Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel ICX Compiler , Intel® DPC++ Compatibility Tool, and GDB*
583 Discussions

IntelOneAPI throws errors compiling vector-add example

John_Johnson
Novice
2,387 Views

Hello I am having difficulties create IntelOneAPI vector-add project. 

Operating system and version: Centos 7.4

GNU Compiler Collection (GCC): 7.3.0 (gcc installed in /share/apps/compilers/gcc-7.3.0 directory)

Toolkit: oneAPI DPC++ Compiler from Intel oneAPI 2021 beta04

Steps to reproduce:

1) source setvars.sh 

2) oneapi-cli

3) Create-project >> cpp >>  oneAPI DPC++ Compiler >> CPU, GPU and FPGA >> Vector Add

4) cd ~/vector_add

5) make all CC=/share/apps/compilers/gcc-7.3.0/bin/gcc CPP=/share/apps/compilers/gcc-7.3.0/bin/g++ CXX=/share/apps/compilers/gcc-7.3.0/bin/g++ LD=/share/apps/compilers/gcc-7.3.0/bin/g++

And  I got:

 

/share/apps/compilers/gcc-7.3.0/bin/g++ -O2 -g -o vector-add src/vector-add.cpp -lOpenCL -lsycl
src/vector-add.cpp:7:10: fatal error: CL/sycl.hpp: No such file or directory
 #include <CL/sycl.hpp>
          ^~~~~~~~~~~~~
compilation terminated.
make: *** [main] Error 1

 

As far as I understand it cannot find header in CL directory, which is located in /compiler/2021.1-beta04/linux/lib/oclfpga/host/include/CL, but it should be found, because sycl.hpp exists there and I sourced setvars.sh script

UPDATE: I found out that during make all command I did overwrite CXX value from dpcpp to g++ and it was wrong. That was the reason why it could not find sycl.hpp header. But when I change command to make all (without additional parameters) I got errors about wrong gcc version (see attached file below). Centos 7.4 by default uses 4.8.5, but I compiled from source gcc 7.3.0 version. I suppose if somehow point to use gcc 7.3.0 I could go futher

 

 

 

 

 

0 Kudos
1 Solution
John_Johnson
Novice
2,387 Views

Finally found out solution to this problem. Had to add --gcc-toolchain=/share/apps/compilers/gcc-7.3.0 (path to gcc installation directory) at the end of the CXXFLAGS line in project's vector-add Makefile

View solution in original post

0 Kudos
5 Replies
RahulV_intel
Moderator
2,387 Views

Hi John,

CentOS version 7.4 is not supported by oneAPI 2021.1-beta04 as of now. You can check the oneAPI system requirements here: https://software.intel.com/en-us/articles/intel-oneapi-dpcpp-system-requirements-beta.

 

--Rahul

0 Kudos
John_Johnson
Novice
2,387 Views

Okay. So maybe then there is any known way how to let inteloneapi use gcc version compiled from source? Because most of the cases it uses my old compiler even if environment variables is properly set. Install compiler using other ways is not preferable, because I have to install it to specific directory. This error comes I guess just because of earlier mentioned issue:

 

/share/apps/devel/inteloneapi/inteloneapi/compiler/2021.1-beta04/linux/lib/clang/10.0.0/include/CL/sycl/intel/functional.hpp:47:17: error: too few template arguments for class template 'greater'
    return std::greater<>()(std::forward<const T>(lhs), std::forward<const U>(rhs))
                ^
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_function.h:222:12: note: template is declared here
    struct greater : public binary_function<_Tp, _Tp, bool>

0 Kudos
RahulV_intel
Moderator
2,387 Views

Hi John,

Export gcc-7.3.0 path (compiled from source) to your bashrc file.

Steps to be followed:

vim ~/.bashrc

Add these lines at the end of your file

export PATH=/share/apps/compilers/gcc-7.3.0/bin:$PATH

export LD_LIBRARY_PATH=/share/apps/compilers/gcc-7.3.0/lib64:$LD_LIBRARY_PATH
source ~/.bashrc

DPC++ codes run perfectly fine with gcc-7.3.0. Tried this on Ubuntu-18.04. Compiled gcc-7.3.0 from source and placed the paths in the bash file. Notice the gcc version change, upon running  gcc --version command. However, I cannot guarantee you that it would work on CentOS 7.4, since this OS version is currently not supported by oneAPI-beta04 version.

 

--Rahul

0 Kudos
John_Johnson
Novice
2,388 Views

Finally found out solution to this problem. Had to add --gcc-toolchain=/share/apps/compilers/gcc-7.3.0 (path to gcc installation directory) at the end of the CXXFLAGS line in project's vector-add Makefile

0 Kudos
RahulV_intel
Moderator
2,387 Views

Hi,

Glad to hear that your issue got resolved. We are closing this thread. Feel free to reach out to us, in case of further queries.

 

--Rahul

0 Kudos
Reply