Skip to content

Commit f9d311f

Browse files
Add amdflang to CI
Co-authored-by: Paul Mullowney <[email protected]>
1 parent eda7b50 commit f9d311f

File tree

2 files changed

+100
-1
lines changed

2 files changed

+100
-1
lines changed

.github/tools/install-amd-flang.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/sh
2+
3+
# Install amdflang new
4+
#
5+
#
6+
# Originally written for Squash <https://github.com/quixdb/squash> by
7+
# Evan Nemerson. For documentation, bug reports, support requests,
8+
# etc. please use <https://github.com/nemequ/pgi-travis>.
9+
#
10+
# To the extent possible under law, the author(s) of this script have
11+
# waived all copyright and related or neighboring rights to this work.
12+
# See <https://creativecommons.org/publicdomain/zero/1.0/> for
13+
# details.
14+
15+
version=6.0.0
16+
17+
TEMPORARY_FILES="${TMPDIR:-/tmp}"
18+
export AMDFLANG_NEW_INSTALL_DIR=$(pwd)/amdflang-new-install
19+
export AMDFLANG_NEW_SILENT=true
20+
while [ $# != 0 ]; do
21+
case "$1" in
22+
"--prefix")
23+
export AMDFLANG_NEW_INSTALL_DIR="$2"; shift
24+
;;
25+
"--tmpdir")
26+
TEMPORARY_FILES="$2"; shift
27+
;;
28+
"--verbose")
29+
export AMDFLANG_NEW_SILENT=false;
30+
;;
31+
"--version")
32+
version="$2"; shift
33+
;;
34+
*)
35+
echo "Unrecognized argument '$1'"
36+
exit 1
37+
;;
38+
esac
39+
shift
40+
done
41+
42+
# Example download URL for version 6.0.0
43+
# https://repo.radeon.com/rocm/misc/flang/rocm-afar-7450-drop-6.0.0-ubu.tar.bz2
44+
45+
ver="$(echo $version | tr -d . )"
46+
BASENAME=$(curl -s "https://repo.radeon.com/rocm/misc/flang/" | grep -oP "rocm-afar-[1-9][0-9]*-drop-{1}.{2}.{3}" | sort | tail -1)
47+
URL_SHORT=$(curl -s "https://repo.radeon.com/rocm/misc/flang/" | grep -oP "$BASENAME-ubu[a-z]*.tar.bz2" | sort | tail -1)
48+
URL=https://repo.radeon.com/rocm/misc/flang/${URL_SHORT}
49+
50+
if [ ! -f "${TEMPORARY_FILES}/${URL_SHORT}" ]; then
51+
echo "Downloading [${URL}]"
52+
wget -P ${TEMPORARY_FILES} "${URL}"
53+
else
54+
echo "Download already present in ${TEMPORARY_FILES}"
55+
fi
56+
57+
if [ ! -d "${AMDFLANG_NEW_INSTALL_DIR}/${BASENAME}" ]; then
58+
if [ ! -d "${AMDFLANG_NEW_INSTALL_DIR}" ]; then
59+
mkdir -p ${AMDFLANG_NEW_INSTALL_DIR}
60+
fi
61+
tar xjf ${TEMPORARY_FILES}/${URL_SHORT} -C ${AMDFLANG_NEW_INSTALL_DIR}
62+
else
63+
echo "Install already present in ${AMDFLANG_NEW_INSTALL_DIR}"
64+
fi
65+
66+
INSTALL_DIR="${AMDFLANG_NEW_INSTALL_DIR}/${BASENAME}"
67+
echo "export AMDFLANG_INSTALL_DIR=${INSTALL_DIR}" > ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
68+
echo "export LD_LIBRARY_PATH=${INSTALL_DIR}/lib:\$LD_LIBRARY_PATH" > ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
69+
echo "export LIBRARY_PATH=${INSTALL_DIR}/lib:\$LIBRARY_PATH" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
70+
echo "export LIBRARY_PATH=${INSTALL_DIR}/llvm/lib:\$LIBRARY_PATH" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
71+
echo "export C_INCLUDE_PATH=${INSTALL_DIR}/include:\$C_INCLUDE_PATH" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
72+
echo "export CPLUS_INCLUDE_PATH=${INSTALL_DIR}/include:\$CPLUS_INCLUDE_PATH" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
73+
echo "export CPATH=${INSTALL_DIR}/include:\$CPATH" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
74+
echo "export PATH=${INSTALL_DIR}/bin:\$PATH" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
75+
echo "export INCLUDE=${INSTALL_DIR}/include:\$INCLUDE" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
76+
echo "export MANPATH=${INSTALL_DIR}/share/man:\$MANPATH" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
77+
echo "export DEVICE_LIB_PATH=${INSTALL_DIR}/amdgcn/bitcode" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
78+
echo "export ROCM_RUNTIME_PATH=${INSTALL_DIR}" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
79+
echo "export CC=amdclang" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
80+
echo "export CXX=amdclang++" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
81+
echo "export FC=amdflang-new" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
82+
echo "export LLVM_PATH=${INSTALL_DIR}" >> ${AMDFLANG_NEW_INSTALL_DIR}/env.sh
83+
chmod +x ${AMDFLANG_NEW_INSTALL_DIR}/env.sh

.github/workflows/build.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- linux clang-18
3636
- linux nvhpc-25.1
3737
- linux intel-classic
38+
- linux amd-flang
3839
- macos
3940

4041
include:
@@ -67,14 +68,21 @@ jobs:
6768
ctest_options: -E memory
6869
caching: false
6970

70-
- name : linux intel-classic
71+
- name: linux intel-classic
7172
os: ubuntu-22.04
7273
compiler: intel-classic
7374
compiler_cc: icc
7475
compiler_cxx: icpc
7576
compiler_fc: ifort
7677
caching: true
7778

79+
- name: linux amd-flang-6.0.0
80+
os: ubuntu-24.04
81+
compiler: amd-flang-6.0.0
82+
compiler_cc: amdclang
83+
compiler_cxx: amdclang++
84+
compiler_fc: amdflang-new
85+
7886
- name: macos
7987
# Xcode compiler requires empty environment variables, so we pass null (~) here
8088
os: macos-13
@@ -150,6 +158,14 @@ jobs:
150158
printenv >> $GITHUB_ENV
151159
echo "CACHE_SUFFIX=$CC-$($CC -dumpversion)" >> $GITHUB_ENV
152160
161+
- name: Install AMD flang compiler
162+
if: contains( matrix.compiler, 'amd-flang' )
163+
shell: bash -eux {0}
164+
run: |
165+
${ECTRANS_TOOLS}/install-amd-flang.sh --prefix /opt/amd-flang
166+
source /opt/amd-flang/env.sh
167+
echo "${AMDFLANG_INSTALL_DIR}/bin" >> $GITHUB_PATH
168+
153169
- name: Install MPI
154170
shell: bash -eux {0}
155171
run: |

0 commit comments

Comments
 (0)