Add host compiler compatibility check to CUDA package. #24540
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
nvcc
only officially supports specific ranges of host compilers, with version ranges varied based on CUDA toolkit version. Currently, Spack does not consider these host compiler restrictions during concretization. This can result in cases where users go through a long build process, only to find out later on that the host compiler they are using is not supported by the CUDA toolkit version they've installed.This PR introduces code into the CUDA package to add conflict statements to enforce host compiler dependencies based on CUDA version. To facilitate this, I've added a
_supported_compilers
dictionary that contains information on supported compilers based on CUDA version. I parsed this data directly from the${CUDA_ROOT}/include/crt/host_config.h
header for each CUDA version listed (as old as 8.0).It appears that the
conflicts
statement does not accept syntax likeconflicts('^%gcc@:10', when ='%gcc')
(i.e. conflicts with gcc versions greater than 10 when building with gcc). As a result, I had to add a helper functioninvert_support_entry
to effectively perform this NOT operation, and then createconflicts
using the inverted ranges. See the comment above the function for examples. If there is a better way to accomplish this without requiring this type of code, please let me know.With these conflicts in place, the build will now error out during concretization. For example, trying to install CUDA 10.0 in a container with GCC 9 will now yield the following:
I'm not sure why the error reports
%gcc@8
, but maybe that is expected? On the other hand, when trying to install CUDA 10.2, the error reported shows%gcc@9
which is more accurate:CC: @bvanessen