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

Commit

Permalink
Update voltage vector from GPU to CPU if trajectories are recorded (#357
Browse files Browse the repository at this point in the history
)

  - NEURON can request various trajectories from CoreNEURON
  - In this implementation we are just updating voltage vector
    and satisfy the use case of olfactory 3d-bulb model
  - We will need more fine grain approach (for future PR)
  • Loading branch information
pramodk authored Aug 9, 2020
1 parent b1ee4fa commit a56aa84
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions coreneuron/gpu/nrn_acc_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,21 @@ void update_nrnthreads_on_device(NrnThread* threads, int nthreads) {
#endif
}

/**
* Copy voltage vector from GPU to CPU
*
* \todo Currently we are copying all voltage vector from GPU
* to CPU. We need fine-grain implementation to copy
* only requested portion of the voltage vector.
*/
void update_voltage_from_gpu(NrnThread* nt) {
if (nt->compute_gpu && nt->end > 0) {
double* voltage = nt->_actual_v;
int num_voltage = nrn_soa_padded_size(nt->end, 0);
#pragma acc update host(voltage[0 : num_voltage])
}
}

void update_matrix_from_gpu(NrnThread* _nt) {
#ifdef _OPENACC
if (_nt->compute_gpu && (_nt->end > 0)) {
Expand Down
1 change: 1 addition & 0 deletions coreneuron/gpu/nrn_acc_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ void update_matrix_to_gpu(NrnThread* _nt);
void update_net_receive_buffer(NrnThread* _nt);
void realloc_net_receive_buffer(NrnThread* nt, Memb_list* ml);
void update_net_send_buffer_on_host(NrnThread* nt, NetSendBuffer_t* nsb);
void update_voltage_from_gpu(NrnThread* nt);
void init_gpu();

} // namespace coreneuron
Expand Down
5 changes: 5 additions & 0 deletions coreneuron/sim/fadvance_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ void nrncore2nrn_send_values(NrnThread* nth) {

TrajectoryRequests* tr = nth->trajec_requests;
if (tr) {
// \todo Check if user has requested voltages for this NrnThread object.
// Currently we are updating voltages if there is any trajectory
// requested by NEURON.
update_voltage_from_gpu(nth);

if (tr->varrays) { // full trajectories into Vector data
double** va = tr->varrays;
int vs = tr->vsize++;
Expand Down

0 comments on commit a56aa84

Please sign in to comment.