1
0
Fork 0

refactor repo

This commit is contained in:
Pcornat 2024-03-25 18:13:16 +01:00
commit 24a83dfa08
Signed by: Pcornat
GPG key ID: E0326CC678A00BDD
5 changed files with 32 additions and 10 deletions

13
src/stream_related.cpp Normal file
View file

@ -0,0 +1,13 @@
#include "stream_related.hpp"
namespace safe_cuda {
std::variant<std::unique_ptr<CUstream_st, streamDestroyType>, cudaError_t> create_stream() noexcept {
cudaStream_t stream = nullptr;
const cudaError_t error = cudaStreamCreate(&stream);
if (error != cudaSuccess) {
return error;
}
return std::unique_ptr<CUstream_st, streamDestroyType>{ stream, cudaStreamDestroy };
}
}