Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:12

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2022-2025 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 // Local include(s).
0009 #include "traccc/hip/utils/stream.hpp"
0010 
0011 #include "hip_error_handling.hpp"
0012 #include "opaque_stream.hpp"
0013 #include "utils.hpp"
0014 
0015 // HIP include(s).
0016 #include <hip/hip_runtime_api.h>
0017 
0018 namespace traccc::hip {
0019 
0020 stream::stream(int device) {
0021   // Make sure that the stream is constructed on the correct device.
0022   details::select_device dev_selector{
0023       device == INVALID_DEVICE ? details::get_device() : device};
0024 
0025   // Construct the stream.
0026   m_stream = std::make_unique<details::opaque_stream>(dev_selector.device());
0027 }
0028 
0029 stream::stream(stream&& parent) noexcept = default;
0030 
0031 stream::~stream() = default;
0032 
0033 stream& stream::operator=(stream&& rhs) noexcept = default;
0034 
0035 int stream::device() const {
0036   return m_stream->m_device;
0037 }
0038 
0039 void* stream::hipStream() const {
0040   return m_stream->m_stream;
0041 }
0042 
0043 void stream::synchronize() const {
0044   TRACCC_HIP_ERROR_CHECK(hipStreamSynchronize(m_stream->m_stream));
0045 }
0046 
0047 }  // namespace traccc::hip