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

Cargo features for CUDA version (updated Dec. 10) #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

peterhj
Copy link

@peterhj peterhj commented Dec 4, 2018

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).

@peterhj peterhj changed the title Add Cargo features for selecting installed CUDA version. Add Cargo features for installed CUDA version. Dec 4, 2018
@kngwyu
Copy link

kngwyu commented Dec 5, 2018

What does gte_ prefix mean?

And I think we should add a version flag after actually testing it.

@AndrewGaspar
Copy link
Contributor

What does gte_ prefix mean?

I assume it means "Greater-than-or-equal". I.e. the feature indicates at least that minimum version is available.

@peterhj
Copy link
Author

peterhj commented Dec 5, 2018

What does gte_ prefix mean?

The gte_ (Greater Than or Equal) features can be used in the library itself, e.g. if certain APIs needed wrapping which differed between versions. The features without gte_ are specified in Cargo.toml by users of cuda-sys.

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.

@peterhj peterhj force-pushed the peterhj-features branch 2 times, most recently from 2725370 to d22d725 Compare December 10, 2018 20:31
@peterhj peterhj changed the title Add Cargo features for installed CUDA version. Cargo features for CUDA version (updated Dec. 10) Dec 10, 2018
@peterhj peterhj force-pushed the peterhj-features branch 2 times, most recently from 5fe9afb to a127dfb Compare December 10, 2018 21:16
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.
@peterhj
Copy link
Author

peterhj commented Dec 10, 2018

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 was referenced Jan 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants