Skip to content

Added run_HeCBench.sh to aomp/bin. - #2396

Open
Lynd98 wants to merge 4 commits into
aomp-devfrom
runHeCBench
Open

Added run_HeCBench.sh to aomp/bin.#2396
Lynd98 wants to merge 4 commits into
aomp-devfrom
runHeCBench

Conversation

@Lynd98

@Lynd98 Lynd98 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Allow developers to easily run HeCBench (a suite of benchmarks) with hip and aomp. They can run individual
benchmarks with run_HeCBench.sh.

Technical Details

Added run_HeCBench.sh

Comment thread bin/run_HeCBench.sh Outdated
Comment thread bin/run_HeCBench.sh Outdated
Comment thread bin/run_HeCBench.sh Outdated
Comment thread bin/run_HeCBench.sh Outdated

@mhalk mhalk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Generally: make sure this script is shellcheck-compliant.
IMHO the VERBOSE-handling makes the script much harder to read and constantly "breaks the flow".

Comment thread bin/run_HeCBench.sh Outdated
Comment thread bin/run_HeCBench.sh Outdated
Comment thread bin/run_HeCBench.sh
Comment thread bin/run_HeCBench.sh Outdated
Comment thread bin/run_HeCBench.sh Outdated
Comment thread bin/run_HeCBench.sh Outdated
@Lynd98
Lynd98 requested review from jplehr and mhalk August 5, 2026 19:46
Comment thread bin/run_HeCBench.sh Outdated
_AOMP_USER_SET=0
_ROCM_USER_SET=0
[ -n "${AOMP+x}" ] && _AOMP_USER_SET=1
[ -n "${ROCM+x}" ] && _ROCM_USER_SET=1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment thread bin/run_HeCBench.sh
Comment on lines +51 to +70
# shellcheck source=aomp_common_vars
_AOMP_USER_SET=0
_ROCM_USER_SET=0
[ -n "${AOMP+x}" ] && _AOMP_USER_SET=1
[ -n "${ROCM+x}" ] && _ROCM_USER_SET=1
# shellcheck disable=SC1091
. "$thisdir/aomp_common_vars"
# --- end standard header ----

# Setup AOMP / ROCM (see header for rules)
if [ "$_AOMP_USER_SET" -eq 1 ]; then
if [ "$_ROCM_USER_SET" -eq 0 ]; then
ROCM=$(realpath -m "$(realpath -m "$AOMP")"/../..)
fi
else
export AOMP=/opt/rocm/lib/llvm
if [ "$_ROCM_USER_SET" -eq 0 ]; then
export ROCM=/opt/rocm
fi
fi

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems more code and more complicated than it need to be?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Setting the default for ROCM_PATH and then exporting it is a bit more complicated than setting the default for AOMP and then exporting it. Hence added lines.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Simplified.

Comment thread bin/run_HeCBench.sh Outdated
@@ -49,31 +48,24 @@ thisdir=$(dirname "$realpath")
export AOMP_USE_CCACHE=0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How is this used in this script?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Deleted.

Comment thread bin/run_HeCBench.sh
export ROCM=/opt/rocm
fi
# Setup AOMP / ROCM_PATH (see header for rules)
[ -z "$_had_aomp" ] && export AOMP=/opt/rocm/lib/llvm

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could this simply be : "${AOMP:=/opt/rocm/lib/llvm}" or AOMP="${AOMP:-/opt/rocm/lib/llvm}" and then also remove line 51?
Same thing for ROCM_PATH.

I think this should prefer to error out if neither of those two envars is set instead of silently running with something it finds in the environment.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The thought was to use the server's compiler if AOMP was not specified. If AOMP is set, we assume that is the path to "bin" and "lib" where the compiler to be tested resides.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think for our use case picking up "something" from the environment is undesirable.

So, IMHO if AOMP is not set, it should default to /opt/rocm/llvm or /COD/LATEST/aomp/llvm or something. But it should not pick up something that happens to be in the environment.

I think the same is true for ROCM_PATH.

@mhalk what are your thoughts here?

Comment thread bin/run_HeCBench.sh
fi
# Setup AOMP / ROCM_PATH (see header for rules)
[ -z "$_had_aomp" ] && export AOMP=/opt/rocm/lib/llvm
if [ -z "$_had_rocm_path" ]; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is here an if and in the line above is none?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The "[ -z "$_had_aomp" ] && export AOMP=/opt/rocm/lib/llvm" is a single line. The "if [ -z "$_had_rocm_path" ]; then" allows for multiple lines (which there are).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I personally find this quite confusing TBH

Comment thread bin/run_HeCBench.sh
[ -z "$_had_aomp" ] && export AOMP=/opt/rocm/lib/llvm
if [ -z "$_had_rocm_path" ]; then
ROCM_PATH=$(realpath -m "$(realpath -m "$AOMP")"/../..)
export ROCM_PATH

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is it exported here and again in line 64?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The second export of ROCM_PATH (and AOMP) was deleted.

@Lynd98
Lynd98 requested review from jplehr and mhalk August 11, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants