Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CMake compiler option handling #989

Conversation

psychocoderHPC
Copy link
Member

Currenlty we split very often the compiler option and the argument.
This creates issues when the compiler parses the given arguments.
CMake or we in alpaka remove duplicated options and creates therefore wrong argument lines:

example:
-Xcudafe --display_error_number -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored
was changed to
-Xcudafe --display_error_number --diag_suppress=esa_on_defaulted_function_ignored
and results in an error:
nvcc fatal : Unknown option '-diag_suppress'

The fix is that the option and argument is explicit grouped.

This bug is included in 0.4.0 too, a backport must be manually applied because we changed our CMake structure in the develop branch.

I found the bug during tests with docker for PIConGPU.
If the bug becomes visible depends on the order of arguments. In the worst case an option could be ignored by the compiler without throwing an error.

@psychocoderHPC psychocoderHPC added this to the Version 0.5.0 milestone Apr 27, 2020
@psychocoderHPC psychocoderHPC requested a review from a team April 27, 2020 11:22
@BenjaminW3
Copy link
Member

On windows it complains: nvcc fatal : Unknown option '-generate-code arch'

@psychocoderHPC
Copy link
Member Author

On windows it complains: nvcc fatal : Unknown option '-generate-code arch'

Where do you get this error from? I do not see any broken windows CI test. Is it on your machine?

@BenjaminW3
Copy link
Member

No, it is the 7th build from the bottom (github action)

Currenlty we split very often the compiler option and the argument.
This creates issues when the compiler parses the given arguments.

The fix is that the option and argument is explicit grouped.
@psychocoderHPC psychocoderHPC force-pushed the fix-cmakeCompilerOptionHandling branch from 8e9bbf5 to 08ad127 Compare April 27, 2020 18:18
@psychocoderHPC
Copy link
Member Author

psychocoderHPC commented Apr 28, 2020 via email

@psychocoderHPC
Copy link
Member Author

The problem is when separate able compile is activated CMake is keeping the quotes " around some command during the linking.

cd /home/rwidera/workspace/buildAlpaka/example/bufferCopy && /opt/spack-modules/linux-ubuntu16.04-broadwell/gcc-5.4.0/cuda-10.2.89-2gpveayvfoo7rfq2gbj7s2ykggvfxplz/bin/nvcc --expt-extended-lambda --expt-relaxed-constexpr "--generate-code arch=compute_70,code=sm_70" "--generate-code arch=compute_70,code=compute_70" -std=c++14 --use_fast_math --ftz=false "-Xcudafe --display_error_number" "-Xcudafe --diag_suppress=esa_on_defaulted_function_ignored" "-Xcudafe --diag_suppress=2976" -m64 -ccbin /usr/bin/c++ -dlink /home/rwidera/workspace/buildAlpaka/example/bufferCopy/CMakeFiles/bufferCopy.dir/src/./bufferCopy_generated_bufferCopy.cpp.o -o /home/rwidera/workspace/buildAlpaka/example/bufferCopy/CMakeFiles/bufferCopy.dir/./bufferCopy_intermediate_link.

@psychocoderHPC
Copy link
Member Author

The problem is when separate able compile is activated CMake is keeping the quotes " around some command during the linking.

cd /home/rwidera/workspace/buildAlpaka/example/bufferCopy && /opt/spack-modules/linux-ubuntu16.04-broadwell/gcc-5.4.0/cuda-10.2.89-2gpveayvfoo7rfq2gbj7s2ykggvfxplz/bin/nvcc --expt-extended-lambda --expt-relaxed-constexpr "--generate-code arch=compute_70,code=sm_70" "--generate-code arch=compute_70,code=compute_70" -std=c++14 --use_fast_math --ftz=false "-Xcudafe --display_error_number" "-Xcudafe --diag_suppress=esa_on_defaulted_function_ignored" "-Xcudafe --diag_suppress=2976" -m64 -ccbin /usr/bin/c++ -dlink /home/rwidera/workspace/buildAlpaka/example/bufferCopy/CMakeFiles/bufferCopy.dir/src/./bufferCopy_generated_bufferCopy.cpp.o -o /home/rwidera/workspace/buildAlpaka/example/bufferCopy/CMakeFiles/bufferCopy.dir/./bufferCopy_intermediate_link.

When CUDA_SEPARABLE_COMPILATION nvcc will be used for linking insted of the normal compiler. For the linker the CUDA_NVCC_FLAGS which are defined as STRING will somehow not remove the quotes.
I am currently looking into the CMake find module, it looks like a bug.

@psychocoderHPC
Copy link
Member Author

I will close this issue. The problem was triggered by our third party project in PIConGPU.

The problem why -Xcudafe was removed when it was multiple times used as option is an issue in ISAAC. ISAAC removes duplicated options in CUDA_NVCC_FLAGS see here

Normally removing duplicated options should not break the build system. The problem is that we add options normally wrong. I tried to solve it in this PR but when enabling CUDA_SPERATABLE_COMPILE the commands will be passt including the quotes to nvcc.
I will not waist more time into it, FindCUDA is not activly developed (as I know) since CMake has native CUDA support.

psychocoderHPC added a commit to psychocoderHPC/alpaka that referenced this pull request Apr 29, 2020
This is the replacement PR for alpaka-group#989

Currenlty we split very often the compiler option and the argument.
This creates issues when the compiler parses the given arguments.

The fix is that the compiler option and argument will be passed with `=` instead
of a space in between.
psychocoderHPC added a commit to psychocoderHPC/alpaka that referenced this pull request Apr 29, 2020
This is the replacement PR for alpaka-group#989

Currenlty we split very often the compiler option and the argument.
This creates issues when the compiler parses the given arguments.

The fix is that the compiler option and argument will be passed with `=` instead
of a space in between.
psychocoderHPC added a commit to psychocoderHPC/alpaka that referenced this pull request Apr 29, 2020
This is the replacement PR for alpaka-group#989

Currenlty we split very often the compiler option and the argument.
This creates issues when the compiler parses the given arguments.

The fix is that the compiler option and argument will be passed with `=` instead
of a space in between.
BenjaminW3 pushed a commit that referenced this pull request May 4, 2020
This is the replacement PR for #989

Currenlty we split very often the compiler option and the argument.
This creates issues when the compiler parses the given arguments.

The fix is that the compiler option and argument will be passed with `=` instead
of a space in between.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants