Driver: re-factored handle wrapper to accomodate proper deinitialization order

This commit is contained in:
philippe
2017-05-10 21:50:39 -07:00
parent 78fff59e47
commit c5a79782b8
18 changed files with 89 additions and 104 deletions

View File

@@ -38,11 +38,11 @@ namespace isaac
namespace driver
{
Stream::Stream(Context const & context): base_type(true), context_(context){
// dispatch::cuCtxPushCurrent_v2(context);
dispatch::cuStreamCreate(&*cu_, 0);
// dispatch::cuCtxPopCurrent_v2(NULL);
}
Stream::Stream(CUstream stream, bool take_ownership): cu_(stream, take_ownership)
{}
Stream::Stream(Context const & context): context_(context), cu_(CUstream(), true)
{ dispatch::cuStreamCreate(&*cu_, 0); }
void Stream::synchronize()
{ dispatch::cuStreamSynchronize(*cu_); }
@@ -72,6 +72,9 @@ void Stream::read(Buffer const & buffer, bool blocking, std::size_t offset, std:
dispatch::cuMemcpyDtoHAsync(ptr, buffer + offset, size, *cu_);
}
Handle<CUstream> const & Stream::cu() const
{ return cu_; }
}
}