Skip to content

Add CUDA infrastructure #108

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- name: Generate code coverage
run: cargo llvm-cov nextest --all-features --no-cfg-coverage --codecov --output-path codecov.json
run: cargo llvm-cov nextest --features=std,pregenerated,tracing --no-cfg-coverage --codecov --output-path codecov.json
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
26 changes: 19 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --all --check
run: cargo fmt --check

build-and-test:
name: Build and Test
Expand All @@ -29,37 +29,49 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --all-features
run: cargo build --features=std,pregenerated,tracing
- uses: taiki-e/install-action@nextest
- name: Test
run: cargo nextest run --all-features
run: cargo nextest run --features=std,pregenerated,tracing

build-no-std:
name: Build `no_std` Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build no_std version
run: cargo build --no-default-features
run: cargo build --no-default-features --features=pregenerated,tracing
- uses: taiki-e/install-action@nextest
- name: Test `no_std` version
run: cargo nextest run --no-default-features
run: cargo nextest run --no-default-features --features=pregenerated,tracing

build-cuda:
name: Build With CUDA Support
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Jimver/cuda-toolkit@master
- name: Build CUDA-Enabled version
run: cargo build --no-default-features --features=std,cuda
- uses: taiki-e/install-action@nextest
- name: Test CUDA-Enabled version
run: cargo nextest run --no-default-features --features=std,cuda

clippy:
name: Check Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Clippy
run: cargo clippy --all
run: cargo clippy

doc:
name: Check Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Documentation
run: cargo doc --all
run: cargo doc

deny:
name: Check Licenses and CVEs
Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,60 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: cargo fmt --all --check
run: cargo fmt --check

build-and-test:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --all-features
run: cargo build --features=std,pregenerated,tracing
- uses: taiki-e/install-action@nextest
- name: Test
run: cargo nextest run --all-features
run: cargo nextest run --features=std,pregenerated,tracing

build-no-std:
name: Build `no_std` Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build no_std version
run: cargo build --no-default-features
run: cargo build --no-default-features --features=pregenerated,tracing
- uses: taiki-e/install-action@nextest
- name: Test `no_std` version
run: cargo nextest run --no-default-features
run: cargo nextest run --no-default-features --features=pregenerated,tracing

build-cuda:
name: Build With CUDA Support
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Jimver/cuda-toolkit@master
- name: Build CUDA-Enabled version
run: cargo build --no-default-features --features=std,cuda
- uses: taiki-e/install-action@nextest
- name: Test CUDA-Enabled version
run: cargo nextest run --no-default-features --features=std,cuda

clippy:
name: Check Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Clippy
run: cargo clippy --all
run: cargo clippy

doc:
name: Check Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Documentation
run: cargo doc --all
run: cargo doc

deny:
name: Check Licenses and CVEs
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ We use GitHub issues to track bugs and errors. If you run into an issue with the

- Before beginning the process, set up your environment, with your favorite IDE/Code Editor, and have the relevant Rust extensions/plugins installed.
- In order to save your precious time, and shorten the process for your PRs to be acknowledged, reviewed, and approved, please add the following jobs to your IDE.
* Compile the project: `cargo build --all`
* Run the 'Clippy' linter on the project: `cargo clippy --all`
* Generate the project documentation: `cargo doc --all`
* Run the project tests: `cargo test --all`
* Compile the project: `cargo build`
* Run the 'Clippy' linter on the project: `cargo clippy`
* Generate the project documentation: `cargo doc`
* Run the project tests: `cargo <test/nextest>`
- Please ensure these jobs pass on your local machine with both:
- The standard library and all required features (by adding `--all-features` after the job)
- Without the standard library (by adding `--no-default-features --features=pregenerated` after the job)
Expand Down
40 changes: 40 additions & 0 deletions crates/algorithms/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use std::fs;
use std::path::PathBuf;

fn scan_dir_recursively(entry_path: PathBuf, cuda_files: &mut Vec<PathBuf>) {
for entry in fs::read_dir(entry_path).unwrap().filter_map(Result::ok) {
let entry_path = entry.path();
let entry_type = entry.file_type().unwrap();

if entry_type.is_file()
&& entry_path
.extension()
.map(|ext| ext == "cu")
.unwrap_or_default()
{
cuda_files.push(entry_path);
continue;
}

if entry_type.is_dir() {
scan_dir_recursively(entry_path, cuda_files);
}
}
}

fn main() {
#[cfg(feature = "cuda")]
{
let mut cuda_files = vec![];
scan_dir_recursively(PathBuf::from("src/cuda_kernels"), &mut cuda_files);

if !cuda_files.is_empty() {
cc::Build::new()
.compiler("nvcc")
.no_default_flags(true)
.warnings(false)
.files(cuda_files)
.compile("algorithms_cuda_kernels")
}
}
}
1 change: 1 addition & 0 deletions crates/suites/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}
Loading