0

I installed oneAPI tools and tried to compile the example project, vector-add

make all
dpcpp -O2 -g -std=c++17 -o vector-add-buffers src/vector-add-buffers.cpp
In file included from src/vector-add-buffers.cpp:22:
In file included from /home/xxx/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/../include/sycl/CL/sycl.hpp:11:
In file included from /home/xxx/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/../include/sycl/CL/sycl/accessor.hpp:12:
In file included from /home/xxx/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/../include/sycl/CL/sycl/atomic.hpp:12:
In file included from /home/xxx/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/../include/sycl/CL/sycl/access/access.hpp:10:
In file included from /home/xxx/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/../include/sycl/CL/sycl/detail/common.hpp:116:
In file included from /home/xxx/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/../include/sycl/CL/sycl/exception.hpp:17:
In file included from /home/xxx/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/../include/sycl/CL/sycl/stl.hpp:13:
/home/xxx/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/../include/sycl/CL/sycl/bit_cast.hpp:33:22: error: no member named 'is_trivially_copyable' in namespace 'std'
  static_assert(std::is_trivially_copyable<From>::value,
                ~~~~~^
/home/xxx/opt/intel/oneapi/compiler/2022.0.2/linux/bin-llvm/../include/sycl/CL/sycl/bit_cast.hpp:33:44: error: 'From' does not refer to a value
  static_assert(std::is_trivially_copyable<From>::value,
                                           ^

I suspect it was caused by the old cmake, pkg-config, make, gcc and g++, but I don't have root access to the cluster. I tried to reinstall it with conda. It was not helping anyway.

  • `is_trivially_copyable` showed up in C++11. Make sure your compiler's not out partying with dinosaurs. – user4581301 Feb 15 '22 at 20:57
  • @user4581301 Thanks for the help. I was using `dpcpp` to compile the project, it was brand new. (`Intel(R) oneAPI DPC++/C++ Compiler 2022.0.0`) But the `g++` is very old (`g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)`), would that be a problem? – junjie yang Feb 15 '22 at 21:02
  • GCC 4.8.5 has slightly dodgy C++11 support. I would upgrade the compiler, but odds are good that if you add `-std=c++11` to the compiler command line you'll have success. – user4581301 Feb 15 '22 at 21:08
  • Mind you, I don't know what `From` is, so you might still have trouble with it. – user4581301 Feb 15 '22 at 21:08
  • In fact, the compiler command is `dpcpp -O2 -g -std=c++17 -o vector-add-buffers src/vector-add-buffers.cpp`, it should work with the C++11 keywords. – junjie yang Feb 15 '22 at 21:11
  • Good point. I should have looked closer. GCC 4.8.5 as no clue what C++17 is , so if GCC is getting involved in any way, there should be a " WTF is this `-std=c++17` option?" error. The paths listed say that the compiler's looking at the correct Standard library. At this point I'd go looking for macros or similar disabling features. – user4581301 Feb 15 '22 at 21:16
  • Yeah, I tried to switch `dpcpp ` to `g++`, it complained about `-std=c++17`. But the brand new `dpcpp ` shall support `-std=c++17` option. – junjie yang Feb 15 '22 at 21:21

2 Answers2

1

In order to compile the vector-add sample code with dpcpp compiler, your gcc version should be atleast 7.3.0 or above.

For more information, please refer to the link below.

https://www.intel.com/content/www/us/en/developer/articles/system-requirements/intel-oneapi-dpcpp-system-requirements.html

0

You can compiler gcc by yourself(it's easy) and use export CXX=/path/gcc-9.2.0/bin/g++ and export CC=/path/gcc-9.2.0/bin/gcc to set compiler env for cmake.