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

Commit 4f6675e

Browse files
committed
Fixed clang-format
1 parent b8ce888 commit 4f6675e

File tree

6 files changed

+43
-22
lines changed

6 files changed

+43
-22
lines changed

coreneuron/network/netcvode.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,10 @@ void NetCvode::check_thresh(NrnThread* nt) { // for default method
533533

534534
nrn_pragma_acc(parallel loop present(
535535
nt [0:1], presyns_helper [0:nt->n_presyn], presyns [0:nt->n_presyn], actual_v [0:nt->end])
536-
copy(net_send_buf_count) if (nt->compute_gpu) async(nt->streams[nt->stream_id]))
537-
nrn_pragma_omp(target teams distribute parallel for map(tofrom: net_send_buf_count) if(nt->compute_gpu) depend(inout: nt->streams[nt->stream_id]) nowait)
536+
copy(net_send_buf_count) if (nt->compute_gpu)
537+
async(nt->streams[nt->stream_id]))
538+
nrn_pragma_omp(target teams distribute parallel for map(tofrom: net_send_buf_count)
539+
if(nt->compute_gpu) depend(inout: nt->streams[nt->stream_id]) nowait)
538540
for (int i = 0; i < nt->ncell; ++i) {
539541
PreSyn* ps = presyns + i;
540542
PreSynHelper* psh = presyns_helper + i;
@@ -569,9 +571,13 @@ void NetCvode::check_thresh(NrnThread* nt) { // for default method
569571
#ifdef CORENEURON_ENABLE_GPU
570572
int* nsbuffer = nt->_net_send_buffer;
571573
#endif
572-
nrn_pragma_acc(update host(nsbuffer [0:nt->_net_send_buffer_cnt]) async(nt->streams[nt->stream_id]))
574+
nrn_pragma_acc(update host(nsbuffer [0:nt->_net_send_buffer_cnt])
575+
async(nt->streams[nt->stream_id]))
573576
nrn_pragma_acc(wait async(nt->streams[nt->stream_id]))
574-
nrn_pragma_omp(target update from(nsbuffer [0:nt->_net_send_buffer_cnt]) depend(inout: nt->streams[nt->stream_id]) nowait)
577+
// clang-format off
578+
nrn_pragma_omp(target update from(nsbuffer [0:nt->_net_send_buffer_cnt])
579+
depend(inout: nt->streams[nt->stream_id]) nowait)
580+
// clang-format on
575581
nrn_pragma_omp(taskwait)
576582
}
577583

coreneuron/network/partrans.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ void nrnmpi_v_transfer() {
6363
}
6464
nrn_pragma_acc(update host(src_gather [0:n_src_gather]) if (nt->compute_gpu)
6565
async(nt->streams[nt->stream_id]))
66-
nrn_pragma_omp(target update from(src_gather [0:n_src_gather]) if (nt->compute_gpu) depend(inout: nt->streams[nt->stream_id]) nowait)
66+
// clang-format off
67+
nrn_pragma_omp(target update from(src_gather [0:n_src_gather]) if (nt->compute_gpu)
68+
depend(inout: nt->streams[nt->stream_id]) nowait)
69+
// clang-format on
6770
}
6871

6972
// copy gathered source values to outsrc_buf_

coreneuron/permute/cellorder.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -600,14 +600,18 @@ void solve_interleaved2(int ith) {
600600
defined(_OPENACC)
601601
int nstride = stridedispl[nwarp];
602602
#endif
603-
nrn_pragma_acc(parallel loop gang vector vector_length(
604-
warpsize) present(nt [0:1],
605-
strides [0:nstride],
606-
ncycles [0:nwarp],
607-
stridedispl [0:nwarp + 1],
608-
rootbegin [0:nwarp + 1],
609-
nodebegin [0:nwarp + 1]) if (nt->compute_gpu) async(nt->streams[nt->stream_id]))
610-
nrn_pragma_omp(target teams distribute parallel for simd if(nt->compute_gpu) depend(inout: nt->streams[nt->stream_id]) nowait)
603+
nrn_pragma_acc(parallel loop gang vector vector_length(warpsize)
604+
present(nt [0:1],
605+
strides [0:nstride],
606+
ncycles [0:nwarp],
607+
stridedispl [0:nwarp + 1],
608+
rootbegin [0:nwarp + 1],
609+
nodebegin [0:nwarp + 1]) if (nt->compute_gpu)
610+
async(nt->streams[nt->stream_id]))
611+
// clang-format off
612+
nrn_pragma_omp(target teams distribute parallel for simd if(nt->compute_gpu)
613+
depend(inout: nt->streams[nt->stream_id]) nowait)
614+
// clang-format on
611615
for (int icore = 0; icore < ncore; ++icore) {
612616
int iwarp = icore / warpsize; // figure out the >> value
613617
int ic = icore & (warpsize - 1); // figure out the & mask

coreneuron/sim/fadvance_core.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ void nrncore2nrn_send_values(NrnThread* nth) {
317317
double* gather_i = tr->gather[i];
318318
nrn_pragma_acc(update self(gather_i [0:1]) if (nth->compute_gpu)
319319
async(nth->streams[nth->stream_id]))
320-
nrn_pragma_omp(target update from(gather_i [0:1]) if (nth->compute_gpu) depend(inout: nth->streams[nth->stream_id]) nowait)
320+
// clang-format off
321+
nrn_pragma_omp(target update from(gather_i [0:1]) if (nth->compute_gpu)
322+
depend(inout: nth->streams[nth->stream_id]) nowait)
323+
// clang-format on
321324
}
322325
nrn_pragma_acc(wait async(nth->streams[nth->stream_id]))
323326
for (int i = 0; i < tr->n_trajec; ++i) {
@@ -341,7 +344,8 @@ static void* nrn_fixed_step_thread(NrnThread* nth) {
341344
if (nth->ncell) {
342345
/*@todo: do we need to update nth->_t on GPU: Yes (Michael, but can
343346
launch kernel) */
344-
nrn_pragma_acc(update device(nth->_t) if (nth->compute_gpu) async(nth->streams[nth->stream_id]))
347+
nrn_pragma_acc(update device(nth->_t) if (nth->compute_gpu)
348+
async(nth->streams[nth->stream_id]))
345349
nrn_pragma_acc(wait async(nth->streams[nth->stream_id]))
346350
nrn_pragma_omp(target update to(nth->_t) if (nth->compute_gpu))
347351
fixed_play_continuous(nth);
@@ -377,7 +381,8 @@ void* nrn_fixed_step_lastpart(NrnThread* nth) {
377381

378382
if (nth->ncell) {
379383
/*@todo: do we need to update nth->_t on GPU */
380-
nrn_pragma_acc(update device(nth->_t) if (nth->compute_gpu) async(nth->streams[nth->stream_id]))
384+
nrn_pragma_acc(update device(nth->_t) if (nth->compute_gpu)
385+
async(nth->streams[nth->stream_id]))
381386
nrn_pragma_acc(wait async(nth->streams[nth->stream_id]))
382387
nrn_pragma_omp(target update to(nth->_t) if (nth->compute_gpu))
383388
fixed_play_continuous(nth);

coreneuron/sim/multicore.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,11 @@ struct NrnThread: public MemoryManaged {
130130

131131
NrnThreadBAList* tbl[BEFORE_AFTER_SIZE]; /* wasteful since almost all empty */
132132

133-
int shadow_rhs_cnt = 0; /* added to facilitate the NrnThread transfer to GPU */
134-
int compute_gpu = 0; /* define whether to compute with gpus */
135-
int stream_id = 0; /* define where the kernel will be launched on GPU stream */
136-
std::vector<int> streams; /* vector of stream ids needed for async execution of OpenMP in multiple streams */
133+
int shadow_rhs_cnt = 0; /* added to facilitate the NrnThread transfer to GPU */
134+
int compute_gpu = 0; /* define whether to compute with gpus */
135+
int stream_id = 0; /* define where the kernel will be launched on GPU stream */
136+
std::vector<int> streams; /* vector of stream ids needed for async execution of OpenMP in
137+
multiple streams */
137138
int _net_send_buffer_size = 0;
138139
int _net_send_buffer_cnt = 0;
139140
int* _net_send_buffer = nullptr;

coreneuron/sim/treeset_core.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ static void nrn_lhs(NrnThread* _nt) {
152152
so here we transform so it only has membrane current contribution
153153
*/
154154
double* p = _nt->nrn_fast_imem->nrn_sav_d;
155-
nrn_pragma_acc(parallel loop present(p, vec_d) if (_nt->compute_gpu) async(_nt->streams[_nt->stream_id]))
156-
nrn_pragma_omp(target teams distribute parallel for if(_nt->compute_gpu) depend(inout: _nt->streams[_nt->stream_id]) nowait)
155+
nrn_pragma_acc(parallel loop present(p, vec_d) if (_nt->compute_gpu)
156+
async(_nt->streams[_nt->stream_id]))
157+
nrn_pragma_omp(target teams distribute parallel for if(_nt->compute_gpu)
158+
depend(inout: _nt->streams[_nt->stream_id]) nowait)
157159
for (int i = i1; i < i3; ++i) {
158160
p[i] += vec_d[i];
159161
}

0 commit comments

Comments
 (0)