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

Commit 2b7c481

Browse files
committed
More fixups.
1 parent 3eb9e96 commit 2b7c481

6 files changed

Lines changed: 20 additions & 12 deletions

File tree

.gitlab-ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ build:coreneuron+nmodl:gpu:
9393
SPACK_PACKAGE: coreneuron
9494
# +report pulls in a lot of dependencies and the tests fail.
9595
# See https://github.com/BlueBrain/CoreNeuron/issues/518 re: build_type
96-
SPACK_PACKAGE_SPEC: +nmodl+openmp+gpu+tests~legacy-unit~report build_type=RelWithDebInfo
96+
SPACK_PACKAGE_SPEC: +nmodl+openmp+gpu+tests~legacy-unit~report+sympy build_type=RelWithDebInfo
9797
extends:
9898
- .spack_build
9999
- .spack_nvhpc
@@ -104,7 +104,8 @@ build:coreneuron+nmodl~openmp:gpu:
104104
SPACK_PACKAGE: coreneuron
105105
# +report pulls in a lot of dependencies and the tests fail.
106106
# See https://github.com/BlueBrain/CoreNeuron/issues/518 re: build_type
107-
SPACK_PACKAGE_SPEC: +nmodl~openmp+gpu+tests~legacy-unit~report build_type=RelWithDebInfo
107+
# Sympy + OpenMP target offload does not currently work with NVHPC
108+
SPACK_PACKAGE_SPEC: +nmodl~openmp+gpu+tests~legacy-unit~report~sympy build_type=RelWithDebInfo
108109
extends:
109110
- .spack_build
110111
- .spack_nvhpc
@@ -178,7 +179,7 @@ build:neuron+nmodl~openmp:gpu:
178179
# Build py-cython and py-numpy with GCC instead of NVHPC.
179180
- SPACK_PACKAGE_DEPENDENCIES="${SPACK_PACKAGE_DEPENDENCIES}^py-cython%gcc^py-numpy%gcc"
180181
- !reference [.spack_build, before_script]
181-
needs: ["build:coreneuron+nmodl:gpu"]
182+
needs: ["build:coreneuron+nmodl~openmp:gpu"]
182183

183184
build:neuron:gpu:
184185
stage: build_neuron

coreneuron/mechanism/mech/mod2c_core_thread.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ extern void* nrn_cons_sparseobj(SPFUN, int, Memb_list*, _threadargsproto_);
100100
extern void _nrn_destroy_sparseobj_thread(SparseObj* so);
101101

102102
nrn_pragma_acc(routine seq)
103+
nrn_pragma_omp(declare target)
103104
extern int nrn_kinetic_steer(int, SparseObj*, double*, _threadargsproto_);
105+
nrn_pragma_omp(end declare target)
104106
#define spfun(arg1, arg2, arg3) nrn_kinetic_steer(arg1, arg2, arg3, _threadargs_);
105107

106108
// derived from nrn/src/scopmath/euler.c
@@ -119,6 +121,7 @@ static inline int euler_thread(int neqn, int* var, int* der, DIFUN fun, _threada
119121
return 0;
120122
}
121123

124+
nrn_pragma_omp(declare target)
122125
nrn_pragma_acc(routine seq)
123126
extern int derivimplicit_thread(int, int*, int*, DIFUN, _threadargsproto_);
124127
nrn_pragma_acc(routine seq)
@@ -141,6 +144,7 @@ nrn_pragma_acc(routine seq)
141144
extern double _modl_get_dt_thread(NrnThread*);
142145
nrn_pragma_acc(routine seq)
143146
extern void _modl_set_dt_thread(double, NrnThread*);
147+
nrn_pragma_omp(end declare target)
144148

145149
void nrn_sparseobj_copyto_device(SparseObj* so);
146150
void nrn_sparseobj_delete_from_device(SparseObj* so);

coreneuron/mechanism/membfunc.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ extern void nrn2ncs_outputevent(int netcon_output_index, double firetime);
179179
extern bool nrn_use_localgid_;
180180
extern void net_sem_from_gpu(int sendtype, int i_vdata, int, int ith, int ipnt, double, double);
181181
nrn_pragma_acc(routine seq)
182+
nrn_pragma_omp(declare target)
182183
extern int at_time(NrnThread*, double);
184+
nrn_pragma_omp(end declare target)
183185

184186
// _OPENACC and/or NET_RECEIVE_BUFFERING
185187
extern void net_sem_from_gpu(int, int, int, int, int, double, double);

coreneuron/utils/ivocvect.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef ivoc_vector_h
1010
#define ivoc_vector_h
1111

12+
#include "coreneuron/utils/offload.hpp"
13+
1214
#include <cstdio>
1315
#include <utility>
1416

@@ -76,9 +78,9 @@ extern double* vector_vec(IvocVect* v);
7678

7779
// retro-compatibility API
7880
extern void* vector_new1(int n);
79-
#pragma acc routine seq
81+
nrn_pragma_acc(routine seq)
8082
extern int vector_capacity(void* v);
81-
#pragma acc routine seq
83+
nrn_pragma_acc(routine seq)
8284
extern double* vector_vec(void* v);
8385

8486
} // namespace coreneuron

coreneuron/utils/randoms/nrnran123.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ of the full distribution available from
3737
#define R123_USE_GNU_UINT128 1
3838
#endif
3939

40+
#include "coreneuron/utils/offload.hpp"
41+
4042
#include <Random123/philox.h>
4143
#include <inttypes.h>
4244

@@ -46,12 +48,7 @@ of the full distribution available from
4648
#define CORENRN_HOST_DEVICE
4749
#endif
4850

49-
// Is there actually any harm leaving the pragma in when DISABLE_OPENACC is true?
50-
#if defined(_OPENACC) && !defined(DISABLE_OPENACC)
51-
#define CORENRN_HOST_DEVICE_ACC CORENRN_HOST_DEVICE _Pragma("acc routine seq")
52-
#else
53-
#define CORENRN_HOST_DEVICE_ACC CORENRN_HOST_DEVICE
54-
#endif
51+
#define CORENRN_HOST_DEVICE_ACC CORENRN_HOST_DEVICE nrn_pragma_acc(routine seq)
5552

5653
// Some files are compiled with DISABLE_OPENACC, and some builds have no GPU
5754
// support at all. In these two cases, request that the random123 state is
@@ -100,6 +97,7 @@ void nrnran123_deletestream(nrnran123_State* s,
10097
bool use_unified_memory = CORENRN_RAN123_USE_UNIFIED_MEMORY);
10198

10299
/* minimal data stream */
100+
nrn_pragma_omp(declare target)
103101
CORENRN_HOST_DEVICE_ACC void nrnran123_getseq(nrnran123_State*, uint32_t* seq, char* which);
104102
CORENRN_HOST_DEVICE_ACC void nrnran123_getids(nrnran123_State*, uint32_t* id1, uint32_t* id2);
105103
CORENRN_HOST_DEVICE_ACC void nrnran123_getids3(nrnran123_State*,
@@ -128,6 +126,7 @@ CORENRN_HOST_DEVICE_ACC nrnran123_array4x32 nrnran123_iran(uint32_t seq,
128126
uint32_t id1,
129127
uint32_t id2);
130128
CORENRN_HOST_DEVICE_ACC double nrnran123_uint2dbl(uint32_t);
129+
nrn_pragma_omp(end declare target)
131130
} // namespace coreneuron
132131

133132
#endif

0 commit comments

Comments
 (0)