nvidia/cuda/stream: Add synchronize function

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

View file

@ -64,3 +64,11 @@ nvidia::cuda::stream::~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);
::nvidia::cuda::stream_t get();
void synchronize();
};
} // namespace nvidia::cuda