| 51 | } |
| 52 | |
| 53 | void* |
| 54 | PArena::alloc (std::size_t nbytes) |
| 55 | { |
| 56 | #if defined(AMREX_USE_GPU) |
| 57 | |
| 58 | #if defined(AMREX_GPU_STREAM_ALLOC_SUPPORT) |
| 59 | if (Gpu::Device::memoryPoolsSupported()) { |
| 60 | void* p; |
| 61 | AMREX_HIP_OR_CUDA( |
| 62 | AMREX_HIP_SAFE_CALL(hipMallocAsync(&p, nbytes, m_pool, Gpu::gpuStream()));, |
| 63 | AMREX_CUDA_SAFE_CALL(cudaMallocAsync(&p, nbytes, m_pool, Gpu::gpuStream())); |
| 64 | ) |
| 65 | m_profiler.profile_alloc(p, nbytes); |
| 66 | return p; |
| 67 | } else |
| 68 | #endif |
| 69 | { |
| 70 | return The_Arena()->alloc(nbytes); |
| 71 | } |
| 72 | |
| 73 | #elif defined(AMREX_USE_OMP) |
| 74 | |
| 75 | if (omp_in_parallel()) { |
| 76 | return amrex_mempool_alloc(nbytes); |
| 77 | } else { |
| 78 | return The_Arena()->alloc(nbytes); |
| 79 | } |
| 80 | |
| 81 | #else |
| 82 | |
| 83 | return The_Arena()->alloc(nbytes); |
| 84 | |
| 85 | #endif |
| 86 | } |
| 87 | |
| 88 | void |
| 89 | PArena::free (void* p) |
nothing calls this directly
no test coverage detected