Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(build) add aocc installation #532

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
fail-fast: false
matrix:
system:
- aocc
- gfortran
- ifort
batch: ${{ fromJson(needs.matrix_prep.outputs.batch) }}
Expand Down Expand Up @@ -105,6 +106,40 @@ jobs:
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV

- name: Install AOCC compiler
if: matrix.system == 'aocc'
id: aocc-install
run: |
REPO_NAME=aocc_flang
TMP_DIR="$(mktemp -d)"
cd "$TMP_DIR" || exit 42
git clone https://github.com/zaikunzhang/"$REPO_NAME".git
cd "$REPO_NAME" || exit 42
AOCC_7Z="aocc_flang.deb.7z.001"
7za x "$AOCC_7Z" -aoa # -aoa: overwrite all existing files without prompt
sudo apt update && sudo apt install p7zip-full libncurses* -y # libncurses* needed for libtinfo.so
sudo dpkg -i "$TMP_DIR"/"$REPO_NAME"/aocc_flang.deb
rm -rf "$TMP_DIR"
# Run the script that sets the necessary environment variables and then damp them to $GITHUB_ENV
# so that they are available in subsequent steps.
if [[ -d /opt/AMD ]] ; then
AOCCDIR="$(find /opt/AMD -maxdepth 1 -name "aocc-compiler*" -type d -print | sort | tail -n 1)"
AOCC_ENVSH="$(find "$AOCCDIR" -name "*setenv*.sh" -type f)"
#shellcheck disable=SC1090
source "$AOCC_ENVSH"
AFLANG="$(find "$AOCCDIR" -type f -executable -name "clang-*" | grep -E "clang-[0-9]{2}" | head -1)"
if [[ -n "$AFLANG" ]] ; then sudo ln -s "$AFLANG" "$(dirname "$AFLANG")"/aflang ; fi
export PATH=$(dirname "$AFLANG"):$PATH
else
exit 1
fi
env | grep -i 'aocc\|AMD' >> "$GITHUB_ENV"
# Show the result of the installation.
echo "The AOCC flang installed is:"
aflang --version
echo "The path to AOCC flang is:"
command -v aflang

- name: Install numpy and matplotlib for analysis unit tests
run: |
sudo apt-get install -y python3-numpy
Expand Down
4 changes: 2 additions & 2 deletions src/setup/set_hierarchical_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,13 @@ subroutine find_hier_level_orb_elem(hl_temp, hs, m1, m2, accr1, accr2, &
!print *,'labels passing: ', trim(adjustl(hl_temp))//'1 ', m1,trim(adjustl(hl_temp))//'2 ',m2

if (any(hs%labels%sink == trim(adjustl(hl_temp))//'1')) then
accr1 = hs%sinks(findloc(hs%labels%sink,trim(adjustl(hl_temp))//'1', 1))%accr
accr1 = hs%sinks( maxloc( merge(0,1,hs%labels%sink==trim(adjustl(hl_temp))//'1' ), 1) )%accr
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would suggest to at least write a helper function here like findloc_nof08 to avoid repeated code

else
accr1 = 1.
endif

if (any(hs%labels%sink == trim(adjustl(hl_temp))//'2')) then
accr2 = hs%sinks(findloc(hs%labels%sink,trim(adjustl(hl_temp))//'2', 1))%accr
accr2 = hs%sinks( maxloc( merge(0,1,hs%labels%sink==trim(adjustl(hl_temp))//'2' ), 1) )%accr
else
accr2 = 1.
endif
Expand Down
Loading