Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Use CORENEURON_PREFER_OPENMP_OFFLOAD.
Browse files Browse the repository at this point in the history
  • Loading branch information
olupton committed Dec 10, 2021
1 parent 52711dc commit 89a1e20
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMake/OpenAccHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if(CORENRN_ENABLE_GPU)
if(CORENRN_ENABLE_OPENMP AND CORENRN_ENABLE_OPENMP_OFFLOAD)
# Enable OpenMP target offload to GPU and if both OpenACC and OpenMP directives are available
# for a region then prefer OpenMP.
add_compile_definitions(CORENRN_PREFER_OPENMP_OFFLOAD)
add_compile_definitions(CORENEURON_PREFER_OPENMP_OFFLOAD)
endif()

elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
Expand Down
4 changes: 2 additions & 2 deletions coreneuron/gpu/nrn_acc_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#ifdef _OPENACC
#include <openacc.h>
#endif
#ifdef CORENRN_PREFER_OPENMP_OFFLOAD
#ifdef CORENEURON_PREFER_OPENMP_OFFLOAD
#include <omp.h>
#endif

Expand Down Expand Up @@ -1435,7 +1435,7 @@ void init_gpu() {

int device_num = local_rank % num_devices_per_node;
acc_set_device_num(device_num, device_type);
#ifdef CORENRN_PREFER_OPENMP_OFFLOAD
#ifdef CORENEURON_PREFER_OPENMP_OFFLOAD
omp_set_default_device(device_num);
#endif

Expand Down
2 changes: 1 addition & 1 deletion coreneuron/network/partrans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void nrnthread_v_transfer(NrnThread* _nt) {
int* insrc_indices = ttd.insrc_indices.data();
double* tar_data = _nt->_data;
// last element in the displacement vector gives total length
#if defined(_OPENACC) && !defined(CORENRN_PREFER_OPENMP_OFFLOAD)
#if defined(_OPENACC) && !defined(CORENEURON_PREFER_OPENMP_OFFLOAD)
int n_insrc_buf = insrcdspl_[nrnmpi_numprocs];
int ndata = _nt->_ndata;
#endif
Expand Down
2 changes: 1 addition & 1 deletion coreneuron/permute/cellorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ void solve_interleaved2(int ith) {
int* strides = ii.stride; // sum ncycles of these (bad since ncompart/warpsize)
int* rootbegin = ii.firstnode; // nwarp+1 of these
int* nodebegin = ii.lastnode; // nwarp+1 of these
#if defined(_OPENACC) && !defined(CORENRN_PREFER_OPENMP_OFFLOAD)
#if defined(_OPENACC) && !defined(CORENEURON_PREFER_OPENMP_OFFLOAD)
int nstride = stridedispl[nwarp];
#endif
nrn_pragma_acc(parallel loop gang vector vector_length(
Expand Down
4 changes: 2 additions & 2 deletions coreneuron/utils/offload.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include <cstddef>

#define nrn_pragma_stringify(x) #x
#if defined(CORENEURON_ENABLE_GPU) && defined(CORENRN_PREFER_OPENMP_OFFLOAD) && defined(_OPENMP)
#if defined(CORENEURON_ENABLE_GPU) && defined(CORENEURON_PREFER_OPENMP_OFFLOAD) && defined(_OPENMP)
#define nrn_pragma_acc(x)
#define nrn_pragma_omp(x) _Pragma(nrn_pragma_stringify(omp x))
#elif defined(CORENEURON_ENABLE_GPU) && !defined(CORENRN_PREFER_OPENMP_OFFLOAD) && \
#elif defined(CORENEURON_ENABLE_GPU) && !defined(CORENEURON_PREFER_OPENMP_OFFLOAD) && \
defined(_OPENACC)
#define nrn_pragma_acc(x) _Pragma(nrn_pragma_stringify(acc x))
#define nrn_pragma_omp(x)
Expand Down

0 comments on commit 89a1e20

Please sign in to comment.