From a8958d104dfacff35209ebb2c295a85e4355a960 Mon Sep 17 00:00:00 2001 From: Pramod Kumbhar Date: Thu, 9 Dec 2021 19:42:51 -0500 Subject: [PATCH] free should happen after omp_target_disassociate_ptr --- coreneuron/gpu/nrn_acc_manager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/coreneuron/gpu/nrn_acc_manager.cpp b/coreneuron/gpu/nrn_acc_manager.cpp index fe11d3702..ee8b868a4 100644 --- a/coreneuron/gpu/nrn_acc_manager.cpp +++ b/coreneuron/gpu/nrn_acc_manager.cpp @@ -83,9 +83,8 @@ void cnrn_target_delete(void* h_ptr, size_t len) { { d_ptr = h_ptr; } - // todo: disassociate first or free first - omp_target_free(d_ptr, device_id); omp_target_disassociate_ptr(h_ptr, device_id); + omp_target_free(d_ptr, device_id); #else throw std::runtime_error("cnrn_target_delete() not implemented without OpenACC/OpenMP and gpu build"); #endif