-
Notifications
You must be signed in to change notification settings - Fork 25
[SYCL] Initial commit of interop example #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Ruyman Reyes <ruyman@codeplay.com>
example-02/sycl_sgemm.cpp
Outdated
const size_t WIDTH = 1024; | ||
const size_t HEIGHT = 1024; | ||
const float ALPHA = 1.0f; | ||
const float BETA = 0.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be constexpr
example-02/sycl_sgemm.cpp
Outdated
h.interop_task([=](sycl::interop_handler ih) { | ||
cublasSetStream(handle, ih.get_queue<backend::cuda>()); | ||
|
||
float *cuA = reinterpret_cast<float *>(ih.get_mem<backend::cuda>(d_A)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the native handle for CUDA memory? Could you use a static_cast
instead? Also you can use auto
instead of float*
since you already specify the exact type with the cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CUdeviceptr
is the native type but is not used in CUDA Runtime API, just using the pointer is enough. Cannot static cast because it converts a number into a pointer
example-02/sgemm.cu
Outdated
const size_t WIDTH = 1024; | ||
const size_t HEIGHT = 1024; | ||
const float ALPHA = 1.0f; | ||
const float BETA = 0.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be constexpr
@@ -0,0 +1,32 @@ | |||
cmake_minimum_required(VERSION 3.17 FATAL_ERROR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is CMake 3.17 such a strong requirement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
find_package(CUDAToolkit)
used below simplifies the setting up of the project, but is only available on latest cmake.
Example of using interop task to use CUBLAS from SYCL