Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 0 additions & 130 deletions coreneuron/gpu/nrn_acc_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,136 +858,6 @@ void update_nrnthreads_on_host(NrnThread* threads, int nthreads) {
#endif
}

void update_nrnthreads_on_device(NrnThread* threads, int nthreads) {
#ifdef _OPENACC

for (int i = 0; i < nthreads; i++) {
NrnThread* nt = threads + i;

if (nt->compute_gpu && (nt->end > 0)) {
/* -- copy data to device -- */

int ne = nrn_soa_padded_size(nt->end, 0);

nrn_pragma_acc(update device(
nt->_actual_rhs[:ne],
nt->_actual_d[:ne],
nt->_actual_a[:ne],
nt->_actual_b[:ne],
nt->_actual_v[:ne],
nt->_actual_area[:ne]))
nrn_pragma_omp(target update to(
nt->_actual_rhs[:ne],
nt->_actual_d[:ne],
nt->_actual_a[:ne],
nt->_actual_b[:ne],
nt->_actual_v[:ne],
nt->_actual_area[:ne]))

nrn_pragma_acc(update device(nt->_actual_diam[:ne]) if (nt->_actual_diam != nullptr))
nrn_pragma_omp(target update to(nt->_actual_diam[:ne]) if (nt->_actual_diam != nullptr))

/* @todo: nt._ml_list[tml->index] = tml->ml; */

/* -- copy NrnThreadMembList list ml to host -- */
for (auto tml = nt->tml; tml; tml = tml->next) {
Memb_list* ml = tml->ml;
int type = tml->index;
int n = ml->nodecount;
int szp = corenrn.get_prop_param_size()[type];
int szdp = corenrn.get_prop_dparam_size()[type];

int pcnt = nrn_soa_padded_size(n, SOA_LAYOUT) * szp;

nrn_pragma_acc(update device(ml->data[:pcnt]))
nrn_pragma_omp(target update to(ml->data[:pcnt]))

nrn_pragma_acc(update device(ml->nodeindices[:n])
if (!corenrn.get_is_artificial()[type]))
nrn_pragma_omp(target update to(ml->nodeindices[:n])
if (!corenrn.get_is_artificial()[type]))
int dpcnt = nrn_soa_padded_size(n, SOA_LAYOUT) * szdp;
nrn_pragma_acc(update device(ml->pdata[:dpcnt]) if (szdp))
nrn_pragma_omp(target update to(ml->pdata[:dpcnt]) if (szdp))

auto nrb = tml->ml->_net_receive_buffer;
nrn_pragma_acc(update device(nrb->_cnt,
nrb->_size,
nrb->_pnt_offset,
nrb->_displ_cnt,
nrb->_pnt_index[:nrb->_size],
nrb->_weight_index[:nrb->_size],
nrb->_displ[:nrb->_size],
nrb->_nrb_index[:nrb->_size])
if (nrb != nullptr))
nrn_pragma_omp(target update to(nrb->_cnt,
nrb->_size,
nrb->_pnt_offset,
nrb->_displ_cnt,
nrb->_pnt_index[:nrb->_size],
nrb->_weight_index[:nrb->_size],
nrb->_displ[:nrb->_size],
nrb->_nrb_index[:nrb->_size])
if (nrb != nullptr))
}
int pcnt = nrn_soa_padded_size(nt->shadow_rhs_cnt, 0);
/* copy shadow_rhs to host */
nrn_pragma_acc(update device(nt->_shadow_rhs[:pcnt],
/* copy shadow_d to host */
nt->_shadow_d[:pcnt])
if (nt->shadow_rhs_cnt))
nrn_pragma_omp(target update to(nt->_shadow_rhs[:pcnt],
/* copy shadow_d to host */
nt->_shadow_d[:pcnt])
if (nt->shadow_rhs_cnt))


nrn_pragma_acc(update device(nt->nrn_fast_imem->nrn_sav_rhs[:nt->end],
nt->nrn_fast_imem->nrn_sav_d[:nt->end])
if (nt->nrn_fast_imem != nullptr))
nrn_pragma_omp(target update to(nt->nrn_fast_imem->nrn_sav_rhs[:nt->end],
nt->nrn_fast_imem->nrn_sav_d[:nt->end])
if (nt->nrn_fast_imem != nullptr))

nrn_pragma_acc(update device(nt->pntprocs[:nt->n_pntproc])
if (nt->n_pntproc))
nrn_pragma_omp(target update to(nt->pntprocs[:nt->n_pntproc])
if (nt->n_pntproc))

nrn_pragma_acc(update device(nt->weights[:nt->n_weight]) if (nt->n_weight))
nrn_pragma_omp(target update to(nt->weights[:nt->n_weight]) if (nt->n_weight))

nrn_pragma_acc(update device(nt->presyns_helper[:nt->n_presyn],
nt->presyns[:nt->n_presyn])
if (nt->n_presyn))
nrn_pragma_omp(target update to(nt->presyns_helper[:nt->n_presyn],
nt->presyns[:nt->n_presyn])
if (nt->n_presyn))

{
TrajectoryRequests* tr = nt->trajec_requests;
if (tr && tr->varrays) {
// The full buffers have `bsize` entries, but only `vsize`
// of them are valid.
for (int i = 0; i < tr->n_trajec; ++i) {
nrn_pragma_acc(update device(tr->varrays[i][:tr->vsize]))
nrn_pragma_omp(target update to(tr->varrays[i][:tr->vsize]))
}
}
}

/* don't and don't update vdata, its pointer array
nrn_pragma_acc(update device(nt->_vdata[:nt->_nvdata) if nt->_nvdata)
nrn_pragma_omp(target update tp(nt->_vdata[:nt->_nvdata) if (nt->_nvdata))
*/
}
}
#else
(void) threads;
(void) nthreads;
#endif
}

/**
* Copy weights from GPU to CPU
*
Expand Down
6 changes: 3 additions & 3 deletions coreneuron/gpu/nrn_acc_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ namespace coreneuron {
void setup_nrnthreads_on_device(NrnThread* threads, int nthreads);
void delete_nrnthreads_on_device(NrnThread* threads, int nthreads);
void update_nrnthreads_on_host(NrnThread* threads, int nthreads);
void update_nrnthreads_on_device(NrnThread* threads, int nthreads);
void modify_data_on_device(NrnThread* threads, int nthreads);
void dump_nt_to_file(char* filename, NrnThread* threads, int nthreads);

void update_net_receive_buffer(NrnThread* _nt);

// Called by NModl
void realloc_net_receive_buffer(NrnThread* nt, Memb_list* ml);
void update_net_send_buffer_on_host(NrnThread* nt, NetSendBuffer_t* nsb);

void update_weights_from_gpu(NrnThread* threads, int nthreads);
void init_gpu();

Expand Down