-
Notifications
You must be signed in to change notification settings - Fork 508
Support for Cuda Separate Compilation #508
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
Support for Cuda Separate Compilation #508
Conversation
Thanks for this! This seems pretty reasonable to me, but TBH I know next-to-nothing about CUDA. Would it be possible to add a new builder on CI which tests this since the support is becoming somewhat nontrivial? |
src/lib.rs
Outdated
} | ||
cmd.arg("-o"); | ||
let out_dir = self.get_out_dir()?; | ||
let out_dir = out_dir.join("link.o"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could "link.o"
shared between here and below be refactored to a common definition? Additionally could it be named something like __cc_internal_link.o
to try to avoid name clashes with normal objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I renamed to __cc_internal_link.o
.
To test compilation of cuda, we need
However, nvidia GPU is not available in Github Action's virtual environment now. We can use only 2-core CPU, 7 GB of RAM memory and 14 GB of SSD disk space. So it is difficult to test execution cuda code... To build CI of cuda execution test, other OSS are using third party CI service, for example CircleCI. But there is a cost to using GPUs in CircleCI... |
Oh I'd be fine not actually executing the CUDA code, it should be ok to just get everything to a linked state I think? Would that be possible to do on CI today? (just exercising this library, which builds, rather than end-to-end testing) |
We can build CI that has nvcc(cuda compiler) by also using github actions.
Of course we have to write test codes to perform cuda compile test. I am trying to do. And I need some time to understanding current cc-rs test code, and write cuda test code. |
Yeah that looks perfect! I'd be happy to have that on CI here |
This PR is no longer needed (#612). thank you:) |
related to #505
This PR change the code to support for cuda separate compilation.
https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#using-separate-compilation-in-cuda
Before change, cc-rs run these command
But, this command fail by unresolved extern function error.
To perform separate compilation, we need to compile with
-dc
option, and to link object file with-dlink
option.After change, cc-rs run these command
code
build.rs(we need
println!("cargo:rustc-link-lib=cudadevrt");
for separate compilation)a.cu
b.cu
b.h