Fix a nasty race condition. #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Cross-platform testing examples | |
# Do this on every push that isn't tagged | |
on: | |
push: | |
tags-ignore: | |
- "**" | |
branches: | |
- "**" | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
CARGO_INCREMENTAL: 0 | |
DEBIAN_FRONTEND: noninteractive | |
MWA_BEAM_FILE: mwa_full_embedded_element_pattern.h5 | |
jobs: | |
test: | |
name: Examples on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, macos-latest] | |
include: | |
- os: macos-latest | |
python-version: [3.7, 3.8, 3.9, 3.10, 3.11] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Dependencies | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt -y update | |
sudo apt -y install libhdf5-dev gcc pkg-config python3{,-pip,-venv} curl wget | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
brew install pkg-config | |
# 1.12 doesn't work? | |
brew install hdf5@1.10 | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- name: Get the HDF5 file | |
run: curl http://ws.mwatelescope.org/static/mwa_full_embedded_element_pattern.h5 -o mwa_full_embedded_element_pattern.h5 | |
- name: Run Rust example | |
run: cargo run --example fee 10 | |
- name: Run C examples | |
run: | | |
cargo build | |
echo "*** Compiling C examples ***" | |
# The macOS runner has clang symlinked as gcc, and attempting to alias | |
# gcc as /usr/local/bin/gcc doesn't work! Why??? | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
gcc -O3 examples/fee.c -o fee -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
gcc -O3 examples/fee_parallel.c -o fee_parallel -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
gcc -O3 -fopenmp examples/fee_parallel_omp.c -o fee_parallel_omp -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
gcc -O3 examples/fee_get_freqs.c -o fee_get_freqs -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
gcc -O3 examples/analytic.c -o analytic -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
gcc -O3 examples/analytic_parallel.c -o analytic_parallel -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
else | |
/usr/local/bin/gcc-12 -O3 examples/fee.c -o fee -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
/usr/local/bin/gcc-12 -O3 examples/fee_parallel.c -o fee_parallel -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
/usr/local/bin/gcc-12 -O3 -fopenmp examples/fee_parallel_omp.c -o fee_parallel_omp -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
/usr/local/bin/gcc-12 -O3 examples/fee_get_freqs.c -o fee_get_freqs -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
/usr/local/bin/gcc-12 -O3 examples/analytic.c -o analytic -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
/usr/local/bin/gcc-12 -O3 examples/analytic_parallel.c -o analytic_parallel -I ./include/ -L ./target/debug/ -l mwa_hyperbeam | |
fi | |
echo "*** Running C examples ***" | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/debug/ ./fee mwa_full_embedded_element_pattern.h5 | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/debug/ ./fee_parallel mwa_full_embedded_element_pattern.h5 | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/debug/ ./fee_parallel_omp mwa_full_embedded_element_pattern.h5 | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/debug/ ./fee_get_freqs mwa_full_embedded_element_pattern.h5 | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/debug/ ./analytic | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/debug/ ./analytic_parallel | |
- name: Run Python example | |
run: | | |
python3 -m venv venv | |
. ./venv/bin/activate | |
pip install numpy maturin | |
echo "*** Compiling Python hyperbeam ***" | |
maturin develop -b pyo3 --features=python | |
echo "*** Running Python examples ***" | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/debug/ ./examples/fee.py mwa_full_embedded_element_pattern.h5 | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/debug/ ./examples/analytic.py | |
- name: CUDA examples | |
if: runner.os == 'Linux' | |
run: | | |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb | |
sudo dpkg -i cuda-keyring_1.0-1_all.deb | |
sudo apt -y update | |
sudo apt -y install cuda --no-install-recommends | |
PATH+=:/usr/local/cuda/bin | |
# Examples may fail because there's no GPU | |
cargo build --features=cuda --example fee_cuda | |
./target/debug/examples/fee_cuda 10 || true | |
cargo build --features=cuda --example analytic_cuda | |
./target/debug/examples/analytic_cuda 10 || true | |
cargo build --features=cuda,gpu-single --example fee_cuda | |
./target/debug/examples/fee_cuda 10 || true | |
cargo build --features=cuda,gpu-single --example analytic_cuda | |
./target/debug/examples/analytic_cuda 10 || true | |
cargo build --release --features=cuda | |
gcc -O3 examples/fee_gpu.c -o fee_cuda -I ./include/ -L ./target/release/ -l mwa_hyperbeam | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release/ ./fee_cuda mwa_full_embedded_element_pattern.h5 || true | |
nvcc -O3 examples/fee_cuda_device.cu -o fee_cuda_device -I ./include/ -L ./target/release/ -l mwa_hyperbeam | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release ./fee_cuda_device mwa_full_embedded_element_pattern.h5 || true | |
gcc -O3 examples/analytic_gpu.c -o analytic_cuda -I ./include/ -L ./target/release/ -l mwa_hyperbeam | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release/ ./analytic_cuda || true | |
nvcc -O3 examples/analytic_cuda_device.cu -o analytic_cuda_device -I ./include/ -L ./target/release/ -l mwa_hyperbeam | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release ./analytic_cuda_device || true | |
cargo build --release --features=cuda,gpu-single | |
gcc -O3 -D SINGLE examples/fee_gpu.c -o fee_cuda -I ./include/ -L ./target/release/ -l mwa_hyperbeam | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release/ ./fee_cuda mwa_full_embedded_element_pattern.h5 || true | |
nvcc -O3 -D SINGLE examples/fee_cuda_device.cu -o fee_cuda_device -I ./include/ -L ./target/release/ -l mwa_hyperbeam | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release ./fee_cuda_device mwa_full_embedded_element_pattern.h5 || true | |
gcc -O3 -D SINGLE examples/analytic_gpu.c -o analytic_cuda -I ./include/ -L ./target/release/ -l mwa_hyperbeam | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release/ ./analytic_cuda || true | |
nvcc -O3 -D SINGLE examples/analytic_cuda_device.cu -o analytic_cuda_device -I ./include/ -L ./target/release/ -l mwa_hyperbeam | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release ./analytic_cuda_device || true | |
. ./venv/bin/activate | |
maturin develop -b pyo3 --features=python,cuda | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release/ ./examples/fee_gpu.py mwa_full_embedded_element_pattern.h5 || true | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release/ ./examples/analytic_gpu.py || true | |
maturin develop -b pyo3 --features=python,cuda,gpu-single | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release/ ./examples/fee_gpu.py mwa_full_embedded_element_pattern.h5 || true | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./target/release/ ./examples/analytic_gpu.py || true |