init
This commit is contained in:
parent
9f1e9881d6
commit
87f1181a1a
4 changed files with 52 additions and 0 deletions
13
safe_cuda/stream_related.cpp
Normal file
13
safe_cuda/stream_related.cpp
Normal file
|
@ -0,0 +1,13 @@
|
|||
#include "stream_related.h"
|
||||
|
||||
namespace safe_cuda {
|
||||
returnType<std::unique_ptr<CUstream_st, streamDestroyType>> 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 };
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue