Cargo features for CUDA version (updated Dec. 10) #5
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.
This commit adds feature flags in Cargo.toml for specific installed versions of the CUDA toolkit. The design is basically the same as that used by clang-sys (https://github.com/KyleMayes/clang-sys/blob/master/Cargo.toml).
Edit (Dec. 10): Assuming the current static bindings for CUDA 8.0, I added static API version checks (using the
static_assertions
crate) and conditional bindings to the FP16 API (currently just an empty module). This way in which the version features are used should be independent of whether static or dynamic bindings are used in cuda-sys.I also set the corresponding cargo features for each nvidia docker image in the CircleCI config. (Because cuda-sys has static bindings to CUDA 8.0, I set the default feature to be "cuda_8_0" in Cargo.toml, but also set --no-default-features in the CI runs.)
These feature flags are not currently used by the library or build script yet to actually select the CUDA version (e.g. for dynamic linking), but that could be done in another PR (pending discussion in #4).