File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ // REQUIREddS: aspect-ext_intel_device_info_luid
2+ // REQUIREddS: gpu, cuda, cuda_dev_kit, windows
3+
4+ // RUN: %{build} %cuda_options -o %t.out
5+ // RUN: %{run} %t.out
6+
7+ // Test that the LUID is read correctly from Level Zero.
8+
9+ #include < iomanip>
10+ #include < iostream>
11+ #include < sstream>
12+ #define SYCL_EXT_ONEAPI_BACKEND_CUDA_EXPERIMENTAL 1
13+ #include < cuda.h>
14+ #include < sycl/backend.hpp>
15+ #include < sycl/detail/core.hpp>
16+
17+ int main () {
18+ sycl::device dev;
19+ auto luid = dev.get_info <sycl::ext::intel::info::device::luid>();
20+
21+ std::stringstream luidSYCLHex;
22+ for (int i = 0 ; i < luid.size (); ++i) {
23+ luidSYCLHex << std::hex << std::setw (2 ) << std::setfill (' 0' )
24+ << int (luid[i]);
25+ }
26+ std::cout << " SYCL: " << luidSYCLHex.str () << std::endl;
27+
28+ CUdevice cudaDevice = sycl::get_native<sycl::backend::ext_oneapi_cuda>(dev);
29+
30+ char *luidCuda = nullptr ;
31+
32+ cuDeviceGetLuid (luidCuda, nullptr , cudaDevice);
33+
34+ std::stringstream luidCudaHex;
35+ for (int i = 0 ; i < 8 ; ++i)
36+ luidCudaHex << std::hex << std::setw (2 ) << std::setfill (' 0' )
37+ << int (luidCuda[i]);
38+ std::cout << " CUDA : " << luidCudaHex.str () << std::endl;
39+
40+ if (luidSYCLHex.str () != luidCudaHex.str ()) {
41+ std::cout << " FAILED" << std::endl;
42+ return -1 ;
43+ }
44+
45+ std::cout << " PASSED" << std::endl;
46+ return 0 ;
47+ }
You can’t perform that action at this time.
0 commit comments