oneMKL
oneMKL copied to clipboard
Add hipSYCL curand support
Description
This PR adds support to use the cuRAND backend with hipSYCL.
The approach is similar though simpler than #144: Since hipSYCL does not support host_task
but instead implements the extension hipSYCL_enqueue_custom_operation
, a wrapper function onemkl_curand_host_task
is introduced that calls either host_task
or hipSYCL_enqueue_custom_operation
depending on which compiler is used.
Further, calls to curandSetStream
before calling the cuRAND generate
-functions were added. This is important since previously, the call to wait_and_throw
after submitting the CUDA calls might not wait for the cuRAND random number generation to finish if it was started on a different stream. In fact, increasing the amount of random numbers generated in the unit tests (and thereby increasing the time spent generating numbers) made some tests fail (both when using hipSYCL and dpc++), since the result might be read before random number generation is finished. Now all tests pass also when increasing the number of random samples to be generated.
Test logs
The tests were executed on Ubuntu 20.04 using CUDA 11.6. curand_dpcpp_test.log curand_hipsycl_test.log
Checklist
- [x] Do all unit tests pass locally? Attach a log.
- [x] Have you formatted the code using clang-format?