-
Notifications
You must be signed in to change notification settings - Fork 9
145 lines (128 loc) · 4.82 KB
/
check-linux-mpi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
name: check-linux-mpi
jobs:
check-linux-mpi:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }}_r-${{ matrix.config.r }}_${{ matrix.config.mpi }}
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release', mpi: 'openmpi'}
- {os: ubuntu-latest, r: 'release', mpi: 'mpich'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v4
with:
path: RNetCDF
- uses: actions/checkout@v4
with:
repository: Unidata/netcdf-c
path: netcdf-c
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: release
use-public-rspm: true
- name: Install system dependencies
run: |
case "${{ matrix.config.mpi }}" in
openmpi) sudo apt-get install -y libhdf5-openmpi-dev openmpi-bin ;;
mpich) sudo apt-get install -y libhdf5-mpich-dev mpich ;;
*) echo "Unknown MPI variant"; exit 1 ;;
esac
shell: bash
- name: Install netcdf with chosen MPI
working-directory: netcdf-c
run: |
echo ::group::autoreconf
autoreconf -if
echo ::endgroup::
echo ::group::configure
inc_path="/usr/include/hdf5/${{ matrix.config.mpi }}"
lib_path="/usr/lib/x86_64-linux-gnu/hdf5/${{ matrix.config.mpi }}"
./configure CC="mpicc.${{ matrix.config.mpi }}" \
CPPFLAGS="-I${inc_path}" \
LDFLAGS="-L${lib_path} -Wl,-rpath=${lib_path}"
echo ::endgroup::
echo ::group::make
make
echo ::endgroup::
echo ::group::make install
sudo make install
echo ::endgroup::
shell: bash
- name: Install R dependencies with chosen MPI
run: |
cat("::group::bit64\n")
install.packages("bit64")
cat("::endgroup::\n")
if ("${{ matrix.config.mpi }}" == "openmpi") {
Rmpi_type <- "OPENMPI"
pbdMPI_type <- "OPENMPI"
mpi_include <- "/usr/lib/x86_64-linux-gnu/openmpi/include"
mpi_lib <- "/usr/lib/x86_64-linux-gnu/openmpi/lib"
} else if ("${{ matrix.config.mpi }}" == "mpich") {
Rmpi_type <- "MPICH2"
pbdMPI_type <- "MPICH3"
mpi_include <- "/usr/include/x86_64-linux-gnu/mpich"
mpi_lib <- "/usr/lib/x86_64-linux-gnu"
} else {
stop("Unknown MPI variant")
}
cat("::group::Rmpi\n")
install.packages("parallel")
install.packages("Rmpi", type="source",
repos="https://cloud.r-project.org",
configure.args=c(paste0("--with-Rmpi-type=", Rmpi_type),
paste0("--with-Rmpi-include=", mpi_include),
paste0("--with-Rmpi-libpath=", mpi_lib)))
cat("::endgroup::\n")
cat("::group::pbdMPI\n")
install.packages(c("rlecuyer", "float"))
install.packages("pbdMPI", type="source",
repos="https://cloud.r-project.org",
configure.args=c(paste0("--with-mpi-type=", pbdMPI_type),
paste0("--with-mpi-include=", mpi_include),
paste0("--with-mpi-libpath=", mpi_lib)))
cat("::endgroup::\n")
shell: Rscript {0}
- name: Check RNetCDF with chosen MPI
run: |
echo ::group::Build RNetCDF
R CMD build RNetCDF
echo ::endgroup::
echo ::group::Check RNetCDF
Rscript -e "library(Rmpi); library(pbdMPI);"
mpicc="mpicc.${{ matrix.config.mpi }}"
mpiexec="mpiexec.${{ matrix.config.mpi }}"
R CMD check --no-manual \
--install-args="--configure-args='--without-nc-config \
--with-mpiexec=$mpiexec --with-mpicc=$mpicc'" \
RNetCDF_*.*-*.tar.gz
echo ::endgroup::
shell: bash
- name: Upload check directory
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.os }}_r-${{ matrix.config.r }}_${{ matrix.config.mpi }}
path: RNetCDF.Rcheck/
retention-days: 5
- name: Show RNetCDF install output
run: |
cat RNetCDF.Rcheck/00install.out
shell: bash
- name: Show RNetCDF test output
run: |
cat RNetCDF.Rcheck/tests/RNetCDF-test.Rout*
shell: bash