Skip to content

Commit 283e69d

Browse files
committed
Removing unnecessary CUDA Driver types
Since intel/llvm#8197, SYCL CUDA backend uses CUDA primary context by default, so individual context setting is no longer required.
1 parent 0c886cb commit 283e69d

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

examples/sgemm_interop/sycl_sgemm.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
#include <iostream>
2626
#include <vector>
2727

28-
#include <CL/sycl.hpp>
29-
#include <CL/sycl/backend/cuda.hpp>
28+
#include <sycl/sycl.hpp>
3029

31-
#include <cublas_v2.h>
3230
#include <cuda.h>
31+
#include <cublas_v2.h>
3332

3433
#define CHECK_ERROR(FUNC) checkCudaErrorMsg(FUNC, " " #FUNC)
3534

@@ -47,12 +46,14 @@ void inline checkCudaErrorMsg(cudaError status, const char *msg) {
4746
}
4847
}
4948

50-
void inline checkCudaErrorMsg(CUresult status, const char *msg) {
49+
/*
50+
* void inline checkCudaErrorMsg(CUresult status, const char *msg) {
5151
if (status != CUDA_SUCCESS) {
5252
std::cout << "ERROR CUDA: " << msg << " - " << status << std::endl;
5353
exit(EXIT_FAILURE);
5454
}
5555
}
56+
*/
5657

5758
class CUDASelector : public sycl::device_selector {
5859
public:
@@ -104,7 +105,6 @@ int main() {
104105
auto d_C = b_C.get_access<sycl::access::mode::write>(h);
105106

106107
h.host_task([=](sycl::interop_handle ih) {
107-
cuCtxSetCurrent(ih.get_native_context<backend::ext_oneapi_cuda>());
108108
auto cuStream = ih.get_native_queue<backend::ext_oneapi_cuda>();
109109
cublasSetStream(handle, cuStream);
110110
auto cuA = reinterpret_cast<float *>(ih.get_native_mem<backend::ext_oneapi_cuda>(d_A));

examples/sgemm_interop/sycl_sgemm_usm.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
#include <iostream>
2626
#include <vector>
2727

28-
#include <CL/sycl.hpp>
29-
#include <CL/sycl/backend/cuda.hpp>
28+
#include <sycl/sycl.hpp>
3029

31-
#include <cublas_v2.h>
3230
#include <cuda.h>
31+
#include <cublas_v2.h>
3332

3433
#define CHECK_ERROR(FUNC) checkCudaErrorMsg(FUNC, " " #FUNC)
3534

@@ -47,12 +46,12 @@ void inline checkCudaErrorMsg(cudaError status, const char *msg) {
4746
}
4847
}
4948

50-
void inline checkCudaErrorMsg(CUresult status, const char *msg) {
49+
/* void inline checkCudaErrorMsg(CUresult status, const char *msg) {
5150
if (status != CUDA_SUCCESS) {
5251
std::cout << "ERROR CUDA: " << msg << " - " << status << std::endl;
5352
exit(EXIT_FAILURE);
5453
}
55-
}
54+
} */
5655

5756
class CUDASelector : public sycl::device_selector {
5857
public:
@@ -107,9 +106,7 @@ int main() {
107106
q.submit([&](handler &h) {
108107

109108
h.host_task([=](sycl::interop_handle ih) {
110-
111109
// Set the correct cuda context & stream
112-
cuCtxSetCurrent(ih.get_native_context<backend::ext_oneapi_cuda>());
113110
auto cuStream = ih.get_native_queue<backend::ext_oneapi_cuda>();
114111
cublasSetStream(handle, cuStream);
115112

0 commit comments

Comments
 (0)