Skip to content

Project assumes CXX compiler and and CUDACXXHOST compiler are the same #126

Open

Description

@theHamsta

When using this project as a with CUDAHOSTCXX=g++-11 and CXX=clang++-17 as dependency, I'm getting the following compilation error.

FAILED: _deps/nvbench-build/nvbench/CMakeFiles/nvbench.dir/blocking_kernel.cu.o 
ccache /usr/local/cuda/bin/nvcc -forward-unknown-to-host-compiler -ccbin=/usr/lib/ccache/g++ -Dnvbench_EXPORTS -I/home/stephan/projects/proviz-app-samples/debug/_deps/nvbench-src -I/home/stephan/projects/proviz-app-samples/debug/_deps/nvbench-build -I/home/stephan/projects/proviz-app-samples/debug/_deps/fmt-src/include -I/home/stephan/projects/proviz-app-samples/debug/_deps/nvbench-build/nvbench/detail -isystem=/usr/local/cuda/include -isystem=/home/stephan/projects/proviz-app-samples/debug/_deps/nlohmann_json-src/include -Wno-deprecated-gpu-targets -allow-unsupported-compiler -arch=native -lineinfo -g -Xcompiler=-fPIC -Wall -Wextra -Wpedantic -Xcompiler=-Wall -Xcompiler=-Wextra -Xcompiler=-Wconversion -Xcompiler=-Woverloaded-virtual -Xcompiler=-Wcast-qual -Xcompiler=-Wpointer-arith -Xcompiler=-Wunused-local-typedef -Xcompiler=-Wunused-parameter -Xcompiler=-Wvla -Xcompiler=-Wgnu -Xcudafe=--display_error_number -Wno-deprecated-gpu-targets -std=c++17 -MD -MT _deps/nvbench-build/nvbench/CMakeFiles/nvbench.dir/blocking_kernel.cu.o -MF _deps/nvbench-build/nvbench/CMakeFiles/nvbench.dir/blocking_kernel.cu.o.d -x cu -c /home/stephan/projects/proviz-app-samples/debug/_deps/nvbench-src/nvbench/blocking_kernel.cu -o _deps/nvbench-build/nvbench/CMakeFiles/nvbench.dir/blocking_kernel.cu.o
g++: error: unrecognized command-line option ‘-Wunused-local-typedef’; did you mean ‘-Wunused-local-typedefs’?
g++: error: unrecognized command-line option ‘-Wgnu’

This seems to be the case because it is implicitly assumed here

if (${${var}})
target_compile_options(${target_name} ${type}
$<$<COMPILE_LANGUAGE:CXX>:${flag}>
$<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:-Xcompiler=${flag}>
# FIXME nvc++ case
)
endif()

that the CUDA host compiler will accept any flags that the CXX compiler accepts.

I'm also not sure whether the second ${} for the if is necessary as if will implicitly resolve the variable

This project also fails to build with NVBench_TOPLEVEL_PROJECT (and thus NVBench_ENABLE_WERROR because it causes a lot of clang warnings. Since I'm using nvbench as a dependency WERROR doesn't cause problems for me.

A simplified solution to this problem could be to disable the CUDA host compiler warnings if CUDA host C++ compiler and C++ compiler are not the same.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions