Description
I am running some tests at the moment with the HEAD of the sycl branch (65da01b). I was hoping to build the compiler on CentOS 7 such that it could be used on machines that have no CUDA or OpenCL devices, in which case the produced executables could just fall back on the host device. (As is the intention with SYCL...)
Unfortunately this doesn't seem to work. 😦
The compiler itself seems to be fine, it is functional after my build.
[bash][lxplus739]:~ > clang++ -v
clang version 11.0.0 (/home/krasznaa/software/intel/llvm/clang 65da01b2a2912237048d61ec0c511dac6346a489)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /afs/cern.ch/user/k/krasznaa/work/public/clang/11.0.0-65da01b/x86_64-centos7-gcc8-opt/bin
Found candidate GCC installation: /afs/cern.ch/work/k/krasznaa/public/gcc/8.3.0/x86_64-centos7/lib/gcc/x86_64-pc-linux-gnu/8.3.0
Selected GCC installation: /afs/cern.ch/work/k/krasznaa/public/gcc/8.3.0/x86_64-centos7/lib/gcc/x86_64-pc-linux-gnu/8.3.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /afs/cern.ch/work/k/krasznaa/public/cuda/10.1.243/x86_64-centos7, version 10.1
[bash][lxplus739]:~ >
I was trying to compile the following very simple executable with it:
// SYCL include(s).
#include <CL/sycl.hpp>
// System include(s).
#include <iostream>
int main() {
// Loop over all available SYCL platforms.
for( const cl::sycl::platform& platform :
cl::sycl::platform::get_platforms() ) {
// Print some information about the platform.
std::cout << "============ Platform ============" << std::endl;
std::cout << " Name : "
<< platform.get_info< cl::sycl::info::platform::name >()
<< std::endl;
std::cout << " Vendor : "
<< platform.get_info< cl::sycl::info::platform::vendor >()
<< std::endl;
std::cout << " Version: "
<< platform.get_info< cl::sycl::info::platform::version >()
<< std::endl;
// Loop over all devices available from this platform.
for( const cl::sycl::device& device : platform.get_devices() ) {
// Print some information about the device.
std::cout << "------------- Device -------------" << std::endl;
std::cout << " Name : "
<< device.get_info< cl::sycl::info::device::name >()
<< std::endl;
std::cout << " Vendor : "
<< device.get_info< cl::sycl::info::device::vendor >()
<< std::endl;
std::cout << " Version: "
<< device.get_info< cl::sycl::info::device::version >()
<< std::endl;
}
}
// Return gracefully.
return 0;
}
It compiles just fine, but it is unable to run. 😦
[bash][lxplus739]:cudaSycl > clang++ -g -fsycl -o syclinfo syclinfo.cxx
[bash][lxplus739]:cudaSycl > ./syclinfo
PI CUDA ERROR:
Value: 100
Name: CUDA_ERROR_NO_DEVICE
Description: no CUDA-capable device is detected
Function: operator()
Source Location: /home/krasznaa/software/intel/llvm/sycl/plugins/cuda/pi_cuda.cpp:546
terminate called after throwing an instance of 'cl::sycl::runtime_error'
what(): OpenCL API failed. OpenCL API returns: -999 (Unknown OpenCL error code) -999 (Unknown OpenCL error code)
Aborted (core dumped)
[bash][lxplus739]:cudaSycl >
The exception itself is coming from:
[bash][lxplus739]:cudaSycl > gdb ./syclinfo
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-115.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /afs/cern.ch/user/k/krasznaa/ATLAS/sw/projects/cudaSycl/syclinfo...done.
(gdb) catch throw
Function "__cxa_throw" not defined.
Catchpoint 1 (throw)
(gdb) run
Starting program: /afs/cern.ch/user/k/krasznaa/ATLAS/sw/projects/cudaSycl/./syclinfo
warning: File "/afs/cern.ch/work/k/krasznaa/public/gcc/8.3.0/x86_64-centos7/lib64/libstdc++.so.6.0.25-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py:/usr/lib/golang/src/runtime/runtime-gdb.py".
To enable execution of this file add
add-auto-load-safe-path /afs/cern.ch/work/k/krasznaa/public/gcc/8.3.0/x86_64-centos7/lib64/libstdc++.so.6.0.25-gdb.py
line to your configuration file "/afs/cern.ch/user/k/krasznaa/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/afs/cern.ch/user/k/krasznaa/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
warning: File "/afs/cern.ch/work/k/krasznaa/public/clang/11.0.0-65da01b/x86_64-centos7-gcc8-opt/lib/libsycl.so-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py:/usr/lib/golang/src/runtime/runtime-gdb.py".
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /afs/cern.ch/work/k/krasznaa/public/cuda/10.1.243/x86_64-centos7/lib64/libcuda.so.1
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/03/576a4f319db6975143582d3c29f08c5eefb030.debug
PI CUDA ERROR:
Value: 100
Name: CUDA_ERROR_NO_DEVICE
Description: no CUDA-capable device is detected
Function: operator()
Source Location: /home/krasznaa/software/intel/llvm/sycl/plugins/cuda/pi_cuda.cpp:546
Catchpoint 1 (exception thrown), __cxxabiv1::__cxa_throw (obj=0x62b2e0, tinfo=0x7ffff6442ae0 <typeinfo for _pi_result>, dest=0x0)
at ../../../../gcc-8.3.0/libstdc++-v3/libsupc++/eh_throw.cc:78
78 ../../../../gcc-8.3.0/libstdc++-v3/libsupc++/eh_throw.cc: No such file or directory.
Missing separate debuginfos, use: debuginfo-install glibc-2.17-292.el7.x86_64
(gdb) c
Continuing.
Catchpoint 1 (exception thrown), __cxxabiv1::__cxa_throw (obj=0x62b2e0,
tinfo=0x7ffff7539870 <typeinfo for cl::sycl::runtime_error>, dest=0x7ffff721f3f0 <cl::sycl::runtime_error::~runtime_error()>)
at ../../../../gcc-8.3.0/libstdc++-v3/libsupc++/eh_throw.cc:78
78 in ../../../../gcc-8.3.0/libstdc++-v3/libsupc++/eh_throw.cc
(gdb) bt
#0 __cxxabiv1::__cxa_throw (obj=0x62b2e0, tinfo=0x7ffff7539870 <typeinfo for cl::sycl::runtime_error>,
dest=0x7ffff721f3f0 <cl::sycl::runtime_error::~runtime_error()>)
at ../../../../gcc-8.3.0/libstdc++-v3/libsupc++/eh_throw.cc:78
#1 0x00007ffff70ba859 in void cl::sycl::detail::plugin::checkPiResult<cl::sycl::runtime_error>(_pi_result) const [clone .constprop.764] [clone .cold.777] ()
from /afs/cern.ch/user/k/krasznaa/work/public/clang/11.0.0-65da01b/x86_64-centos7-gcc8-opt/lib/libsycl.so
#2 0x00007ffff725fe92 in cl::sycl::detail::platform_impl::get_platforms() ()
from /afs/cern.ch/user/k/krasznaa/work/public/clang/11.0.0-65da01b/x86_64-centos7-gcc8-opt/lib/libsycl.so
#3 0x00007ffff72d01a9 in cl::sycl::platform::get_platforms() ()
from /afs/cern.ch/user/k/krasznaa/work/public/clang/11.0.0-65da01b/x86_64-centos7-gcc8-opt/lib/libsycl.so
#4 0x000000000040112b in main () at syclinfo.cxx:13
(gdb)
There seem to be multiple things wrong here:
- The CUDA plugin should really not print any error messages just because it can't find a CUDA device. Since the whole point of using SYCL is portability, right?
- Even if it prints a warning (error), there's really no reason for it to kill the application. As far as I can see, the exception gets thrown because of the CUDA issue. Though I'm not 100% sure about that.
Note that I didn't even explicitly tell clang++
to build NVPTX code into my binary. Which makes this behaviour just the more annoying. 😦
Cc. @fwyzard. I think you'll also be interested in this Andrea. 😉