nvidia/cuda/stream: Add synchronize function

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-11-08 06:47:47 +01:00
parent 4dac477500
commit c0a108bf4a
2 changed files with 10 additions and 0 deletions

View file

@ -64,3 +64,11 @@ nvidia::cuda::stream::~stream()
{ {
return _stream; return _stream;
} }
void nvidia::cuda::stream::synchronize()
{
D_LOG_DEBUG("Synchronizing... (Addr: 0x%" PRIuPTR ")", this);
if (auto res = _cuda->cuStreamSynchronize(_stream); res != ::nvidia::cuda::result::SUCCESS) {
throw ::nvidia::cuda::cuda_error(res);
}
}

View file

@ -31,5 +31,7 @@ namespace nvidia::cuda {
stream(::nvidia::cuda::stream_flags flags = ::nvidia::cuda::stream_flags::DEFAULT, int32_t priority = 0); stream(::nvidia::cuda::stream_flags flags = ::nvidia::cuda::stream_flags::DEFAULT, int32_t priority = 0);
::nvidia::cuda::stream_t get(); ::nvidia::cuda::stream_t get();
void synchronize();
}; };
} // namespace nvidia::cuda } // namespace nvidia::cuda