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

Commit 55d5605

Browse files
committed
Implement omp_get_mapped_ptr until it is available
omp_get_mapped_ptr is only for omp >= 5.1 gcc and clang still does not implement it
1 parent 4b9af99 commit 55d5605

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

coreneuron/gpu/nrn_acc_manager.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,15 @@ T* cnrn_target_deviceptr(const T* h_ptr) {
4848
#if defined(CORENEURON_ENABLE_GPU) && !defined(CORENEURON_PREFER_OPENMP_OFFLOAD) && defined(_OPENACC)
4949
return acc_deviceptr(const_cast<T*>(h_ptr));
5050
#elif defined(CORENEURON_ENABLE_GPU) && defined(CORENEURON_PREFER_OPENMP_OFFLOAD) && defined(_OPENMP)
51-
return static_cast<T*>(omp_get_mapped_ptr(const_cast<T*>(h_ptr), omp_get_default_device()));
51+
T* _h_ptr = const_cast<T*>(h_ptr);
52+
T *d_ptr = nullptr;
53+
54+
nrn_pragma_omp(target data use_device_ptr(_h_ptr))
55+
{
56+
d_ptr = _h_ptr;
57+
}
58+
59+
return d_ptr;
5260
#else
5361
throw std::runtime_error("cnrn_target_deviceptr() not implemented without OpenACC/OpenMP and gpu build");
5462
#endif

0 commit comments

Comments
 (0)