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

Commit 78081b4

Browse files
author
Nicolas Cornu
authored
Remove unused GPU code (#711)
We prefer selective host-to-device updates.
1 parent 0fe815e commit 78081b4

File tree

2 files changed

+3
-133
lines changed

2 files changed

+3
-133
lines changed

coreneuron/gpu/nrn_acc_manager.cpp

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -858,136 +858,6 @@ void update_nrnthreads_on_host(NrnThread* threads, int nthreads) {
858858
#endif
859859
}
860860

861-
void update_nrnthreads_on_device(NrnThread* threads, int nthreads) {
862-
#ifdef _OPENACC
863-
864-
for (int i = 0; i < nthreads; i++) {
865-
NrnThread* nt = threads + i;
866-
867-
if (nt->compute_gpu && (nt->end > 0)) {
868-
/* -- copy data to device -- */
869-
870-
int ne = nrn_soa_padded_size(nt->end, 0);
871-
872-
nrn_pragma_acc(update device(
873-
nt->_actual_rhs[:ne],
874-
nt->_actual_d[:ne],
875-
nt->_actual_a[:ne],
876-
nt->_actual_b[:ne],
877-
nt->_actual_v[:ne],
878-
nt->_actual_area[:ne]))
879-
nrn_pragma_omp(target update to(
880-
nt->_actual_rhs[:ne],
881-
nt->_actual_d[:ne],
882-
nt->_actual_a[:ne],
883-
nt->_actual_b[:ne],
884-
nt->_actual_v[:ne],
885-
nt->_actual_area[:ne]))
886-
887-
nrn_pragma_acc(update device(nt->_actual_diam[:ne]) if (nt->_actual_diam != nullptr))
888-
nrn_pragma_omp(target update to(nt->_actual_diam[:ne]) if (nt->_actual_diam != nullptr))
889-
890-
/* @todo: nt._ml_list[tml->index] = tml->ml; */
891-
892-
/* -- copy NrnThreadMembList list ml to host -- */
893-
for (auto tml = nt->tml; tml; tml = tml->next) {
894-
Memb_list* ml = tml->ml;
895-
int type = tml->index;
896-
int n = ml->nodecount;
897-
int szp = corenrn.get_prop_param_size()[type];
898-
int szdp = corenrn.get_prop_dparam_size()[type];
899-
900-
int pcnt = nrn_soa_padded_size(n, SOA_LAYOUT) * szp;
901-
902-
nrn_pragma_acc(update device(ml->data[:pcnt]))
903-
nrn_pragma_omp(target update to(ml->data[:pcnt]))
904-
905-
nrn_pragma_acc(update device(ml->nodeindices[:n])
906-
if (!corenrn.get_is_artificial()[type]))
907-
nrn_pragma_omp(target update to(ml->nodeindices[:n])
908-
if (!corenrn.get_is_artificial()[type]))
909-
int dpcnt = nrn_soa_padded_size(n, SOA_LAYOUT) * szdp;
910-
nrn_pragma_acc(update device(ml->pdata[:dpcnt]) if (szdp))
911-
nrn_pragma_omp(target update to(ml->pdata[:dpcnt]) if (szdp))
912-
913-
auto nrb = tml->ml->_net_receive_buffer;
914-
nrn_pragma_acc(update device(nrb->_cnt,
915-
nrb->_size,
916-
nrb->_pnt_offset,
917-
nrb->_displ_cnt,
918-
nrb->_pnt_index[:nrb->_size],
919-
nrb->_weight_index[:nrb->_size],
920-
nrb->_displ[:nrb->_size],
921-
nrb->_nrb_index[:nrb->_size])
922-
if (nrb != nullptr))
923-
nrn_pragma_omp(target update to(nrb->_cnt,
924-
nrb->_size,
925-
nrb->_pnt_offset,
926-
nrb->_displ_cnt,
927-
nrb->_pnt_index[:nrb->_size],
928-
nrb->_weight_index[:nrb->_size],
929-
nrb->_displ[:nrb->_size],
930-
nrb->_nrb_index[:nrb->_size])
931-
if (nrb != nullptr))
932-
}
933-
int pcnt = nrn_soa_padded_size(nt->shadow_rhs_cnt, 0);
934-
/* copy shadow_rhs to host */
935-
nrn_pragma_acc(update device(nt->_shadow_rhs[:pcnt],
936-
/* copy shadow_d to host */
937-
nt->_shadow_d[:pcnt])
938-
if (nt->shadow_rhs_cnt))
939-
nrn_pragma_omp(target update to(nt->_shadow_rhs[:pcnt],
940-
/* copy shadow_d to host */
941-
nt->_shadow_d[:pcnt])
942-
if (nt->shadow_rhs_cnt))
943-
944-
945-
nrn_pragma_acc(update device(nt->nrn_fast_imem->nrn_sav_rhs[:nt->end],
946-
nt->nrn_fast_imem->nrn_sav_d[:nt->end])
947-
if (nt->nrn_fast_imem != nullptr))
948-
nrn_pragma_omp(target update to(nt->nrn_fast_imem->nrn_sav_rhs[:nt->end],
949-
nt->nrn_fast_imem->nrn_sav_d[:nt->end])
950-
if (nt->nrn_fast_imem != nullptr))
951-
952-
nrn_pragma_acc(update device(nt->pntprocs[:nt->n_pntproc])
953-
if (nt->n_pntproc))
954-
nrn_pragma_omp(target update to(nt->pntprocs[:nt->n_pntproc])
955-
if (nt->n_pntproc))
956-
957-
nrn_pragma_acc(update device(nt->weights[:nt->n_weight]) if (nt->n_weight))
958-
nrn_pragma_omp(target update to(nt->weights[:nt->n_weight]) if (nt->n_weight))
959-
960-
nrn_pragma_acc(update device(nt->presyns_helper[:nt->n_presyn],
961-
nt->presyns[:nt->n_presyn])
962-
if (nt->n_presyn))
963-
nrn_pragma_omp(target update to(nt->presyns_helper[:nt->n_presyn],
964-
nt->presyns[:nt->n_presyn])
965-
if (nt->n_presyn))
966-
967-
{
968-
TrajectoryRequests* tr = nt->trajec_requests;
969-
if (tr && tr->varrays) {
970-
// The full buffers have `bsize` entries, but only `vsize`
971-
// of them are valid.
972-
for (int i = 0; i < tr->n_trajec; ++i) {
973-
nrn_pragma_acc(update device(tr->varrays[i][:tr->vsize]))
974-
nrn_pragma_omp(target update to(tr->varrays[i][:tr->vsize]))
975-
}
976-
}
977-
}
978-
979-
/* don't and don't update vdata, its pointer array
980-
nrn_pragma_acc(update device(nt->_vdata[:nt->_nvdata) if nt->_nvdata)
981-
nrn_pragma_omp(target update tp(nt->_vdata[:nt->_nvdata) if (nt->_nvdata))
982-
*/
983-
}
984-
}
985-
#else
986-
(void) threads;
987-
(void) nthreads;
988-
#endif
989-
}
990-
991861
/**
992862
* Copy weights from GPU to CPU
993863
*

coreneuron/gpu/nrn_acc_manager.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ namespace coreneuron {
1919
void setup_nrnthreads_on_device(NrnThread* threads, int nthreads);
2020
void delete_nrnthreads_on_device(NrnThread* threads, int nthreads);
2121
void update_nrnthreads_on_host(NrnThread* threads, int nthreads);
22-
void update_nrnthreads_on_device(NrnThread* threads, int nthreads);
23-
void modify_data_on_device(NrnThread* threads, int nthreads);
24-
void dump_nt_to_file(char* filename, NrnThread* threads, int nthreads);
2522

2623
void update_net_receive_buffer(NrnThread* _nt);
24+
25+
// Called by NModl
2726
void realloc_net_receive_buffer(NrnThread* nt, Memb_list* ml);
2827
void update_net_send_buffer_on_host(NrnThread* nt, NetSendBuffer_t* nsb);
28+
2929
void update_weights_from_gpu(NrnThread* threads, int nthreads);
3030
void init_gpu();
3131

0 commit comments

Comments
 (0)