Cargo features for CUDA version (updated Dec. 10)#5
Cargo features for CUDA version (updated Dec. 10)#5peterhj wants to merge 1 commit intorust-cuda:masterfrom
Conversation
|
What does And I think we should add a version flag after actually testing it. |
I assume it means "Greater-than-or-equal". I.e. the feature indicates at least that minimum version is available. |
The For example, one difference in CUDA APIs between versions is the addition of f16 support somewhere around 8.0 or 9.0, which added a new header among other changes. |
2725370 to
d22d725
Compare
5fe9afb to
a127dfb
Compare
Use the features to gate on the API version and a (currently empty) binding to the FP16 API. Fix for stable rustc. Update CI to set the version features. Disable default features in CI.
|
I added some minimal usage of the new API version features (just for 8.0, since that's what cuda-sys binds to currently). I also updated the CI config to set the right features in the environment (more details in the top post). |
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_assertionscrate) 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).