oneapi-src / level-zero

oneAPI Level Zero Specification Headers and Loader
https://spec.oneapi.com/versions/latest/elements/l0/source/index.html
MIT License
218 stars 96 forks source link

Minimum GCC version to build level-zero API #41

Closed jjfumero closed 3 years ago

jjfumero commented 4 years ago

Level-zero newbie here!

I am running level-zero on CentOS 7.8.

The default GCC version on CentOS is 4.8.5, which seems to be very old to compile level-zero.

By using:

$ scl enable devtoolset-9 bash
$ gcc --version
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)

I can compile and run the examples successfully. I think it would be good to add the minimum GCC version in the README file. GCC >= ??

bmyates commented 4 years ago

Hi, what compile errors did you get with the older gcc version?

jjfumero commented 4 years ago

This is the error I get:

$ cmake ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib64/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib64/ccache/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "1.8.3.1") 
-- Using patch version from commit count in git repository: 18
-- Performing Test COMPILER_SUPPORTS_CXX14
-- Performing Test COMPILER_SUPPORTS_CXX14 - Failed
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/juan/manchester/SPIRV/level-zero/build-GCC-4

$ cmake --build . --config Release
Scanning dependencies of target ze_loader
[  2%] Building CXX object source/CMakeFiles/ze_loader.dir/lib/ze_libapi.cpp.o
[  5%] Building CXX object source/CMakeFiles/ze_loader.dir/lib/ze_libddi.cpp.o
[  8%] Building CXX object source/CMakeFiles/ze_loader.dir/lib/zet_libapi.cpp.o
[ 11%] Building CXX object source/CMakeFiles/ze_loader.dir/lib/zet_libddi.cpp.o
[ 14%] Building CXX object source/CMakeFiles/ze_loader.dir/lib/zes_libapi.cpp.o
[ 17%] Building CXX object source/CMakeFiles/ze_loader.dir/lib/zes_libddi.cpp.o
[ 20%] Building CXX object source/CMakeFiles/ze_loader.dir/lib/zel_tracing_libapi.cpp.o
[ 23%] Building CXX object source/CMakeFiles/ze_loader.dir/lib/zel_tracing_libddi.cpp.o
[ 26%] Building CXX object source/CMakeFiles/ze_loader.dir/lib/ze_lib.cpp.o
In file included from /home/juan/manchester/SPIRV/level-zero/source/lib/../loader/ze_object.h:11:0,
                 from /home/juan/manchester/SPIRV/level-zero/source/lib/../loader/ze_loader.h:16,
                 from /home/juan/manchester/SPIRV/level-zero/source/lib/../loader/ze_loader_api.h:11,
                 from /home/juan/manchester/SPIRV/level-zero/source/lib/ze_lib.cpp:12:
/home/juan/manchester/SPIRV/level-zero/source/inc/ze_singleton.h: In member function ‘_singleton_t* singleton_factory_t<_singleton_t, _key_t>::getInstance(Ts&& ...)’:
/home/juan/manchester/SPIRV/level-zero/source/inc/ze_singleton.h:57:24: error: ‘make_unique’ is not a member of ‘std’
             auto ptr = std::make_unique<singleton_t>( std::forward<Ts>( _params )... );
                        ^
/home/juan/manchester/SPIRV/level-zero/source/inc/ze_singleton.h:57:52: error: expected primary-expression before ‘>’ token
             auto ptr = std::make_unique<singleton_t>( std::forward<Ts>( _params )... );
                                                    ^
/home/juan/manchester/SPIRV/level-zero/source/inc/ze_singleton.h:57:82: error: expected ‘)’ before ‘...’ token
             auto ptr = std::make_unique<singleton_t>( std::forward<Ts>( _params )... );
                                                                                  ^
/home/juan/manchester/SPIRV/level-zero/source/inc/ze_singleton.h:57:86: error: parameter packs not expanded with ‘...’:
             auto ptr = std::make_unique<singleton_t>( std::forward<Ts>( _params )... );
                                                                                      ^
/home/juan/manchester/SPIRV/level-zero/source/inc/ze_singleton.h:57:86: note:         ‘_params’
/home/juan/manchester/SPIRV/level-zero/source/inc/ze_singleton.h:57:86: note:         ‘Ts’
gmake[2]: *** [source/CMakeFiles/ze_loader.dir/lib/ze_lib.cpp.o] Error 1
gmake[1]: *** [source/CMakeFiles/ze_loader.dir/all] Error 2
gmake: *** [all] Error 2

It looks to me that, even though the CXX0X is selected, the build process is trying to compile classes using CXX14, which is not available in GCC 4.8.5

As I said, no issues with devtoolset-9 from Red Hat.

bmyates commented 4 years ago

Okay thanks. c++14 is required. I've updated the Cmake to reflect that. Try out: https://github.com/oneapi-src/level-zero/pull/42 Hopefully that will give a cleaner error.

bmyates commented 3 years ago

Merged https://github.com/oneapi-src/level-zero/commit/35b66f095bee70b82f6f88c501f24e175cb0cf17