| 121 | #endif |
| 122 | |
| 123 | void InitializeGraph(int graph_size) |
| 124 | { |
| 125 | amrex::ignore_unused(graph_size); |
| 126 | |
| 127 | #if defined(__CUDACC__) && defined(AMREX_USE_CUDA) |
| 128 | |
| 129 | BL_PROFILE("InitGraph"); |
| 130 | |
| 131 | int streams = Gpu::Device::numGpuStreams(); |
| 132 | cudaGraphExec_t graphExec{}; |
| 133 | for (int n=0; n<(graph_size); ++n) |
| 134 | { |
| 135 | Gpu::Device::startGraphRecording((n == 0), NULL, NULL, 0); |
| 136 | |
| 137 | // .................. |
| 138 | Gpu::Device::setStreamIndex(n%streams); |
| 139 | emptyKernel<<<1, 1, 0, Gpu::gpuStream()>>>(); |
| 140 | // .................. |
| 141 | |
| 142 | graphExec = Gpu::Device::stopGraphRecording((n == (graph_size-1))); |
| 143 | } |
| 144 | AMREX_CUDA_SAFE_CALL(cudaGraphExecDestroy(graphExec)); |
| 145 | #endif |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | [[nodiscard]] gpuStream_t& |
no test coverage detected