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 check cuda & run f64 tests in CI #447

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/cargo-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ jobs:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
- name: Check CPU
uses: actions-rs/cargo@v1
with:
command: check
- name: Check CUDA
uses: actions-rs/cargo@v1
with:
command: check
args: --features test-cuda,ci-check
8 changes: 7 additions & 1 deletion .github/workflows/cargo-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ jobs:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- uses: actions-rs/cargo@v1
- name: test CPU f32
uses: actions-rs/cargo@v1
with:
command: test
- name: test CPU f64
uses: actions-rs/cargo@v1
with:
command: test
args: --features test-f64
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ intel-mkl = ["cblas"]
cuda = ["dep:cudarc"]
test-cuda = ["cuda"]
test-f64 = []
ci-check = ["cudarc?/ci-check"]

[dev-dependencies]
rand = "0.8.5"
Expand Down
15 changes: 13 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() {
mod cuda {
pub fn build_ptx() {
let out_dir = std::env::var("OUT_DIR").unwrap();
let kernel_paths: Vec<std::path::PathBuf> = glob::glob("src/**/*.cu")
let mut kernel_paths: Vec<std::path::PathBuf> = glob::glob("src/**/*.cu")
.unwrap()
.map(|p| p.unwrap())
.collect();
Expand All @@ -44,8 +44,19 @@ mod cuda {
.map(|s| "-I".to_string() + &s.into_os_string().into_string().unwrap())
.collect::<Vec<_>>();

for kernel_path in kernel_paths {
#[cfg(feature = "ci-check")]
for mut kernel_path in kernel_paths.drain(..) {
kernel_path.set_extension("ptx");

let mut ptx_path: std::path::PathBuf = out_dir.clone().into();
ptx_path.push(kernel_path.as_path().file_name().unwrap());
std::fs::File::create(ptx_path).unwrap();
}

#[cfg(not(feature = "ci-check"))]
for kernel_path in kernel_paths.drain(..) {
println!("cargo:rerun-if-changed={}", kernel_path.display());

let output = std::process::Command::new("nvcc")
.args(["--gpu-architecture", "compute_60"])
.arg("--ptx")
Expand Down