This repository was archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
CoreNEURON does not free GPU buffers allocated for gap junctions #727
Copy link
Copy link
Closed
Labels
Description
Describe the issue
CoreNEURON does not free all GPU memory that it allocates for gap junction handling:
CoreNeuron/coreneuron/network/partrans.cpp
Lines 133 to 174 in 53b0c5f
| /// TODO: Corresponding exit data cluase for OpenACC/OpenMP is missing and hence | |
| /// GPU buffers are not freed. | |
| void nrn_partrans::gap_update_indices() { | |
| // Ensure index vectors, src_gather, and insrc_buf_ are on the gpu. | |
| if (insrcdspl_) { | |
| int n_insrc_buf = insrcdspl_[nrnmpi_numprocs]; | |
| nrn_pragma_acc(enter data create(insrc_buf_ [0:n_insrc_buf]) if (corenrn_param.gpu)) | |
| // clang-format off | |
| nrn_pragma_omp(target enter data map(alloc: insrc_buf_[0:n_insrc_buf]) | |
| if(corenrn_param.gpu)) | |
| // clang-format off | |
| } | |
| for (int tid = 0; tid < nrn_nthread; ++tid) { | |
| TransferThreadData& ttd = transfer_thread_data_[tid]; | |
| size_t n_src_indices = ttd.src_indices.size(); | |
| size_t n_src_gather = ttd.src_gather.size(); | |
| NrnThread* nt = nrn_threads + tid; | |
| if (n_src_indices) { | |
| int* src_indices = ttd.src_indices.data(); | |
| double* src_gather = ttd.src_gather.data(); | |
| nrn_pragma_acc(enter data copyin(src_indices[0:n_src_indices]) if(nt->compute_gpu)) | |
| nrn_pragma_acc(enter data create(src_gather[0:n_src_gather]) if(nt->compute_gpu)) | |
| // clang-format off | |
| nrn_pragma_omp(target enter data map(to: src_indices [0:n_src_indices]) | |
| map(alloc: src_gather[0:n_src_gather]) | |
| if(nt->compute_gpu)) | |
| // clang-format on | |
| } | |
| if (ttd.insrc_indices.size()) { | |
| int* insrc_indices = ttd.insrc_indices.data(); | |
| size_t n_insrc_indices = ttd.insrc_indices.size(); | |
| nrn_pragma_acc( | |
| enter data copyin(insrc_indices [0:n_insrc_indices]) if (nt->compute_gpu)) | |
| // clang-format off | |
| nrn_pragma_omp(target enter data map(to: insrc_indices[0:n_insrc_indices]) | |
| if(nt->compute_gpu)) | |
| // clang-format on | |
| } | |
| } | |
| } |
This could cause problems if we repeatedly run CoreNEURON in a single process, so we should add cleanup code.
Expected behavior
CoreNEURON should clean up after itself.