Skip to content

Commit

Permalink
HIP support.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjordan committed Sep 26, 2023
1 parent 4006294 commit f4718dc
Show file tree
Hide file tree
Showing 46 changed files with 1,036 additions and 920 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
LICENSE COPYING-hdf5 LICENSE-erfa LICENSE-cfitsio LICENSE-NVIDIA README.md \
hyperdrive
cargo build --profile production --locked --no-default-features --features=hdf5-static,cfitsio-static,cuda-single
cargo build --profile production --locked --no-default-features --features=hdf5-static,cfitsio-static,cuda,gpu-single
mv target/production/hyperdrive .
tar -acvf mwa_hyperdrive-$(git describe --tags)-Linux-x86-64-v3-CUDA-single.tar.gz \
LICENSE COPYING-hdf5 LICENSE-erfa LICENSE-cfitsio LICENSE-NVIDIA README.md \
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,7 @@ jobs:
cargo clean
cargo +${MIN_RUST} test --locked
cargo +${MIN_RUST} test --locked --features=all-static
cargo +${MIN_RUST} test --locked --all-features --no-run
# Can't test with --all-features, cuda and hip aren't allowed together
# hip is also difficult to install so ignore it
cargo +${MIN_RUST} test --locked --features=all-static,cuda --no-run
cargo +${MIN_RUST} test --locked --features=all-static,cuda,gpu-single --no-run
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.0] - Unreleased
### Added
- Support for HIP, which allows AMD GPUs to be used instead of only NVIDIA GPUs
via CUDA.
- Support for the "DipAmps" column in a metafits file. This allows users to
control dipole gains in beam code.
- Support for averaging incoming visibilities in time and frequency *before*
Expand Down
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ inherits = "production"
default = ["plotting"]

# Use CUDA code with double-precision floats.
cuda = ["mwa_hyperbeam/cuda", "cuda-runtime-sys"]
cuda = ["mwa_hyperbeam/cuda", "cuda-runtime-sys", "cc"]

# Use CUDA code with single-precision floats.
cuda-single = [
"cuda",
"mwa_hyperbeam/gpu-single",
]
# Use HIP code with double-precision floats.
hip = ["mwa_hyperbeam/hip", "hip-sys", "cc"]

# Opt-out of GPU double precision, use only single precision (faster on desktop
# GPUs).
gpu-single = ["mwa_hyperbeam/gpu-single"]

# Enable plotting.
plotting = ["plotters"]
Expand Down Expand Up @@ -100,6 +101,9 @@ vec1 = { version = "1.5.0", features = ["serde"] }
# "cuda" feature
cuda-runtime-sys = { version = "0.3.0-alpha.1", optional = true }

# "hip" feature
hip-sys = { version = "0.1.0", optional = true }

# "plotting" feature
plotters = { version = "0.3.5", default-features = false, features = [
"bitmap_backend",
Expand All @@ -121,7 +125,8 @@ tempfile = "3.6.0"

[build-dependencies]
built = { version = "0.6.0", features = ["chrono", "git2"] }
cc = { version = "1.0.72", features = ["parallel"] }
cc = { version = "1.0.72", features = ["parallel"], optional = true }
hip-sys = { version = "0.1.0", optional = true }

[[bench]]
name = "bench"
Expand Down
12 changes: 6 additions & 6 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn model_benchmarks(c: &mut Criterion) {
);
}

#[cfg(feature = "cuda")]
#[cfg(any(feature = "cuda", feature = "hip"))]
for (num_sources, num_chans) in [
(1, 768),
(32, 768),
Expand Down Expand Up @@ -130,7 +130,7 @@ fn model_benchmarks(c: &mut Criterion) {
},
);
}
let modeller = model::SkyModellerCuda::new(
let modeller = model::SkyModellerGpu::new(
&*beam,
&source_list,
Polarisations::default(),
Expand Down Expand Up @@ -209,7 +209,7 @@ fn model_benchmarks(c: &mut Criterion) {
})
});

#[cfg(feature = "cuda")]
#[cfg(any(feature = "cuda", feature = "hip"))]
for (num_sources, num_chans) in [
(1, 768),
(32, 768),
Expand Down Expand Up @@ -251,7 +251,7 @@ fn model_benchmarks(c: &mut Criterion) {
},
);
}
let modeller = model::SkyModellerCuda::new(
let modeller = model::SkyModellerGpu::new(
&*beam,
&source_list,
Polarisations::default(),
Expand Down Expand Up @@ -342,7 +342,7 @@ fn model_benchmarks(c: &mut Criterion) {
},
);

#[cfg(feature = "cuda")]
#[cfg(any(feature = "cuda", feature = "hip"))]
for (num_sources, num_chans) in [
(1, 768),
(32, 768),
Expand Down Expand Up @@ -393,7 +393,7 @@ fn model_benchmarks(c: &mut Criterion) {
},
);
}
let modeller = model::SkyModellerCuda::new(
let modeller = model::SkyModellerGpu::new(
&*beam,
&source_list,
Polarisations::default(),
Expand Down
Loading

0 comments on commit f4718dc

Please sign in to comment.