Skip to content

[SYCL] Initial commit of interop example - #2

Merged
Ruyk merged 4 commits into
masterfrom
cuda_interop
May 11, 2020
Merged

[SYCL] Initial commit of interop example#2
Ruyk merged 4 commits into
masterfrom
cuda_interop

Conversation

@Ruyk

@Ruyk Ruyk commented May 7, 2020

Copy link
Copy Markdown

Example of using interop task to use CUBLAS from SYCL

Ruyman Reyes added 2 commits May 5, 2020 09:50
Comment thread 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be constexpr

Comment thread 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));

Copy link
Copy Markdown

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.

@Ruyk Ruyk May 8, 2020

Copy link
Copy Markdown
Author

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

Comment thread example-02/sycl_sgemm.cpp
Comment thread 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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be constexpr

Comment thread example-02/CMakeLists.txt
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.17 FATAL_ERROR)

Copy link
Copy Markdown

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?

Copy link
Copy Markdown
Author

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.

@Ruyk
Ruyk merged commit c278fcc into master May 11, 2020
@Ruyk
Ruyk deleted the cuda_interop branch May 11, 2020 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants