Skip to content

Commit 4053052

Browse files
ptheywoodmondus
authored andcommitted
CI: Replace Manylinux2014 with Manylinux_2_28 and update deprecated github actions
Node 16 Github actions are deprecated, but node 20 actions are incompatible with Manylinux_2014/CentOS7. - Replaces manylinux wheel building to use 2_28 (based on Alma 8) - Updates depreacted actions in all workflows.
1 parent c8407d7 commit 4053052

10 files changed

Lines changed: 238 additions & 70 deletions

File tree

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Install CUDA on Alma8/manylinux_2_28.
2+
3+
## -------------------
4+
## Constants
5+
## -------------------
6+
7+
# dnf install cuda-nvrtc-devel-11-4 cuda-compiler-11-4 cuda-cudart-devel-11-4 cuda-nvcc-11-4 cuda-nvrtc-11-4 cuda-nvtx-11-4 libcurand-devel-11-4
8+
9+
# List of sub-packages to install.
10+
# @todo - pass this in from outside the script?
11+
# @todo - check the specified subpackages exist via apt pre-install? apt-rdepends cuda-9-0 | grep "^cuda-"?
12+
13+
# Ideally choose from the list of meta-packages to minimise variance between cuda versions (although it does change too)
14+
CUDA_PACKAGES_IN=(
15+
"cuda-compiler"
16+
"cuda-cudart-devel" # libcudart.so
17+
"cuda-driver-devel" # libcuda.so
18+
"cuda-nvtx"
19+
"cuda-nvrtc-devel"
20+
"libcurand-devel" # 11-0+
21+
)
22+
23+
## -------------------
24+
## Bash functions
25+
## -------------------
26+
# returns 0 (true) if a >= b
27+
function version_ge() {
28+
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
29+
[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" == "$2" ]
30+
}
31+
# returns 0 (true) if a > b
32+
function version_gt() {
33+
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
34+
[ "$1" = "$2" ] && return 1 || version_ge $1 $2
35+
}
36+
# returns 0 (true) if a <= b
37+
function version_le() {
38+
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
39+
[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" == "$1" ]
40+
}
41+
# returns 0 (true) if a < b
42+
function version_lt() {
43+
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
44+
[ "$1" = "$2" ] && return 1 || version_le $1 $2
45+
}
46+
47+
48+
## -------------------
49+
## Select CUDA version
50+
## -------------------
51+
52+
# Get the cuda version from the environment as $cuda.
53+
CUDA_VERSION_MAJOR_MINOR=${cuda}
54+
55+
# Split the version.
56+
# We (might/probably) don't know PATCH at this point - it depends which version gets installed.
57+
CUDA_MAJOR=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f1)
58+
CUDA_MINOR=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f2)
59+
CUDA_PATCH=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f3)
60+
# query rpm to find the major enterprise linux release
61+
EL_MAJOR=$(rpm -E %{rhel})
62+
63+
echo "CUDA_MAJOR: ${CUDA_MAJOR}"
64+
echo "CUDA_MINOR: ${CUDA_MINOR}"
65+
echo "CUDA_PATCH: ${CUDA_PATCH}"
66+
echo "EL_MAJOR: ${EL_MAJOR}"
67+
68+
# If we don't know the CUDA_MAJOR or MINOR, error.
69+
if [ -z "${CUDA_MAJOR}" ] ; then
70+
echo "Error: Unknown CUDA Major version. Aborting."
71+
exit 1
72+
fi
73+
if [ -z "${CUDA_MINOR}" ] ; then
74+
echo "Error: Unknown CUDA Minor version. Aborting."
75+
exit 1
76+
fi
77+
# If we don't know the Ubuntu version, error.
78+
if [ -z ${EL_MAJOR} ]; then
79+
echo "Error: Unknown EL version. Aborting."
80+
exit 1
81+
fi
82+
83+
## -------------------------------
84+
## Select CUDA packages to install
85+
## -------------------------------
86+
CUDA_PACKAGES=""
87+
for package in "${CUDA_PACKAGES_IN[@]}"
88+
do :
89+
# CUDA < 11, lib* packages were actually cuda-cu* (generally, this might be greedy.)
90+
if [[ ${package} == libcu* ]] && version_lt "$CUDA_VERSION_MAJOR_MINOR" "11.0" ; then
91+
package="${package/libcu/cuda-cu}"
92+
fi
93+
# CUDA < 11, -devel- packages were actually -dev
94+
if [[ ${package} == *devel* ]] && version_lt "$CUDA_VERSION_MAJOR_MINOR" "11.0" ; then
95+
package="${package//devel/dev}"
96+
fi
97+
# Build the full package name and append to the string.
98+
CUDA_PACKAGES+=" ${package}-${CUDA_MAJOR}-${CUDA_MINOR}"
99+
done
100+
echo "CUDA_PACKAGES ${CUDA_PACKAGES}"
101+
102+
## -----------------
103+
## Prepare to install
104+
## -----------------
105+
106+
CPU_ARCH="x86_64"
107+
# Nvidia don't provide an explicit alma repo. 11.2's closest is RHEL.
108+
# 12.4 includes rocky8/9, rhel7/8/9, cent7, so RHEL is the closes that should hopefully be fine, otherwise will have to switch to the much slower runfile installer.
109+
DNF_REPO_URI="https://developer.download.nvidia.com/compute/cuda/repos/rhel${EL_MAJOR}/${CPU_ARCH}/cuda-rhel${EL_MAJOR}.repo"
110+
111+
echo "DNF_REPO_URI ${DNF_REPO_URI}"
112+
113+
## -----------------
114+
## Check for root/sudo
115+
## -----------------
116+
117+
# Detect if the script is being run as root, storing true/false in is_root.
118+
is_root=false
119+
if (( $EUID == 0)); then
120+
is_root=true
121+
fi
122+
# Find if sudo is available
123+
has_sudo=false
124+
if command -v sudo &> /dev/null ; then
125+
has_sudo=true
126+
fi
127+
# Decide if we can proceed or not (root or sudo is required) and if so store whether sudo should be used or not.
128+
if [ "$is_root" = false ] && [ "$has_sudo" = false ]; then
129+
echo "Root or sudo is required. Aborting."
130+
exit 1
131+
elif [ "$is_root" = false ] ; then
132+
USE_SUDO=sudo
133+
else
134+
USE_SUDO=
135+
fi
136+
137+
## -----------------
138+
## Install
139+
## -----------------
140+
echo "Adding CUDA Repository"
141+
$USE_SUDO dnf config-manager --add-repo ${DNF_REPO_URI}
142+
$USE_SUDO dnf clean all
143+
144+
echo "Installing CUDA packages ${CUDA_PACKAGES}"
145+
$USE_SUDO dnf -y install ${CUDA_PACKAGES}
146+
147+
if [[ $? -ne 0 ]]; then
148+
echo "CUDA Installation Error."
149+
exit 1
150+
fi
151+
152+
## -----------------
153+
## Set environment vars / vars to be propagated
154+
## -----------------
155+
156+
CUDA_PATH=/usr/local/cuda-${CUDA_MAJOR}.${CUDA_MINOR}
157+
echo "CUDA_PATH=${CUDA_PATH}"
158+
export CUDA_PATH=${CUDA_PATH}
159+
export PATH="$CUDA_PATH/bin:$PATH"
160+
export LD_LIBRARY_PATH="$CUDA_PATH/lib:$LD_LIBRARY_PATH"
161+
export LD_LIBRARY_PATH="$CUDA_PATH/lib64:$LD_LIBRARY_PATH"
162+
# Check nvcc is now available.
163+
nvcc -V
164+
165+
# If executed on github actions, make the appropriate echo statements to update the environment
166+
if [[ $GITHUB_ACTIONS ]]; then
167+
# Set paths for subsequent steps, using ${CUDA_PATH}
168+
echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH"
169+
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
170+
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
171+
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
172+
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
173+
fi

.github/workflows/CMake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
CMAKE: ${{ matrix.cmake }}
6969

7070
steps:
71-
- uses: actions/checkout@v3
71+
- uses: actions/checkout@v4
7272

7373
- name: Install cmake from GitHub Releases
7474
if: ${{ env.CMAKE != '' && env.CMAKE != 'default' }}
@@ -96,7 +96,7 @@ jobs:
9696
9797
- name: Select Python
9898
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
99-
uses: actions/setup-python@v4
99+
uses: actions/setup-python@v5
100100
with:
101101
python-version: ${{ env.PYTHON }}
102102

.github/workflows/Docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
# Define constants
2727
BUILD_DIR: "build"
2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3030

3131
- name: Install doxygen >= 1.9.0 + other dependencies
3232
run: |

0 commit comments

Comments
 (0)