File indexing completed on 2026-07-26 08:22:11
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "traccc/cuda/utils/stream_wrapper.hpp"
0010
0011 #include "cuda_error_handling.hpp"
0012
0013
0014 #include <cuda_runtime_api.h>
0015
0016 namespace traccc::cuda {
0017
0018 stream_wrapper::stream_wrapper(void* stream) : m_stream{stream} {}
0019
0020 int stream_wrapper::device() const {
0021
0022 int device = -1;
0023
0024 #ifdef TRACCC_HAVE_CUDA_STREAM_GET_DEVICE
0025
0026 TRACCC_CUDA_ERROR_CHECK(
0027 cudaStreamGetDevice(static_cast<cudaStream_t>(m_stream), &device));
0028
0029 #else
0030
0031
0032 TRACCC_CUDA_ERROR_CHECK(cudaGetDevice(&device));
0033 #endif
0034
0035
0036 return device;
0037 }
0038
0039 void* stream_wrapper::cudaStream() const {
0040 return m_stream;
0041 }
0042
0043 void stream_wrapper::synchronize() const {
0044 TRACCC_CUDA_ERROR_CHECK(
0045 cudaStreamSynchronize(static_cast<cudaStream_t>(m_stream)));
0046 }
0047
0048 }