From 530a74688037047648ae79995efb22c8594004ee Mon Sep 17 00:00:00 2001 From: d3v-null Date: Tue, 20 Aug 2024 01:30:21 +0000 Subject: [PATCH] remove native CPU default --- .cargo/config.toml | 2 -- .github/workflows/coverage.yml | 1 + .github/workflows/run-tests.yml | 1 + README.md | 41 ++++++++++++++++++++++++--------- 4 files changed, 32 insertions(+), 13 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index c729c54..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build] -rustflags = "-C target-cpu=native" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 30223af..31b1b52 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -13,6 +13,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 + RUSTFLAGS: -C target-cpu=native DEBIAN_FRONTEND: noninteractive MWA_BEAM_FILE: mwa_full_embedded_element_pattern.h5 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e5c28f4..f48a164 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,6 +13,7 @@ on: env: CARGO_TERM_COLOR: always CARGO_INCREMENTAL: 0 + RUSTFLAGS: -C target-cpu=native DEBIAN_FRONTEND: noninteractive MWA_BEAM_FILE: mwa_full_embedded_element_pattern.h5 diff --git a/README.md b/README.md index 3552337..65588a1 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,10 @@ their respective licenses are also distributed. Clone the repo, and run: - cargo build --release +```bash +export RUSTFLAGS="-C target-cpu=native" # (optional) Use native CPU features (not portable!) +cargo build --release +``` For usage with other languages, an include file will be in the `include` directory, along with C-compatible shared and static objects in the @@ -137,13 +140,17 @@ directory, along with C-compatible shared and static objects in the Are you running `hyperbeam` on a desktop GPU? Then you probably want to compile with single-precision floats: - cargo build --release --features=cuda,gpu-single - cargo build --release --features=hip,gpu-single +```bash +cargo build --release --features=cuda,gpu-single +cargo build --release --features=hip,gpu-single +``` Otherwise, go ahead with double-precision floats: - cargo build --release --features=cuda - cargo build --release --features=hip +```bash +cargo build --release --features=cuda +cargo build --release --features=hip +``` Desktop GPUs (e.g. NVIDIA GeForce RTX 2070) have significantly less double-precision compute capability than "data center" GPUs (e.g. NVIDIA V100). @@ -152,7 +159,9 @@ between the performance and precision compromise. `CUDA` can also be linked statically: - cargo build --release --features=cuda,cuda-static +```bash +cargo build --release --features=cuda,cuda-static +``` #### HIP The situation with `HIP` is similar to that of `CUDA`; use the `hip` feature and @@ -163,7 +172,9 @@ not appear to offer static libraries, so no static feature is provided. To make `hyperbeam` without a dependence on a system `HDF5` library, give the `build` command a feature flag: - cargo build --release --features=hdf5-static +```bash +cargo build --release --features=hdf5-static +``` This will automatically compile the HDF5 source code and "bake" it into the `hyperbeam` products, meaning that HDF5 is not needed as a system dependency. @@ -171,18 +182,24 @@ This will automatically compile the HDF5 source code and "bake" it into the To compile all C libraries statically: - cargo build --release --features=all-static +```bash +cargo build --release --features=all-static +``` #### Python To install `hyperbeam` to your currently-in-use virtualenv or conda environment, you'll need the Python package `maturin` (can get it with `pip`), then run: - maturin develop --release -b pyo3 --features=python --strip +```bash +maturin develop --release -b pyo3 --features=python --strip +``` If you don't have or don't want to install HDF5 as a system dependency, include the `hdf5-static` feature: - maturin develop --release -b pyo3 --features=python,hdf5-static --strip +```bash +maturin develop --release -b pyo3 --features=python,hdf5-static --strip +``` ## Comparing with other FEE beam codes Below is a table comparing other implementations of the FEE beam code. All @@ -222,7 +239,9 @@ know. Run your code with `hyperbeam` again, but this time with the debug build. This should be as simple as running: - cargo build +```bash +cargo build +``` and then using the results in `./target/debug`.