From 57823dc7f326e60875c0eba771584e3579bc3ee1 Mon Sep 17 00:00:00 2001 From: Pramod Kumbhar Date: Thu, 4 Mar 2021 01:24:41 +0100 Subject: [PATCH] Bug fix for GPU : Patternstim shouldn't be copied from GPU to CPU - patternstim is a special mechanism whose data is not copied on gpu - when we update whole GPU data back to CPU, we should skip the patternstim fixes #503 --- coreneuron/gpu/nrn_acc_manager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coreneuron/gpu/nrn_acc_manager.cpp b/coreneuron/gpu/nrn_acc_manager.cpp index 9b0e74968..4ac6d48cc 100644 --- a/coreneuron/gpu/nrn_acc_manager.cpp +++ b/coreneuron/gpu/nrn_acc_manager.cpp @@ -610,6 +610,12 @@ void update_nrnthreads_on_host(NrnThread* threads, int nthreads) { int is_art = corenrn.get_is_artificial()[type]; int layout = corenrn.get_mech_data_layout()[type]; + // PatternStim is a special mechanim of type artificial cell + // and it's not copied on GPU. So we shouldn't update it from GPU. + if (type == nrn_get_mechtype("PatternStim")) { + continue; + } + int pcnt = nrn_soa_padded_size(n, layout) * szp; acc_update_self(ml->data, pcnt * sizeof(double));