1
0
Fork 0
raii-safe-cuda/include/stream_related.hpp

19 lines
567 B
C++

#ifndef RAIISAFECUDA_STREAM_RELATED_HPP
#define RAIISAFECUDA_STREAM_RELATED_HPP
#include <memory>
#include <cuda_runtime_api.h>
#include <variant>
namespace safe_cuda {
using streamDestroyType = decltype(&cudaStreamDestroy);
/**
* \brief It tries to create a stream, putting it in a smart pointer with its correct destructor.
* \return smart pointer if creation is OK, else the CUDA error
*/
std::variant<std::unique_ptr<CUstream_st, streamDestroyType>, cudaError_t> create_stream() noexcept;
}
#endif //RAIISAFECUDA_STREAM_RELATED_HPP