Repository navigation
trying to build the examples fails #2
Description
Activity
benvanwerkhoven commented
on Apr 26, 2024 ContributorAuthorMore actionsThis is the full CMAKE output, there are a few warnings as well:
CMake Warning (dev) in CMakeLists.txt: No project() command is present. The top-level CMakeLists.txt file must contain a literal, direct call to the project() command. Add a line of code such as project(ProjectName) near the top of the file, but after cmake_minimum_required(). CMake is pretending there is a "project(Project)" command on the first line. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) in CMakeLists.txt: cmake_minimum_required() should be called prior to this top-level project() call. Please see the cmake-commands(7) manual for usage documentation of both commands. This warning is for project developers. Use -Wno-dev to suppress it. -- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/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/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- The CUDA compiler identification is NVIDIA 12.3.107 -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - done -- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped -- Detecting CUDA compile features -- Detecting CUDA compile features - done -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Found CUDA: /usr/local/cuda (found version "12.3") CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as cmake_minimum_required(VERSION 3.26) should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it. -- Configuring done (20.1s) -- Generating done (0.7s) -- Build files have been written to: /home/ben/documents/kernel_tuner/kernel_float/examples/build (py311) ben@benwerklaptop:~/documents/kernel_tuner/kernel_float/examples/build$ make [ 25%] Building CUDA object vector_add/CMakeFiles/kernel_float_vecadd.dir/main.cu.o In file included from /home/ben/documents/kernel_tuner/kernel_float/examples/vector_add/main.cu:6: /home/ben/documents/kernel_tuner/kernel_float/single_include/kernel_float.h:75:44: error: missing binary operator before token "(" 75 | #if defined(__has_builtin) && __has_builtin(__builtin_assume_aligned) && 0 | ^ make[2]: *** [vector_add/CMakeFiles/kernel_float_vecadd.dir/build.make:77: vector_add/CMakeFiles/kernel_float_vecadd.dir/main.cu.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:116: vector_add/CMakeFiles/kernel_float_vecadd.dir/all] Error 2 make: *** [Makefile:91: all] Error 2It seems the CMakelists.txt file may not be the 'top-level' CMakelists.txt file. I first tried to build the top-level file but that did not do anything it seemed. At least I don't end up with the examples somewhere in the build directory.
benvanwerkhoven commented
on Apr 26, 2024 ContributorAuthorMore actionsJust tested, I get the same error when using the include directory instead of the single_include directory. I also get the error when trying to compile the example on the repo's README.
benvanwerkhoven commented
on Apr 26, 2024 ContributorAuthorMore actionsSince the line in question (line 75 of marcos.h) ends with "&& 0" I don't think the expression ever evaluates to true. I tried to apply a fix similar to the one used here: madler/spoof#2 by moving the __has_builtin() function to a nested preprocessor if. This seems to fix it.
Using
nvcc --std=c++17 -arch=sm_86 -c test.cu -o test.o
I can build the example from the Readme now.- added a commit that references this issue
on Apr 26, 2024 The fix looks good to me! I'm guessing different host compilers handle the
__has_builtindifferently.
I tried the following:
And got the following error:
In my first attempt at the above the compiler complained that it could not find the kernel_float.h header. So I've added that to make CPATH and removed the build directory and restarted all the steps outlined above to finally get this error.