diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 2cbffc123e..5e6c6e7ac6 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,3 +1,3 @@
-* @estewart08 @gregrodgers @ronlieb
+* @estewart08 @gregrodgers @ronlieb @zGoldthorpe @carlobertolli
/bin/rocmlibs/ @saiislam
diff --git a/.github/workflows/aomp-shell.yml b/.github/workflows/aomp-shell.yml
new file mode 100644
index 0000000000..fea5c6e7fb
--- /dev/null
+++ b/.github/workflows/aomp-shell.yml
@@ -0,0 +1,16 @@
+name: AOMP Lint
+
+on:
+ push:
+ pull_request:
+
+jobs:
+ aomp-lint:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Run shellcheck
+ run: |
+ find . -name "*.sh" -exec shellcheck -S info {} +
diff --git a/Makefile b/Makefile
index 5783e6600a..dec3ac541e 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,6 @@ AOMP ?= $(HOME)/rocm/aomp
AOMP_REPOS = $(shell pwd)
all:
AOMP=$(AOMP) AOMP_REPOS=$(AOMP_REPOS) AOMP_APPLY_ROCM_PATCHES=0 TARBALL_INSTALL=1 $(AOMP_REPOS)/aomp/bin/build_prereq.sh
- AOMP=$(AOMP) AOMP_REPOS=$(AOMP_REPOS) AOMP_APPLY_ROCM_PATCHES=0 TARBALL_INSTALL=1 DISABLE_LLVM_TESTS=1 $(AOMP_REPOS)/aomp/bin/build_aomp.sh
+ AOMP=$(AOMP) AOMP_REPOS=$(AOMP_REPOS) AOMP_APPLY_ROCM_PATCHES=0 TARBALL_INSTALL=1 DISABLE_LLVM_TESTS=1 LIBC_INCLUDE_BENCHMARKS=0 $(AOMP_REPOS)/aomp/bin/build_aomp.sh
install:
@echo "Installation complete to $(AOMP)"
diff --git a/README.md b/README.md
index 7d7296a2d9..505ff916d0 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-AOMP - V 21.0-0
+AOMP - V 23.0-0
==============
This is README.md for https://github.com/ROCm/aomp.
@@ -8,8 +8,8 @@ This is the base repository for AOMP. Use this github repository for
documentation, and
[examples](https://github.com/ROCm/aomp/tree/master/examples).
-The last [release is AOMP 21.0-0](https://github.com/ROCm/aomp/releases).
-Currently AOMP 21.0-1 is under development.
+The last [release is AOMP 23.0-0](https://github.com/ROCm/aomp/releases).
+Currently AOMP 23.0-1 is under development.
Attention Users! Please use this repository for [issues](https://github.com/ROCm/aomp/issues).
Do not put issues in any of the source code repositories.
diff --git a/bin/Makefile_ROCmFlangNew b/bin/Makefile_ROCmFlangNew
index 6306d67af6..8e9db5cb12 100644
--- a/bin/Makefile_ROCmFlangNew
+++ b/bin/Makefile_ROCmFlangNew
@@ -59,6 +59,9 @@ ifeq ($(ENABLE_OMP_OFFLOAD), 1)
endif
ifeq ($(ENABLE_HIP), 1)
DEVICE_COMPILE ?= $(HIP_DIR)/bin/hipcc -c -D__HIP_PLATFORM_AMD__
+ ifeq ($(USE_OPENMP_RUNTIME), 1)
+ DEVICE_COMPILE += -DUSE_OPENMP_RUNTIME
+ endif
LIBRARY_DEVICE = -L$(HIP_DIR)/lib -lamdhip64
Device_Interface = Device_HIP
endif
@@ -71,6 +74,9 @@ ifeq ($(ENABLE_MPI), 1)
#CC_COMPILE = $(ROCM_DIR)/bin/clang -v
FCFLAGS = $(DEFINES)
CC_COMPILE = $(HIP_DIR)/bin/hipcc -c -D__HIP_PLATFORM_AMD__
+ ifeq ($(USE_OPENMP_RUNTIME), 1)
+ CC_COMPILE += -DUSE_OPENMP_RUNTIME
+ endif
FCFLAGS += $(LIBRARY_OPENMPI)
#LINK = $(OPENMPI_DIR)/bin/mpifort
LINK = $(FORTRAN_LINK)
diff --git a/bin/README.md b/bin/README.md
index b69cdc092c..2b5e3b3009 100644
--- a/bin/README.md
+++ b/bin/README.md
@@ -13,7 +13,7 @@ The AOMP compiler supports OpenMP, clang-hip, clang-cuda, device OpenCL, and the
The clone_aomp.sh script clones the necessary github repositories and the correct
-branches into subdirectories of $HOME/git/aomp21.0 (or $AOMP_REPOS if AOMP_REPOS is set).
+branches into subdirectories of $HOME/git/aomp23.0 (or $AOMP_REPOS if AOMP_REPOS is set).
The repositories and components needed by AOMP are shown in the following table.
The first column is the AOMP component name. The build_aomp.sh script invokes
each component build script with the name build_\.sh .
@@ -21,40 +21,34 @@ each component build script with the name build_\.sh .
| COMPONENT | DEV BRANCH | DEFAULT DIRECTORY LOCATION | REPOSITORY LINKS
| --------- | ---------- | -------------------------- | ----------------
-| (aomp) | aomp-dev | $HOME/git/aomp21.0/aomp | [aomp](https://github.com/ROCm/aomp) This repo!
-| project | amd-staging | $HOME/git/aomp21.0/llvm-project | [llvm-project](https://github.com/ROCm/llvm-project)
-| SPIRV-LLVM-Translator | amd-staging | $HOME/git/aomp21.0/SPIRV-LLVM-Translator | [SPIRV-LLVM-Translator](https://github.com/ROCm/SPIRV-LLVM-Translator)
-| rocprofiler-register | Latest ROCm | $HOME/git/aomp21.0/rocprofiler-register | [rocprofiler-register](https://github.com/ROCm/rocprofiler-register)
-| openmp | amd-staging | $HOME/git/aomp21.0/llvm-project/openmp | [llvm-project/openmp](https://github.com/ROCm/llvm-project)
-| flang | aomp-dev | $HOME/git/aomp21.0/flang | [flang](https://github.com/ROCm/flang)
-| pgmath | aomp-dev | $HOME/git/aomp21.0/flang/runtime/libpgmath | [flang](https://github.com/ROCm/flang)
-| llvm-classic | aomp-dev | $HOME/git/aomp21.0/flang/flang-classic/17.0-4/llvm-classic | [flang](https://github.com/ROCm/flang/flang-classic/17.0-4/llvm-classic)
-| flang-classic | aomp-dev | $HOME/git/aomp21.0/flang/flang-classic/17.0-4 | [flang](https://github.com/ROCm/flang/flang-classic/17.0-4)
-| flang_runtime | aomp-dev | $HOME/git/aomp21.0/flang | [flang](https://github.com/ROCm/flang)
+| (aomp) | aomp-dev | $HOME/git/aomp23.0/aomp | [aomp](https://github.com/ROCm/aomp) This repo!
+| project | amd-staging | $HOME/git/aomp23.0/llvm-project | [llvm-project](https://github.com/ROCm/llvm-project)
+| SPIRV-LLVM-Translator | amd-staging | $HOME/git/aomp23.0/SPIRV-LLVM-Translator | [SPIRV-LLVM-Translator](https://github.com/ROCm/SPIRV-LLVM-Translator)
+| hipify |amd-staging| $HOME/git/aomp23.0/hipify | [hipify](https://github.com/ROCm/hipify)
+| rocprofiler-register | Latest ROCm | $HOME/git/aomp23.0/rocprofiler-register | [rocprofiler-register](https://github.com/ROCm/rocprofiler-register)
+| openmp | amd-staging | $HOME/git/aomp23.0/llvm-project/openmp | [llvm-project/openmp](https://github.com/ROCm/llvm-project)
|| | |
-| rocr |Latest ROCm| $HOME/git/aomp21.0/rocr-runtime | [rocr-runtime](https://github.com/ROCm/rocr-runtime)
-| hip |Latest ROCm| $HOME/git/aomp21.0/hip | [hipamd](https://github.com/ROCm/hip)
-| |Latest ROCm| $HOME/git/aomp21.0/hipcc | [hip](https://github.com/ROCm/hipcc)
-| |Latest ROCm| $HOME/git/aomp21.0/clr | [ROCclr](https://github.com/ROCm/clr)
-| |Latest ROCm| $HOME/git/aomp21.0/ROCm-OpenCL-Runtime | [ocl](https://github.com/ROCm/ROCm-OpenCL-Runtime)
-| comgr |Latest ROCm| $HOME/git/aomp21.0/rocm-compilersupport| [comgr](https://github.com/ROCm/rocm-compilersupport)
-| rocminfo |Latest ROCm| $HOME/git/aomp21.0/rocminfo | [rocminfo](https://github.com/ROCm/rocminfo)
-| rocdbgapi |Latest ROCm| $HOME/git/aomp21.0/ROCdbgapi | [rocdbgapi](https://github.com/ROCm/ROCdbgapi)
-| rocgdb |Latest ROCm| $HOME/git/aomp21.0/ROCgdb | [rocgdb](https://github.com/ROCm/ROCgdb)
-| roctracer |Latest ROCm| $HOME/git/aomp21.0/roctracer | [roctracer](https://github.com/ROCm/roctracer)
+| rocr |Latest ROCm| $HOME/git/aomp23.0/rocr-runtime | [rocr-runtime](https://github.com/ROCm/rocr-runtime)
+| hip |Latest ROCm| $HOME/git/aomp23.0/hip | [hipamd](https://github.com/ROCm/hip)
+| |Latest ROCm| $HOME/git/aomp23.0/hipcc | [hip](https://github.com/ROCm/hipcc)
+| |Latest ROCm| $HOME/git/aomp23.0/clr | [ROCclr](https://github.com/ROCm/clr)
+| |Latest ROCm| $HOME/git/aomp23.0/ROCm-OpenCL-Runtime | [ocl](https://github.com/ROCm/ROCm-OpenCL-Runtime)
+| comgr |Latest ROCm| $HOME/git/aomp23.0/rocm-compilersupport| [comgr](https://github.com/ROCm/rocm-compilersupport)
+| rocminfo |Latest ROCm| $HOME/git/aomp23.0/rocminfo | [rocminfo](https://github.com/ROCm/rocminfo)
+| rocdbgapi |Latest ROCm| $HOME/git/aomp23.0/ROCdbgapi | [rocdbgapi](https://github.com/ROCm/ROCdbgapi)
+| rocgdb |Latest ROCm| $HOME/git/aomp23.0/ROCgdb | [rocgdb](https://github.com/ROCm/ROCgdb)
+| roctracer |Latest ROCm| $HOME/git/aomp23.0/roctracer | [roctracer](https://github.com/ROCm/roctracer)
+| rocprofiler |Latest ROCm| $HOME/git/aomp23.0/rocprofiler | [rocprofiler](https://github.com/ROCm/rocprofiler)
+| rocprofiler-sdk |Latest ROCm| $HOME/git/aomp23.0/rocprofiler-sdk | [rocprofiler-sdk](https://github.com/ROCm/rocprofiler-sdk)
Notice that some components are built with different parts of the same repository.
-The [llvm-project](https://github.com/ROCm/llvm-project) repository is a mirror of the gerrit-managed internal AMD repository.
-The updates to the mirror are done at least daily.
-If you are internal to AMD you will pick up the llvm-project repository directly from the gerrit
- [llvm-project](ssh://git.amd.com:29418/lightning/ec/llvm-project) repository.
+The following repos use the "amd-staging" branch [llvm-project](https://github.com/ROCm/llvm-project),
+[spirv-llvm-translator](https://github.com/ROCm/spirv-llvm-translator), and
+[hipify](https://github.com/ROCm/hipify).
-In addition to the gerrit-managed llvm-project repository, the three repositories
-[aomp](https://github.com/ROCm/aomp) ,
-[aomp-extras](https://github.com/ROCm/aomp-extras) , and
-[flang](https://github.com/ROCm/flang) make up the core aomp development repositories.
-These three use the branch "aomp-dev" and are managed completely on external github.
+In addition to the above repos, the "aomp-dev" branch is used for the,
+[aomp](https://github.com/ROCm/aomp) repo, which houses the build scripts and tests.
The default branch name for other non-core components is typically the name of the latest ROCm release in the external source repository.
The clone_aomp.sh script, described in the "Quick Start" below, uses a manfest file from the
@@ -73,10 +67,10 @@ These are some important environment variables and their default values.
| ENV VARIABLE | DEFAULT VALUE | DESCRIPTION
| ------------ | ------------- | -----------
| AOMP | $HOME/rocm/aomp | Directory symbolic link to where AOMP is installed and tested
-| AOMP_REPOS | $HOME/git/aomp21.0 | The base directory for all AOMP build repositories
+| AOMP_REPOS | $HOME/git/aomp23.0 | The base directory for all AOMP build repositories
| AOMP_STANDALONE_BUILD | 1 | Build all components, do NOT use installed ROCm
-| AOMP_VERSION | 21.0 | Clang version.
-| AOMP_VERSION_MOD | 1 | This implies the next release will be AOMP_21.0-1.
+| AOMP_VERSION | 23.0 | Clang version.
+| AOMP_VERSION_MOD | 1 | This implies the next release will be AOMP_23.0-1.
| AOMP_VERSION_STRING | $AOMP_VERSION-$AOMP_VERSION_MOD |
| AOMP_USE_NINJA | 0 | Use ninja instead of make to build certain components
| GFXLIST | gfx700 gfx701 gfx801 gfx803 | List of AMDGPU gpus to build for
@@ -94,7 +88,7 @@ Here is a sample of commands you might want to put into your .bashrc or .bash_pr
```
AOMP=/work/$USER/rocm/aomp
-AOMP_REPOS=/work/$USER/git/aomp21.0
+AOMP_REPOS=/work/$USER/git/aomp23.0
NVPTXGPUS=30,35,70
GFXLIST="gfx803 gfx906"
AOMP_USE_NINJA=1
@@ -121,15 +115,15 @@ For testing purposes, you will often change the value of AOMP when not testing y
AOMP build. For example, to test the latest packaged aomp release, set AOMP=/usr/lib/aomp.
To test against the ROCM installed compiler, set AOMP=/opt/rocm/lib/llvm. To test one of your
previous AOMP source builds, set AOMP to an older physical installation directory, such as
-AOMP=$HOME/rocm/aomp_21.0-0. BE CAREFUL! If you set AOMP for testing purposes,
+AOMP=$HOME/rocm/aomp_23.0-0. BE CAREFUL! If you set AOMP for testing purposes,
remember to set it back before rebuilding aomp from source.
## Quick Start to AOMP Development
To build and clone all components using the latest development sources, first clone aomp repo and checkout the aomp-dev branch as follows:
```
- mkdir $HOME/git/aomp21.0
- cd git/aomp21.0
+ mkdir $HOME/git/aomp23.0
+ cd git/aomp23.0
git clone https://github.com/ROCm/aomp.git aomp
cd aomp
git checkout aomp-dev
@@ -144,7 +138,7 @@ WARNING: The script clone_aomp.sh does not pull updates for this aomp repository
So please run "git pull" frequently to stay current with the aomp development team.
```
-cd $HOME/git/aomp21.0/aomp
+cd $HOME/git/aomp23.0/aomp
git pull
cd bin
./clone_aomp.sh
@@ -188,32 +182,34 @@ The only ROCm common component required by AOMP is the kernel kfd.
## Individual Component Builds
-This bin directory ($HOME/git/aomp21.0/aomp/bin) contains many component scripts to build and install AOMP from source. Here are some of the scripts contained in this direcotry
+This bin directory ($HOME/git/aomp23.0/aomp/bin) contains many component scripts to build and install AOMP from source. Here are some of the scripts contained in this direcotry
```
clone_aomp.sh - A script to make sure the necessary repos are up to date.
See list source repositories above.
build_aomp.sh - This is the master build script. It runs all the
component build scripts in the correct order.
-build_project.sh - Builds llvm, lld, and clang components.
+build_project.sh - Builds llvm, lld, clang, and flang components along with openmp, offload, flang-rt runtimes.
build_rocprofiler-register.sh - Builds rocprofiler-register component.
build_rocr.sh - Builds the ROCm runtime and thunk library.
+build_openmp.sh - Builds the host OpenMP perf/debug/asan libraries
+build_offload.sh - Builds the target OpenMP perf/debug/asan libraries
+build_extras.sh - Builds tools in aomp-extras repo.
build_comgr.sh - Builds the code object manager (needs rocm-device-libs).
build_rocminfo.sh - Builds the rocminfo utilities to support hip.
-build_extras.sh - Builds hostcall, libm, and utils all in aomp-extras repo.
-build_openmp.sh - Builds the OpenMP libraries
-build_pgmath.sh - Builds the pgmath support for flang.
-build_flang.sh - Builds flang for aomp.
-build_flang_runtime.sh - Builds the flang runtime for aomp.
+build_rocm_smi_lib.sh - Builds rocm-smi.
+build_amdsmi.sh - Builds amdsmi.
+build_hipcc.sh - Builds hipcc.
+build_hipamd.sh - Builds hip, openCL, and ocl-icd-loader.
+build_hipify.sh - Builds hipify tool.
build_rocdbgapi.sh - Builds ROCm Debugger API.
build_gdb.sh - Builds ROC gdb.
-build_roctracer.sh - Builds ROC gdb. UNDER DEVELOPMENT
build_prereq.sh - Builds prerequisites such as cmake, hwloc, rocmsmi in $HOME/local.
create_release_tarball.sh - This builds an important release artifact
containing all sources.
```
To build aomp, run the master build script build_aomp.sh, or run the individual scripts in the order shown below.
-The build scripts with no arguments will build the component in the build directory $HOME/git/aomp21.0/build/\
+The build scripts with no arguments will build the component in the build directory $HOME/git/aomp23.0/build/\
(or $AOMP_REPOS/build/\ if AOMP_REPOS is set).
The component build scripts take a single positional argument with the value "install" or "nocmake".
The master build script build_aomp.sh will call the component build scripts in the following order and stop if
@@ -238,26 +234,24 @@ any fails occur.
./build_comgr.sh install
./build_rocminfo.sh
./build_rocminfo.sh install
- ./build_flang-classic.sh
- ./build_flang-classic.sh install
- ./build_pgmath.sh
- ./build_pgmath.sh install
- ./build_flang.sh
- ./build_flang.sh install
- ./build_flang_runtime.sh
- ./build_flang_runtime.sh install
+ ./build_rocm_smi_lib.sh
+ ./build_rocm_smi_lib.sh install
+ ./build_amdsmi.sh
+ ./build_amdsmi.sh
./build_hipcc.sh
./build_hipcc.sh install
./build_hipamd.sh
./build_hipamd.sh install
+ ./build_hipify.sh
+ ./build_hipify.sh install
+ ./build_hipfort.sh
+ ./build_hipfort.sh install
./build_rocdbgapi.sh
./build_rocdbgapi.sh install
./build_rocgdb.sh
./build_rocgdb.sh install
- ./build_roctracer.sh
- ./build_roctracer.sh install
- ./build_rocprofiler.sh
- ./build_rocprofiler.sh install
+ ./build_rocprofiler-sdk.sh
+ ./build_rocprofiler-sdk.sh install
```
Once you have a successful development build, individual components can be incrementally rebuilt without rebuilding the entire system or the entire component. For example, if you change a file in the llvm-project repository. Run this command to incrementally build llvm, clang, and lld and update your installation.
@@ -268,24 +262,24 @@ WARNING: When the build scripts are run with NO arguments (that is, you do not s
## The AOMP Install Location
The build scripts will build from the source directories identified by the environment variable AOMP_REPOS.
-The AOMP_REPOS default value is currently $HOME/git/aomp21.0.
+The AOMP_REPOS default value is currently $HOME/git/aomp23.0.
The out-of-source build directory for each component is $AOMP_REPOS/build/\.
The install location is defined by the $AOMP environment variable. The value of AOMP MUST be reserved as a symbolic link.
That is, the physical installation will be in directory name formed by concatonating the version string to the value of $AOMP.
The "build_project.sh install" script will make a symbolic link from the physical directory to the symbolic directory $AOMP.
The default value for AOMP is $HOME/rocm/aomp.
-For example, when building AOMP version 21.0-0 the install scripts will put all files and directories
-in $HOME/rocm/aomp_21.0-0 and create a symbolic link as follows:
+For example, when building AOMP version 23.0-0 the install scripts will put all files and directories
+in $HOME/rocm/aomp_23.0-0 and create a symbolic link as follows:
```
-ln -sf ${AOMP}_21.0-0 ${AOMP}
+ln -sf ${AOMP}_23.0-0 ${AOMP}
```
All testing for AOMP uses the environment variable AOMP to locate the installation. This makes it easy to switch between versions of AOMP for testing by simply changing the environment variable AOMP. You do NOT need to change the symbolic link.
-For example, if the aomp symbolic link currently points to aomp_21.0-1 and you want to test aomp_21.0-0, do this:
+For example, if the aomp symbolic link currently points to aomp_23.0-1 and you want to test aomp_22.0-2, do this:
```
-export AOMP=$HOME/rocm/aomp_21.0-0
+export AOMP=$HOME/rocm/aomp_23.0-0
```
The aomp package installs in /usr/lib/aomp_\ and symlinks /usr/lib/aomp to the versioned directory. To test the installed package, set AOMP to /usr/lib/aomp or /usr/lib/aomp_\.
diff --git a/bin/aomp.spec b/bin/aomp.spec
index 1c140efce1..523bdbe9fc 100644
--- a/bin/aomp.spec
+++ b/bin/aomp.spec
@@ -3,7 +3,7 @@ Name: $rpmname
Version: __VERSION1
Release: __VERSION3_MOD
Source: /tmp/home/rpmbuild/SOURCES/$rpmname.tar.gz
-URL: https://github.com/ROCm-Developer-Tools/aomp
+URL: https://github.com/ROCm/aomp
License: MIT and ASL 2.0
Group: System/Base
Vendor: AMD
diff --git a/bin/aomp_common_vars b/bin/aomp_common_vars
index 24a5a39192..7aede9cefa 100644
--- a/bin/aomp_common_vars
+++ b/bin/aomp_common_vars
@@ -11,21 +11,24 @@
# already set. If not, it assigns it the value following the :-
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
# Individual scripts will determine what generator to use
unset CMAKE_GENERATOR
+# If running under osh, set strict options.
+shopt -s strict:all 2>/dev/null || true
+
# The AOMP_COMPILER_NAME is used whenever version is queried.
# FIXME: More work is needed to propogate the use of AOMP_COMPILER_NAME.
AOMP_COMPILER_NAME=${AOMP_COMPILER_NAME:-AOMP}
# ROCM_VERSION may be set by Jenkins, if not guess a good number
-ROCM_VERSION=${ROCM_VERSION:-6.0.0}
+ROCM_VERSION=${ROCM_VERSION:-6.4.0}
# Set the AOMP VERSION STRING
-AOMP_VERSION=${AOMP_VERSION:-"21.0"}
+AOMP_VERSION=${AOMP_VERSION:-"23.0"}
AOMP_VERSION_MOD=${AOMP_VERSION_MOD:-"1"}
AOMP_VERSION_STRING=${AOMP_VERSION_STRING:-"$AOMP_VERSION-$AOMP_VERSION_MOD"}
ROCM_EXPECTED_MODVERSION=${ROCM_EXPECTED_MODVERSION:-6.2.4}
@@ -37,13 +40,13 @@ AOMP=${AOMP:-$HOME/rocm/aomp}
AOMP_INSTALL_DIR=${AOMP}_${AOMP_VERSION_STRING}
GPURUN_BINDIR=${GPURUN_BINDIR:-$AOMP/bin}
-if [ ! -f "$GPURUN_BINDIR/gpurun" ] || [ ! -f "$GPURUN_BINDIR/rocminfo" ] ; then
+if [ ! -f "$GPURUN_BINDIR/gpurun" ] ; then
# When using trunk, try to find gpurun and rocminfo in ROCm
_SILENT=""
GPURUN_BINDIR=/opt/rocm/llvm/bin
- export ROCMINFO_BINARY=/opt/rocm/bin/rocminfo
-else
- export ROCMINFO_BINARY=$GPURUN_BINDIR/rocminfo
+fi
+if [ ! -f "$AOMP/bin/rocminfo" ] ; then
+ export ROCMINFO_BINARY=/opt/rocm/bin/rocminfo
fi
# For example, if AOMP_REPOS=$HOME/git/aomp11, then the primary aomp repo
@@ -58,27 +61,38 @@ else
AOMP_PATCH_CONTROL_FILE="$thisdir/patches/patch-control-file_$AOMP_VERSION.txt"
fi
+LLVM_FORCE_VC_REVISION_OPT=""
+LLVM_FORCE_VC_REPOSITORY_OPT=""
+if [ -n "$LLVM_FORCE_VC_REVISION" ] ; then
+ LLVM_FORCE_VC_REVISION_OPT="-DLLVM_FORCE_VC_REVISION=$LLVM_FORCE_VC_REVISION"
+fi
+if [ -n "$LLVM_FORCE_VC_REPOSITORY" ] ; then
+ LLVM_FORCE_VC_REPOSITORY_OPT="-DLLVM_FORCE_VC_REPOSITORY=$LLVM_FORCE_VC_REPOSITORY"
+fi
+
# Because the source for all repos are tarred for release, we store
# all the test repositories in a different directory.
AOMP_REPOS_TEST=${AOMP_REPOS_TEST:-$HOME/git/aomp-test}
-_ccache_bin=`which ccache`
+_ccache_bin=$(which ccache)
if [ "$_ccache_bin" == "" ] ; then
AOMP_USE_CCACHE=${AOMP_USE_CCACHE:-0}
else
AOMP_USE_CCACHE=${AOMP_USE_CCACHE:-1}
fi
+declare -a AOMP_CCACHE_OPTS
if [ "$AOMP_USE_CCACHE" == 0 ] ; then
- AOMP_CCACHE_OPTS=""
+ AOMP_CCACHE_OPTS=()
else
- _ccache_bin=`which ccache`
+ _ccache_bin=$(which ccache)
if [ "$_ccache_bin" == "" ] ; then
echo "ERROR: AOMP_USE_CCACHE is $AOMP_USE_CCACHE but no ccache bin found in PATH"
echo " Either fix path, install ccache, or set AOMP_USE_CCACHE=0"
echo
exit 1
fi
- AOMP_CCACHE_OPTS="-DCMAKE_C_COMPILER_LAUNCHER=$_ccache_bin -DCMAKE_CXX_COMPILER_LAUNCHER=$_ccache_bin"
+ AOMP_CCACHE_OPTS=(-DCMAKE_C_COMPILER_LAUNCHER="$_ccache_bin"
+ -DCMAKE_CXX_COMPILER_LAUNCHER="$_ccache_bin")
fi
AOMP_SKIP_FLANG=${AOMP_SKIP_FLANG:-1}
@@ -136,8 +150,8 @@ CUDABIN=${CUDABIN:-$CUDA/bin}
# unless overridden with AOMP_CMAKE, get CMAKE from the
# prerequisite supplemental component cmake.
AOMP_CMAKE=${AOMP_CMAKE:-$AOMP_SUPP/cmake/bin/cmake}
-if [ ! -f $AOMP_CMAKE ] ; then
- AOMP_CMAKE=`which cmake`
+if [ ! -f "$AOMP_CMAKE" ] ; then
+ AOMP_CMAKE=$(which cmake)
if [ "$AOMP_CMAKE" == "" ] ; then
echo "ERROR: finding cmake in aomp_common_vars."
echo " Missing prerequisite supplemental component cmake."
@@ -160,21 +174,21 @@ AOMP_USE_NINJA=${AOMP_USE_NINJA:-0}
if [ "$AOMP_USE_NINJA" == 0 ] ; then
AOMP_NINJA_BIN="make"
else
- AOMP_NINJA_BIN=`which ninja`
- if [ AOMP_NINJA_BIN == "" ] ; then
+ AOMP_NINJA_BIN=$(which ninja)
+ if [ "$AOMP_NINJA_BIN" == "" ] ; then
echo "ERROR: AOMP_USE_NINJA is $AOMP_USE_NINJA but no ninja bin found in PATH"
echo " Either install ninja in PATH or set AOMP_USE_NINJA=0"
echo
exit 1
fi
fi
-AOMP_PROC=`uname -m`
+AOMP_PROC=$(uname -m)
if [ "$AOMP_PROC" == "unknown" ] ; then
- AOMP_PROC=`uname -a | awk '{print $(NF-1)}'`
+ AOMP_PROC=$(uname -a | awk '{print $(NF-1)}')
fi
-GCC=`which gcc`
-GCCXX=`which g++`
+GCC=$(which gcc)
+GCCXX=$(which g++)
AOMP_CC_COMPILER=${AOMP_CC_COMPILER:-$GCC}
AOMP_CXX_COMPILER=${AOMP_CXX_COMPILER:-$GCCXX}
@@ -191,8 +205,8 @@ fi
# Otherwise default to installed AOMP. If not yet installed, try rocm clang.
_clang_compiler=$LLVM_INSTALL_LOC/bin/clang
_clangxx_compiler=$LLVM_INSTALL_LOC/bin/clang++
-[ ! -f $_clang_compiler ] && _clang_compiler=/opt/rocm/llvm/bin/clang
-[ ! -f $_clangxx_compiler ] && _clangxx_compiler=/opt/rocm/llvm/bin/clang++
+[ ! -f "$_clang_compiler" ] && _clang_compiler=/opt/rocm/llvm/bin/clang
+[ ! -f "$_clangxx_compiler" ] && _clangxx_compiler=/opt/rocm/llvm/bin/clang++
AOMP_CLANG_COMPILER=${AOMP_CLANG_COMPILER:-$_clang_compiler}
AOMP_CLANGXX_COMPILER=${AOMP_CLANGXX_COMPILER:-$_clangxx_compiler}
@@ -211,7 +225,7 @@ if [ "$AOMP_PROC" == "ppc64le" ] ; then
fi
AOMP_BUILD_DEBUG=${AOMP_BUILD_DEBUG:-1}
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
# Default is to build nvptx for STANDALONE build
AOMP_BUILD_CUDA=${AOMP_BUILD_CUDA:-1}
AOMP_BUILD_PERF=${AOMP_BUILD_PERF:-1}
@@ -228,6 +242,32 @@ else
fi
fi
+# Quote argument list suitable for passing as a single (string) argument to
+# cmake. Result can be used within a double-quoted string, i.e. using
+# "$(cmquot ...)".
+function cmquot() {
+ local escaped_flags
+ local escaped_flag
+ local flag
+ escaped_flags=()
+ for flag in "$@"; do
+ escaped_flag=$(printf "%s" "$flag" | sed 's/\\/\\\\/g; s/\$/\\$/g; s/ /\\ /g; s/"/\\"/g')
+ escaped_flags+=("$escaped_flag")
+ done
+ echo "${escaped_flags[*]}"
+}
+
+# Quote argument list suitable for passing back to the shell as a string.
+# Useful for e.g. dumping argument lists in such a way that they can be safely
+# copy & pasted into the user's terminal. Output should not be further quoted.
+function shquot() {
+ local -a output
+ output=()
+ for arg in "$@"; do
+ output+=(\'${arg//\'/\'\\\'\'}\')
+ done
+ printf '%s' "${output[*]}"
+}
# AOMP uses RPATH (not) RUNPATH because LD_LIBRARY_PATH is a user feature for
# user lib development. We do not want the compiler runtime to search user paths
@@ -240,28 +280,37 @@ fi
# Spliting options with AOMP_ORIGIN_NO_DTAGS is no longer necessary.
AOMP_ORIGIN_RPATH_LIST="\$ORIGIN:\$ORIGIN/../lib:\$ORIGIN/../lib64:\$ORIGIN/../../../lib:\$ORIGIN/../llvm/lib"
-AOMP_ORIGIN_RPATH="-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags' -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON -DCMAKE_INSTALL_RPATH=$AOMP_ORIGIN_RPATH_LIST"
+AOMP_ORIGIN_RPATH=(-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags'
+ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON
+ -DCMAKE_INSTALL_RPATH="$AOMP_ORIGIN_RPATH_LIST")
AOMP_DEBUG_ORIGIN_RPATH_LIST="\$ORIGIN:\$ORIGIN/../lib-debug:\$ORIGIN/../lib64:\$ORIGIN/../../../lib-debug"
-AOMP_DEBUG_ORIGIN_RPATH="-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags' -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON -DCMAKE_INSTALL_RPATH=$AOMP_DEBUG_ORIGIN_RPATH_LIST"
+AOMP_DEBUG_ORIGIN_RPATH=(-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags'
+ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON
+ -DCMAKE_INSTALL_RPATH="$AOMP_DEBUG_ORIGIN_RPATH_LIST")
# Libraries and Binaries need different RUNPATH as below
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
## Below 3 lines are actually only required for AOMP ASan RPATH Cmake configuration.
AOMP_ASAN_ORIGIN_RPATH_LIST="\$ORIGIN:\$ORIGIN/../../lib:\$ORIGIN/../lib:\$ORIGIN/../lib64:\$ORIGIN/../../../../lib/asan:\$ORIGIN/../lib/llvm"
- AOMP_ASAN_ORIGIN_RPATH="-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags' -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF -DCMAKE_INSTALL_RPATH=$AOMP_ASAN_ORIGIN_RPATH_LIST"
+ AOMP_ASAN_ORIGIN_RPATH=(-DCMAKE_SHARED_LINKER_FLAGS='-Wl,--disable-new-dtags'
+ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF
+ -DCMAKE_INSTALL_RPATH="$AOMP_ASAN_ORIGIN_RPATH_LIST")
# Please note below lines are only setup for ROCm ASan integration with AOMP.
# Relative RUNPATH for ASAN binaries and libraries
- OPENMP_EXTRAS_LIB_RPATH='$ORIGIN:$ORIGIN/../../../lib/asan:$ORIGIN/../../../lib:$ORIGIN/../../../../lib/asan:$ORIGIN/../../../../lib'
- OPENMP_EXTRAS_EXE_RPATH='$ORIGIN/../lib/asan:$ORIGIN/../lib:$ORIGIN/../../lib/asan:$ORIGIN/../../lib:$ORIGIN/../../../lib/asan:$ORIGIN/../../../lib'
+ OPENMP_EXTRAS_LIB_RPATH="\$ORIGIN:\$ORIGIN/../../../lib/asan:\$ORIGIN/../../../lib:\$ORIGIN/../../../../lib/asan:\$ORIGIN/../../../../lib"
+ OPENMP_EXTRAS_EXE_RPATH="\$ORIGIN/../lib/asan:\$ORIGIN/../lib:\$ORIGIN/../../lib/asan:\$ORIGIN/../../lib:\$ORIGIN/../../../lib/asan:\$ORIGIN/../../../lib"
else
# Relative RUNPATH for non-ASAN binaries and libraries
- OPENMP_EXTRAS_LIB_RPATH='$ORIGIN:$ORIGIN/../lib:$ORIGIN/../../lib:$ORIGIN/../../../lib'
- OPENMP_EXTRAS_EXE_RPATH='$ORIGIN/../lib:$ORIGIN/../../lib:$ORIGIN/../../../lib'
+ OPENMP_EXTRAS_LIB_RPATH="\$ORIGIN:\$ORIGIN/../lib:\$ORIGIN/../../lib:\$ORIGIN/../../../lib"
+ OPENMP_EXTRAS_EXE_RPATH="\$ORIGIN/../lib:\$ORIGIN/../../lib:\$ORIGIN/../../../lib"
fi
-OPENMP_EXTRAS_SHARED_LINKER_FLAGS="-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$OPENMP_EXTRAS_LIB_RPATH"
-OPENMP_EXTRAS_EXE_LINKER_FLAGS="-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$OPENMP_EXTRAS_EXE_RPATH"
-OPENMP_EXTRAS_ORIGIN_RPATH="-DCMAKE_SKIP_INSTALL_RPATH=TRUE -DCMAKE_SHARED_LINKER_FLAGS_INIT=${OPENMP_EXTRAS_SHARED_LINKER_FLAGS} -DCMAKE_EXE_LINKER_FLAGS_INIT=${OPENMP_EXTRAS_EXE_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS_INIT=${OPENMP_EXTRAS_SHARED_LINKER_FLAGS}"
+OPENMP_EXTRAS_SHARED_LINKER_FLAGS=("-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$OPENMP_EXTRAS_LIB_RPATH")
+OPENMP_EXTRAS_EXE_LINKER_FLAGS=("-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$OPENMP_EXTRAS_EXE_RPATH")
+OPENMP_EXTRAS_ORIGIN_RPATH=(-DCMAKE_SKIP_INSTALL_RPATH=TRUE
+ -DCMAKE_SHARED_LINKER_FLAGS_INIT="$(cmquot "${OPENMP_EXTRAS_SHARED_LINKER_FLAGS[@]}")"
+ -DCMAKE_EXE_LINKER_FLAGS_INIT="$(cmquot "${OPENMP_EXTRAS_EXE_LINKER_FLAGS[@]}")"
+ -DCMAKE_MODULE_LINKER_FLAGS_INIT="$(cmquot "${OPENMP_EXTRAS_SHARED_LINKER_FLAGS[@]}")")
# Regardless, turn off AOMP_BUILD_CUDA if CUDA not available
if [ ! -d "$CUDABIN" ] ; then
@@ -278,20 +327,33 @@ if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
NVPTXGPUS_DEFAULT="35,37,50,52,53,60,61,62,70,72,75,80,86"
# Developers should override NVPTXGPUS to shorten build time.
NVPTXGPUS=${NVPTXGPUS:-"${NVPTXGPUS_DEFAULT}"}
+ # shellcheck disable=2034
AOMP_NVPTX_TARGET="NVPTX;"
else
NVPTXGPUS_DEFAULT=""
NVPTXGPUS=""
+ # shellcheck disable=2034
AOMP_NVPTX_TARGET=""
fi
# Set list of default amdgcn subarchitectures to build
-# Developers may override GFXLIST to shorten build time.
-GFXLIST=${GFXLIST:-"gfx900 gfx902 gfx906 gfx908 gfx90a gfx90c gfx942 gfx950 gfx1030 gfx1031 gfx1035 gfx1036 gfx1100 gfx1101 gfx1102 gfx1103 gfx1150 gfx1151 gfx1152 gfx1153 gfx1200 gfx1201 gfx9-generic gfx9-4-generic gfx10-1-generic gfx10-3-generic gfx11-generic gfx12-generic"}
-export GFXLIST
+# Developers may override GFXLIST and ROCMLIBS_GFXLIST variables to shorten build time of aomp and rocmlibs, respectively.
+# | ROCMLIBS_GFXLIST defined | GFXLIST defined | Resulting GFXLIST and ROCMLIBS_GFXLIST |
+# | Yes | Yes | GFXLIST and ROCMLIBS_GFXLIST are both set to their defined values |
+# | Yes | No | GFXLIST is set to ROCMLIBS_GFXLIST, ROCMLIBS_GFXLIST remains unchanged |
+# | No | Yes | ROCMLIBS_GFXLIST is set to GFXLIST, GFXLIST remains unchanged |
+# | No | No | GFXLIST is set to a default list, ROCMLIBS_GFXLIST is set to a smaller subset of GFXLIST |
+if [ -z "$ROCMLIBS_GFXLIST" ] && [ -n "$GFXLIST" ]; then
+ ROCMLIBS_GFXLIST="$GFXLIST"
+elif [ -n "$ROCMLIBS_GFXLIST" ] && [ -z "$GFXLIST" ]; then
+ GFXLIST="$ROCMLIBS_GFXLIST"
+else
+ GFXLIST=${GFXLIST:-"gfx900 gfx902 gfx906 gfx908 gfx90a gfx90c gfx942 gfx950 gfx1030 gfx1031 gfx1035 gfx1036 gfx1100 gfx1101 gfx1102 gfx1103 gfx1150 gfx1151 gfx1152 gfx1153 gfx1200 gfx1201 gfx9-generic gfx9-4-generic gfx10-1-generic gfx10-3-generic gfx11-generic gfx12-generic"}
+ ROCMLIBS_GFXLIST=${ROCMLIBS_GFXLIST:-"gfx90a;gfx942;gfx1103;gfx1150"}
+fi
-# Keep a small list of architectures for ROCMLIBS to shorten build time.
-ROCMLIBS_GFXLIST=${ROCMLIBS_GFXLIST:-"gfx90a;gfx942;gfx1103;gfx1150"}
+export GFXLIST
+export ROCMLIBS_GFXLIST
# Do a sanity check for stanalone build that ROCMLIBS_GFXLIST is a subset of GFXLIST
for arch in ${ROCMLIBS_GFXLIST//;/ }; do
@@ -302,22 +364,11 @@ for arch in ${ROCMLIBS_GFXLIST//;/ }; do
fi
done
-# rccl currently doesn't support gfx1103 and gfx1150.
-RCCL_GFXLIST=${RCCL_GFXLIST:-"gfx90a;gfx942"}
-
-# Do a sanity check for stanalone build that RCCL_GFXLIST is a subset of ROCMLIBS_GFXLIST
-for arch in ${RCCL_GFXLIST//;/ }; do
- if [[ ! $ROCMLIBS_GFXLIST =~ $arch ]]; then
- echo "ERROR: RCCL_GFXLIST architecture $arch not in ROCMLIBS_GFXLIST $ROCMLIBS_GFXLIST"
- echo "Please update RCCL_GFXLIST to be a subset of ROCMLIBS_GFXLIST, or leave it undefined to use the default architecture list."
- exit 1
- fi
-done
-
# Calculate the number of threads to use for make
COMP_THREADS=1
-if [ ! -z `which "getconf"` ]; then
- COMP_THREADS=$(`which "getconf"` _NPROCESSORS_ONLN)
+GETCONF=$(which getconf)
+if [ -n "$GETCONF" ]; then
+ COMP_THREADS=$($GETCONF _NPROCESSORS_ONLN)
if [ "$AOMP_PROC" == "ppc64le" ] ; then
COMP_THREADS=$(( COMP_THREADS / 6))
fi
@@ -349,14 +400,16 @@ AOMP_GIT_INTERNAL_IP="git@github-ent"
GITROC="https://github.com/ROCm"
GITGERRIT="ssh://$USER@gerrit-git.amd.com:29418"
GITKHRONOS="https://github.com/KhronosGroup"
+# shellcheck disable=2034
GITHWLOC="https://github.com/open-mpi"
GITLIGHTNINGINTERNAL="$AOMP_GIT_INTERNAL_IP:AMD-Lightning-Internal"
GITPROJECT=$GITROCDEV
+# shellcheck disable=2034
POWERINFER_REPO="https://github.com/SJTU-IPADS"
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
AOMP_PROJECT_REPO_NAME=${AOMP_PROJECT_REPO_NAME:-llvm-project}
else
- AOMP_PROJECT_REPO_NAME=${AOMP_PROJECT_REPO_NAME:-$(basename $LLVM_PROJECT_ROOT)}
+ AOMP_PROJECT_REPO_NAME=${AOMP_PROJECT_REPO_NAME:-$(basename "$LLVM_PROJECT_ROOT")}
if [ ! -d "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME" ]; then
AOMP_PROJECT_REPO_NAME="../llvm-project"
fi
@@ -366,7 +419,7 @@ AOMP_FLANG_REPO_NAME=${AOMP_FLANG_REPO_NAME:-flang}
# Last version of rocm (5.5) that supports the legacy driver (command generation)
# The archives are built during flang-classic.
AOMP_FLANG_CLASSIC_REL=${AOMP_FLANG_CLASSIC_REL:-${AOMP_REPOS}/${AOMP_FLANG_REPO_NAME}/flang-classic}
-if [ -d $AOMP_FLANG_CLASSIC_REL/llvm-classic ] ; then
+if [ -d "$AOMP_FLANG_CLASSIC_REL/llvm-classic" ] ; then
AOMP_BUILD_FLANG_CLASSIC=1
else
AOMP_BUILD_FLANG_CLASSIC=0
@@ -399,57 +452,70 @@ AOMP_ROCMCMAKE_REPO_NAME=${AOMP_ROCMCMAKE_REPO_NAME:-rocm-cmake}
AOMP_GDB_REPO_NAME=${AOMP_GDB_REPO_NAME:-ROCgdb}
AOMP_DBGAPI_REPO_NAME=${AOMP_DBGAPI_REPO_NAME:-ROCdbgapi}
AOMP_PROF_REPO_NAME=${AOMP_PROF_REPO_NAME:-rocprofiler}
+AOMP_PROF_SDK_REPO_NAME=${AOMP_PROF_SDK_REPO_NAME:-rocprofiler-sdk}
AOMP_PROF_REGISTER_REPO_NAME=${AOMP_PROF_REGISTER_REPO_NAME:-rocprofiler-register}
AOMP_TRACE_REPO_NAME=${AOMP_TRACE_REPO_NAME:-roctracer}
# These are test repositories
+# shellcheck disable=2034
GITNEKBONE="https://github.com/AMDComputeLibraries"
AOMP_NEKBONE_REPO_NAME=${AOMP_NEKBONE_REPO_NAME:-Nekbone}
AOMP_APPS_REPO_NAME=${AOMP_APPS_REPO_NAME:-openmpapps}
+# shellcheck disable=2034
GITOPENMPVV="https://github.com/OpenMP-Validation-and-Verification"
AOMP_OPENMPVV_REPO_NAME=${AOMP_OPENMPVV_REPO_NAME:-OpenMP_VV}
+# shellcheck disable=2034
GITSOLVV="https://github.com/SOLLVE"
AOMP_SOLVV_REPO_NAME=${AOMP_SOLVV_REPO_NAME:-sollve_vv}
AOMP_APPS_REPO_NAME=${AOMP_APPS_REPO_NAME:-openmpapps}
+# shellcheck disable=2034
GITLLNL="https://github.com/llnl"
AOMP_RAJA_REPO_NAME=${AOMP_RAJA_REPO_NAME:-raja}
AOMP_RAJAPERF_REPO_NAME=${AOMP_RAJAPERF_REPO_NAME:-RAJAPerf}
+# shellcheck disable=2034
GITKOKKOS="https://github.com/kokkos"
AOMP_KOKKOS_REPO_NAME=${AOMP_KOKKOS_REPO_NAME:-kokkos}
AOMP_INTERNAL_IP="gitlab1.amd.com"
+# shellcheck disable=2034
GITINTERNAL="http://${AOMP_INTERNAL_IP}/dmcdouga" # This will change soon
+# shellcheck disable=2034
GITOVO="https://github.com/TApplencourt"
AOMP_OVO_REPO_NAME=${AOMP_OVO_REPO_NAME:-OvO}
+# shellcheck disable=2034
GITOMPTESTS="https://github.com/doru1004"
AOMP_OMPTESTS_REPO_NAME=${AOMP_OMPTESTS_REPO_NAME:-omptests}
+# shellcheck disable=2034
GITQMCPACK="https://github.com/QMCPACK"
AOMP_QMCPACK_REPO_NAME=${AOMP_QMCPACK_REPO_NAME:-qmcpack}
+# shellcheck disable=2034
GITOPENLIBM="https://github.com/JuliaMath"
AOMP_OPENLIBM_REPO_NAME=${AOMP_OPENLIBM_REPO_NAME:-openlibm}
+# shellcheck disable=2034
GITLLNLGOULASH="https://github.com/LLNL"
AOMP_GOULASH_REPO_NAME=${AOMP_GOULASH_REPO_NAME:-goulash}
AOMP_BABELSTREAM_REPO_NAME=${AOMP_BABELSTREAM_REPO_NAME:-babelstream}
+# shellcheck disable=2034
GITUMT="https://github.com/LLNL"
AOMP_UMT_REPO_NAME=${AOMP_UMT_REPO_NAME:-UMT}
# We dont use this yet, waiting for trunk merge
AOMP_F18_REPO_NAME=${AOMP_F18_REPO_NAME:-f18}
-if [ -d $AOMP_REPOS/$AOMP_TRACE_REPO_NAME ] ; then
- pushd $AOMP_REPOS/$AOMP_TRACE_REPO_NAME > /dev/null
- roctracer_branch=`git branch --list | grep "\*" | cut -d" " -f2`
+if [ -d "$AOMP_REPOS/$AOMP_TRACE_REPO_NAME" ] ; then
+ pushd "$AOMP_REPOS/$AOMP_TRACE_REPO_NAME" > /dev/null || exit
+ roctracer_branch=$(git branch --list | grep "\*" | cut -d" " -f2)
if [ "$roctracer_branch" == "rocm-4.0.x" ] ; then
AOMP_PATCH_CONTROL_FILE="${AOMP_REPOS}/${AOMP_REPO_NAME}/bin/patches/patch-control-file_4.0.txt"
fi
- popd > /dev/null
+ popd > /dev/null || exit
fi
AOMP_PATCH_CONTROL_FILE=${AOMP_PATCH_CONTROL_FILE:-${AOMP_REPOS}/${AOMP_REPO_NAME}/bin/patches/patch-control-file.txt}
STASH_BEFORE_PULL=${STASH_BEFORE_PULL:-YES}
-# It is highly recommendded that developers set SUDO to disable and
+# It is highly recommendded that developers set SUDO to disable and
# this have update access to install directory $AOMP. In the future
-# we may set this default to disable
+# we may set this default to disable
SUDO=${SUDO:-NO}
if [ "$SUDO" == "set" ] || [ "$SUDO" == "yes" ] || [ "$SUDO" == "YES" ] ; then
SUDO="sudo"
@@ -457,15 +523,16 @@ else
SUDO=""
fi
-# The default for BUILD_AOMP is AOMP_REPOS.
-# The cmake and make builds are actually done in
-# BUILD_AOMP/build, not the actual repos.
+# The default for BUILD_AOMP is AOMP_REPOS.
+# The cmake and make builds are actually done in
+# BUILD_AOMP/build, not the actual repos.
BUILD_AOMP=${BUILD_AOMP:-$AOMP_REPOS}
+# shellcheck disable=2034
BUILD_DIR=$BUILD_AOMP
# Here is where we define different behaviors for STANDALONE build
# and the new ROCm integrated build. The default is STANDALONE build.
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
# Standalone build gets ROCm components from the AOMP Installation.
# As a result their is an order to component builds.
ROCM_DIR=${ROCM_DIR:-$AOMP_INSTALL_DIR}
@@ -474,16 +541,18 @@ else
# ROCm integrated build gets ROCm pieces from installed ROCm
ROCM_DIR=${ROCM_DIR:-/opt/rocm}
- # For Integrated ROCm build we do not install to versioned dir and create
+ # For Integrated ROCm build we do not install to versioned dir and create
# a symbolic link. Instead we install directly to /opt/rocm/aomp
AOMP_INSTALL_DIR=${AOMP}
fi
+declare -a ASAN_FLAGS
+
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
if [ -f "${LLVM_INSTALL_LOC}/bin/clang" ]; then
ASAN_LIB=$(${LLVM_INSTALL_LOC}/bin/clang --print-file-name=libclang_rt.asan-x86_64.so)
ASAN_LIB_PATH=$(dirname "$ASAN_LIB")
- if [ ! -d $ASAN_LIB_PATH ]; then
+ if [ ! -d "$ASAN_LIB_PATH" ]; then
#Suppose above search path fails then via 'LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON' the host asan library would lose the suffix
ASAN_LIB=$(${LLVM_INSTALL_LOC}/bin/clang --print-file-name=libclang_rt.asan.so)
ASAN_LIB_PATH=$(dirname "$ASAN_LIB")
@@ -492,20 +561,37 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
# no compiler at $AOMP so set where we expect ASAN_LIP_PATH to be
ASAN_LIB_PATH=${LLVM_INSTALL_LOC}/lib/clang/${AOMP_MAJOR_VERSION}/lib/linux
fi
- ASAN_FLAGS="-g -fsanitize=address -shared-libasan -Wl,-rpath=$ASAN_LIB_PATH -L$ASAN_LIB_PATH"
+ ASAN_FLAGS=(-g -fsanitize=address -shared-libasan
+ "-Wl,-rpath=$ASAN_LIB_PATH" -L"$ASAN_LIB_PATH")
if [ "$AOMP_STANDALONE_BUILD" == 0 ]; then
- ASAN_FLAGS="$ASAN_FLAGS -I$ROCM_DIR/include -I$ROCM_DIR/include/hsa"
+ ASAN_FLAGS+=(-I"$ROCM_DIR/include" -I"$ROCM_DIR/include/hsa")
fi
fi
+function check_writable_installdir() {
+ local action=$1
+ local installdir=$2
+
+ # Make sure we can update the install directory
+ if [ "$action" == "install" ] ; then
+ $SUDO mkdir -p "$installdir"
+
+ if ! $SUDO touch "$installdir/testfile"; then
+ echo "ERROR: No update access to $installdir"
+ exit 1
+ fi
+ $SUDO rm "$installdir/testfile"
+ fi
+}
+
# TO use this function set variables patchdir and patchfile
function patchrepo(){
patchdir=$1
if [ "$AOMP_APPLY_ROCM_PATCHES" == 1 ] && [ -d "$patchdir" ] ; then
patches=""
- cd $patchdir
+ cd "$patchdir" || exit
if [[ "$2" =~ "postinstall" ]]; then
- getpatchlist $2
+ getpatchlist "$2"
else
getpatchlist
fi
@@ -513,10 +599,10 @@ if [ "$AOMP_APPLY_ROCM_PATCHES" == 1 ] && [ -d "$patchdir" ] ; then
#loop through list of patches to apply
if [ "$patches" != "" ] ; then
patchloc=${AOMP_PATCH_CONTROL_FILE%/*}
- echo patchloc=$patchloc
+ echo "patchloc=$patchloc"
for patch in $patches; do
patchfile=$patchloc/$patch
- if [ ! -f $patchfile ] ; then
+ if [ ! -f "$patchfile" ] ; then
echo
echo "ERROR: Patch $patchfile does not exist"
echo " It is referenced in ${AOMP_PATCH_CONTROL_FILE}"
@@ -526,12 +612,10 @@ if [ "$AOMP_APPLY_ROCM_PATCHES" == 1 ] && [ -d "$patchdir" ] ; then
echo "Testing patch $patchfile to $patchdir"
applypatch="yes"
- patch -p1 -t -N --dry-run <$patchfile >/dev/null
- if [ $? != 0 ] ; then
+ if ! patch -p1 -t -N --dry-run <"$patchfile" >/dev/null; then
applypatch="no"
# Check to see if reverse patch applies cleanly
- patch -p1 -R --dry-run -t <$patchfile >/dev/null
- if [ $? == 0 ] ; then
+ if patch -p1 -R --dry-run -t <"$patchfile" >/dev/null; then
echo "patch $patchfile was already applied to $patchdir"
else
echo
@@ -544,7 +628,7 @@ if [ "$AOMP_APPLY_ROCM_PATCHES" == 1 ] && [ -d "$patchdir" ] ; then
fi
if [ "$applypatch" == "yes" ] ; then
echo "Applying patch $patchfile to $patchdir"
- patch -p1 --no-backup-if-mismatch <$patchfile
+ patch -p1 --no-backup-if-mismatch <"$patchfile"
fi
done
fi
@@ -556,7 +640,7 @@ function removepatch(){
patchdir=$1
if [ "$AOMP_APPLY_ROCM_PATCHES" == 1 ] && [ -d "$patchdir" ] ; then
patches=""
- cd $patchdir
+ cd "$patchdir" || exit
getpatchlist
if [ "$patches" != "" ] ; then
echo "Patchdir $patchdir"
@@ -569,14 +653,14 @@ if [ "$AOMP_APPLY_ROCM_PATCHES" == 1 ] && [ -d "$patchdir" ] ; then
echo "Testing reverse patch $patchfile to $patchdir"
reversepatch="yes"
# Check to see if reverse patch applies cleanly
- patch -p1 -R --dry-run -f <$patchfile >/dev/null
- if [ $? != 0 ] ; then
+
+ if ! patch -p1 -R --dry-run -f <"$patchfile" >/dev/null; then
echo "patch $patchfile was NOT applied $patchdir, no patch to reverse"
reversepatch="no"
fi
if [ "$reversepatch" == "yes" ] ; then
echo "Reversing patch $patchfile to $patchdir"
- patch -p1 -R -f --no-backup-if-mismatch <$patchfile
+ patch -p1 -R -f --no-backup-if-mismatch <"$patchfile"
fi
done
fi
@@ -585,14 +669,14 @@ fi
function getpatchlist(){
currdir=$(pwd)
- basedir=$(basename $currdir)
+ basedir=$(basename "$currdir")
if [[ "$1" =~ "postinstall" ]]; then
reporegex="(^$1:\s)"
else
reporegex="(^$basedir:\s)"
fi
- echo FILE: $AOMP_PATCH_CONTROL_FILE
- echo regex $reporegex
+ echo "FILE: $AOMP_PATCH_CONTROL_FILE"
+ echo "regex $reporegex"
#read patch control file and look for correct patches
while read -r line; do
if [[ "$line" =~ $reporegex ]]; then
@@ -607,23 +691,23 @@ function getpatchlist(){
function setaompgpu (){
if [[ -e "$AOMP/../../bin/rocm_agent_enumerator" ]]; then
echo Set AOMP_GPU with ../.. rocm_agent_enumerator.
- detected_gpu=$($AOMP/../../bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
+ detected_gpu=$("$AOMP"/../../bin/rocm_agent_enumerator | grep -m 1 -E 'gfx[^0]{1}.{2}')
elif [[ -e "$AOMP/../bin/rocm_agent_enumerator" ]]; then
echo Set AOMP_GPU with .. rocm_agent_enumerator.
- detected_gpu=$($AOMP/../bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
+ detected_gpu=$("$AOMP"/../bin/rocm_agent_enumerator | grep -m 1 -E 'gfx[^0]{1}.{2}')
elif [[ "$AOMP" =~ "opt" ]]; then
echo Set AOMP_GPU with rocm_agent_enumerator.
- detected_gpu=$($AOMP/../bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
+ detected_gpu=$("$AOMP"/../bin/rocm_agent_enumerator | grep -m 1 -E 'gfx[^0]{1}.{2}')
else
echo Set AOMP_GPU with rocm_agent_enumerator.
- if [ -a $AOMP/bin/rocm_agent_enumerator ]; then
- detected_gpu=$($AOMP/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
- elif [ -a $AOMP/bin/amdgpu-arch ]; then
- detected_gpu=$($AOMP/bin/amdgpu-arch)
- detected_gpu=$(echo $detected_gpu | awk '{print $1,$5}')
- detected_gpu=`echo $detected_gpu | cut -d" " -f1` # pick first found
- elif [ -e $AOMP/../bin/mygpu ]; then
- detected_gpu=$($AOMP/../bin/mygpu)
+ if [ -a "$AOMP"/bin/rocm_agent_enumerator ]; then
+ detected_gpu=$("$AOMP"/bin/rocm_agent_enumerator | grep -m 1 -E 'gfx[^0]{1}.{2}')
+ elif [ -a "$AOMP"/bin/amdgpu-arch ]; then
+ detected_gpu=$("$AOMP"/bin/amdgpu-arch)
+ detected_gpu=$(echo "$detected_gpu" | awk '{print $1,$5}')
+ detected_gpu=$(echo "$detected_gpu" | cut -d" " -f1) # pick first found
+ elif [ -e "$AOMP"/../bin/mygpu ]; then
+ detected_gpu=$("$AOMP"/../bin/mygpu)
else
echo "Error: in setaompgpu, could not find rocm_agent_enumerator"
echo " Set AOMP_GPU, AOMP, or install ROCm"
@@ -633,8 +717,8 @@ function setaompgpu (){
AOMP_GPU=${AOMP_GPU:-$detected_gpu}
export AOMP_GPU
- echo AOMP_GPU = $AOMP_GPU
- echo AOMP = $AOMP
+ echo "AOMP_GPU = $AOMP_GPU"
+ echo "AOMP = $AOMP"
if [ "$AOMP_GPU" == "" ] || [ "$AOMP_GPU" == "unknown" ]; then
echo Error: AOMP_GPU not properly set...exiting.
@@ -692,13 +776,13 @@ function help_build_aomp(){
/bin/cat 2>&1 <<"EOF"
The build scripts in this directory are used to build AOMP.
-
+
Repositories:
Many repositories are used to build AOMP. The script clone_aomp.sh will
clone all the necessary repositories as subdirectories of the directory
$HOME/git/aomp11. The web repository locations and the required branches
are set with the file aomp_common_vars
-
+
Build all components:
To build all components, run these commands:
@@ -716,14 +800,14 @@ function help_build_aomp(){
"install" or "nocmake". Running with no options starts fresh with an empty
component build directory. It then runs cmake with the correct cmake options
then it runs make with a proper -j option.
-
+
Optional Arguments 'nocmake' and 'install' :
The 'nocmake' or 'install' options can only be used after your initial build
- with no options. The 'nocmake' option is intended to restart make after
- you fix code following a failed build. The 'install' option will run 'make'
- and 'make install' causing installation into the directory $AOMP_INSTALL_DIR.
+ with no options. The 'nocmake' option is intended to restart make after
+ you fix code following a failed build. The 'install' option will run 'make'
+ and 'make install' causing installation into the directory $AOMP_INSTALL_DIR.
The 'install' option will also create a symbolic link to directory $AOMP.
-
+
Environment Variables:
You can set environment variables to override behavior of the build scripts
NAME DEFAULT DESCRIPTION
@@ -733,28 +817,28 @@ function help_build_aomp(){
BUILD_TYPE Release The CMAKE build type
BUILD_AOMP same as AOMP_REPOS Set a different build location than AOMP_REPOS
AOMP_USE_NINJA 0 Use ninja if possible
-
+
To build a debug version of the compiler, run this command before the build:
export BUILD_TYPE=debug
-
+
The BUILD_AOMP Envronment Variable:
The build scripts will always build with cmake and make outside your source git trees.
By default (without BUILD_AOMP) the build will occur in the "build" subdirectory of
AOMP_REPOS. For example build_llvm will build in $AOMP_REPOS/build/llvm
-
+
The BUILD_AOMP environment variable enables source development outside your git
- repositories. By default, this feature is OFF. The BUILD_AOMP environment variable
- can be used if access to your git repositories is very slow or you want to test
- changes outside of your local git repositories (specified by AOMP_REPOS env var).
+ repositories. By default, this feature is OFF. The BUILD_AOMP environment variable
+ can be used if access to your git repositories is very slow or you want to test
+ changes outside of your local git repositories (specified by AOMP_REPOS env var).
If BUILD_AOMP is set, your git repositories (specifed by AOMP_REPOS) will be
- replicated to subdirectories of BUILD_AOMP using rsync. The subsequent build
+ replicated to subdirectories of BUILD_AOMP using rsync. The subsequent build
(cmake and make) will occur in subdirectory BUILD_AOMP/build/llvm.
This replication only happens on your initial build, that is, if you specify no arguments.
The option 'nocmake' skips replication and then restarts make in the build directory.
- The install option skips replication, skips cmake, runs 'make' and 'make install'.
+ The install option skips replication, skips cmake, runs 'make' and 'make install'.
Be careful to always use options nocmake or install if you made local changes in
BUILD_AOMP or your changes will be lost by a new replica of your git repositories.
-
+
EOF
exit 0
}
diff --git a/bin/build-deb-aomp.sh b/bin/build-deb-aomp.sh
index ef79ee2002..770037b548 100755
--- a/bin/build-deb-aomp.sh
+++ b/bin/build-deb-aomp.sh
@@ -1,4 +1,4 @@
-#/bin/bash
+#!/bin/bash
#
# build-deb-aomp.sh: Using debhelper and alien, build the aomp debian and rpm packages
# This script is tested on amd64 and ppc64le linux architectures.
@@ -10,14 +10,14 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
. /etc/lsb-release
-RELSTRING=`echo $DISTRIB_ID$DISTRIB_RELEASE | tr -d "."`
-echo RELSTRING=$RELSTRING
+RELSTRING=$(echo $DISTRIB_ID$DISTRIB_RELEASE | tr -d ".")
+echo "RELSTRING=$RELSTRING"
if [ "$1" == aomp-hip-libraries ]; then
pkgname=aomp-hip-libraries
@@ -25,7 +25,7 @@ else
pkgname=aomp
fi
-echo Building $pkgname package
+echo "Building $pkgname package"
dirname="aomp_${AOMP_VERSION_STRING}"
sourcedir="/usr/lib/$dirname"
@@ -35,7 +35,7 @@ DEBFULLNAME="Greg Rodgers"
DEBEMAIL="Gregory.Rodgers@amd.com"
export DEBFULLNAME DEBEMAIL
-DEBARCH=`uname -m`
+DEBARCH=$(uname -m)
if [ "$DEBARCH" == "x86_64" ] ; then
DEBARCH="amd64"
fi
@@ -46,115 +46,120 @@ if [ "$DEBARCH" == "aarch64" ] ; then
DEBARCH="arm64"
fi
-tmpdir=/tmp/$USER/build-deb
-builddir=$tmpdir/$pkgname
-if [ -d $builddir ] ; then
+tmpdir="/tmp/$USER/build-deb"
+builddir="$tmpdir/$pkgname"
+if [ -d "$builddir" ] ; then
echo
echo "--- CLEANUP LAST BUILD: rm -rf $builddir"
- sudo rm -rf $builddir
+ sudo rm -rf "$builddir"
fi
debdir=$PWD/debian
-froot=$builddir/$pkgname-$AOMP_VERSION
-mkdir -p $froot$installdir
-mkdir -p $froot/usr/share/doc/$dirname
+froot="$builddir/$pkgname-$AOMP_VERSION"
+mkdir -p "$froot$installdir"
+mkdir -p "$froot/usr/share/doc/$dirname"
echo
echo "--- PREPARING fake root directory $froot"
-sed -i -e "s|//|/|g" $BUILD_DIR/build/rocmlibs/installed_files.txt
+if [ -f "$BUILD_DIR/build/rocmlibs/installed_files.txt" ]; then
+ sed -i -e "s|//|/|g" "$BUILD_DIR/build/rocmlibs/installed_files.txt"
+fi
if [ "$pkgname" == "aomp-hip-libraries" ]; then
- cat $BUILD_DIR/build/rocmlibs/installed_files.txt | xargs -I {} cp -d --parents {} $froot
+ xargs -I {} cp -d --parents {} "$froot" < "$BUILD_DIR/build/rocmlibs/installed_files.txt"
else
# Create a temporary file to exclude math libraries if present
- if [ -f $BUILD_DIR/build/rocmlibs/installed_files.txt ]; then
+ if [ -f "$BUILD_DIR/build/rocmlibs/installed_files.txt" ]; then
tmpfile=/tmp/tmp_installed_files.txt
- rm -f $tmpfile
- cp $BUILD_DIR/build/rocmlibs/installed_files.txt $tmpfile
- sed -i -e "s/\/usr\/lib\/$dirname\///g" $tmpfile
- echo "rocblas" >> $tmpfile
- echo "lib/rocblas" >> $tmpfile
+ rm -f "$tmpfile"
+ cp "$BUILD_DIR/build/rocmlibs/installed_files.txt" "$tmpfile"
+ sed -i -e "s/\/usr\/lib\/$dirname\///g" "$tmpfile"
+ echo "rocblas" >> "$tmpfile"
+ echo "lib/rocblas" >> "$tmpfile"
fi
- rsync -a $sourcedir"/" --exclude ".*" --exclude "rocblas" --exclude "rocsparse" --exclude "rocprim" --exclude "hipblas" --exclude "rocsolver" --exclude "hipblas-common" --exclude-from=$tmpfile $froot$installdir
+ rsync -a "$sourcedir/" --exclude ".*" --exclude "rocblas" --exclude "rocsparse" --exclude "rocprim" --exclude "hipblas" --exclude "rocsolver" --exclude "hipblas-common" --exclude "hiprand" --exclude "rocrand" --exclude-from="$tmpfile" "$froot$installdir"
fi
if [ "$pkgname" == "aomp-hip-libraries" ]; then
- mkdir -p $froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}
- cp $debdir/copyright $froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}/.
- cp $debdir/LICENSE.TXT $froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}/.
+ mkdir -p "$froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}"
+ cp "$debdir/copyright" "$froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}/."
+ cp "$debdir/LICENSE.TXT" "$froot/usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}/."
else
- cp $debdir/copyright $froot/usr/share/doc/$dirname/.
- cp $debdir/LICENSE.TXT $froot/usr/share/doc/$dirname/.
+ cp "$debdir/copyright" "$froot/usr/share/doc/$dirname/."
+ cp "$debdir/LICENSE.TXT" "$froot/usr/share/doc/$dirname/."
fi
-cp -rp $debdir $froot/debian
+cp -rp "$debdir" "$froot/debian"
if [ "$DEBARCH" != "amd64" ] ; then
- echo sed -i -e"s/amd64/$DEBARCH/" $froot/debian/control
- sed -i -e"s/amd64/$DEBARCH/" $froot/debian/control
+ echo "sed -i -e\"s/amd64/$DEBARCH/\" $froot/debian/control"
+ sed -i -e"s/amd64/$DEBARCH/" "$froot/debian/control"
fi
if [ "$pkgname" == "aomp-hip-libraries" ]; then
- echo sed -i -e"s/Source: aomp/Source: $pkgname/" $froot/debian/control
- sed -i -e"s/Source: aomp/Source: $pkgname/" $froot/debian/control
- echo sed -i -e"s/Package: aomp/Package: $pkgname/" $froot/debian/control
- sed -i -e"s/Package: aomp/Package: $pkgname/" $froot/debian/control
+ echo "sed -i -e\"s/Source: aomp/Source: $pkgname/\" $froot/debian/control"
+ sed -i -e"s/Source: aomp/Source: $pkgname/" "$froot/debian/control"
+ echo "sed -i -e\"s/Package: aomp/Package: $pkgname/\" $froot/debian/control"
+ sed -i -e"s/Package: aomp/Package: $pkgname/" "$froot/debian/control"
fi
# Make the install and links file version specific
if [ "$pkgname" == "aomp-hip-libraries" ]; then
- echo "usr/lib/$dirname" > $froot/debian/$pkgname.install
- echo "usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}" >> $froot/debian/$pkgname.install
+ {
+ echo "usr/lib/$dirname"
+ echo "usr/share/doc/${pkgname}_${AOMP_VERSION_STRING}"
+ } > "$froot/debian/$pkgname.install"
else
- echo "usr/lib/$dirname usr/lib/aomp" > $froot/debian/$pkgname.links
- echo "usr/lib/$dirname/bin/aompExtractRegion /usr/bin/aompExtractRegion" >> $froot/debian/$pkgname.links
- echo "usr/lib/$dirname/bin/cloc.sh /usr/bin/cloc.sh" >> $froot/debian/$pkgname.links
- echo "usr/lib/$dirname/bin/mymcpu /usr/bin/mymcpu" >> $froot/debian/$pkgname.links
- echo "usr/lib/$dirname/bin/mygpu /usr/bin/mygpu" >> $froot/debian/$pkgname.links
- echo "usr/lib/$dirname/bin/aompversion /usr/bin/aompversion" >> $froot/debian/$pkgname.links
- echo "usr/lib/$dirname/bin/aompcc /usr/bin/aompcc" >> $froot/debian/$pkgname.links
- echo "usr/lib/$dirname/bin/gpurun /usr/bin/gpurun" >> $froot/debian/$pkgname.links
- echo "usr/lib/$dirname" > $froot/debian/$pkgname.install
- echo "usr/share/doc/$dirname" >> $froot/debian/$pkgname.install
+ {
+ echo "usr/lib/$dirname usr/lib/aomp"
+ echo "usr/lib/$dirname/bin/aompversion /usr/bin/aompversion"
+ echo "usr/lib/$dirname/bin/gpurun /usr/bin/gpurun"
+ } > "$froot/debian/$pkgname.links"
+ {
+ echo "usr/lib/$dirname"
+ echo "usr/share/doc/$dirname"
+ } > "$froot/debian/$pkgname.install"
fi
echo
echo "--- BUILDING SOURCE TARBALL $builddir/${pkgname}_$AOMP_VERSION.orig.tar.gz "
echo " FROM FAKEROOT: $froot "
-cd $builddir
-tar -czf $builddir/${pkgname}_$AOMP_VERSION.orig.tar.gz ${pkgname}-$AOMP_VERSION
+cd "$builddir" || exit
+tar -czf "$builddir/${pkgname}_$AOMP_VERSION.orig.tar.gz" "${pkgname}-$AOMP_VERSION"
echo " DONE BUILDING TARBALL"
echo
echo "--- RUNNING dch TO MANANGE CHANGELOG "
-cd $froot
+cd "$froot" || exit
# Skip changelog editor for docker release builds.
-echo dch -v ${AOMP_VERSION_STRING} -e --package $pkgname
+echo "dch -v ${AOMP_VERSION_STRING} -e --package $pkgname"
if [ "$DOCKER" == "1" ]; then
- dch -v ${AOMP_VERSION_STRING} --package $pkgname ""
+ dch -v "${AOMP_VERSION_STRING}" --package "$pkgname" ""
else
- dch -v ${AOMP_VERSION_STRING} --package $pkgname
+ dch -v "${AOMP_VERSION_STRING}" --package "$pkgname"
fi
# Backup the debian changelog to git repo, be sure to commit this
-cp -p $froot/debian/changelog $debdir/.
+cp -p "$froot/debian/changelog" "$debdir/."
+
+declare -a debuildargs
-debuildargs="-us -uc -rsudo --lintian-opts -X files,changelog-file,fields"
+debuildargs=(-us -uc -rsudo --lintian-opts -X "files,changelog-file,fields")
echo
-echo "--- BUILDING DEB: debuild $debuildargs "
-debuild $debuildargs
+echo "--- BUILDING DEB: debuild" "${debuildargs[@]}"
+debuild "${debuildargs[@]}"
dbrc=$?
echo " DONE BUILDING DEB WITH RC: $dbrc"
if [ "$dbrc" != "0" ] ; then
echo "ERROR during debuild"
- exit $dbrc
+ exit "$dbrc"
fi
# Backup debhelper log to git repo , be sure to commit this
-cp -p $froot/debian/${pkgname}.debhelper.log $debdir/.
+cp -p "$froot/debian/${pkgname}.debhelper.log" "$debdir/."
-mkdir -p $tmpdir/debs
-if [ -f $tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb ] ; then
- rm -f $tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb
+mkdir -p "$tmpdir/debs"
+if [ -f "$tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb" ] ; then
+ rm -f "$tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb"
fi
# Insert the os release name
-cp -p $builddir/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb $tmpdir/debs/${pkgname}_${RELSTRING}_${AOMP_VERSION_STRING}_$DEBARCH.deb
+cp -p "$builddir/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb" "$tmpdir/debs/${pkgname}_${RELSTRING}_${AOMP_VERSION_STRING}_$DEBARCH.deb"
echo
echo "DONE Debian package is in $tmpdir/debs/${pkgname}_${AOMP_VERSION_STRING}_$DEBARCH.deb"
echo
diff --git a/bin/build-rpm.sh b/bin/build-rpm.sh
index 4253c78099..da5f5db9e7 100755
--- a/bin/build-rpm.sh
+++ b/bin/build-rpm.sh
@@ -4,9 +4,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
if [ "$1" == aomp-hip-libraries ]; then
@@ -15,8 +15,8 @@ else
pkgname=aomp
fi
-osname=$(cat /etc/os-release | grep -e ^NAME=)
-version=$(cat /etc/os-release | grep -e ^VERSION=)
+osname=$(grep -e ^NAME= < /etc/os-release)
+version=$(grep -e ^VERSION= < /etc/os-release)
rpmname="Not_Found"
if [[ $osname =~ "Red Hat" ]]; then
echo "Red Hat found!!!"
@@ -37,114 +37,120 @@ elif [[ $osname =~ "CentOS" ]]; then
elif [[ $version =~ "7" ]]; then
rpmname=${pkgname}_CENTOS_7
fi
+ elif [[ $osname =~ "AlmaLinux" ]]; then
+ if [[ $version =~ "8" ]]; then
+ rpmname=${pkgname}_ALMALINUX_8
+ else
+ rpmname=${pkgname}_ALMALINUX
+ fi
fi
echo "rpmname: $rpmname"
+# For the life of this script, change home directory
+curdir=$PWD
+tmphome="/tmp/$USER/home"
+savehome=$HOME
+export HOME=$tmphome
+
# Ensure the rpmbuild tool from rpm-build package is available
-rpmbuild_loc=`which rpmbuild 2>/dev/null`
+rpmbuild_loc=$(which rpmbuild 2>/dev/null)
if [ -z "$rpmbuild_loc" ];then
echo
echo "ERROR: You need to install rpm-build for $0"
echo
export HOME=$savehome
- cd $curdir
+ cd "$curdir" || exit
exit 1
fi
-# For the life of this script, change home directory
-curdir=$PWD
-tmphome="/tmp/$USER/home"
-savehome=$HOME
-export HOME=$tmphome
-
-echo --- checking for $tmphome/rpmbuild
+echo "--- checking for $tmphome/rpmbuild"
if [ -d "$tmphome/rpmbuild" ] ; then
- echo --- cleanup from previous call to $0
- echo --- rm -rf $tmphome/rpmbuild
- rm -rf $tmphome/rpmbuild
+ echo "--- cleanup from previous call to $0"
+ echo "--- rm -rf $tmphome/rpmbuild"
+ rm -rf "$tmphome/rpmbuild"
fi
-dirname=aomp_${AOMP_VERSION_STRING}
-echo --- mkdir -p $tmphome/rpmbuild/SOURCES/$rpmname/usr/lib
-mkdir -p $tmphome/rpmbuild/SOURCES/$rpmname/usr/lib/$dirname
+dirname="aomp_${AOMP_VERSION_STRING}"
+echo "--- mkdir -p $tmphome/rpmbuild/SOURCES/$rpmname/usr/lib"
+mkdir -p "$tmphome/rpmbuild/SOURCES/$rpmname/usr/lib/$dirname"
if [ "$pkgname" == "aomp-hip-libraries" ]; then
echo "cat $BUILD_DIR/build/rocmlibs/installed_files.txt | xargs -I {} cp -d --parents {} ~/rpmbuild/SOURCES/$rpmname"
- cat $BUILD_DIR/build/rocmlibs/installed_files.txt | xargs -I {} cp -d --parents {} ~/rpmbuild/SOURCES/$rpmname
+ xargs -I {} cp -d --parents {} "$HOME/rpmbuild/SOURCES/$rpmname" < "$BUILD_DIR/build/rocmlibs/installed_files.txt"
else
# Create a temporary file to exclude math libraries if present
- if [ -f $BUILD_DIR/build/rocmlibs/installed_files.txt ]; then
+ if [ -f "$BUILD_DIR/build/rocmlibs/installed_files.txt" ]; then
tmpfile=/tmp/tmp_installed_files.txt
- rm -f $tmpfile
- cp $BUILD_DIR/build/rocmlibs/installed_files.txt $tmpfile
- sed -i -e "s/\/usr\/lib\/$dirname\///g" $tmpfile
+ rm -f "$tmpfile"
+ cp "$BUILD_DIR/build/rocmlibs/installed_files.txt" "$tmpfile"
+ sed -i -e "s/\/usr\/lib\/$dirname\///g" "$tmpfile"
# Avoid copying empty rocblas folders
- echo "rocblas" >> $tmpfile
- echo "lib/rocblas" >> $tmpfile
+ echo "rocblas" >> "$tmpfile"
+ echo "lib/rocblas" >> "$tmpfile"
fi
# Exclude hidden files and math libraries from aomp package
- echo rsync -a --delete /usr/lib/$dirname/ --exclude ".*" --exclude-from=$tmpfile ~/rpmbuild/SOURCES/$rpmname/usr/lib/$dirname
- rsync -a --delete /usr/lib/$dirname"/" --exclude ".*" --exclude-from=$tmpfile ~/rpmbuild/SOURCES/$rpmname/usr/lib/$dirname
+ echo "rsync -a --delete /usr/lib/$dirname/ --exclude ".*" --exclude-from=$tmpfile ~/rpmbuild/SOURCES/$rpmname/usr/lib/$dirname"
+ rsync -a --delete "/usr/lib/$dirname/" --exclude ".*" --exclude-from="$tmpfile" "$HOME/rpmbuild/SOURCES/$rpmname/usr/lib/$dirname"
fi
-echo --- mkdir -p $tmphome/rpmbuild/SPECS
-mkdir -p $tmphome/rpmbuild/SPECS
+echo "--- mkdir -p $tmphome/rpmbuild/SPECS"
+mkdir -p "$tmphome/rpmbuild/SPECS"
-tmpspecfile=$tmphome/rpmbuild/SPECS/aomp.spec
-echo --- cp $thisdir/aomp.spec $tmpspecfile
-cp $thisdir/aomp.spec $tmpspecfile
-echo --- sed -ie "s/__VERSION1/$AOMP_VERSION/" $tmpspecfile
-sed -ie "s/__VERSION1/$AOMP_VERSION/" $tmpspecfile
-sed -ie "s/__VERSION2_STRING/$AOMP_VERSION_STRING/" $tmpspecfile
-sed -ie "s/__VERSION3_MOD/$AOMP_VERSION_MOD/" $tmpspecfile
+tmpspecfile="$tmphome/rpmbuild/SPECS/aomp.spec"
+echo "--- cp $thisdir/aomp.spec $tmpspecfile"
+cp "$thisdir/aomp.spec" "$tmpspecfile"
+echo "--- sed -ie \"s/__VERSION1/$AOMP_VERSION/\" $tmpspecfile"
+sed -ie "s/__VERSION1/$AOMP_VERSION/" "$tmpspecfile"
+sed -ie "s/__VERSION2_STRING/$AOMP_VERSION_STRING/" "$tmpspecfile"
+sed -ie "s/__VERSION3_MOD/$AOMP_VERSION_MOD/" "$tmpspecfile"
# Replace rpmname place holder with actual $rpmname
-sed -ie "s/Name: \$rpmname/Name: $rpmname/" $tmpspecfile
-sed -ie "s/\$rpmname.tar.gz/$rpmname.tar.gz/" $tmpspecfile
-cat $thisdir/debian/changelog | grep -v " --" | grep -v "UNRELEASED" >>$tmpspecfile
-
-echo --- cd ~/rpmbuild/SOURCES
-cd ~/rpmbuild/SOURCES
-
-if [ ! -d ${rpmname} ] ; then
- echo
- echo "ERROR: Missing directory $tmphome/rpmbuild/SOURCES/${rpmname}"
- echo
- export HOME=$savehome
- cd $curdir
- exit 1
+sed -ie "s/Name: \$rpmname/Name: $rpmname/" "$tmpspecfile"
+sed -ie "s/\$rpmname.tar.gz/$rpmname.tar.gz/" "$tmpspecfile"
+grep -v " --" < "$thisdir/debian/changelog" | grep -v "UNRELEASED" >>"$tmpspecfile"
+
+echo "--- cd ~/rpmbuild/SOURCES"
+cd ~/rpmbuild/SOURCES || exit
+
+if [ ! -d "${rpmname}" ] ; then
+ echo
+ echo "ERROR: Missing directory $tmphome/rpmbuild/SOURCES/${rpmname}"
+ echo
+ export HOME=$savehome
+ cd "$curdir" || exit
+ exit 1
fi
# tar and zip the package contents
-echo --- rm -f ${rpmname}.tar.gz
-rm -f ${rpmname}.tar.gz
-echo --- tar zcf ${rpmname}.tar.gz ${rpmname}
-tar zcf ${rpmname}.tar.gz ${rpmname}
-echo --- ls -l $PWD/${rpmname}.tar.gz
-ls -l $PWD/${rpmname}.tar.gz
-echo --- done tar
+echo "--- rm -f ${rpmname}.tar.gz"
+rm -f "${rpmname}.tar.gz"
+echo "--- tar zcf ${rpmname}.tar.gz ${rpmname}"
+tar zcf "${rpmname}.tar.gz" "${rpmname}"
+echo "--- ls -l $PWD/${rpmname}.tar.gz"
+ls -l "$PWD/${rpmname}.tar.gz"
+echo "--- done tar"
# build the package
echo
-echo ------ STARTING rpmbuild -----
+echo "------ STARTING rpmbuild -----"
echo
-echo rpmbuild --define "_topdir $tmphome/rpmbuild" -ba -v ../SPECS/aomp.spec
+echo "rpmbuild --define \"_topdir $tmphome/rpmbuild\" -ba -v ../SPECS/aomp.spec"
rpmbuild --define "_topdir $tmphome/rpmbuild" -ba -v ../SPECS/aomp.spec
rc=$?
-echo ------ DONE rpmbuild rc is $rc -----
+echo "------ DONE rpmbuild rc is $rc -----"
if [ $rc != 0 ] ; then
echo
echo "ERROR during rpmbuild"
echo
export HOME=$savehome
- cd $curdir
+ cd "$curdir" || exit
exit 1
fi
outfile="$tmphome/rpmbuild/RPMS/x86_64/${rpmname}-${AOMP_VERSION_STRING}.x86_64.rpm"
echo " --- The output rpm file is $outfile."
echo "--- ls -lh $outfile"
-ls -lh $outfile
+ls -lh "$outfile"
echo
export HOME=$savehome
-cd $curdir
+cd "$curdir" || exit
diff --git a/bin/build_amdsmi.sh b/bin/build_amdsmi.sh
index ae52cd9da8..ffa078e5e3 100755
--- a/bin/build_amdsmi.sh
+++ b/bin/build_amdsmi.sh
@@ -29,9 +29,9 @@
# SOFTWARE.
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
RSMILIB_REPO_DIR=$AOMP_REPOS/amdsmi
@@ -50,12 +50,12 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $RSMILIB_REPO_DIR ] ; then
+if [ ! -d "$RSMILIB_REPO_DIR" ] ; then
echo "ERROR: Missing repository $RSMILIB_REPO_DIR/"
exit 1
fi
-if [ ! -f $LLVM_INSTALL_LOC/bin/clang ] ; then
+if [ ! -f "$LLVM_INSTALL_LOC/bin/clang" ] ; then
echo "ERROR: Missing file $AOMP/bin/clang"
echo " Build the AOMP llvm compiler in $AOMP first"
echo " This is needed to build the device libraries"
@@ -63,38 +63,35 @@ if [ ! -f $LLVM_INSTALL_LOC/bin/clang ] ; then
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $AOMP_INSTALL_DIR
- $SUDO touch $AOMP_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $AOMP_INSTALL_DIR"
- exit 1
- fi
- $SUDO rm $AOMP_INSTALL_DIR/testfile
-fi
+check_writable_installdir "$1" "$AOMP_INSTALL_DIR"
-patchrepo $AOMP_REPOS/amdsmi
+patchrepo "$AOMP_REPOS/amdsmi"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/amdsmi" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/amdsmi
- rm -rf $BUILD_DIR/build/amdsmi
+ echo "rm -rf $BUILD_DIR/build/amdsmi"
+ rm -rf "$BUILD_DIR/build/amdsmi"
fi
- MYCMAKEOPTS="$AOMP_ORIGIN_RPATH -DCMAKE_BUILD_TYPE=$BUILDTYPE -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH='\$ORIGIN/../lib' -DCMAKE_EXE_LINKER_FLAGS='-Wl,--disable-new-dtags'"
+ declare -a MYCMAKEOPTS
- mkdir -p $BUILD_DIR/build/amdsmi
- cd $BUILD_DIR/build/amdsmi
+ MYCMAKEOPTS=("${AOMP_ORIGIN_RPATH[@]}" -DCMAKE_BUILD_TYPE="$BUILDTYPE"
+ -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR"
+ -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
+ -DCMAKE_INSTALL_RPATH="\$ORIGIN/../lib"
+ -DCMAKE_EXE_LINKER_FLAGS='-Wl,--disable-new-dtags')
+
+ mkdir -p "$BUILD_DIR/build/amdsmi"
+ cd "$BUILD_DIR/build/amdsmi" || exit
echo
echo " -----Running amdsmi cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $RSMILIB_REPO_DIR
- ${AOMP_CMAKE} $MYCMAKEOPTS $RSMILIB_REPO_DIR
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE} $(shquot "${MYCMAKEOPTS[@]}") $RSMILIB_REPO_DIR"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$RSMILIB_REPO_DIR"; then
echo "ERROR amdsmi cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -103,11 +100,11 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_DIR/build/amdsmi
+cd "$BUILD_DIR/build/amdsmi" || exit
echo
echo " -----Running make for amdsmi ---- "
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -125,13 +122,12 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_DIR/build/amdsmi
+ cd "$BUILD_DIR/build/amdsmi" || exit
echo
echo " -----Installing to $AOMP_INSTALL_DIR ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
- removepatch $AOMP_REPOS/amdsmi
+ removepatch "$AOMP_REPOS/amdsmi"
fi
diff --git a/bin/build_aomp.sh b/bin/build_aomp.sh
index fe13f732b2..650fd0a32e 100755
--- a/bin/build_aomp.sh
+++ b/bin/build_aomp.sh
@@ -4,58 +4,53 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
function build_aomp_component() {
- osversion=$(cat /etc/os-release | grep -e ^VERSION_ID)
+ osversion=$(grep -e ^VERSION_ID < /etc/os-release)
- if [[ $osversion =~ '"7.' ]]; then
- echo "OS version 7 found `cat /etc/os-release`"
+ if [[ $osversion =~ \"7\. ]]; then
+ echo "OS version 7 found $(cat /etc/os-release)"
+ # shellcheck disable=1091
[ -f /opt/rh/devtoolset-7/enable ] && . /opt/rh/devtoolset-7/enable
- elif [[ $osversion =~ '"8' ]]; then
- echo "OS version 8 found `cat /etc/os-release`"
- echo
- echo "Get updated gcc 8: export PATH=/usr/bin:\$PATH"
- export PATH=/usr/bin:$PATH
- gcc --version
fi
_stats_dir=$AOMP_INSTALL_DIR/.aomp_component_stats
- mkdir -p $_stats_dir
- touch $_stats_dir/.${COMPONENT}.ts
- start_date=`date`
- start_secs=`date +%s`
+ mkdir -p "$_stats_dir"
+ touch "$_stats_dir/.${COMPONENT}.ts"
+ start_date=$(date)
+ start_secs=$(date +%s)
- $AOMP_REPOS/$AOMP_REPO_NAME/bin/build_$COMPONENT.sh "$@"
+ "$AOMP_REPOS/$AOMP_REPO_NAME/bin/build_$COMPONENT.sh" "$@"
rc=$?
if [ $rc != 0 ] ; then
echo " !!! build_aomp.sh: BUILD FAILED FOR COMPONENT $COMPONENT !!!"
exit $rc
fi
if [ $# -eq 0 ] ; then
- $AOMP_REPOS/$AOMP_REPO_NAME/bin/build_$COMPONENT.sh install
+ "$AOMP_REPOS/$AOMP_REPO_NAME/bin/build_$COMPONENT.sh" install
rc=$?
if [ $rc != 0 ] ; then
echo " !!! build_aomp.sh: INSTALL FAILED FOR COMPONENT $COMPONENT !!!"
exit $rc
fi
# gather stats on artifacts installed with this component build
- end_date=`date`
- end_secs=`date +%s`
- find $AOMP_INSTALL_DIR -type f -newercc $_stats_dir/.${COMPONENT}.ts | xargs wc -c >$_stats_dir/$COMPONENT.files
- echo "COMPONENT $COMPONENT START : $start_date " >$_stats_dir/$COMPONENT.stats
- echo "COMPONENT $COMPONENT END : $end_date" >>$_stats_dir/$COMPONENT.stats
- echo "COMPONENT $COMPONENT TIME : $(( $end_secs - $start_secs )) seconds" >> $_stats_dir/$COMPONENT.stats
- file_count=`wc -l $_stats_dir/$COMPONENT.files | cut -d" " -f1`
+ end_date=$(date)
+ end_secs=$(date +%s)
+ find "$AOMP_INSTALL_DIR" -type f -newercc "$_stats_dir/.${COMPONENT}.ts" -exec wc -c {} \; > "$_stats_dir/$COMPONENT.files"
+ echo "COMPONENT $COMPONENT START : $start_date " >"$_stats_dir/$COMPONENT.stats"
+ echo "COMPONENT $COMPONENT END : $end_date" >>"$_stats_dir/$COMPONENT.stats"
+ echo "COMPONENT $COMPONENT TIME : $(( end_secs - start_secs )) seconds" >> "$_stats_dir/$COMPONENT.stats"
+ file_count=$(wc -l "$_stats_dir/$COMPONENT.files" | cut -d" " -f1)
file_count=$(( file_count -1 ))
- echo "COMPONENT $COMPONENT FILES : $file_count " >> $_stats_dir/$COMPONENT.stats
- new_bytes=`grep " total" $_stats_dir/$COMPONENT.files | cut -d" " -f1 | awk '{sum += $1} END {print sum}'`
+ echo "COMPONENT $COMPONENT FILES : $file_count " >> "$_stats_dir/$COMPONENT.stats"
+ new_bytes=$(grep " total" "$_stats_dir/$COMPONENT.files" | cut -d" " -f1 | awk '{sum += $1} END {print sum}')
k_bytes=$(( new_bytes / 1024 ))
m_bytes=$(( k_bytes / 1024 ))
- echo "COMPONENT $COMPONENT SIZE : $k_bytes KB $m_bytes MB " >> $_stats_dir/$COMPONENT.stats
+ echo "COMPONENT $COMPONENT SIZE : $k_bytes KB $m_bytes MB " >> "$_stats_dir/$COMPONENT.stats"
fi
}
@@ -69,23 +64,23 @@ fi
# Test update access to AOMP_INSTALL_DIR
# This should be done early to ensure sudo (if set) does not prompt for password later
-$TOPSUDO mkdir -p $AOMP_INSTALL_DIR
-if [ $? != 0 ] ; then
+
+if ! $TOPSUDO mkdir -p "$AOMP_INSTALL_DIR"; then
echo "ERROR: $TOPSUDO mkdir failed, No update access to $AOMP_INSTALL_DIR"
exit 1
fi
-$TOPSUDO touch $AOMP_INSTALL_DIR/testfile
-if [ $? != 0 ] ; then
+
+if ! $TOPSUDO touch "$AOMP_INSTALL_DIR/testfile"; then
echo "ERROR: $TOPSUDO touch failed, No update access to $AOMP_INSTALL_DIR"
exit 1
fi
-$TOPSUDO rm $AOMP_INSTALL_DIR/testfile
+$TOPSUDO rm "$AOMP_INSTALL_DIR/testfile"
#Check for gawk on Ubuntu, which is needed for the flang build.
GAWK=$(gawk --version | grep "^GNU Awk")
-OS=$(cat /etc/os-release | grep "^NAME=")
+OS=$(grep "^NAME=" < /etc/os-release)
-if [[ -z $GAWK ]] && [[ "$OS" == *"Ubuntu"* ]] ; then
+if [[ -z "$GAWK" ]] && [[ "$OS" == *"Ubuntu"* ]] ; then
echo
echo "Build Error: gawk was not found and is required for building flang! Please run 'sudo apt-get install gawk' and run build_aomp.sh again."
echo
@@ -103,8 +98,8 @@ echo
components="$AOMP_COMPONENT_LIST"
if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
- components="$components rocprofiler-register rocr openmp offload extras comgr rocminfo rocm_smi_lib amdsmi"
- _hostarch=`uname -m`
+ components="$components rocprofiler-register rocr llvm_runtimes_standalone offload extras comgr rocminfo rocm_smi_lib amdsmi"
+ _hostarch=$(uname -m)
# The rocclr architecture is very x86 centric so it will not build on ppc64. Without
# rocclr, we have no HIP or OpenCL for ppc64 :-( However, rocr works for ppc64 so AOMP works.
if [ "$_hostarch" == "x86_64" ] ; then
@@ -112,7 +107,7 @@ if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
if [ "$AOMP_SKIP_FLANG" == 0 ] ; then
components="$components llvm-classic flang-classic pgmath flang flang_runtime"
fi
- components="$components hipcc hipamd "
+ components="$components hipcc hipamd hipify"
fi
if [ "$AOMP_SKIP_FLANG_NEW" == 0 ] && [ "$AOMP_SKIP_FLANG" == 1 ] ; then
# We can only build hipfort for flang
@@ -120,27 +115,26 @@ if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
fi
# ROCdbgapi requires atleast g++ 7
- GPPVERS=`g++ --version | grep g++ | cut -d")" -f2 | cut -d"." -f1`
+ GPPVERS=$(g++ --version | grep g++ | cut -d")" -f2 | cut -d"." -f1)
if [ "$AOMP_BUILD_DEBUG" == "1" ] && [ "$GPPVERS" -ge 7 ]; then
components="$components rocdbgapi rocgdb"
fi
# Do not add roctracer/rocprofiler for tarball install
# Also, as of ROCm 5.3 roctracer and rocprofiler require a rocm installation
# The preceeding AOMP installation is not sufficient to build them.
+ # rocprofiler-sdk adds rocprofv3 binary and rocprof/rocprofv2 will be phased out.
+ # We removed roctracer/rocprofiler because ROCm favors rocprofiler-sdk.
if [ "$TARBALL_INSTALL" != 1 ] && [ "$_hostarch" == "x86_64" ] ; then
- components="$components roctracer rocprofiler"
+ components="$components rocprofiler-sdk"
fi
else
# For ROCM build (AOMP_STANDALONE_BUILD=0) the components roct, rocr,
# libdevice, project, comgr, rocminfo, hipamd, rocdbgapi, rocgdb,
# roctracer, rocprofiler, rocm_smi_lib, and amdsmi should be found
# in ROCM in /opt/rocm. The ROCM build only needs these components:
- components="extras openmp"
- if [ -f "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload/CMakeLists.txt" ]; then
- components="$components offload"
- fi
+ components="llvm_runtimes_standalone offload"
if [ "$AOMP_SKIP_FLANG" == 0 ] ; then
- if [ "$SANITIZER" == 1 ] && [ -f $AOMP/bin/flang-classic ] ; then
+ if [ "$SANITIZER" == 1 ] && [ -f "$AOMP/bin/flang-classic" ] ; then
components="$components pgmath flang flang_runtime"
else
components="$components llvm-classic flang-classic pgmath flang flang_runtime"
@@ -152,10 +146,11 @@ echo "COMPONENTS:$components"
#Partial build options. Check if argument was given.
if [ -n "$1" ] ; then
found=0
+ list=""
#Start build from given component (./build_aomp.sh continue openmp)
if [ "$1" == 'continue' ] ; then
for COMPONENT in $components ; do
- if [ $COMPONENT == "$2" ] ; then
+ if [ "$COMPONENT" == "$2" ] ; then
found=1
fi
if [[ $found -eq 1 ]] ; then
@@ -171,8 +166,8 @@ if [ -n "$1" ] ; then
#Select which components to build(./build_aomp.sh select libdevice extras)
elif [ "$1" == 'select' ] ; then
- for ARGUMENT in $@ ; do
- if [ $ARGUMENT != "$1" ] ; then
+ for ARGUMENT in "$@" ; do
+ if [ "$ARGUMENT" != "$1" ] ; then
list+="$ARGUMENT "
fi
done
@@ -200,8 +195,8 @@ echo " ================= END build_aomp.sh ==================="
echo
if [ "$AOMP_STANDALONE_BUILD" -eq 0 ]; then
- cd $BUILD_DIR/build
- classic_version=`ls flang-classic`
+ cd "$BUILD_DIR/build" || exit
+ classic_version=$(ls flang-classic)
classic_install_manifest=$classic_version/install_manifest.txt
if [ "$SANITIZER" == 1 ]; then
install_manifest_orig=asan/install_manifest.txt
@@ -210,20 +205,20 @@ if [ "$AOMP_STANDALONE_BUILD" -eq 0 ]; then
fi
# Clean file log
- rm -f $BUILD_DIR/build/installed_files.txt
+ rm -f "$BUILD_DIR/build/installed_files.txt"
for directory in ./*/; do
- pushd $directory > /dev/null
+ pushd "$directory" > /dev/null || exit
if [[ "$directory" =~ "flang-classic" ]]; then
install_manifest=$classic_install_manifest
else
- install_manifest=$install_manifest_orig
+ install_manifest="$install_manifest_orig"
fi
if [ -f "$install_manifest" ]; then
- cat $install_manifest >> $BUILD_DIR/build/installed_files.txt
- echo "" >> $BUILD_DIR/build/installed_files.txt
+ cat "$install_manifest" >> "$BUILD_DIR/build/installed_files.txt"
+ echo "" >> "$BUILD_DIR/build/installed_files.txt"
fi
- popd > /dev/null
+ popd > /dev/null || exit
done
fi
exit 0
diff --git a/bin/build_aomp_docker_release.sh b/bin/build_aomp_docker_release.sh
index 17a3fa7fa5..75c8af12f7 100755
--- a/bin/build_aomp_docker_release.sh
+++ b/bin/build_aomp_docker_release.sh
@@ -10,8 +10,8 @@
set -e
set -x
-AOMP_VERSION_STRING=${AOMP_VERSION_STRING:-21.0-0}
-AOMP_VERSION=${AOMP_VERSION:-21.0}
+AOMP_VERSION_STRING=${AOMP_VERSION_STRING:-23.0-0}
+AOMP_VERSION=${AOMP_VERSION:-23.0}
#DOCKERX_HOST=${DOCKERX_HOST:-$HOME/dockerx}
DOCKERX_HOST=$HOME/dockerx
#DOCKERX=${DOCKERX:-/dockerx}
@@ -20,14 +20,14 @@ PATCHLOC=${PATCHLOC:-$DOCKERX/changelog.patch}
host_packages=$HOME/aomp-docker-release/$AOMP_VERSION_STRING/packages
#mkdir -p $docker_home; mkdir -p $docker_home/$AOMP_VERSION_STRING/packages
-mkdir -p $host_packages
+mkdir -p "$host_packages"
declare -A url_array
declare -A prereq_array
# Populate url arrays with dockers
-if [ -f $DOCKERX_HOST/docker-urls.txt ]; then
+if [ -f "$DOCKERX_HOST/docker-urls.txt" ]; then
while read -r line; do
if [[ "$line" =~ "ubuntu-base" ]]; then
url_array["ubuntu1804"]=$line
@@ -49,8 +49,10 @@ if [ -f $DOCKERX_HOST/docker-urls.txt ]; then
url_array["rhel9"]=$line
elif [[ "$line" =~ "suse" ]]; then
url_array["sles15"]=$line
+ elif [[ "$line" =~ "manylinux" ]]; then
+ url_array["alma8"]=$line
fi
- done < $DOCKERX_HOST/docker-urls.txt
+ done < "$DOCKERX_HOST/docker-urls.txt"
else
echo "Error: $DOCKERX_HOST/docker-urls.txt not found, exiting."
exit 1
@@ -58,36 +60,41 @@ fi
pip_install="python3 -m pip install CppHeaderParser argparse wheel lit lxml barectf pandas"
pip_install_centos7="python3.8 -m pip install CppHeaderParser argparse wheel lit lxml barectf pandas"
-pip_install_sles15="python3.8 -m pip install CppHeaderParser argparse wheel lit lxml barectf pandas"
+pip_install_sles15="python3.10 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3.10 -m pip install CppHeaderParser argparse wheel lit lxml pandas"
+pip_install_rhel8="python3.10 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3.10 -m pip install CppHeaderParser argparse wheel lit lxml pandas"
# 22.04 workaround for cython/PyYAML bug.
pip_install_2204="python3 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3 -m pip install CppHeaderParser argparse wheel lit lxml pandas"
+pip_install_alma="python3.10 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3.10 -m pip install CppHeaderParser argparse wheel lit lxml pandas"
+
# 24.04 uses python virtual environment
pip_install_2404="python3 -m venv /opt/venv; PATH=/opt/venv/bin:$PATH python3 -m pip install CppHeaderParser argparse lxml pandas setuptools PyYAML pandas"
# Populate prereq arrays
prereq_array["ubuntu1804"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.8-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync sudo && $pip_install"
-p2rereq_array["ubuntu2004"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.8-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev sudo ccache libgmp-dev libmpfr-dev && $pip_install"
+prereq_array["ubuntu2004"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.8-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev sudo ccache libgmp-dev libmpfr-dev && $pip_install"
-prereq_array["ubuntu2204"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.10-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev libstdc++-12-dev sudo python3-lxml ccache libgmp-dev libmpfr-dev ocl-icd-opencl-dev libfmt-dev libmsgpack-dev python3-venv && $pip_install_2204"
+prereq_array["ubuntu2204"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libpython3.10-dev libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev libstdc++-12-dev sudo python3-lxml ccache libgmp-dev libmpfr-dev ocl-icd-opencl-dev libfmt-dev libmsgpack-dev python3-venv libsqlite3-dev && $pip_install_2204"
-prereq_array["ubuntu2404"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses-dev liblzma-dev python3-setuptools python3-dev python3-barectf python3-pip python3-pip-whl python3-requests python3-venv python3-yaml libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev libstdc++-12-dev sudo python3-lxml ccache libgmp-dev libmpfr-dev make ocl-icd-opencl-dev libfmt-dev libmsgpack-dev && $pip_install_2404"
+prereq_array["ubuntu2404"]="apt-get -y update && apt-get install -y git cmake wget vim openssl libssl-dev libelf-dev kmod pciutils gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git libopenmpi-dev gawk mesa-common-dev libtool python3 texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses-dev liblzma-dev python3-setuptools python3-dev python3-barectf python3-pip python3-pip-whl python3-requests python3-venv python3-yaml libudev-dev libgmp-dev debianutils devscripts cli-common-dev rsync libsystemd-dev libdw-dev libgtest-dev libstdc++-12-dev sudo python3-lxml ccache libgmp-dev libmpfr-dev make ocl-icd-opencl-dev libfmt-dev libmsgpack-dev libsqlite3-dev && $pip_install_2404"
prereq_array["centos7"]="yum install -y make gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel libpciaccess-devel elfutils-devel ccache libxml2-devel xz-lzma-compat devtoolset-9 devtoolset-9-libatomic-devel devtoolset-9-elfutils-libelf-devel scl-utils mpfr-devel gettext libcurl-devel ocl-icd-devel && yum remove -y python3*"
-prereq_array["centos8"]="yum install -y dnf-plugins-core && yum config-manager --set-enabled PowerTools && yum install -y gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel elfutils-devel ccache python38 python38-devel mpfr-devel ocl-icd-devel && yum remove -y python36* && $pip_install"
+prereq_array["centos8"]="yum install -y dnf-plugins-core && yum config-manager --set-enabled PowerTools && yum install -y gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel elfutils-devel ccache python38 python38-devel mpfr-devel ocl-icd-devel sqlite-devel && yum remove -y python36* && $pip_install"
+
+prereq_array["centos9"]="yum install -y dnf-plugins-core gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel ccache mpfr-devel ocl-icd-devel sqlite-devel && $pip_install"
-prereq_array["centos9"]="yum install -y dnf-plugins-core gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel ccache mpfr-devel ocl-icd-devel && $pip_install"
+prereq_array["rhel8"]="yum update -y && yum install -y dnf-plugins-core && yum install -y gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel elfutils-devel ccache python38 python38-devel mpfr-devel ocl-icd-devel libatomic libquadmath-devel msgpack-devel fmt-devel sqlite-devel && $pip_install_rhel8"
-prereq_array["rhel8"]="yum update -y && yum install -y dnf-plugins-core && yum install -y gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel elfutils-devel ccache python38 python38-devel mpfr-devel ocl-icd-devel libatomic libquadmath-devel msgpack-devel fmt-devel && $pip_install"
+prereq_array["rhel9"]="dnf -y update && dnf -y install dnf-plugins-core && dnf -y install gdb gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel elfutils-devel ccache python3-devel mpfr-devel ocl-icd-devel libatomic libquadmath-devel msgpack-devel fmt-devel sqlite-devel && $pip_install"
-prereq_array["rhel9"]="dnf -y update && dnf -y install dnf-plugins-core && dnf -y install gdb gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel elfutils-devel ccache python3-devel mpfr-devel ocl-icd-devel libatomic libquadmath-devel msgpack-devel fmt-devel && $pip_install"
+prereq_array["alma8"]="dnf -y update && dnf -y install gdb gcc-c++ git cmake wget vim openssl-devel elfutils-libelf-devel pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel gmp-devel rpm-build rsync systemd-devel gtest-devel elfutils-devel ccache python3-devel mpfr-devel ocl-icd-devel libatomic libquadmath-devel msgpack-devel fmt-devel sqlite-devel gcc-toolset-12-libatomic-devel gcc-toolset-12-libstdc++-devel gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-gfortran && dnf remove -y python3.11*"
-prereq_array["sles15"]="zypper install -y which cmake wget vim libopenssl-devel elfutils libelf-devel git pciutils-devel libffi-devel gcc gcc-c++ libnuma-devel openmpi4-devel Mesa-libGL-devel libquadmath0 libtool texinfo bison flex babeltrace-devel makeinfo libexpat-devel xz-devel gmp-devel rpm-build rsync libdrm-devel libX11-devel systemd-devel libdw-devel hwdata unzip ccache mpfr-devel ocl-icd-devel msgpack-devel fmt-devel gcc7-fortran ncurses-devel"
+prereq_array["sles15"]="zypper install -y which cmake wget vim libopenssl-devel elfutils libelf-devel git pciutils-devel libffi-devel gcc gcc-c++ libnuma-devel openmpi4-devel Mesa-libGL-devel libquadmath0 libtool texinfo bison flex babeltrace-devel makeinfo libexpat-devel xz-devel gmp-devel rpm-build rsync libdrm-devel libX11-devel systemd-devel libdw-devel hwdata unzip ccache mpfr-devel ocl-icd-devel msgpack-devel fmt-devel gcc13-fortran ncurses-devel sqlite-devel gcc13-c++ gcc13 libstdc++6-devel-gcc13 libc++-devel"
# Some prep
-default_os="ubuntu2404 ubuntu2204 rhel8 rhel9 sles15"
+default_os="ubuntu2404 ubuntu2204 rhel8 rhel9 sles15 alma8"
OS=${OS:-$default_os}
export DOCKER_HOME=/home/release; export DOCKER_AOMP=/usr/lib/aomp; export DOCKER_AOMP_REPOS=/home/release/git/aomp$AOMP_VERSION
exports="export HOME=/home/release; export AOMP=/usr/lib/aomp; export AOMP_REPOS=/home/release/git/aomp$AOMP_VERSION; export AOMP_EXTERNAL_MANIFEST=1; export AOMP_JOB_THREADS=128; export AOMP_SKIP_FLANG_NEW=0"
@@ -95,82 +102,100 @@ exports="export HOME=/home/release; export AOMP=/usr/lib/aomp; export AOMP_REPOS
function getcontainer(){
echo docker ps -aqf "name=$docker_name"
container=$(docker ps -aqf "name=$docker_name")
- echo $container
+ echo "$container"
}
function setup(){
- if [ "$system" == "centos7" ] || [ "$system" == "sles15" ]; then
- exports="$exports; export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH"
+ if [ "$system" == "centos7" ] || [ "$system" == "sles15" ] || [ "$system" == "rhel8" ]; then
+ exports="$exports; export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; PATH=/usr/local/bin:$PATH"
+ fi
+ if [ "$system" == "alma8" ]; then
+ exports="$exports; export LD_LIBRARY_PATH=/opt/Python-3.10.18/lib:/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:/opt/rh/gcc-toolset-14/root/usr/lib64:/opt/rh/gcc-toolset-14/root/usr/lib:/opt/rh/gcc-toolset-14/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-14/root/usr/lib/dyninst; export PATH=/opt/Python-3.10.18/bin:/opt/rh/gcc-toolset-12/root/usr/bin:/usr/share/Modules/bin:/opt/rh/gcc-toolset-14/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin; export LIBRARY_PATH=/opt/Python-3.10.18/lib"
fi
# Pull docker and start
- docker pull ${url_array[$system]}
- docker run -d -it --name="$docker_name" --network=host --privileged --group-add video --cap-add=SYS_PTRACE --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --ipc=host -v $DOCKERX_HOST:$DOCKERX ${url_array[$system]}
+ docker pull "${url_array[$system]}"
+ docker run -d -it --name="$docker_name" --network=host --privileged --group-add video --cap-add=SYS_PTRACE --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --ipc=host -v "$DOCKERX_HOST:$DOCKERX" "${url_array[$system]}"
getcontainer
- docker exec -i $docker_name /bin/bash -c "mkdir -p /home/release/git/aomp$AOMP_VERSION"
+ docker exec -i "$docker_name" /bin/bash -c "mkdir -p /home/release/git/aomp$AOMP_VERSION"
if [ "$system" == "centos7" ]; then
# Support for centos7 has reached EOL. Many of the repos no longer use the mirror list url and need switched to baseurl with vault url.
- docker exec -i $docker_name /bin/bash -c "sed -i 's/mirrorlist=/#mirrorlist=/g' /etc/yum.repos.d/CentOS-*.repo; sed -i 's/#\s*baseurl=/baseurl=/g' /etc/yum.repos.d/CentOS-*.repo; sed -i 's/mirror\./vault\./g' /etc/yum.repos.d/CentOS-*.repo"
- docker exec -i $docker_name /bin/bash -c "yum install -y epel-release centos-release-scl"
- docker exec -i $docker_name /bin/bash -c "sed -i 's/mirrorlist=/#mirrorlist=/g' /etc/yum.repos.d/CentOS-*.repo; sed -i 's/#\s*baseurl=/baseurl=/g' /etc/yum.repos.d/CentOS-*.repo; sed -i 's/mirror\./vault\./g' /etc/yum.repos.d/CentOS-*.repo"
+ docker exec -i "$docker_name" /bin/bash -c "sed -i 's/mirrorlist=/#mirrorlist=/g' /etc/yum.repos.d/CentOS-*.repo; sed -i 's/#\s*baseurl=/baseurl=/g' /etc/yum.repos.d/CentOS-*.repo; sed -i 's/mirror\./vault\./g' /etc/yum.repos.d/CentOS-*.repo"
+ docker exec -i "$docker_name" /bin/bash -c "yum install -y epel-release centos-release-scl"
+ docker exec -i "$docker_name" /bin/bash -c "sed -i 's/mirrorlist=/#mirrorlist=/g' /etc/yum.repos.d/CentOS-*.repo; sed -i 's/#\s*baseurl=/baseurl=/g' /etc/yum.repos.d/CentOS-*.repo; sed -i 's/mirror\./vault\./g' /etc/yum.repos.d/CentOS-*.repo"
fi
# Change repos for Centos 8 to enable yum functionality again as it has been vaulted.
if [ "$system" == "centos8" ]; then
- docker exec -i $docker_name /bin/bash -c "cd /etc/yum.repos.d/; sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*; sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*"
+ docker exec -i "$docker_name" /bin/bash -c "cd /etc/yum.repos.d/; sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*; sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*"
elif [ "$system" == "sles15" ]; then
# Create symbolic link for libquadmath and rename /usr/src/packages as that prevents rpmbuild from getting the correct source directory.
- docker exec -i $docker_name /bin/bash -c "ln -s /usr/lib64/libquadmath.so.0 /usr/lib64/libquadmath.so"
- docker exec -i $docker_name /bin/bash -c "mv /usr/src/packages /usr/src/packages-temp"
+ docker exec -i "$docker_name" /bin/bash -c "ln -s /usr/lib64/libquadmath.so.0 /usr/lib64/libquadmath.so"
+ docker exec -i "$docker_name" /bin/bash -c "mv /usr/src/packages /usr/src/packages-temp"
elif [ "$system" == "rhel8" ]; then
- docker exec -i $docker_name /bin/bash -c "sed -i 's%^enabled = .*%enabled = 0%' /etc/yum.repos.d/ubi.repo"
- docker cp $DOCKERX_HOST/rhel8.repo $container:/etc/yum.repos.d/redhat-partner.repo
- docker exec -i $docker_name /bin/bash -c "yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && rpm -ql epel-release"
+ docker exec -i "$docker_name" /bin/bash -c "sed -i 's%^enabled = .*%enabled = 0%' /etc/yum.repos.d/ubi.repo"
+ docker cp "$DOCKERX_HOST/rhel8.repo" "$container:/etc/yum.repos.d/redhat-partner.repo"
+ docker exec -i "$docker_name" /bin/bash -c "yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && rpm -ql epel-release"
elif [ "$system" == "rhel9" ]; then
- docker exec -i $docker_name /bin/bash -c "sed -i 's%^enabled = .*%enabled = 0%' /etc/yum.repos.d/ubi.repo"
- docker cp $DOCKERX_HOST/rhel9.repo $container:/etc/yum.repos.d/redhat-partner.repo
- docker exec -i $docker_name /bin/bash -c "dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm && rpm -ql epel-release"
- docker exec -i $docker_name /bin/bash -c "echo 'timeout=300' >> /etc/yum.conf"
+ docker exec -i "$docker_name" /bin/bash -c "sed -i 's%^enabled = .*%enabled = 0%' /etc/yum.repos.d/ubi.repo"
+ docker cp "$DOCKERX_HOST/rhel9.repo" "$container:/etc/yum.repos.d/redhat-partner.repo"
+ docker exec -i "$docker_name" /bin/bash -c "dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm && rpm -ql epel-release"
+ docker exec -i "$docker_name" /bin/bash -c "echo 'timeout=300' >> /etc/yum.conf"
fi
# Setup directory structure
- docker exec -i $docker_name /bin/bash -c "$exports; mkdir -p $DOCKER_AOMP_REPOS; mkdir -p $DOCKER_HOME/logs"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; mkdir -p $DOCKER_AOMP_REPOS; mkdir -p $DOCKER_HOME/logs"
# Hardcode timezone for tzdata install to avoid an interactive prompt
- docker exec -i $docker_name /bin/bash -c "$exports; ln -fs /usr/share/zoneinfo/America/Chicago /etc/localtime"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; ln -fs /usr/share/zoneinfo/America/Chicago /etc/localtime"
# Install prerequisite system packages
if [ "$system" == "sles15" ]; then
set +e
- docker exec -i $docker_name /bin/bash -c "zypper refresh"
- docker exec -i $docker_name /bin/bash -c "zypper addrepo https://download.opensuse.org/repositories/science/SLE_15_SP5/science.repo"
- docker exec -i $docker_name /bin/bash -c "zypper addrepo https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/openSUSE:Backports:SLE-15-SP4.repo"
- docker exec -i $docker_name /bin/bash -c "zypper addrepo https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP3/standard/openSUSE:Backports:SLE-15-SP3.repo && zypper --gpg-auto-import-keys refresh"
- docker exec -i $docker_name /bin/bash -c "$exports; ${prereq_array[$system]} 2>&1 | tee $DOCKER_HOME/logs/$system-preq.out"
+ docker exec -i "$docker_name" /bin/bash -c "zypper refresh"
+ docker exec -i "$docker_name" /bin/bash -c "zypper addrepo https://download.opensuse.org/repositories/science/SLE_15_SP5/science.repo"
+ docker exec -i "$docker_name" /bin/bash -c "zypper addrepo https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP4/standard/openSUSE:Backports:SLE-15-SP4.repo"
+ docker exec -i "$docker_name" /bin/bash -c "zypper addrepo https://download.opensuse.org/repositories/openSUSE:/Backports:/SLE-15-SP3/standard/openSUSE:Backports:SLE-15-SP3.repo && zypper --gpg-auto-import-keys refresh"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; ${prereq_array[$system]} 2>&1 | tee $DOCKER_HOME/logs/$system-preq.out"
set -e
#docker exec -i $docker_name /bin/bash -c "zypper install -y --force libncurses6=6.1-150000.5.15.1; zypper install -y ncurses-devel"
- docker exec -i $docker_name /bin/bash -c "mkdir /tmp/googletest; cd /tmp/googletest; git clone -b v1.14.0 https://github.com/google/googletest; cd googletest; mkdir build; cd build; cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON ..; make -j16; make -j16 install"
+ docker exec -i "$docker_name" /bin/bash -c "mkdir /tmp/googletest; cd /tmp/googletest; git clone -b v1.14.0 https://github.com/google/googletest; cd googletest; mkdir build; cd build; cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON ..; make -j16; make -j16 install"
else
- docker exec -i $docker_name /bin/bash -c "$exports; DEBIAN_FRONTEND=noninteractive ${prereq_array[$system]} 2>&1 | tee -a $DOCKER_HOME/logs/$system-preq.out"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; DEBIAN_FRONTEND=noninteractive ${prereq_array[$system]} 2>&1 | tee -a $DOCKER_HOME/logs/$system-preq.out"
fi
if [ "$system" == "centos7" ]; then
exports="$exports; source /opt/rh/devtoolset-9/enable"
- docker exec -i $docker_name /bin/bash -c "$exports; cd /home/release; wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz; tar xf Python-3.8.13.tgz; cd Python-3.8.13; ./configure --enable-optimizations --enable-shared; make altinstall; ln -s /usr/local/bin/python3.8 /usr/bin/python3; $pip_install_centos7"
- docker exec -i $docker_name /bin/bash -c "$exports; cd /home/release; wget https://github.com/git/git/archive/refs/tags/v2.19.0.tar.gz; tar xzf v2.19.0.tar.gz; cd git-2.19.0; make -j16 prefix=/usr/local install"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd /home/release; wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz; tar xf Python-3.8.13.tgz; cd Python-3.8.13; ./configure --enable-optimizations --enable-shared; make altinstall; ln -s /usr/local/bin/python3.8 /usr/bin/python3; $pip_install_centos7"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd /home/release; wget https://github.com/git/git/archive/refs/tags/v2.19.0.tar.gz; tar xzf v2.19.0.tar.gz; cd git-2.19.0; make -j16 prefix=/usr/local install"
+ fi
+ if [ "$system" == "alma8" ]; then
+ exports="$exports; source /opt/rh/gcc-toolset-12/enable"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd /home/release; wget https://www.python.org/ftp/python/3.10.18/Python-3.10.18.tgz; tar xf Python-3.10.18.tgz; cd Python-3.10.18; ./configure --enable-optimizations --enable-shared --prefix=/opt/Python-3.10.18; make altinstall; ln -s /opt/Python-3.10.18/bin/python3.10 /opt/Python-3.10.18/bin/python3; $pip_install_alma"
+ # Install libffi from source so that we can use libffi.a to help with portability.
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd /tmp && wget ftp://sourceware.org/pub/libffi/libffi-3.1.tar.gz && tar -xvf libffi-3.1.tar.gz && cd libffi-3.1 && CFLAGS="-fPIC" ./configure --prefix=/usr/local && make && make install && cd .. && rm -rf libffi-3.1 libffi-3.1.tar.gz"
fi
if [ "$system" == "sles15" ]; then
- docker exec -i $docker_name /bin/bash -c "$exports; cd /home/release; wget https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tgz; tar xf Python-3.8.13.tgz; cd Python-3.8.13; ./configure --enable-optimizations --enable-shared; make altinstall; rm /usr/bin/python3; ln -s /usr/local/bin/python3.8 /usr/bin/python3; $pip_install_sles15"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd /home/release; wget https://www.python.org/ftp/python/3.10.12/Python-3.10.12.tgz; tar xf Python-3.10.12.tgz; cd Python-3.10.12; ./configure --enable-optimizations --enable-shared; make altinstall; rm /usr/bin/python3; ln -s /usr/local/bin/python3.10 /usr/bin/python3; $pip_install_sles15"
+ docker exec -i "$docker_name" /bin/bash -c "update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10"
+ docker exec -i "$docker_name" /bin/bash -c "update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10"
+ docker exec -i "$docker_name" /bin/bash -c "update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 10"
+ docker exec -i "$docker_name" /bin/bash -c "update-alternatives --set cc /usr/bin/gcc"
+ docker exec -i "$docker_name" /bin/bash -c "update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 10"
+ docker exec -i "$docker_name" /bin/bash -c "update-alternatives --set c++ /usr/bin/g++"
+ fi
+ if [ "$system" == "rhel8" ]; then
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd /home/release; wget https://www.python.org/ftp/python/3.10.12/Python-3.10.12.tgz; tar xf Python-3.10.12.tgz; cd Python-3.10.12; ./configure --enable-optimizations --enable-shared; make altinstall; rm /usr/bin/python3; ln -s /usr/local/bin/python3.10 /usr/bin/python3; $pip_install_sles15"
fi
# Run build_prerequisites.sh to build cmake, hwloc, rocmsmi, etc
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS; git clone -b aomp-$AOMP_VERSION_STRING https://github.com/ROCm-Developer-Tools/aomp; cd aomp/bin; ./build_prereq.sh 2>&1 | tee $DOCKER_HOME/logs/$system-prereq.out"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS; git clone -b aomp-$AOMP_VERSION_STRING https://github.com/ROCm/aomp; cd aomp/bin; ./build_prereq.sh 2>&1 | tee $DOCKER_HOME/logs/$system-prereq.out"
# Clone repos
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; SINGLE_BRANCH=1 ./clone_aomp.sh 2>&1 | tee $DOCKER_HOME/logs/$system-clone.out"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; SINGLE_BRANCH=1 ./clone_aomp.sh 2>&1 | tee $DOCKER_HOME/logs/$system-clone.out"
if [ "$AOMP_HIP_LIBRARIES" == "1" ]; then
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin/rocmlibs; SINGLE_BRANCH=1 ./clone_rocmlibs.sh 2>&1 | tee $DOCKER_HOME/logs/$system-clone-rocmlibs.out"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin/rocmlibs; SINGLE_BRANCH=1 ./clone_rocmlibs.sh 2>&1 | tee $DOCKER_HOME/logs/$system-clone-rocmlibs.out"
fi
}
@@ -178,44 +203,55 @@ function build(){
if [ "$system" == "ubuntu2404" ]; then
exports="$exports; PATH=/opt/venv/bin:$PATH; python3 -m venv /opt/venv"
fi
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_aomp.sh 2>&1 | tee $DOCKER_HOME/logs/$system-build.out"
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; AOMP=/usr/lib/aomp/llvm ./build_llvm-flang-rt-host-dev.sh 2>&1 | tee -a $DOCKER_HOME/logs/$system-build.out"
+ if [ "$system" == "centos7" ] || [ "$system" == "sles15" ]; then
+ exports="$exports; export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; PATH=/usr/local/bin:$PATH"
+ fi
+ if [ "$system" == "alma8" ]; then
+ exports="$exports; source /opt/rh/gcc-toolset-12/enable; export LD_LIBRARY_PATH=/opt/Python-3.10.18/lib:/opt/rh/gcc-toolset-12/root/usr/lib64:/opt/rh/gcc-toolset-12/root/usr/lib:/opt/rh/gcc-toolset-14/root/usr/lib64:/opt/rh/gcc-toolset-14/root/usr/lib:/opt/rh/gcc-toolset-14/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-14/root/usr/lib/dyninst; export PATH=/opt/Python-3.10.18/bin:/opt/rh/gcc-toolset-12/root/usr/bin:/usr/share/Modules/bin:/opt/rh/gcc-toolset-14/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin; export LIBRARY_PATH=/opt/Python-3.10.18/lib"
+ fi
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_aomp.sh 2>&1 | tee $DOCKER_HOME/logs/$system-build.out"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; AOMP=/usr/lib/aomp/llvm ./build_llvm-flang-rt-host-dev.sh 2>&1 | tee -a $DOCKER_HOME/logs/$system-build.out"
if [ "$AOMP_HIP_LIBRARIES" == "1" ]; then
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin/rocmlibs; ./build_rocmlibs.sh 2>&1 | tee $DOCKER_HOME/logs/$system-build-rocmlibs.out"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin/rocmlibs; ./build_rocmlibs.sh 2>&1 | tee $DOCKER_HOME/logs/$system-build-rocmlibs.out"
fi
}
function package(){
getcontainer
- docker exec -i $docker_name /bin/bash -c "grep 'END build_aomp' $DOCKER_HOME/logs/$system-build.out"
- if [ "$?" -eq 0 ]; then
+ if docker exec -i "$docker_name" /bin/bash -c "grep 'END build_aomp' $DOCKER_HOME/logs/$system-build.out"; then
if [[ "$system" =~ "ubuntu" ]]; then
# Update changelog with user patch
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; patch debian/changelog /dockerx/changelog.patch"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; patch debian/changelog /dockerx/changelog.patch"
# Build aomp debian
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-deb-aomp.sh 2>&1 | tee $DOCKER_HOME/logs/$system-package.out; git checkout debian/changelog"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-deb-aomp.sh 2>&1 | tee $DOCKER_HOME/logs/$system-package.out; git checkout debian/changelog"
if [ "$AOMP_HIP_LIBRARIES" == "1" ]; then
# Build aomp-hip-libraries debian
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-deb-aomp.sh aomp-hip-libraries 2>&1 | tee $DOCKER_HOME/logs/$system-package-hip-libraries.out"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-deb-aomp.sh aomp-hip-libraries 2>&1 | tee $DOCKER_HOME/logs/$system-package-hip-libraries.out"
fi
# Copy to host
- docker cp $container:/tmp/build-deb/debs/. $host_packages
+ docker cp "$container:/tmp/build-deb/debs/." "$host_packages"
else
# Update changelog with user patch and change aomp version header
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; patch debian/changelog /dockerx/changelog.patch; sed -i -e 's/aomp (.*)/aomp ($AOMP_VERSION_STRING)/g' debian/changelog"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; patch debian/changelog /dockerx/changelog.patch; sed -i -e 's/aomp (.*)/aomp ($AOMP_VERSION_STRING)/g' debian/changelog"
# Build aomp rpm
if [ "$system" == "centos7" ]; then
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-rpm.sh aomp_CENTOS_7 2>&1 | tee $DOCKER_HOME/logs/$system-package.out"
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-rpm.sh aomp_CENTOS_7 2>&1 | tee $DOCKER_HOME/logs/$system-package.out"
else
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-rpm.sh 2>&1 | tee $DOCKER_HOME/logs/$system-package.out"
- # Copy to host
- docker cp $container:/tmp/home/rpmbuild/RPMS/x86_64/. $host_packages
- # Build aomp-hip-libraries rpm
- if [ "$AOMP_HIP_LIBRARIES" == "1" ]; then
- docker exec -i $docker_name /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-rpm.sh aomp-hip-libraries 2>&1 | tee $DOCKER_HOME/logs/$system-package-hip-libraries.out"
+ if [ "$OS" == "alma8" ]; then
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; ./package_release_tarball.sh 2>&1 | tee $DOCKER_HOME/logs/$system-package.out"
+ # Copy to host
+ docker cp "$container:$DOCKER_AOMP_REPOS/../aomp-$AOMP_VERSION_STRING.tar.gz" "$host_packages"
+ else
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-rpm.sh 2>&1 | tee $DOCKER_HOME/logs/$system-package.out"
# Copy to host
- docker cp $container:/tmp/home/rpmbuild/RPMS/x86_64/. $host_packages
+ docker cp "$container:/tmp/home/rpmbuild/RPMS/x86_64/." "$host_packages"
+ # Build aomp-hip-libraries rpm
+ if [ "$AOMP_HIP_LIBRARIES" == "1" ]; then
+ docker exec -i "$docker_name" /bin/bash -c "$exports; cd $DOCKER_AOMP_REPOS/aomp/bin; ./build_fixups.sh; DOCKER=1 ./build-rpm.sh aomp-hip-libraries 2>&1 | tee $DOCKER_HOME/logs/$system-package-hip-libraries.out"
+ # Copy to host
+ docker cp "$container:/tmp/home/rpmbuild/RPMS/x86_64/." "$host_packages"
+ fi
fi
fi
fi
@@ -256,7 +292,7 @@ do
echo "---------------------------------------------------------------"
exit ;;
*)
- echo $1 option not recognized ; exit 1 ;;
+ echo "$1 option not recognized"; exit 1 ;;
esac
shift 1
done
@@ -265,7 +301,7 @@ done
for system in $OS; do
# Verify operating system is supported
if [ "${prereq_array[$system]}" == "" ]; then
- echo $system is not a supported os. Choose from: $default_os.
+ echo "$system is not a supported os. Choose from: $default_os."
exit 1
fi
echo "Building AOMP in $system docker."
@@ -273,7 +309,7 @@ for system in $OS; do
docker_name="$system-$AOMP_VERSION_STRING"
# Setup/Build/Package
for step in $target; do
- echo Executing Step: $step
+ echo "Executing Step: $step"
$step
done
done
diff --git a/bin/build_bolt.sh b/bin/build_bolt.sh
index 148a43134d..cd95b11f35 100755
--- a/bin/build_bolt.sh
+++ b/bin/build_bolt.sh
@@ -28,9 +28,9 @@
# SOFTWARE.
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
REPO_DIR=$AOMP_REPOS/bolt
@@ -47,7 +47,7 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $REPO_DIR ] ; then
+if [ ! -d "$REPO_DIR" ] ; then
echo "ERROR: Missing repository $REPO_DIR/"
echo " Try these commands till bolt is part of the AOMP manifest:"
echo
@@ -57,7 +57,7 @@ if [ ! -d $REPO_DIR ] ; then
exit 1
fi
-if [ ! -f $AOMP/bin/clang ] ; then
+if [ ! -f "$AOMP/bin/clang" ] ; then
echo "ERROR: Missing file $AOMP/bin/clang"
echo " Build the AOMP llvm compiler in $AOMP first"
echo " This is needed to build the bolt libraries"
@@ -65,49 +65,41 @@ if [ ! -f $AOMP/bin/clang ] ; then
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $BOLT_INSTALL_DIR
- $SUDO touch $BOLT_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $BOLT_INSTALL_DIR"
- exit 1
- fi
- $SUDO rm $BOLT_INSTALL_DIR/testfile
-fi
+check_writable_installdir "$1" "$BOLT_INSTALL_DIR"
-patchrepo $AOMP_REPOS/bolt
+patchrepo "$AOMP_REPOS/bolt"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/bolt" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/bolt
- rm -rf $BUILD_DIR/build/bolt
+ echo "rm -rf $BUILD_DIR/build/bolt"
+ rm -rf "$BUILD_DIR/build/bolt"
fi
-MYCMAKEOPTS=" \
--DCMAKE_INSTALL_PREFIX=$BOLT_INSTALL_DIR \
-$AOMP_ORIGIN_RPATH \
--DCMAKE_C_COMPILER=$AOMP_CC_COMPILER \
--DCMAKE_CXX_COMPILER=$AOMP_CXX_COMPILER \
--DOPENMP_TEST_C_COMPILER=$AOMP_CC_COMPILER \
--DOPENMP_TEST_CXX_COMPILER=$AOMP_CXX_COMPILER \
--DCMAKE_BUILD_TYPE=Release \
--DOPENMP_ENABLE_LIBOMPTARGET=OFF \
--DLIBOMP_HEADERS_INSTALL_PATH=include/bolt \
--DLIBOMP_INSTALL_ALIASES=OFF \
--DLIBOMP_USE_ARGOBOTS=on"
-
- mkdir -p $BUILD_DIR/build/bolt
- cd $BUILD_DIR/build/bolt
+declare -a MYCMAKEOPTS
+
+MYCMAKEOPTS=(-DCMAKE_INSTALL_PREFIX="$BOLT_INSTALL_DIR"
+ "${AOMP_ORIGIN_RPATH[@]}"
+ -DCMAKE_C_COMPILER="$AOMP_CC_COMPILER"
+ -DCMAKE_CXX_COMPILER="$AOMP_CXX_COMPILER"
+ -DOPENMP_TEST_C_COMPILER="$AOMP_CC_COMPILER"
+ -DOPENMP_TEST_CXX_COMPILER="$AOMP_CXX_COMPILER"
+ -DCMAKE_BUILD_TYPE=Release
+ -DOPENMP_ENABLE_LIBOMPTARGET=OFF
+ -DLIBOMP_HEADERS_INSTALL_PATH=include/bolt
+ -DLIBOMP_INSTALL_ALIASES=OFF
+ -DLIBOMP_USE_ARGOBOTS=on)
+
+ mkdir -p "$BUILD_DIR/build/bolt"
+ cd "$BUILD_DIR/build/bolt" || exit
echo
echo " -----Running bolt cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $REPO_DIR
- ${AOMP_CMAKE} $MYCMAKEOPTS $REPO_DIR
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE} $(shquot "${MYCMAKEOPTS[@]}") $REPO_DIR"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$REPO_DIR"; then
echo "ERROR bolt cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -116,11 +108,11 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_DIR/build/bolt
+cd "$BUILD_DIR/build/bolt" || exit
echo
echo " -----Running make for bolt ---- "
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -138,13 +130,13 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_DIR/build/bolt
+ cd "$BUILD_DIR/build/bolt" || exit
echo
echo " -----Installing to $BOLT_INSTALL_DIR ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
- removepatch $AOMP_REPOS/bolt
+ removepatch "$AOMP_REPOS/bolt"
fi
diff --git a/bin/build_comgr.sh b/bin/build_comgr.sh
index 385f8ba524..109bebf244 100755
--- a/bin/build_comgr.sh
+++ b/bin/build_comgr.sh
@@ -4,9 +4,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_COMGR=${INSTALL_COMGR:-$AOMP_INSTALL_DIR}
@@ -30,31 +30,23 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME"
echo " Are environment variables AOMP_REPOS and AOMP_COMGR_REPO_NAME set correctly?"
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_COMGR
- $SUDO touch $INSTALL_COMGR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_COMGR"
- exit 1
- fi
- $SUDO rm $INSTALL_COMGR/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_COMGR"
osversion=$(cat /etc/os-release)
#if [ "$AOMP_MAJOR_VERSION" != "12" ] && [[ "$osversion" =~ "Ubuntu 16" ]]; then
- patchrepo $REPO_DIR
+ patchrepo "$REPO_DIR"
#fi
-if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- LDFLAGS="-fuse-ld=lld $ASAN_FLAGS"
-fi
+#if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ #LDFLAGS=$(shquot '-fuse-ld=lld' "${ASAN_FLAGS[@]}")
+ #export LDFLAGS
+#fi
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
@@ -63,40 +55,58 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
BUILDTYPE="Release"
- echo $SUDO rm -rf $BUILD_AOMP/build/comgr
- $SUDO rm -rf $BUILD_AOMP/build/comgr
+ echo $SUDO rm -rf "$BUILD_AOMP/build/comgr"
+ $SUDO rm -rf "$BUILD_AOMP/build/comgr"
export LLVM_DIR=$AOMP_INSTALL_DIR
export Clang_DIR=$AOMP_INSTALL_DIR
- mkdir -p $BUILD_AOMP/build/comgr
- cd $BUILD_AOMP/build/comgr
+ mkdir -p "$BUILD_AOMP/build/comgr"
+ cd "$BUILD_AOMP/build/comgr" || exit
echo " -----Running comgr cmake ---- "
DEVICELIBS_BUILD_PATH=$AOMP_REPOS/build/AOMP_LIBDEVICE_REPO_NAME
PACKAGE_ROOT=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME
COMMON_PREFIX_PATH="$AOMP/include/amd_comgr;$DEVICELIBS_BUILD_PATH;$PACKAGE_ROOT;$LLVM_INSTALL_LOC"
- MYCMAKEOPTS="
- -DCMAKE_INSTALL_PREFIX='$INSTALL_COMGR'
- -DCMAKE_BUILD_TYPE=$BUILDTYPE
+ MYCMAKEOPTS=(
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_COMGR"
+ -DCMAKE_BUILD_TYPE="$BUILDTYPE"
-DBUILD_TESTING=OFF
- -DROCM_DIR=$AOMP_INSTALL_DIR
- -DLLVM_DIR=$AOMP_INSTALL_DIR
- -DClang_DIR=$AOMP_INSTALL_DIR"
- echo ${AOMP_CMAKE} ${MYCMAKEOPTS} -DCMAKE_PREFIX_PATH="$AOMP/lib/cmake;$COMMON_PREFIX_PATH" -DCMAKE_INSTALL_LIBDIR=lib $AOMP_ORIGIN_RPATH $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME
- ${AOMP_CMAKE} ${MYCMAKEOPTS} -DCMAKE_PREFIX_PATH="$AOMP/lib/cmake;$COMMON_PREFIX_PATH" -DCMAKE_INSTALL_LIBDIR=lib $AOMP_ORIGIN_RPATH $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME
- if [ $? != 0 ] ; then
+ -DROCM_DIR="$AOMP_INSTALL_DIR"
+ -DLLVM_DIR="$AOMP_INSTALL_DIR"
+ -DClang_DIR="$AOMP_INSTALL_DIR")
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ -DCMAKE_PREFIX_PATH="$AOMP/lib/cmake;$COMMON_PREFIX_PATH" \
+ -DCMAKE_INSTALL_LIBDIR=lib "${AOMP_ORIGIN_RPATH[@]}" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ -DCMAKE_PREFIX_PATH="$AOMP/lib/cmake;$COMMON_PREFIX_PATH" \
+ -DCMAKE_INSTALL_LIBDIR=lib "${AOMP_ORIGIN_RPATH[@]}" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME"; then
echo "ERROR comgr cmake failed. cmake flags"
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- mkdir -p $BUILD_AOMP/build/comgr/asan
- cd $BUILD_AOMP/build/comgr/asan
+ mkdir -p "$BUILD_AOMP/build/comgr/asan"
+ cd "$BUILD_AOMP/build/comgr/asan" || exit
echo " -----Running comgr-asan cmake ----- "
- ASAN_CMAKE_OPTS="$MYCMAKEOPTS -DCMAKE_C_COMPILER=$LLVM_INSTALL_LOC/bin/clang -DCMAKE_CXX_COMPILER=$LLVM_INSTALL_LOC/bin/clang++"
- echo ${AOMP_CMAKE} ${ASAN_CMAKE_OPTS} -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake;$COMMON_PREFIX_PATH:$AOMP/lib/cmake" -DCMAKE_INSTALL_LIBDIR=lib/asan $AOMP_ASAN_ORIGIN_RPATH -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" $AOMP_ASAN_ORIGIN_RPATH $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME
- ${AOMP_CMAKE} ${ASAN_CMAKE_OPTS} -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake;$COMMON_PREFIX_PATH;$AOMP/lib/cmake" -DCMAKE_INSTALL_LIBDIR=lib/asan $AOMP_ASAN_ORIGIN_RPATH -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME
- if [ $? != 0 ] ; then
+ ASAN_CMAKE_OPTS=("${MYCMAKEOPTS[@]}"
+ -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++")
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake;$COMMON_PREFIX_PATH:$AOMP/lib/cmake" \
+ -DCMAKE_INSTALL_LIBDIR=lib/asan "$(shquot "${AOMP_ASAN_ORIGIN_RPATH[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake;$COMMON_PREFIX_PATH;$AOMP/lib/cmake" \
+ -DCMAKE_INSTALL_LIBDIR=lib/asan "${AOMP_ASAN_ORIGIN_RPATH[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_COMGR_REPO_NAME"; then
echo "ERROR comgr-asan cmake failed. cmake flags"
exit 1
fi
@@ -107,11 +117,11 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_AOMP/build/comgr
+cd "$BUILD_AOMP/build/comgr" || exit
echo
echo " -----Running make for comgr ---- "
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -121,10 +131,10 @@ if [ $? != 0 ] ; then
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_AOMP/build/comgr/asan
+ cd "$BUILD_AOMP/build/comgr/asan" || exit
echo " -----Running make for comgr-asan ---- "
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -135,27 +145,27 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
fi
# ----------- Install only if asked ----------------------------
-if [ "$1" == "install" ] ; then
- cd $BUILD_AOMP/build/comgr
+if [ "$1" == "install" ] ; then
+ cd "$BUILD_AOMP/build/comgr" || exit
echo " -----Installing to $INSTALL_COMGR/lib ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_AOMP/build/comgr/asan
+ cd "$BUILD_AOMP/build/comgr/asan" || exit
echo " -----Installing to $INSTALL_COMGR/lib/asan ----"
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed"
exit 1
fi
fi
# amd_comgr.h is now in amd_comgr/amd_comgr.h, so remove depracated file
- [ -f $INSTALL_COMGR/include/amd_comgr.h ] && rm $INSTALL_COMGR/include/amd_comgr.h
+ [ -f "$INSTALL_COMGR/include/amd_comgr.h" ] && rm "$INSTALL_COMGR/include/amd_comgr.h"
if [ "$AOMP_MAJOR_VERSION" != "12" ] && [[ "$osversion" =~ "Ubuntu 16" ]]; then
- removepatch $REPO_DIR
+ removepatch "$REPO_DIR"
fi
fi
diff --git a/bin/build_extras.sh b/bin/build_extras.sh
index 745428cb3e..b58f93ebae 100755
--- a/bin/build_extras.sh
+++ b/bin/build_extras.sh
@@ -30,9 +30,9 @@
# SOFTWARE.
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
AOMP_REPO_DIR=$AOMP_REPOS/$AOMP_REPO_NAME
@@ -42,7 +42,7 @@ BUILD_DIR=${BUILD_AOMP}
INSTALL_EXTRAS=${INSTALL_EXTRAS:-$LLVM_INSTALL_LOC}
export LLVM_DIR=$LLVM_INSTALL_LOC
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
install_list="gpurun rebundle_hip_lib.sh raja_build.sh kokkos_build.sh aompversion blt.patch raja.patch modulefile"
else
install_list="gpurun"
@@ -58,52 +58,45 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
fi
# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_EXTRAS
- $SUDO touch $INSTALL_EXTRAS/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_EXTRAS"
- exit 1
-fi
- $SUDO rm $INSTALL_EXTRAS/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_EXTRAS"
if [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/extras" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/extras
- rm -rf $BUILD_DIR/build/extras
+ echo "rm -rf $BUILD_DIR/build/extras"
+ rm -rf "$BUILD_DIR/build/extras"
fi
- if [ $AOMP_STANDALONE_BUILD == 0 ] ; then
+ if [ "$AOMP_STANDALONE_BUILD" == 0 ] ; then
export AOMP_VERSION_STRING=$ROCM_VERSION
fi
- mkdir -p $BUILD_DIR/build/extras
- cd $BUILD_DIR/build/extras
+ mkdir -p "$BUILD_DIR/build/extras"
+ cd "$BUILD_DIR/build/extras" || exit
- if [ $AOMP_STANDALONE_BUILD == 0 ] ; then
- SED_INSTALL_DIR=`echo /opt/rocm/llvm | sed -e 's/\//\\\\\//g' `
+ if [ "$AOMP_STANDALONE_BUILD" == 0 ] ; then
+ SED_INSTALL_DIR=$(echo /opt/rocm/llvm | sed -e 's,/,\\/,g')
else
- SED_INSTALL_DIR=`echo $INSTALL_EXTRAS | sed -e 's/\//\\\\\//g' `
+ SED_INSTALL_DIR="${INSTALL_EXTRAS//\//\\/}"
fi
export SED_INSTALL_DIR
echo "----- Copy util scripts to $BUILD_DIR/build/extras -----"
- cp $AOMP_REPO_DIR/utils/* $BUILD_DIR/build/extras
+ cp "$AOMP_REPO_DIR"/utils/* "$BUILD_DIR"/build/extras
+ cp "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME"/offload/utils/gpurun "$BUILD_DIR"/build/extras
for util in $install_list; do
if [ "$util" == "rebundle_hip_lib.sh" ]; then
- /bin/sed -i -e "s/X\\.Y\\-Z/${AOMP_VERSION_STRING}/g" -e "s/_LLVM_INSTALL_DIR_/${SED_INSTALL_DIR}/g" $util
+ /bin/sed -i -e "s/X\\.Y\\-Z/${AOMP_VERSION_STRING}/g" -e "s/_LLVM_INSTALL_DIR_/${SED_INSTALL_DIR}/g" "$util"
else
- /bin/sed -i -e "s/X\\.Y\\-Z/${AOMP_VERSION_STRING}/g" -e "s/_AOMP_INSTALL_DIR_/${SED_INSTALL_DIR}/g" $util
+ /bin/sed -i -e "s/X\\.Y\\-Z/${AOMP_VERSION_STRING}/g" -e "s/_AOMP_INSTALL_DIR_/${SED_INSTALL_DIR}/g" "$util"
fi
done
fi
-cd $BUILD_DIR/build/extras
+cd "$BUILD_DIR/build/extras" || exit
echo
if [ "$1" != "install" ] ; then
echo
@@ -114,7 +107,7 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_DIR/build/extras
+ cd "$BUILD_DIR/build/extras" || exit
echo " -----Installing to $INSTALL_EXTRAS/bin ----- "
for util in $install_list; do
echo "-- Installing: $INSTALL_EXTRAS/bin/$util"
diff --git a/bin/build_fixups.sh b/bin/build_fixups.sh
index 54a547491c..1b464462b2 100755
--- a/bin/build_fixups.sh
+++ b/bin/build_fixups.sh
@@ -5,54 +5,54 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
# Copy examples
-if [ -d $AOMP/examples ] ; then
- $SUDO rm -rf $AOMP/examples
+if [ -d "$AOMP/examples" ]; then
+ $SUDO rm -rf "$AOMP/examples"
fi
-echo $SUDO cp -rp $AOMP_REPOS/$AOMP_REPO_NAME/examples $AOMP
-$SUDO cp -rp $AOMP_REPOS/$AOMP_REPO_NAME/examples $AOMP
+echo $SUDO cp -rp "$AOMP_REPOS/$AOMP_REPO_NAME/examples" "$AOMP"
+$SUDO cp -rp "$AOMP_REPOS/$AOMP_REPO_NAME/examples" "$AOMP"
if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
# Licenses
- echo mkdir -p $AOMP/share/doc/aomp
- mkdir -p $AOMP/share/doc/aomp
- echo $SUDO cp $AOMP_REPOS/$AOMP_REPO_NAME/LICENSE $AOMP/share/doc/aomp/LICENSE.apache2
- $SUDO cp $AOMP_REPOS/$AOMP_REPO_NAME/LICENSE $AOMP/share/doc/aomp/LICENSE.apache2
- echo $SUDO cp $AOMP_REPOS/$AOMP_EXTRAS_REPO_NAME/LICENSE $AOMP/share/doc/aomp/LICENSE.mit
- $SUDO cp $AOMP_REPOS/$AOMP_EXTRAS_REPO_NAME/LICENSE $AOMP/share/doc/aomp/LICENSE.mit
- echo $SUDO cp $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/LICENSE.txt $AOMP/share/doc/aomp/LICENSE.flang
- $SUDO cp $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/LICENSE.txt $AOMP/share/doc/aomp/LICENSE.flang
+ echo mkdir -p "$AOMP/share/doc/aomp"
+ mkdir -p "$AOMP/share/doc/aomp"
+ echo $SUDO cp "$AOMP_REPOS/$AOMP_REPO_NAME/LICENSE" "$AOMP/share/doc/aomp/LICENSE.apache2"
+ $SUDO cp "$AOMP_REPOS/$AOMP_REPO_NAME/LICENSE" "$AOMP/share/doc/aomp/LICENSE.apache2"
+ echo $SUDO cp "$AOMP_REPOS/$AOMP_EXTRAS_REPO_NAME/LICENSE" "$AOMP/share/doc/aomp/LICENSE.mit"
+ $SUDO cp "$AOMP_REPOS/$AOMP_EXTRAS_REPO_NAME/LICENSE" "$AOMP/share/doc/aomp/LICENSE.mit"
+ echo $SUDO cp "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/LICENSE.txt" "$AOMP/share/doc/aomp/LICENSE.flang"
+ $SUDO cp "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/LICENSE.txt" "$AOMP/share/doc/aomp/LICENSE.flang"
fi
echo Cleaning AOMP Directory...
#examples
-$SUDO rm -f $AOMP/examples/hip/*.txt
-$SUDO rm -f $AOMP/examples/hip/*.sh
-$SUDO rm -f $AOMP/examples/openmp/*.txt
-$SUDO rm -f $AOMP/examples/openmp/*.sh
-$SUDO rm -f $AOMP/examples/cloc/*.txt
-$SUDO rm -f $AOMP/examples/cloc/*.sh
-$SUDO rm -f $AOMP/examples/fortran/*.txt
-$SUDO rm -f $AOMP/examples/fortran/*.sh
-$SUDO rm -f $AOMP/examples/*.sh
-$SUDO rm -f $AOMP/examples/raja/*.txt
-$SUDO rm -f $AOMP/examples/raja/*.sh
+$SUDO rm -f "$AOMP"/examples/hip/*.txt
+$SUDO rm -f "$AOMP"/examples/hip/*.sh
+$SUDO rm -f "$AOMP"/examples/openmp/*.txt
+$SUDO rm -f "$AOMP"/examples/openmp/*.sh
+$SUDO rm -f "$AOMP"/examples/cloc/*.txt
+$SUDO rm -f "$AOMP"/examples/cloc/*.sh
+$SUDO rm -f "$AOMP"/examples/fortran/*.txt
+$SUDO rm -f "$AOMP"/examples/fortran/*.sh
+$SUDO rm -f "$AOMP"/examples/*.sh
+$SUDO rm -f "$AOMP"/examples/raja/*.txt
+$SUDO rm -f "$AOMP"/examples/raja/*.sh
# Clean libexec, for now just delete files not directories
# rocprofiler installs some needed python scripts in
# libexec/rocprofiler.
-$SUDO find $AOMP/libexec -maxdepth 1 -type f -delete
+$SUDO find "$AOMP"/libexec -maxdepth 1 -type f -delete
# Clean src
-$SUDO rm -rf $AOMP/src
-$SUDO rm -rf $AOMP/rocclr
+$SUDO rm -rf "$AOMP"/src
+$SUDO rm -rf "$AOMP"/rocclr
# Clean llvm-lit
-$SUDO rm -f $AOMP/bin/llvm-lit
+$SUDO rm -f "$AOMP"/bin/llvm-lit
echo "Done with $0"
diff --git a/bin/build_flang-classic.sh b/bin/build_flang-classic.sh
index 897b8e18a0..b61228f56c 100755
--- a/bin/build_flang-classic.sh
+++ b/bin/build_flang-classic.sh
@@ -1,5 +1,9 @@
#!/bin/bash
#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
# build_flang-classic.sh: Script to build the flang-classic binary driver
# This driver will never call flang -fc1, it only calls binaries
# clang, flang1, flang2, build elsewhere
@@ -12,12 +16,12 @@
BUILD_TYPE=${BUILD_TYPE:-Release}
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
-if [ $AOMP_BUILD_FLANG_CLASSIC == 0 ] ; then
+if [ "$AOMP_BUILD_FLANG_CLASSIC" == 0 ] ; then
if [ "$1" != "install" ] ; then
echo "WARNING: ROCM install for $AOMP_FLANG_CLASSIC_REL/llvm-classic not found."
echo " This build will skip build of flang-classic."
@@ -25,24 +29,17 @@ if [ $AOMP_BUILD_FLANG_CLASSIC == 0 ] ; then
fi
exit
fi
-TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}X86"
-
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
- standalone_word="_STANDALONE"
-else
- standalone_word=""
-fi
if [ "$AOMP_USE_NINJA" == 0 ] ; then
- AOMP_SET_NINJA_GEN=""
+ AOMP_SET_NINJA_GEN=()
else
- AOMP_SET_NINJA_GEN="-G Ninja"
+ AOMP_SET_NINJA_GEN=(-G Ninja)
fi
-osversion=$(cat /etc/os-release | grep -e ^VERSION_ID)
-if [[ $osversion =~ '"7.' ]] || [[ $osversion =~ '"8' ]]; then
- _cxx_flag="-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0'"
+osversion=$(grep -e ^VERSION_ID < /etc/os-release)
+if [[ $osversion =~ \"7\. ]] || [[ $osversion =~ \"8\. ]]; then
+ _cxx_flag=(-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0')
else
- _cxx_flag=""
+ _cxx_flag=()
fi
# We need a version of ROCM llvm that supports flang-classic
@@ -50,9 +47,6 @@ fi
# This will enable removal of flang-classic driver support
# from clang to make way for flang
-# Options for llvm-classic cmake.
-TARGETS_TO_BUILD="AMDGPU;X86"
-
# Do not change the AOMP_LFL_DIR default because it is the subdirectory
# from where we build the flang-classic driver binary. This is the
# Last Frozen LLVM (LFL) for which there is amd-only clang driver support
@@ -63,20 +57,22 @@ AOMP_LFL_DIR=${AOMP_LFL_DIR:-"17.0-4"}
# comment out above line and uncomment next line for new LFL
#AOMP_LFL_DIR=${AOMP_LFL_DIR:-17.0-4}
-MYCMAKEOPTS="\
--DCMAKE_BUILD_TYPE=$BUILD_TYPE \
--DCMAKE_C_COMPILER=$LLVM_INSTALL_LOC/bin/clang \
--DCMAKE_CXX_COMPILER=$LLVM_INSTALL_LOC/bin/clang++ \
-$_cxx_flag \
--DCMAKE_CXX_STANDARD=17 \
--DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_LOC \
-$AOMP_SET_NINJA_GEN \
-"
-
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
- MYCMAKEOPTS="$MYCMAKEOPTS -DBUILD_SHARED_LIBS=ON $AOMP_ORIGIN_RPATH"
+declare -a MYCMAKEOPTS
+
+MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
+ -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++"
+ "${_cxx_flag[@]}"
+ -DCMAKE_CXX_STANDARD=17
+ -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC"
+ "${AOMP_SET_NINJA_GEN[@]}")
+
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" -DBUILD_SHARED_LIBS=ON
+ "${AOMP_ORIGIN_RPATH[@]}")
else
- MYCMAKEOPTS="$MYCMAKEOPTS -DBUILD_SHARED_LIBS=OFF $OPENMP_EXTRAS_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" -DBUILD_SHARED_LIBS=OFF
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
@@ -84,27 +80,16 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
help_build_aomp
fi
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
- if [ ! -L $AOMP ] ; then
- if [ -d $AOMP ] ; then
- echo "ERROR: Directory $AOMP is a physical directory."
- echo " It must be a symbolic link or not exist"
- exit 1
- fi
- fi
-fi
-
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $AOMP_INSTALL_DIR
- $SUDO touch $AOMP_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $AOMP_INSTALL_DIR"
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
+ if [ ! -L "$AOMP" ] && [ -d "$AOMP" ] ; then
+ echo "ERROR: Directory $AOMP is a physical directory."
+ echo " It must be a symbolic link or not exist"
exit 1
fi
- $SUDO rm $AOMP_INSTALL_DIR/testfile
fi
+check_writable_installdir "$1" "$AOMP_INSTALL_DIR"
+
# Allow extglobs -- seems like this must be set before bash starts parsing
# the 'if' block below.
shopt -s extglob
@@ -121,7 +106,7 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
exit 1
fi
else
- if [ ! -d $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR ] ; then
+ if [ ! -d "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR" ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR does not exist"
echo " run $0 without nocmake or install options. "
exit 1
@@ -131,13 +116,13 @@ fi
echo
# Cmake flang-classic.
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
- cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR
+ cd "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR" || exit
echo " -----Running cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR
- ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR 2>&1
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR" 2>&1; then
echo "ERROR cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -150,9 +135,9 @@ echo
# Build flang-classic.
echo " --- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR ---- "
-cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR
-$AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+cd "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR" || exit
+
+if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -163,8 +148,8 @@ fi
if [ "$1" == "install" ] ; then
echo " -----Installing to $AOMP_INSTALL_DIR ---- "
- $SUDO ${AOMP_CMAKE} --build . -j $AOMP_JOB_THREADS --target install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "${AOMP_CMAKE}" --build . -j "$AOMP_JOB_THREADS" --target install; then
echo "ERROR make install failed "
exit 1
fi
diff --git a/bin/build_flang.sh b/bin/build_flang.sh
index 551a77eb4c..74f9162b23 100755
--- a/bin/build_flang.sh
+++ b/bin/build_flang.sh
@@ -6,9 +6,9 @@
BUILD_TYPE=${BUILD_TYPE:-Release}
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_FLANG=${INSTALL_FLANG:-$AOMP_INSTALL_DIR}
@@ -26,74 +26,73 @@ fi
REPO_DIR=$AOMP_REPOS/$AOMP_FLANG_REPO_NAME
COMP_INC_DIR=$REPO_DIR/runtime/libpgmath/lib/common
-MYCMAKEOPTS="-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
- -DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_LOC \
- -DLLVM_ENABLE_ASSERTIONS=ON \
- -DLLVM_CONFIG=$LLVM_INSTALL_LOC/bin/llvm-config \
- -DCMAKE_CXX_COMPILER=$LLVM_INSTALL_LOC/bin/clang++ \
- -DCMAKE_C_COMPILER=$LLVM_INSTALL_LOC/bin/clang \
- -DCMAKE_Fortran_COMPILER=gfortran \
- -DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD \
- -DFLANG_OPENMP_GPU_AMD=ON \
- -DFLANG_OPENMP_GPU_NVIDIA=ON \
- -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
- -DFLANG_INCLUDE_TESTS=OFF"
+declare -a MYCMAKEOPTS
+
+MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
+ -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC"
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DLLVM_CONFIG="$LLVM_INSTALL_LOC/bin/llvm-config"
+ -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++"
+ -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DCMAKE_Fortran_COMPILER=gfortran
+ -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD"
+ -DFLANG_OPENMP_GPU_AMD=ON
+ -DFLANG_OPENMP_GPU_NVIDIA=ON
+ -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON
+ -DFLANG_INCLUDE_TESTS=OFF)
+
+declare -a ASAN_CMAKE_OPTS
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- ASAN_FLAGS="$ASAN_FLAGS -I$COMP_INC_DIR"
- ASAN_CMAKE_OPTS="$MYCMAKEOPTS -DCMAKE_PREFIX_PATH=$AOMP/lib/asan/cmake $AOMP_ASAN_ORIGIN_RPATH -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DCMAKE_INSTALL_LIBDIR=lib/asan"
+ ASAN_FLAGS=("${ASAN_FLAGS[@]}" "-I$COMP_INC_DIR")
+ ASAN_CMAKE_OPTS=("${MYCMAKEOPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake"
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}"
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DCMAKE_INSTALL_LIBDIR=lib/asan)
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- ASAN_CMAKE_OPTS="$ASAN_CMAKE_OPTS -DCMAKE_INSTALL_BINDIR=bin/asan"
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}" -DCMAKE_INSTALL_BINDIR=bin/asan)
fi
fi
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- MYCMAKEOPTS="$MYCMAKEOPTS $AOMP_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "${AOMP_ORIGIN_RPATH[@]}")
else
- MYCMAKEOPTS="$MYCMAKEOPTS $OPENMP_EXTRAS_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
-MYCMAKEOPTS="$MYCMAKEOPTS -DCMAKE_PREFIX_PATH=$AOMP/lib/cmake"
+MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "-DCMAKE_PREFIX_PATH=$AOMP/lib/cmake")
if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
help_build_aomp
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_FLANG
- $SUDO touch $INSTALL_FLANG/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_FLANG"
- exit 1
- fi
- $SUDO rm $INSTALL_FLANG/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_FLANG"
# Skip synchronization from git repos if nocmake or install are specified
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- rm -rf $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME
- mkdir -p $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME
+ rm -rf "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME"
+ mkdir -p "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME"
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- mkdir -p $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan
+ mkdir -p "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan"
fi
else
- if [ ! -d $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME ] ; then
+ if [ ! -d "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME does not exist"
echo " run $0 without nocmake or install options. "
exit 1
fi
- if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ ! -d $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan ] ; then
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ ! -d "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan" ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan does not exist"
echo " run $0 without nocmake or install options. "
exit 1
fi
fi
-cd $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME
+cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" || exit
# Need llvm-config to come from previous LLVM build
export PATH=$AOMP_INSTALL_DIR/bin:$PATH
@@ -102,38 +101,37 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ "$SANITIZER" != 1 ]; then
echo
echo " -----Running cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS \
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
-DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME"
- ${AOMP_CMAKE} $MYCMAKEOPTS \
- -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME 2>&1
- if [ $? != 0 ] ; then
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" 2>&1; then
echo "ERROR cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- cd $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan
+ cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan" || exit
echo
echo " ----Running cmake for flang-asan ----- "
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS \
- -DCMAKE_C_FLAGS="$CFLAGS $ASAN_FLAGS" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS $ASAN_FLAGS" \
- $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME
-
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS \
- -DCMAKE_C_FLAGS="$CFLAGS $ASAN_FLAGS" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS $ASAN_FLAGS" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME 2>&1
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \
+ "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME"
+
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" 2>&1; then
echo "ERROR flang-asan cmake failed. Cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
@@ -146,22 +144,22 @@ fi
echo
if [ "$SANITIZER" != 1 ]; then
echo " ----- Running make ---- "
- cd $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME
- echo make -j $AOMP_JOB_THREADS
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" || exit
+ echo "make -j $AOMP_JOB_THREADS"
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo "ERROR make -j $AOMP_JOB_THREADS failed"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- cd $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan
+ cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan" || exit
echo
echo " ----- Running make for flang-asan ---- "
- echo make -j $AOMP_JOB_THREADS
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ echo "make -j $AOMP_JOB_THREADS"
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo "ERROR make -j $AOMP_JOB_THREADS failed"
exit 1
fi
@@ -169,10 +167,10 @@ fi
if [ "$1" == "install" ] ; then
if [ "$SANITIZER" != 1 ]; then
- cd $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME
+ cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME" || exit
echo " -----Installing to $INSTALL_FLANG ---- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
@@ -181,10 +179,10 @@ if [ "$1" == "install" ] ; then
echo
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- cd $BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan
+ cd "$BUILD_DIR/build/$AOMP_FLANG_REPO_NAME/asan" || exit
echo " -----Installing to $INSTALL_FLANG/lib/asan ---- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
diff --git a/bin/build_flang_runtime.sh b/bin/build_flang_runtime.sh
index 4de2a71f62..1bddf15381 100755
--- a/bin/build_flang_runtime.sh
+++ b/bin/build_flang_runtime.sh
@@ -6,9 +6,9 @@
BUILD_TYPE=${BUILD_TYPE:-Release}
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_FLANG=${INSTALL_FLANG:-$AOMP_INSTALL_DIR}
@@ -23,7 +23,7 @@ else
fi
fi
-COMP_INC_DIR=$(ls -d $AOMP_INSTALL_DIR/lib/llvm/lib/clang/*/include )
+COMP_INC_DIR=$(ls -d "$AOMP_INSTALL_DIR"/lib/llvm/lib/clang/*/include )
REPO_DIR=$AOMP_REPOS/$AOMP_FLANG_REPO_NAME
COMP_INC_DIR=$REPO_DIR/runtime/libpgmath/lib/common
@@ -37,87 +37,93 @@ if [ "$AOMP_STANDALONE_BUILD" == 0 ]; then
CMAKE_PREFIX_PATH=$BUILD_DIR/build/pgmath
fi
else
- if [ -d $BUILD_DIR/build/openmp/runtime/src ] ; then
+ if [ -d "$BUILD_DIR/build/openmp/runtime/src" ] ; then
openmp_build_runtime_src="$BUILD_DIR/build/openmp/runtime/src"
else
openmp_build_runtime_src="$BUILD_DIR/build/llvm-project/runtimes/runtimes-bins/openmp/runtime/src"
fi
- if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ -d $BUILD_DIR/build/openmp/asan/runtime/src ]; then
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ -d "$BUILD_DIR/build/openmp/asan/runtime/src" ]; then
openmp_build_runtime_src="$BUILD_DIR/build/openmp/asan/runtime/src"
fi
fi
-MYCMAKEOPTS="-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
- -DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_LOC \
- -DLLVM_ENABLE_ASSERTIONS=ON \
- -DLLVM_CONFIG=$LLVM_INSTALL_LOC/bin/llvm-config \
- -DCMAKE_CXX_COMPILER=$LLVM_INSTALL_LOC/bin/clang++ \
- -DCMAKE_C_COMPILER=$LLVM_INSTALL_LOC/bin/clang \
- -DCMAKE_Fortran_COMPILER=$LLVM_INSTALL_LOC/bin/flang-classic \
- -DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD \
- -DLLVM_INSTALL_RUNTIME=ON \
- -DFLANG_BUILD_RUNTIME=ON \
- -DOPENMP_BUILD_DIR=$openmp_build_runtime_src \
- -DFLANG_INCLUDE_TESTS=OFF"
+declare -a MYCMAKEOPTS
+
+MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
+ -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC"
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DLLVM_CONFIG="$LLVM_INSTALL_LOC/bin/llvm-config"
+ -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++"
+ -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DCMAKE_Fortran_COMPILER="$LLVM_INSTALL_LOC/bin/flang-classic"
+ -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD"
+ -DLLVM_INSTALL_RUNTIME=ON
+ -DFLANG_BUILD_RUNTIME=ON
+ -DOPENMP_BUILD_DIR="$openmp_build_runtime_src"
+ -DFLANG_INCLUDE_TESTS=OFF)
# Note this variable is used only for AOMP ASan-ROCm builds don't remove it.
# This is not used for AOMP-ASan standalone build.
if [ "$SANITIZER" == 1 ]; then
- MYCMAKEOPTS="$MYCMAKEOPTS -DSANITIZER=$SANITIZER"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" -DSANITIZER="$SANITIZER")
fi
+declare -a ASAN_CMAKE_OPTS
+
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- ASAN_FLAGS="$ASAN_FLAGS -I$COMP_INC_DIR"
- ASAN_CMAKE_OPTS="$MYCMAKEOPTS -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DCMAKE_INSTALL_BINDIR=bin/asan -DCMAKE_INSTALL_LIBDIR=lib/asan"
+ ASAN_FLAGS=("${ASAN_FLAGS[@]}" -I"$COMP_INC_DIR")
+ ASAN_CMAKE_OPTS=("${MYCMAKEOPTS[@]}"
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DCMAKE_INSTALL_BINDIR=bin/asan
+ -DCMAKE_INSTALL_LIBDIR=lib/asan)
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- ASAN_CMAKE_OPTS="$ASAN_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$AOMP/lib/asan/cmake;$AOMP/lib/asan $AOMP_ASAN_ORIGIN_RPATH"
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake;$AOMP/lib/asan"
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}")
else
- ASAN_CMAKE_OPTS="$ASAN_CMAKE_OPTS -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$INSTALL_PREFIX/lib/asan/cmake" $OPENMP_EXTRAS_ORIGIN_RPATH -DOPENMP_EXTRAS_SHARED_LINKER_FLAGS=$OPENMP_EXTRAS_SHARED_LINKER_FLAGS"
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$INSTALL_PREFIX/lib/asan/cmake"
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}"
+ -DOPENMP_EXTRAS_SHARED_LINKER_FLAGS="$(cmquot "${OPENMP_EXTRAS_SHARED_LINKER_FLAGS[@]}")")
fi
fi
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- MYCMAKEOPTS="$MYCMAKEOPTS -DCMAKE_PREFIX_PATH=$AOMP/lib/cmake;$AOMP_INSTALL_DIR/lib $AOMP_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP/lib/cmake;$AOMP_INSTALL_DIR/lib"
+ "${AOMP_ORIGIN_RPATH[@]}")
else
- MYCMAKEOPTS="$MYCMAKEOPTS -DCMAKE_PREFIX_PATH=$INSTALL_PREFIX/lib/asan/cmake
- -DOPENMP_EXTRAS_SHARED_LINKER_FLAGS=$OPENMP_EXTRAS_SHARED_LINKER_FLAGS
- -DAOMP_BUILD_SANITIZER=$AOMP_BUILD_SANITIZER
- -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH
- $OPENMP_EXTRAS_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX/lib/asan/cmake"
+ -DOPENMP_EXTRAS_SHARED_LINKER_FLAGS="$(cmquot "${OPENMP_EXTRAS_SHARED_LINKER_FLAGS[@]}")"
+ -DAOMP_BUILD_SANITIZER="$AOMP_BUILD_SANITIZER"
+ -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH"
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
help_build_aomp
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_FLANG
- $SUDO touch $INSTALL_FLANG/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_FLANG"
- exit 1
- fi
- $SUDO rm $INSTALL_FLANG/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_FLANG"
# Skip synchronization from git repos if nocmake or install are specified
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/flang_runtime"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- rm -rf $BUILD_DIR/build/flang_runtime
- mkdir -p $BUILD_DIR/build/flang_runtime
+ rm -rf "$BUILD_DIR/build/flang_runtime"
+ mkdir -p "$BUILD_DIR/build/flang_runtime"
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- mkdir -p $BUILD_DIR/build/flang_runtime/asan
+ mkdir -p "$BUILD_DIR/build/flang_runtime/asan"
fi
else
- if [ ! -d $BUILD_DIR/build/flang_runtime ] ; then
+ if [ ! -d "$BUILD_DIR/build/flang_runtime" ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/flang_runtime does not exist"
echo " run $0 without nocmake or install options. "
exit 1
fi
- if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ ! -d $BUILD_DIR/build/flang_runtime/asan ]; then
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ ! -d "$BUILD_DIR/build/flang_runtime/asan" ]; then
echo "ERROR: The build directory $BUILD_DIR/build/flang_runtime/asan does not exist"
echo " run $0 without nocmake or install options. "
exit 1
@@ -125,49 +131,45 @@ else
fi
# Need llvm-config to come from previous LLVM build
-export PATH=$AOMP_INSTALL_DIR/bin:$PATH
+export PATH="$AOMP_INSTALL_DIR/bin":$PATH
# Old CMAKE uses FC env variable to find fortran compiler
-export FC=$AOMP_INSTALL_DIR/bin/flang
+export FC="$AOMP_INSTALL_DIR/bin/flang"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ "$SANITIZER" != 1 ]; then
- cd $BUILD_DIR/build/flang_runtime
+ cd "$BUILD_DIR/build/flang_runtime" || exit
echo
echo " -----Running cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS \
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
-DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME
-
- ${AOMP_CMAKE} $MYCMAKEOPTS \
- -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME 2>&1
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME"
- if [ $? != 0 ] ; then
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" 2>&1; then
echo "ERROR cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- cd $BUILD_DIR/build/flang_runtime/asan
+ cd "$BUILD_DIR/build/flang_runtime/asan" || exit
echo
echo " -----Running cmake flang_runtime-asan ---- "
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS \
- -DCMAKE_C_FLAGS="$CFLAGS $ASAN_FLAGS" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS $ASAN_FLAGS" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME
-
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS \
- -DCMAKE_C_FLAGS="$CFLAGS $ASAN_FLAGS" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS $ASAN_FLAGS" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME 2>&1
-
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME" 2>&1; then
echo "ERROR flang_runtime-asan cmake failed. Cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
@@ -180,10 +182,10 @@ fi
echo
if [ "$SANITIZER" != 1 ]; then
echo " -----Running make ---- "
- cd $BUILD_DIR/build/flang_runtime
- echo make -j $AOMP_JOB_THREADS
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ cd "$BUILD_DIR/build/flang_runtime" || exit
+ echo make -j "$AOMP_JOB_THREADS"
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo "ERROR make -j $AOMP_JOB_THREADS failed"
exit 1
fi
@@ -192,10 +194,10 @@ fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
echo
echo " -----Running make ---- "
- cd $BUILD_DIR/build/flang_runtime/asan
- echo make -j $AOMP_JOB_THREADS
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ cd "$BUILD_DIR/build/flang_runtime/asan" || exit
+ echo make -j "$AOMP_JOB_THREADS"
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo "ERROR make -j $AOMP_JOB_THREADS failed"
exit 1
fi
@@ -203,10 +205,10 @@ fi
if [ "$1" == "install" ] ; then
if [ "$SANITIZER" != 1 ]; then
- cd $BUILD_DIR/build/flang_runtime
+ cd "$BUILD_DIR/build/flang_runtime" || exit
echo " -----Installing to $INSTALL_FLANG ---- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
@@ -215,10 +217,10 @@ if [ "$1" == "install" ] ; then
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- cd $BUILD_DIR/build/flang_runtime/asan
+ cd "$BUILD_DIR/build/flang_runtime/asan" || exit
echo " -----Installing to $INSTALL_FLANG/lib/asan ---- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
diff --git a/bin/build_hipamd.sh b/bin/build_hipamd.sh
index 196ffd1aae..0a0ae14d13 100755
--- a/bin/build_hipamd.sh
+++ b/bin/build_hipamd.sh
@@ -28,9 +28,9 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
export HIPAMD_DIR=$AOMP_REPOS/clr
@@ -48,7 +48,6 @@ export HIP_CLANG_PATH=$AOMP_INSTALL_DIR/bin
export DEVICE_LIB_PATH=$AOMP_INSTALL_DIR/lib
export LLVM_DIR=$LLVM_INSTALL_LOC
-HIP_PATH=$AOMP_INSTALL_DIR
BUILD_DIR=${BUILD_AOMP}
BUILDTYPE="Release"
@@ -62,23 +61,15 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $AOMP_INSTALL_DIR
- $SUDO touch $AOMP_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $AOMP_INSTALL_DIR"
- exit 1
- fi
- $SUDO rm $AOMP_INSTALL_DIR/testfile
-fi
+check_writable_installdir "$1" "$AOMP_INSTALL_DIR"
-patchrepo $AOMP_REPOS/hipamd
-patchrepo $AOMP_REPOS/clr
+patchrepo "$AOMP_REPOS/hipamd"
+patchrepo "$AOMP_REPOS/clr"
-if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- LDFLAGS="-fuse-ld=lld $ASAN_FLAGS"
-fi
+#if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ #LDFLAGS=$(shquot '-fuse-ld=lld' "${ASAN_FLAGS[@]}")"
+ #export LDFLAGS
+#fi
_ompd_src_dir="$LLVM_INSTALL_LOC/share/gdb/python/ompd/src"
@@ -87,72 +78,97 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/hipamd" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/hipamd
- rm -rf $BUILD_DIR/build/hipamd
+ echo rm -rf "$BUILD_DIR/build/hipamd"
+ rm -rf "$BUILD_DIR/build/hipamd"
fi
- MYCMAKEOPTS="-DCMAKE_BUILD_TYPE=$BUILDTYPE \
- -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR \
- -DHIP_COMMON_DIR=$HIP_DIR \
- -DHIP_PLATFORM=amd \
- -DHIP_COMPILER=clang \
- -DCMAKE_HIP_ARCHITECTURES=OFF \
- -DCLR_BUILD_HIP=ON -DCLR_BUILD_OCL=ON \
- -DHIPCC_BIN_DIR=$BUILD_DIR/build/hipcc \
- -DROCM_PATH=$ROCM_PATH"
+ declare -a MYCMAKEOPTS
+
+ MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILDTYPE"
+ -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR"
+ -DHIP_COMMON_DIR="$HIP_DIR"
+ -DHIP_PLATFORM=amd
+ -DHIP_COMPILER=clang
+ -DCMAKE_HIP_ARCHITECTURES=OFF
+ -DCLR_BUILD_HIP=ON -DCLR_BUILD_OCL=ON
+ -DHIPCC_BIN_DIR="$BUILD_DIR/build/hipcc"
+ -DROCM_PATH="$ROCM_PATH"
+ -DBUILD_ICD=ON)
# If this machine does not have an actvie amd GPU, tell hipamd
# to use first in GFXLIST or gfx90a if no GFXLIST
- if [ -f $LLVM_INSTALL_LOC/bin/amdgpu-arch ] ; then
- $LLVM_INSTALL_LOC/bin/amdgpu-arch >/dev/null
- if [ $? != 0 ] ; then
- if [ ! -z "$GFXLIST" ] ; then
- amdgpu=`echo $GFXLIST | cut -d" " -f1`
+ if [ -f "$LLVM_INSTALL_LOC/bin/amdgpu-arch" ] ; then
+ if ! "$LLVM_INSTALL_LOC/bin/amdgpu-arch" >/dev/null; then
+ if [ -n "$GFXLIST" ] ; then
+ amdgpu=$(echo "$GFXLIST" | cut -d" " -f1)
else
amdgpu=gfx90a
- fi
- MYCMAKEOPTS+=" -DOFFLOAD_ARCH_STR=$amdgpu"
+ fi
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "-DOFFLOAD_ARCH_STR=$amdgpu")
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- ASAN_FLAGS="$ASAN_FLAGS -I$SANITIZER_COMGR_INCLUDE_PATH -Wno-error=deprecated-declarations"
- ASAN_CMAKE_OPTS="$MYCMAKEOPTS $AOMP_ASAN_ORIGIN_RPATH -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR;$HOME/local/openclicdloader -DCMAKE_INSTALL_LIBDIR=lib/asan -DCMAKE_C_COMPILER=$LLVM_INSTALL_LOC/bin/clang -DCMAKE_CXX_COMPILER=$LLVM_INSTALL_LOC/bin/clang++ -DHIP_LLVM_ROOT=$LLVM_INSTALL_LOC"
+ ASAN_FLAGS=("${ASAN_FLAGS[@]}" -I"$SANITIZER_COMGR_INCLUDE_PATH" -Wno-error=deprecated-declarations)
+ ASAN_CMAKE_OPTS=("${MYCMAKEOPTS[@]}" "${AOMP_ASAN_ORIGIN_RPATH[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR;$HOME/local/openclicdloader;$BUILD_DIR/build/hipamd/opencl/khronos/icd"
+ -DCMAKE_INSTALL_LIBDIR=lib/asan
+ -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++"
+ -DHIP_LLVM_ROOT="$LLVM_INSTALL_LOC")
fi
if [ "$AOMP_BUILD_DEBUG" == 1 ]; then
- HIPAMD_DEBUG_CMAKE_OPTS="$MYCMAKEOPTS $AOMP_DEBUG_ORIGIN_RPATH -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR;$HOME/local/openclicdloader -DCMAKE_INSTALL_LIBDIR=lib-debug -DCMAKE_C_COMPILER=$LLVM_INSTALL_LOC/bin/clang -DCMAKE_CXX_COMPILER=$LLVM_INSTALL_LOC/bin/clang++ -DHIP_LLVM_ROOT=$LLVM_INSTALL_LOC"
+ HIPAMD_DEBUG_CMAKE_OPTS=("${MYCMAKEOPTS[@]}"
+ "${AOMP_DEBUG_ORIGIN_RPATH[@]}"
+ -DCMAKE_BUILD_TYPE=DEBUG
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR;$HOME/local/openclicdloader;$BUILD_DIR/build/hipamd/opencl/khronos/icd"
+ -DCMAKE_INSTALL_LIBDIR=lib-debug
+ -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++"
+ -DHIP_LLVM_ROOT="$LLVM_INSTALL_LOC")
fi
- HIPAMD_CMAKE_OPTS="$MYCMAKEOPTS -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR;$HOME/local/openclicdloader -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_CXX_FLAGS=-I${AOMP_INSTALL_DIR}/include/amd_comgr -DCMAKE_CXX_FLAGS=-Wno-error=deprecated-declarations -DCMAKE_C_FLAGS=-Wno-error=deprecated-declarations -DHIP_LLVM_ROOT=$LLVM_INSTALL_LOC $AOMP_ORIGIN_RPATH"
+ HIPAMD_CMAKE_OPTS=("${MYCMAKEOPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR;$HOME/local/openclicdloader;$BUILD_DIR/build/hipamd/opencl/khronos/icd"
+ -DCMAKE_INSTALL_LIBDIR=lib
+ -DCMAKE_CXX_FLAGS=-I"${AOMP_INSTALL_DIR}/include/amd_comgr"
+ -DCMAKE_CXX_FLAGS=-Wno-error=deprecated-declarations
+ -DCMAKE_C_FLAGS=-Wno-error=deprecated-declarations
+ -DHIP_LLVM_ROOT="$LLVM_INSTALL_LOC"
+ "${AOMP_ORIGIN_RPATH[@]}")
- echo mkdir -p $BUILD_DIR/build/hipamd
- mkdir -p $BUILD_DIR/build/hipamd
- echo cd $BUILD_DIR/build/hipamd
- cd $BUILD_DIR/build/hipamd
+ echo "mkdir -p $BUILD_DIR/build/hipamd"
+ mkdir -p "$BUILD_DIR/build/hipamd"
+ echo "cd $BUILD_DIR/build/hipamd"
+ cd "$BUILD_DIR/build/hipamd" || exit
echo
echo " -----Running hipamd cmake ---- "
- echo ${AOMP_CMAKE} $HIPAMD_CMAKE_OPTS $HIPAMD_DIR
- ${AOMP_CMAKE} $HIPAMD_CMAKE_OPTS $HIPAMD_DIR
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "${HIPAMD_CMAKE_OPTS[@]}" "$HIPAMD_DIR"
+
+ if ! ${AOMP_CMAKE} "${HIPAMD_CMAKE_OPTS[@]}" "$HIPAMD_DIR"; then
echo "ERROR hipamd cmake failed. Cmake flags"
- echo " $HIPAMD_CMAKE_OPTS"
+ echo " $(shquot "${HIPAMD_CMAKE_OPTS[@]}")"
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
export ROCM_RPATH="$AOMP_ORIGIN_RPATH_LIST"
- echo mkdir -p $BUILD_DIR/build/hipamd/asan
- mkdir -p $BUILD_DIR/build/hipamd/asan
- echo cd $BUILD_DIR/build/hipamd/asan
- cd $BUILD_DIR/build/hipamd/asan
+ echo "mkdir -p $BUILD_DIR/build/hipamd/asan"
+ mkdir -p "$BUILD_DIR/build/hipamd/asan"
+ echo "cd $BUILD_DIR/build/hipamd/asan"
+ cd "$BUILD_DIR/build/hipamd/asan" || exit
echo
echo " -----Running hipamd-asan cmake -----"
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_CXX_FLAGS="$ASAN_FLAGS" $HIPAMD_DIR
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_CXX_FLAGS="$ASAN_FLAGS" $HIPAMD_DIR
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_CXX_FLAGS=\""$(cmquot "${ASAN_FLAGS[@]}")\""
+ "$HIPAMD_DIR"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ "$HIPAMD_DIR"; then
echo "ERROR hipamd-asan cmake failed. Cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
@@ -160,22 +176,28 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/hipamd_debug" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/hipamd_debug
- rm -rf $BUILD_DIR/build/hipamd_debug
+ echo "rm -rf $BUILD_DIR/build/hipamd_debug"
+ rm -rf "$BUILD_DIR/build/hipamd_debug"
fi
- echo mkdir -p $BUILD_DIR/build/hipamd_debug
- mkdir -p $BUILD_DIR/build/hipamd_debug
- echo cd $BUILD_DIR/build/hipamd_debug
- cd $BUILD_DIR/build/hipamd_debug
+ echo "mkdir -p $BUILD_DIR/build/hipamd_debug"
+ mkdir -p "$BUILD_DIR/build/hipamd_debug"
+ echo "cd $BUILD_DIR/build/hipamd_debug"
+ cd "$BUILD_DIR/build/hipamd_debug" || exit
echo
echo " -----Running hipamd-debug cmake -----"
- _prefix_map="\""-fdebug-prefix-map=$HIPAMD_DIR=$_ompd_src_dir/clr"\""
- echo ${AOMP_CMAKE} $HIPAMD_DEBUG_CMAKE_OPTS -DCMAKE_CXX_FLAGS="-g $_prefix_map" -DCMAKE_C_FLAGS="-g $_prefix_map" $HIPAMD_DIR
- ${AOMP_CMAKE} $HIPAMD_DEBUG_CMAKE_OPTS -DCMAKE_CXX_FLAGS="-g $_prefix_map" -DCMAKE_C_FLAGS="-g $_prefix_map" $HIPAMD_DIR
- if [ $? != 0 ] ; then
+ _prefix_map=(-fdebug-prefix-map="$HIPAMD_DIR=$_ompd_src_dir/clr")
+ echo "${AOMP_CMAKE}" "${HIPAMD_DEBUG_CMAKE_OPTS[@]}" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot -g "${_prefix_map[@]}")\"" \
+ -DCMAKE_C_FLAGS="\"$(cmquot -g "${_prefix_map[@]}")\"" \
+ "$HIPAMD_DIR"
+
+ if ! ${AOMP_CMAKE} "${HIPAMD_DEBUG_CMAKE_OPTS[@]}" \
+ -DCMAKE_CXX_FLAGS="$(cmquot -g "${_prefix_map[@]}")" \
+ -DCMAKE_C_FLAGS="$(cmquot -g "${_prefix_map[@]}")" \
+ "$HIPAMD_DIR"; then
echo "ERROR hipamd-debug cmake failed. Cmake flags"
- echo " $HIPAMD_DEBUG_CMAKE_OPTS"
+ echo " $(shquot "${HIPAMD_DEBUG_CMAKE_OPTS[@]}")"
exit 1
fi
fi
@@ -185,12 +207,12 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_DIR/build/hipamd
+cd "$BUILD_DIR/build/hipamd" || exit
echo
echo " -----Running make for hipamd ---- "
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -207,11 +229,11 @@ else
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/hipamd/asan
+ cd "$BUILD_DIR/build/hipamd/asan" || exit
echo
echo " -----Running make for hipamd-asan ----- "
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -228,11 +250,11 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
fi
fi
if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
- cd $BUILD_DIR/build/hipamd_debug
+ cd "$BUILD_DIR/build/hipamd_debug" || exit
echo
echo " -----Running make for hipamd-debug ----- "
- make -j $AOMP_JOB_THREADS amdhip64
- if [ $? != 0 ] ; then
+
+ if ! make -j "$AOMP_JOB_THREADS" amdhip64; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -250,69 +272,64 @@ if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
fi
function edit_installed_hip_file(){
- if [ -f $installed_hip_file_to_edit ] ; then
+ local installed_file_to_edit="$1"
+ if [ -f "$installed_file_to_edit" ] ; then
# In hipvars.pm HIP_PATH is determined by parent directory of hipcc location.
# Set ROCM_PATH using HIP_PATH
- $SUDO sed -i -e "s/\"\/opt\/rocm\"/\"\$HIP_PATH\"/" $installed_file_to_edit
+ $SUDO sed -i -e "s/\"\/opt\/rocm\"/\"\$HIP_PATH\"/" "$installed_file_to_edit"
# Set HIP_CLANG_PATH using ROCM_PATH/bin
- $SUDO sed -i -e "s/\"\$ROCM_PATH\/llvm\/bin\"/\"\$ROCM_PATH\/bin\"/" $installed_file_to_edit
+ $SUDO sed -i -e "s/\"\$ROCM_PATH\/llvm\/bin\"/\"\$ROCM_PATH\/bin\"/" "$installed_file_to_edit"
fi
}
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_DIR/build/hipamd
+ cd "$BUILD_DIR/build/hipamd" || exit
echo
echo " -----Installing to $AOMP_INSTALL_DIR ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/hipamd/asan
+ cd "$BUILD_DIR/build/hipamd/asan" || exit
echo
echo " -----Installing to $AOMP_INSTALL_DIR/lib/asan"
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
fi
if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
- cd $BUILD_DIR/build/hipamd_debug
+ cd "$BUILD_DIR/build/hipamd_debug" || exit
echo
echo " -----Installing to $AOMP_INSTALL_DIR/lib-debug"
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
- $SUDO mkdir -p $_ompd_src_dir
- echo cp -r $HIPAMD_DIR/hipamd $_ompd_src_dir
- $SUDO cp -r $HIPAMD_DIR/hipamd $_ompd_src_dir
- echo cp -r $HIPAMD_DIR/opencl $_ompd_src_dir
- $SUDO cp -r $HIPAMD_DIR/opencl $_ompd_src_dir
- echo cp -r $HIPAMD_DIR/rocclr $_ompd_src_dir
- $SUDO cp -r $HIPAMD_DIR/rocclr $_ompd_src_dir
+ $SUDO mkdir -p "$_ompd_src_dir"
+ echo "cp -r $HIPAMD_DIR/hipamd $_ompd_src_dir"
+ $SUDO cp -r "$HIPAMD_DIR/hipamd" "$_ompd_src_dir"
+ echo "cp -r $HIPAMD_DIR/opencl $_ompd_src_dir"
+ $SUDO cp -r "$HIPAMD_DIR/opencl" "$_ompd_src_dir"
+ echo cp -r "$HIPAMD_DIR/rocclr" "$_ompd_src_dir"
+ $SUDO cp -r "$HIPAMD_DIR/rocclr" "$_ompd_src_dir"
fi
- removepatch $AOMP_REPOS/hipamd
- removepatch $AOMP_REPOS/clr
+ removepatch "$AOMP_REPOS/hipamd"
+ removepatch "$AOMP_REPOS/clr"
- # The hip perl scripts have /opt/rocm hardcoded, so fix them after then are installed
+ # The hip perl scripts have /opt/rocm hardcoded, so fix them after then are installed
# but only if not installing to rocm.
- if [ $AOMP_INSTALL_DIR != "/opt/rocm/llvm" ] ; then
- SED_INSTALL_DIR=`echo $AOMP_INSTALL_DIR | sed -e 's/\//\\\\\//g' `
- installed_file_to_edit=$AOMP_INSTALL_DIR/bin/hipcc
- $(edit_installed_hip_file)
- installed_file_to_edit=$AOMP_INSTALL_DIR/bin/hipvars.pm
- $(edit_installed_hip_file)
+ if [ "$AOMP_INSTALL_DIR" != "/opt/rocm/llvm" ] ; then
+ edit_installed_hip_file "$AOMP_INSTALL_DIR/bin/hipcc"
+ edit_installed_hip_file "$AOMP_INSTALL_DIR/bin/hipvars.pm"
# nothing to change in hipconfig but in case something is added in future, try to fix it
- installed_file_to_edit=$AOMP_INSTALL_DIR/bin/hipconfig
- $(edit_installed_hip_file)
+ edit_installed_hip_file "$AOMP_INSTALL_DIR/bin/hipconfig"
fi
-
-
fi
diff --git a/bin/build_hipcc.sh b/bin/build_hipcc.sh
index 3a71dd7977..7ad2314c4b 100755
--- a/bin/build_hipcc.sh
+++ b/bin/build_hipcc.sh
@@ -24,9 +24,9 @@
# SOFTWARE.
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
HIPCC_REPO_DIR=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/hipcc
@@ -47,12 +47,12 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $EXTRAS_REPO_DIR ] ; then
- echo "ERROR: Missing repository $EXTRAS_REPO_DIR/"
+if [ ! -d "$HIPCC_REPO_DIR" ] ; then
+ echo "ERROR: Missing repository $HIPCC_REPO_DIR/"
exit 1
fi
-if [ ! -f $LLVM_INSTALL_LOC/bin/clang ] ; then
+if [ ! -f "$LLVM_INSTALL_LOC/bin/clang" ] ; then
echo "ERROR: Missing file $LLVM_INSTALL_LOC/bin/clang"
echo " Build and install the AOMP clang compiler in $AOMP first"
echo " This is needed to build hipcc "
@@ -60,39 +60,33 @@ if [ ! -f $LLVM_INSTALL_LOC/bin/clang ] ; then
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_HIPCC
- $SUDO touch $INSTALL_HIPCC/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_HIPCC"
- exit 1
- fi
- $SUDO rm $INSTALL_HIPCC/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_HIPCC"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/hipcc" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/hipcc
- rm -rf $BUILD_DIR/build/hipcc
+ echo "rm -rf $BUILD_DIR/build/hipcc"
+ rm -rf "$BUILD_DIR/build/hipcc"
fi
- MYCMAKEOPTS="-DCMAKE_BUILD_TYPE=$BUILDTYPE -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR"
+ declare -a MYCMAKEOPTS
+
+ MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILDTYPE"
+ -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR")
- mkdir -p $BUILD_DIR/build/hipcc
- cd $BUILD_DIR/build/hipcc
+ mkdir -p "$BUILD_DIR/build/hipcc"
+ cd "$BUILD_DIR/build/hipcc" || exit
export SED_INSTALL_DIR
echo
echo " -----Running cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $HIPCC_REPO_DIR
- ${AOMP_CMAKE} $MYCMAKEOPTS $HIPCC_REPO_DIR
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" "$HIPCC_REPO_DIR"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$HIPCC_REPO_DIR"; then
echo "ERROR hipcc cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -101,11 +95,11 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_DIR/build/hipcc
+cd "$BUILD_DIR/build/hipcc" || exit
echo
echo " -----Running make for hipcc ---- "
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -123,11 +117,11 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_DIR/build/hipcc
+ cd "$BUILD_DIR/build/hipcc" || exit
echo
echo " -----Installing to $INSTALL_HIPCC ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
diff --git a/bin/build_hipfort.sh b/bin/build_hipfort.sh
index b371c4cb80..83e584bbf4 100755
--- a/bin/build_hipfort.sh
+++ b/bin/build_hipfort.sh
@@ -28,9 +28,9 @@
# SOFTWARE.
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
REPO_DIR=$AOMP_REPOS/hipfort
@@ -47,60 +47,53 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $REPO_DIR ] ; then
+if [ ! -d "$REPO_DIR" ] ; then
echo "ERROR: Missing repository $REPO_DIR/"
exit 1
fi
-if [ ! -f $AOMP/bin/clang ] ; then
- if [ ! -f $AOMP/lib/llvm/bin/clang ] ; then
+if [ ! -f "$AOMP/bin/clang" ] ; then
+ if [ ! -f "$AOMP/lib/llvm/bin/clang" ] ; then
echo "ERROR: Missing file $AOMP/lib/llvm/bin/clang"
echo " "
exit 1
fi
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $HIPFORT_INSTALL_DIR
- $SUDO touch $HIPFORT_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $HIPFORT_INSTALL_DIR"
- exit 1
- fi
- $SUDO rm $HIPFORT_INSTALL_DIR/testfile
-fi
+check_writable_installdir "$1" "$HIPFORT_INSTALL_DIR"
-patchrepo $AOMP_REPOS/hipfort
+patchrepo "$AOMP_REPOS/hipfort"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/hipfort" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/hipfort
- rm -rf $BUILD_DIR/build/hipfort
+ echo "rm -rf $BUILD_DIR/build/hipfort"
+ rm -rf "$BUILD_DIR/build/hipfort"
fi
- MYCMAKEOPTS=" \
--DCMAKE_INSTALL_PREFIX=$HIPFORT_INSTALL_DIR \
--DCMAKE_BUILD_TYPE=Release \
--DHIPFORT_COMPILER=$LLVM_INSTALL_LOC/bin/flang \
--DHIPFORT_COMPILER_FLAGS="-cpp" \
--DCMAKE_Fortran_FLAGS_DEBUG="" \
--DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/cmake \
--DHIPFORT_AR=$LLVM_INSTALL_LOC/bin/llvm-ar \
--DHIPFORT_RANLIB=$LLVM_INSTALL_LOC/bin/llvm-ranlib "
-
- mkdir -p $BUILD_DIR/build/hipfort
- cd $BUILD_DIR/build/hipfort
+ declare -a MYCMAKEOPTS
+
+ MYCMAKEOPTS=(-DCMAKE_INSTALL_PREFIX="$HIPFORT_INSTALL_DIR"
+ -DCMAKE_BUILD_TYPE=Release
+ -DHIPFORT_COMPILER="$LLVM_INSTALL_LOC/bin/flang"
+ -DHIPFORT_COMPILER_FLAGS="-cpp"
+ -DCMAKE_Fortran_FLAGS_DEBUG=""
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake"
+ -DHIPFORT_AR="$LLVM_INSTALL_LOC/bin/llvm-ar"
+ -DHIPFORT_RANLIB="$LLVM_INSTALL_LOC/bin/llvm-ranlib")
+
+ mkdir -p "$BUILD_DIR/build/hipfort"
+ cd "$BUILD_DIR/build/hipfort" || exit
echo
echo " -----Running hipfort cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS -DCMAKE_Fortran_FLAGS="-ffree-form -fPIC" $REPO_DIR
- ${AOMP_CMAKE} $MYCMAKEOPTS -DCMAKE_Fortran_FLAGS="-ffree-form -fPIC" $REPO_DIR
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" -DCMAKE_Fortran_FLAGS=\"-ffree-form -fPIC\" "$REPO_DIR"
- if [ $? != 0 ] ; then
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ -DCMAKE_Fortran_FLAGS="-ffree-form -fPIC" \
+ "$REPO_DIR"; then
echo "ERROR hipfort cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -109,11 +102,11 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_DIR/build/hipfort
+cd "$BUILD_DIR/build/hipfort" || exit
echo
echo " -----Running make for hipfort ---- "
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -131,13 +124,12 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_DIR/build/hipfort
+ cd "$BUILD_DIR/build/hipfort" || exit
echo
echo " -----Installing to $HIPFORT_INSTALL_DIR ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
- removepatch $AOMP_REPOS/hipfort
+ removepatch "$AOMP_REPOS/hipfort"
fi
diff --git a/bin/build_hipify.sh b/bin/build_hipify.sh
new file mode 100755
index 0000000000..e2b835f686
--- /dev/null
+++ b/bin/build_hipify.sh
@@ -0,0 +1,135 @@
+#!/bin/bash
+# MIT License
+#
+# Copyright (c) 2019 Advanced Micro Devices, Inc. All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, sublicense, and/or sell copies
+# of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# --- Start standard header to set AOMP environment variables ----
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
+# --- end standard header ----
+
+HIPIFY_REPO_DIR=$AOMP_REPOS/hipify
+
+BUILD_DIR=${BUILD_AOMP}
+
+BUILDTYPE="Release"
+
+INSTALL_HIPIFY=${INSTALL_HIPIFY:-$AOMP_INSTALL_DIR}
+
+if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
+ echo " "
+ echo "Example commands and actions: "
+ echo " ./build_hipify.sh cmake, make, NO Install "
+ echo " ./build_hipify.sh nocmake NO cmake, make, NO install "
+ echo " ./build_hipify.sh install NO Cmake, make install "
+ echo " "
+ exit
+fi
+
+if [ ! -d "$HIPIFY_REPO_DIR" ] ; then
+ echo "ERROR: Missing repository $HIPIFY_REPO_DIR/"
+ exit 1
+fi
+
+if [ ! -f "$LLVM_INSTALL_LOC"/bin/clang ] ; then
+ echo "ERROR: Missing file $LLVM_INSTALL_LOC/bin/clang"
+ echo " Build and install the AOMP clang compiler in $AOMP first"
+ echo " This is needed to build hipify "
+ echo " "
+ exit 1
+fi
+
+# Make sure we can update the install directory
+if [ "$1" == "install" ] ; then
+ $SUDO mkdir -p "$INSTALL_HIPIFY"
+ if ! $SUDO touch "$INSTALL_HIPIFY"/testfile; then
+ echo "ERROR: No update access to $INSTALL_HIPIFY"
+ exit 1
+ fi
+ $SUDO rm "$INSTALL_HIPIFY"/testfile
+fi
+
+if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
+
+ if [ -d "$BUILD_DIR"/build/hipify ] ; then
+ echo
+ echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
+ echo "rm -rf $BUILD_DIR/build/hipify"
+ rm -rf "$BUILD_DIR"/build/hipify
+ fi
+
+ declare -a MYCMAKEOPTS
+
+ MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILDTYPE"
+ -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR"
+ -DCMAKE_PREFIX_PATH="$LLVM_INSTALL_LOC"
+ -DHIPIFY_INSTALL_CLANG_HEADERS=OFF
+ -DLLVM_EXTERNAL_LIT="$LLVM_INSTALL_LOC/bin/llvm-lit")
+
+ mkdir -p "$BUILD_DIR"/build/hipify
+ cd "$BUILD_DIR"/build/hipify || exit
+
+ echo
+ echo " -----Running cmake ---- "
+ echo "${AOMP_CMAKE}" "${MYCMAKEOPTS[@]}" "$HIPIFY_REPO_DIR"
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$HIPIFY_REPO_DIR"; then
+ echo "ERROR hipify cmake failed. Cmake flags"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
+ exit 1
+ fi
+fi
+
+if [ "$1" = "cmake" ]; then
+ exit 0
+fi
+
+cd "$BUILD_DIR"/build/hipify || exit
+echo
+echo " -----Running make for hipify ---- "
+if ! make -j "$AOMP_JOB_THREADS"; then
+ echo " "
+ echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
+ echo "To restart:"
+ echo " cd $BUILD_DIR/build/hipify"
+ echo " make "
+ exit 1
+else
+ if [ "$1" != "install" ] ; then
+ echo
+ echo " BUILD COMPLETE! To install hipify component run this command:"
+ echo " $0 install"
+ echo
+ fi
+fi
+
+# ----------- Install only if asked ----------------------------
+if [ "$1" == "install" ] ; then
+ cd "$BUILD_DIR"/build/hipify || exit
+ echo
+ echo " -----Installing to $INSTALL_HIPIFY ----- "
+ if ! $SUDO make install; then
+ echo "ERROR make install failed "
+ exit 1
+ fi
+fi
diff --git a/bin/build_libdevice.sh b/bin/build_libdevice.sh
index 8e861b14db..511bfe4167 100755
--- a/bin/build_libdevice.sh
+++ b/bin/build_libdevice.sh
@@ -5,9 +5,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
# We now pickup HSA from the AOMP install directory because it is built
@@ -20,62 +20,66 @@ INSTALL_DIR=$INSTALL_ROOT_DIR
export LLVM_DIR=$AOMP_INSTALL_DIR
export LLVM_BUILD=$AOMP_INSTALL_DIR
-SOURCEDIR=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_LIBDEVICE_REPO_NAME
REPO_DIR=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_LIBDEVICE_REPO_NAME
-MYCMAKEOPTS="-DLLVM_DIR=$LLVM_DIR -DCMAKE_INSTALL_LIBDIR=lib"
+declare -a MYCMAKEOPTS
-if [ ! -d $AOMP_INSTALL_DIR/lib ] ; then
+MYCMAKEOPTS=(-DLLVM_DIR="$LLVM_DIR" -DCMAKE_INSTALL_LIBDIR=lib)
+
+if [ ! -d "$AOMP_INSTALL_DIR/lib" ]; then
echo "ERROR: Directory $AOMP/lib is missing"
echo " AOMP must be installed in $AOMP_INSTALL_DIR to continue"
exit 1
fi
export LLVM_BUILD HSA_DIR
-export PATH=$LLVM_BUILD/bin:$PATH
+export PATH="$LLVM_BUILD/bin":$PATH
-patchrepo $REPO_DIR
+patchrepo "$REPO_DIR"
-if [ "$1" != "install" && "$1" != "nocmake" ]; then
+if [ "$1" != "install" ] && [ "$1" != "nocmake" ]; then
builddir_libdevice=$BUILD_DIR/build/libdevice
- if [ -d $builddir_libdevice ] ; then
- echo rm -rf $builddir_libdevice
+ if [ -d "$builddir_libdevice" ]; then
+ echo rm -rf "$builddir_libdevice"
# need SUDO because a previous make install was done with sudo
- $SUDO rm -rf $builddir_libdevice
+ $SUDO rm -rf "$builddir_libdevice"
fi
- mkdir -p $builddir_libdevice
- cd $builddir_libdevice
+ mkdir -p "$builddir_libdevice"
+ cd "$builddir_libdevice" || exit
echo
- echo DOING BUILD in Directory $builddir_libdevice
+ echo "DOING BUILD in Directory $builddir_libdevice"
echo
CC="$LLVM_BUILD/bin/clang"
export CC
- echo "${AOMP_CMAKE} $MYCMAKEOPTS -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_LIBDEVICE_REPO_NAME"
- ${AOMP_CMAKE} $MYCMAKEOPTS -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_LIBDEVICE_REPO_NAME
- if [ $? != 0 ] ; then
- echo "ERROR cmake failed command was \n"
- echo " ${AOMP_CMAKE} $MYCMAKEOPTS -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $BUILD_DIR/$AOMP_LIBDEVICE_REPO_NAME"
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ "-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_LIBDEVICE_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/$AOMP_LIBDEVICE_REPO_NAME"; then
+ echo "ERROR cmake failed command was:"
+ echo " ${AOMP_CMAKE} $(shquot "${MYCMAKEOPTS[@]}") -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $BUILD_DIR/$AOMP_LIBDEVICE_REPO_NAME"
exit 1
fi
fi
if [ "$1" = "cmake" ]; then
- removepatch $REPO_DIR
+ removepatch "$REPO_DIR"
exit 0
fi
if [ "$1" != "install" ]; then
echo "make -j $AOMP_JOB_THREADS"
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo "ERROR make failed "
exit 1
fi
-
echo
echo " Done with all makes"
echo " Please run ./build_libdevice.sh install "
@@ -83,7 +87,7 @@ if [ "$1" != "install" ]; then
if [ "$SKIPTEST" != "YES" ] ; then
builddir_libdevice=$BUILD_DIR/build/libdevice
- cd $builddir_libdevice
+ cd "$builddir_libdevice" || exit
echo "running tests in $builddir_libdevice"
make test
echo
@@ -95,14 +99,14 @@ fi
if [ "$1" == "install" ] ; then
echo
- echo mkdir -p $INSTALL_DIR/include
- $SUDO mkdir -p $INSTALL_DIR/include
- $SUDO mkdir -p $INSTALL_DIR/lib
+ echo mkdir -p "$INSTALL_DIR/include"
+ $SUDO mkdir -p "$INSTALL_DIR/include"
+ $SUDO mkdir -p "$INSTALL_DIR/lib"
builddir_libdevice=$BUILD_DIR/build/libdevice
echo "running make install from $builddir_libdevice"
- cd $builddir_libdevice
- echo $SUDO make -j $AOMP_JOB_THREADS install
- $SUDO make -j $AOMP_JOB_THREADS install
+ cd "$builddir_libdevice" || exit
+ echo "$SUDO make -j $AOMP_JOB_THREADS install"
+ $SUDO make -j "$AOMP_JOB_THREADS" install
# rocm-device-lib cmake installs to lib dir, move all bc files up one level
# and cleanup unused oclc_isa_version bc files and link correct one
@@ -120,5 +124,5 @@ if [ "$1" == "install" ] ; then
echo
echo " $0 Installation complete into $INSTALL_DIR"
echo
- removepatch $REPO_DIR
+ removepatch "$REPO_DIR"
fi
diff --git a/bin/build_llvm-classic.sh b/bin/build_llvm-classic.sh
index 2cb1cb8b13..9c456233dc 100755
--- a/bin/build_llvm-classic.sh
+++ b/bin/build_llvm-classic.sh
@@ -1,5 +1,9 @@
#!/bin/bash
#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
# build_llvm-classic.sh: Script to build the classic LLVM used by flang-classic. binary driver
# This driver will never call flang -fc1, it only calls binaries
# clang, flang1, flang2, built elsewhere
@@ -12,12 +16,12 @@
BUILD_TYPE=${BUILD_TYPE:-Release}
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
-if [ $AOMP_BUILD_FLANG_CLASSIC == 0 ] ; then
+if [ "$AOMP_BUILD_FLANG_CLASSIC" == 0 ] ; then
if [ "$1" != "install" ] ; then
echo "WARNING: ROCM install for $AOMP_FLANG_CLASSIC_REL/llvm-classic not found."
echo " This build will skip build of flang-classic."
@@ -27,29 +31,23 @@ if [ $AOMP_BUILD_FLANG_CLASSIC == 0 ] ; then
fi
TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}X86"
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
- standalone_word="_STANDALONE"
-else
- standalone_word=""
-fi
-
if [ "$AOMP_USE_NINJA" == 0 ] ; then
- AOMP_SET_NINJA_GEN=""
+ AOMP_SET_NINJA_GEN=()
else
- AOMP_SET_NINJA_GEN="-G Ninja"
+ AOMP_SET_NINJA_GEN=(-G Ninja)
fi
-osversion=$(cat /etc/os-release | grep -e ^VERSION_ID)
-if [[ $osversion =~ '"7.' ]] || [[ $osversion =~ '"8' ]]; then
- _cxx_flag="-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0'"
+osversion=$(grep -e ^VERSION_ID < /etc/os-release)
+if [[ $osversion =~ \"7\. ]] || [[ $osversion =~ \"8\. ]]; then
+ _cxx_flag=(-DCMAKE_CXX_FLAGS='-D_GLIBCXX_USE_CXX11_ABI=0')
else
- _cxx_flag=""
+ _cxx_flag=()
fi
# Legacy Flang dosen't support building of compiler-rt so it
# utilizes the clang runtime libraries build/install using build_project.sh.
# The LLVM_VERSION_MAJOR of classic flang driver has to match with the clang
# binaries generated from build_project.sh.
-LLVM_VERSION_MAJOR=$(${LLVM_INSTALL_LOC}/bin/clang --version | grep -oP '(?<=clang version )[0-9]+')
+LLVM_VERSION_MAJOR=$("${LLVM_INSTALL_LOC}"/bin/clang --version | grep -oP '(?<=clang version )[0-9]+')
# We need a version of ROCM llvm that supports flang-classic
# via the link from flang to clang. rocm 5.5 would be best.
@@ -69,58 +67,48 @@ AOMP_LFL_DIR=${AOMP_LFL_DIR:-"17.0-4"}
# comment out above line and uncomment next line for new LFL
#AOMP_LFL_DIR=${AOMP_LFL_DIR:-17.0-4}
-LLVMCMAKEOPTS="\
--DLLVM_ENABLE_PROJECTS=clang \
--DCMAKE_BUILD_TYPE=Release \
--DLLVM_ENABLE_ASSERTIONS=ON \
--DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD \
--DCLANG_DEFAULT_LINKER=lld \
--DLLVM_VERSION_MAJOR="$LLVM_VERSION_MAJOR" \
--DLLVM_INCLUDE_BENCHMARKS=0 \
--DLLVM_INCLUDE_RUNTIMES=0 \
--DLLVM_INCLUDE_EXAMPLES=0 \
--DLLVM_INCLUDE_TESTS=0 \
--DLLVM_INCLUDE_DOCS=0 \
--DLLVM_INCLUDE_UTILS=0 \
--DCLANG_DEFAULT_PIE_ON_LINUX=0 \
--DLLVM_ENABLE_ZSTD=OFF \
-$_cxx_flag \
-$AOMP_SET_NINJA_GEN"
+declare -a LLVMCMAKEOPTS
+
+LLVMCMAKEOPTS=(-DLLVM_ENABLE_PROJECTS=clang
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD"
+ -DCLANG_DEFAULT_LINKER=lld
+ -DLLVM_VERSION_MAJOR="$LLVM_VERSION_MAJOR"
+ -DLLVM_INCLUDE_BENCHMARKS=0
+ -DLLVM_INCLUDE_RUNTIMES=0
+ -DLLVM_INCLUDE_EXAMPLES=0
+ -DLLVM_INCLUDE_TESTS=0
+ -DLLVM_INCLUDE_DOCS=0
+ -DLLVM_INCLUDE_UTILS=0
+ -DCLANG_DEFAULT_PIE_ON_LINUX=0
+ -DLLVM_ENABLE_ZSTD=OFF
+ "${_cxx_flag[@]}"
+ "${AOMP_SET_NINJA_GEN[@]}")
if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
help_build_aomp
fi
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
- if [ ! -L $AOMP ] ; then
- if [ -d $AOMP ] ; then
- echo "ERROR: Directory $AOMP is a physical directory."
- echo " It must be a symbolic link or not exist"
- exit 1
- fi
- fi
-fi
-
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $AOMP_INSTALL_DIR
- $SUDO touch $AOMP_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $AOMP_INSTALL_DIR"
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
+ if [ ! -L "$AOMP" ] && [ -d "$AOMP" ] ; then
+ echo "ERROR: Directory $AOMP is a physical directory."
+ echo " It must be a symbolic link or not exist"
exit 1
fi
- $SUDO rm $AOMP_INSTALL_DIR/testfile
fi
+check_writable_installdir "$1" "$AOMP_INSTALL_DIR"
+
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- rm -rf $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic
- mkdir -p $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR
- mkdir -p $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic
+ rm -rf "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic"
+ mkdir -p "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR"
+ mkdir -p "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic"
else
- if [ ! -d $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR ] ; then
+ if [ ! -d "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR" ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR does not exist"
echo " run $0 without nocmake or install options. "
exit 1
@@ -129,13 +117,14 @@ fi
# Cmake for llvm classic (ROCm 5.5).
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
- cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic
+ cd "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic" || exit
echo " -----Running cmake ---- "
- echo ${AOMP_CMAKE} $LLVMCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR/llvm-classic/llvm
- ${AOMP_CMAKE} $LLVMCMAKEOPTS $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR/llvm-classic/llvm 2>&1
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "${LLVMCMAKEOPTS[@]}" "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR/llvm-classic/llvm"
+
+ if ! ${AOMP_CMAKE} "${LLVMCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/flang-classic/$AOMP_LFL_DIR/llvm-classic/llvm" 2>&1; then
echo "ERROR cmake failed. Cmake flags"
- echo " $LLVMCMAKEOPTS"
+ echo " $(shquot "${LLVMCMAKEOPTS[@]}")"
exit 1
fi
echo
@@ -147,9 +136,9 @@ fi
# Build llvm classic.
echo " --- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic ---- "
-cd $BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic
-$AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+cd "$BUILD_DIR/build/flang-classic/$AOMP_LFL_DIR/llvm-classic" || exit
+
+if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
diff --git a/bin/build_llvm-flang-rt-host-dev.sh b/bin/build_llvm-flang-rt-host-dev.sh
index 740d8355dd..7889872cb2 100755
--- a/bin/build_llvm-flang-rt-host-dev.sh
+++ b/bin/build_llvm-flang-rt-host-dev.sh
@@ -13,11 +13,15 @@
# https://github.com/llvm/llvm-project/blob/main/flang/docs/GettingStarted.md
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
+# for TheRock to override with amd-llvm
+export AOMP_NAME_LLVM_PROJECT=${AOMP_NAME_LLVM_PROJECT:-llvm-project}
+export BUILD_AOMP_SUBDIR=${BUILD_AOMP_SUBDIR:-build/llvm-project}
+
echo "-----------------------------------------------------------------------------"
echo "Building flang-runtime for device"
echo "AOMP = $AOMP"
@@ -35,29 +39,32 @@ if [ -z ${AOMP_REPOS+x} ]; then
echo "Error: AOMP_REPOS must be defined"
exit 0
fi
-if [ ! -x $CMAKE_C_COMPILER ]; then
+if [ ! -x "$CMAKE_C_COMPILER" ]; then
# try again by adding the llvm subdirectory
AOMP="$AOMP/llvm"
CMAKE_C_COMPILER="$AOMP/bin/clang"
CMAKE_CXX_COMPILER="$AOMP/bin/clang++"
- if [ ! -x $CMAKE_C_COMPILER ]; then
+ if [ ! -x "$CMAKE_C_COMPILER" ]; then
echo "Error: $CMAKE_C_COMPILER not found"
exit 0
fi
fi
-if [ ! -x $CMAKE_CXX_COMPILER ]; then
+if [ ! -x "$CMAKE_CXX_COMPILER" ]; then
echo "Error: $CMAKE_CXX_COMPILER not found"
exit 0
fi
-BUILD_DIR=$BUILD_AOMP/build/llvm-project
+BUILD_DIR=$BUILD_AOMP/$BUILD_AOMP_SUBDIR
BUILD_DIR_FRT=$BUILD_AOMP/build/flang-runtime/flang-rt/lib
OMPRUNTIME_DIR=$BUILD_DIR/runtimes/runtimes-bins/openmp/runtime/src
-INSTALL_DIR=$AOMP
+INSTALL_DIR=${INSTALL_DIR:-$AOMP}
+SUFFIX=${SUFFIX:-}
# generate ARCH_LIST from GFXLIST
-ARCH_LIST=`echo $GFXLIST | tr ' ' ','`
+ARCH_LIST=$(echo "$GFXLIST" | tr ' ' ',')
+#BUILD_TYPE=${BUILD_TYPE:-Release} # note: hits backend assert
+BUILD_TYPE=${BUILD_TYPE:-}
echo "BUILD_DIR = $BUILD_DIR"
echo "BUILD_DIR_FRT = $BUILD_DIR_FRT"
@@ -66,48 +73,54 @@ echo "INSTALL_DIR = $INSTALL_DIR"
echo "CMAKE_C_COMPILER = $CMAKE_C_COMPILER"
echo "CMAKE_CXX_COMPILER = $CMAKE_CXX_COMPILER"
echo "GFXLIST = $GFXLIST"
+echo "BUILD_TYPE = $BUILD_TYPE"
+echo "SUFFIX = $SUFFIX"
echo "Sleeping 5 sec..."
sleep 5
-mkdir -p $BUILD_AOMP
-cd $BUILD_AOMP
+mkdir -p "$BUILD_AOMP"
+cd "$BUILD_AOMP" || exit
mkdir -p build
-cd build
+cd build || exit
rm -rf flang-runtime
mkdir flang-runtime
-cd flang-runtime
+cd flang-runtime || exit
if [ "$AOMP_USE_NINJA" == 0 ] ; then
- AOMP_SET_NINJA_GEN=""
+ AOMP_SET_NINJA_GEN=()
else
- AOMP_SET_NINJA_GEN="-G Ninja"
+ AOMP_SET_NINJA_GEN=(-G Ninja)
fi
# Notes:
# -DFLANG_RT_INCLUDE_TESTS=OFF # avoids needing CUDA toolchain
#
-${AOMP_CMAKE} $AOMP_SET_NINJA_GEN \
+if [ ${BUILD_TYPE+x} ]; then
+ CM_BUILD_TYPE="-DCMAKE_BUILD_TYPE='$BUILD_TYPE'"
+fi
+${AOMP_CMAKE} "${AOMP_SET_NINJA_GEN[@]}" $CM_BUILD_TYPE \
-DLLVM_ENABLE_RUNTIMES=flang-rt \
-DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT="OpenMP" \
-DFLANG_RT_INCLUDE_TESTS=OFF \
- -DCMAKE_C_COMPILER=$CMAKE_C_COMPILER \
- -DCMAKE_CXX_COMPILER=$CMAKE_CXX_COMPILER \
+ -DCMAKE_C_COMPILER="$CMAKE_C_COMPILER" \
+ -DCMAKE_CXX_COMPILER="$CMAKE_CXX_COMPILER" \
-DFLANG_RT_DEVICE_ARCHITECTURES="$ARCH_LIST" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
- $AOMP_REPOS/llvm-project/runtimes
+ -DFLANG_RT_EMBED_GPU_LLVM_IR=OFF \
+ "$AOMP_REPOS/$AOMP_NAME_LLVM_PROJECT/runtimes"
$AOMP_NINJA_BIN --version
-$AOMP_NINJA_BIN -j $AOMP_JOB_THREADS flang-rt
+$AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS" flang-rt
mystat=$?
-allstat=$(($allstat+$mystat))
+allstat=$((allstat+mystat))
echo "status: $mystat"
-cmd="cp $BUILD_DIR_FRT/libflang_rt.runtime.a $INSTALL_DIR/lib/libflang_rt.hostdevice.a"
-echo $cmd
+cmd="cp $BUILD_DIR_FRT/libflang_rt.runtime.a $INSTALL_DIR/lib/libflang_rt.hostdevice${SUFFIX}.a"
+echo "$cmd"
$cmd
mystat=$?
-allstat=$(($allstat+$mystat))
+allstat=$((allstat+mystat))
echo "status: $mystat"
echo "allstat: $allstat"
diff --git a/bin/build_llvm_runtimes_standalone.sh b/bin/build_llvm_runtimes_standalone.sh
new file mode 100755
index 0000000000..3346b57b24
--- /dev/null
+++ b/bin/build_llvm_runtimes_standalone.sh
@@ -0,0 +1,533 @@
+#!/bin/bash
+#
+# build_llvm_runtimes_standalone.sh: Script to build the AOMP runtime libraries and debug libraries.
+# This script will install in location defined by AOMP env variable
+#
+
+# --- Start standard header to set AOMP environment variables ----
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
+# --- end standard header ----
+
+if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
+ help_build_aomp
+fi
+
+REPO_DIR=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME
+_ompd_src_dir="$LLVM_INSTALL_LOC/share/gdb/python/ompd/src"
+OPENMP_BUILD_DEVICERTL=${OPENMP_BUILD_DEVICERTL:-0}
+RUNTIMES_BUILD_DIR=${RUNTIMES_BUILD_DIR:-"llvm_runtimes_standalone"}
+
+if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
+ CUDAH=$(find "$CUDAT" -type f,l -name "cuda.h" 2>/dev/null)
+ if [ "$CUDAH" == "" ] ; then
+ CUDAH=$(find "$CUDAINCLUDE" -type f,l -name "cuda.h" 2>/dev/null)
+ fi
+ if [ "$CUDAH" == "" ] ; then
+ echo
+ echo "ERROR: THE cuda.h FILE WAS NOT FOUND WITH ARCH $AOMP_PROC"
+ echo " A CUDA installation is necessary to build libomptarget deviceRTLs"
+ echo " Please install CUDA to build llvm_runtimes_standalone"
+ echo
+ exit 1
+ fi
+ # I don't see now nvcc is called, but this eliminates the deprecated warnings
+ export CUDAFE_FLAGS="-w"
+fi
+
+if [ ! -d "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME" ] ; then
+ echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME "
+ echo " Consider setting env variables AOMP_REPOS and/or AOMP_PROJECT_REPO_NAME "
+ exit 1
+fi
+
+check_writable_installdir "$1" "$LLVM_INSTALL_LOC"
+
+if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
+ if [ -f "$CUDABIN/nvcc" ] ; then
+ CUDAVER=$("$CUDABIN"/nvcc --version | grep compilation | cut -d" " -f5 | cut -d"." -f1)
+ echo "CUDA VERSION IS $CUDAVER"
+ fi
+fi
+
+if [ "$AOMP_USE_NINJA" == 0 ] ; then
+ AOMP_SET_NINJA_GEN=()
+else
+ AOMP_SET_NINJA_GEN=(-G Ninja)
+fi
+
+export LLVM_DIR=$AOMP_INSTALL_DIR
+GFXSEMICOLONS=$(echo "$GFXLIST" | tr ' ' ';')
+ALTAOMP=${ALTAOMP:-$LLVM_INSTALL_LOC}
+
+LLVM_VERSION_MAJOR=$("${LLVM_INSTALL_LOC}"/bin/clang --version | grep -oP '(?<=clang version )[0-9]+')
+
+declare -a COMMON_CMAKE_OPTS
+
+COMMON_CMAKE_OPTS=("${AOMP_SET_NINJA_GEN[@]}" -DOPENMP_ENABLE_LIBOMPTARGET=1
+ -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC"
+ -DOPENMP_TEST_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DOPENMP_TEST_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++"
+ -DCMAKE_C_COMPILER="$ALTAOMP/bin/clang"
+ -DCMAKE_CXX_COMPILER="$ALTAOMP/bin/clang++"
+ -DLIBOMPTARGET_AMDGCN_GFXLIST="$GFXSEMICOLONS"
+ -DLIBOMPTARGET_ENABLE_DEBUG=ON
+ -DDEVICELIBS_ROOT="$DEVICELIBS_ROOT"
+ -DLIBOMP_COPY_EXPORTS=OFF
+ -DLIBOMPTEST_INSTALL_COMPONENTS=ON
+ -DLLVM_DIR="$LLVM_DIR"
+ -DLIBOMPTEST_BUILD_STANDALONE=1 -DLIBOMPTARGET_BUILD_DEVICE_FORTRT=On)
+
+LLVM_RUNTIMES="openmp"
+if [ "$OPENMP_BUILD_DEVICERTL" -eq 1 ]; then
+ if [ -f "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/device/CMakeLists.txt" ]; then
+ LLVM_RUNTIMES=openmp
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_DEFAULT_TARGET_TRIPLE=amdgcn-amd-amdhsa
+ -DLLVM_ENABLE_RUNTIMES="$LLVM_RUNTIMES")
+ fi
+fi
+
+COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_BINARY_DIR="$LLVM_INSTALL_LOC"
+ -DLLVM_ENABLE_RUNTIMES="$LLVM_RUNTIMES"
+ -DCLANG_VERSION_MAJOR="$LLVM_VERSION_MAJOR")
+
+if [ "$AOMP_STANDALONE_BUILD" == 0 ]; then
+ # For static package builds, set BUILD_SHARED_LIBS to OFF
+ if [ "$STATIC_PKG_DEPS" == "ON" ]; then
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}" -DBUILD_SHARED_LIBS=OFF)
+ fi
+
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_MAIN_INCLUDE_DIR="$LLVM_PROJECT_ROOT/llvm/include"
+ -DLIBOMPTARGET_LLVM_INCLUDE_DIRS="$LLVM_PROJECT_ROOT/llvm/include"
+ -DROCM_DIR="$ROCM_DIR"
+ -DAOMP_STANDALONE_BUILD="$AOMP_STANDALONE_BUILD"
+ -DCMAKE_MODULE_PATH="$LLVM_PROJECT_ROOT/llvm/cmake/modules")
+else
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_MAIN_INCLUDE_DIR="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include"
+ -DLIBOMPTARGET_LLVM_INCLUDE_DIRS="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include"
+ -DCMAKE_MODULE_PATH="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/cmake/modules"
+ -DLLVM_INSTALL_PREFIX="$LLVM_INSTALL_LOC")
+fi
+
+if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=ON
+ -DLIBOMPTARGET_NVPTX_CUDA_COMPILER="$AOMP/bin/clang++"
+ -DLIBOMPTARGET_NVPTX_BC_LINKER="$AOMP/bin/llvm-link"
+ -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES="$NVPTXGPUS")
+else
+# Need to force CUDA off this way in case cuda is installed in this system
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCUDA_TOOLKIT_ROOT_DIR=OFF)
+fi
+
+# This is how we tell the hsa plugin where to find hsa
+export HSA_RUNTIME_PATH=$ROCM_DIR
+
+# Patch llvm-project with ATD patch customized for amd-staging.
+# WARNING: This patch (ATD_ASO_full.patch) rarely applies cleanly
+# because of its size and constant trunk merges to amd-staging.
+# This is why default is 0 (OFF).
+if [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 1 ] ; then
+ patchrepo "$REPO_DIR"
+fi
+
+declare -a ASAN_CMAKE_OPTS
+
+if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
+ echo " "
+ echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/llvm_runtimes_standalone."
+ echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
+ echo "rm -rf $BUILD_DIR/build/$RUNTIMES_BUILD_DIR"
+ rm -rf "$BUILD_DIR/build/$RUNTIMES_BUILD_DIR"
+ declare -a MYCMAKEOPTS
+ if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ -DCMAKE_BUILD_TYPE=Release "${AOMP_ORIGIN_RPATH[@]}")
+ else
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX/lib/cmake"
+ -DCMAKE_BUILD_TYPE=Release "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
+
+ # XXX: Crude way to detect if we should enable building the mod files with flang.
+ # Is it preferrable to set it from the outside or based on branch name, some other in-tree file?
+ AOMP_BUILD_MODFILES_WITH_FLANG_NEW=0
+ if [ -e "${LLVM_INSTALL_LOC}/bin/flang" ]; then
+ AOMP_BUILD_MODFILES_WITH_FLANG_NEW=1
+ fi
+
+ if [ "$AOMP_BUILD_MODFILES_WITH_FLANG_NEW" == 1 ]; then
+ echo "Building .mod files via: $LLVM_INSTALL_LOC/bin/flang"
+ echo "Installing .mod files to: $LLVM_INSTALL_LOC/include/flang/"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}"
+ -DLIBOMP_FORTRAN_MODULES_COMPILER="$LLVM_INSTALL_LOC/bin/flang"
+ -DLIBOMP_MODULES_INSTALL_PATH="$LLVM_INSTALL_LOC/include/flang/")
+ fi
+ fi
+
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
+ if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}")
+ else
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$ROCM_CMAKECONFIG_PATH;$INSTALL_PREFIX/lib/llvm/lib/asan"
+ -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
+ fi
+ echo " -----Running llvm_runtimes_standalone cmake for asan ---- "
+ mkdir -p "$BUILD_DIR/build/$RUNTIMES_BUILD_DIR/asan"
+ cd "$BUILD_DIR/build/$RUNTIMES_BUILD_DIR/asan" || exit
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DOFFLOAD_LIBDIR_SUFFIX="/asan" \
+ -DLLVM_LIBDIR_SUFFIX="/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/runtimes"
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DOFFLOAD_LIBDIR_SUFFIX="/asan" \
+ -DLLVM_LIBDIR_SUFFIX="/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/runtimes"; then
+ echo "ERROR llvm_runtimes_standalone cmake failed. Cmake flags"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
+ exit 1
+ fi
+ fi
+
+ # Build a dedicatd "performance" version of libomptarget
+ if [ "$AOMP_BUILD_PERF" == "1" ]; then
+ echo "rm -rf $BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf"
+ rm -rf "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ -DLIBOMPTARGET_ENABLE_DEBUG=OFF -DCMAKE_BUILD_TYPE=Release
+ -DLIBOMPTARGET_PERF=ON -DOFFLOAD_LIBDIR_SUFFIX=-perf
+ -DLLVM_LIBDIR_SUFFIX="-perf")
+ mkdir -p "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf"
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf" || exit
+ echo " -----Running llvm_runtimes_standalone cmake for perf ---- "
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/runtimes" \
+ "$(shquot "${AOMP_ORIGIN_RPATH[@]}")"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/runtimes" \
+ "${AOMP_ORIGIN_RPATH[@]}"; then
+ echo "error llvm_runtimes_standalone cmake failed. cmake flags"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
+ exit 1
+ fi
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ -DLIBOMPTARGET_ENABLE_DEBUG=OFF
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DLIBOMPTARGET_PERF=ON -DSANITIZER_AMDGPU=1
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}")
+ echo " -----Running llvm_runtimes_standalone cmake for perf-asan ---- "
+ mkdir -p "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf/asan"
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf/asan" || exit
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-perf/asan" \
+ -DLLVM_LIBDIR_SUFFIX="-perf/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/runtimes"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-perf/asan" \
+ -DLLVM_LIBDIR_SUFFIX="-perf/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/runtimes"; then
+ echo "error llvm_runtimes_standalone cmake failed. cmake flags"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
+ exit 1
+ fi
+ fi
+ fi
+
+ if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
+ _prefix_map=(-fdebug-prefix-map="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload=$_ompd_src_dir/offload")
+
+ declare -a DEBUGCMAKEOPTS
+
+ DEBUGCMAKEOPTS=(-DLIBOMPTARGET_NVPTX_DEBUG=ON
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DCMAKE_BUILD_TYPE=Debug
+ -DROCM_DIR="$ROCM_DIR"
+ -DLIBOMP_ARCH=x86_64
+ -DLIBOMP_OMPT_SUPPORT=ON
+ -DLIBOMP_USE_DEBUGGER=ON
+ -DLIBOMP_CPPFLAGS='-O0'
+ -DLIBOMP_OMPD_SUPPORT=ON
+ -DLIBOMP_OMPT_DEBUG=ON)
+
+ # The 'pip install --system' command is not supported on non-debian systems. This will disable
+ # the system option if the debian_version file is not present.
+ if [ ! -f /etc/debian_version ]; then
+ echo "==> Non-Debian OS, disabling use of pip install --system"
+ DEBUGCMAKEOPTS=("${DEBUGCMAKEOPTS[@]}" -DDISABLE_SYSTEM_NON_DEBIAN=1)
+ fi
+
+ # Redhat 7.6 does not have python36-devel package, which is needed for ompd compilation.
+ # This is acquired through RH Software Collections.
+ if [ -f /opt/rh/rh-python36/enable ]; then
+ echo "==> Using python3.6 out of rh tools."
+ DEBUGCMAKEOPTS=("${DEBUGCMAKEOPTS[@]}"
+ -DPython3_ROOT_DIR=/opt/rh/rh-python36/root/bin
+ -DPYTHON_HEADERS=/opt/rh/rh-python36/root/usr/include/python3.6m)
+ fi
+
+ echo
+ if [ "$SANITIZER" != 1 ] ; then
+ echo "rm -rf $BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug"
+ rm -rf "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug"
+ echo " -----Running llvm_runtimes_standalone cmake for debug ---- "
+ mkdir -p "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug"
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug" || exit
+ if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
+ PREFIX_PATH="-DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}" "${DEBUGCMAKEOPTS[@]}"
+ "${AOMP_DEBUG_ORIGIN_RPATH[@]}")
+ else
+ PREFIX_PATH="-DCMAKE_PREFIX_PATH=$INSTALL_PREFIX/lib/cmake"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}" "${DEBUGCMAKEOPTS[@]}"
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
+ fi
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$PREFIX_PATH" \
+ -DCMAKE_C_FLAGS="$CFLAGS -g" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS -g $(cmquot "${_prefix_map[@]}")" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-debug" \
+ -DLLVM_LIBDIR_SUFFIX="-debug" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/runtimes"; then
+ echo "ERROR llvm_runtimes_standalone debug cmake failed. Cmake flags"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
+ exit 1
+ fi
+ fi
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}" "${DEBUGCMAKEOPTS[@]}"
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DSANITIZER_AMDGPU=1)
+ if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}")
+ else
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$ROCM_CMAKECONFIG_PATH;$INSTALL_PREFIX/lib/llvm/lib/asan"
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
+ fi
+ echo " -----Running llvm_runtimes_standalone cmake for debug-asan ---- "
+ mkdir -p "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug/asan"
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug/asan" || exit
+ echo "${AOMP_CMAKE}" "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-debug/asan" \
+ -DLLVM_LIBDIR_SUFFIX="-debug/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/runtimes"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-debug/asan" \
+ -DLLVM_LIBDIR_SUFFIX="-debug/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/runtimes"; then
+ echo "ERROR llvm_runtimes_standalone debug cmake failed. Cmake flags"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
+ exit 1
+ fi
+ fi
+ fi
+fi
+
+if [ "$1" = "cmake" ]; then
+ exit 0
+fi
+
+if [ "$1" != "install" ] ; then
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ cd "$BUILD_DIR/build/$RUNTIMES_BUILD_DIR/asan" || exit
+ echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/$RUNTIMES_BUILD_DIR/asan ---- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
+ echo " "
+ echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED"
+ echo "To restart:"
+ echo " cd $BUILD_DIR/build/$RUNTIMES_BUILD_DIR/asan"
+ echo " $AOMP_NINJA_BIN"
+ exit 1
+ fi
+ fi
+
+ if [ "$AOMP_BUILD_PERF" == "1" ] ; then
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf" || exit
+ echo
+ echo
+ echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf ---- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
+ echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
+ exit 1
+ fi
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf/asan" || exit
+ echo
+ echo
+ echo " ----- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf/asan ----- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
+ echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
+ exit 1
+ fi
+ fi
+ fi
+
+ if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
+ if [ "$SANITIZER" != 1 ] ; then
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug" || exit
+ echo
+ echo
+ echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug ---- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
+ echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
+ exit 1
+ fi
+ fi
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug/asan" || exit
+ echo
+ echo
+ echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug/asan ---- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
+ echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
+ exit 1
+ fi
+ fi
+ fi
+
+ echo
+ echo "Successful build of ./build_llvm_runtimes_standalone.sh . Please run:"
+ echo " ./build_llvm_runtimes_standalone.sh install "
+ echo
+fi
+
+# ----------- Install only if asked ----------------------------
+if [ "$1" == "install" ] ; then
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ cd "$BUILD_DIR/build/$RUNTIMES_BUILD_DIR/asan" || exit
+ echo
+ echo " -----Installing to $LLVM_INSTALL_LOC/lib/asan ----- "
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
+ echo "ERROR $AOMP_NINJA_BIN install failed "
+ exit 1
+ fi
+ fi
+
+ if [ "$AOMP_BUILD_PERF" == "1" ]; then
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf" || exit
+ echo
+ echo " -----Installing to $LLVM_INSTALL_LOC/lib-perf ----- "
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
+ echo "ERROR $AOMP_NINJA_BIN install failed "
+ exit 1
+ fi
+
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_perf/asan" || exit
+ echo
+ echo " ----- Installing to $LLVM_INSTALL_LOC/lib-perf/asan ----- "
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
+ echo "ERROR $AOMP_NINJA_BIN install failed "
+ exit 1
+ fi
+ fi
+ fi
+
+ if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
+ if [ "$SANITIZER" != 1 ] ; then
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug" || exit
+ echo
+ echo " -----Installing to $LLVM_INSTALL_LOC/lib-debug ---- "
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
+ echo "ERROR $AOMP_NINJA_BIN install failed "
+ exit 1
+ fi
+ fi
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ cd "$BUILD_DIR/build/${RUNTIMES_BUILD_DIR}_debug/asan" || exit
+ echo " -----Installing to $LLVM_INSTALL_LOC/lib-debug/asan ---- "
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
+ echo "ERROR $AOMP_NINJA_BIN install failed "
+ exit 1
+ fi
+ fi
+
+ # Copy selected debugable runtime sources into the installation directory
+ # $_ompd_src_dir directory to satisfy the above CXXOPT -fdebug-prefix-map.
+ $SUDO mkdir -p "$_ompd_src_dir/offload"
+ $SUDO mkdir -p "$_ompd_src_dir/offload/plugins-nextgen"
+ if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
+ _from_dir_src="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload/libomptarget"
+ _from_dir_plugins="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload/plugins-nextgen"
+ else
+ _from_dir_src="$LLVM_PROJECT_ROOT/offload/libomptarget"
+ _from_dir_plugins="$LLVM_PROJECT_ROOT/offload/plugins-nextgen"
+ fi
+ echo cp -rp "$_from_dir_src" "$_ompd_src_dir/offload"
+ $SUDO cp -rp "$_from_dir_src" "$_ompd_src_dir/offload"
+ echo cp -rp "$_from_dir_plugins" "$_ompd_src_dir/offload"
+ $SUDO cp -rp "$_from_dir_plugins" "$_ompd_src_dir/offload"
+
+ # Copy selected debugable runtime sources into the installation $ompd_src_dir/src directory
+ # to satisfy the above -fdebug-prefix-map.
+ $SUDO mkdir -p "$_ompd_src_dir/openmp/runtime"
+ $SUDO mkdir -p "$_ompd_src_dir/openmp/libompd"
+ $SUDO mkdir -p "$_ompd_src_dir/openmp/device"
+ if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
+ $SUDO cp -rp "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/runtime/src" "$_ompd_src_dir/openmp/runtime"
+ $SUDO cp -rp "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libompd/src" "$_ompd_src_dir/openmp/libompd"
+ $SUDO cp -rp "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/device/src" "$_ompd_src_dir/openmp/device"
+ else
+ $SUDO cp -rp "$LLVM_PROJECT_ROOT/openmp/runtime/src" "$_ompd_src_dir/openmp/runtime"
+ $SUDO cp -rp "$LLVM_PROJECT_ROOT/openmp/libompd/src" "$_ompd_src_dir/openmp/libompd"
+ $SUDO cp -rp "$LLVM_PROJECT_ROOT/openmp/device/src" "$_ompd_src_dir/openmp/device"
+ fi
+ fi # end of AOMP_BUILD_DEBUG install block
+
+ if [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 1 ] ; then
+ removepatch "$REPO_DIR"
+ fi
+
+fi # end of install block
+
+# We have to build the deviceRTL by itself as it requires a different target
+if [ "$1" != "install" ] && [ "$OPENMP_BUILD_DEVICERTL" == 0 ] ; then
+ RUNTIMES_BUILD_DIR="llvm_runtimes_standalone-devicertl" OPENMP_BUILD_DEVICERTL=1 $thisdir/build_llvm_runtimes_standalone.sh
+fi
+if [ "$1" == "install" ] && [ "$OPENMP_BUILD_DEVICERTL" == 0 ]; then
+ RUNTIMES_BUILD_DIR="llvm_runtimes_standalone-devicertl" OPENMP_BUILD_DEVICERTL=1 $thisdir/build_llvm_runtimes_standalone.sh install
+fi
diff --git a/bin/build_offload.sh b/bin/build_offload.sh
index 63eb8c09e4..5303a3ee69 100755
--- a/bin/build_offload.sh
+++ b/bin/build_offload.sh
@@ -5,9 +5,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
@@ -18,9 +18,9 @@ REPO_DIR=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME
_ompd_src_dir="$LLVM_INSTALL_LOC/share/gdb/python/ompd/src"
if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
- CUDAH=`find $CUDAT -type f -name "cuda.h" 2>/dev/null`
+ CUDAH=$(find "$CUDAT" -type f,l -name "cuda.h" 2>/dev/null)
if [ "$CUDAH" == "" ] ; then
- CUDAH=`find $CUDAINCLUDE -type f -name "cuda.h" 2>/dev/null`
+ CUDAH=$(find "$CUDAINCLUDE" -type f,l -name "cuda.h" 2>/dev/null)
fi
if [ "$CUDAH" == "" ] ; then
echo
@@ -34,74 +34,69 @@ if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
export CUDAFE_FLAGS="-w"
fi
-if [ ! -d $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME "
echo " Consider setting env variables AOMP_REPOS and/or AOMP_PROJECT_REPO_NAME "
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $LLVM_INSTALL_LOC
- $SUDO touch $LLVM_INSTALL_LOC/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $LLVM_INSTALL_LOC"
- exit 1
- fi
- $SUDO rm $LLVM_INSTALL_LOC/testfile
-fi
+check_writable_installdir "$1" "$LLVM_INSTALL_LOC"
if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
- if [ -f $CUDABIN/nvcc ] ; then
- CUDAVER=`$CUDABIN/nvcc --version | grep compilation | cut -d" " -f5 | cut -d"." -f1 `
+ if [ -f "$CUDABIN/nvcc" ] ; then
+ CUDAVER=$("$CUDABIN"/nvcc --version | grep compilation | cut -d" " -f5 | cut -d"." -f1)
echo "CUDA VERSION IS $CUDAVER"
fi
fi
if [ "$AOMP_USE_NINJA" == 0 ] ; then
- AOMP_SET_NINJA_GEN=""
+ AOMP_SET_NINJA_GEN=()
else
- AOMP_SET_NINJA_GEN="-G Ninja"
+ AOMP_SET_NINJA_GEN=(-G Ninja)
fi
export LLVM_DIR=$AOMP_INSTALL_DIR
-GFXSEMICOLONS=`echo $GFXLIST | tr ' ' ';' `
+GFXSEMICOLONS=$(echo "$GFXLIST" | tr ' ' ';')
ALTAOMP=${ALTAOMP:-$LLVM_INSTALL_LOC}
-COMMON_CMAKE_OPTS="$AOMP_SET_NINJA_GEN -DOPENMP_ENABLE_LIBOMPTARGET=1
--DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_LOC
--DOPENMP_TEST_C_COMPILER=$LLVM_INSTALL_LOC/bin/clang
--DOPENMP_TEST_CXX_COMPILER=$LLVM_INSTALL_LOC/bin/clang++
--DCMAKE_C_COMPILER=$ALTAOMP/bin/clang
--DCMAKE_CXX_COMPILER=$ALTAOMP/bin/clang++
--DLIBOMPTARGET_AMDGCN_GFXLIST=$GFXSEMICOLONS
--DLIBOMPTARGET_ENABLE_DEBUG=ON
--DLLVM_DIR=$LLVM_DIR"
+
+declare -a COMMON_CMAKE_OPTS
+
+COMMON_CMAKE_OPTS=("${AOMP_SET_NINJA_GEN[@]}" -DOPENMP_ENABLE_LIBOMPTARGET=1
+ -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC"
+ -DOPENMP_TEST_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DOPENMP_TEST_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++"
+ -DCMAKE_C_COMPILER="$ALTAOMP/bin/clang"
+ -DCMAKE_CXX_COMPILER="$ALTAOMP/bin/clang++"
+ -DLIBOMPTARGET_AMDGCN_GFXLIST="$GFXSEMICOLONS"
+ -DLIBOMPTARGET_ENABLE_DEBUG=ON
+ -DLLVM_DIR="$LLVM_DIR")
if [ "$AOMP_STANDALONE_BUILD" == 0 ]; then
- COMMON_CMAKE_OPTS="$COMMON_CMAKE_OPTS
- -DLLVM_MAIN_INCLUDE_DIR=$LLVM_PROJECT_ROOT/llvm/include
- -DLIBOMPTARGET_LLVM_INCLUDE_DIRS=$LLVM_PROJECT_ROOT/llvm/include"
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_MAIN_INCLUDE_DIR="$LLVM_PROJECT_ROOT/llvm/include"
+ -DLIBOMPTARGET_LLVM_INCLUDE_DIRS="$LLVM_PROJECT_ROOT/llvm/include")
else
- COMMON_CMAKE_OPTS="$COMMON_CMAKE_OPTS \
- -DLLVM_MAIN_INCLUDE_DIR=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include \
- -DLIBOMPTARGET_LLVM_INCLUDE_DIRS=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include"
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_MAIN_INCLUDE_DIR="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include"
+ -DLIBOMPTARGET_LLVM_INCLUDE_DIRS="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include")
fi
if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
- COMMON_CMAKE_OPTS="$COMMON_CMAKE_OPTS
--DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=ON
--DLIBOMPTARGET_NVPTX_CUDA_COMPILER=$AOMP/bin/clang++
--DLIBOMPTARGET_NVPTX_BC_LINKER=$AOMP/bin/llvm-link
--DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=$NVPTXGPUS"
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=ON
+ -DLIBOMPTARGET_NVPTX_CUDA_COMPILER="$AOMP/bin/clang++"
+ -DLIBOMPTARGET_NVPTX_BC_LINKER="$AOMP/bin/llvm-link"
+ -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES="$NVPTXGPUS")
else
# Need to force CUDA off this way in case cuda is installed in this system
- COMMON_CMAKE_OPTS="$COMMON_CMAKE_OPTS
--DCUDA_TOOLKIT_ROOT_DIR=OFF"
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCUDA_TOOLKIT_ROOT_DIR=OFF)
fi
-if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- LDFLAGS="-fuse-ld=lld $ASAN_FLAGS"
-fi
+#if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
+ #LDFLAGS=$(shquot '-fuse-ld=lld' "${ASAN_FLAGS[@]}")
+ #export LDFLAGS
+#fi
# This is how we tell the hsa plugin where to find hsa
export HSA_RUNTIME_PATH=$ROCM_DIR
@@ -114,145 +109,221 @@ export HSA_RUNTIME_PATH=$ROCM_DIR
# because of its size and constant trunk merges to amd-staging.
# This is why default is 0 (OFF).
if [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 1 ] ; then
- patchrepo $REPO_DIR
+ patchrepo "$REPO_DIR"
fi
+declare -a ASAN_CMAKE_OPTS
+
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo " "
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/offload."
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- echo rm -rf $BUILD_DIR/build/offload
- rm -rf $BUILD_DIR/build/offload
+ echo "rm -rf $BUILD_DIR/build/offload"
+ rm -rf "$BUILD_DIR/build/offload"
+ declare -a MYCMAKEOPTS
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake -DCMAKE_BUILD_TYPE=Release $AOMP_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ -DCMAKE_BUILD_TYPE=Release "${AOMP_ORIGIN_RPATH[@]}")
else
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$INSTALL_PREFIX/lib/cmake -DCMAKE_BUILD_TYPE=Release $OPENMP_EXTRAS_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX/lib/cmake"
+ -DCMAKE_BUILD_TYPE=Release "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
if [ "$AOMP_LEGACY_OPENMP" == "1" ] && [ "$SANITIZER" != 1 ]; then
echo " -----Running offload cmake ---- "
- mkdir -p $BUILD_DIR/build/offload
- cd $BUILD_DIR/build/offload
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload
- ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_DIR/build/offload"
+ cd "$BUILD_DIR/build/offload" || exit
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload"; then
echo "ERROR offload cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- ASAN_CMAKE_OPTS="$COMMON_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF $AOMP_ASAN_ORIGIN_RPATH"
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}")
else
- ASAN_CMAKE_OPTS="$COMMON_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$ROCM_CMAKECONFIG_PATH;$INSTALL_PREFIX/lib/llvm/lib/asan -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF $OPENMP_EXTRAS_ORIGIN_RPATH"
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$ROCM_CMAKECONFIG_PATH;$INSTALL_PREFIX/lib/llvm/lib/asan"
+ -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
echo " -----Running offload cmake for asan ---- "
- mkdir -p $BUILD_DIR/build/offload/asan
- cd $BUILD_DIR/build/offload/asan
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DOFFLOAD_LIBDIR_SUFFIX="/asan" -DLLVM_LIBDIR_SUFFIX="/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DOFFLOAD_LIBDIR_SUFFIX="/asan" -DLLVM_LIBDIR_SUFFIX="/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_DIR/build/offload/asan"
+ cd "$BUILD_DIR/build/offload/asan" || exit
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DOFFLOAD_LIBDIR_SUFFIX="/asan" \
+ -DLLVM_LIBDIR_SUFFIX="/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload"
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DOFFLOAD_LIBDIR_SUFFIX="/asan" \
+ -DLLVM_LIBDIR_SUFFIX="/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload"; then
echo "ERROR offload cmake failed. Cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
# Build a dedicatd "performance" version of libomptarget
if [ "$AOMP_BUILD_PERF" == "1" ]; then
- echo rm -rf $BUILD_DIR/build/offload_perf
- rm -rf $BUILD_DIR/build/offload_perf
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake -DLIBOMPTARGET_ENABLE_DEBUG=OFF -DCMAKE_BUILD_TYPE=Release -DLIBOMPTARGET_PERF=ON -DOFFLOAD_LIBDIR_SUFFIX=-perf -DLLVM_LIBDIR_SUFFIX=-perf"
- mkdir -p $BUILD_DIR/build/offload_perf
- cd $BUILD_DIR/build/offload_perf
+ echo "rm -rf $BUILD_DIR/build/offload_perf"
+ rm -rf "$BUILD_DIR/build/offload_perf"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ -DLIBOMPTARGET_ENABLE_DEBUG=OFF -DCMAKE_BUILD_TYPE=Release
+ -DLIBOMPTARGET_PERF=ON -DOFFLOAD_LIBDIR_SUFFIX=-perf
+ -DLLVM_LIBDIR_SUFFIX="-perf")
+ mkdir -p "$BUILD_DIR/build/offload_perf"
+ cd "$BUILD_DIR/build/offload_perf" || exit
echo " -----Running offload cmake for perf ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload $AOMP_ORIGIN_RPATH
- ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload $AOMP_ORIGIN_RPATH
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload" \
+ "$(shquot "${AOMP_ORIGIN_RPATH[@]}")"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload" \
+ "${AOMP_ORIGIN_RPATH[@]}"; then
echo "error offload cmake failed. cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- ASAN_CMAKE_OPTS="$COMMON_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake -DLIBOMPTARGET_ENABLE_DEBUG=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DLIBOMPTARGET_PERF=ON -DSANITIZER_AMDGPU=1 $AOMP_ASAN_ORIGIN_RPATH"
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ -DLIBOMPTARGET_ENABLE_DEBUG=OFF
+ -DCMAKE_BUILD_TYPE=Release
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DLIBOMPTARGET_PERF=ON -DSANITIZER_AMDGPU=1
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}")
echo " -----Running offload cmake for perf-asan ---- "
- mkdir -p $BUILD_DIR/build/offload_perf/asan
- cd $BUILD_DIR/build/offload_perf/asan
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DOFFLOAD_LIBDIR_SUFFIX="-perf/asan" -DLLVM_LIBDIR_SUFFIX="-perf/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DOFFLOAD_LIBDIR_SUFFIX="-perf/asan" -DLLVM_LIBDIR_SUFFIX="-perf/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_DIR/build/offload_perf/asan"
+ cd "$BUILD_DIR/build/offload_perf/asan" || exit
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-perf/asan" \
+ -DLLVM_LIBDIR_SUFFIX="-perf/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-perf/asan" \
+ -DLLVM_LIBDIR_SUFFIX="-perf/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload"; then
echo "error offload cmake failed. cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
fi
if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
- _prefix_map="\""-fdebug-prefix-map=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload=$_ompd_src_dir/offload"\""
- DEBUGCMAKEOPTS="
--DLIBOMPTARGET_NVPTX_DEBUG=ON \
--DLLVM_ENABLE_ASSERTIONS=ON \
--DCMAKE_BUILD_TYPE=Debug \
--DROCM_DIR=$ROCM_DIR \
--DLIBOMP_ARCH=x86_64 \
--DLIBOMP_OMPT_SUPPORT=ON \
--DLIBOMP_USE_DEBUGGER=ON \
--DLIBOMP_CPPFLAGS='-O0' \
--DLIBOMP_OMPD_SUPPORT=ON \
--DLIBOMP_OMPT_DEBUG=ON"
+ _prefix_map=(-fdebug-prefix-map="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload=$_ompd_src_dir/offload")
+
+ declare -a DEBUGCMAKEOPTS
+
+ DEBUGCMAKEOPTS=(-DLIBOMPTARGET_NVPTX_DEBUG=ON
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DCMAKE_BUILD_TYPE=Debug
+ -DROCM_DIR="$ROCM_DIR"
+ -DLIBOMP_ARCH=x86_64
+ -DLIBOMP_OMPT_SUPPORT=ON
+ -DLIBOMP_USE_DEBUGGER=ON
+ -DLIBOMP_CPPFLAGS='-O0'
+ -DLIBOMP_OMPD_SUPPORT=ON
+ -DLIBOMP_OMPT_DEBUG=ON)
# The 'pip install --system' command is not supported on non-debian systems. This will disable
# the system option if the debian_version file is not present.
if [ ! -f /etc/debian_version ]; then
echo "==> Non-Debian OS, disabling use of pip install --system"
- DEBUGCMAKEOPTS="$DEBUGCMAKEOPTS -DDISABLE_SYSTEM_NON_DEBIAN=1"
+ DEBUGCMAKEOPTS=("${DEBUGCMAKEOPTS[@]}" -DDISABLE_SYSTEM_NON_DEBIAN=1)
fi
# Redhat 7.6 does not have python36-devel package, which is needed for ompd compilation.
# This is acquired through RH Software Collections.
if [ -f /opt/rh/rh-python36/enable ]; then
echo "==> Using python3.6 out of rh tools."
- DEBUGCMAKEOPTS="$DEBUGCMAKEOPTS -DPython3_ROOT_DIR=/opt/rh/rh-python36/root/bin -DPYTHON_HEADERS=/opt/rh/rh-python36/root/usr/include/python3.6m"
+ DEBUGCMAKEOPTS=("${DEBUGCMAKEOPTS[@]}"
+ -DPython3_ROOT_DIR=/opt/rh/rh-python36/root/bin
+ -DPYTHON_HEADERS=/opt/rh/rh-python36/root/usr/include/python3.6m)
fi
echo
if [ "$SANITIZER" != 1 ] ; then
- echo rm -rf $BUILD_DIR/build/offload_debug
- rm -rf $BUILD_DIR/build/offload_debug
+ echo "rm -rf $BUILD_DIR/build/offload_debug"
+ rm -rf "$BUILD_DIR/build/offload_debug"
echo " -----Running offload cmake for debug ---- "
- mkdir -p $BUILD_DIR/build/offload_debug
- cd $BUILD_DIR/build/offload_debug
+ mkdir -p "$BUILD_DIR/build/offload_debug"
+ cd "$BUILD_DIR/build/offload_debug" || exit
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
PREFIX_PATH="-DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS $DEBUGCMAKEOPTS $AOMP_DEBUG_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}" "${DEBUGCMAKEOPTS[@]}"
+ "${AOMP_DEBUG_ORIGIN_RPATH[@]}")
else
PREFIX_PATH="-DCMAKE_PREFIX_PATH=$INSTALL_PREFIX/lib/cmake"
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS $DEBUGCMAKEOPTS $OPENMP_EXTRAS_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}" "${DEBUGCMAKEOPTS[@]}"
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
- ${AOMP_CMAKE} $MYCMAKEOPTS $PREFIX_PATH -DCMAKE_C_FLAGS="$CFLAGS -g" -DCMAKE_CXX_FLAGS="$CXXFLAGS -g $_prefix_map" -DOFFLOAD_LIBDIR_SUFFIX="-debug" -DLLVM_LIBDIR_SUFFIX="-debug" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload
- if [ $? != 0 ] ; then
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$PREFIX_PATH" \
+ -DCMAKE_C_FLAGS="$CFLAGS -g" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS -g $(cmquot "${_prefix_map[@]}")" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-debug" \
+ -DLLVM_LIBDIR_SUFFIX="-debug" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload"; then
echo "ERROR offload debug cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- ASAN_CMAKE_OPTS="$COMMON_CMAKE_OPTS $DEBUGCMAKEOPTS -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DSANITIZER_AMDGPU=1"
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}" "${DEBUGCMAKEOPTS[@]}"
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DSANITIZER_AMDGPU=1)
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- ASAN_CMAKE_OPTS="$ASAN_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake $AOMP_ASAN_ORIGIN_RPATH"
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake;$AOMP_INSTALL_DIR/lib64/cmake"
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}")
else
- ASAN_CMAKE_OPTS="$ASAN_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$ROCM_CMAKECONFIG_PATH;$INSTALL_PREFIX/lib/llvm/lib/asan $OPENMP_EXTRAS_ORIGIN_RPATH"
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$ROCM_CMAKECONFIG_PATH;$INSTALL_PREFIX/lib/llvm/lib/asan"
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
echo " -----Running offload cmake for debug-asan ---- "
- mkdir -p $BUILD_DIR/build/offload_debug/asan
- cd $BUILD_DIR/build/offload_debug/asan
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DOFFLOAD_LIBDIR_SUFFIX="-debug/asan" -DLLVM_LIBDIR_SUFFIX="-debug/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DOFFLOAD_LIBDIR_SUFFIX="-debug/asan" -DLLVM_LIBDIR_SUFFIX="-debug/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_DIR/build/offload_debug/asan"
+ cd "$BUILD_DIR/build/offload_debug/asan" || exit
+ echo "${AOMP_CMAKE}" "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-debug/asan" \
+ -DLLVM_LIBDIR_SUFFIX="-debug/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DOFFLOAD_LIBDIR_SUFFIX="-debug/asan" \
+ -DLLVM_LIBDIR_SUFFIX="-debug/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload"; then
echo "ERROR offload debug cmake failed. Cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
@@ -265,10 +336,9 @@ fi
if [ "$1" != "install" ] ; then
if [ "$AOMP_LEGACY_OPENMP" == "1" ] && [ "$SANITIZER" != 1 ] ; then
- cd $BUILD_DIR/build/offload
+ cd "$BUILD_DIR/build/offload" || exit
echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/offload ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -279,10 +349,10 @@ if [ "$AOMP_LEGACY_OPENMP" == "1" ] && [ "$SANITIZER" != 1 ] ; then
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/offload/asan
+ cd "$BUILD_DIR/build/offload/asan" || exit
echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/offload/asan ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -293,22 +363,22 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
fi
if [ "$AOMP_BUILD_PERF" == "1" ] ; then
- cd $BUILD_DIR/build/offload_perf
+ cd "$BUILD_DIR/build/offload_perf" || exit
echo
echo
echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/offload_perf ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/offload_perf/asan
+ cd "$BUILD_DIR/build/offload_perf/asan" || exit
echo
echo
echo " ----- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/offload_perf/asan ----- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
exit 1
fi
@@ -317,23 +387,23 @@ fi
if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
if [ "$SANITIZER" != 1 ] ; then
- cd $BUILD_DIR/build/offload_debug
+ cd "$BUILD_DIR/build/offload_debug" || exit
echo
echo
echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/offload_debug ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/offload_debug/asan
+ cd "$BUILD_DIR/build/offload_debug/asan" || exit
echo
echo
echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/offload_debug/asan ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
exit 1
fi
@@ -349,43 +419,43 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
if [ "$AOMP_LEGACY_OPENMP" == "1" ] && [ "$SANITIZER" != 1 ] ; then
- cd $BUILD_DIR/build/offload
+ cd "$BUILD_DIR/build/offload" || exit
echo
echo " -----Installing to $LLVM_INSTALL_LOC/lib ----- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/offload/asan
+ cd "$BUILD_DIR/build/offload/asan" || exit
echo
echo " -----Installing to $LLVM_INSTALL_LOC/lib/asan ----- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
fi
if [ "$AOMP_BUILD_PERF" == "1" ]; then
- cd $BUILD_DIR/build/offload_perf
+ cd "$BUILD_DIR/build/offload_perf" || exit
echo
echo " -----Installing to $LLVM_INSTALL_LOC/lib-perf ----- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/offload_perf/asan
+ cd "$BUILD_DIR/build/offload_perf/asan" || exit
echo
echo " ----- Installing to $LLVM_INSTALL_LOC/lib-perf/asan ----- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
@@ -394,20 +464,20 @@ if [ "$1" == "install" ] ; then
if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
if [ "$SANITIZER" != 1 ] ; then
- cd $BUILD_DIR/build/offload_debug
+ cd "$BUILD_DIR/build/offload_debug" || exit
echo
echo " -----Installing to $LLVM_INSTALL_LOC/lib-debug ---- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/offload_debug/asan
+ cd "$BUILD_DIR/build/offload_debug/asan" || exit
echo " -----Installing to $LLVM_INSTALL_LOC/lib-debug/asan ---- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
@@ -415,8 +485,8 @@ if [ "$1" == "install" ] ; then
# Copy selected debugable runtime sources into the installation directory
# $_ompd_src_dir directory to satisfy the above CXXOPT -fdebug-prefix-map.
- $SUDO mkdir -p $_ompd_src_dir/offload
- $SUDO mkdir -p $_ompd_src_dir/offload/plugins-nextgen
+ $SUDO mkdir -p "$_ompd_src_dir/offload"
+ $SUDO mkdir -p "$_ompd_src_dir/offload/plugins-nextgen"
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
_from_dir_src="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload/libomptarget"
_from_dir_plugins="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/offload/plugins-nextgen"
@@ -424,14 +494,14 @@ if [ "$1" == "install" ] ; then
_from_dir_src="$LLVM_PROJECT_ROOT/offload/libomptarget"
_from_dir_plugins="$LLVM_PROJECT_ROOT/offload/plugins-nextgen"
fi
- echo cp -rp $_from_dir_src $_ompd_src_dir/offload
- $SUDO cp -rp $_from_dir_src $_ompd_src_dir/offload
- echo cp -rp $_from_dir_plugins $_ompd_src_dir/offload
- $SUDO cp -rp $_from_dir_plugins $_ompd_src_dir/offload
+ echo cp -rp "$_from_dir_src" "$_ompd_src_dir/offload"
+ $SUDO cp -rp "$_from_dir_src" "$_ompd_src_dir/offload"
+ echo cp -rp "$_from_dir_plugins" "$_ompd_src_dir/offload"
+ $SUDO cp -rp "$_from_dir_plugins" "$_ompd_src_dir/offload"
fi # end of AOMP_BUILD_DEBUG install block
if [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 1 ] ; then
- removepatch $REPO_DIR
+ removepatch "$REPO_DIR"
fi
fi # end of install block
diff --git a/bin/build_openmp.sh b/bin/build_openmp.sh
index 89bbed25cf..0f587bc9ff 100755
--- a/bin/build_openmp.sh
+++ b/bin/build_openmp.sh
@@ -5,9 +5,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
@@ -17,11 +17,13 @@ fi
REPO_DIR=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME
_ompd_src_dir="$LLVM_INSTALL_LOC/share/gdb/python/ompd/src"
_ompd_dir="$LLVM_INSTALL_LOC/share/gdb/python/ompd"
+OPENMP_BUILD_DEVICERTL=${OPENMP_BUILD_DEVICERTL:-0}
+OPENMP_BUILD_DIR=${OPENMP_BUILD_DIR:-"openmp"}
if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
- CUDAH=`find $CUDAT -type f -name "cuda.h" 2>/dev/null`
+ CUDAH=$(find "$CUDAT" -type f,l -name "cuda.h" 2>/dev/null)
if [ "$CUDAH" == "" ] ; then
- CUDAH=`find $CUDAINCLUDE -type f -name "cuda.h" 2>/dev/null`
+ CUDAH=$(find "$CUDAINCLUDE" -type f,l -name "cuda.h" 2>/dev/null)
fi
if [ "$CUDAH" == "" ] ; then
echo
@@ -35,82 +37,85 @@ if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
export CUDAFE_FLAGS="-w"
fi
-if [ ! -d $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME "
echo " Consider setting env variables AOMP_REPOS and/or AOMP_PROJECT_REPO_NAME "
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $LLVM_INSTALL_LOC
- $SUDO touch $LLVM_INSTALL_LOC/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $LLVM_INSTALL_LOC"
- exit 1
- fi
- $SUDO rm $LLVM_INSTALL_LOC/testfile
-fi
+check_writable_installdir "$1" "$LLVM_INSTALL_LOC"
if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
- if [ -f $CUDABIN/nvcc ] ; then
- CUDAVER=`$CUDABIN/nvcc --version | grep compilation | cut -d" " -f5 | cut -d"." -f1 `
+ if [ -f "$CUDABIN/nvcc" ] ; then
+ CUDAVER=$("$CUDABIN"/nvcc --version | grep compilation | cut -d" " -f5 | cut -d"." -f1)
echo "CUDA VERSION IS $CUDAVER"
fi
fi
if [ "$AOMP_USE_NINJA" == 0 ] ; then
- AOMP_SET_NINJA_GEN=""
+ AOMP_SET_NINJA_GEN=()
else
- AOMP_SET_NINJA_GEN="-G Ninja"
+ AOMP_SET_NINJA_GEN=(-G Ninja)
fi
export LLVM_DIR=$AOMP_INSTALL_DIR
-GFXSEMICOLONS=`echo $GFXLIST | tr ' ' ';' `
+GFXSEMICOLONS=$(echo "$GFXLIST" | tr ' ' ';')
ALTAOMP=${ALTAOMP:-$LLVM_INSTALL_LOC}
-COMMON_CMAKE_OPTS="$AOMP_SET_NINJA_GEN -DOPENMP_ENABLE_LIBOMPTARGET=1
--DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_LOC
--DOPENMP_TEST_C_COMPILER=$LLVM_INSTALL_LOC/bin/clang
--DOPENMP_TEST_CXX_COMPILER=$LLVM_INSTALL_LOC/bin/clang++
--DCMAKE_C_COMPILER=$ALTAOMP/bin/clang
--DCMAKE_CXX_COMPILER=$ALTAOMP/bin/clang++
--DLIBOMPTARGET_AMDGCN_GFXLIST=$GFXSEMICOLONS
--DDEVICELIBS_ROOT=$DEVICELIBS_ROOT
--DLIBOMP_COPY_EXPORTS=OFF
--DLIBOMPTARGET_ENABLE_DEBUG=ON
--DLLVM_DIR=$LLVM_DIR"
+declare -a COMMON_CMAKE_OPTS
+COMMON_CMAKE_OPTS=("${AOMP_SET_NINJA_GEN[@]}" -DOPENMP_ENABLE_LIBOMPTARGET=1
+ -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC"
+ -DOPENMP_TEST_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DOPENMP_TEST_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++"
+ -DCMAKE_C_COMPILER="$ALTAOMP/bin/clang"
+ -DCMAKE_CXX_COMPILER="$ALTAOMP/bin/clang++"
+ -DLIBOMPTARGET_AMDGCN_GFXLIST="$GFXSEMICOLONS"
+ -DDEVICELIBS_ROOT="$DEVICELIBS_ROOT"
+ -DLIBOMP_COPY_EXPORTS=OFF
+ -DLIBOMPTARGET_ENABLE_DEBUG=ON
+ -DLIBOMPTEST_INSTALL_COMPONENTS=ON
+ -DLLVM_DIR="$LLVM_DIR")
+
+if [ "$OPENMP_BUILD_DEVICERTL" -eq 1 ]; then
+ if [ -f "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/device/CMakeLists.txt" ]; then
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_DEFAULT_TARGET_TRIPLE=amdgcn-amd-amdhsa)
+ fi
+fi
if [ "$AOMP_STANDALONE_BUILD" == 0 ]; then
# For static package builds, set BUILD_SHARED_LIBS to OFF
if [ "$STATIC_PKG_DEPS" == "ON" ]; then
- COMMON_CMAKE_OPTS="$COMMON_CMAKE_OPTS -DBUILD_SHARED_LIBS=OFF"
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}" -DBUILD_SHARED_LIBS=OFF)
fi
- COMMON_CMAKE_OPTS="$COMMON_CMAKE_OPTS
- -DLLVM_MAIN_INCLUDE_DIR=$LLVM_PROJECT_ROOT/llvm/include
- -DLIBOMPTARGET_LLVM_INCLUDE_DIRS=$LLVM_PROJECT_ROOT/llvm/include
- -DROCM_DIR=$ROCM_DIR -DAOMP_STANDALONE_BUILD=$AOMP_STANDALONE_BUILD"
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_MAIN_INCLUDE_DIR="$LLVM_PROJECT_ROOT/llvm/include"
+ -DLIBOMPTARGET_LLVM_INCLUDE_DIRS="$LLVM_PROJECT_ROOT/llvm/include"
+ -DROCM_DIR="$ROCM_DIR"
+ -DAOMP_STANDALONE_BUILD="$AOMP_STANDALONE_BUILD")
else
- COMMON_CMAKE_OPTS="$COMMON_CMAKE_OPTS \
--DLLVM_MAIN_INCLUDE_DIR=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include \
--DLIBOMPTARGET_LLVM_INCLUDE_DIRS=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include \
--DLIBOMP_USE_HWLOC=ON -DLIBOMP_HWLOC_INSTALL_DIR=$AOMP_SUPP/hwloc"
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_MAIN_INCLUDE_DIR="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include"
+ -DLIBOMPTARGET_LLVM_INCLUDE_DIRS="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/include"
+ -DLIBOMP_USE_HWLOC=ON
+ -DLIBOMP_HWLOC_INSTALL_DIR="$AOMP_SUPP/hwloc")
fi
if [ "$AOMP_BUILD_CUDA" == 1 ] ; then
- COMMON_CMAKE_OPTS="$COMMON_CMAKE_OPTS
--DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=ON
--DLIBOMPTARGET_NVPTX_CUDA_COMPILER=$AOMP/bin/clang++
--DLIBOMPTARGET_NVPTX_BC_LINKER=$AOMP/bin/llvm-link
--DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=$NVPTXGPUS"
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=ON
+ -DLIBOMPTARGET_NVPTX_CUDA_COMPILER="$AOMP/bin/clang++"
+ -DLIBOMPTARGET_NVPTX_BC_LINKER="$AOMP/bin/llvm-link"
+ -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES="$NVPTXGPUS")
else
# Need to force CUDA off this way in case cuda is installed in this system
- COMMON_CMAKE_OPTS="$COMMON_CMAKE_OPTS
--DCUDA_TOOLKIT_ROOT_DIR=OFF"
+ COMMON_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCUDA_TOOLKIT_ROOT_DIR=OFF)
fi
-if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- LDFLAGS="-fuse-ld=lld $ASAN_FLAGS"
-fi
+#if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
+ #LDFLAGS=$(shquot '-fuse-ld=lld' "${ASAN_FLAGS[@]}")
+ #export LDFLAGS
+#fi
# This is how we tell the hsa plugin where to find hsa
export HSA_RUNTIME_PATH=$ROCM_DIR
@@ -123,161 +128,237 @@ export HSA_RUNTIME_PATH=$ROCM_DIR
# because of its size and constant trunk merges to amd-staging.
# This is why default is 0 (OFF).
if [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 1 ] ; then
- patchrepo $REPO_DIR
+ patchrepo "$REPO_DIR"
fi
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo " "
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/openmp."
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- echo rm -rf $BUILD_DIR/build/openmp
- rm -rf $BUILD_DIR/build/openmp
+ echo "rm -rf $BUILD_DIR/build/$OPENMP_BUILD_DIR"
+ rm -rf "$BUILD_DIR/build/$OPENMP_BUILD_DIR"
+ declare -a MYCMAKEOPTS
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/cmake -DCMAKE_BUILD_TYPE=Release $AOMP_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake"
+ -DCMAKE_BUILD_TYPE=Release
+ "${AOMP_ORIGIN_RPATH[@]}")
else
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$INSTALL_PREFIX/lib/cmake -DCMAKE_BUILD_TYPE=Release $OPENMP_EXTRAS_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX/lib/cmake"
+ -DCMAKE_BUILD_TYPE=Release
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
# XXX: Crude way to detect if we should enable building the mod files with flang.
# Is it preferrable to set it from the outside or based on branch name, some other in-tree file?
AOMP_BUILD_MODFILES_WITH_FLANG_NEW=0
- if [ -e ${LLVM_INSTALL_LOC}/bin/flang ]; then
+ if [ -e "${LLVM_INSTALL_LOC}/bin/flang" ]; then
AOMP_BUILD_MODFILES_WITH_FLANG_NEW=1
fi
if [ "$AOMP_BUILD_MODFILES_WITH_FLANG_NEW" == 1 ]; then
echo "Building .mod files via: $LLVM_INSTALL_LOC/bin/flang"
echo "Installing .mod files to: $LLVM_INSTALL_LOC/include/flang/"
- MYCMAKEOPTS="$MYCMAKEOPTS -DLIBOMP_FORTRAN_MODULES_COMPILER=$LLVM_INSTALL_LOC/bin/flang
- -DLIBOMP_MODULES_INSTALL_PATH=$LLVM_INSTALL_LOC/include/flang/"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}"
+ -DLIBOMP_FORTRAN_MODULES_COMPILER="$LLVM_INSTALL_LOC/bin/flang"
+ -DLIBOMP_MODULES_INSTALL_PATH="$LLVM_INSTALL_LOC/include/flang/")
fi
fi
if [ "$AOMP_LEGACY_OPENMP" == "1" ] && [ "$SANITIZER" != 1 ]; then
echo " -----Running openmp cmake ---- "
- mkdir -p $BUILD_DIR/build/openmp
- cd $BUILD_DIR/build/openmp
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_DIR/build/$OPENMP_BUILD_DIR"
+ cd "$BUILD_DIR/build/$OPENMP_BUILD_DIR" || exit
+ echo "${AOMP_CMAKE}" "${MYCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"; then
echo "ERROR openmp cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
+ declare -a ASAN_CMAKE_OPTS
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- ASAN_CMAKE_OPTS="$COMMON_CMAKE_OPTS -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/asan/cmake -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release $AOMP_ASAN_ORIGIN_RPATH"
- else
- ASAN_CMAKE_OPTS="$COMMON_CMAKE_OPTS -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DCMAKE_PREFIX_PATH=$ROCM_CMAKECONFIG_PATH -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release $OPENMP_EXTRAS_ORIGIN_RPATH"
- fi
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake/AMDDeviceLibs"
+ -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}")
+ else
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}"
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DCMAKE_PREFIX_PATH="$ROCM_CMAKECONFIG_PATH"
+ -DSANITIZER_AMDGPU=1 -DCMAKE_BUILD_TYPE=Release
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
+ fi
echo " -----Running openmp cmake for asan ---- "
- mkdir -p $BUILD_DIR/build/openmp/asan
- cd $BUILD_DIR/build/openmp/asan
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DLLVM_LIBDIR_SUFFIX="/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DLLVM_LIBDIR_SUFFIX="/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_DIR/build/$OPENMP_BUILD_DIR/asan"
+ cd "$BUILD_DIR/build/$OPENMP_BUILD_DIR/asan" || exit
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DLLVM_LIBDIR_SUFFIX="/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DLLVM_LIBDIR_SUFFIX="/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"; then
echo "ERROR openmp cmake failed. Cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
# Build a dedicatd "performance" version of libomptarget
if [ "$AOMP_BUILD_PERF" == "1" ]; then
- echo rm -rf $BUILD_DIR/build/openmp_perf
- rm -rf $BUILD_DIR/build/openmp_perf
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS -DLIBOMPTARGET_ENABLE_DEBUG=OFF -DCMAKE_BUILD_TYPE=Release -DLIBOMPTARGET_PERF=ON -DLLVM_LIBDIR_SUFFIX=-perf"
- mkdir -p $BUILD_DIR/build/openmp_perf
- cd $BUILD_DIR/build/openmp_perf
+ echo "rm -rf $BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf"
+ rm -rf "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}" -DLIBOMPTARGET_ENABLE_DEBUG=OFF
+ -DCMAKE_BUILD_TYPE=Release -DLIBOMPTARGET_PERF=ON
+ -DLLVM_LIBDIR_SUFFIX=-perf)
+ mkdir -p "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf"
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf" || exit
echo " -----Running openmp cmake for perf ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake" $AOMP_ORIGIN_RPATH $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- ${AOMP_CMAKE} $MYCMAKEOPTS -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake" $AOMP_ORIGIN_RPATH $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake" \
+ "$(shquot "${AOMP_ORIGIN_RPATH[@]}")" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake" \
+ "${AOMP_ORIGIN_RPATH[@]}" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"; then
echo "error openmp cmake failed. cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- ASAN_CMAKE_OPTS="$MYCMAKEOPTS -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DSANITIZER_AMDGPU=1"
+ declare -a ASAN_CMAKE_OPTS
+ ASAN_CMAKE_OPTS=("${MYCMAKEOPTS[@]}"
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DSANITIZER_AMDGPU=1)
echo " -----Running openmp cmake for perf-asan ---- "
- mkdir -p $BUILD_DIR/build/openmp_perf/asan
- cd $BUILD_DIR/build/openmp_perf/asan
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake" $AOMP_ASAN_ORIGIN_RPATH -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DLLVM_LIBDIR_SUFFIX="-perf/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake" $AOMP_ASAN_ORIGIN_RPATH -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DLLVM_LIBDIR_SUFFIX="-perf/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf/asan"
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf/asan" || exit
+ echo "${AOMP_CMAKE}" "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake/AMDDeviceLibs" \
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DLLVM_LIBDIR_SUFFIX="-perf/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake/AMDDeviceLibs" \
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DLLVM_LIBDIR_SUFFIX="-perf/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"; then
echo "error openmp cmake failed. cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
fi
if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
- echo rm -rf $BUILD_DIR/build/openmp_debug
- rm -rf $BUILD_DIR/build/openmp_debug
-
- DEBUGCMAKEOPTS="
--DLIBOMPTARGET_NVPTX_DEBUG=ON \
--DLLVM_ENABLE_ASSERTIONS=ON \
--DCMAKE_BUILD_TYPE=Debug \
--DROCM_DIR=$ROCM_DIR \
--DLIBOMP_ARCH=x86_64 \
--DLIBOMP_OMPT_SUPPORT=ON \
--DLIBOMP_USE_DEBUGGER=ON \
--DLIBOMP_CPPFLAGS='-O0' \
--DLIBOMP_OMPD_SUPPORT=ON \
--DLIBOMP_OMPT_DEBUG=ON \
--DOPENMP_SOURCE_DEBUG_MAP="\""-fdebug-prefix-map=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp=$_ompd_src_dir/openmp"\"" "
+ echo "rm -rf $BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug"
+ rm -rf "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug"
+
+ declare -a DEBUGCMAKEOPTS
+
+ DEBUGCMAKEOPTS=(-DLIBOMPTARGET_NVPTX_DEBUG=ON
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DCMAKE_BUILD_TYPE=Debug
+ -DROCM_DIR="$ROCM_DIR"
+ -DLIBOMP_ARCH=x86_64
+ -DLIBOMP_OMPT_SUPPORT=ON
+ -DLIBOMP_USE_DEBUGGER=ON
+ -DLIBOMP_CPPFLAGS='-O0'
+ -DLIBOMP_OMPD_SUPPORT=ON
+ -DLIBOMP_OMPT_DEBUG=ON
+ -DOPENMP_SOURCE_DEBUG_MAP="-fdebug-prefix-map=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp=$_ompd_src_dir/openmp")
# The 'pip install --system' command is not supported on non-debian systems. This will disable
# the system option if the debian_version file is not present.
if [ ! -f /etc/debian_version ]; then
echo "==> Non-Debian OS, disabling use of pip install --system"
- DEBUGCMAKEOPTS="$DEBUGCMAKEOPTS -DDISABLE_SYSTEM_NON_DEBIAN=1"
+ DEBUGCMAKEOPTS=("${DEBUGCMAKEOPTS[@]}" -DDISABLE_SYSTEM_NON_DEBIAN=1)
fi
# Redhat 7.6 does not have python36-devel package, which is needed for ompd compilation.
# This is acquired through RH Software Collections.
if [ -f /opt/rh/rh-python36/enable ]; then
echo "==> Using python3.6 out of rh tools."
- DEBUGCMAKEOPTS="$DEBUGCMAKEOPTS -DPython3_ROOT_DIR=/opt/rh/rh-python36/root/bin -DPYTHON_HEADERS=/opt/rh/rh-python36/root/usr/include/python3.6m"
+ DEBUGCMAKEOPTS=("${DEBUGCMAKEOPTS[@]}" -DPython3_ROOT_DIR=/opt/rh/rh-python36/root/bin -DPYTHON_HEADERS=/opt/rh/rh-python36/root/usr/include/python3.6m)
fi
if [ "$SANITIZER" != 1 ]; then
echo
echo " -----Running openmp cmake for debug ---- "
- mkdir -p $BUILD_DIR/build/openmp_debug
- cd $BUILD_DIR/build/openmp_debug
+ mkdir -p "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug"
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug" || exit
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
PREFIX_PATH="-DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/cmake"
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS $DEBUGCMAKEOPTS $AOMP_DEBUG_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}" "${DEBUGCMAKEOPTS[@]}"
+ "${AOMP_DEBUG_ORIGIN_RPATH[@]}")
else
PREFIX_PATH="-DCMAKE_PREFIX_PATH=$INSTALL_PREFIX/lib/cmake"
- MYCMAKEOPTS="$COMMON_CMAKE_OPTS $DEBUGCMAKEOPTS $OPENMP_EXTRAS_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${COMMON_CMAKE_OPTS[@]}" "${DEBUGCMAKEOPTS[@]}"
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $PREFIX_PATH -DCMAKE_C_FLAGS="$CFLAGS -g" -DCMAKE_CXX_FLAGS="$CXXFLAGS -g" -DLLVM_LIBDIR_SUFFIX=-debug $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- ${AOMP_CMAKE} $MYCMAKEOPTS $PREFIX_PATH -DCMAKE_C_FLAGS="$CFLAGS -g" -DCMAKE_CXX_FLAGS="$CXXFLAGS -g" -DLLVM_LIBDIR_SUFFIX=-debug $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "${MYCMAKEOPTS[@]}" "$PREFIX_PATH" \
+ -DCMAKE_C_FLAGS="$CFLAGS -g" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS -g" \
+ -DLLVM_LIBDIR_SUFFIX=-debug \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$PREFIX_PATH" \
+ -DCMAKE_C_FLAGS="$CFLAGS -g" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS -g" \
+ -DLLVM_LIBDIR_SUFFIX=-debug \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"; then
echo "ERROR openmp debug cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- ASAN_CMAKE_OPTS="$COMMON_CMAKE_OPTS $DEBUGCMAKEOPTS -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DSANITIZER_AMDGPU=1"
+ declare -a ASAN_CMAKE_OPTS
+ ASAN_CMAKE_OPTS=("${COMMON_CMAKE_OPTS[@]}" "${DEBUGCMAKEOPTS[@]}"
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DSANITIZER_AMDGPU=1)
echo " -----Running openmp cmake for debug-asan ---- "
- mkdir -p $BUILD_DIR/build/openmp_debug/asan
- cd $BUILD_DIR/build/openmp_debug/asan
- if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- ASAN_CMAKE_OPTS="$ASAN_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/asan/cmake $AOMP_ASAN_ORIGIN_RPATH"
- else
- ASAN_CMAKE_OPTS="$ASAN_CMAKE_OPTS -DCMAKE_PREFIX_PATH=$ROCM_CMAKECONFIG_PATH $OPENMP_EXTRAS_ORIGIN_RPATH"
- fi
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DLLVM_LIBDIR_SUFFIX="-debug/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" -DLLVM_LIBDIR_SUFFIX="-debug/asan" $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug/asan"
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug/asan" || exit
+ if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake;$AOMP_INSTALL_DIR/lib/cmake/AMDDeviceLibs"
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}")
+ else
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$ROCM_CMAKECONFIG_PATH"
+ "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
+ fi
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DLLVM_LIBDIR_SUFFIX="-debug/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DLLVM_LIBDIR_SUFFIX="-debug/asan" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp"; then
echo "ERROR openmp debug cmake failed. Cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
@@ -290,50 +371,49 @@ fi
if [ "$1" != "install" ] ; then
if [ "$AOMP_LEGACY_OPENMP" == "1" ] && [ "$SANITIZER" != 1 ] ; then
- cd $BUILD_DIR/build/openmp
- echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/openmp ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ cd "$BUILD_DIR/build/$OPENMP_BUILD_DIR" || exit
+ echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/$OPENMP_BUILD_DIR ---- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
- echo " cd $BUILD_DIR/build/openmp"
+ echo " cd $BUILD_DIR/build/$OPENMP_BUILD_DIR"
echo " $AOMP_NINJA_BIN"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/openmp/asan
- echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/openmp/asan ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ cd "$BUILD_DIR/build/$OPENMP_BUILD_DIR/asan" || exit
+ echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/$OPENMP_BUILD_DIR/asan ---- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
- echo " cd $BUILD_DIR/build/openmp/asan"
+ echo " cd $BUILD_DIR/build/$OPENMP_BUILD_DIR/asan"
echo " $AOMP_NINJA_BIN"
exit 1
fi
fi
if [ "$AOMP_BUILD_PERF" == "1" ] ; then
- cd $BUILD_DIR/build/openmp_perf
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf" || exit
echo
echo
- echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/openmp_perf ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf ---- "
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/openmp_perf/asan
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf/asan" || exit
echo
echo
- echo " ----- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/openmp_perf/asan ----- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ echo " ----- Running $AOMP_NINJA_BIN for $BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf/asan ----- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
exit 1
fi
@@ -342,24 +422,24 @@ fi
if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
if [ "$SANITIZER" != 1 ] ; then
- cd $BUILD_DIR/build/openmp_debug
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug" || exit
echo
echo
- echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/openmp_debug ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug ---- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/openmp_debug/asan
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug/asan" || exit
echo
echo
- echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/openmp_debug/asan ---- "
- $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ echo " -----Running $AOMP_NINJA_BIN for $BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug/asan ---- "
+
+ if ! $AOMP_NINJA_BIN -j "$AOMP_JOB_THREADS"; then
echo "ERROR $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS failed"
exit 1
fi
@@ -375,47 +455,48 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
if [ "$AOMP_LEGACY_OPENMP" == "1" ] && [ "$SANITIZER" != 1 ] ; then
- cd $BUILD_DIR/build/openmp
+ cd "$BUILD_DIR/build/$OPENMP_BUILD_DIR" || exit
echo
echo " -----Installing to $LLVM_INSTALL_LOC/lib ----- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/openmp/asan
+ cd "$BUILD_DIR/build/$OPENMP_BUILD_DIR/asan" || exit
echo
echo " -----Installing to $LLVM_INSTALL_LOC/lib/asan ----- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
fi
if [ "$AOMP_BUILD_PERF" == "1" ]; then
- cd $BUILD_DIR/build/openmp_perf
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf" || exit
echo
echo " -----Installing to $LLVM_INSTALL_LOC/lib-perf ----- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
- if [ ! -h $AOMP_INSTALL_DIR/lib-perf/$llvm_dylib ] && [ "$llvm_dylib" != "" ]; then
- cd $AOMP_INSTALL_DIR/lib-perf
- ln -s ../lib/$llvm_dylib $llvm_dylib
- fi
+ # FIXME: llvm_dylib is not set anywhere!
+ #if [ ! -h "$AOMP_INSTALL_DIR/lib-perf/$llvm_dylib" ] && [ "$llvm_dylib" != "" ]; then
+ # cd "$AOMP_INSTALL_DIR/lib-perf" || exit
+ # ln -s "../lib/$llvm_dylib" "$llvm_dylib"
+ #fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/openmp_perf/asan
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_perf/asan" || exit
echo
echo " ----- Installing to $LLVM_INSTALL_LOC/lib-perf/asan ----- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
@@ -424,25 +505,26 @@ if [ "$1" == "install" ] ; then
if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
if [ "$SANITIZER" != 1 ] ; then
- cd $BUILD_DIR/build/openmp_debug
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug" || exit
echo
echo " -----Installing to $LLVM_INSTALL_LOC/lib-debug ---- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
- if [ ! -h $AOMP_INSTALL_DIR/lib-debug/$llvm_dylib ] && [ "$llvm_dylib" != "" ]; then
- cd $AOMP_INSTALL_DIR/lib-debug
- ln -s ../lib/$llvm_dylib $llvm_dylib
- fi
+ # FIXME: llvm_dylib is not set anywhere!
+ #if [ ! -h "$AOMP_INSTALL_DIR/lib-debug/$llvm_dylib" ] && [ "$llvm_dylib" != "" ]; then
+ # cd "$AOMP_INSTALL_DIR/lib-debug" || exit
+ # ln -s "../lib/$llvm_dylib" "$llvm_dylib"
+ #fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_DIR/build/openmp_debug/asan
+ cd "$BUILD_DIR/build/${OPENMP_BUILD_DIR}_debug/asan" || exit
echo " -----Installing to $LLVM_INSTALL_LOC/lib-debug/asan ---- "
- $SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_NINJA_BIN" -j "$AOMP_JOB_THREADS" install; then
echo "ERROR $AOMP_NINJA_BIN install failed "
exit 1
fi
@@ -455,19 +537,29 @@ if [ "$1" == "install" ] ; then
# Copy selected debugable runtime sources into the installation $ompd_src_dir/src directory
# to satisfy the above -fdebug-prefix-map.
- $SUDO mkdir -p $_ompd_src_dir/openmp/runtime
- $SUDO mkdir -p $_ompd_src_dir/openmp/libompd
+ $SUDO mkdir -p "$_ompd_src_dir/openmp/runtime"
+ $SUDO mkdir -p "$_ompd_src_dir/openmp/libompd"
+ $SUDO mkdir -p "$_ompd_src_dir/openmp/device"
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- $SUDO cp -rp $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/runtime/src $_ompd_src_dir/openmp/runtime
- $SUDO cp -rp $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libompd/src $_ompd_src_dir/openmp/libompd
+ $SUDO cp -rp "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/runtime/src" "$_ompd_src_dir/openmp/runtime"
+ $SUDO cp -rp "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libompd/src" "$_ompd_src_dir/openmp/libompd"
+ $SUDO cp -rp "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/device/src" "$_ompd_src_dir/openmp/device"
else
- $SUDO cp -rp $LLVM_PROJECT_ROOT/openmp/runtime/src $_ompd_src_dir/openmp/runtime
- $SUDO cp -rp $LLVM_PROJECT_ROOT/openmp/libompd/src $_ompd_src_dir/openmp/libompd
+ $SUDO cp -rp "$LLVM_PROJECT_ROOT/openmp/runtime/src" "$_ompd_src_dir/openmp/runtime"
+ $SUDO cp -rp "$LLVM_PROJECT_ROOT/openmp/libompd/src" "$_ompd_src_dir/openmp/libompd"
+ $SUDO cp -rp "$LLVM_PROJECT_ROOT/openmp/device/src" "$_ompd_src_dir/openmp/device"
fi
fi
if [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 1 ] ; then
- removepatch $REPO_DIR
+ removepatch "$REPO_DIR"
fi
fi
+
+if [ "$1" != "install" ] && [ "$OPENMP_BUILD_DEVICERTL" == 0 ] ; then
+ OPENMP_BUILD_DIR="openmp-devicertl" OPENMP_BUILD_DEVICERTL=1 $thisdir/build_openmp.sh
+fi
+if [ "$1" == "install" ] && [ "$OPENMP_BUILD_DEVICERTL" == 0 ]; then
+ OPENMP_BUILD_DIR="openmp-devicertl" OPENMP_BUILD_DEVICERTL=1 $thisdir/build_openmp.sh install
+fi
diff --git a/bin/build_pgmath.sh b/bin/build_pgmath.sh
index 6ad7d43848..cdd1045cf9 100755
--- a/bin/build_pgmath.sh
+++ b/bin/build_pgmath.sh
@@ -6,9 +6,9 @@
BUILD_TYPE=${BUILD_TYPE:-Release}
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_FLANG=${INSTALL_FLANG:-$AOMP_INSTALL_DIR}
@@ -23,66 +23,73 @@ else
fi
fi
-COMP_INC_DIR=$(ls -d $AOMP_INSTALL_DIR/lib/clang/*/include )
+COMP_INC_DIR=$(ls -d "$AOMP_INSTALL_DIR"/lib/clang/*/include )
+
+declare -a MYCMAKEOPTS
if [ "$AOMP_PROC" == "ppc64le" ] ; then
- MYCMAKEOPTS="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_LOC -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_Fortran_COMPILER=$LLVM_INSTALL_LOC/bin/flang -DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD "
+ MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
+ -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC"
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DCMAKE_Fortran_COMPILER="$LLVM_INSTALL_LOC/bin/flang"
+ -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD")
else
- MYCMAKEOPTS="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$LLVM_INSTALL_LOC -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_CONFIG=$LLVM_INSTALL_LOC/bin/llvm-config -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD "
+ MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
+ -DCMAKE_INSTALL_PREFIX="$LLVM_INSTALL_LOC"
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DLLVM_CONFIG="$LLVM_INSTALL_LOC/bin/llvm-config"
+ -DCMAKE_CXX_COMPILER=clang++
+ -DCMAKE_C_COMPILER=clang
+ -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD")
fi
+declare -a ASAN_CMAKE_OPTS
+
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- ASAN_FLAGS="$ASAN_FLAGS -I$COMP_INC_DIR"
- ASAN_CMAKE_OPTS="$MYCMAKEOPTS -DCMAKE_PREFIX_PATH=$AOMP/lib/asan/cmake -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF -DCMAKE_INSTALL_BINDIR=bin/asan -DCMAKE_INSTALL_LIBDIR=lib/asan"
+ ASAN_FLAGS=("${ASAN_FLAGS[@]}" "-I$COMP_INC_DIR")
+ ASAN_CMAKE_OPTS=("${MYCMAKEOPTS[@]}"
+ -DCMAKE_PREFIX_PATH="$AOMP/lib/asan/cmake"
+ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
+ -DCMAKE_INSTALL_BINDIR=bin/asan
+ -DCMAKE_INSTALL_LIBDIR=lib/asan)
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- ASAN_CMAKE_OPTS="$ASAN_CMAKE_OPTS $AOMP_ASAN_ORIGIN_RPATH"
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}" "${AOMP_ASAN_ORIGIN_RPATH[@]}")
else
- ASAN_CMAKE_OPTS="$ASAN_CMAKE_OPTS $OPENMP_EXTRAS_ORIGIN_RPATH"
+ ASAN_CMAKE_OPTS=("${ASAN_CMAKE_OPTS[@]}" "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
fi
if [ "$AOMP_STANDALONE_BUILD" == 1 ]; then
- MYCMAKEOPTS="$MYCMAKEOPTS $AOMP_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "${AOMP_ORIGIN_RPATH[@]}")
else
- MYCMAKEOPTS="$MYCMAKEOPTS $OPENMP_EXTRAS_ORIGIN_RPATH"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" "${OPENMP_EXTRAS_ORIGIN_RPATH[@]}")
fi
-MYCMAKEOPTS="$MYCMAKEOPTS -DCMAKE_PREFIX_PATH=$AOMP/lib/cmake"
+MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" -DCMAKE_PREFIX_PATH="$AOMP/lib/cmake")
if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
help_build_aomp
fi
-REPO_DIR=$AOMP_REPOS/$AOMP_FLANG_REPO_NAME
-
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_FLANG
- $SUDO touch $INSTALL_FLANG/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_FLANG"
- exit 1
- fi
- $SUDO rm $INSTALL_FLANG/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_FLANG"
# Skip synchronization from git repos if nocmake or install are specified
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/pgmath"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- rm -rf $BUILD_DIR/build/pgmath
- mkdir -p $BUILD_DIR/build/pgmath
+ rm -rf "$BUILD_DIR/build/pgmath"
+ mkdir -p "$BUILD_DIR/build/pgmath"
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- mkdir -p $BUILD_DIR/build/pgmath/asan
+ mkdir -p "$BUILD_DIR/build/pgmath/asan"
fi
else
- if [ ! -d $BUILD_DIR/build/pgmath ] ; then
+ if [ ! -d "$BUILD_DIR/build/pgmath" ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/pgmath does not exist"
echo " run $0 without nocmake or install options. "
exit 1
fi
- if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ ! -d $BUILD_DIR/build/pgmath/asan ] ; then
+ if [ "$AOMP_BUILD_SANITIZER" == 1 ] && [ ! -d "$BUILD_DIR/build/pgmath/asan" ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/pgmath/asan does not exist"
echo " run $0 without nocmake or install options. "
exit 1
@@ -90,43 +97,43 @@ else
fi
# Need llvm-config to come from previous LLVM build
-export PATH=$LLVM_INSTALL_LOC/bin:$PATH
+export PATH="$LLVM_INSTALL_LOC/bin":$PATH
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ "$SANITIZER" != 1 ]; then
echo
- cd $BUILD_DIR/build/pgmath
+ cd "$BUILD_DIR/build/pgmath" || exit
echo " -----Running cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS \
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
-DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath
- ${AOMP_CMAKE} $MYCMAKEOPTS \
- -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath 2>&1
- if [ $? != 0 ] ; then
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ -DCMAKE_C_FLAGS="$CFLAGS -I$COMP_INC_DIR" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS -I$COMP_INC_DIR" \
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath" 2>&1; then
echo "ERROR cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
echo
- cd $BUILD_DIR/build/pgmath/asan
+ cd "$BUILD_DIR/build/pgmath/asan" || exit
echo " -----Running cmake pgmath-asan ---- "
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS \
- -DCMAKE_C_FLAGS="$CFLAGS $ASAN_FLAGS" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS $ASAN_FLAGS" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS \
- -DCMAKE_C_FLAGS="$CFLAGS $ASAN_FLAGS" \
- -DCMAKE_CXX_FLAGS="$CXXFLAGS $ASAN_FLAGS" \
- $AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath 2>&1
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")\"" \
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$CFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS $(cmquot "${ASAN_FLAGS[@]}")" \
+ "$AOMP_REPOS/$AOMP_FLANG_REPO_NAME/runtime/libpgmath" 2>&1; then
echo "ERROR pgmath-asan cmake failed. Cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
@@ -138,34 +145,34 @@ fi
if [ "$SANITIZER" != 1 ]; then
echo
- cd $BUILD_DIR/build/pgmath
+ cd "$BUILD_DIR/build/pgmath" || exit
echo " -----Running make ---- "
- echo make -j $AOMP_JOB_THREADS
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ echo make -j "$AOMP_JOB_THREADS"
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo "ERROR make -j $AOMP_JOB_THREADS failed"
exit 1
fi
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
-echo
-cd $BUILD_DIR/build/pgmath/asan
-echo " -----Running make ---- "
-echo make -j $AOMP_JOB_THREADS
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
- echo "ERROR make -j $AOMP_JOB_THREADS failed"
- exit 1
-fi
+ echo
+ cd "$BUILD_DIR/build/pgmath/asan" || exit
+ echo " -----Running make ---- "
+ echo "make -j $AOMP_JOB_THREADS"
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
+ echo "ERROR make -j $AOMP_JOB_THREADS failed"
+ exit 1
+ fi
fi
if [ "$1" == "install" ] ; then
if [ "$SANITIZER" != 1 ]; then
- cd $BUILD_DIR/build/pgmath
+ cd "$BUILD_DIR/build/pgmath" || exit
echo " -----Installing to $INSTALL_FLANG ---- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
@@ -173,10 +180,10 @@ if [ "$1" == "install" ] ; then
echo
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- cd $BUILD_DIR/build/pgmath/asan
+ cd "$BUILD_DIR/build/pgmath/asan" || exit
echo " -----Installing to $INSTALL_FLANG/lib/asan ---- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
diff --git a/bin/build_project.sh b/bin/build_project.sh
index c028ee66d3..0b34d1178f 100755
--- a/bin/build_project.sh
+++ b/bin/build_project.sh
@@ -1,58 +1,65 @@
#!/bin/bash
-#
-# build_project.sh: Script to build the llvm, clang , and lld components of the AOMP compiler.
+#
+# build_project.sh: Script to build the llvm, clang , and lld components of the AOMP compiler.
# This clang 9.0 compiler supports clang hip, OpenMP, and clang cuda
# offloading languages for BOTH nvidia and Radeon accelerator cards.
# This compiler has both the NVPTX and AMDGPU LLVM backends.
# The AMDGPU LLVM backend is referred to as the Lightning Compiler.
#
-# See the help text below, run 'build_project.sh -h' for more information.
+# See the help text below, run 'build_project.sh -h' for more information.
#
BUILD_TYPE=${BUILD_TYPE:-Release}
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
echo "LLVM PROJECTS TO BUILD:$AOMP_PROJECTS_LIST"
INSTALL_PROJECT=${INSTALL_PROJECT:-$LLVM_INSTALL_LOC}
-WEBSITE="http\:\/\/github.com\/ROCm-Developer-Tools\/aomp"
+WEBSITE="http\:\/\/github.com\/ROCm\/aomp"
# Check-openmp prep
# Patch rocr
ROCR_REPO_DIR=$AOMP_REPOS/$AOMP_ROCR_REPO_NAME
-patchrepo $ROCR_REPO_DIR
+patchrepo "$ROCR_REPO_DIR"
# Patch llvm-project with ATD patch customized for amd-staging.
# WARNING: This patch (ATD_ASO_full.patch) rarely applies cleanly
# because of its size and constant trunk merges to amd-staging.
# This is why default is 0 (OFF).
REPO_DIR=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME
-if [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 1 ] ; then
- patchrepo $REPO_DIR
+if [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 1 ] ; then
+ patchrepo "$REPO_DIR"
fi
# End check-openmp prep
+declare -a COMPILERS
+declare -a _qmathopt
+declare -a _amdflangrtopt
+
# Enable AMD-specific Fortran runtime extensions if not skipped
-_amdflangrtopt="-DFLANG_RT_INCLUDE_AMD=ON"
+_amdflangrtopt=(-DFLANG_RT_INCLUDE_AMD=ON)
if [ "$AOMP_SKIP_AMD_FLANGRT" == "1" ]; then
- _amdflangrtopt=""
+ _amdflangrtopt=()
fi
# Enable support for real(kind=16) via libquadmath
-_qmathopt="-DFLANG_RUNTIME_F128_MATH_LIB=libquadmath"
+_qmathopt=(-DFLANG_RUNTIME_F128_MATH_LIB=libquadmath)
+
if [ "$AOMP_PROC" == "ppc64le" ] ; then
- COMPILERS="-DCMAKE_C_COMPILER=/usr/bin/gcc-7 -DCMAKE_CXX_COMPILER=/usr/bin/g++-7"
+ COMPILERS=(-DCMAKE_C_COMPILER=/usr/bin/gcc-7
+ -DCMAKE_CXX_COMPILER=/usr/bin/g++-7)
TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}PowerPC"
else
- COMPILERS="-DCMAKE_C_COMPILER=$AOMP_CC_COMPILER -DCMAKE_CXX_COMPILER=$AOMP_CXX_COMPILER"
+ COMPILERS=(-DCMAKE_C_COMPILER="$AOMP_CC_COMPILER"
+ -DCMAKE_CXX_COMPILER="$AOMP_CXX_COMPILER")
if [ "$AOMP_PROC" == "aarch64" ] ; then
TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}AArch64"
- _qmathopt=""
+ _qmathopt=()
else
TARGETS_TO_BUILD="AMDGPU;${AOMP_NVPTX_TARGET}X86"
fi
@@ -61,20 +68,28 @@ fi
# When building from release source (no git), turn off test items that are not distributed
# also ubuntu 16.04 only has python 3.5 and lit testing needs 3.6 minimum, so turn off
# testing with ubuntu 16.04 which goes EOL in April 2021.
-PN=$(cat /etc/os-release | grep "^PRETTY_NAME=" | cut -d= -f2)
-DO_TESTS=${DO_TESTS:-"-DLLVM_BUILD_TESTS=ON -DLLVM_INCLUDE_TESTS=ON -DCLANG_INCLUDE_TESTS=ON"}
+declare -a DO_TESTS_OPTS
+if [ -z ${DO_TESTS+x} ]; then
+ DO_TESTS_OPTS=(-DLLVM_BUILD_TESTS=ON
+ -DLLVM_INCLUDE_TESTS=ON
+ -DCLANG_INCLUDE_TESTS=ON)
+else
+ # Incoming DO_TESTS is a string with space-separated arguments. Convert it
+ # to an array.
+ IFS=" " read -r -a DO_TESTS_OPTS <<< "$DO_TESTS"
+fi
#-DCOMPILER_RT_INCLUDE_TESTS=OFF"
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
standalone_word="_STANDALONE"
else
standalone_word=""
fi
if [ "$AOMP_USE_NINJA" == 0 ] ; then
- AOMP_SET_NINJA_GEN=""
+ AOMP_SET_NINJA_GEN=()
else
- AOMP_SET_NINJA_GEN="-G Ninja"
+ AOMP_SET_NINJA_GEN=(-G Ninja)
fi
if [ "$AOMP_LEGACY_OPENMP" != 0 ]; then
@@ -85,103 +100,113 @@ fi
rocmdevicelib_loc_new=lib/llvm/lib/clang/$AOMP_MAJOR_VERSION/lib/amdgcn
-GFXSEMICOLONS=`echo $GFXLIST | tr ' ' ';' `
-MYCMAKEOPTS="-DCMAKE_BUILD_TYPE=$BUILD_TYPE
- -DCMAKE_INSTALL_PREFIX=$INSTALL_PROJECT
- -DLLVM_ENABLE_ASSERTIONS=ON
- -DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD
- $COMPILERS
- -DLLVM_VERSION_SUFFIX=_AOMP${standalone_word}_$AOMP_VERSION_STRING
- -DCLANG_VENDOR=AOMP${standalone_word}_$AOMP_VERSION_STRING
- -DCLANG_DEFAULT_PIE_ON_LINUX=0
- -DLLVM_ENABLE_ZLIB=ON
- -DBUG_REPORT_URL='https://github.com/ROCm-Developer-Tools/aomp'
- -DLLVM_ENABLE_BINDINGS=OFF
- -DLLVM_INCLUDE_BENCHMARKS=OFF
- $DO_TESTS $AOMP_ORIGIN_RPATH
- -DCLANG_DEFAULT_LINKER=lld
- $AOMP_SET_NINJA_GEN
- $_qmathopt
- $_amdflangrtopt
- -DLIBOMPTARGET_BUILD_DEVICE_FORTRT=ON
- -DLLVM_BUILD_LLVM_DYLIB=ON
- -DLLVM_LINK_LLVM_DYLIB=ON
- -DCLANG_LINK_CLANG_DYLIB=ON
- -DLIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH=$AOMP_REPOS/$AOMP_ROCR_REPO_NAME
- -DOFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR=On
- -DLIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/device-libs
- -DLLVM_EXTERNAL_PROJECTS=SPIRV_TRANSLATOR
- -DLLVM_EXTERNAL_SPIRV_TRANSLATOR_SOURCE_DIR=$AOMP_REPOS/SPIRV-LLVM-Translator
- -DROCM_DEVICE_LIBS_INSTALL_PREFIX_PATH=$AOMP_INSTALL_DIR
- -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC=$rocmdevicelib_loc_new
- -DROCM_LLVM_BACKWARD_COMPAT_LINK="$AOMP_INSTALL_DIR/llvm"
- -DROCM_LLVM_BACKWARD_COMPAT_LINK_TARGET="./lib/llvm"
- -DLIBOMP_COPY_EXPORTS=OFF
- -DLIBOMPTARGET_ENABLE_DEBUG=ON
- -DLIBOMPTARGET_AMDGCN_GFXLIST=$GFXSEMICOLONS
- -DLIBOMP_USE_HWLOC=ON -DLIBOMP_HWLOC_INSTALL_DIR=$AOMP_SUPP/hwloc
- -DOPENMP_ENABLE_LIBOMPTARGET=1
- -DLIBOMP_SHARED_LINKER_FLAGS=-Wl,--disable-new-dtags
- -DLIBOMP_INSTALL_RPATH=$AOMP_ORIGIN_RPATH_LIST
- -DLIBOMPTARGET_INSTALL_RPATH=$AOMP_ORIGIN_RPATH_LIST
- -DLIBOMPTARGET_NO_SANITIZER_AMDGPU=1
- -DLIBOMPTARGET_BUILD_DEVICE_FORTRT=On
- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
-
+GFXSEMICOLONS=$(echo "$GFXLIST" | tr ' ' ';')
+
+declare -a MYCMAKEOPTS
+
+MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_PROJECT"
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ -DLLVM_TARGETS_TO_BUILD="$TARGETS_TO_BUILD"
+ "${COMPILERS[@]}"
+ -DLLVM_VERSION_SUFFIX="_AOMP${standalone_word}_$AOMP_VERSION_STRING"
+ -DCLANG_VENDOR="AOMP${standalone_word}_$AOMP_VERSION_STRING"
+ "$LLVM_FORCE_VC_REVISION_OPT"
+ "$LLVM_FORCE_VC_REPOSITORY_OPT"
+ -DCLANG_DEFAULT_PIE_ON_LINUX=0
+ -DLLVM_ENABLE_ZLIB=ON
+ -DBUG_REPORT_URL='https://github.com/ROCm/aomp'
+ -DLLVM_ENABLE_BINDINGS=OFF
+ -DCMAKE_PREFIX_PATH=$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/lib/cmake
+ -DLLVM_INCLUDE_BENCHMARKS=OFF
+ "${DO_TESTS_OPTS[@]}"
+ "${AOMP_ORIGIN_RPATH[@]}"
+ -DCLANG_DEFAULT_LINKER=lld
+ "${AOMP_SET_NINJA_GEN[@]}"
+ "${_qmathopt[@]}"
+ "${_amdflangrtopt[@]}"
+ -DLIBOMPTARGET_BUILD_DEVICE_FORTRT=ON
+ -DLLVM_BUILD_LLVM_DYLIB=ON
+ -DLLVM_LINK_LLVM_DYLIB=ON
+ -DCLANG_LINK_CLANG_DYLIB=ON
+ -DLIBOMPTARGET_EXTERNAL_PROJECT_HSA_PATH="$AOMP_REPOS/$AOMP_ROCR_REPO_NAME"
+ -DOFFLOAD_EXTERNAL_PROJECT_UNIFIED_ROCR=On
+ -DLIBOMPTARGET_EXTERNAL_PROJECT_ROCM_DEVICE_LIBS_PATH="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/device-libs"
+ -DLLVM_EXTERNAL_PROJECTS=SPIRV_TRANSLATOR
+ -DLLVM_EXTERNAL_SPIRV_TRANSLATOR_SOURCE_DIR="$AOMP_REPOS/SPIRV-LLVM-Translator"
+ -DROCM_DEVICE_LIBS_INSTALL_PREFIX_PATH="$AOMP_INSTALL_DIR"
+ -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC="$rocmdevicelib_loc_new"
+ -DROCM_LLVM_BACKWARD_COMPAT_LINK="$AOMP_INSTALL_DIR/llvm"
+ -DROCM_LLVM_BACKWARD_COMPAT_LINK_TARGET="./lib/llvm"
+ -DLIBOMP_COPY_EXPORTS=OFF
+ -DLIBOMPTARGET_ENABLE_DEBUG=ON
+ -DLIBOMPTEST_INSTALL_COMPONENTS=ON
+ -DLIBOMPTARGET_AMDGCN_GFXLIST="$GFXSEMICOLONS"
+ -DLIBOMP_USE_HWLOC=ON
+ -DLIBOMP_HWLOC_INSTALL_DIR="$AOMP_SUPP/hwloc"
+ -DOPENMP_ENABLE_LIBOMPTARGET=1
+ -DLIBOMP_SHARED_LINKER_FLAGS="-Wl,--disable-new-dtags"
+ -DLIBOMP_INSTALL_RPATH="$AOMP_ORIGIN_RPATH_LIST"
+ -DLIBOMPTARGET_INSTALL_RPATH="$AOMP_ORIGIN_RPATH_LIST"
+ -DLIBOMPTARGET_NO_SANITIZER_AMDGPU=1
+ -DLIBOMPTARGET_BUILD_DEVICE_FORTRT=On
+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON)
+
+if [ -f "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/device/CMakeLists.txt" ]; then
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}"
+ -DLLVM_RUNTIME_TARGETS='default;amdgcn-amd-amdhsa'
+ -DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES='compiler-rt;libc;libcxx;libcxxabi;flang-rt;openmp'
+ -DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON)
+fi
+
# -DCLANG_LINK_FLANG_LEGACY=ON
# Enable amdflang, amdclang, amdclang++, amdllvm.
# clang-tools-extra added to LLVM_ENABLE_PROJECTS above.
-MYCMAKEOPTS="$MYCMAKEOPTS
-$AOMP_CCACHE_OPTS
--DLLVM_ENABLE_PROJECTS='$AOMP_PROJECTS_LIST'
--DCLANG_ENABLE_AMDCLANG=ON
--DLLVM_ENABLE_RUNTIMES=$LLVM_RUNTIMES
--DLIBCXX_ENABLE_STATIC=ON
--DLIBCXXABI_ENABLE_STATIC=ON
-"
+MYCMAKEOPTS=("${MYCMAKEOPTS[@]}"
+ "${AOMP_CCACHE_OPTS[@]}"
+ -DLLVM_ENABLE_PROJECTS="$AOMP_PROJECTS_LIST"
+ -DCLANG_ENABLE_AMDCLANG=ON
+ -DLLVM_ENABLE_RUNTIMES="$LLVM_RUNTIMES"
+ -DLIBCXX_ENABLE_STATIC=ON
+ -DLIBCXXABI_ENABLE_STATIC=ON
+ -DLLVM_RUNTIME_TARGETS="default;amdgcn-amd-amdhsa"
+ -DRUNTIMES_amdgcn-amd-amdhsa_FLANG_RT_LIBC_PROVIDER=llvm
+ -DRUNTIMES_amdgcn-amd-amdhsa_FLANG_RT_LIBCXX_PROVIDER=llvm
+ -DRUNTIMES_amdgcn-amd-amdhsa_CACHE_FILES="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/libcxx/cmake/caches/AMDGPU.cmake"
+ )
# Enable Compiler-rt Sanitizer Build
if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
- MYCMAKEOPTS="$MYCMAKEOPTS -DSANITIZER_AMDGPU=1 -DSANITIZER_HSA_INCLUDE_PATH=$AOMP_REPOS/$AOMP_ROCR_REPO_NAME/runtime/hsa-runtime/inc -DSANITIZER_COMGR_INCLUDE_PATH=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/comgr/include"
+ MYCMAKEOPTS=("${MYCMAKEOPTS[@]}" -DSANITIZER_AMDGPU=1
+ -DSANITIZER_HSA_INCLUDE_PATH="$AOMP_REPOS/$AOMP_ROCR_REPO_NAME/runtime/hsa-runtime/inc"
+ -DSANITIZER_COMGR_INCLUDE_PATH="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/amd/comgr/include")
fi
-if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
+if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
help_build_aomp
fi
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
- if [ ! -L $AOMP ] ; then
- if [ -d $AOMP ] ; then
- echo "ERROR: Directory $AOMP is a physical directory."
- echo " It must be a symbolic link or not exist"
- exit 1
- fi
- fi
-fi
-
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_PROJECT
- $SUDO touch $INSTALL_PROJECT/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_PROJECT"
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
+ if [ ! -L "$AOMP" ] && [ -d "$AOMP" ] ; then
+ echo "ERROR: Directory $AOMP is a physical directory."
+ echo " It must be a symbolic link or not exist"
exit 1
fi
- $SUDO rm $INSTALL_PROJECT/testfile
fi
-# Fix the banner to print the AOMP version string.
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
- cd $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME
- MONO_REPO_ID=`git log | grep -m1 commit | cut -d" " -f2`
+check_writable_installdir "$1" "$INSTALL_PROJECT"
+
+# Fix the banner to print the AOMP version string.
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
+ cd "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME" || exit
+ MONO_REPO_ID=$(git log | grep -m1 commit | cut -d" " -f2)
SOURCEID="Source ID:$AOMP_VERSION_STRING-$MONO_REPO_ID"
TEMPCLFILE="/tmp/clfile$$.cpp"
ORIGCLFILE="$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm/lib/Support/CommandLine.cpp"
BUILDCLFILE=$ORIGCLFILE
- sed "s/LLVM (http:\/\/llvm\.org\/):/AOMP-${AOMP_VERSION_STRING} ($WEBSITE):\\\n $SOURCEID/" $ORIGCLFILE > $TEMPCLFILE
- if [ $? != 0 ] ; then
+ if ! sed "s/LLVM (http:\/\/llvm\.org\/):/AOMP-${AOMP_VERSION_STRING} ($WEBSITE):\\\n $SOURCEID/" "$ORIGCLFILE" > "$TEMPCLFILE"; then
echo "ERROR sed command to fix CommandLine.cpp failed."
exit 1
fi
@@ -189,48 +214,52 @@ fi
# Skip synchronization from git repos if nocmake or install are specified
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
- echo
+ echo
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- rm -rf $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME
- mkdir -p $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME
+ rm -rf "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME"
+ mkdir -p "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME"
else
- if [ ! -d $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME ] ; then
+ if [ ! -d "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME" ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME does not exist"
echo " run $0 without nocmake or install options. "
exit 1
fi
fi
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
- cd $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME
- if [ -f $BUILDCLFILE ] ; then
+if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
+ cd "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME" || exit
+ if [ -f "$BUILDCLFILE" ] ; then
# only copy if there has been a change to the source.
- diff $TEMPCLFILE $BUILDCLFILE >/dev/null
- if [ $? != 0 ] ; then
+
+ if ! diff "$TEMPCLFILE" "$BUILDCLFILE" >/dev/null; then
echo "Updating $BUILDCLFILE with corrected $SOURCEID"
- cp $TEMPCLFILE $BUILDCLFILE
+ cp "$TEMPCLFILE" "$BUILDCLFILE"
else
echo "File $BUILDCLFILE already has correct $SOURCEID"
fi
else
echo "Updating $BUILDCLFILE with $SOURCEID"
- cp $TEMPCLFILE $BUILDCLFILE
+ cp "$TEMPCLFILE" "$BUILDCLFILE"
fi
- rm $TEMPCLFILE
+ rm "$TEMPCLFILE"
fi
-cd $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME
+cd "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME" || exit
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo
- echo " -----Running cmake ---- "
- MYLITOPTS=("-DLLVM_LIT_ARGS='-vv --show-unsupported --show-xfail -j 32'")
- echo ${AOMP_CMAKE} "${MYLITOPTS[@]}" $MYCMAKEOPTS $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm
- ${AOMP_CMAKE} "${MYLITOPTS[@]}" $MYCMAKEOPTS $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm 2>&1
- if [ $? != 0 ] ; then
+ echo " -----Running cmake ---- "
+ MYLITOPTS=(-DLLVM_LIT_ARGS='-vv --show-unsupported --show-xfail -j 16')
+ echo "${AOMP_CMAKE}" "$(shquot "${MYLITOPTS[@]}")" \
+ "$(shquot "${MYCMAKEOPTS[@]}")" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm"
+
+ if ! ${AOMP_CMAKE} "${MYLITOPTS[@]}" \
+ "${MYCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/llvm" 2>&1; then
echo "ERROR cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -240,63 +269,61 @@ if [ "$1" = "cmake" ]; then
fi
echo
-echo " -----Running make ---- "
+echo " -----Running make ---- "
if [ "$AOMP_LIMIT_FLANG" == "1" ] ; then
# Required for building flang on memory limited systems.
- echo ${AOMP_CMAKE} --build . -- -j $AOMP_JOB_THREADS clang lld compiler-rt
- ${AOMP_CMAKE} --build . -- -j $AOMP_JOB_THREADS clang lld compiler-rt
+ echo "${AOMP_CMAKE} --build . -- -j $AOMP_JOB_THREADS clang lld compiler-rt"
+ ${AOMP_CMAKE} --build . -- -j "$AOMP_JOB_THREADS" clang lld compiler-rt
- echo ${AOMP_CMAKE} --build . -- -j $AOMP_FLANG_THREADS flang
- ${AOMP_CMAKE} --build . -- -j $AOMP_FLANG_THREADS flang
+ echo "${AOMP_CMAKE} --build . -- -j $AOMP_FLANG_THREADS flang"
+ ${AOMP_CMAKE} --build . -- -j "$AOMP_FLANG_THREADS" flang
fi
# Build llvm-project in one step
echo "Running CMAKE in ${PWD}"
-echo ${AOMP_CMAKE} --build . -j $AOMP_JOB_THREADS
-${AOMP_CMAKE} --build . -j $AOMP_JOB_THREADS
+echo "${AOMP_CMAKE} --build . -j $AOMP_JOB_THREADS"
-if [ $? != 0 ] ; then
+if ! ${AOMP_CMAKE} --build . -j "$AOMP_JOB_THREADS"; then
echo "ERROR make -j $AOMP_JOB_THREADS failed"
exit 1
fi
if [ "$1" == "install" ] ; then
echo " -----Installing to $INSTALL_PROJECT ---- "
- $SUDO ${AOMP_CMAKE} --install .
- if [ $? != 0 ] ; then
+
+ if ! $SUDO "$AOMP_CMAKE" --install .; then
echo "ERROR make install failed "
exit 1
fi
- if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
+ if [ "$AOMP_STANDALONE_BUILD" == 1 ] ; then
echo " "
echo "------ Linking $INSTALL_PROJECT to $AOMP -------"
- if [ -L $AOMP ] ; then
- $SUDO rm $AOMP
+ if [ -L "$AOMP" ] ; then
+ $SUDO rm "$AOMP"
fi
- $SUDO ln -sf $AOMP_INSTALL_DIR $AOMP
-
+ $SUDO ln -sf "$AOMP_INSTALL_DIR" "$AOMP"
fi
# add executables forgot by make install but needed for testing
- $SUDO cp -p $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/llvm-lit $LLVM_INSTALL_LOC/bin/llvm-lit
+ $SUDO cp -p "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/llvm-lit" "$LLVM_INSTALL_LOC/bin/llvm-lit"
# update map_config and llvm_source_root paths in the copied llvm-lit file
- SED_AOMP_REPOS=`echo $AOMP_REPOS | sed -e 's/\//\\\\\//g' `
- sed -ie "s/..\/..\/..\//$SED_AOMP_REPOS\//g" $LLVM_INSTALL_LOC/bin/llvm-lit
-
- $SUDO cp -p $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/FileCheck $LLVM_INSTALL_LOC/bin/FileCheck
- $SUDO cp -p $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/count $LLVM_INSTALL_LOC/bin/count
- $SUDO cp -p $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/not $LLVM_INSTALL_LOC/bin/not
- $SUDO cp -p $BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/yaml-bench $LLVM_INSTALL_LOC/bin/yaml-bench
- cd $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME
+ SED_AOMP_REPOS=$(echo "$AOMP_REPOS" | sed -e 's/\//\\\\\//g')
+ sed -ie "s/..\/..\/..\//$SED_AOMP_REPOS\//g" "$LLVM_INSTALL_LOC/bin/llvm-lit"
+
+ $SUDO cp -p "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/FileCheck" "$LLVM_INSTALL_LOC/bin/FileCheck"
+ $SUDO cp -p "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/count" "$LLVM_INSTALL_LOC/bin/count"
+ $SUDO cp -p "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/not" "$LLVM_INSTALL_LOC/bin/not"
+ $SUDO cp -p "$BUILD_DIR/build/$AOMP_PROJECT_REPO_NAME/bin/yaml-bench" "$LLVM_INSTALL_LOC/bin/yaml-bench"
+ cd "$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME" || exit
git checkout llvm/lib/Support/CommandLine.cpp
echo
echo "SUCCESSFUL INSTALL to $INSTALL_PROJECT with link to $AOMP"
echo
if [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 1 ] ; then
- removepatch $REPO_DIR
+ removepatch "$REPO_DIR"
fi
- removepatch $ROCR_REPO_DIR
+ removepatch "$ROCR_REPO_DIR"
amd_compiler_symlinks=("amdclang" "amdclang++" "amdclang-cl" "amdclang-cpp" "amdflang" "amdlld")
amd_compiler_cfg=("clang" "clang++" "clang-cpp" "clang-${AOMP_MAJOR_VERSION}" "clang-cl" "flang")
@@ -325,9 +352,9 @@ if [ "$1" == "install" ] ; then
#cp ${LLVM_INSTALL_LOC}/bin/rocm.cfg $config_file
fi
done
-else
- echo
+else
+ echo
echo "SUCCESSFUL BUILD, please run: $0 install"
echo " to install into $AOMP"
- echo
+ echo
fi
diff --git a/bin/build_qmcpack.sh b/bin/build_qmcpack.sh
index 1d03bec54f..188913bdec 100755
--- a/bin/build_qmcpack.sh
+++ b/bin/build_qmcpack.sh
@@ -23,9 +23,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
AOMP=${AOMP:-~/usr/lib/aomp}
@@ -41,7 +41,7 @@ if [ "$USE_MODULES" == "1" ] && [ -e /etc/profile.d/modules.sh ] ; then
module load hdf5/1.10.1
module load openblas
if [ "$ROCM_VER" != "none" ]; then
- module load $ROCM_VER
+ module load "$ROCM_VER"
fi
BOOST_ROOT=${BOOST_ROOT:-/cm/shared/opt/boost/1.72.0}
FFTW_HOME=${FFTW_HOME:-/cm/shared/apps/fftw/openmpi/gcc/64/3.3.8}
@@ -66,17 +66,12 @@ QMCPACK_REPO=${QMCPACK_REPO:-$AOMP_REPOS_TEST/$AOMP_QMCPACK_REPO_NAME}
export PATH=$OPENMPI_INSTALL/bin:$AOMP/bin:$PATH
export LD_LIBRARY_PATH=$OPENMPI_INSTALL/lib:$LD_LIBRARY_PATH
-if [ "$mygpu" == "unknown" ] ; then
- echo "ERROR: No gpu found"
- exit 1
-fi
-
-pushd $QMCPACK_REPO
+pushd "$QMCPACK_REPO" || exit
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
- if [ -d $build_folder ] ; then
+ if [ -d "$build_folder" ] ; then
echo "FRESH START"
- echo rm -rf $build_folder
- rm -rf $build_folder
+ echo rm -rf "$build_folder"
+ rm -rf "$build_folder"
fi
fi
@@ -85,21 +80,21 @@ clang --version
mpicc --version
echo Environment Variables:
-echo AOMP: $AOMP
-echo AOMP_GPU: $AOMP_GPU
-echo OPENMPI_INSTALL: $OPENMPI_INSTALL
-echo BOOST_ROOT: $BOOST_ROOT
-echo FFTW_HOME: $FFTW_HOME
-echo QMCPACK_REPO: $QMCPACK_REPO
-echo HDF5_ROOT: $HDF5_ROOT
+echo "AOMP: $AOMP"
+echo "AOMP_GPU: $AOMP_GPU"
+echo "OPENMPI_INSTALL: $OPENMPI_INSTALL"
+echo "BOOST_ROOT: $BOOST_ROOT"
+echo "FFTW_HOME: $FFTW_HOME"
+echo "QMCPACK_REPO: $QMCPACK_REPO"
+echo "HDF5_ROOT: $HDF5_ROOT"
echo
echo "###################################"
-echo Building AOMP_offload_real_MP_$AOMP_GPU
+echo "Building AOMP_offload_real_MP_$AOMP_GPU"
echo "###################################"
-mkdir -p $build_folder
-pushd $build_folder
+mkdir -p "$build_folder"
+pushd "$build_folder" || exit
complex="-DQMC_COMPLEX="
mixed="-DQMC_MIXED_PRECISION="
@@ -140,27 +135,34 @@ while [ "$1" != "" ];
do
case $1 in
-c | --complex | complex)
- echo $1 turns QMC_COMPLEX=ON;
- opts_array[$complex]=ON ;;
+ echo "$1 turns QMC_COMPLEX=ON"
+ opts_array[$complex]=ON
+ ;;
-m | --mixed | mixed)
- echo $1 turns QMC_MIXED_PRECISION=ON;
- opts_array[$mixed]=ON ;;
+ echo "$1 turns QMC_MIXED_PRECISION=ON"
+ opts_array[$mixed]=ON
+ ;;
-mpi | --mpi | mpi)
- echo $1 turns QMC_MPI=ON;
- opts_array[$mpi]=ON;
- mpi=1;
- opts_array[$mpicc]=$OPENMPI_INSTALL/bin/mpicc;
- opts_array[$mpicxx]=$OPENMPI_INSTALL/bin/mpicxx ;;
+ echo "$1 turns QMC_MPI=ON"
+ opts_array[$mpi]=ON
+ mpi=1
+ opts_array[$mpicc]=$OPENMPI_INSTALL/bin/mpicc
+ opts_array[$mpicxx]=$OPENMPI_INSTALL/bin/mpicxx
+ ;;
*)
- echo $1 option not recognized ; exit 1 ;;
+ echo "$1 option not recognized"
+ exit 1
+ ;;
esac
shift 1
done
+declare -a custom_opts=()
+
# Populate key/value into acceptable cmake option
for option in "${!opts_array[@]}"; do
val=${opts_array[$option]}
- custom_opts="$custom_opts $option$val"
+ custom_opts+=("$option$val")
done
if [[ ! -e $OPENMPI_INSTALL/bin/mpicc ]] && [ "$mpi" == "1" ]; then
@@ -169,11 +171,12 @@ if [[ ! -e $OPENMPI_INSTALL/bin/mpicc ]] && [ "$mpi" == "1" ]; then
fi
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
-$AOMP_CMAKE -DOFFLOAD_ARCH=$AOMP_GPU \
--DENABLE_OFFLOAD=ON -DOFFLOAD_TARGET="amdgcn-amd-amdhsa" \
--DENABLE_TIMERS=1 \
-$custom_opts \
-..
+ $AOMP_CMAKE -DOFFLOAD_ARCH="$AOMP_GPU" \
+ -DQMC_GPU=openmp \
+ -DOFFLOAD_TARGET="amdgcn-amd-amdhsa" \
+ -DENABLE_TIMERS=1 \
+ "${custom_opts[@]}" \
+ ..
fi
if [ "$1" = "cmake" ]; then
@@ -181,11 +184,11 @@ if [ "$1" = "cmake" ]; then
fi
echo
-echo make -j$AOMP_JOB_THREADS
-make -j$AOMP_JOB_THREADS
+echo "make -j$AOMP_JOB_THREADS"
+
# Exit if build was not successful
-if [ $? != 0 ]; then
+if ! make -j"$AOMP_JOB_THREADS"; then
echo
echo ERROR: make command failed.
echo
@@ -197,5 +200,5 @@ echo "DONE! Build is in $build_folder. To test:"
echo " cd $QMCPACK_REPO/$build_folder"
echo " ctest -R deterministic"
echo
-popd
-popd
+popd || exit
+popd || exit
diff --git a/bin/build_rocdbgapi.sh b/bin/build_rocdbgapi.sh
index 5f81c98364..4e64222db3 100755
--- a/bin/build_rocdbgapi.sh
+++ b/bin/build_rocdbgapi.sh
@@ -4,9 +4,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_ROCDBGAPI=${INSTALL_ROCDBGAPI:-$AOMP_INSTALL_DIR}
@@ -28,22 +28,13 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $AOMP_REPOS/$AOMP_DBGAPI_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_DBGAPI_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_DBGAPI_REPO_NAME"
echo " Are environment variables AOMP_REPOS and AOMP_DBGAPI_REPO_NAME set correctly?"
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_ROCDBGAPI
- $SUDO touch $INSTALL_ROCDBGAPI/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_ROCDBGAPI"
- exit 1
- fi
- $SUDO rm $INSTALL_ROCDBGAPI/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_ROCDBGAPI"
API_NAME=rocm-dbgapi
PROJ_NAME=$API_NAME
@@ -55,33 +46,38 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo "This is a FRESH START. ERASING any previous builds in $BUILD_AOMP/build_rocdbgapi"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- BUILDTYPE="Release"
- echo rm -rf $BUILD_AOMP/build/rocdbgapi
- rm -rf $BUILD_AOMP/build/rocdbgapi
+ BUILD_TYPE="Release"
+ echo rm -rf "$BUILD_AOMP/build/rocdbgapi"
+ rm -rf "$BUILD_AOMP/build/rocdbgapi"
_cxx_flags="-DCMAKE_CXX_FLAGS=-I$AOMP_INSTALL_DIR/include/amd_comgr"
if [ -d "/usr/include/c++/5/experimental" ] ; then
- _loc=`which gcc`
+ _loc=$(which gcc)
if [ "$_loc" != "" ] ; then
- _gccver=`$_loc --version | grep gcc | cut -d")" -f2 | cut -d"." -f1`
- if [ "$_gccver" == "5" ] ; then
+ _gccver=$($_loc --version | grep gcc | cut -d")" -f2 | cut -d"." -f1)
+ if [ "$_gccver" == "5" ] ; then
_cxx_flags+="\;-I/usr/include/c++/5/experimental"
fi
fi
fi
- MYCMAKEOPTS="-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
- -DCMAKE_INSTALL_LIBDIR=lib \
- -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCDBGAPI \
- -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR;$INSTALL_ROCDBGAPI/include \
- $_cxx_flags \
- $AOMP_ORIGIN_RPATH"
- mkdir -p $BUILD_AOMP/build/rocdbgapi
- cd $BUILD_AOMP/build/rocdbgapi
+ declare -a MYCMAKEOPTS
+ MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
+ -DCMAKE_INSTALL_LIBDIR=lib
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCDBGAPI"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR;$INSTALL_ROCDBGAPI/include"
+ -DCMAKE_C_COMPILER="$LLVM_INSTALL_LOC/bin/clang"
+ -DCMAKE_CXX_COMPILER="$LLVM_INSTALL_LOC/bin/clang++"
+ "$_cxx_flags"
+ "${AOMP_ORIGIN_RPATH[@]}")
+ mkdir -p "$BUILD_AOMP/build/rocdbgapi"
+ cd "$BUILD_AOMP/build/rocdbgapi" || exit
echo " -----Running rocdbgapi cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_DBGAPI_REPO_NAME
- ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_DBGAPI_REPO_NAME
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ "$AOMP_REPOS/$AOMP_DBGAPI_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_DBGAPI_REPO_NAME"; then
echo "ERROR rocdbgapi cmake failed. cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -90,12 +86,12 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_AOMP/build/rocdbgapi
+cd "$BUILD_AOMP/build/rocdbgapi" || exit
echo
echo " -----Running make for rocdbgapi ---- "
-echo make -j $AOMP_JOB_THREADS
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+echo "make -j $AOMP_JOB_THREADS"
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -104,26 +100,26 @@ if [ $? != 0 ] ; then
exit 1
fi
-doxygen=`which doxygen`
-if [ ! -z $doxygen ] ; then
+doxygen=$(which doxygen)
+if [ -n "$doxygen" ] ; then
# the ROCdbgapi CMakeLists.txt will prepare docs install if doxygen found.
# However, the make doc has issues. But if you dont make doc, the install
# fails. This 'make doc' will do enough so install does not fail.
- echo make -j $AOMP_JOB_THREADS doc
- make -j $AOMP_JOB_THREADS doc 2>/dev/null >/dev/null
+ echo "make -j $AOMP_JOB_THREADS doc"
+ make -j "$AOMP_JOB_THREADS" doc 2>/dev/null >/dev/null
fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_AOMP/build/rocdbgapi
- echo " -----Installing to $INSTALL_ROCDBGAPI/lib ----- "
- echo $SUDO make install
- $SUDO make install
- if [ $? != 0 ] ; then
- echo "ERROR make install failed "
- exit 1
- fi
- echo
+ cd "$BUILD_AOMP/build/rocdbgapi" || exit
+ echo " -----Installing to $INSTALL_ROCDBGAPI/lib ----- "
+ echo "$SUDO make install "
+
+ if ! $SUDO make install; then
+ echo "ERROR make install failed "
+ exit 1
+ fi
+ echo
else
echo
echo "SUCCESSFUL BUILD, please run: $0 install"
diff --git a/bin/build_rocgdb.sh b/bin/build_rocgdb.sh
index 942409a91f..4c5388815c 100755
--- a/bin/build_rocgdb.sh
+++ b/bin/build_rocgdb.sh
@@ -7,9 +7,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
# Point to the right python3.6 on Red Hat 7.6
@@ -34,51 +34,48 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $AOMP_REPOS/$AOMP_GDB_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_GDB_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_GDB_REPO_NAME"
echo " Are environment variables AOMP_REPOS and AOMP_GDB_REPO_NAME set correctly?"
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $AOMP_INSTALL_DIR
- $SUDO touch $AOMP_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $AOMP_INSTALL_DIR"
- exit 1
- fi
- $SUDO rm $AOMP_INSTALL_DIR/testfile
-fi
+check_writable_installdir "$1" "$AOMP_INSTALL_DIR"
-BUG_URL="https://github.com/ROCm-Developer-Tools/ROCgdb/issues"
+BUG_URL="https://github.com/ROCm/ROCgdb/issues"
export CXXFLAGS_FOR_BUILD="-O2"
export CFLAGS_FOR_BUILD="-O2"
-#patchrepo $AOMP_REPOS/$AOMP_GDB_REPO_NAME
+#patchrepo "$AOMP_REPOS/$AOMP_GDB_REPO_NAME"
if [ "$1" != "noconfigure" ] && [ "$1" != "install" ] ; then
echo " "
echo "This is a FRESH START. ERASING any previous builds in $BUILD_AOMP/build_rocgdb"
echo "Use ""$0 noconfigure"" or ""$0 install"" to avoid FRESH START."
- BUILDTYPE="Release"
- echo rm -rf $BUILD_AOMP/build/rocgdb
- rm -rf $BUILD_AOMP/build/rocgdb
- MYCONFIGOPTS="--prefix=$AOMP_INSTALL_DIR --srcdir=$AOMP_REPOS/$AOMP_GDB_REPO_NAME --program-prefix=roc \
- --with-bugurl="$BUG_URL" --with-pkgversion="${AOMP_COMPILER_NAME}_${AOMP_VERSION_STRING}" \
- --with-gdb-datadir="\${prefix}/share/rocgdb" \
- --enable-64-bit-bfd --enable-targets="x86_64-linux-gnu,amdgcn-amd-amdhsa" \
- --disable-ld --disable-gas --disable-gdbserver --disable-sim --enable-tui \
- --disable-gdbtk --disable-shared \
- --disable-gdbtk --disable-gprofng --disable-shared --with-expat \
- --with-system-zlib --without-guile --with-babeltrace --with-lzma \
- --with-python=python3 --with-rocm-dbgapi=$AOMP_INSTALL_DIR PKG_CONFIG_PATH=$AOMP_INSTALL_DIR/share/pkgconfig"
+ echo "rm -rf $BUILD_AOMP/build/rocgdb"
+ rm -rf "$BUILD_AOMP/build/rocgdb"
+ declare -a MYCONFIGOPTS
+ MYCONFIGOPTS=(--prefix="$AOMP_INSTALL_DIR"
+ --srcdir="$AOMP_REPOS/$AOMP_GDB_REPO_NAME"
+ --program-prefix=roc
+ --with-bugurl="$BUG_URL"
+ --with-pkgversion="${AOMP_COMPILER_NAME}_${AOMP_VERSION_STRING}"
+ --with-gdb-datadir="\${prefix}/share/rocgdb"
+ --enable-64-bit-bfd
+ --enable-targets="x86_64-linux-gnu,amdgcn-amd-amdhsa"
+ --disable-ld --disable-gas --disable-gdbserver --disable-sim
+ --enable-tui --disable-gdbtk --disable-shared --disable-gdbtk
+ --disable-gprofng --disable-shared --with-expat
+ --with-system-zlib --without-guile --with-babeltrace
+ --with-lzma --with-python=python3
+ --with-rocm-dbgapi="$AOMP_INSTALL_DIR"
+ PKG_CONFIG_PATH="$AOMP_INSTALL_DIR/share/pkgconfig")
- mkdir -p $BUILD_AOMP/build/rocgdb
+ mkdir -p "$BUILD_AOMP/build/rocgdb"
export LDFLAGS="-Wl,-rpath=$AOMP_INSTALL_DIR/lib"
- cd $BUILD_AOMP/build/rocgdb
+ cd "$BUILD_AOMP/build/rocgdb" || exit
echo " -----Running gdb configure ---- "
- echo "$AOMP_REPOS/$AOMP_GDB_REPO_NAME/configure $MYCONFIGOPTS"
- $AOMP_REPOS/$AOMP_GDB_REPO_NAME/configure $MYCONFIGOPTS
- if [ $? != 0 ] ; then
+ echo "$AOMP_REPOS/$AOMP_GDB_REPO_NAME/configure $(shquot "${MYCONFIGOPTS[@]}")"
+
+ if ! "$AOMP_REPOS/$AOMP_GDB_REPO_NAME"/configure "${MYCONFIGOPTS[@]}"; then
echo "ERROR gdb configure failed."
exit 1
fi
@@ -88,14 +85,14 @@ if [ "$1" = "configure" ]; then
exit 0
fi
-cd $BUILD_AOMP/build/rocgdb
+cd "$BUILD_AOMP/build/rocgdb" || exit
echo
echo " -----Running make for gdb ---- "
#echo make -j $AOMP_JOB_THREADS all-gdb
#make -j $AOMP_JOB_THREADS all-gdb
-echo make -j $AOMP_JOB_THREADS
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+echo "make -j $AOMP_JOB_THREADS"
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -114,15 +111,15 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_AOMP/build/rocgdb
+ cd "$BUILD_AOMP/build/rocgdb" || exit
echo " -----Installing to $AOMP_INSTALL_DIR ----- "
- echo $SUDO make install-info-gdb
+ echo "$SUDO make install-info-gdb"
$SUDO make install-info-gdb
- echo $SUDO make install-strip-gdb
- $SUDO make install-strip-gdb
- if [ $? != 0 ] ; then
+ echo "$SUDO make install-strip-gdb"
+
+ if ! $SUDO make install-strip-gdb; then
echo "ERROR make install failed "
exit 1
fi
-# removepatch $AOMP_REPOS/$AOMP_GDB_REPO_NAME
+# removepatch "$AOMP_REPOS/$AOMP_GDB_REPO_NAME"
fi
diff --git a/bin/build_rocm-cmake.sh b/bin/build_rocm-cmake.sh
index 98d638242c..98f405935d 100755
--- a/bin/build_rocm-cmake.sh
+++ b/bin/build_rocm-cmake.sh
@@ -29,15 +29,13 @@
# SOFTWARE.
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
BUILD_DIR=${BUILD_AOMP}
-BUILDTYPE="Release"
-
if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
echo " "
echo "Example commands and actions: "
@@ -47,43 +45,38 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-echo checking for $AOMP_REPOS/$AOMP_ROCMCMAKE_REPO_NAME
-if [ ! -d $AOMP_REPOS/$AOMP_ROCMCMAKE_REPO_NAME ] ; then
+echo "checking for $AOMP_REPOS/$AOMP_ROCMCMAKE_REPO_NAME"
+if [ ! -d "$AOMP_REPOS/$AOMP_ROCMCMAKE_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_ROCMCMAKE_REPO_NAME"
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $AOMP_INSTALL_DIR
- $SUDO touch $AOMP_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $AOMP_INSTALL_DIR"
- exit 1
- fi
- $SUDO rm $AOMP_INSTALL_DIR/testfile
-fi
+check_writable_installdir "$1" "$AOMP_INSTALL_DIR"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/rocm-cmake" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/rocm-cmake
- rm -rf $BUILD_DIR/build/rocm-cmake
+ echo rm -rf "$BUILD_DIR/build/rocm-cmake"
+ rm -rf "$BUILD_DIR/build/rocm-cmake"
fi
- export CMAKE_PREFIX_PATH="""$AOMP_INSTALL_DIR"""
- MYCMAKEOPTS="-DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR"
+ declare -a MYCMAKEOPTS
+
+ export CMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR"
+ MYCMAKEOPTS=(-DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR")
- mkdir -p $BUILD_DIR/build/rocm-cmake
- cd $BUILD_DIR/build/rocm-cmake
+ mkdir -p "$BUILD_DIR/build/rocm-cmake"
+ cd "$BUILD_DIR/build/rocm-cmake" || exit
echo
echo " -----Running rocm-cmake cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_ROCMCMAKE_REPO_NAME
- ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_ROCMCMAKE_REPO_NAME
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ "$AOMP_REPOS/$AOMP_ROCMCMAKE_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_ROCMCMAKE_REPO_NAME"; then
echo "ERROR rocm-cmake cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -92,17 +85,17 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_DIR/build/rocm-cmake
+cd "$BUILD_DIR/build/rocm-cmake" || exit
# ----------- no make for this component
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_DIR/build/rocm-cmake
+ cd "$BUILD_DIR/build/rocm-cmake" || exit
echo
echo " -----Installing to $AOMP_INSTALL_DIR ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
diff --git a/bin/build_rocm_smi_lib.sh b/bin/build_rocm_smi_lib.sh
index 6ff9df710a..b074713b76 100755
--- a/bin/build_rocm_smi_lib.sh
+++ b/bin/build_rocm_smi_lib.sh
@@ -29,9 +29,9 @@
# SOFTWARE.
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
RSMILIB_REPO_DIR=$AOMP_REPOS/rocm_smi_lib
@@ -50,12 +50,12 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $RSMILIB_REPO_DIR ] ; then
+if [ ! -d "$RSMILIB_REPO_DIR" ] ; then
echo "ERROR: Missing repository $RSMILIB_REPO_DIR/"
exit 1
fi
-if [ ! -f $LLVM_INSTALL_LOC/bin/clang ] ; then
+if [ ! -f "$LLVM_INSTALL_LOC/bin/clang" ] ; then
echo "ERROR: Missing file $AOMP/bin/clang"
echo " Build the AOMP llvm compiler in $AOMP first"
echo " This is needed to build the device libraries"
@@ -63,38 +63,35 @@ if [ ! -f $LLVM_INSTALL_LOC/bin/clang ] ; then
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $AOMP_INSTALL_DIR
- $SUDO touch $AOMP_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $AOMP_INSTALL_DIR"
- exit 1
- fi
- $SUDO rm $AOMP_INSTALL_DIR/testfile
-fi
+check_writable_installdir "$1" "$AOMP_INSTALL_DIR"
-patchrepo $AOMP_REPOS/rocm_smi_lib
+patchrepo "$AOMP_REPOS/rocm_smi_lib"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/rocm_smi_lib" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/rocm_smi_lib
- rm -rf $BUILD_DIR/build/rocm_smi_lib
+ echo "rm -rf $BUILD_DIR/build/rocm_smi_lib"
+ rm -rf "$BUILD_DIR/build/rocm_smi_lib"
fi
- MYCMAKEOPTS="$AOMP_ORIGIN_RPATH -DCMAKE_BUILD_TYPE=$BUILDTYPE -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH='\$ORIGIN/../lib' -DCMAKE_EXE_LINKER_FLAGS='-Wl,--disable-new-dtags'"
+ declare -a MYCMAKEOPTS
+
+ MYCMAKEOPTS=("${AOMP_ORIGIN_RPATH[@]}" -DCMAKE_BUILD_TYPE="$BUILDTYPE"
+ -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR"
+ -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
+ -DCMAKE_INSTALL_RPATH="\$ORIGIN/../lib"
+ -DCMAKE_EXE_LINKER_FLAGS='-Wl,--disable-new-dtags')
- mkdir -p $BUILD_DIR/build/rocm_smi_lib
- cd $BUILD_DIR/build/rocm_smi_lib
+ mkdir -p "$BUILD_DIR/build/rocm_smi_lib"
+ cd "$BUILD_DIR/build/rocm_smi_lib" || exit
echo
echo " -----Running rocm_smi_lib cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $RSMILIB_REPO_DIR
- ${AOMP_CMAKE} $MYCMAKEOPTS $RSMILIB_REPO_DIR
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE} $(shquot "${MYCMAKEOPTS[@]}") $RSMILIB_REPO_DIR"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$RSMILIB_REPO_DIR"; then
echo "ERROR rocm_smi_lib cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -103,11 +100,11 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_DIR/build/rocm_smi_lib
+cd "$BUILD_DIR/build/rocm_smi_lib" || exit
echo
echo " -----Running make for rocm_smi_lib ---- "
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -125,13 +122,13 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_DIR/build/rocm_smi_lib
+ cd "$BUILD_DIR/build/rocm_smi_lib" || exit
echo
echo " -----Installing to $AOMP_INSTALL_DIR ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
- removepatch $AOMP_REPOS/rocm_smi_lib
+ removepatch "$AOMP_REPOS/rocm_smi_lib"
fi
diff --git a/bin/build_rocminfo.sh b/bin/build_rocminfo.sh
index c438afed02..0af84d537f 100755
--- a/bin/build_rocminfo.sh
+++ b/bin/build_rocminfo.sh
@@ -29,9 +29,9 @@
# SOFTWARE.
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
RINFO_REPO_DIR=$AOMP_REPOS/$AOMP_RINFO_REPO_NAME
@@ -41,7 +41,6 @@ BUILD_DIR=${BUILD_AOMP}
BUILDTYPE="Release"
INSTALL_RINFO=${INSTALL_RINFO:-$AOMP_INSTALL_DIR}
-LLVM_BUILD=$AOMP
if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
echo " "
@@ -53,12 +52,12 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $RINFO_REPO_DIR ] ; then
+if [ ! -d "$RINFO_REPO_DIR" ] ; then
echo "ERROR: Missing repository $RINFO_REPO_DIR/"
exit 1
fi
-if [ ! -f $LLVM_INSTALL_LOC/bin/clang ] ; then
+if [ ! -f "$LLVM_INSTALL_LOC/bin/clang" ] ; then
echo "ERROR: Missing file $LLVM_INSTALL_LOC/bin/clang"
echo " Build the AOMP llvm compiler in $AOMP first"
echo " This is needed to build the device libraries"
@@ -66,38 +65,36 @@ if [ ! -f $LLVM_INSTALL_LOC/bin/clang ] ; then
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_RINFO
- $SUDO touch $INSTALL_RINFO/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_RINFO"
- exit 1
- fi
- $SUDO rm $INSTALL_RINFO/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_RINFO"
-patchrepo $AOMP_REPOS/$AOMP_RINFO_REPO_NAME
+patchrepo "$AOMP_REPOS/$AOMP_RINFO_REPO_NAME"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
if [ -d "$BUILD_DIR/build/rocminfo" ] ; then
echo
echo "FRESH START , CLEANING UP FROM PREVIOUS BUILD"
- echo rm -rf $BUILD_DIR/build/rocminfo
- rm -rf $BUILD_DIR/build/rocminfo
+ echo "rm -rf $BUILD_DIR/build/rocminfo"
+ rm -rf "$BUILD_DIR/build/rocminfo"
fi
- MYCMAKEOPTS="$AOMP_ORIGIN_RPATH -DCMAKE_BUILD_TYPE=$BUILDTYPE -DCMAKE_INSTALL_PREFIX=$INSTALL_RINFO -DROCRTST_BLD_TYPE=$BUILDTYPE -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH='\$ORIGIN/../lib' -DCMAKE_EXE_LINKER_FLAGS='-Wl,--disable-new-dtags'"
+ declare -a MYCMAKEOPTS
+
+ MYCMAKEOPTS=("${AOMP_ORIGIN_RPATH[@]}" -DCMAKE_BUILD_TYPE="$BUILDTYPE"
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_RINFO"
+ -DROCRTST_BLD_TYPE="$BUILDTYPE"
+ -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
+ -DCMAKE_INSTALL_RPATH="\$ORIGIN/../lib"
+ -DCMAKE_EXE_LINKER_FLAGS='-Wl,--disable-new-dtags')
- mkdir -p $BUILD_DIR/build/rocminfo
- cd $BUILD_DIR/build/rocminfo
+ mkdir -p "$BUILD_DIR/build/rocminfo"
+ cd "$BUILD_DIR/build/rocminfo" || exit
echo
echo " -----Running rocminfo cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $RINFO_REPO_DIR
- ${AOMP_CMAKE} $MYCMAKEOPTS $RINFO_REPO_DIR
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE} $(shquot "${MYCMAKEOPTS[@]}") $RINFO_REPO_DIR"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$RINFO_REPO_DIR"; then
echo "ERROR rocminfo cmake failed. Cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -106,11 +103,11 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_DIR/build/rocminfo
+cd "$BUILD_DIR/build/rocminfo" || exit
echo
echo " -----Running make for rocminfo ---- "
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -128,13 +125,13 @@ fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_DIR/build/rocminfo
- echo
- echo " -----Installing to $INSTALL_RINFO ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
- echo "ERROR make install failed "
- exit 1
- fi
- removepatch $AOMP_REPOS/$AOMP_RINFO_REPO_NAME
+ cd "$BUILD_DIR/build/rocminfo" || exit
+ echo
+ echo " -----Installing to $INSTALL_RINFO ----- "
+
+ if ! $SUDO make install; then
+ echo "ERROR make install failed "
+ exit 1
+ fi
+ removepatch "$AOMP_REPOS/$AOMP_RINFO_REPO_NAME"
fi
diff --git a/bin/build_rocprofiler-register.sh b/bin/build_rocprofiler-register.sh
index de51e53662..f8cc44faa2 100755
--- a/bin/build_rocprofiler-register.sh
+++ b/bin/build_rocprofiler-register.sh
@@ -1,12 +1,16 @@
#!/bin/bash
#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
# build_rocprofiler-register.sh: Script to build rocprofiler-register for AOMP standalone build
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_ROCPROF_REGISTER=${INSTALL_ROCPROF_REGISTER:-$AOMP_INSTALL_DIR}
@@ -29,42 +33,52 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $AOMP_REPOS/$AOMP_PROF_REGISTER_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_PROF_REGISTER_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_PROF_REGISTER_REPO_NAME"
echo " Are environment variables AOMP_REPOS and AOMP_PROF_REGISTER_REPO_NAME set correctly?"
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_ROCPROF_REGISTER
- $SUDO touch $INSTALL_ROCPROF_REGISTER/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_ROCPROF_REGISTER"
- exit 1
- fi
- $SUDO rm $INSTALL_ROCPROF_REGISTER/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_ROCPROF_REGISTER"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo " "
echo "This is a FRESH START. ERASING any previous builds in $BUILD_AOMP/$AOMP_PROF_REGISTER_REPO_NAME"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- echo rm -rf $BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME
- rm -rf $BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME
+ echo "rm -rf $BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME"
+ rm -rf "$BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME"
BUILD_TYPE="Release"
export CMAKE_BUILD_TYPE=$BUILD_TYPE
CMAKE_PREFIX_PATH="$ROCM_DIR/include;$ROCM_DIR/lib;$ROCM_DIR"
export CMAKE_PREFIX_PATH
- GFXSEMICOLONS=`echo $GFXLIST | tr ' ' ';' `
- mkdir -p $BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME
- cd $BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME
+ mkdir -p "$BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME"
+ cd "$BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME" || exit
echo " -----Running $AOMP_PROF_REGISTER_REPO_NAME cmake ---- "
- echo ${AOMP_CMAKE} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DROCM_PATH=$AOMP_INSTALL_DIR -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCPROF_REGISTER -DCMAKE_PREFIX_PATH="""$CMAKE_PREFIX_PATH""" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--disable-new-dtags" -DROCPROFILER_REGISTER_BUILD_TESTS=1 -DROCPROFILER_REGISTER_BUILD_SAMPLES=1 -DCMAKE_EXE_LINKER_FLAGS="-Wl,--disable-new-dtags" -DBUILD_SHARED_LIBS=ON -DENABLE_LDCONFIG=OFF -DROCPROFILER_REGISTER_BUILD_TESTS=1 -DROCPROFILER_REGISTER_BUILD_SAMPLES=1 $AOMP_ORIGIN_RPATH $AOMP_REPOS/$AOMP_PROF_REGISTER_REPO_NAME
- ${AOMP_CMAKE} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DROCM_PATH=$AOMP_INSTALL_DIR -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCPROF_REGISTER -DCMAKE_PREFIX_PATH="""$CMAKE_PREFIX_PATH""" $AOMP_ORIGIN_RPATH -DCMAKE_EXE_LINKER_FLAGS="-Wl,--disable-new-dtags" -DBUILD_SHARED_LIBS=ON -DENABLE_LDCONFIG=OFF -DROCPROFILER_REGISTER_BUILD_TESTS=1 -DROCPROFILER_REGISTER_BUILD_SAMPLES=1 $AOMP_REPOS/$AOMP_PROF_REGISTER_REPO_NAME
+ echo "${AOMP_CMAKE}" "-DCMAKE_INSTALL_LIBDIR=lib" \
+ "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \
+ "-DROCM_PATH=$AOMP_INSTALL_DIR" \
+ "-DCMAKE_INSTALL_PREFIX=$INSTALL_ROCPROF_REGISTER" \
+ "-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" \
+ "-DCMAKE_EXE_LINKER_FLAGS=-Wl,--disable-new-dtags" \
+ "-DROCPROFILER_REGISTER_BUILD_TESTS=0" \
+ "-DROCPROFILER_REGISTER_BUILD_SAMPLES=1" \
+ "-DCMAKE_EXE_LINKER_FLAGS=-Wl,--disable-new-dtags" \
+ "-DBUILD_SHARED_LIBS=ON -DENABLE_LDCONFIG=OFF" \
+ "$(shquot "${AOMP_ORIGIN_RPATH[@]}")" \
+ "$AOMP_REPOS/$AOMP_PROF_REGISTER_REPO_NAME"
- if [ $? != 0 ] ; then
+ if ! ${AOMP_CMAKE} -DCMAKE_INSTALL_LIBDIR=lib \
+ -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
+ -DROCM_PATH="$AOMP_INSTALL_DIR" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCPROF_REGISTER" \
+ -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
+ "${AOMP_ORIGIN_RPATH[@]}" \
+ -DCMAKE_EXE_LINKER_FLAGS="-Wl,--disable-new-dtags" \
+ -DBUILD_SHARED_LIBS=ON -DENABLE_LDCONFIG=OFF \
+ -DROCPROFILER_REGISTER_BUILD_TESTS=0 \
+ -DROCPROFILER_REGISTER_BUILD_SAMPLES=1 \
+ "$AOMP_REPOS/$AOMP_PROF_REGISTER_REPO_NAME"; then
echo "ERROR $AOMP_PROF_REGISTER_REPO_NAME cmake failed. cmake flags"
echo " $MYCMAKEOPTS"
exit 1
@@ -75,12 +89,12 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME
+cd "$BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME" || exit
echo
echo " -----Running make for $AOMP_PROF_REGISTER_REPO_NAME ---- "
-echo make -j $AOMP_JOB_THREADS
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+echo "make -j $AOMP_JOB_THREADS"
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -90,12 +104,12 @@ if [ $? != 0 ] ; then
fi
# ----------- Install only if asked ----------------------------
-if [ "$1" == "install" ] ; then
- cd $BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME
+if [ "$1" == "install" ] ; then
+ cd "$BUILD_AOMP/build/$AOMP_PROF_REGISTER_REPO_NAME" || exit
echo " -----Installing to $INSTALL_ROCPROF_REGISTER/lib ----- "
- echo $SUDO make install
- $SUDO make install
- if [ $? != 0 ] ; then
+ echo "$SUDO make install"
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
diff --git a/bin/build_rocprofiler-sdk.sh b/bin/build_rocprofiler-sdk.sh
new file mode 100755
index 0000000000..f2e405a253
--- /dev/null
+++ b/bin/build_rocprofiler-sdk.sh
@@ -0,0 +1,133 @@
+#!/bin/bash
+#
+# build_rocprofiler-sdk.sh: Script to build rocprofiler-sdk for AOMP standalone build
+#
+
+# --- Start standard header to set AOMP environment variables ----
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
+# --- end standard header ----
+
+INSTALL_ROCPROF_SDK=${INSTALL_ROCPROF_SDK:-$AOMP_INSTALL_DIR}
+export HIP_CLANG_PATH=$LLVM_INSTALL_LOC/bin
+export ROCM_PATH=$AOMP_INSTALL_DIR
+
+if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
+ echo " "
+ echo " This script builds the ROCM runtime libraries"
+ echo " It gets the source from: $AOMP_REPOS/$AOMP_PROF_SDK_REPO_NAME"
+ echo " It builds libraries in: $BUILD_AOMP/build/rocprofiler-sdk"
+ echo " It installs in: $INSTALL_ROCPROF_SDK"
+ echo " "
+ echo "Example commands and actions: "
+ echo " ./build_rocprofiler-sdk.sh cmake, make , NO Install "
+ echo " ./build_rocprofiler-sdk.sh nocmake NO cmake, make, NO install "
+ echo " ./build_rocprofiler-sdk.sh install NO Cmake, make , INSTALL"
+ echo " "
+ echo "To build aomp, see the README file in this directory"
+ echo " "
+ exit
+fi
+
+if [ ! -d "$AOMP_REPOS/$AOMP_PROF_SDK_REPO_NAME" ] ; then
+ echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_PROF_SDK_REPO_NAME"
+ echo " Are environment variables AOMP_REPOS and AOMP_PROF_SDK_REPO_NAME set correctly?"
+ exit 1
+fi
+
+# Make sure we can update the install directory
+if [ "$1" == "install" ] ; then
+ $SUDO mkdir -p "$INSTALL_ROCPROF_SDK"
+ if ! $SUDO touch "$INSTALL_ROCPROF_SDK"/testfile; then
+ echo "ERROR: No update access to $INSTALL_ROCPROF_SDK"
+ exit 1
+ fi
+ $SUDO rm "$INSTALL_ROCPROF_SDK"/testfile
+fi
+
+if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
+ echo " "
+ echo "This is a FRESH START. ERASING any previous builds in $BUILD_AOMP/build_rocprofiler-sdk"
+ echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
+
+ echo "rm -rf $BUILD_AOMP/build/rocprofiler-sdk"
+ rm -rf "$BUILD_AOMP"/build/rocprofiler-sdk
+
+ BUILD_TYPE="Release"
+ GFXSEMICOLONS=$(echo "$GFXLIST" | tr ' ' ';')
+
+ mkdir -p "$BUILD_AOMP"/build/rocprofiler-sdk
+ cd "$BUILD_AOMP"/build/rocprofiler-sdk || exit
+ export PATH=$HOME/.local/bin:$INSTALL_ROCPROF_SDK/bin:$PATH
+
+ pythonbinary=$(which python3) || exit
+ pythonversion=$("$pythonbinary" --version) || exit
+ if [[ $pythonversion =~ ([Pp]ython)[[:space:]]*([0-9]+)\.([0-9]+) ]]; then
+ pythonversion="${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
+ else
+ echo "Error: cannot determine python version"
+ exit 1
+ fi
+
+ declare -a MYCMAKEOPTS
+
+ MYCMAKEOPTS=(-DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR;$HOME/local/aqlprofile"
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCPROF_SDK"
+ -DCMAKE_BUILD_TYPE="$BUILD_TYPE"
+ -DROCM_ROOT_DIR="$AOMP_INSTALL_DIR"
+ -DBUILD_SHARED_LIBS=On
+ -DGPU_TARGETS="$GFXSEMICOLONS"
+ -DROCPROFILER_BUILD_SAMPLES=ON
+ -DROCPROFILER_BUILD_TESTS=OFF
+ -DPython3_EXECUTABLE=$(which python3)
+ -DROCPROFILER_PYTHON_VERSIONS="$pythonversion")
+
+ echo " -----Running rocprofiler-sdk cmake ---- "
+ echo "${AOMP_CMAKE}" "${MYCMAKEOPTS[@]}" "$AOMP_REPOS/$AOMP_PROF_SDK_REPO_NAME"
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$AOMP_REPOS/$AOMP_PROF_SDK_REPO_NAME"; then
+ echo "ERROR rocprofiler-sdk cmake failed. cmake flags"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
+ exit 1
+ fi
+fi
+
+if [ "$1" = "cmake" ]; then
+ exit 0
+fi
+
+cd "$BUILD_AOMP"/build/rocprofiler-sdk || exit
+echo
+echo " -----Running make for rocprofiler-sdk ---- "
+echo make -j "$AOMP_JOB_THREADS"
+if ! make -j "$AOMP_JOB_THREADS"; then
+ echo " "
+ echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
+ echo "To restart:"
+ echo " cd $BUILD_AOMP/build/rocprofiler-sdk"
+ echo " make"
+ exit 1
+fi
+
+# ----------- Install only if asked ----------------------------
+if [ "$1" == "install" ] ; then
+ cd "$BUILD_AOMP"/build/rocprofiler-sdk || exit
+ echo " -----Installing to $INSTALL_ROCPROF_SDK/lib ----- "
+ echo $SUDO make install
+ if ! $SUDO make install; then
+ echo "ERROR make install failed "
+ exit 1
+ fi
+ if [ -d "$HOME/local/aqlprofile/lib" ]; then
+ echo Copying aqlprofile libraries from $HOME/local/aqlprofile/lib to $INSTALL_ROCPROF_SDK/lib
+ cp -r $HOME/local/aqlprofile/lib/* $INSTALL_ROCPROF_SDK/lib
+ else
+ echo "Error: rocprofiler-sdk needs aqlprofile libraries to exist in $INSTALL_ROCPROF_SDK/lib. Please run ./build_prereq.sh first."
+ exit 1
+ fi
+else
+ echo
+ echo "SUCCESSFUL BUILD, please run: $0 install"
+ echo " to install into $AOMP"
+ echo
+fi
diff --git a/bin/build_rocprofiler.sh b/bin/build_rocprofiler.sh
index 0785e2dcaf..8cf77057d3 100755
--- a/bin/build_rocprofiler.sh
+++ b/bin/build_rocprofiler.sh
@@ -4,9 +4,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_ROCPROF=${INSTALL_ROCPROF:-$AOMP_INSTALL_DIR}
@@ -30,39 +30,30 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $AOMP_REPOS/$AOMP_PROF_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_PROF_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_PROF_REPO_NAME"
echo " Are environment variables AOMP_REPOS and AOMP_PROF_REPO_NAME set correctly?"
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_ROCPROF
- $SUDO touch $INSTALL_ROCPROF/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_ROCPROF"
- exit 1
- fi
- $SUDO rm $INSTALL_ROCPROF/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_ROCPROF"
-patchrepo $AOMP_REPOS/$AOMP_PROF_REPO_NAME
+patchrepo "$AOMP_REPOS/$AOMP_PROF_REPO_NAME"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo " "
echo "This is a FRESH START. ERASING any previous builds in $BUILD_AOMP/build_rocprofiler"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- echo rm -rf $BUILD_AOMP/build/rocprofiler
- rm -rf $BUILD_AOMP/build/rocprofiler
- CMAKE_WITH_EXPERIMENTAL=""
+ echo "rm -rf $BUILD_AOMP/build/rocprofiler"
+ rm -rf "$BUILD_AOMP/build/rocprofiler"
+ CMAKE_WITH_EXPERIMENTAL=()
if [ -d "/usr/include/c++/5/experimental" ] ; then
- _loc=`which gcc`
+ _loc=$(which gcc)
if [ "$_loc" != "" ] ; then
- _gccver=`$_loc --version | grep gcc | cut -d")" -f2 | cut -d"." -f1`
- if [ "$_gccver" == "5" ] ; then
- CMAKE_WITH_EXPERIMENTAL="-DCMAKE_CXX_FLAGS=-I/usr/include/c++/5/experimental"
+ _gccver=$($_loc --version | grep gcc | cut -d")" -f2 | cut -d"." -f1)
+ if [ "$_gccver" == "5" ] ; then
+ CMAKE_WITH_EXPERIMENTAL=(-DCMAKE_CXX_FLAGS=-I/usr/include/c++/5/experimental)
fi
fi
fi
@@ -74,14 +65,48 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
#export HSA_RUNTIME_LIB=$ROCM_DIR/include/lib
#export HSA_KMT_LIB=$ROCM_DIR/lib
#export HSA_KMT_LIB_PATH=$ROCM_DIR/lib
- GFXSEMICOLONS=`echo $GFXLIST | tr ' ' ';' `
- mkdir -p $BUILD_AOMP/build/rocprofiler
- cd $BUILD_AOMP/build/rocprofiler
+ GFXSEMICOLONS=$(echo "$GFXLIST" | tr ' ' ';')
+ mkdir -p "$BUILD_AOMP/build/rocprofiler"
+ cd "$BUILD_AOMP/build/rocprofiler" || exit
export PATH=$HOME/.local/bin:$INSTALL_ROCPROF/bin:$PATH
echo " -----Running rocprofiler cmake ---- "
- echo ${AOMP_CMAKE} -DCMAKE_INSTALL_LIBDIR=lib -DENABLE_ASAN_PACKAGING=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DROCM_PATH=$AOMP_INSTALL_DIR -DCMAKE_MODULE_PATH=$INSTALL_ROCPROF/lib/cmake/hip -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCPROF -DCMAKE_PREFIX_PATH="""$CMAKE_PREFIX_PATH""" $CMAKE_WITH_EXPERIMENTAL $AOMP_ORIGIN_RPATH -DGPU_TARGETS="""$GFXSEMICOLONS""" -DPROF_API_HEADER_PATH=$INSTALL_ROCPROF/include/roctracer/ext -DHIP_ROOT_DIR=$INSTALL_ROCPROF/hip $AOMP_REPOS/$AOMP_PROF_REPO_NAME -DAQLPROFILE_LIB=$AOMP_SUPP/aqlprofile/lib/libhsa-amd-aqlprofile64.so -DCMAKE_CXX_FLAGS=-I$HOME/local/rocmsmilib/include -DHIP_HIPCC_FLAGS="-I$HOME/local/rocmsmilib/include" -DCMAKE_EXE_LINKER_FLAGS="-L$HOME/local/rocmsmilib/lib -L$HOME/local/rocmsmilib/lib64 -Wl,--disable-new-dtags"
- ${AOMP_CMAKE} -DCMAKE_INSTALL_LIBDIR=lib -DENABLE_ASAN_PACKAGING=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DROCM_PATH=$AOMP_INSTALL_DIR -DCMAKE_MODULE_PATH=$INSTALL_ROCPROF/lib/cmake/hip -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCPROF -DCMAKE_PREFIX_PATH="""$CMAKE_PREFIX_PATH""" $CMAKE_WITH_EXPERIMENTAL $AOMP_ORIGIN_RPATH -DGPU_TARGETS="""$GFXSEMICOLONS""" -DPROF_API_HEADER_PATH=$INSTALL_ROCPROF/include/roctracer/ext -DHIP_ROOT_DIR=$INSTALL_ROCPROF/hip $AOMP_REPOS/$AOMP_PROF_REPO_NAME -DAQLPROFILE_LIB=$AOMP_SUPP/aqlprofile/lib/libhsa-amd-aqlprofile64.so -DCMAKE_CXX_FLAGS=-I$HOME/local/rocmsmilib/include -DHIP_HIPCC_FLAGS="-I$HOME/local/rocmsmilib/include" -DCMAKE_EXE_LINKER_FLAGS="-L$HOME/local/rocmsmilib/lib -L$HOME/local/rocmsmilib/lib64 -Wl,--disable-new-dtags"
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "-DCMAKE_INSTALL_LIBDIR=lib" \
+ "-DENABLE_ASAN_PACKAGING=ON" \
+ "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \
+ "-DROCM_PATH=$AOMP_INSTALL_DIR" \
+ "-DCMAKE_MODULE_PATH=$INSTALL_ROCPROF/lib/cmake/hip" \
+ "-DCMAKE_INSTALL_PREFIX=$INSTALL_ROCPROF" \
+ "-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" \
+ "${CMAKE_WITH_EXPERIMENTAL[@]}" \
+ "${AOMP_ORIGIN_RPATH[@]}" \
+ "-DGPU_TARGETS=$GFXSEMICOLONS" \
+ "-DPROF_API_HEADER_PATH=$INSTALL_ROCPROF/include/roctracer/ext" \
+ "-DHIP_ROOT_DIR=$INSTALL_ROCPROF/hip" \
+ "$AOMP_REPOS/$AOMP_PROF_REPO_NAME" \
+ "-DAQLPROFILE_LIB=$AOMP_SUPP/aqlprofile/lib/libhsa-amd-aqlprofile64.so" \
+ "-DCMAKE_CXX_FLAGS=-I$HOME/local/rocmsmilib/include" \
+ "-DHIP_HIPCC_FLAGS=-I$HOME/local/rocmsmilib/include" \
+ "-DCMAKE_EXE_LINKER_FLAGS=-L$HOME/local/rocmsmilib/lib" \
+ "-L$HOME/local/rocmsmilib/lib64" \
+ "-Wl,--disable-new-dtags"
+
+ if ! ${AOMP_CMAKE} -DCMAKE_INSTALL_LIBDIR=lib \
+ -DENABLE_ASAN_PACKAGING=ON \
+ -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
+ -DROCM_PATH="$AOMP_INSTALL_DIR" \
+ -DCMAKE_MODULE_PATH="$INSTALL_ROCPROF/lib/cmake/hip" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCPROF" \
+ -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
+ "${CMAKE_WITH_EXPERIMENTAL[@]}" \
+ "${AOMP_ORIGIN_RPATH[@]}" \
+ -DGPU_TARGETS="$GFXSEMICOLONS" \
+ -DPROF_API_HEADER_PATH="$INSTALL_ROCPROF/include/roctracer/ext" \
+ -DHIP_ROOT_DIR="$INSTALL_ROCPROF/hip" \
+ "$AOMP_REPOS/$AOMP_PROF_REPO_NAME" \
+ -DAQLPROFILE_LIB="$AOMP_SUPP/aqlprofile/lib/libhsa-amd-aqlprofile64.so" \
+ -DCMAKE_CXX_FLAGS="-I$HOME/local/rocmsmilib/include" \
+ -DHIP_HIPCC_FLAGS="-I$HOME/local/rocmsmilib/include" \
+ -DCMAKE_EXE_LINKER_FLAGS="-L$HOME/local/rocmsmilib/lib -L$HOME/local/rocmsmilib/lib64 -Wl,--disable-new-dtags"; then
echo "ERROR rocprofiler cmake failed. cmake flags"
echo " $MYCMAKEOPTS"
exit 1
@@ -92,13 +117,13 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_AOMP/build/rocprofiler
+cd "$BUILD_AOMP/build/rocprofiler" || exit
echo
echo " -----Running make for rocprofiler ---- "
-echo make -j $AOMP_JOB_THREADS
-make -j $AOMP_JOB_THREADS
-make -j $AOMP_JOB_THREADS mytest
-if [ $? != 0 ] ; then
+echo "make -j $AOMP_JOB_THREADS"
+make -j "$AOMP_JOB_THREADS"
+
+if ! make -j "$AOMP_JOB_THREADS" mytest; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -107,26 +132,26 @@ if [ $? != 0 ] ; then
exit 1
fi
-doxygen=`which doxygen`
-if [ ! -z $doxygen ] ; then
+doxygen=$(which doxygen)
+if [ -n "$doxygen" ] ; then
# the rocprofiler CMakeLists.txt will prepare docs install if doxygen found.
# However, the make doc has issues. But if you dont make doc, the install
# fails. This 'make doc' will do enough so install does not fail.
- echo make -j $AOMP_JOB_THREADS doc
- make -j $AOMP_JOB_THREADS doc 2>/dev/null >/dev/null
+ echo "make -j $AOMP_JOB_THREADS doc"
+ make -j "$AOMP_JOB_THREADS" doc 2>/dev/null >/dev/null
fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_AOMP/build/rocprofiler
+ cd "$BUILD_AOMP/build/rocprofiler" || exit
echo " -----Installing to $INSTALL_ROCPROF/lib ----- "
- echo $SUDO make install
- $SUDO make install
- if [ $? != 0 ] ; then
+ echo "$SUDO make install"
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
- removepatch $AOMP_REPOS/$AOMP_PROF_REPO_NAME
+ removepatch "$AOMP_REPOS/$AOMP_PROF_REPO_NAME"
else
echo
echo "SUCCESSFUL BUILD, please run: $0 install"
diff --git a/bin/build_rocr.sh b/bin/build_rocr.sh
index 51e2cf0887..b78bcb9370 100755
--- a/bin/build_rocr.sh
+++ b/bin/build_rocr.sh
@@ -6,9 +6,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_ROCM=${INSTALL_ROCM:-$AOMP_INSTALL_DIR}
@@ -30,28 +30,20 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $AOMP_REPOS/$AOMP_ROCR_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_ROCR_REPO_NAME"
echo " Are environment variables AOMP_REPOS and AOMP_ROCR_REPO_NAME set correctly?"
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_ROCM
- $SUDO touch $INSTALL_ROCM/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_ROCM"
- exit 1
- fi
- $SUDO rm $INSTALL_ROCM/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_ROCM"
-patchrepo $AOMP_REPOS/$AOMP_ROCR_REPO_NAME
+patchrepo "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME"
-if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- LDFLAGS="-fuse-ld=lld $ASAN_FLAGS"
-fi
+#if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ #LDFLAGS=$(shquot '-fuse-ld=lld' "${ASAN_FLAGS[@]}")
+ #export LDFLAGS
+#fi
_ompd_src_dir="$LLVM_INSTALL_LOC/share/gdb/python/ompd/src"
@@ -62,51 +54,93 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
BUILDTYPE="Release"
- echo rm -rf $BUILD_AOMP/build/rocr
- rm -rf $BUILD_AOMP/build/rocr
+ echo "rm -rf $BUILD_AOMP/build/rocr"
+ rm -rf "$BUILD_AOMP/build/rocr"
export PATH=/opt/rocm/llvm/bin:$PATH
- MYCMAKEOPTS="-DCMAKE_INSTALL_PREFIX=$INSTALL_ROCM -DCMAKE_BUILD_TYPE=$BUILDTYPE -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib -DIMAGE_SUPPORT=OFF $AOMP_ORIGIN_RPATH -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_C_COMPILER=${AOMP_INSTALL_DIR}/lib/llvm/bin/clang -DCMAKE_CXX_COMPILER=${AOMP_INSTALL_DIR}/lib/llvm/bin/clang++ -DLLVM_DIR=$AOMP_INSTALL_DIR/lib/llvm/bin -DBUILD_SHARED_LIBS=On"
- mkdir -p $BUILD_AOMP/build/rocr
- cd $BUILD_AOMP/build/rocr
+ declare -a MYCMAKEOPTS
+ MYCMAKEOPTS=(-DCMAKE_INSTALL_PREFIX="$INSTALL_ROCM"
+ -DCMAKE_BUILD_TYPE="$BUILDTYPE"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib"
+ -DIMAGE_SUPPORT=OFF "${AOMP_ORIGIN_RPATH[@]}"
+ -DCMAKE_INSTALL_LIBDIR=lib
+ -DCMAKE_C_COMPILER="${AOMP_INSTALL_DIR}/lib/llvm/bin/clang"
+ -DCMAKE_CXX_COMPILER="${AOMP_INSTALL_DIR}/lib/llvm/bin/clang++"
+ -DLLVM_DIR="$AOMP_INSTALL_DIR/lib/llvm/bin"
+ -DBUILD_SHARED_LIBS=On)
+ mkdir -p "$BUILD_AOMP/build/rocr"
+ cd "$BUILD_AOMP/build/rocr" || exit
echo
echo " -----Running rocr cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_ROCR_REPO_NAME
- ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_ROCR_REPO_NAME
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME"; then
echo "ERROR rocr cmake failed. cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ declare -a ASAN_CMAKE_OPTS
# unused prefix path :$ROCM_DIR/lib/asan/cmake;${AOMP_INSTALL_DIR}/lib/cmake
- ASAN_CMAKE_OPTS="-DCMAKE_C_COMPILER=${AOMP_INSTALL_DIR}/lib/llvm/bin/clang -DCMAKE_CXX_COMPILER=${AOMP_INSTALL_DIR}/lib/llvm/bin/clang++ -DLLVM_DIR=$AOMP_INSTALL_DIR/lib/llvm/bin -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR -DCMAKE_INSTALL_LIBDIR=lib/asan -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib -DIMAGE_SUPPORT=OFF $AOMP_ASAN_ORIGIN_RPATH -DBUILD_SHARED_LIBS=On"
- mkdir -p $BUILD_AOMP/build/rocr/asan
- cd $BUILD_AOMP/build/rocr/asan
+ ASAN_CMAKE_OPTS=(-DCMAKE_C_COMPILER="${AOMP_INSTALL_DIR}/lib/llvm/bin/clang"
+ -DCMAKE_CXX_COMPILER="${AOMP_INSTALL_DIR}/lib/llvm/bin/clang++"
+ -DLLVM_DIR="$AOMP_INSTALL_DIR/lib/llvm/bin"
+ -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR"
+ -DCMAKE_INSTALL_LIBDIR=lib/asan
+ -DCMAKE_BUILD_TYPE="$BUILD_TYPE"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib"
+ -DIMAGE_SUPPORT=OFF "${AOMP_ASAN_ORIGIN_RPATH[@]}"
+ -DBUILD_SHARED_LIBS=On)
+ mkdir -p "$BUILD_AOMP/build/rocr/asan"
+ cd "$BUILD_AOMP/build/rocr/asan" || exit
echo
echo " ----Running rocr-asan cmake ----- "
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" $AOMP_REPOS/$AOMP_ROCR_REPO_NAME
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" $AOMP_REPOS/$AOMP_ROCR_REPO_NAME
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME"; then
echo "ERROR rocr-asan cmake failed. cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
- echo rm -rf $BUILD_AOMP/build/rocr_debug
- [ -d $BUILD_AOMP/build/rocr_debug ] && rm -rf $BUILD_AOMP/build/rocr_debug
- ROCR_CMAKE_OPTS="-DCMAKE_C_COMPILER=$AOMP_INSTALL_DIR/lib/llvm/bin/clang -DCMAKE_CXX_COMPILER=$AOMP_INSTALL_DIR/lib/llvm/bin/clang++ -DLLVM_DIR=$AOMP_INSTALL_DIR/lib/llvm/bin -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR -DCMAKE_BUILD_TYPE=Debug $AOMP_DEBUG_ORIGIN_RPATH -DCMAKE_INSTALL_LIBDIR=lib-debug -DBUILD_SHARED_LIBS=On -DIMAGE_SUPPORT=OFF"
+ echo "rm -rf $BUILD_AOMP/build/rocr_debug"
+ [ -d "$BUILD_AOMP/build/rocr_debug" ] && rm -rf "$BUILD_AOMP/build/rocr_debug"
+ declare -a ROCR_CMAKE_OPTS
+ ROCR_CMAKE_OPTS=(-DCMAKE_C_COMPILER="$AOMP_INSTALL_DIR/lib/llvm/bin/clang"
+ -DCMAKE_CXX_COMPILER="$AOMP_INSTALL_DIR/lib/llvm/bin/clang++"
+ -DLLVM_DIR="$AOMP_INSTALL_DIR/lib/llvm/bin"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib"
+ -DCMAKE_INSTALL_PREFIX="$AOMP_INSTALL_DIR"
+ -DCMAKE_BUILD_TYPE=Debug
+ "${AOMP_DEBUG_ORIGIN_RPATH[@]}"
+ -DCMAKE_INSTALL_LIBDIR=lib-debug
+ -DBUILD_SHARED_LIBS=On
+ -DIMAGE_SUPPORT=OFF
+ -DTARGET_DEVICES="gfx900;gfx90a;gfx942;gfx1010;gfx1030;gfx1100;gfx1200")
echo
echo " -----Running rocr_debug cmake -----"
- mkdir -p $BUILD_AOMP/build/rocr_debug
- cd $BUILD_AOMP/build/rocr_debug
- _prefix_map="\""-fdebug-prefix-map=$AOMP_REPOS/$AOMP_ROCR_REPO_NAME=$_ompd_src_dir/rocr"\""
- echo ${AOMP_CMAKE} $ROCR_CMAKE_OPTS -DCMAKE_C_FLAGS="-g $_prefix_map" -DCMAKE_CXX_FLAGS="-g $_prefix_map" $AOMP_REPOS/$AOMP_ROCR_REPO_NAME
- ${AOMP_CMAKE} $ROCR_CMAKE_OPTS -DCMAKE_C_FLAGS="-g $_prefix_map" -DCMAKE_CXX_FLAGS="-g $_prefix_map" $AOMP_REPOS/$AOMP_ROCR_REPO_NAME
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_AOMP/build/rocr_debug"
+ cd "$BUILD_AOMP/build/rocr_debug" || exit
+ _prefix_map=(-fdebug-prefix-map="$AOMP_REPOS/$AOMP_ROCR_REPO_NAME=$_ompd_src_dir/rocr")
+ echo "${AOMP_CMAKE}" "$(shquot "${ROCR_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot -g "${_prefix_map[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot -g "${_prefix_map[@]}")\"" \
+ "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${ROCR_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot -g "${_prefix_map[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot -g "${_prefix_map[@]}")" \
+ "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME"; then
echo "ERROR rocr_debug cmake failed.cmake flags"
- echo " $ROCR_CMAKE_OPTS"
+ echo " $(shquot "${ROCR_CMAKE_OPTS[@]}")"
exit 1
fi
fi
@@ -116,12 +150,12 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_AOMP/build/rocr
+cd "$BUILD_AOMP/build/rocr" || exit
echo
echo " -----Running make for rocr ---- "
-echo make -j $AOMP_JOB_THREADS
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+echo "make -j $AOMP_JOB_THREADS"
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -131,12 +165,12 @@ if [ $? != 0 ] ; then
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_AOMP/build/rocr/asan
+ cd "$BUILD_AOMP/build/rocr/asan" || exit
echo
echo " -----Running make for rocr-asan ---- "
- echo make -j $AOMP_JOB_THREADS
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+ echo "make -j $AOMP_JOB_THREADS"
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -146,11 +180,11 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
fi
fi
if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
- cd $BUILD_AOMP/build/rocr_debug
+ cd "$BUILD_AOMP/build/rocr_debug" || exit
echo
echo " ----- Running make for rocr_debug ----- "
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -161,42 +195,41 @@ if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
fi
# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
- cd $BUILD_AOMP/build/rocr
+ cd "$BUILD_AOMP/build/rocr" || exit
echo " -----Installing to $INSTALL_ROCM/lib ----- "
- echo $SUDO make install
- $SUDO make install
- if [ $? != 0 ] ; then
+ echo "$SUDO make install "
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_AOMP/build/rocr/asan
+ cd "$BUILD_AOMP/build/rocr/asan" || exit
echo " ------Installing to $INSTALL_ROCM/lib/asan ------ "
- echo $SUDO make install
- $SUDO make install
- if [ $? != 0 ] ; then
+ echo "$SUDO make install"
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
fi
if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
- cd $BUILD_AOMP/build/rocr_debug
+ cd "$BUILD_AOMP/build/rocr_debug" || exit
echo " -----Installing to $INSTALL_ROCM/lib-debug ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+ if ! $SUDO make install; then
echo "ERROR make install for rocr failed "
exit 1
fi
# copy rocr sources into the installation for runtime source debugging
_dirs="runtime/hsa-runtime/image runtime/hsa-runtime/inc runtime/hsa-runtime/core runtime/hsa-runtime/loader runtime/hsa-runtime/pcs libhsakmt/src libhsakmt/include"
for _dirname in $_dirs ; do
- $SUDO mkdir -p $_ompd_src_dir/rocr/$_dirname
- echo cp -r $AOMP_REPOS/$AOMP_ROCR_REPO_NAME/$_dirname/ $_ompd_src_dir/rocr/$_dirname/
- $SUDO cp -r $AOMP_REPOS/$AOMP_ROCR_REPO_NAME/$_dirname/ $_ompd_src_dir/rocr/$_dirname/
+ $SUDO mkdir -p "$_ompd_src_dir/rocr/$_dirname"
+ echo "cp -r $AOMP_REPOS/$AOMP_ROCR_REPO_NAME/$_dirname/ $_ompd_src_dir/rocr/$_dirname/"
+ $SUDO cp -r "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME/$_dirname/" "$_ompd_src_dir/rocr/$_dirname/"
done
# remove non-source files to save space
- find $_ompd_src_dir/rocr -type f | grep -v "\.cpp$\|\.h$\|\.hpp$\|\.c$\|\.s$" | xargs rm
+ find "$_ompd_src_dir/rocr" -type f | grep -v "\.cpp$\|\.h$\|\.hpp$\|\.c$\|\.s$" | xargs rm
fi
- removepatch $AOMP_REPOS/$AOMP_ROCR_REPO_NAME
+ removepatch "$AOMP_REPOS/$AOMP_ROCR_REPO_NAME"
fi
diff --git a/bin/build_roct.sh b/bin/build_roct.sh
index e58f723b8e..e928aa3fa8 100755
--- a/bin/build_roct.sh
+++ b/bin/build_roct.sh
@@ -4,9 +4,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_ROCT=${INSTALL_ROCT:-$AOMP_INSTALL_DIR}
@@ -28,28 +28,20 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $AOMP_REPOS/$AOMP_ROCT_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_ROCT_REPO_NAME"
echo " Are environment variables AOMP_REPOS and AOMP_ROCT_REPO_NAME set correctly?"
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_ROCT
- $SUDO touch $INSTALL_ROCT/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_ROCT"
- exit 1
- fi
- $SUDO rm $INSTALL_ROCT/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_ROCT"
-patchrepo $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
+patchrepo "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME"
-if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- LDFLAGS="-fuse-ld=lld $ASAN_FLAGS"
-fi
+#if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
+ #LDFLAGS=$(shquot '-fuse-ld=lld' "${ASAN_FLAGS[@]}")
+ #export LDFLAGS
+#fi
_ompd_src_dir="$LLVM_INSTALL_LOC/share/gdb/python/ompd/src"
@@ -60,46 +52,79 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
BUILDTYPE="Release"
- echo $SUDO rm -rf $BUILD_AOMP/build/roct
- $SUDO rm -rf $BUILD_AOMP/build/roct
- MYCMAKEOPTS="-DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCT -DCMAKE_BUILD_TYPE=$BUILDTYPE $AOMP_ORIGIN_RPATH -DCMAKE_INSTALL_LIBDIR=lib"
- mkdir -p $BUILD_AOMP/build/roct
- cd $BUILD_AOMP/build/roct
+ echo "$SUDO rm -rf $BUILD_AOMP/build/roct"
+ $SUDO rm -rf "$BUILD_AOMP/build/roct"
+ declare -a MYCMAKEOPTS
+ MYCMAKEOPTS=(-DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/cmake"
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCT"
+ -DCMAKE_BUILD_TYPE="$BUILDTYPE"
+ "${AOMP_ORIGIN_RPATH[@]}"
+ -DCMAKE_INSTALL_LIBDIR=lib)
+ mkdir -p "$BUILD_AOMP/build/roct"
+ cd "$BUILD_AOMP/build/roct" || exit
echo " -----Running roct cmake ---- "
- echo ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
- ${AOMP_CMAKE} $MYCMAKEOPTS $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
+ "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" \
+ "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME"; then
echo "ERROR roct cmake failed. cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- mkdir -p $BUILD_AOMP/build/roct/asan
- cd $BUILD_AOMP/build/roct/asan
- ASAN_CMAKE_OPTS="-DCMAKE_C_COMPILER=$AOMP_CLANG_COMPILER -DCMAKE_CXX_COMPILER=$AOMP_CLANGXX_COMPILER -DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR/lib/asan/cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCT -DCMAKE_BUILD_TYPE=$BUILDTYPE $AOMP_ASAN_ORIGIN_RPATH -DCMAKE_INSTALL_LIBDIR=$AOMP_INSTALL_DIR/lib/asan"
+ mkdir -p "$BUILD_AOMP/build/roct/asan"
+ cd "$BUILD_AOMP/build/roct/asan" || exit
+ declare -a ASAN_CMAKE_OPTS
+ ASAN_CMAKE_OPTS=(-DCMAKE_C_COMPILER="$AOMP_CLANG_COMPILER"
+ -DCMAKE_CXX_COMPILER="$AOMP_CLANGXX_COMPILER"
+ -DCMAKE_PREFIX_PATH="$AOMP_INSTALL_DIR/lib/asan/cmake"
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCT"
+ -DCMAKE_BUILD_TYPE="$BUILDTYPE"
+ "${AOMP_ASAN_ORIGIN_RPATH[@]}"
+ -DCMAKE_INSTALL_LIBDIR="$AOMP_INSTALL_DIR/lib/asan")
echo " -----Running roct-asan cmake -----"
- echo ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
- ${AOMP_CMAKE} $ASAN_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ASAN_FLAGS'" -DCMAKE_CXX_FLAGS="'$ASAN_FLAGS'" $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
- if [ $? != 0 ] ; then
+ echo "${AOMP_CMAKE}" "$(shquot "${ASAN_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot "${ASAN_FLAGS[@]}")\"" \
+ "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${ASAN_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot "${ASAN_FLAGS[@]}")" \
+ "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME"; then
echo "ERROR roct-asan cmake failed.cmake flags"
- echo " $ASAN_CMAKE_OPTS"
+ echo " $(shquot "${ASAN_CMAKE_OPTS[@]}")"
exit 1
fi
fi
if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
- echo rm -rf $BUILD_AOMP/build/roct_debug
- [ -d $BUILD_AOMP/build/roct_debug ] && rm -rf $BUILD_AOMP/build/roct_debug
- ROCT_CMAKE_OPTS="-DCMAKE_C_COMPILER=$AOMP_CLANG_COMPILER -DCMAKE_CXX_COMPILER=$AOMP_CLANGXX_COMPILER -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCT -DCMAKE_BUILD_TYPE=Debug $AOMP_DEBUG_ORIGIN_RPATH -DCMAKE_INSTALL_LIBDIR=lib-debug -DBUILD_SHARED_LIBS=ON"
+ echo "rm -rf $BUILD_AOMP/build/roct_debug"
+ [ -d "$BUILD_AOMP/build/roct_debug" ] && rm -rf "$BUILD_AOMP/build/roct_debug"
+ declare -a ROCT_CMAKE_OPTS
+ ROCT_CMAKE_OPTS=(-DCMAKE_C_COMPILER="$AOMP_CLANG_COMPILER"
+ -DCMAKE_CXX_COMPILER="$AOMP_CLANGXX_COMPILER"
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCT"
+ -DCMAKE_BUILD_TYPE=Debug
+ "${AOMP_DEBUG_ORIGIN_RPATH[@]}"
+ -DCMAKE_INSTALL_LIBDIR=lib-debug
+ -DBUILD_SHARED_LIBS=ON)
echo " -----Running roct_debug cmake -----"
- mkdir -p $BUILD_AOMP/build/roct_debug
- cd $BUILD_AOMP/build/roct_debug
- _prefix_map="\""-fdebug-prefix-map=$AOMP_REPOS/$AOMP_ROCT_REPO_NAME/src=$_ompd_src_dir/roct/src"\""
- echo ${AOMP_CMAKE} $ROCT_CMAKE_OPTS -DCMAKE_C_FLAGS="-g $_prefix_map" -DCMAKE_CXX_FLAGS="-g $_prefix_map" $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
- ${AOMP_CMAKE} $ROCT_CMAKE_OPTS -DCMAKE_C_FLAGS="-g $_prefix_map" -DCMAKE_CXX_FLAGS="-g $_prefix_map" $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
- if [ $? != 0 ] ; then
+ mkdir -p "$BUILD_AOMP/build/roct_debug"
+ cd "$BUILD_AOMP/build/roct_debug" || exit
+ _prefix_map=(-fdebug-prefix-map="$AOMP_REPOS/$AOMP_ROCT_REPO_NAME/src=$_ompd_src_dir/roct/src")
+ echo "${AOMP_CMAKE}" "$(shquot "${ROCT_CMAKE_OPTS[@]}")" \
+ -DCMAKE_C_FLAGS="\"$(cmquot -g "${_prefix_map[@]}")\"" \
+ -DCMAKE_CXX_FLAGS="\"$(cmquot -g "${_prefix_map[@]}")\"" \
+ "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME"
+
+ if ! ${AOMP_CMAKE} "${ROCT_CMAKE_OPTS[@]}" \
+ -DCMAKE_C_FLAGS="$(cmquot -g "${_prefix_map[@]}")" \
+ -DCMAKE_CXX_FLAGS="$(cmquot -g "${_prefix_map[@]}")" \
+ "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME"; then
echo "ERROR roct_debug cmake failed.cmake flags"
- echo " $ROCT_CMAKE_OPTS"
+ echo " $(shquot "${ROCT_CMAKE_OPTS[@]}")"
exit 1
fi
fi
@@ -109,11 +134,11 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_AOMP/build/roct
+cd "$BUILD_AOMP/build/roct" || exit
echo
echo " -----Running make for roct ---- "
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -125,8 +150,8 @@ fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
echo
echo " ----- Running make for roct-asan ----- "
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -136,11 +161,11 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
fi
fi
if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
- cd $BUILD_AOMP/build/roct_debug
+ cd "$BUILD_AOMP/build/roct_debug" || exit
echo
echo " ----- Running make for roct_debug ----- "
- make -j $AOMP_JOB_THREADS
- if [ $? != 0 ] ; then
+
+ if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -151,36 +176,35 @@ if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
fi
# ----------- Install only if asked ----------------------------
-if [ "$1" == "install" ] ; then
- cd $BUILD_AOMP/build/roct
+if [ "$1" == "install" ] ; then
+ cd "$BUILD_AOMP/build/roct" || exit
echo " -----Installing to $INSTALL_ROCT/lib ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
- cd $BUILD_AOMP/build/roct/asan
+ cd "$BUILD_AOMP/build/roct/asan" || exit
echo " -----Installing to $INSTALL_ROCT/lib/asan ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
fi
if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
- cd $BUILD_AOMP/build/roct_debug
+ cd "$BUILD_AOMP/build/roct_debug" || exit
echo " -----Installing to $INSTALL_ROCT/lib-debug ----- "
- $SUDO make install
- if [ $? != 0 ] ; then
+ if ! $SUDO make install; then
echo "ERROR make install for roct failed "
exit 1
fi
- $SUDO mkdir -p $_ompd_src_dir/roct
- echo $SUDO cp -r $AOMP_REPOS/$AOMP_ROCT_REPO_NAME/src $_ompd_src_dir/roct
- $SUDO cp -r $AOMP_REPOS/$AOMP_ROCT_REPO_NAME/src $_ompd_src_dir/roct
+ $SUDO mkdir -p "$_ompd_src_dir/roct"
+ echo "$SUDO cp -r $AOMP_REPOS/$AOMP_ROCT_REPO_NAME/src $_ompd_src_dir/roct"
+ $SUDO cp -r "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME/src" "$_ompd_src_dir/roct"
fi
- removepatch $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
+ removepatch "$AOMP_REPOS/$AOMP_ROCT_REPO_NAME"
fi
diff --git a/bin/build_roctracer.sh b/bin/build_roctracer.sh
index 7354a34eb1..ec9dc3d666 100755
--- a/bin/build_roctracer.sh
+++ b/bin/build_roctracer.sh
@@ -5,14 +5,14 @@
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
INSTALL_ROCTRACE=${INSTALL_ROCTRACE:-$AOMP_INSTALL_DIR}
export HIP_CLANG_PATH=$LLVM_INSTALL_LOC/bin
-echo $HIP_CLANG_PATH
+echo "$HIP_CLANG_PATH"
export ROCM_PATH=$ROCM_DIR
# Needed for systems that have both AMD and Nvidia cards installed.
@@ -36,39 +36,30 @@ if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
exit
fi
-if [ ! -d $AOMP_REPOS/$AOMP_TRACE_REPO_NAME ] ; then
+if [ ! -d "$AOMP_REPOS/$AOMP_TRACE_REPO_NAME" ] ; then
echo "ERROR: Missing repository $AOMP_REPOS/$AOMP_TRACE_REPO_NAME"
echo " Are environment variables AOMP_REPOS and AOMP_TRACE_REPO_NAME set correctly?"
exit 1
fi
-# Make sure we can update the install directory
-if [ "$1" == "install" ] ; then
- $SUDO mkdir -p $INSTALL_ROCTRACE
- $SUDO touch $INSTALL_ROCTRACE/testfile
- if [ $? != 0 ] ; then
- echo "ERROR: No update access to $INSTALL_ROCTRACE"
- exit 1
- fi
- $SUDO rm $INSTALL_ROCTRACE/testfile
-fi
+check_writable_installdir "$1" "$INSTALL_ROCTRACE"
-patchrepo $AOMP_REPOS/$AOMP_TRACE_REPO_NAME
+patchrepo "$AOMP_REPOS/$AOMP_TRACE_REPO_NAME"
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo " "
echo "This is a FRESH START. ERASING any previous builds in $BUILD_AOMP/build_roctracer"
echo "Use ""$0 nocmake"" or ""$0 install"" to avoid FRESH START."
- echo rm -rf $BUILD_AOMP/build/roctracer
- rm -rf $BUILD_AOMP/build/roctracer
- CMAKE_WITH_EXPERIMENTAL=""
+ echo "rm -rf $BUILD_AOMP/build/roctracer"
+ rm -rf "$BUILD_AOMP/build/roctracer"
+ CMAKE_WITH_EXPERIMENTAL=()
if [ -d "/usr/include/c++/5/experimental" ] ; then
- _loc=`which gcc`
+ _loc=$(which gcc)
if [ "$_loc" != "" ] ; then
- _gccver=`$_loc --version | grep gcc | cut -d")" -f2 | cut -d"." -f1`
- if [ "$_gccver" == "5" ] ; then
- CMAKE_WITH_EXPERIMENTAL="-DCMAKE_CXX_FLAGS=-I/usr/include/c++/5/experimental"
+ _gccver=$($_loc --version | grep gcc | cut -d")" -f2 | cut -d"." -f1)
+ if [ "$_gccver" == "5" ] ; then
+ CMAKE_WITH_EXPERIMENTAL=(-DCMAKE_CXX_FLAGS=-I/usr/include/c++/5/experimental)
fi
fi
fi
@@ -76,16 +67,24 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
export CMAKE_BUILD_TYPE=$BUILD_TYPE
CMAKE_PREFIX_PATH="$ROCM_DIR/include/hsa;$ROCM_DIR/include;$ROCM_DIR/lib;$ROCM_DIR;$LLVM_INSTALL_LOC"
export CMAKE_PREFIX_PATH
- GFXSEMICOLONS=`echo $GFXLIST | tr ' ' ';' `
+ GFXSEMICOLONS=$(echo "$GFXLIST" | tr ' ' ';')
export ROCM_PATH=$ROCM_DIR
export HIPCC_COMPILE_FLAGS_APPEND="--rocm-path=$ROCM_PATH"
- mkdir -p $BUILD_AOMP/build/roctracer
- cd $BUILD_AOMP/build/roctracer
+ mkdir -p "$BUILD_AOMP/build/roctracer"
+ cd "$BUILD_AOMP/build/roctracer" || exit
echo " -----Running roctracer cmake ---- "
- ${AOMP_CMAKE} -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCTRACE -DCMAKE_PREFIX_PATH="""$CMAKE_PREFIX_PATH""" $CMAKE_WITH_EXPERIMENTAL $AOMP_ORIGIN_RPATH -DGPU_TARGETS="""$GFXSEMICOLONS""" -DROCM_PATH=$ROCM_DIR $AOMP_REPOS/$AOMP_TRACE_REPO_NAME
- if [ $? != 0 ] ; then
+
+ if ! ${AOMP_CMAKE} -DCMAKE_INSTALL_LIBDIR=lib \
+ -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
+ -DCMAKE_INSTALL_PREFIX="$INSTALL_ROCTRACE" \
+ -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
+ "${CMAKE_WITH_EXPERIMENTAL[@]}" \
+ "${AOMP_ORIGIN_RPATH[@]}" \
+ -DGPU_TARGETS="$GFXSEMICOLONS" \
+ -DROCM_PATH="$ROCM_DIR" \
+ "$AOMP_REPOS/$AOMP_TRACE_REPO_NAME"; then
echo "ERROR roctracer cmake failed. cmake flags"
- echo " $MYCMAKEOPTS"
+ echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
fi
@@ -94,12 +93,12 @@ if [ "$1" = "cmake" ]; then
exit 0
fi
-cd $BUILD_AOMP/build/roctracer
+cd "$BUILD_AOMP/build/roctracer" || exit
echo
echo " -----Running make for roctracer ---- "
-echo make -j $AOMP_JOB_THREADS
-make -j $AOMP_JOB_THREADS
-if [ $? != 0 ] ; then
+echo "make -j $AOMP_JOB_THREADS"
+
+if ! make -j "$AOMP_JOB_THREADS"; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
@@ -108,26 +107,26 @@ if [ $? != 0 ] ; then
exit 1
fi
-doxygen=`which doxygen`
-if [ ! -z $doxygen ] ; then
+doxygen=$(which doxygen)
+if [ -n "$doxygen" ] ; then
# the roctracer CMakeLists.txt will prepare docs install if doxygen found.
# However, the make doc has issues. But if you dont make doc, the install
# fails. This 'make doc' will do enough so install does not fail.
- echo make -j $AOMP_JOB_THREADS doc
- make -j $AOMP_JOB_THREADS doc 2>/dev/null >/dev/null
+ echo "make -j $AOMP_JOB_THREADS doc"
+ make -j "$AOMP_JOB_THREADS" doc 2>/dev/null >/dev/null
fi
# ----------- Install only if asked ----------------------------
-if [ "$1" == "install" ] ; then
- cd $BUILD_AOMP/build/roctracer
+if [ "$1" == "install" ] ; then
+ cd "$BUILD_AOMP/build/roctracer" || exit
echo " -----Installing to $INSTALL_ROCTRACE/lib ----- "
- echo $SUDO make install
- $SUDO make install
- if [ $? != 0 ] ; then
+ echo "$SUDO make install "
+
+ if ! $SUDO make install; then
echo "ERROR make install failed "
exit 1
fi
- removepatch $AOMP_REPOS/$AOMP_TRACE_REPO_NAME
+ removepatch "$AOMP_REPOS/$AOMP_TRACE_REPO_NAME"
else
echo
echo "SUCCESSFUL BUILD, please run: $0 install"
diff --git a/bin/build_supp.sh b/bin/build_supp.sh
index 537b4cd17e..da7714141e 100755
--- a/bin/build_supp.sh
+++ b/bin/build_supp.sh
@@ -53,22 +53,22 @@ EOF
}
SUPPLEMENTAL_COMPONENTS=${SUPPLEMENTAL_COMPONENTS:-openmpi silo hdf5 fftw ninja}
-PREREQUISITE_COMPONENTS=${PREREQUISITE_COMPONENTS:-cmake rocmsmilib hwloc aqlprofile}
+PREREQUISITE_COMPONENTS=${PREREQUISITE_COMPONENTS:-cmake rocmsmilib hwloc aqlprofile rocm-core}
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
FLANG=${FLANG:-flang}
function runcmd(){
THISCMD=$1
- if [ $DRYRUN ] ; then
+ if [ "$DRYRUN" ] ; then
echo "$THISCMD"
else
echo "$THISCMD"
- echo "$THISCMD" >>$CMDLOGFILE
+ echo "$THISCMD" >>"$CMDLOGFILE"
$THISCMD
rc=$?
if [ $rc != 0 ] ; then
@@ -82,12 +82,12 @@ function runcmd(){
function runcmdout(){
THISCMD=$1
OUTFILE=$2
- if [ $DRYRUN ] ; then
+ if [ "$DRYRUN" ] ; then
echo "$THISCMD > $OUTFILE"
else
echo "$THISCMD > $OUTFILE"
- echo "$THISCMD > $OUTFILE" >>$CMDLOGFILE
- $THISCMD > $OUTFILE
+ echo "$THISCMD > $OUTFILE" >>"$CMDLOGFILE"
+ $THISCMD > "$OUTFILE"
rc=$?
if [ $rc != 0 ] ; then
echo "ERROR: The following command failed with return code $rc: "
@@ -100,12 +100,12 @@ function runcmdout(){
function runcmdin(){
THISCMD=$1
INFILE=$2
- if [ $DRYRUN ] ; then
+ if [ "$DRYRUN" ] ; then
echo "$THISCMD < $INFILE"
else
echo "$THISCMD < $INFILE"
- echo "$THISCMD < $INFILE" >>$CMDLOGFILE
- $THISCMD < $INFILE
+ echo "$THISCMD < $INFILE" >>"$CMDLOGFILE"
+ $THISCMD < "$INFILE"
rc=$?
if [ $rc != 0 ] ; then
echo "ERROR: The following command failed with return code $rc: "
@@ -118,44 +118,44 @@ function runcmdin(){
function checkversion(){
# inputs: $_linkfrom, $_cname, $CMDLOGFILE, $_version
# output: $SKIPBUILD
- if [ -L $_linkfrom ] ; then
- existing_install_dir=`ls -l $_linkfrom | grep $_cname | awk '{print $11}'`
- if [ -d $existing_install_dir ] ; then
+ if [ -L "$_linkfrom" ] ; then
+ existing_install_dir=$(readlink -f "$_linkfrom")
+ if [ -d "$existing_install_dir" ] ; then
existing_version=${existing_install_dir##*-}
if [ "$existing_version" == "$_version" ] ; then
echo "Info: Skipping build for $_cname, version $_version already exists"
- echo "# skipping build for $_cname, version $_version already exists" >>$CMDLOGFILE
+ echo "# skipping build for $_cname, version $_version already exists" >>"$CMDLOGFILE"
SKIPBUILD=TRUE
else
echo "Info: creating new version of $_cname $_version"
- echo "Info: creating new version of $_cname $_version" >>$CMDLOGFILE
+ echo "Info: creating new version of $_cname $_version" >>"$CMDLOGFILE"
fi
else
echo "Info: Missing existing_install_dir $existing_install_dir, creating version of $_cname $_version"
- echo "# Missing existing_install_dir $existing_install_dir, creating version of $_cname $_version" >>$CMDLOGFILE
+ echo "# Missing existing_install_dir $existing_install_dir, creating version of $_cname $_version" >>"$CMDLOGFILE"
fi
fi
}
function buildopenmpi(){
# Not all builds, trunk for example, install clang into lib/llvm/bin. Fall back on $AOMP/bin.
- if [ ! -f $LLVM_INSTALL_LOC/bin/${FLANG} ] ; then
+ if [ ! -f "$LLVM_INSTALL_LOC/bin/${FLANG}" ] ; then
LLVM_INSTALL_LOC=$AOMP
- if [ ! -f $LLVM_INSTALL_LOC/bin/${FLANG} ] ; then
+ if [ ! -f "$LLVM_INSTALL_LOC/bin/${FLANG}" ] ; then
LLVM_INSTALL_LOC=$AOMP/lib/llvm
- if [ ! -f $LLVM_INSTALL_LOC/bin/${FLANG} ] ; then
+ if [ ! -f "$LLVM_INSTALL_LOC/bin/${FLANG}" ] ; then
echo "Error: buildopenmpi cannot find ${FLANG} executable. Set AOMP to location of $FLANG "
exit 1
fi
fi
fi
- if [ ! -d $AOMP_SUPP/hwloc ] ; then
+ if [ ! -d "$AOMP_SUPP/hwloc" ] ; then
echo "Error: 'build_supp.sh openmpi' requires that hwloc is installed at $AOMP_SUPP/hwloc"
echo " Please run 'build_supp.sh hwloc' "
exit 1
fi
_cname="openmpi"
- _version=5.0.7
+ _version=5.0.8
_release=v5.0
_installdir=$AOMP_SUPP_INSTALL/$_cname-$_version
_linkfrom=$AOMP_SUPP/$_cname
@@ -166,7 +166,7 @@ function buildopenmpi(){
if [ "$SKIPBUILD" == "TRUE" ] ; then
return
fi
- if [ -d $_builddir ] ; then
+ if [ -d "$_builddir" ] ; then
runcmd "rm -rf $_builddir"
fi
runcmd "mkdir -p $_builddir"
@@ -175,7 +175,7 @@ function buildopenmpi(){
runcmd "bzip2 -d openmpi-$_version.tar.bz2"
runcmd "tar -xf openmpi-$_version.tar"
runcmd "cd openmpi-$_version"
- if [ -d $_installdir ] ; then
+ if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
runcmd "mkdir -p $_installdir"
@@ -184,18 +184,18 @@ function buildopenmpi(){
runcmdout "sed -e s/flang\s*)/flang*)/ configure-orig" configure
###
runcmd "./configure --with-hwloc=$AOMP_SUPP/hwloc --with-hwloc-libdir=$AOMP_SUPP/hwloc/lib OMPI_CC=$LLVM_INSTALL_LOC/bin/clang OMPI_CXX=$LLVM_INSTALL_LOC/bin/clang++ OMPI_F90=$LLVM_INSTALL_LOC/bin/${FLANG} CXX=$LLVM_INSTALL_LOC/bin/clang++ CC=$LLVM_INSTALL_LOC/bin/clang FC=$LLVM_INSTALL_LOC/bin/${FLANG} --prefix=$_installdir"
- runcmd "make -j8"
+ runcmd "make -j${AOMP_JOB_THREADS}"
runcmd "make install"
- if [ -L $_linkfrom ] ; then
+ if [ -L "$_linkfrom" ] ; then
runcmd "rm $_linkfrom"
fi
- runcmd "ln -sf $_installdir $_linkfrom"
- echo "# $_linkfrom is now symbolic link to $_installdir " >>$CMDLOGFILE
+ runcmd "ln -sfr $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
}
function buildninja(){
_cname="ninja"
- _version=1.11.1
+ _version=1.13.2
_installdir=$AOMP_SUPP_INSTALL/$_cname-$_version
_linkfrom=$AOMP_SUPP/$_cname
_builddir=$AOMP_SUPP_BUILD/$_cname
@@ -205,7 +205,7 @@ function buildninja(){
if [ "$SKIPBUILD" == "TRUE" ] ; then
return
fi
- if [ -d $_builddir ] ; then
+ if [ -d "$_builddir" ] ; then
runcmd "rm -rf $_builddir"
fi
runcmd "mkdir -p $_builddir"
@@ -214,22 +214,22 @@ function buildninja(){
runcmd "tar -xzf v${_version}.tar.gz"
runcmd "cd ninja-$_version"
_patch_file="$thisdir/patches/ninja-nprocs-v${_version}.patch"
- if [ -r $_patch_file ]; then
+ if [ -r "$_patch_file" ]; then
runcmd "cp $_patch_file $_builddir"
runcmdin "patch --merge -p1" "$_patch_file"
fi
- if [ -d $_installdir ] ; then
+ if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
runcmd "mkdir -p $_installdir/bin"
runcmd "$AOMP_SUPP/cmake/bin/cmake -Bbuild-cmake"
runcmd "$AOMP_SUPP/cmake/bin/cmake --build build-cmake"
runcmd "cp -p build-cmake/ninja $_installdir/bin/."
- if [ -L $_linkfrom ] ; then
+ if [ -L "$_linkfrom" ] ; then
runcmd "rm $_linkfrom"
fi
- runcmd "ln -sf $_installdir $_linkfrom"
- echo "# $_linkfrom is now symbolic link to $_installdir " >>$CMDLOGFILE
+ runcmd "ln -sfr $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
}
function getrocmpackage(){
@@ -240,11 +240,11 @@ function getrocmpackage(){
_cname="$1"
_packagename="$2"
_componentversion="$3"
- _directory=$(echo $2 | cut -b 1)
- _version=6.4
- _packageversion=6.4.0
- _fullversion=60400
- _buildnumber=47
+ _directory=$(echo "$2" | cut -b 1)
+ _version=7.1
+ _packageversion=7.1.0
+ _fullversion=70100
+ _buildnumber=20
_installdir=$AOMP_SUPP_INSTALL/$_cname-$_version
_linkfrom=$AOMP_SUPP/$_cname
_builddir=$AOMP_SUPP_BUILD/$_cname
@@ -254,52 +254,57 @@ function getrocmpackage(){
if [ "$SKIPBUILD" == "TRUE" ] ; then
return
fi
- if [ -d $_builddir ] ; then
+ if [ -d "$_builddir" ] ; then
runcmd "rm -rf $_builddir"
fi
runcmd "mkdir -p $_builddir"
runcmd "cd $_builddir"
- osname=$(cat /etc/os-release | grep -e ^NAME=)
+ osname=$(grep -e ^NAME= < /etc/os-release)
if [[ $osname =~ "Ubuntu" ]]; then
# not sure if deb_version is 20 or 22
deb_version="24"
- os_version=`grep VERSION_ID /etc/os-release | cut -d"\"" -f2`
- [ $os_version == "22.04" ] && deb_version="22"
+ os_version=$(grep VERSION_ID /etc/os-release | cut -d"\"" -f2)
+ [ "$os_version" == "22.04" ] && deb_version="22"
#https://repo.radeon.com/rocm/apt/6.1/pool/main/h/hsa-amd-aqlprofile6.1.0/hsa-amd-aqlprofile6.1.0_1.0.0.60100.60100-82~${deb_version}_amd64.deb
#https://repo.radeon.com/rocm/apt/6.1/pool/main/h/hsa-amd-aqlprofile6.1.0/hsa-amd-aqlprofile6.1.0_1.0.0.60100.60100-82~22.04_amd64.deb
- runcmd "wget https://repo.radeon.com/rocm/apt/"$_version"/pool/main/$_directory/"$_packagename$_packageversion"/"$_packagename$_packageversion"_"$_componentversion"."$_fullversion"-"$_buildnumber"~${deb_version}.04_amd64.deb"
+ runcmd "wget https://repo.radeon.com/rocm/apt/$_version/pool/main/$_directory/$_packagename$_packageversion/$_packagename${_packageversion}_${_componentversion}.${_fullversion}-${_buildnumber}~${deb_version}.04_amd64.deb"
- runcmd "dpkg -x "$_packagename$_packageversion"_"$_componentversion"."$_fullversion"-"$_buildnumber"~${deb_version}.04_amd64.deb $_builddir"
+ runcmd "dpkg -x $_packagename${_packageversion}_${_componentversion}.${_fullversion}-${_buildnumber}~${deb_version}.04_amd64.deb $_builddir"
elif [[ $osname =~ "SLES" ]]; then
#https://repo.radeon.com/rocm/yum/6.1/main/hsa-amd-aqlprofile6.1.0-1.0.0.60100.60100-82.el7.x86_64.rpm
- runcmd "wget https://repo.radeon.com/rocm/zyp/"$_version"/main/"$_packagename$_packageversion"-"$_componentversion"."$_fullversion"-sles155."$_buildnumber".x86_64.rpm"
- echo ""$_packagename$_packageversion"-"$_componentversion"."$_fullversion"-sles155."$_buildnumber".x86_64.rpm | cpio -idm"
- rpm2cpio "$_packagename$_packageversion"-"$_componentversion"."$_fullversion"-sles155."$_buildnumber".x86_64.rpm | cpio -idm
+ runcmd "wget https://repo.radeon.com/rocm/zyp/$_version/main/$_packagename$_packageversion-$_componentversion.$_fullversion-sles156.$_buildnumber.x86_64.rpm"
+ echo "$_packagename$_packageversion-$_componentversion.$_fullversion-sles156.$_buildnumber.x86_64.rpm | cpio -idm"
+ rpm2cpio "$_packagename$_packageversion-$_componentversion.$_fullversion-sles156.$_buildnumber.x86_64.rpm" | cpio -idm
else
- runcmd "wget https://repo.radeon.com/rocm/rhel8/"$_version"/main/"$_packagename$_packageversion"-"$_componentversion"."$_fullversion"-"$_buildnumber".el8.x86_64.rpm"
- echo ""$_packagename$_packageversion"-"$_componentversion"."$_fullversion"-"$_buildnumber".el8.x86_64.rpm | cpio -idm"
- rpm2cpio "$_packagename$_packageversion"-"$_componentversion"."$_fullversion"-"$_buildnumber".el8.x86_64.rpm | cpio -idm
+ runcmd "wget https://repo.radeon.com/rocm/rhel8/$_version/main/$_packagename$_packageversion-$_componentversion.$_fullversion-$_buildnumber.el8.x86_64.rpm"
+ echo "$_packagename$_packageversion-$_componentversion.$_fullversion-$_buildnumber.el8.x86_64.rpm | cpio -idm"
+ rpm2cpio "$_packagename$_packageversion-$_componentversion.$_fullversion-$_buildnumber.el8.x86_64.rpm" | cpio -idm
fi
- if [ -d $_installdir ] ; then
+ if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
- runcmd "mkdir -p $_installdir/lib"
- runcmd "cd $_installdir"
- runcmd "cp -rp $_builddir/opt/rocm-"$_packageversion"/lib $_installdir"
+ if [ "$_cname" == "rocm-core" ] ; then
+ runcmd "mkdir -p $_installdir"
+ runcmd "cp -rp $_builddir/opt/rocm-$_packageversion/. $_installdir"
+ else
+ runcmd "mkdir -p $_installdir/lib"
+ runcmd "cd $_installdir"
+ runcmd "cp -rp $_builddir/opt/rocm-$_packageversion/lib $_installdir"
+ fi
- if [ -L $_linkfrom ] ; then
+ if [ -L "$_linkfrom" ] ; then
runcmd "rm $_linkfrom"
fi
- runcmd "ln -sf $_installdir $_linkfrom"
+ runcmd "ln -sfr $_installdir $_linkfrom"
#runcmd "rm -rf $_builddir"
- echo "# $_linkfrom is now symbolic link to $_installdir " >>$CMDLOGFILE
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
}
function buildhdf5(){
_cname="hdf5"
- _version=1.12.0
- _release=hdf5-1.12
+ _version=1.14.0
+ _release=hdf5-1.14
_installdir=$AOMP_SUPP_INSTALL/hdf5-$_version
_linkfrom=$AOMP_SUPP/hdf5
_builddir=$AOMP_SUPP_BUILD/hdf5
@@ -309,7 +314,7 @@ function buildhdf5(){
return
fi
- if [ -d $_builddir ] ; then
+ if [ -d "$_builddir" ] ; then
runcmd "rm -rf $_builddir"
fi
runcmd "mkdir -p $_builddir"
@@ -318,23 +323,23 @@ function buildhdf5(){
runcmd "bzip2 -d hdf5-$_version.tar.bz2"
runcmd "tar -xf hdf5-$_version.tar"
runcmd "cd hdf5-$_version"
- if [ -d $_installdir ] ; then
+ if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
runcmd "mkdir -p $_installdir"
runcmd "./configure --enable-fortran --prefix=$_installdir"
- runcmd "make -j8"
+ runcmd "make -j${AOMP_JOB_THREADS}"
runcmd "make install"
- if [ -L $_linkfrom ] ; then
+ if [ -L "$_linkfrom" ] ; then
runcmd "rm $_linkfrom"
fi
- runcmd "ln -sf $_installdir $_linkfrom"
- echo "# $_linkfrom is now symbolic link to $_installdir " >>$CMDLOGFILE
+ runcmd "ln -sfr $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
}
function buildsilo(){
_cname="silo"
- _version=4.10.2
+ _version=4.11.1
_installdir=$AOMP_SUPP_INSTALL/silo-$_version
_linkfrom=$AOMP_SUPP/silo
_builddir=$AOMP_SUPP_BUILD/silo
@@ -344,28 +349,29 @@ function buildsilo(){
return
fi
- if [ -d $_builddir ] ; then
+ if [ -d "$_builddir" ] ; then
runcmd "rm -rf $_builddir"
fi
runcmd "mkdir -p $_builddir"
runcmd "cd $_builddir"
# runcmd "wget https://wci.llnl.gov/sites/wci/files/2021-01/silo-$_version.tgz"
# runcmd "tar -xzf silo-$_version.tgz"
- runcmd "wget https://software.llnl.gov/Silo/ghpages/releases/silo-$_version.tar.xz"
+ #runcmd "wget https://software.llnl.gov/Silo/ghpages/releases/silo-$_version.tar.xz"
+ runcmd "wget https://github.com/LLNL/Silo/releases/download/$_version/silo-$_version.tar.xz"
runcmd "tar -x --xz -f silo-$_version.tar.xz"
runcmd "cd silo-$_version"
- if [ -d $_installdir ] ; then
+ if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
runcmd "mkdir -p $_installdir"
runcmd "./configure --prefix=$_installdir"
- runcmd "make -j8"
+ runcmd "make -j${AOMP_JOB_THREADS}"
runcmd "make install"
- if [ -L $_linkfrom ] ; then
+ if [ -L "$_linkfrom" ] ; then
runcmd "rm $_linkfrom"
fi
- runcmd "ln -sf $_installdir $_linkfrom"
- echo "# $_linkfrom is now symbolic link to $_installdir " >>$CMDLOGFILE
+ runcmd "ln -sfr $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
}
function buildfftw(){
@@ -380,7 +386,7 @@ function buildfftw(){
return
fi
- if [ -d $_builddir ] ; then
+ if [ -d "$_builddir" ] ; then
runcmd "rm -rf $_builddir"
fi
runcmd "mkdir -p $_builddir"
@@ -388,22 +394,22 @@ function buildfftw(){
runcmd "wget http://www.fftw.org/fftw-$_version.tar.gz"
runcmd "tar -xzf fftw-$_version.tar.gz"
runcmd "cd fftw-$_version"
- if [ -d $_installdir ] ; then
+ if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
runcmd "mkdir -p $_installdir"
runcmd "./configure --prefix=$_installdir --enable-shared --enable-threads --enable-sse2 --enable-avx"
- runcmd "make -j8"
+ runcmd "make -j${AOMP_JOB_THREADS}"
runcmd "make install"
runcmd "make clean"
runcmd "./configure --prefix=$_installdir --enable-shared --enable-threads --enable-sse2 --enable-avx --enable-float"
- runcmd "make -j8"
+ runcmd "make -j${AOMP_JOB_THREADS}"
runcmd "make install"
- if [ -L $_linkfrom ] ; then
+ if [ -L "$_linkfrom" ] ; then
runcmd "rm $_linkfrom"
fi
- runcmd "ln -sf $_installdir $_linkfrom"
- echo "# $_linkfrom is now symbolic link to $_installdir " >>$CMDLOGFILE
+ runcmd "ln -sfr $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
}
@@ -419,7 +425,7 @@ function buildcmake(){
return
fi
- if [ -d $_builddir ] ; then
+ if [ -d "$_builddir" ] ; then
runcmd "rm -rf $_builddir"
fi
runcmd "mkdir -p $_builddir"
@@ -427,23 +433,23 @@ function buildcmake(){
runcmd "wget https://github.com/Kitware/CMake/releases/download/v$_version/cmake-$_version.tar.gz"
runcmd "tar -xzf cmake-$_version.tar.gz"
runcmd "cd cmake-$_version"
- if [ -d $_installdir ] ; then
+ if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
runcmd "mkdir -p $_installdir"
runcmd "./bootstrap --parallel=8 --prefix=$_installdir"
- runcmd "make -j8"
+ runcmd "make -j${AOMP_JOB_THREADS}"
runcmd "make install"
- if [ -L $_linkfrom ] ; then
+ if [ -L "$_linkfrom" ] ; then
runcmd "rm $_linkfrom"
fi
- runcmd "ln -sf $_installdir $_linkfrom"
- echo "# $_linkfrom is now symbolic link to $_installdir " >>$CMDLOGFILE
+ runcmd "ln -sfr $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
}
function buildrocmsmilib(){
_cname="rocmsmilib"
- _version=6.4.x
+ _version=7.1.x
_installdir=$AOMP_SUPP_INSTALL/rocmsmilib-$_version
_linkfrom=$AOMP_SUPP/rocmsmilib
_builddir=$AOMP_SUPP_BUILD/rocmsmilib
@@ -453,27 +459,27 @@ function buildrocmsmilib(){
return
fi
- if [ -d $_builddir ] ; then
+ if [ -d "$_builddir" ] ; then
runcmd "rm -rf $_builddir"
fi
runcmd "mkdir -p $_builddir"
runcmd "cd $_builddir"
- runcmd "git clone -b release/rocm-rel-6.4 https://github.com/ROCm/rocm_smi_lib rocmsmilib-$_version"
+ runcmd "git clone -b release/rocm-rel-7.1 https://github.com/ROCm/rocm_smi_lib rocmsmilib-$_version"
runcmd "cd rocmsmilib-$_version"
runcmd "mkdir -p build"
runcmd "cd build"
runcmd "$AOMP_SUPP/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=$_installdir .."
- if [ -d $_installdir ] ; then
+ if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
runcmd "mkdir -p $_installdir"
- runcmd "make -j8"
+ runcmd "make -j${AOMP_JOB_THREADS}"
runcmd "make install"
- if [ -L $_linkfrom ] ; then
+ if [ -L "$_linkfrom" ] ; then
runcmd "rm $_linkfrom"
fi
- runcmd "ln -sf $_installdir $_linkfrom"
- echo "# $_linkfrom is now symbolic link to $_installdir " >>$CMDLOGFILE
+ runcmd "ln -sfr $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
}
function buildhwloc(){
@@ -488,13 +494,13 @@ function buildhwloc(){
return
fi
- if [ ! -d $AOMP_SUPP/rocmsmilib/lib ] && [ ! -d $AOMP_SUPP/rocmsmilib/lib64 ]; then
+ if [ ! -d "$AOMP_SUPP/rocmsmilib/lib" ] && [ ! -d "$AOMP_SUPP/rocmsmilib/lib64" ]; then
echo "ERROR: Must build rocmsmilib before hwloc. Try:"
echo " $0 rocmsmilib"
- echo "#ERROR: You must build rocmsmilib before hwloc because static build of hwloc depends on rocsmilib">>$CMDLOGFILE
+ echo "#ERROR: You must build rocmsmilib before hwloc because static build of hwloc depends on rocsmilib">>"$CMDLOGFILE"
exit 1
fi
- if [ -d $_builddir ] ; then
+ if [ -d "$_builddir" ] ; then
runcmd "rm -rf $_builddir"
fi
runcmd "mkdir -p $_builddir"
@@ -504,23 +510,23 @@ function buildhwloc(){
runcmd "git checkout v$_version"
runcmd "./autogen.sh"
runcmd "./configure --prefix=$_installdir --with-pic=yes --enable-static=yes --enable-shared=no --disable-io --disable-libudev --disable-libxml2 --with-rocm=$AOMP_SUPP/rocsmilib"
- if [ -d $_installdir ] ; then
+ if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
runcmd "mkdir -p $_installdir"
- runcmd "make -j8"
+ runcmd "make -j${AOMP_JOB_THREADS}"
runcmd "make install"
- if [ -L $_linkfrom ] ; then
+ if [ -L "$_linkfrom" ] ; then
runcmd "rm $_linkfrom"
fi
- runcmd "ln -sf $_installdir $_linkfrom"
- echo "# $_linkfrom is now symbolic link to $_installdir " >>$CMDLOGFILE
+ runcmd "ln -sfr $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
}
#--------------------------- Main script starts here -----------------------
sname=${0##*/}
CMDLOGFILE=$AOMP_SUPP_BUILD/cmdlog
-mkdir -p $AOMP_SUPP_BUILD
+mkdir -p "$AOMP_SUPP_BUILD"
if [ "$1" == "-h" ] ; then
build_supp_help
exit 0
@@ -538,37 +544,41 @@ if [ "$1" == "" ] ; then
_components="$SUPPLEMENTAL_COMPONENTS"
fi
else
- _components=$@
+ _components=$*
fi
# save the current directory
curdir=$PWD
for _component in $_components ; do
- _thisdate=`date`
- echo "" >>$CMDLOGFILE
- echo "# -------------------------------------------------" >>$CMDLOGFILE
- echo "# $_component build started on $_thisdate" >>$CMDLOGFILE
- if [ $_component == "openmpi" ] ; then
+ _thisdate=$(date)
+ {
+ echo ""
+ echo "# -------------------------------------------------"
+ echo "# $_component build started on $_thisdate"
+ } >> "$CMDLOGFILE"
+ if [ "$_component" == "openmpi" ] ; then
buildopenmpi
- elif [ $_component == "silo" ] ; then
+ elif [ "$_component" == "silo" ] ; then
buildsilo
- elif [ $_component == "hdf5" ] ; then
+ elif [ "$_component" == "hdf5" ] ; then
buildhdf5
- elif [ $_component == "fftw" ] ; then
+ elif [ "$_component" == "fftw" ] ; then
buildfftw
- elif [ $_component == "hwloc" ] ; then
+ elif [ "$_component" == "hwloc" ] ; then
buildhwloc
- elif [ $_component == "cmake" ] ; then
+ elif [ "$_component" == "cmake" ] ; then
buildcmake
- elif [ $_component == "rocmsmilib" ] ; then
+ elif [ "$_component" == "rocmsmilib" ] ; then
buildrocmsmilib
- elif [ $_component == "ninja" ] ; then
+ elif [ "$_component" == "ninja" ] ; then
buildninja
- elif [ $_component == "aqlprofile" ] ; then
+ elif [ "$_component" == "aqlprofile" ] ; then
getrocmpackage aqlprofile hsa-amd-aqlprofile 1.0.0
- elif [ $_component == "openclicdloader" ] ; then
+ elif [ "$_component" == "openclicdloader" ] ; then
getrocmpackage openclicdloader rocm-opencl-icd-loader 1.2
+ elif [ "$_component" == "rocm-core" ] ; then
+ getrocmpackage rocm-core rocm-core 7.1.0
else
- echo "ERROR: Invalid component name $_component" >>$CMDLOGFILE
+ echo "ERROR: Invalid component name $_component" >>"$CMDLOGFILE"
echo "ERROR: Invalid component name $_component"
if [ "$sname" == "build_prereq.sh" ] ; then
echo " Must be a subset of: $PREREQUISITE_COMPONENTS"
@@ -577,9 +587,8 @@ for _component in $_components ; do
fi
exit 0
fi
- _thisdate=`date`
- echo "# DONE: successful build of $_component on $_thisdate " >>$CMDLOGFILE
+ _thisdate=$(date)
+ echo "# DONE: successful build of $_component on $_thisdate " >>"$CMDLOGFILE"
done
-cd $curdir
-
+cd "$curdir" || exit
diff --git a/bin/build_supp_llvm-flang.sh b/bin/build_supp_llvm-flang.sh
index 12a64ad6d3..d7c70accc5 100755
--- a/bin/build_supp_llvm-flang.sh
+++ b/bin/build_supp_llvm-flang.sh
@@ -4,15 +4,15 @@
# supplemental components with the flang driver.
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
# CLEAN_SUPP=${CLEAN_SUPP:-1} # set if clean build needed in nightly tests
-cd $AOMP_REPOS
-cd aomp
+cd "$AOMP_REPOS" || exit
+cd aomp || exit
export AOMP_SUPP=$HOME/local/llvm-flang
export FLANG=flang
@@ -27,10 +27,10 @@ if [ ! -r "$AOMP/bin/$FLANG" ]; then
exit 1
fi
-if [ $CLEAN_SUPP ]; then rm -rf $AOMP_SUPP; fi
-mkdir -p $AOMP_SUPP
+if [ "$CLEAN_SUPP" ]; then rm -rf "$AOMP_SUPP"; fi
+mkdir -p "$AOMP_SUPP"
# symlink to local prereqs that already exist, can be used
-if [ ! -r $AOMP_SUPP/cmake ]; then ln -sf ../cmake $AOMP_SUPP; fi
-if [ ! -r $AOMP_SUPP/ninja ]; then ln -sf ../ninja $AOMP_SUPP; fi
-if [ ! -r $AOMP_SUPP/hwloc ]; then ln -sf ../hwloc $AOMP_SUPP; fi
+if [ ! -r "$AOMP_SUPP/cmake" ]; then ln -sf ../cmake "$AOMP_SUPP"; fi
+if [ ! -r "$AOMP_SUPP/ninja" ]; then ln -sf ../ninja "$AOMP_SUPP"; fi
+if [ ! -r "$AOMP_SUPP/hwloc" ]; then ln -sf ../hwloc "$AOMP_SUPP"; fi
AOMP_USE_CCACHE=0 bin/build_supp.sh
diff --git a/bin/calculate_divergence.sh b/bin/calculate_divergence.sh
new file mode 100755
index 0000000000..d1a3b5f6fe
--- /dev/null
+++ b/bin/calculate_divergence.sh
@@ -0,0 +1,496 @@
+#!/bin/bash
+
+################################################################################
+# Calculates and reports the divergence between LLVM upstream and ROCm's LLVM
+# fork by comparing git branches and generating diff statistics and patches.
+#
+# Environment Variables:
+# SKIP_FETCH - Skip git fetch operations (default: 0)
+# SILENT - Suppress informational messages (default: 0)
+# SETUP_ONLY - Only runs setup process, then exits (default: 0)
+# SKIP_SETUP - Skips directory & git setup steps (default: 0)
+# LLVM_REPO_DIR - Path to LLVM repository (default: ~/git/llvm-project.diff)
+# LLVM_PATH - Path to analyze (default: "" for entire repo)
+# COMPONENT - Index into list of paths (default: "" for entire repo)
+# LLVM_BRANCH - LLVM branch to compare (default: main)
+# ROCm_BRANCH - ROCm branch to compare (default: amd-staging)
+# RESULTS_DIR - Path to results dir (default: /results)
+# PER_FILE - Creates per-file diffs (default: 0)
+# FILE_GROUPS - Used for per-file diffs to group files together (default: 1)
+# NFC - Create patch for non-functional changes (default: 0)
+################################################################################
+
+timestamp="$(date +"%Y-%m-%d_%H-%M")"
+
+source_config="llvm"
+target_config="ROCm"
+remote_configs=("$source_config" "$target_config")
+
+# configs
+declare -A components=(
+ [clang]="clang"
+ [flang]="flang"
+ [offload]="offload"
+ [openmp]="openmp"
+ [driver]="clang/lib/Driver clang/include/clang/Driver clang/test/Driver"
+)
+
+declare -A directories=(
+ [llvm]=${LLVM_REPO_DIR:=${HOME}/git/llvm-project.diff}
+ [path]=${LLVM_PATH:=""}
+ [results]=${RESULTS_DIR:="$(pwd)/results"}
+)
+
+declare -A diff_args=(
+ [component]=${COMPONENT:=""}
+ [options]="stat patch"
+)
+
+declare -A llvm=(
+ [url]="https://github.com/llvm/llvm-project.git"
+ [remote]="llvm"
+ [branch]=${LLVM_BRANCH:=main}
+)
+
+declare -A ROCm=(
+ [url]="https://github.com/ROCm/llvm-project.git"
+ [remote]="ROCm"
+ [branch]=${ROCm_BRANCH:=amd-staging}
+)
+
+################################################################################
+# Outputs the script relevant environment variables and the values they are
+# set to after they were assigned their default values if not set.
+################################################################################
+print_environment() {
+ if [[ "$SILENT" -eq 1 ]]; then
+ return 0
+ fi
+
+ print_step "Processed environment"
+ local other_vars=("LLVM_REPO_DIR" "LLVM_PATH" "COMPONENT" "LLVM_BRANCH" "ROCm_BRANCH" "RESULTS_DIR")
+
+ for var_name in "${other_vars[@]}" "${default_false[@]}" "${default_true[@]}"; do
+ local -n var="$var_name"
+ print_info "$var_name=$var"
+ done
+}
+
+################################################################################
+# Normalizes a predefined list of boolean-like environment variables into a
+# consistent integer format (1 for true, 0 for false). It reads each variable
+# name from the `boolean_vars` array, interprets its value, and overwrites
+# the global variable with either a 1 or a 0.
+#
+# This function handles case-insensitive "true" values (e.g., true, 1, yes, y)
+# and "false" values (e.g., false, 0, no, n). If a variable is unset or has
+# an unrecognized value, it defaults to 0 (false).
+################################################################################
+process_environment() {
+ default_false=("SKIP_FETCH" "SILENT" "SETUP_ONLY" "SKIP_SETUP" "PER_FILE" "NFC")
+ default_true=("FILE_GROUPS")
+
+ for var_name in "${default_false[@]}" "${default_true[@]}"; do
+ local -n var="$var_name"
+ if printf '%s\n' "${default_true[@]}" | grep -qx "$var_name"; then
+ var=${var:-1}
+ else
+ var=${var:-0}
+ fi
+
+ case "${var,,}" in
+ true|1|yes|y)
+ var=1
+ ;;
+ false|0|no|n)
+ var=0
+ ;;
+ *)
+ var=-
+ ;;
+ esac
+ done
+}
+
+################################################################################
+# Utility functions for consistent, formatted console output throughout the
+# script execution. Provides two levels of messaging: step headers for major
+# operations and informational messages for detailed progress updates.
+################################################################################
+print_step() {
+ echo -e "$1..."
+}
+
+print_info() {
+ if [[ "$SILENT" -eq 1 ]]; then
+ return 0
+ fi
+
+ local is_first_line=1
+ local prefix=" * "
+
+ while IFS= read -r line; do
+ printf "%s%s\n" "$prefix" "$line"
+ # echo -e "${prefix}${line}"
+ if [[ "$is_first_line" -eq 1 ]]; then
+ prefix=" "
+ is_first_line=0
+ fi
+ done <<< "$1"
+}
+
+################################################################################
+# Sets up the LLVM repository directory. Checks if the directory exists and
+# is a valid git repository. If not, clones the LLVM repository from the
+# configured URL.
+################################################################################
+setup_directory() {
+ print_step "Setting up required directories"
+ local git_dir="${directories[llvm]}"
+ local parent_dir=$(dirname "$git_dir")
+
+ if [[ -d $git_dir ]] && git -C "$git_dir" rev-parse --is-inside-work-tree &>/dev/null ; then
+ print_info "found existing directory $git_dir"
+ return 0
+ fi
+
+ print_info "creating directory $git_dir"
+ mkdir -p $parent_dir
+ cd $parent_dir
+ git clone ${llvm[url]} "$(basename "$git_dir")"
+}
+
+################################################################################
+# Sets up git remotes for both LLVM and ROCm repositories. Checks if remotes
+# with the configured URLs already exist. If a remote exists with a different
+# name, updates the configuration to use the existing name. Otherwise, adds
+# the remote with the configured name.
+################################################################################
+setup_remotes() {
+ print_step "Setting up required remotes"
+
+ cd "${directories[llvm]}"
+
+ for name in "${remote_configs[@]}"; do
+ local -n config="$name"
+ local url="${config[url]}"
+ local remote="${config[remote]}"
+
+ match=$(git remote -v | grep -E "\s${url}\s" | awk '{print $1}' | head -n 1)
+
+ if [ -n "$match" ]; then
+ print_info "found remote $url ($match)"
+ config[remote]=$match
+ else
+ print_info "remote $url not found, adding as $remote"
+ git remote add $remote $url
+ fi
+ done
+}
+
+################################################################################
+# Enriches configuration arrays with formatted reference strings for different
+# use cases. Generates three formats for each config: 'ref' (remote/branch)
+# for git commands, 'file' (remote_branch) for safe filenames, and 'name'
+# (remote/branch) for display purposes.
+################################################################################
+update_configs() {
+ print_step "Updating configs"
+
+ local -A formats=(
+ [ref]="/"
+ [file]="_"
+ [name]="/"
+ )
+
+ for c in "${remote_configs[@]}"; do
+ local -n config="$c"
+ local remote="${config[remote]}"
+ local branch="${config[branch]}"
+
+ for key in "${!formats[@]}"; do
+ config[$key]="$remote${formats[$key]}$branch"
+ done
+ done
+}
+
+################################################################################
+# Validates and formats paths for use in a `git diff` command based on a
+# pre-defined component name or a list of explicit paths. It iterates through
+# the specified paths, verifies that each exists, and formats them
+# appropriately (e.g., adding a trailing slash for directories). The function
+# populates the `diff_args` associative array with a formatted `path` argument
+# string (e.g., `-- path1/ path2`) and a `file_suffix` for use in output
+# filenames. If no valid paths are found, it clears these arguments to ensure
+# the diff runs on the entire repository.
+################################################################################
+check_paths() {
+ local c="${diff_args[component]}"
+ local p="${directories[path]}"
+
+ if [[ -z "$c" && -z "$p" ]]; then
+ return 0
+ fi
+
+ print_step "Checking paths"
+
+ diff_args[file_suffix]=$(
+ if [[ ! -z "$c" ]]; then
+ echo "$c"
+ else
+ echo "${p%/}"
+ fi
+ )
+
+ for path in ${components[$c]} $p; do
+ local full_path="${directories[llvm]}/$path"
+ if [[ ! -e "$full_path" ]]; then
+ print_info "$path does not exist, skipping"
+ continue
+ fi
+ diff_args[path]+=$(
+ if [[ -d "$full_path" ]]; then
+ echo " ${path%/}/"
+ elif [[ -f "$full_path" ]]; then
+ echo " $path"
+ fi
+ )
+ done
+
+ if [[ -z "${diff_args[path]}" ]]; then
+ diff_args[file_suffix]=""
+ return 0
+ fi
+
+ diff_args[file_suffix]="--${diff_args[file_suffix]}"
+ diff_args[path]="-- ${diff_args[path]}"
+}
+
+################################################################################
+# Fetches the latest changes from configured git remotes for both LLVM and
+# ROCm repositories. Uses dry-run to check if updates are available before
+# fetching. Skips all fetch operations if SKIP_FETCH is set to "true".
+################################################################################
+update_sources() {
+ if [[ "$SKIP_FETCH" -eq 1 ]]; then
+ return 0
+ fi
+
+ print_step "Updating sources"
+
+ for config in "${remote_configs[@]}"; do
+ local -n c="$config"
+ local remote="${c[remote]}"
+ local branch="${c[branch]}"
+
+ fetch_output=$(git fetch --dry-run "$remote" "$branch" 2>&1)
+ if [ -z "$fetch_output" ] ; then
+ print_info "$remote/$branch already up to date"
+ else
+ git fetch $remote $branch
+ fi
+ done
+}
+
+diff_merge_base() {
+ git diff --src-prefix="$a_ref/" --dst-prefix="$b_ref/" --merge-base "$@" $a_ref $b_ref $path_arg
+}
+
+################################################################################
+# Takes the set of changed files and produces one or more Git patch files
+# per logical unit. When FILE_GROUPS is disabled emits on patch per file
+# otherwise groups files by their shared base name allowing for combined
+# patches for example header and related source files. Each patch is generated
+# via `git diff --merge-base` and written into a dedicated, timestamped
+# subdirectory under the main results folder, using a sanitized base name for
+# the filename.
+################################################################################
+create_file_patches() {
+ if [[ ${#changed_files[@]} -eq 0 ]]; then
+ return 0
+ fi
+
+ print_step "Generating file based git diff --$op"
+ local results_dir="${directories[results]}/$1"
+ mkdir -p $results_dir
+
+ local -A groups
+ for cf in "${changed_files[@]}"; do
+ if [[ "$FILE_GROUPS" -eq 0 ]]; then
+ path_arg="-- $cf"
+ diff_merge_base --$op > "$results_dir/${cf//[\/.]/_}.$op"
+ else
+ groups["$(basename "${cf%.*}")"]+=" $cf"
+ fi
+ done
+
+ if [[ "$FILE_GROUPS" -eq 0 ]]; then
+ return 0
+ fi
+
+ for key in "${!groups[@]}"; do
+ cf="${groups[$key]}"
+ IFS=' ' read -r -a grouped_files <<< "${groups[$key]}"
+ if [[ ${#grouped_files[@]} > 1 ]]; then
+ print_info "processing as one:${cf// /$'\n'}"
+ else
+ print_info "processing$cf"
+ fi
+ path_arg="--$cf"
+ diff_merge_base --$op > "$results_dir/${key//[\/.]/_}.$op"
+ done
+}
+
+################################################################################
+# Creates a patch file of changes that are considered "non-functional", which
+# include lines that only add or remove:
+# - whitespaces/newlines
+# - braces
+################################################################################
+calculate_nfc() {
+ print_info "calculating non functional changes"
+ local out="$1.nfc.patch"
+ local tmp full
+
+ tmp="$(mktemp /tmp/divergence_nfc.XXXXXX)" || return 1
+ full="$tmp.full"
+ grep_only="$tmp.grep"
+
+ # Grab a zero-context diff of all changes
+ diff_merge_base -U0 --no-color > "$full"
+
+ # Filter hunks: we include a hunk only if EVERY '+' or '–' line
+ # contains only whitespace and/or braces.
+ awk -v out="$grep_only" '
+ BEGIN {
+ printing = 0
+ header = ""
+ hunk = ""
+ }
+ # Collect the diff headers until the first hunk
+ /^diff --git/ { header = $0 "\n"; next }
+ /^index / { header = header $0 "\n"; next }
+ /^--- / { header = header $0 "\n"; next }
+ /^\+\+\+ / { header = header $0 "\n"; next }
+
+ # Beginning of a new hunk
+ /^@@/ {
+ # flush the prior hunk if it qualified
+ if (hunk && printing) {
+ print header hunk
+ }
+ # start a new hunk
+ printing = 1
+ hunk = $0 "\n"
+ next
+ }
+
+ # Collect lines within a hunk
+ /^[ +-]/ {
+ hunk = hunk $0 "\n"
+ # Check if this added/removed line is NON-functional:
+ # allowed forms are:
+ # +{ -{ +} -} + -
+ if ($0 ~ /^[+-][[:space:]]*[\{\}]?[[:space:]]*$/) {
+ # still ok
+ } else {
+ printing = 0
+ }
+ }
+
+ END {
+ if (hunk && printing) {
+ print header hunk
+ }
+ }
+ ' "$full" > "${directories[results]}/$out"
+
+ rm -f "$full" "$grep_only"
+}
+
+################################################################################
+# Determines the common ancestor (merge-base) of two Git references and
+# produces diff outputs between them. Based on configured options, it will
+# generate summary statistics and full diffs, saving each to timestamped
+# files in the results directory. Optionally limits analysis to specified
+# paths. When per-file patching is enabled, it splits the overall patch into
+# individual files.
+################################################################################
+calculate_differences() {
+ declare -g -n a="$source_config"
+ declare -g -n b="$target_config"
+ a_ref="${a[ref]}"
+ b_ref="${b[ref]}"
+ path_arg="${diff_args[path]}"
+
+ local merge_base=$(git merge-base $a_ref $b_ref)
+
+ local filename="${timestamp}_${a[file]}-${b[file]}${diff_args[file_suffix]}"
+ filename="${filename//\//_}"
+
+ print_step "Calculating difference"
+ print_info "based on: $(git show -s $merge_base)"
+ print_info "between: ${a[name]}
+ and: ${b[name]}"
+
+ if [[ ! -z "$path_arg" ]] ; then
+ local cleaned_path_arg="${path_arg#-- }"
+ print_info "only including files from:${cleaned_path_arg// /$'\n'}"
+ fi
+
+ print_info "$(diff_merge_base --shortstat)"
+ local per_file_ops=("patch")
+
+ git log --pretty=format:"%h %s%n%an <%ae> | %ad" --date=format:'%Y-%m-%d %H:%M:%S' --stat --no-merges $merge_base...$b_ref $path_arg > "${directories[results]}/$filename.commits"
+
+ if [[ "$NFC" -eq 1 ]]; then
+ calculate_nfc $filename
+ fi
+
+ IFS=' ' read -ra operations <<< "${diff_args[options]}"
+ for op in "${operations[@]}"; do
+ print_info "calculating git diff --$op"
+ diff_merge_base --$op > "${directories[results]}/$filename.$op"
+ if [[ "$PER_FILE" -eq 1 ]] && printf "%s\n" "${per_file_ops[@]}" | grep -qx "$op"; then
+ local path_arg_tmp=$path_arg
+ mapfile -t changed_files < <(diff_merge_base --name-only)
+ create_file_patches $filename
+ path_arg=$path_arg_tmp
+ fi
+ done
+}
+
+main() {
+ local working_dir=$(pwd)
+ local results_dir="${directories[results]}"
+ mkdir -p $results_dir
+
+ local log_file="${directories[results]}/${timestamp}_$(basename "${0%.*}").log"
+
+ exec > >(tee -a "$log_file") 2>&1
+
+ process_environment
+ print_environment
+
+ if [[ "$SKIP_SETUP" -eq 0 ]]; then
+ setup_directory
+ setup_remotes
+ fi
+
+ check_paths
+
+ if [[ "$SETUP_ONLY" -eq 1 ]]; then
+ return 0
+ fi
+
+ update_configs
+ update_sources
+
+ calculate_differences
+
+ print_step "Cleaning up"
+ print_info "output files written to: $results_dir"
+ cd $working_dir
+}
+
+main "$@"
diff --git a/bin/check_amdgpu_modversion.sh b/bin/check_amdgpu_modversion.sh
index 2660ae0697..4af2e72317 100755
--- a/bin/check_amdgpu_modversion.sh
+++ b/bin/check_amdgpu_modversion.sh
@@ -4,14 +4,14 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-[ -f $thisdir/aomp_common_vars ] && . $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+[ -f "$thisdir/aomp_common_vars" ] && . "$thisdir/aomp_common_vars"
# --- end standard header ----
-which dpkg 2>/dev/null >/dev/null
-if [ $? == 0 ] ; then
-_packaged_amdgpu_ver=`dpkg -l amdgpu-dkms 2>/dev/null | tail -n 1 | cut -d":" -f2 | cut -d"." -f1-3`
+
+if which dpkg 2>/dev/null >/dev/null; then
+_packaged_amdgpu_ver=$(dpkg -l amdgpu-dkms 2>/dev/null | tail -n 1 | cut -d":" -f2 | cut -d"." -f1-3)
else
_packaged_amdgpu_ver=""
fi
@@ -21,13 +21,13 @@ else
ROCM_EXPECTED_MODVERSION=$_packaged_amdgpu_ver
fi
_llvm_install_dir=${AOMP:-/opt/rocm/llvm}
-which modinfo >/dev/null 2>/dev/null
-if [ $? == 0 ] ; then
- _amdgpu_mod_version=`modinfo -F version amdgpu`
- if [ ! -z $_amdgpu_mod_version ] ; then
+
+if which modinfo >/dev/null 2>/dev/null; then
+ _amdgpu_mod_version=$(modinfo -F version amdgpu)
+ if [ -n "$_amdgpu_mod_version" ] ; then
if [ "$_amdgpu_mod_version" != "$ROCM_EXPECTED_MODVERSION" ] ; then
- if [ -f $_llvm_install_dir/bin/aompversion ] ; then
- _aomp_version_string=`$AOMP/bin/aompversion`
+ if [ -f "$_llvm_install_dir/bin/aompversion" ] ; then
+ _aomp_version_string=$("$AOMP"/bin/aompversion)
_phrase="for AOMP version $_aomp_version_string"
else
_phrase="for $_llvm_install_dir"
@@ -36,7 +36,7 @@ if [ $? == 0 ] ; then
echo "WARNING: Unexpected version of amdgpu kernel module found on this system: $_amdgpu_mod_version"
echo " The expected version $_phrase is $ROCM_EXPECTED_MODVERSION"
echo " Execution of compiled binaries may have issues on this system. For best results"
- echo " consider installing the latest "amdgpu-dkms" package from ROCm and reboot."
+ echo " consider installing the latest \"amdgpu-dkms\" package from ROCm and reboot."
echo " Command to check amdgpu kernel module version: modinfo -F version amdgpu"
echo
exit 0 # returning non zero fails the run_rocm_test.sh
diff --git a/bin/check_omptests.sh b/bin/check_omptests.sh
index 79495bde43..453f5671b0 100755
--- a/bin/check_omptests.sh
+++ b/bin/check_omptests.sh
@@ -4,12 +4,12 @@
# Assumes run_omptests.sh has been executed.
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
-pushd $AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME
+pushd "$AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME" || exit
rm -f runtime-fails.txt
rm -f compile-fails.txt
rm -f passing-tests.txt
@@ -19,25 +19,25 @@ compile_fails=0
runtime_fails=0
# Count tests that start with t- or test-
-total_tests=$(ls | grep "\(^t\-*\|^test\-\)" | wc -l)
+# shellcheck disable=SC2010 # 'ls' is OK here
+total_tests=$(ls -U1q | grep -Ec '^t-|^test-')
# Count compile/runtime fails and successful tests
for directory in ./t-*/; do
- pushd $directory > /dev/null
- testname=`basename $(pwd)`
- diff results/stdout expected > /dev/null
- return_code=$?
- if [ $return_code != 0 ] && [ -e results/a.out ]; then
- reason=`grep -E 'Killed' results/stderr`
- echo $testname $reason >> $AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME/runtime-fails.txt
+ pushd "$directory" > /dev/null || exit
+ testname=$(basename "$(pwd)")
+
+ if ! diff results/stdout expected > /dev/null && [ -e results/a.out ]; then
+ reason=$(grep -E 'Killed' results/stderr)
+ echo "$testname $reason" >> "$AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME/runtime-fails.txt"
elif ! [[ -e results/a.out ]]; then
- echo $testname >> $AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME/compile-fails.txt
+ echo "$testname" >> "$AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME/compile-fails.txt"
else
if [ -e results/a.out ]; then
- echo $testname >> $AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME/passing-tests.txt
+ echo "$testname" >> "$AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME/passing-tests.txt"
fi
fi
- popd > /dev/null
+ popd > /dev/null || exit
done
# Add skip_list tests to runtime fails
@@ -55,7 +55,8 @@ fi
# Add tests that were skipped to avoid soft hang
echo
echo -----Runtime Fails-----
-runtime_fails=$(ls | grep "^test\-" | wc -l)
+# shellcheck disable=SC2010 # 'ls' is OK here
+runtime_fails=$(ls -U1q | grep -Ec '^test-')
if [ -e runtime-fails.txt ]; then
echo
cat runtime-fails.txt
@@ -76,29 +77,34 @@ if [ "$passing_tests" == "$total_tests" ]; then
pass_rate=100
else
# The calculation results in extra zeros that can be removed with sed
- pass_rate=`bc -l <<< "scale=4; ($passing_tests/$total_tests) * 100" | sed -E "s/([0-9]+\.[0-9]+)00/\1/g"`
+ pass_rate=$(bc -l <<< "scale=4; ($passing_tests/$total_tests) * 100" | sed -E "s/([0-9]+\.[0-9]+)00/\1/g")
fi
echo
-echo ----- Results -----
-echo Compile Fails: $compile_fails
-echo Runtime Fails: $runtime_fails
+echo "----- Results -----"
+echo "Compile Fails: $compile_fails"
+echo "Runtime Fails: $runtime_fails"
-echo Successful Tests: $passing_tests/$total_tests
-echo Pass Rate: $pass_rate%
-echo -------------------
+echo "Successful Tests: $passing_tests/$total_tests"
+echo "Pass Rate: $pass_rate%"
+echo "-------------------"
echo
+if [ -z "$log" ]; then
+ echo "Log file not set! Exiting." >&2
+ exit 1
+fi
+
# Log Results
{
echo
- echo ----- Results -----
- echo Compile Fails: $compile_fails
- echo Runtime Fails: $runtime_fails
+ echo "----- Results -----"
+ echo "Compile Fails: $compile_fails"
+ echo "Runtime Fails: $runtime_fails"
- echo Successful Tests: $passing_tests/$total_tests
- echo Pass Rate: $pass_rate%
- echo -------------------
+ echo "Successful Tests: $passing_tests/$total_tests"
+ echo "Pass Rate: $pass_rate%"
+ echo "-------------------"
echo
-} >> omptests_run_$log
-popd
+} >> "omptests_run_$log"
+popd || exit
diff --git a/bin/clone_aomp.sh b/bin/clone_aomp.sh
index 2f747dc7d6..0df4f42470 100755
--- a/bin/clone_aomp.sh
+++ b/bin/clone_aomp.sh
@@ -5,14 +5,14 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
export AOMP_USE_CCACHE=${AOMP_USE_CCACHE:-0}
-. $thisdir/aomp_common_vars
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
thischk="$AOMP_REPOS/$AOMP_REPO_NAME/bin"
-thischk=`realpath $thischk`
+thischk=$(realpath "$thischk")
if [ "$thisdir" != "$thischk" ] ; then
echo
echo "ERROR: This clone_aomp.sh script is found in directory $thisdir "
@@ -28,9 +28,9 @@ fi
function list_repo(){
repodirname=$AOMP_REPOS/$reponame
-cd $repodirname
-abranch=`git branch | awk '/\*/ { print $2; }'`
-echo `git config --get remote.origin.url` " desired: " $COBRANCH " actual: " $abranch " " `git log --numstat --format="%h" |head -1`
+cd "$repodirname" || exit
+abranch=$(git branch | awk '/\*/ { print $2; }')
+echo "$(git config --get remote.origin.url)" " desired: " "$COBRANCH" " actual: " "$abranch" " " "$(git log --numstat --format="%h" |head -1)"
}
function clone_or_pull(){
@@ -39,91 +39,91 @@ list_repo
return
fi
+function clone_failed() {
+ echo "git clone failed for: $repodirname"
+ exit 1
+}
+
repodirname=$AOMP_REPOS/$reponame
echo
-if [ -d $repodirname ] ; then
+if [ -d "$repodirname" ] ; then
echo "--- Pulling updates to existing dir $repodirname ----"
echo " We assume this came from an earlier clone of $repo_web_location/$repogitname"
# FIXME look in $repodir/.git/config to be sure
- cd $repodirname
+ cd "$repodirname" || exit
if [ "$STASH_BEFORE_PULL" == "YES" ] ; then
git stash -u
fi
echo "git pull "
- git pull
- if [ $? != 0 ] && [ "$IGNORE_GIT_ERROR" != 1 ] ; then
+ if ! git pull && [ "$IGNORE_GIT_ERROR" != 1 ] ; then
echo "git pull failed for: $repodirname"
exit 1
fi
echo "cd $repodirname ; git checkout $COBRANCH"
- git checkout $COBRANCH
- if [ $? != 0 ] && [ "$IGNORE_GIT_ERROR" != 1 ] ; then
+ if ! git checkout "$COBRANCH" && [ "$IGNORE_GIT_ERROR" != 1 ] ; then
echo "git checkout failed for: $repodirname"
exit 1
fi
echo "git pull "
- git pull
- if [ $? != 0 ] && [ "$IGNORE_GIT_ERROR" != 1 ]; then
+ if ! git pull && [ "$IGNORE_GIT_ERROR" != 1 ]; then
echo "git pull failed for: $repodirname"
exit 1
fi
else
- echo --- NEW CLONE of repo $repogitname to $repodirname ----
- cd $AOMP_REPOS
+ echo "--- NEW CLONE of repo $repogitname to $repodirname ----"
+ cd "$AOMP_REPOS" || exit
if [ "$SINGLE_BRANCH" == 1 ]; then
- echo git clone -b $COBRANCH --depth=1 --single-branch $repo_web_location/$repogitname $reponame
- git clone -b $COBRANCH --depth=1 --single-branch $repo_web_location/$repogitname $reponame
- else
- echo git clone -b $COBRANCH $repo_web_location/$repogitname $reponame
- git clone -b $COBRANCH $repo_web_location/$repogitname $reponame
- fi
- if [ $? != 0 ] ; then
- echo "git clone failed for: $repodirname"
- exit 1
+ echo "git clone -b $COBRANCH --depth=1 --single-branch $repo_web_location/$repogitname $reponame"
+ if ! git clone -b "$COBRANCH" --depth=1 --single-branch "$repo_web_location/$repogitname" "$reponame"; then
+ clone_failed
+ fi
else
- echo "cd $repodirname ; git checkout $COBRANCH"
- cd $repodirname
- git checkout $COBRANCH
+ echo "git clone -b $COBRANCH $repo_web_location/$repogitname $reponame"
+ if ! git clone -b "$COBRANCH" "$repo_web_location/$repogitname" "$reponame"; then
+ clone_failed
+ fi
fi
+ echo "cd $repodirname ; git checkout $COBRANCH"
+ cd "$repodirname" || exit
+ git checkout "$COBRANCH"
fi
-if [ -d $repodirname ] ; then
- echo cd $repodirname
- cd $repodirname
+if [ -d "$repodirname" ] ; then
+ echo "cd $repodirname"
+ cd "$repodirname" || exit
if [ "$COSHAKEY" != "" ] ; then
- echo git checkout $COSHAKEY
- git checkout $COSHAKEY
+ echo "git checkout $COSHAKEY"
+ git checkout "$COSHAKEY"
fi
- echo git status
+ echo "git status"
git status
fi
}
function list_repo_from_manifest(){
- logcommit=`git log -1 | grep "^commit" | cut -d" " -f2 | xargs`
+ logcommit=$(git log -1 | grep "^commit" | cut -d" " -f2 | xargs)
thiscommit=${logcommit:0:12}
- thisdate=`git log -1 --pretty=fuller | grep "^CommitDate:" | cut -d":" -f2- | xargs | cut -d" " -f2-`
- get_monthnumber $thisdate
- thisday=`echo $thisdate | cut -d" " -f2`
- thisyear=`echo $thisdate | cut -d" " -f4`
- printf -v thisdatevar "%4u-%2s-%02u" $thisyear $monthnumber $thisday
- author=`git log -1 --pretty=fuller | grep "^Commit:" | cut -d":" -f2- | cut -d"<" -f1 | xargs`
- forauthor=`git log -1 --pretty=fuller | grep "^Author:" | cut -d":" -f2- | cut -d"<" -f1 | xargs`
+ thisdate=$(git log -1 --pretty=fuller | grep "^CommitDate:" | cut -d":" -f2- | xargs | cut -d" " -f2-)
+ get_monthnumber "$thisdate"
+ thisday=$(echo "$thisdate" | cut -d" " -f2)
+ thisyear=$(echo "$thisdate" | cut -d" " -f4)
+ printf -v thisdatevar "%4u-%2s-%02u" "$thisyear" "$monthnumber" "$thisday"
+ author=$(git log -1 --pretty=fuller | grep "^Commit:" | cut -d":" -f2- | cut -d"<" -f1 | xargs)
+ forauthor=$(git log -1 --pretty=fuller | grep "^Author:" | cut -d":" -f2- | cut -d"<" -f1 | xargs)
repodirname=$REPO_PATH
- HASH=`git log -1 --numstat --format="%h" | head -1`
+ HASH=$(git log -1 --numstat --format="%h" | head -1)
is_hash=0
branch_name=${REPO_RREV}
# get the actual branch
- actual_branch=`git branch | awk '/\*/ { print $2; }'`
+ actual_branch=$(git branch | awk '/\*/ { print $2; }')
WARNWORD=""
if [ "$actual_branch" == "(no" ] || [ "$actual_branch" == "(HEAD" ] || [ "$actual_branch" == "(detached" ] ; then
is_hash=1
WARNWORD="hash"
- git describe --exact-match --tags > /dev/null 2>&1
# Repo has a tag checked out
- if [ $? -eq 0 ]; then
- head_tags=`git tag --points-at HEAD`
+ if git describe --exact-match --tags > /dev/null 2>&1; then
+ head_tags=$(git tag --points-at HEAD)
# If tag is found in list of tags at HEAD, then it is correct.
- if [[ "$head_tags" =~ "$branch_name" ]]; then
+ if [[ "$head_tags" =~ $branch_name ]]; then
WARNWORD="tag"
thiscommit=$branch_name
else
@@ -131,10 +131,10 @@ function list_repo_from_manifest(){
thiscommit=$HASH
fi
else # This is a hash not a tag
- actual_hash=`git branch | awk '/\*/ { print $5; }' | cut -d")" -f1`
+ actual_hash=$(git branch | awk '/\*/ { print $5; }' | cut -d")" -f1)
# RHEL 7 'git branch' returns (detached from 123456), try to get hash again.
if [ "$actual_hash" == "" ] ; then
- actual_hash=`git branch | awk '/\*/ { print $4; }' | cut -d")" -f1`
+ actual_hash=$(git branch | awk '/\*/ { print $4; }' | cut -d")" -f1)
fi
revision_regex="^$actual_hash"
if [[ ! "$COSHAKEY" =~ $revision_regex ]] ; then
@@ -149,29 +149,39 @@ function list_repo_from_manifest(){
else
printbranch=${REPO_RREV##*release/}
fi
- url=`grep url .git/config | grep -v google | grep -v fmtlib | cut -d":" -f2- | cut -d"/" -f3-`
- project_name=`echo $url | cut -d"/" -f2- | tr '[:upper:]' '[:lower:]'`
+ url=$(grep url .git/config | grep -v google | grep -v fmtlib | cut -d":" -f2- | cut -d"/" -f3-)
+ project_name=$(echo $url | cut -d"/" -f2- | cut -d" " -f1 | tr '[:upper:]' '[:lower:]')
REPO_PROJECT=${REPO_PROJECT%*\.git}
if [[ "$REPO_REMOTE" == "githubemu-lightning" ]] ; then
REPO_REMOTE="emu"
fi
- #website=`echo $url | cut -d"/" -f1`
if [[ "$REPO_REMOTE" == "roc" ]] ; then
- manifest_project=`echo ROCm/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ repo_git_list="llvm-project hipify spirv-llvm-translator"
+ if echo "$repo_git_list" | grep -w "$REPO_PROJECT"; then
+ url=$(grep url .git/config)
+ nogit=${url%*.git}
+ project_name=${nogit##*/}
+ manifest_project=$(echo $REPO_PROJECT | tr '[:upper:]' '[:lower:]' | cut -d"." -f1)
+ else
+ manifest_project=$(echo ROCm/$REPO_PROJECT | tr '[:upper:]' '[:lower:]')
+ fi
elif [[ "$REPO_REMOTE" == "emu" ]] ; then
- url=`grep url .git/config | cut -d":" -f2- | cut -d"/" -f1- | cut -d"." -f1`
- project_name=`echo $url | cut -d"/" -f2- | tr '[:upper:]' '[:lower:]'`
- manifest_project=`echo $REPO_PROJECT | tr '[:upper:]' '[:lower:]' | cut -d"." -f1`
+ url=$(grep url .git/config)
+ nogit=${url%*.git}
+ project_name=${nogit##*/}
+ manifest_project=$(echo $REPO_PROJECT | tr '[:upper:]' '[:lower:]' | cut -d"." -f1)
elif [[ "$REPO_REMOTE" == "roctools" ]] ; then
- manifest_project=`echo ROCm/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "ROCm/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
elif [[ "$REPO_REMOTE" == "rocsw" ]] ; then
- manifest_project=`echo ROCm/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "ROCm/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
elif [[ "$REPO_REMOTE" == "gerritgit" ]] ; then
- manifest_project=`echo $REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
elif [[ "$REPO_REMOTE" == "hwloc" ]] ; then
- manifest_project=`echo open-mpi/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "open-mpi/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
+ elif [[ "$REPO_REMOTE" == "simde" ]] ; then
+ manifest_project=$(echo "simd-everywhere/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
else
- manifest_project=`echo $REPO_REMOTE/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "$REPO_REMOTE/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
fi
#tr '[:upper:]' '[:lower:]'`
if [[ "$manifest_project" != "$project_name" ]] ; then
@@ -179,11 +189,13 @@ function list_repo_from_manifest(){
echo " Manifest project: $manifest_project"
WARNWORD="!REPO!"
fi
- printf "%6s %14s %21s %25s %12s %10s %18s %18s %8s\n" $REPO_REMOTE $printbranch $REPO_PATH ${REPO_PROJECT} $thiscommit $thisdatevar "$author" "$forauthor" "$WARNWORD"
+ printf "%6s %14s %21s %25s %12s %10s %18s %18s %8s\n" "$REPO_REMOTE" \
+ "$printbranch" "$REPO_PATH" "${REPO_PROJECT}" "$thiscommit" \
+ "$thisdatevar" "$author" "$forauthor" "$WARNWORD"
}
function get_monthnumber() {
- case $(echo ${1:0:3} | tr '[a-z]' '[A-Z]') in
+ case $(echo "${1:0:3}" | tr '[:lower:]' '[:upper:]') in
JAN) monthnumber="01" ;;
FEB) monthnumber="02" ;;
MAR) monthnumber="03" ;;
@@ -214,7 +226,7 @@ if [[ "$AOMP_VERSION" == "13.1" ]] || [[ $AOMP_MAJOR_VERSION -gt 13 ]] ; then
manifest_file=$thisdir/../manifests/aompi_${AOMP_VERSION}.xml
fi
else
- abranch=`git branch | awk '/\*/ { print $2; }'`
+ abranch=$(git branch | awk '/\*/ { print $2; }')
# Use release manifest if on release branch
if [ "$abranch" == "aomp-${AOMP_VERSION_STRING}" ]; then
manifest_file=$thisdir/../manifests/aomp_${AOMP_VERSION_STRING}.xml
@@ -227,43 +239,42 @@ if [[ "$AOMP_VERSION" == "13.1" ]] || [[ $AOMP_MAJOR_VERSION -gt 13 ]] ; then
fi
fi
echo "USED manifest file: $manifest_file"
- if [ ! -f $manifest_file ] ; then
+ if [ ! -f "$manifest_file" ] ; then
echo "ERROR manifest file missing: $manifest_file"
exit 1
fi
tmpfile=/tmp/mlines$$
# Manifest file must be one project line per repo
- cat $manifest_file | grep project > $tmpfile
+ grep project < "$manifest_file" > "$tmpfile"
if [ "$1" == "list" ] ; then
- printf "MANIFEST FILE: %40s\n" $manifest_file
+ printf "MANIFEST FILE: %40s\n" "$manifest_file"
printf "%6s %14s %21s %25s %12s %10s %18s %18s\n" "repo" "branch" "path" "repo name" "last hash" "updated" "commitor" "for author"
printf "%6s %14s %21s %25s %12s %10s %18s %18s\n" "----" "------" "----" "---------" "---------" "-------" "--------" "----------"
# printf "%6s %14s %24s %25s %12s %10s %18s %18s %8s\n" $REPO_REMOTE $printbranch $REPO_PATH ${REPO_PROJECT} $thiscommit $thisdatevar "$author" "$forauthor" "$WARNWORD"
fi
- while read line ; do
+ while read -r line; do
line_is_good=1
- remote=`echo $line | grep remote | cut -d"=" -f2`
+ remote=$(echo "$line" | grep remote | cut -d"=" -f2)
sha_key_used=0
COSHAKEY=""
- for field in `echo $line` ; do
- if [ -z "${field##*remote=*}" ] ; then
- # strip off = and double quotes
- remote=$(eval echo `echo $field | cut -d= -f2 `)
+ for field in $line; do
+ if [[ "$field" =~ remote=\"([^\"]*)\" ]]; then
+ remote=${BASH_REMATCH[1]}
fi
- if [ -z "${field##*name=*}" ] ; then
- name=$(eval echo `echo $field | cut -d= -f2 `)
+ if [[ "$field" =~ name=\"([^\"]*)\" ]]; then
+ name=${BASH_REMATCH[1]}
fi
- if [ -z "${field##*path=*}" ] ; then
- path=$(eval echo `echo $field | cut -d= -f2 `)
+ if [[ "$field" =~ path=\"([^\"]*)\" ]]; then
+ path=${BASH_REMATCH[1]}
fi
- if [ -z "${field##*upstream=*}" ] ; then
- COBRANCH=$(eval echo `echo $field | cut -d= -f2 `)
+ if [[ "$field" =~ upstream=\"([^\"]*)\" ]]; then
+ COBRANCH=${BASH_REMATCH[1]}
sha_key_used=1
fi
- if [ -z "${field##*revision=*}" ] && [ "$sha_key_used" == 1 ] ; then
- COSHAKEY=$(eval echo `echo $field | cut -d= -f2 `)
- elif [ -z "${field##*revision=*}" ]; then
- COBRANCH=$(eval echo `echo $field | cut -d= -f2 `)
+ if [[ "$field" =~ revision=\"([^\"]*)\" ]] && [ "$sha_key_used" == 1 ]; then
+ COSHAKEY=${BASH_REMATCH[1]}
+ elif [[ "$field" =~ revision=\"([^\"]*)\" ]]; then
+ COBRANCH=${BASH_REMATCH[1]}
fi
done
reponame=$path
@@ -276,50 +287,52 @@ if [[ "$AOMP_VERSION" == "13.1" ]] || [[ $AOMP_MAJOR_VERSION -gt 13 ]] ; then
repo_web_location=$GITHWLOC
elif [ "$remote" == "githubemu-lightning" ] ; then
repo_web_location=$GITLIGHTNINGINTERNAL
+ elif [ "$remote" == "simde" ] ; then
+ repo_web_location="https://github.com/simd-everywhere"
else
line_is_good=0
fi
- if [ $line_is_good == 1 ] ; then
+ if [ "$line_is_good" == 1 ] ; then
if [ "$1" == "list" ] ; then
repodirname=$AOMP_REPOS/$reponame
- if [ -d $repodirname ] ; then
+ if [ -d "$repodirname" ] ; then
REPO_PROJECT=$name
REPO_PATH=$path
REPO_RREV=$COBRANCH
- REPO_REMOTE=$remote
- cd $repodirname
+ REPO_REMOTE=$remote
+ cd "$repodirname" || exit
list_repo_from_manifest
fi
else
- if [ $reponame == "aomp" ] ; then
+ if [ "$reponame" == "aomp" ] ; then
echo
echo "Skipping pull of aomp repo "
- echo
- else
+ echo
+ else
clone_or_pull
fi
fi
fi # end line_is_good
- done <$tmpfile
- rm $tmpfile
+ done <"$tmpfile"
+ rm "$tmpfile"
# build_rocr.sh expects directory rocr-runtime which is a subdir of hsa-runtime
# Link in the open source hsa-runtime as "src" directory
- if [ -d $AOMP_REPOS/hsa-runtime ] ; then
- if [ ! -L $AOMP_REPOS/rocr-runtime/src ] ; then
+ if [ -d "$AOMP_REPOS/hsa-runtime" ] ; then
+ if [ ! -L "$AOMP_REPOS/rocr-runtime/src" ] ; then
echo "Fixing rocr-runtime with correct link to hsa-runtime/opensrc/hsa-runtime src"
- echo mkdir -p $AOMP_REPOS/rocr-runtime
- mkdir -p $AOMP_REPOS/rocr-runtime
- echo cd $AOMP_REPOS/rocr-runtime
- cd $AOMP_REPOS/rocr-runtime
- echo ln -sf -t $AOMP_REPOS/rocr-runtime ../hsa-runtime/opensrc/hsa-runtime
- ln -sf -t $AOMP_REPOS/rocr-runtime ../hsa-runtime/opensrc/hsa-runtime
- echo ln -sf hsa-runtime src
+ echo "mkdir -p $AOMP_REPOS/rocr-runtime"
+ mkdir -p "$AOMP_REPOS/rocr-runtime"
+ echo "cd $AOMP_REPOS/rocr-runtime"
+ cd "$AOMP_REPOS/rocr-runtime" || exit
+ echo "ln -sf -t $AOMP_REPOS/rocr-runtime ../hsa-runtime/opensrc/hsa-runtime"
+ ln -sf -t "$AOMP_REPOS/rocr-runtime" ../hsa-runtime/opensrc/hsa-runtime
+ echo "ln -sf hsa-runtime src"
ln -sf hsa-runtime src
fi
fi
- exit $rc
+ exit
fi
## Before 13.1 repos were specified with environment variablse in aomp_common_vars
diff --git a/bin/clone_epsdb_test.sh b/bin/clone_epsdb_test.sh
index 8801fff915..f949401b27 100755
--- a/bin/clone_epsdb_test.sh
+++ b/bin/clone_epsdb_test.sh
@@ -5,25 +5,25 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
function clone_or_pull(){
repodirname=$AOMP_REPOS_TEST/$reponame
echo
-if [ -d $repodirname ] ; then
+if [ -d "$repodirname" ]; then
echo "--- Pulling updates to existing dir $repodirname ----"
echo " We assume this came from an earlier clone of $repo_web_location/$reponame"
# FIXME look in $repodir/.git/config to be sure
- cd $repodirname
+ cd "$repodirname" || exit
# undo the patches to RAJA
if [ "$reponame" == "$AOMP_RAJA_REPO_NAME" ] ; then
git checkout include/RAJA/policy/atomic_auto.hpp
- cd blt
+ cd blt || exit
git checkout cmake/SetupCompilerOptions.cmake
- cd $repodirname
+ cd "$repodirname" || exit
fi
if [ "$STASH_BEFORE_PULL" == "YES" ] ; then
if [ "$reponame" != "$AOMP_RAJA_REPO_NAME" ] ; then
@@ -33,7 +33,7 @@ if [ -d $repodirname ] ; then
echo "git pull "
git pull
echo "cd $repodirname ; git checkout $COBRANCH"
- git checkout $COBRANCH
+ git checkout "$COBRANCH"
#echo "git pull "
#git pull
if [ "$reponame" == "$AOMP_RAJA_REPO_NAME" ] ; then
@@ -43,24 +43,24 @@ if [ -d $repodirname ] ; then
git pull
fi
else
- echo --- NEW CLONE of repo $reponame to $repodirname ----
- cd $AOMP_REPOS_TEST
+ echo "--- NEW CLONE of repo $reponame to $repodirname ----"
+ cd "$AOMP_REPOS_TEST" || exit
if [[ "$reponame" == "$AOMP_RAJA_REPO_NAME" || "$reponame" == "$AOMP_RAJAPERF_REPO_NAME" ]]; then
- git clone --recursive -b $COBRANCH $repo_web_location/$reponame $reponame
+ git clone --recursive -b "$COBRANCH" "$repo_web_location/$reponame" "$reponame"
else
- echo git clone $repo_web_location/$reponame
- git clone $repo_web_location/$reponame $reponame
+ echo "git clone $repo_web_location/$reponame"
+ git clone "$repo_web_location/$reponame" "$reponame"
echo "cd $repodirname ; git checkout $COBRANCH"
- cd $repodirname
- git checkout $COBRANCH
+ cd "$repodirname" || exit
+ git checkout "$COBRANCH"
fi
fi
-cd $repodirname
+cd "$repodirname" || exit
echo git status
git status
}
-mkdir -p $AOMP_REPOS_TEST
+mkdir -p "$AOMP_REPOS_TEST"
# ---------------------------------------
# The following repos is in AMDComputeLibraries
diff --git a/bin/clone_test.sh b/bin/clone_test.sh
index 322e441ab7..85d8686d53 100755
--- a/bin/clone_test.sh
+++ b/bin/clone_test.sh
@@ -5,35 +5,35 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
export AOMP_USE_CCACHE=${AOMP_USE_CCACHE:-0}
-. $thisdir/aomp_common_vars
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
EPSDB_LIST=${EPSDB_LIST:-"openmpapps sollve_vv Nekbone goulash fortran-babelstream babelstream OvO OpenMP_VV"}
function list_repo_from_manifest(){
- logcommit=`git log -1 | grep "^commit" | cut -d" " -f2 | xargs`
+ logcommit=$(git log -1 | grep "^commit" | cut -d" " -f2 | xargs)
thiscommit=${logcommit:0:12}
- thisdate=`git log -1 --pretty=fuller | grep "^CommitDate:" | cut -d":" -f2- | xargs | cut -d" " -f2-`
- get_monthnumber $thisdate
- thisday=`echo $thisdate | cut -d" " -f2`
- thisyear=`echo $thisdate | cut -d" " -f4`
- printf -v thisdatevar "%4u-%2s-%02u" $thisyear $monthnumber $thisday
- author=`git log -1 --pretty=fuller | grep "^Commit:" | cut -d":" -f2- | cut -d"<" -f1 | xargs`
- forauthor=`git log -1 --pretty=fuller | grep "^Author:" | cut -d":" -f2- | cut -d"<" -f1 | xargs`
+ thisdate=$(git log -1 --pretty=fuller | grep "^CommitDate:" | cut -d":" -f2- | xargs | cut -d" " -f2-)
+ get_monthnumber "$thisdate"
+ thisday=$(echo "$thisdate" | cut -d" " -f2)
+ thisyear=$(echo "$thisdate" | cut -d" " -f4)
+ printf -v thisdatevar "%4u-%2s-%02u" "$thisyear" "$monthnumber" "$thisday"
+ author=$(git log -1 --pretty=fuller | grep "^Commit:" | cut -d":" -f2- | cut -d"<" -f1 | xargs)
+ forauthor=$(git log -1 --pretty=fuller | grep "^Author:" | cut -d":" -f2- | cut -d"<" -f1 | xargs)
repodirname=$REPO_PATH
- HASH=`git log -1 --numstat --format="%h" | head -1`
+ HASH=$(git log -1 --numstat --format="%h" | head -1)
is_hash=0
branch_name=${REPO_RREV}
# get the actual branch
- actual_branch=`git branch | awk '/\*/ { print $2; }'`
+ actual_branch=$(git branch | awk '/\*/ { print $2; }')
WARNWORD=""
if [ "$actual_branch" == "(no" ] || [ "$actual_branch" == "(HEAD" ] ; then
is_hash=1
- actual_hash=`git branch | awk '/\*/ { print $5; }' | cut -d")" -f1`
+ actual_hash=$(git branch | awk '/\*/ { print $5; }' | cut -d")" -f1)
if [ "$actual_hash" == "$branch_name" ] ; then
WARNWORD="tagged"
thiscommit=$HASH
@@ -53,38 +53,39 @@ function list_repo_from_manifest(){
fi
if [[ -f .git/config ]] ; then
- url=`grep -m1 url .git/config | cut -d":" -f2- | cut -d"/" -f3-`
- project_name=`echo $url | cut -d"/" -f2- | tr '[:upper:]' '[:lower:]'`
+ url=$(grep -m1 url .git/config | cut -d":" -f2- | cut -d"/" -f3-)
+ project_name=$(echo "$url" | cut -d"/" -f2- | tr '[:upper:]' '[:lower:]')
#website=`echo $url | cut -d"/" -f1`
if [[ "$REPO_REMOTE" == "roc" ]] ; then
- manifest_project=`echo radeonopencompute/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "radeonopencompute/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
elif [[ "$REPO_REMOTE" == "roctools" ]] ; then
- manifest_project=`echo ROCM-Developer-Tools/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "ROCM-Developer-Tools/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
elif [[ "$REPO_REMOTE" == "amdlibs" ]] ; then
- manifest_project=`echo AMDComputeLibraries/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "AMDComputeLibraries/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
elif [[ "$REPO_REMOTE" == "omphost" ]] ; then
- manifest_project=`echo doru1004/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "doru1004/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
elif [[ "$REPO_REMOTE" == "julia" ]] ; then
- manifest_project=`echo JuliaMath/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "JuliaMath/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
elif [[ "$REPO_REMOTE" == "tapple" ]] ; then
- manifest_project=`echo TApplencourt/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "TApplencourt/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
elif [[ "$REPO_REMOTE" == "gerritgit" ]] ; then
- manifest_project=`echo $REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
else
- manifest_project=`echo $REPO_REMOTE/$REPO_PROJECT | tr '[:upper:]' '[:lower:]'`
+ manifest_project=$(echo "$REPO_REMOTE/$REPO_PROJECT" | tr '[:upper:]' '[:lower:]')
fi
- #tr '[:upper:]' '[:lower:]'`
if [[ "$manifest_project" != "$project_name" ]] ; then
echo "WARNING Actual project : $project_name"
echo " Manifest project: $manifest_project"
WARNWORD="!REPO!"
fi
- printf "%10s %12s %13s %17s %12s %10s %18s %18s %8s\n" $REPO_REMOTE $printbranch $REPO_PATH ${REPO_PROJECT} $thiscommit $thisdatevar "$author" "$forauthor" "$WARNWORD"
+ printf "%10s %12s %13s %17s %12s %10s %18s %18s %8s\n" "$REPO_REMOTE" \
+ "$printbranch" "$REPO_PATH" "${REPO_PROJECT}" "$thiscommit" \
+ "$thisdatevar" "$author" "$forauthor" "$WARNWORD"
fi
}
function get_monthnumber() {
- case $(echo ${1:0:3} | tr '[a-z]' '[A-Z]') in
+ case $(echo "${1:0:3}" | tr '[:lower:]' '[:upper:]') in
JAN) monthnumber="01" ;;
FEB) monthnumber="02" ;;
MAR) monthnumber="03" ;;
@@ -103,17 +104,17 @@ function get_monthnumber() {
function clone_or_pull(){
repodirname=${AOMP_REPOS_TEST}/$reponame
echo
-if [ -d $repodirname ] ; then
+if [ -d "$repodirname" ] ; then
echo "--- Pulling updates to existing dir $repodirname ----"
echo " We assume this came from an earlier clone of $repo_web_location$repogitname"
# FIXME look in $repodir/.git/config to be sure
- cd $repodirname
+ cd "$repodirname" || exit
# undo the patches to RAJA
if [ "$reponame" == "raja" ] ; then
git checkout include/RAJA/policy/atomic_auto.hpp
- cd blt
+ cd blt || exit
git checkout cmake/SetupCompilerOptions.cmake
- cd $repodirname
+ cd "$repodirname" || exit
fi
if [ "$STASH_BEFORE_PULL" == "YES" ] ; then
if [ "$reponame" != "raja" ] ; then
@@ -123,7 +124,7 @@ if [ -d $repodirname ] ; then
echo "git pull "
git pull
echo "cd $repodirname ; git checkout $COBRANCH"
- git checkout $COBRANCH
+ git checkout "$COBRANCH"
#echo "git pull "
#git pull
if [ "$reponame" == "raja" ] ; then
@@ -133,79 +134,77 @@ if [ -d $repodirname ] ; then
git pull
fi
else
- echo --- NEW CLONE of repo $reponame to $repodirname ----
- cd $AOMP_REPOS_TEST
+ echo "--- NEW CLONE of repo $reponame to $repodirname ----"
+ cd "$AOMP_REPOS_TEST" || exit
if [[ "$reponame" == "raja" || "$reponame" == "RAJAPerf" ]]; then
- git clone --recursive -b $COBRANCH $repo_web_location$repogitname $reponame
+ git clone --recursive -b "$COBRANCH" "$repo_web_location$repogitname" "$reponame"
else
- echo git clone $repo_web_location$repogitname
- git clone ${repo_web_location}${repogitname} $reponame
+ echo "git clone $repo_web_location$repogitname"
+ git clone "${repo_web_location}${repogitname}" "$reponame"
echo "cd $repodirname ; git checkout $COBRANCH"
- cd $repodirname
- git checkout $COBRANCH
+ cd "$repodirname" || exit
+ git checkout "$COBRANCH"
fi
fi
-cd $repodirname
+cd "$repodirname" || exit
echo git status
git status
}
manifest_file=$thisdir/../manifests/test_${AOMP_VERSION}.xml
-if [ ! -f $manifest_file ] ; then
+if [ ! -f "$manifest_file" ] ; then
echo "ERROR manifest file missing: $manifest_file"
exit 1
fi
# Manifest file must be one project line per repo
if [ "$1" == "list" ] ; then
- printf "MANIFEST FILE : %66s\n" $manifest_file
- printf "AOMP_REPOS_TEST: %66s\n" $AOMP_REPOS_TEST
+ printf "MANIFEST FILE : %66s\n" "$manifest_file"
+ printf "AOMP_REPOS_TEST: %66s\n" "$AOMP_REPOS_TEST"
printf "%10s %12s %13s %17s %12s %10s %18s %18s\n" "repo src" "branch" "path" "repo name" "last hash" "updated" "commitor" "for author"
printf "%10s %12s %13s %17s %12s %10s %18s %18s\n" "--------" "------" "----" "---------" "---------" "-------" "--------" "----------"
fi
tmpfile=/tmp/mlines$$
-cat $manifest_file | grep project > $tmpfile
+grep project < "$manifest_file" > $tmpfile
-if [ ! -d ${AOMP_REPOS_TEST} ]; then
- mkdir -p ${AOMP_REPOS_TEST}
+if [ ! -d "${AOMP_REPOS_TEST}" ]; then
+ mkdir -p "${AOMP_REPOS_TEST}"
fi
-while read line ; do
- line_is_good=1
- remote=`echo $line | grep remote | cut -d"=" -f2`
- for field in `echo $line` ; do
- if [ -z "${field##*remote=*}" ] ; then
- # strip off = and double quotes
- remote=$(eval echo `echo $field | cut -d= -f2 `)
+while read -r line ; do
+ remote=$(echo "$line" | grep remote | cut -d"=" -f2)
+ for field in $line; do
+ if [[ "$field" =~ remote=\"([^\"]*)\" ]]; then
+ remote=${BASH_REMATCH[1]}
fi
- if [ -z "${field##*name=*}" ] ; then
- name=$(eval echo `echo $field | cut -d= -f2 `)
+ if [[ "$field" =~ name=\"([^\"]*)\" ]]; then
+ name=${BASH_REMATCH[1]}
fi
- if [ -z "${field##*path=*}" ] ; then
- path=$(eval echo `echo $field | cut -d= -f2 `)
+ if [[ "$field" =~ path=\"([^\"]*)\" ]]; then
+ path=${BASH_REMATCH[1]}
fi
- if [ -z "${field##*revision=*}" ] ; then
- COBRANCH=$(eval echo `echo $field | cut -d= -f2 `)
+ if [[ "$field" =~ revision=\"([^\"]*)\" ]]; then
+ COBRANCH=${BASH_REMATCH[1]}
fi
- if [ -z "${field##*groups=*}" ] ; then
- groups=$(eval echo `echo $field | cut -d= -f2 `)
+ if [[ "$field" =~ groups=\"([^\"]*)\" ]]; then
+ groups=${BASH_REMATCH[1]}
fi
done
reponame=$path
repogitname=$name
repodirname=$AOMP_REPOS_TEST/$reponame
- repo_web_location=`grep http $manifest_file | grep $remote | cut -d":" -f2 | cut -d"\"" -f1`
+ repo_web_location=$(grep http "$manifest_file" | grep "$remote" | cut -d":" -f2 | cut -d"\"" -f1)
repo_web_location="https:${repo_web_location}"
REPO_PROJECT=$name
REPO_PATH=$path
REPO_RREV=$COBRANCH
REPO_REMOTE=$remote
if [ "$1" == "list" ] ; then
- if [ -d $repodirname ] ; then
- cd $repodirname
+ if [ -d "$repodirname" ] ; then
+ cd "$repodirname" || exit
list_repo_from_manifest
else
- echo $repodirname not found
+ echo "$repodirname not found"
fi
else
if [[ "$groups" != "skip" ]] ; then
@@ -223,7 +222,7 @@ while read line ; do
fi
fi
fi
-done <$tmpfile
-rm $tmpfile
+done < "$tmpfile"
+rm "$tmpfile"
exit
diff --git a/bin/create_release_tarball.sh b/bin/create_release_tarball.sh
index d253d3b70f..cb5b1dfd74 100755
--- a/bin/create_release_tarball.sh
+++ b/bin/create_release_tarball.sh
@@ -7,9 +7,9 @@
#
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
function getmanifest(){
@@ -26,7 +26,7 @@ function getmanifest(){
# AMD internal repo file
manifest_file=$thisdir/../manifests/aompi_${AOMP_VERSION}.xml
else
- abranch=`git branch | awk '/\*/ { print $2; }'`
+ abranch=$(git branch | awk '/\*/ { print $2; }')
# Use release manifest if on release branch
if [ "$abranch" == "aomp-${AOMP_VERSION_STRING}" ]; then
manifest_file=$thisdir/../manifests/aomp_${AOMP_VERSION_STRING}.xml
@@ -35,11 +35,11 @@ function getmanifest(){
fi
fi
fi
- if [ ! -f $manifest_file ] ; then
+ if [ ! -f "$manifest_file" ] ; then
echo "ERROR manifest file missing: $manifest_file"
exit 1
fi
- echo Using: $manifest_file
+ echo "Using: $manifest_file"
else
echo Error: This AOMP version does not have a manifest file.
fi
@@ -48,31 +48,31 @@ function getmanifest(){
function getreponame(){
getmanifest
tmpfile=/tmp/mlines$$
- tarballremove="roctracer rocprofiler aomp build Makefile"
+ tarballremove="roctracer rocprofiler aomp build Makefile rocprofiler-sdk"
# Manifest file must be one project line per repo
#manifest_file=/home/release/git/aomp14/aomp/manifests/aomp_14.0-0.xml
- cat $manifest_file | grep project > $tmpfile
- while read line ; do
+ grep project < "$manifest_file" > "$tmpfile"
+ while read -r line; do
found=0
- for field in `echo $line` ; do
- if [ -z "${field##*path=*}" ] ; then
- path=$(eval echo `echo $field | cut -d= -f2 `)
+ for field in $line; do
+ if [[ "$field" =~ path=\"([^\"]*)\" ]]; then
+ path=${BASH_REMATCH[1]}
fi
done
- reponame=$path
- for component in $tarballremove; do
- if [ "$reponame" == "$component" ]; then
- found=1
- break
+ reponame=$path
+ for component in $tarballremove; do
+ if [ "$reponame" == "$component" ]; then
+ found=1
+ break
+ fi
+ done
+ if [ "$found" == 0 ]; then
+ repos="$repos $reponame"
fi
- done
- if [ "$found" == 0 ]; then
- repos="$repos $reponame"
- fi
- done <$tmpfile
+ done < "$tmpfile"
- echo $repos
- rm $tmpfile
+ echo "$repos"
+ rm "$tmpfile"
}
# Get repos from manifest
@@ -81,7 +81,8 @@ getreponame
REPO_NAMES=$repos
ALL_NAMES="$REPO_NAMES Makefile build aomp"
# Check for extra directories. Note build is in the exclude list
-for dir_name in `ls $AOMP_REPOS` ; do
+for dir_name in "$AOMP_REPOS"/*; do
+ dir_name=$(basename $dir_name)
found=0
for repo_name in $ALL_NAMES ; do
if [ "$repo_name" == "$dir_name" ] ; then
@@ -96,7 +97,7 @@ for dir_name in `ls $AOMP_REPOS` ; do
echo " $dir_name WILL NOT BE ADDED TO SOURCE TARBALL."
echo " CHECK DIRECTORY $AOMP_REPOS ."
echo " HIT ENTER TO CONTINUE or CTRL-C TO CANCEL"
- read
+ read -r
fi
done
@@ -104,9 +105,9 @@ patchloc=$thisdir/patches
export IFS=" "
echo "----------------- PRE-PATCH STATUS -----------------"
for repo_name in $REPO_NAMES ; do
- cd $AOMP_REPOS/$repo_name
+ cd "$AOMP_REPOS/$repo_name" || exit
echo
- echo $repo_name: git status
+ echo "$repo_name: git status"
git status
done
echo "----------------- PATCHING REPOS -----------------"
@@ -115,69 +116,69 @@ for repo_name in $REPO_NAMES ; do
if [ "$repo_name" == "llvm-project" ] && [ "$AOMP_APPLY_ATD_AMD_STAGING_PATCH" == 0 ] ; then
continue
else
- echo patchrepo $AOMP_REPOS/$repo_name
- patchrepo $AOMP_REPOS/$repo_name
+ echo "patchrepo $AOMP_REPOS/$repo_name"
+ patchrepo "$AOMP_REPOS/$repo_name"
fi
done
echo "----------------- POST-PATCH STATUS -----------------"
for repo_name in $REPO_NAMES ; do
- cd $AOMP_REPOS/$repo_name
+ cd "$AOMP_REPOS/$repo_name" || exit
echo
- echo $repo_name: git status
+ echo "$repo_name: git status"
git status
done
# This file will be uploaded to the release directory
-tarball="$AOMP_REPOS/../aomp-${AOMP_VERSION_STRING}.tar.gz"
+tarball="$AOMP_REPOS/../aomp-${AOMP_VERSION_STRING}-source.tar.gz"
tmpdir=/tmp/create_tarball$$
majorver=${AOMP_VERSION}
tardir=$tmpdir/aomp$majorver
echo "----- Building symbolic temp dir $tardir------------"
-echo mkdir -p $tardir
-mkdir -p $tardir
-cd $tardir
+echo "mkdir -p $tardir"
+mkdir -p "$tardir"
+cd "$tardir" || exit
# Copy makefile to $tardir
-echo cp -p $AOMP_REPOS/$AOMP_REPO_NAME/Makefile $tardir/Makefile
-cp -p $AOMP_REPOS/aomp/Makefile $tardir/Makefile
+echo "cp -p $AOMP_REPOS/$AOMP_REPO_NAME/Makefile $tardir/Makefile"
+cp -p "$AOMP_REPOS/aomp/Makefile" "$tardir/Makefile"
for repo_name in $REPO_NAMES ; do
- echo ln -sf $AOMP_REPOS/$repo_name $repo_name
- ln -sf $AOMP_REPOS/$repo_name $repo_name
+ echo "ln -sf $AOMP_REPOS/$repo_name $repo_name"
+ ln -sf "$AOMP_REPOS/$repo_name" "$repo_name"
done
-echo ln -sf $AOMP_REPOS/$AOMP_REPO_NAME $AOMP_REPO_NAME
-ln -sf $AOMP_REPOS/$AOMP_REPO_NAME $AOMP_REPO_NAME
-cd $tmpdir
-cmd="tar --exclude-from $thisdir/create_release_tarball_excludes -h -czf $tarball aomp$majorver "
+echo "ln -sf $AOMP_REPOS/$AOMP_REPO_NAME $AOMP_REPO_NAME"
+ln -sf "$AOMP_REPOS/$AOMP_REPO_NAME" "$AOMP_REPO_NAME"
+cd "$tmpdir" || exit
+cmd="tar --exclude-from $thisdir/create_release_tarball_excludes -h -czf $tarball aomp$majorver"
echo "----------------- START tar COMMAND -----------------"
-echo time $cmd
+echo "time $cmd"
time $cmd
echo
-echo done creating $PWD/$tarball
+echo "done creating $PWD/$tarball"
echo
echo "----- Cleanup symbolic temp dir $tardir------------"
-echo cd $tardir
-cd $tardir
+echo "cd $tardir"
+cd "$tardir" || exit
echo "rm *"
-rm *
-echo rmdir $tardir
-rmdir $tardir
-cd /tmp
-echo rmdir $tmpdir
-rmdir $tmpdir
+rm -- *
+echo "rmdir $tardir"
+rmdir "$tardir"
+cd /tmp || exit
+echo "rmdir $tmpdir"
+rmdir "$tmpdir"
echo "----------------- REVERSE PATCHING -----------------"
for repo_name in $REPO_NAMES ; do
- removepatch $AOMP_REPOS/$repo_name
+ removepatch "$AOMP_REPOS/$repo_name"
done
echo "----------------- POST REVERSE PATCH STATUS -----------------"
for repo_name in $REPO_NAMES ; do
- cd $AOMP_REPOS/$repo_name
+ cd "$AOMP_REPOS/$repo_name" || exit
echo
- echo $repo_name: git status
+ echo "$repo_name: git status"
git status
done
echo
-cd $AOMP_REPOS/..
+cd "$AOMP_REPOS/.." || exit
echo "------ DONE! CMD:$0 FILE:$tarball ------"
-ls -lh $tarball
+ls -lh "$tarball"
diff --git a/bin/debian/changelog b/bin/debian/changelog
index 21397e26b2..ba93cb3d34 100644
--- a/bin/debian/changelog
+++ b/bin/debian/changelog
@@ -903,7 +903,7 @@ aomp (19.0-3) UNRELEASED; urgency=medium
* to be isolated from ROCm stack with the exception of rocm-dkms which
* installs the correct kernel driver.
* The following issues were resolved in this release:
- * [#601](https://github.com/ROCm-Developer-Tools/aomp/issues/601) AOMP
+ * [#601](https://github.com/ROCm/aomp/issues/601) AOMP
* 17.0.3 crashes at compile time with conjunction in if clause.
* While the source build of aomp, supports ASAN (address sanitizer), the
* release build does not due to complexities in packaging asan. Therefore,
@@ -1041,5 +1041,142 @@ aomp (19.0-3) UNRELEASED; urgency=medium
* Moved to ROCm 6.3.2 sources for non-compiler related repositories.
*
* 21.0-0
+ * In this release, the FORTRAN flang-classic compiler is replaced with the
+ * new LLVM compiler (flang-new). Flang-new is built using the LLVM 21 trunk
+ * plus changes in the amd-staging branch. In addition to improved performance
+ * flang-new, supports print and write statements in the target region to support
+ * user diagnostics. The existence of any print or write statement in the target
+ * region will trigger a service thread that could impact performance, even if
+ * the print or write statements are not executed.
+ * The hipfort component built with flang-new has returned to aomp. Hipfort
+ * provides FORTRAN module interfaces to the HIP API and to many other hip math
+ * libraries. There are new examples in the examples directory to demonstrate hipfort.
+ * Improved performance on min and max reductions using fmin and fmax functions to define the reduction.
+ * Replacement of the amd-stging hostexec infrastructure with the upstream offload rpc mechanism.
+ * A new infrastructure for executing host API's in target regions called
+ * "Emissary APIs". Emissary APIs use the offload rpc mechanism to transparently
+ * execute functions called from a target region on the host. Emissary APIs exist
+ * for print, FORTRAN runtime, MPI, and HDF5. MPI and HDF5 are currently
+ * placeholders requiring more development to make them functional. The Emissary
+ * API for print includes printf, fprintf, and asan exception reporting. The
+ * Emissary API for the FORTRAN runtime supports print, write, stop, and abort
+ * FORTRAN statements.
+ * In this release, all OpenMP toolchains (c, c++, and FORTRAN) use a tool called
+ * clang-linker-wrapper as the default. This is a single command generated for
+ * host and device linking. Previously a multi-step process was used by the LLVM
+ * command driver. This multi-step process is still available with the
+ * --opaque-offload-linker command line option. Since clang-linker-wrapper
+ * obscures the process of device linking --opaque-offload-linker can be used to
+ * see the transformations from heterogeneous objects to fully linked device and host executable.
+ * This release uses the sources from ROCM 6.3 components for non-compiler components.
+ * All llvm-project compiler components were built using the amd-staging branch with the
+ * above-mentioned commit hash.
+ * In this release, we started a process to cleanup the examples for the
+ * different programming models supported by the ROCm compiler. The new examples
+ * are 100% driven by Makefiles so that users can see the compiler commands and
+ * environment that they are run in. Since the examples are typically in a
+ * read-only installation directory. They can now be executed from an out-of-tree
+ * directory to avoid the need to copy them. For example "make -f
+ * /usr/lib/aomp/examples/openmp/reduction/Makefile run " will build and run the example.
+ * A significant number of changes to the AOMP build infrastructure were done to
+ * both add flang-new build and remove flang-classic build.
+ * Merging non-upstream changes into the amd-staging branch now uses github pull requests. We no longer
+ * use gerrit for this purpose. Merging of github PRs still requires successful passing of psdb tests.
+ * Merging from upstream trunk is still possible and preferred.
+ *
+ * 21.0-1
+ * Integrated ROCm components are built with ROCM 6.4 sources whereas in
+ * AOMP 21.0-0 they were built with ROCM 6.3
+ * The binary name for the LLVM Fortran compiler driver is flang-21 whereas in
+ * AOMP 21.0-0, it was flang-new. The symbolic link flang now links to the new binary name flang-21.
+ * The AOMP hip-libraries package now includes rocRAND, hipRAND, and half.
+ * AOMP testing has been expanded to include HeCBench
+ * MI300 xnack issues have been resolved.
+ * Updates to ROCr patch for deprecated gfx ids.
+ * Fixed Kokkos build ver v3.7.01
+ * Added smoke tests for target firstprivate
+ * Limited release build of hip-libraries to gfx90a, gfx942, gfx1103, and gfx1150.
+ * Several flang (LLVM 21) updates and fixes:
+ * Fix do-concurrent
+ * Fix reduction of a single element
+ * Fix parallel regions with live-out values
+ * Fix combined target parallel
+ * Add support for pooled memory allocator
+ * Replace cmake FLANG_INCLUDE_RUNTIME option with LLVM_ENABLE_RUNTIMES=flang-rt
+ * Device side Fortran runtime available via -lflang_rt.hostdevice (previously -lFortranRuntimeHostDevice)
+ * Add hipfort support
+ * I/O from device supported
+ * Debug supported on host, initial support provided for target routines
+ * Support bind clause on loop and teams loop
+ * Support reduction on loop directives
+ * Added support for target firstprivate for included target tasks
+ * Generate math ops for non-precise acos, acosh, asin, asinh, atan, atanh, erfc intrinsic calls
+ * Allow declare target to be used on functions external to the declare targets scope
+ * Moved the gpurun utility from the aomp-extras repository to the utils
+ * directory of aomp. Eventually we will eliminate the aomp-extras repository.
+ * Restored optimization options for build of OpenMP Device RTL.
+ * Added environment variables for controlling buffer flush, OMPX_FlushOnBufferFull and OMPX_FlushOnShutdown
+ * Replaced libomptarget.devicertl.a with target specific bitcode libraries.
+ *
+ * 22.0-1
+ *
+ * Switch to ROCm 7.0.1 sources
+ * Add BUILD_ICD to build_hipamd.sh to support OpenCL
+ * Use of aomp-shellcheck on build scripts
+ * Merge aomp-shell-format
+ * Rename aomp-shell-format to aomp-shellcheck
+ * Run aomp-shellcheck on aomp_common_vars and dependent build scripts
+ * Unit testing for shell scripts
+ * Change RCCL build from install.sh to traditional build
+ * Cleanup to remove AOMP_APPLY_ATD_AMD_STAGING_PATCH
+ * Deprecated rocprof and rocprofv2 in favor of rocprofv3 from rocprofiler-sdk
+ *
+ * flang updates:
+ *
+ * Support for complex math intrinsics in target offload regions
+ * Reduction support for do concurrent
+ * Mapping improvements
+ * Add canonical loop operations
+ * Allow cycle in target teams distribute [simd]
+ * Additional support for debug in target regions
+ * Improved alias analysis
+ * Support directive spellings introduced in OpenMP 6.0
+ * Added atomic controls options for OpenMP offload:
+ * -f[no-]atomic-remote-memory
+ * -f[no-]atomic-fine-grained-memory
+ * -f[no-]atomic-ignore-denormal-mode
+ * -f[no-]ignore-denormal-mode
+ * -m[no-]unsafe-fp-atomics (alias for -f[no-]ignore-denormal-mode)
+ * Added support for complex pow
+ * Add 6.1 as a valid OpenMP version
+ * Implement LOWER= argument for C_F_POINTER (Fortran 2023)
+ * Implement !$omp unroll using omp.unroll_heuristic
+ * For do concurrent enable delayed localization by default
+ * Fixed issue with named constants in SHARED and FIRSTPRIVATE clauses
+ * Don't privatize implicit symbols declare by nested BLOCKs
+ * Reassociate ATOMIC update expressions (currently integer type only)
+ * Parse OpenMP 6.0 map modifiers
+ * Add -fintrinsic-modules-path= alias
+ * Support -gsplit-dwarf
+ * Add support for -ffast-real-mod
+ * Implicitly map nested allocatable components in derived types
+ * do concurrent: support reduce on device
+ * do concurrent: support local on device
+ * Preserve to/from flags in mapper base entry for mappers
+ * Add new ConvertComplexPow pass for Flang
+ * Support -flto-partitions=N and -f[no]fat-lto-objects
+ * Support -gdwarf-N option
+ * Extend do concurrent mapping to device
+ * Enable tiling - supports tripcount not a multiple of tile size
+ * Fix mapping of character type with LEN > 1 specified
+ * Fix default firstprivatization miscategorization of mod file symbols
+ * Reassociate logical ATOMIC update expressions
+ * Reassociate floating-point ATOMIC update expressions (with -ffast-math)
+ * Add SPMD-No-Loop mode to OpenMP offload runtime requires setting both of the following flags:
+ * -fopenmp-assume-teams-oversubscription
+ * -fopenmp-assume-threads-oversubscription
+ * 22.0-2
+ *
+ * 22.0-3
-- Greg Rodgers Thu, 19 May 2022 23:34:44 -0500
diff --git a/bin/debian/control b/bin/debian/control
index 6c254babec..c2e02697a2 100644
--- a/bin/debian/control
+++ b/bin/debian/control
@@ -5,7 +5,7 @@ Priority: optional
Standards-Version: 3.9.5
Build-Depends: debhelper (>= 9)
Build-Depends-Indep: cli-common-dev (>= 0.8)
-Homepage: http://github.com/ROCm-Developer-Tools/aomp
+Homepage: http://github.com/ROCm/aomp
Package: aomp
Architecture: amd64
diff --git a/bin/diff_driver.sh b/bin/diff_driver.sh
index d70ef82f59..7f1d0a3f38 100755
--- a/bin/diff_driver.sh
+++ b/bin/diff_driver.sh
@@ -1,4 +1,8 @@
#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
#
# diff_driver.sh : show the diff between llvm driver code in trunk vs amd-staging
# This checks both llvm-project/clang/lib/Driver and llvm-project/clang/include/clang/Driver
diff --git a/bin/get_trunk_pr_since b/bin/get_trunk_pr_since
index 1d2b663c9d..eebb1358dd 100755
--- a/bin/get_trunk_pr_since
+++ b/bin/get_trunk_pr_since
@@ -9,22 +9,22 @@
# This script is used for OpenMP development.
# --- Start standard AOMP header ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
-. $thisdir/aomp_common_vars
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
# --- end standard AOMP header ----
repo_dir=${1:-$AOMP_REPOS/llvm-project}
date_since=${2:-lastweek}
pr_status=${3:-open}
-[ $date_since == "lastweek" ] && date_since=`date --date="last week" -I`
+[ "$date_since" == "lastweek" ] && date_since=$(date --date="last week" -I)
curdir=$PWD
tdir="/tmp/$USER/trunk_patches"
-[ -d $tdir ] && rm -rf $tdir
-mkdir -p $tdir
-cd $tdir
+[ -d "$tdir" ] && rm -rf "$tdir"
+mkdir -p "$tdir"
+cd "$tdir" || exit
REVIEW_URL="https://github.com/llvm/llvm-project/pulls?q=is%3Apr++is%3A${pr_status}+%22%5BOpenMP%5D%22+in%3Atitle+updated%3A%3E%3D${date_since}"
echo
@@ -33,50 +33,49 @@ echo "URL: $REVIEW_URL"
echo
http_filename=pull_${pr_status}_${date_since}
-wget $REVIEW_URL -O $http_filename 2>/dev/null >/dev/null
+wget "$REVIEW_URL" -O "$http_filename" 2>/dev/null >/dev/null
-cat $http_filename | grep llvm/llvm-project/pull | grep pull_request | cut -d"/" -f7- | while read line ; do
- dir=`echo $line | cut -d"\"" -f1`
- comment=`echo $line | cut -d">" -f2-`
- comment=`echo $comment | sed "s///g" | sed "s/<\/code>//g" | sed "s/<\/a>//g"`
- number=`echo $dir | cut -d"/" -f4`
+grep llvm/llvm-project/pull < "$http_filename" | grep pull_request | cut -d"/" -f7- | while read -r line ; do
+ dir=$(echo "$line" | cut -d"\"" -f1)
+ comment=$(echo "$line" | cut -d">" -f2-)
+ comment=$(echo "$comment" | sed "s///g" | sed "s/<\/code>//g" | sed "s/<\/a>//g")
+ number=$(echo "$dir" | cut -d"/" -f4)
patchurl="https://github.com/${dir}.patch"
local_file=${patchurl##*/}
- [ -f $local_file ] && rm -f $local_file
- echo wget $patchurl -O $local_file
- wget $patchurl 2>/dev/null >/dev/null
+ [ -f "$local_file" ] && rm -f "$local_file"
+ echo "wget $patchurl -O $local_file"
+ wget "$patchurl" 2>/dev/null >/dev/null
cfile=comment.${number}.txt
- echo $comment > $cfile
+ echo "$comment" > "$cfile"
done
echo
echo " DONE getting files into $tdir"
-if [ $pr_status == "merged" ] ; then
+if [ "$pr_status" == "merged" ] ; then
# Do not attempt to test merged commits
echo "The above patches are found in directory $tdir"
- cd $curdir
+ cd "$curdir" || exit
exit 0
fi
-if [ ! -d $repo_dir ] ; then
+if [ ! -d "$repo_dir" ] ; then
echo "ERROR directory $repo_dir does not exist to test patches"
echo
- cd $curdir
+ cd "$curdir" || exit
exit 1
fi
echo " Now attempting to dry-run patches to $repo_dir"
echo
-cd $repo_dir
+cd "$repo_dir" || exit
prcount=0
failcount=0
-for patchfile in `ls $tdir/*.patch` ; do
- prcount=$(( $prcount + 1 ))
- lines=`wc -l $patchfile | cut -d" " -f1`
- number=`echo $patchfile | cut -d"." -f1 | cut -d"/" -f5`
- comment=`cat $tdir/comment.${number}.txt`
- patch -p1 -t -N --dry-run <$patchfile >/dev/null
- if [ $? != 0 ] ; then
- failcount=$(( $failcount + 1 ))
+for patchfile in "$tdir"/*.patch; do
+ prcount=$(( prcount + 1 ))
+ lines=$(wc -l "$patchfile" | cut -d" " -f1)
+ number=$(echo "$patchfile" | cut -d"." -f1 | cut -d"/" -f5)
+ comment=$(cat "$tdir/comment.${number}.txt")
+ if ! patch -p1 -t -N --dry-run < "$patchfile" >/dev/null; then
+ failcount=$(( failcount + 1 ))
echo "FAIL in $patchfile with $lines lines."
echo " Title: \"$comment\" "
echo " URL: https://github.com/llvm/llvm-project/pull/$number"
@@ -99,4 +98,4 @@ echo "get_trunk_pr_since could be rerun with this command:"
echo
echo " $0 $repo_dir $date_since $pr_status"
echo
-cd $curdir
+cd "$curdir" || exit
diff --git a/bin/npsdb_bld_ompi.sh b/bin/npsdb_bld_ompi.sh
new file mode 100755
index 0000000000..89af6ce901
--- /dev/null
+++ b/bin/npsdb_bld_ompi.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+export DOMP=${DOMP:-openmpi-5.0.8}
+export WORK=${WORK:-/tmp/ompi$$}
+export COMP=$AOMP
+export INST=${INST:-/tmp/inst$$/$DOMP-flang}
+
+rm -rf $WORK
+mkdir -p $WORK
+pushd $WORK
+wget -q https://download.open-mpi.org/release/open-mpi/v5.0/$DOMP.tar.gz
+tar xf $DOMP.tar.gz
+cd $DOMP
+rm -rf build
+mkdir build
+cd build
+
+export LD_LIBRARY_PATH=$COMP/lib
+export PATH=$COMP/bin:$PATH
+../configure --prefix=$INST OMPI_CC=clang OMPI_CXX=clang++ OMPI_F90=flang CXX=clang++ CC=clang FC=flang -enable-mpi1-compatibility 2>&1 | tail
+make -j 32 2>&1 | tail
+LD_LIBRARY_PATH=$COMP/lib PATH=$COMP/bin:$PATH make -j 32 install 2>&1 | tail
+popd
+rm -rf $WORK
+echo $INST
diff --git a/bin/package.py b/bin/package.py
index 68edc86a15..af3d22b68a 100644
--- a/bin/package.py
+++ b/bin/package.py
@@ -11,11 +11,11 @@
class Aomp(MakefilePackage):
""" llvm openmp compiler from AMD"""
- homepage = "https://github.com/ROCm-Developer-Tools/aomp"
- url = "https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp-21.0-0.tar.gz"
+ homepage = "https://github.com/ROCm/aomp"
+ url = "https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp-22.0-2.tar.gz"
# Fixme: this will be adjusted when spack create is called. When copying over to your own package.py omit this line.
- version('21.0-0', sha256='7ea4e218b171585441278f3562d97779006b12bc3b5dc201901f2d757226da84')
+ version('22.0-2', sha256='7ea4e218b171585441278f3562d97779006b12bc3b5dc201901f2d757226da84')
family = 'compiler'
diff --git a/bin/package_release_tarball.sh b/bin/package_release_tarball.sh
new file mode 100755
index 0000000000..e2ac40e304
--- /dev/null
+++ b/bin/package_release_tarball.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# package_release_tarball.sh: Build the tarball for aomp release
+#
+# --- Start standard header to set AOMP environment variables ----
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/aomp_common_vars"
+# --- end standard header ----
+
+pkgname=aomp
+echo "Building $pkgname package"
+
+dirname="aomp_${AOMP_VERSION_STRING}"
+sourcedir="/usr/lib/$dirname"
+installdir="/usr/lib/$dirname"
+
+tmpdir="/tmp/build-tar"
+builddir="$tmpdir/$pkgname"
+froot="$builddir/$pkgname-$AOMP_VERSION"
+
+if [ -d "$builddir" ] ; then
+ echo
+ echo "--- CLEANUP LAST BUILD: rm -rf $builddir"
+ rm -rf "$builddir"
+fi
+
+mkdir -p "$froot$installdir"
+rsync -a "$sourcedir/" --exclude ".*" "$froot$installdir"
+
+cd "$froot$installdir/../" || exit
+tarball="$AOMP_REPOS/../aomp-${AOMP_VERSION_STRING}.tar.gz"
+tar -czf $tarball $dirname
diff --git a/bin/patches/UMT-5-9-0-amdflang-mods.patch b/bin/patches/UMT-5-9-0-amdflang-mods.patch
new file mode 100644
index 0000000000..ba9ee286f6
--- /dev/null
+++ b/bin/patches/UMT-5-9-0-amdflang-mods.patch
@@ -0,0 +1,470 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index b348b26..ff000f1 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -19,7 +19,7 @@ set(TETON_VERSION_PATCH 0)
+ include (cmake/Version.cmake)
+
+ # The CUDA Boltzmann Compton solver source file requires C++11. Conduit requires C++14.
+-set(CMAKE_CXX_STANDARD 14)
++set(CMAKE_CXX_STANDARD 17)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+ set(CMAKE_CUDA_STANDARD 14)
+ set(CMAKE_CUDA_STANDARD_REQUIRED ON)
+@@ -104,7 +104,14 @@ if(ENABLE_OPENMP)
+ message( STATUS "OPENMP - Platform has unified memory, skip OpenMP host<->device maps and updates" )
+ add_compile_definitions( "TETON_OPENMP_HAS_UNIFIED_MEMORY" )
+ endif()
+-
++
++ # ideally this would be runtime nad not require a recompile, but the
++ # presence of the omp_wrapper.h macros prevents this unfortunately
++ if ($ENV{HSA_XNACK})
++ add_compile_definitions(HSA_XNACK=$ENV{HSA_XNACK})
++ else()
++ add_compile_definitions(HSA_XNACK=0)
++ endif()
+ endif()
+
+ find_package(OpenMP REQUIRED COMPONENTS Fortran CXX)
+@@ -201,7 +208,31 @@ if(ENABLE_OPENMP)
+
+ target_link_options( OpenMP::OpenMP_Fortran INTERFACE $<$:--rocm-path=${HIP_ROOT_DIR} -target-accel=amd_${CMAKE_HIP_ARCHITECTURES}>)
+ target_compile_options( OpenMP::OpenMP_Fortran INTERFACE $<$:--rocm-path=${HIP_ROOT_DIR} -target-accel=amd_${CMAKE_HIP_ARCHITECTURES}>)
+- target_link_libraries( OpenMP::OpenMP_Fortran INTERFACE hip::amdhip64)
++ target_link_libraries( OpenMP::OpenMP_Fortran INTERFACE hip::device)
++ target_include_directories( OpenMP::OpenMP_Fortran INTERFACE ${HIP_ROOT_DIR}/include)
++
++ elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "LLVMFlang")
++
++ message( STATUS "Detected Flang Fortran OpenMP offload support requested. Adding additional flags to pull in HIP backend needed by Cray Fortran compiler.")
++
++ if (DEFINED CMAKE_HIP_ARCHITECTURES)
++ message( STATUS "Setting target gpu architecture to ${CMAKE_HIP_ARCHITECTURES}")
++ else()
++ message( FATAL_ERROR " Must set CMAKE_HIP_ARCHITECTURES when using LLVM Flang compiler openmp offload functionality.")
++ endif()
++
++ if (DEFINED CMAKE_FORTRAN_OFFLOAD_LIB)
++ message( STATUS "Setting Fortran GPU offload library to ${CMAKE_FORTRAN_OFFLOAD_LIB}")
++ else()
++ message( FATAL_ERROR " Must set CMAKE_FORTRAN_OFFLOAD_LIB when using LLVM Flang compiler openmp offload functionality.")
++ endif()
++
++ find_package(hip REQUIRED)
++ add_compile_definitions( "TETON_ENABLE_HIP" )
++
++ target_link_options( OpenMP::OpenMP_Fortran INTERFACE $<$:--offload-arch=${CMAKE_HIP_ARCHITECTURES}>)
++ target_compile_options( OpenMP::OpenMP_Fortran INTERFACE $<$:--offload-arch=${CMAKE_HIP_ARCHITECTURES}>)
++ target_link_libraries( OpenMP::OpenMP_Fortran INTERFACE hip::device)
+ target_include_directories( OpenMP::OpenMP_Fortran INTERFACE ${HIP_ROOT_DIR}/include)
+
+ endif()
+diff --git a/src/cmake/GetGPUInfo.cmake b/src/cmake/GetGPUInfo.cmake
+index 2a337a9..b15ced1 100644
+--- a/src/cmake/GetGPUInfo.cmake
++++ b/src/cmake/GetGPUInfo.cmake
+@@ -14,28 +14,52 @@ if (ENABLE_OPENMP_OFFLOAD)
+ message(STATUS "Checking for GPU...")
+ if (CMAKE_CUDA_ARCHITECTURES STREQUAL 70)
+ message(STATUS "-- Detected NVIDIA Volta, setting device num processors to 80")
++ set(OMP_DEVICE_NUM_PROCESSORS 80)
++ add_compile_definitions(OMP_DEVICE_NUM_PROCESSORS=80)
+ set(GSET_MIN_SIZE 16)
+ set(MAX_NUM_SWEEP_HYPER_DOMAINS 1)
+ set(MAX_NUM_GTA_HYPER_DOMAINS 80)
+ set(OMP_DEVICE_TEAM_THREAD_LIMIT 1024)
+-
++ set(IS_AMDGPU FALSE)
++ add_compile_definitions(IS_AMDGPU=0)
++ set(OPENMP_UNIFIED_MEMORY FALSE)
++ elseif (CMAKE_HIP_ARCHITECTURES STREQUAL gfx1100)
++# AMD RX7900XT* - 96 CUs
++message(STATUS "-- Detected AMD RX7900XT*, setting device num processors to 96")
++ set(OMP_DEVICE_NUM_PROCESSORS 96)
++ add_compile_definitions(OMP_DEVICE_NUM_PROCESSORS=96)
++ set(GSET_MIN_SIZE 16)
++ set(MAX_NUM_SWEEP_HYPER_DOMAINS 1)
++ set(MAX_NUM_GTA_HYPER_DOMAINS 96)
++ set(OMP_DEVICE_TEAM_THREAD_LIMIT 512)
++ set(IS_AMDGPU TRUE)
++ add_compile_definitions(IS_AMDGPU=1)
++ set(OPENMP_UNIFIED_MEMORY FALSE)
+ elseif (CMAKE_HIP_ARCHITECTURES STREQUAL gfx90a)
+ # AMD MI250X - 110 CUs
+ message(STATUS "-- Detected AMD MI250, setting device num processors to 110")
++ set(OMP_DEVICE_NUM_PROCESSORS 110)
++ add_compile_definitions(OMP_DEVICE_NUM_PROCESSORS=110)
+ set(GSET_MIN_SIZE 16)
+ set(MAX_NUM_SWEEP_HYPER_DOMAINS 1)
+ set(MAX_NUM_GTA_HYPER_DOMAINS 110)
+- set(OMP_DEVICE_TEAM_THREAD_LIMIT 1024)
+-
++ set(OMP_DEVICE_TEAM_THREAD_LIMIT 512)
++ set(IS_AMDGPU TRUE)
++ add_compile_definitions(IS_AMDGPU=1)
++ set(OPENMP_UNIFIED_MEMORY TRUE)
+ # AMD MI300 - 228 CUs
+ elseif (CMAKE_HIP_ARCHITECTURES STREQUAL gfx942)
+ message(STATUS "-- Detected AMD MI300, setting device num processors to 228")
++ set(OMP_DEVICE_NUM_PROCESSORS 228)
++ add_compile_definitions(OMP_DEVICE_NUM_PROCESSORS=228)
+ set(OPENMP_UNIFIED_MEMORY TRUE)
+ set(GSET_MIN_SIZE 4)
+ set(MAX_NUM_SWEEP_HYPER_DOMAINS 1)
++ set(MAX_NUM_HYPER_DOMAINS 40)
+ set(MAX_NUM_GTA_HYPER_DOMAINS 228)
+- set(OMP_DEVICE_TEAM_THREAD_LIMIT 1024)
+-
++ set(IS_AMDGPU TRUE)
++ add_compile_definitions(IS_AMDGPU=1)
++ set(OMP_DEVICE_TEAM_THREAD_LIMIT 512)
+ else()
+ message(ERROR "-- Unrecogized or unset value for CUDA or HIP architecture.")
+ endif()
+@@ -43,11 +67,16 @@ if (ENABLE_OPENMP_OFFLOAD)
+ else()
+ message(STATUS "-- No GPU detected.")
+ # These are only used if running the GPU kernels on the CPU for testing purposes.
++ set(OMP_DEVICE_NUM_PROCESSORS 1)
++ add_compile_definitions(OMP_DEVICE_NUM_PROCESSORS=1)
+ set(OMP_DEVICE_TEAM_THREAD_LIMIT 1)
+ set(GSET_MIN_SIZE 1)
+ set(MAX_NUM_SWEEP_HYPER_DOMAINS 1)
+ set(MAX_NUM_GTA_HYPER_DOMAINS 1)
+ set(OMP_DEVICE_TEAM_THREAD_LIMIT 1)
++ set(IS_AMDGPU FALSE)
++ add_compile_definitions(IS_AMDGPU=0)
++ set(OPENMP_UNIFIED_MEMORY FALSE)
+ endif()
+
+ mark_as_advanced(OMP_DEVICE_NUM_PROCESSORS OMP_DEVICE_TEAM_THREAD_LIMIT)
+diff --git a/src/teton/CMakeLists.txt b/src/teton/CMakeLists.txt
+index 805e3e5..940776a 100644
+--- a/src/teton/CMakeLists.txt
++++ b/src/teton/CMakeLists.txt
+@@ -234,8 +234,10 @@ if(ENABLE_TESTS)
+ ${CONDUIT_INCLUDE_DIR}/conduit
+ )
+
++if ( ENABLE_OPENMP AND CMAKE_Fortran_COMPILER_ID STREQUAL LLVMFlang)
+ target_link_libraries( test_driver PUBLIC
+- teton
++ $
++ -Wl,--no-nvptx-whole-archive
+ ${CONDUIT_LIBRARIES}
+ ${CONDUITRELAY_LIBRARIES}
+ ${CONDUITBLUEPRINT_LIBRARIES}
+@@ -243,9 +245,25 @@ if(ENABLE_TESTS)
+ ${CONDUITRELAYMPI_LIBRARIES}
+ ${CONDUITRELAYMPIIO_LIBRARIES}
+ )
++else()
++ target_link_libraries( test_driver PUBLIC
++ teton
++ ${CONDUIT_LIBRARIES}
++ ${CONDUITRELAY_LIBRARIES}
++ ${CONDUITBLUEPRINT_LIBRARIES}
++ ${CONDUITBLUEPRINTMPI_LIBRARIES}
++ ${CONDUITRELAYMPI_LIBRARIES}
++ ${CONDUITRELAYMPIIO_LIBRARIES}
++ )
++endif()
+
+ if( ENABLE_OPENMP )
+- target_link_libraries( test_driver PUBLIC OpenMP::OpenMP_Fortran)
++ if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "LLVMFlang")
++ target_link_libraries( test_driver PUBLIC OpenMP::OpenMP_Fortran
++ ${CMAKE_FORTRAN_OFFLOAD_LIB})
++ else()
++ target_link_libraries( test_driver PUBLIC OpenMP::OpenMP_Fortran)
++ endif()
+
+ # The target_link_options command has trouble with adding flags if there is
+ # a space, it keeps putting quotes around the whole line. Use the older
+@@ -280,7 +298,7 @@ if(ENABLE_TESTS)
+ if (ENABLE_UMPIRE)
+ target_include_directories( test_driver PUBLIC ${UMPIRE_INCLUDE_DIR}
+ ${UMPIRE_FORTRAN_MODULES_DIR})
+- target_link_libraries( test_driver PUBLIC ${UMPIRE_LIBRARIES})
++ target_link_libraries( test_driver PUBLIC ${UMPIRE_LIBRARIES} rt)
+
+ if (FMT_ROOT)
+ target_include_directories( test_driver PUBLIC ${FMT_INCLUDE_DIR})
+diff --git a/src/teton/driver/test_driver.cc b/src/teton/driver/test_driver.cc
+index 68e96c9..b736171 100644
+--- a/src/teton/driver/test_driver.cc
++++ b/src/teton/driver/test_driver.cc
+@@ -650,7 +650,10 @@ int TetonDriver::execute()
+ << std::endl;
+ }
+ options["iteration/incidentFluxMaxIt"] = 99;
+- options["iteration/outerMaxIt"] = 1;
++ // A default of 1 outerMaxIt for LLVM Flang AMDGPU doesn't work, it
++ // currently requiress more outer iterations to converge. So set to 50
++ // which was the default in v5.5.0.
++ options["iteration/outerMaxIt"] = 50;
+ #endif
+ if (cycles == 0 && goalTime <= 0.0)
+ {
+@@ -663,6 +666,16 @@ int TetonDriver::execute()
+ numAzimuthalUser = 3;
+ if (numGroupsUser <= 0)
+ numGroupsUser = 128;
++ // Setting any of the above to be equivelant to benchmark problem 2
++ // works for mi300, but having them as the current default doesn't
++ // allow the correct group partitioning (perfectly even, and UMT
++ // doesn't support uneven group partitions at the moment), for the
++ // moment I've selected 32 as numGroupUser to be a little different
++ // to benchmark problem 2 while still allowing even group paritions
++ // with no remainder work. However, the original LLNL authors will
++ // know best what the appropriate thing to do here is.
++ if (OMP_DEVICE_NUM_PROCESSORS == 228) // MI300 processor count
++ numGroupsUser = 32;
+ }
+ else if (benchmarkProblem == 2)
+ {
+@@ -1187,14 +1200,16 @@ void TetonDriver::setOptions()
+ }
+ else if (useUmpire == 3)
+ {
+-#if !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY)
+- if (myRank == 0)
+- {
+- std::cerr
+- << "Teton driver: Detected user selection of single Umpire device memory pool. This is only supported on single memory architecture platforms."
+- << std::endl;
+- }
+- exit(1);
++#if !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) || \
++ defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) && defined(IS_AMDGPU) && \
++ HSA_XNACK == 0
++ if (myRank == 0) {
++ std::cerr << "Teton driver: Detected user selection of single "
++ "Umpire device memory pool. This is only supported "
++ "on single memory architecture platforms."
++ << std::endl;
++ }
++ exit(1);
+ #endif
+ if (myRank == 0)
+ {
+diff --git a/src/teton/gpu/CornerSweepUCBrz_OMPOL.F90 b/src/teton/gpu/CornerSweepUCBrz_OMPOL.F90
+index d132b25..0765c66 100644
+--- a/src/teton/gpu/CornerSweepUCBrz_OMPOL.F90
++++ b/src/teton/gpu/CornerSweepUCBrz_OMPOL.F90
+@@ -144,7 +144,7 @@
+
+ TOMP(target teams distribute num_teams(nZoneSets) thread_limit(omp_device_team_thread_limit) default(none) &)
+ TOMPC(shared(nZoneSets, nAngleSets,Geom, angleList, Quad)&)
+- TOMPC(private(ASet, angle))
++ TOMPC(private(ASet, angle, setID))
+
+ ZoneSetLoop0: do zSetID=1,nZoneSets
+
+@@ -176,7 +176,7 @@
+
+ TOMP(target teams distribute num_teams(nZoneSets) thread_limit(omp_device_team_thread_limit) default(none)&)
+ TOMPC(shared(nZoneSets, nAngleSets, Geom, angleList, Quad)&)
+- TOMPC(private(ASet, angle, fac, R_afp, R_afp2, R, R2))
++ TOMPC(private(ASet, angle, fac, R_afp, R_afp2, R, R2, setID))
+
+ ZoneSetLoop1: do zSetID=1,nZoneSets
+
+diff --git a/src/teton/gpu/SetSweep_OMPOL.F90 b/src/teton/gpu/SetSweep_OMPOL.F90
+index bed14e4..0bad379 100644
+--- a/src/teton/gpu/SetSweep_OMPOL.F90
++++ b/src/teton/gpu/SetSweep_OMPOL.F90
+@@ -97,7 +97,7 @@
+ ! If the CUDA solver is used the source needs to be mapped to the GPU
+
+ #if !defined(TETON_ENABLE_MINIAPP_BUILD)
+-#if !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY)
++#if !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) || defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) && defined(IS_AMDGPU) && HSA_XNACK == 0
+ if ( useBoltzmannCompton .and. Size% useCUDASolver .and. Size% ngr >= 16) then
+ START_RANGE("Teton_OpenMP_data_movement")
+ do setID=1,nGroupSets
+@@ -184,7 +184,7 @@
+
+ ! Map the latest boundary values
+
+-#if !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY)
++#if !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) || defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) && defined(IS_AMDGPU) && HSA_XNACK == 0
+ START_RANGE("Teton_OpenMP_data_movement")
+ TOMP_UPDATE(target update to( Set%PsiB(:,:,Angle) ) )
+ END_RANGE("Teton_OpenMP_data_movement")
+@@ -239,7 +239,7 @@
+ Set => getSetData(Quad, setID)
+ Angle = Set% AngleOrder(sendIndex)
+
+-#if !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY)
++#if !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) || defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) && defined(IS_AMDGPU) && HSA_XNACK == 0
+ START_RANGE("Teton_OpenMP_Updates")
+ TOMP_UPDATE(target update from( Set%PsiB(:,:,Angle) ))
+ END_RANGE("Teton_OpenMP_Updates")
+diff --git a/src/teton/gpu/SweepGreyUCBrz_OMPOL.F90 b/src/teton/gpu/SweepGreyUCBrz_OMPOL.F90
+index 3548de8..0927dea 100644
+--- a/src/teton/gpu/SweepGreyUCBrz_OMPOL.F90
++++ b/src/teton/gpu/SweepGreyUCBrz_OMPOL.F90
+@@ -145,7 +145,7 @@
+
+ TOMP(target teams distribute num_teams(nZoneSets) thread_limit(omp_device_team_thread_limit) default(none) &)
+ TOMPC(shared(nZoneSets,nGTASets,Geom,nSets,Quad )&)
+- TOMPC(private(Set))
++ TOMPC(private(Set, SetID))
+
+ ZoneSetLoop0: do zSetID=1,nZoneSets
+
+@@ -411,7 +411,7 @@
+
+ TOMP(target teams distribute num_teams(nZoneSets) thread_limit(omp_device_team_thread_limit) default(none)&)
+ TOMPC(shared(nZoneSets, nGTASets, Geom, GTA, Quad, angleList, nSets)&)
+- TOMPC(private(Set, ASet, angle, angle0, quadwt, quadTauW1, quadTauW2))
++ TOMPC(private(Set, ASet, angle, angle0, quadwt, quadTauW1, quadTauW2, setID))
+
+ ZoneSetLoop2: do zSetID=1,nZoneSets
+ do setID=1,nGTASets
+diff --git a/src/teton/gpu/SweepGreyUCBxyz_OMPOL.F90 b/src/teton/gpu/SweepGreyUCBxyz_OMPOL.F90
+index 44e9098..ae35ab9 100644
+--- a/src/teton/gpu/SweepGreyUCBxyz_OMPOL.F90
++++ b/src/teton/gpu/SweepGreyUCBxyz_OMPOL.F90
+@@ -572,7 +572,7 @@
+
+ TOMP(target teams distribute num_teams(nZoneSets) thread_limit(omp_device_team_thread_limit) default(none) &)
+ TOMPC(shared(nZoneSets, nGTASets, nSets, GTA, angleList, Quad, Geom)&)
+- TOMPC(private(Set, ASet, angle, quadwt))
++ TOMPC(private(Set, ASet, angle, quadwt, setID))
+
+ ZoneSetLoop3: do zSetID=1,nZoneSets
+
+diff --git a/src/teton/gpu/SweepUCBrz_OMPOL.F90 b/src/teton/gpu/SweepUCBrz_OMPOL.F90
+index bcfbbdb..1f540b2 100644
+--- a/src/teton/gpu/SweepUCBrz_OMPOL.F90
++++ b/src/teton/gpu/SweepUCBrz_OMPOL.F90
+@@ -139,7 +139,7 @@
+
+ TOMP(target teams distribute num_teams(nZoneSets) thread_limit(omp_device_team_thread_limit) default(none) &)
+ TOMPC(shared(nZoneSets, nAngleSets,Geom, angleList, Quad)&)
+- TOMPC(private(ASet, angle))
++ TOMPC(private(ASet, angle, setID))
+
+ ZoneSetLoop: do zSetID=1,nZoneSets
+
+@@ -171,7 +171,7 @@
+
+ TOMP(target teams distribute num_teams(nZoneSets) thread_limit(omp_device_team_thread_limit) default(none)&)
+ TOMPC(shared(nZoneSets, nAngleSets, Geom, angleList, Quad)&)
+- TOMPC(private(ASet, angle, fac, R_afp, R_afp2, R, R2))
++ TOMPC(private(ASet, angle, fac, R_afp, R_afp2, R, R2, setID))
+
+ ZoneSetLoop1: do zSetID=1,nZoneSets
+
+@@ -254,7 +254,6 @@
+
+
+ if ( nHyperDomains > 1 ) then
+-
+ TOMP(target teams distribute collapse(2) num_teams(nZoneSets*nSets) &)
+ TOMPC(thread_limit(omp_device_team_thread_limit) default(none) &)
+ TOMPC(shared(sendIndex, Quad, nZoneSets, nSets) &)
+diff --git a/src/teton/gpu/SweepUCBxyz_OMPOL.F90 b/src/teton/gpu/SweepUCBxyz_OMPOL.F90
+index 350ffcc..9c9c0dc 100644
+--- a/src/teton/gpu/SweepUCBxyz_OMPOL.F90
++++ b/src/teton/gpu/SweepUCBxyz_OMPOL.F90
+@@ -138,7 +138,7 @@
+ TOMP_MAP(target enter data map(to: tau, sendIndex, angleList))
+
+ TOMP(target teams distribute num_teams(nZoneSets) thread_limit(omp_device_team_thread_limit) default(none) &)
+- TOMPC(private(ASet, angle) &)
++ TOMPC(private(ASet, angle, setID) &)
+ TOMPC(shared(nZoneSets, angleList, Quad, Geom, nAngleSets) )
+
+ ZoneSetLoop0: do zSetID=1,nZoneSets
+@@ -186,7 +186,7 @@
+
+ TOMP(target teams distribute num_teams(nZoneSets) thread_limit(omp_device_team_thread_limit) default(none) &)
+ TOMPC(shared(nZoneSets, nAngleSets, Quad, Geom) &)
+- TOMPC(private(ASet))
++ TOMPC(private(ASet, setID))
+
+ ZoneSetLoop1: do zSetID=1,nZoneSets
+
+diff --git a/src/teton/include/omp_wrappers.h b/src/teton/include/omp_wrappers.h
+index 519bc26..07b86d5 100644
+--- a/src/teton/include/omp_wrappers.h
++++ b/src/teton/include/omp_wrappers.h
+@@ -19,7 +19,10 @@
+ #endif
+
+ ! Enable openmp data map and update pragmas, if openmp offloading enabled and not using unified cpu and gpu memory.
+-#if defined(TETON_ENABLE_OPENMP_OFFLOAD) && !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY)
++#if defined(TETON_ENABLE_OPENMP_OFFLOAD) && \
++ !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) || \
++ defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) && defined(IS_AMDGPU) && \
++ HSA_XNACK == 0
+ # define TOMP_MAP(source) !$omp source
+ # define TOMP_UPDATE(source) !$omp source
+ #else
+@@ -28,7 +31,10 @@
+ #endif
+
+ ! Enable Umpire integration for host and device pools, if openmp offloading enabled and not using unified cpu and gpu memory.
+-#if defined(TETON_ENABLE_UMPIRE) && defined(TETON_ENABLE_OPENMP_OFFLOAD) && !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY)
++#if defined(TETON_ENABLE_UMPIRE) && defined(TETON_ENABLE_OPENMP_OFFLOAD) && \
++ !defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) || \
++ defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) && defined(IS_AMDGPU) && \
++ HSA_XNACK == 0
+ # define UMPIRE_DEVICE_POOL_ALLOC(source) call target_alloc_and_pair_ptrs(source)
+ # define UMPIRE_DEVICE_POOL_FREE(source) call target_free_and_unpair_ptrs(source)
+ #else
+diff --git a/src/teton/mods/Datastore_mod.F90 b/src/teton/mods/Datastore_mod.F90
+index b530955..64abf0a 100644
+--- a/src/teton/mods/Datastore_mod.F90
++++ b/src/teton/mods/Datastore_mod.F90
+@@ -146,7 +146,7 @@ contains
+ endif
+ endif
+ ! Get the value from the environment
+- call getenv("TETON_PARTITION", str)
++ call get_environment_variable("TETON_PARTITION", str)
+ if (str .ne. " ") then
+ value = 0
+ read (str,*) value
+diff --git a/src/teton/mods/MemoryAllocator_mod.F90 b/src/teton/mods/MemoryAllocator_mod.F90
+index 1931b4b..90765ca 100644
+--- a/src/teton/mods/MemoryAllocator_mod.F90
++++ b/src/teton/mods/MemoryAllocator_mod.F90
+@@ -82,7 +82,7 @@ contains
+ endif
+
+ if (umpire_device_allocator_id >= 0) then
+-#if defined(TETON_OPENMP_HAS_UNIFIED_MEMORY)
++#if defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) || defined(TETON_OPENMP_HAS_UNIFIED_MEMORY) && defined(IS_AMDGPU) && HSA_XNACK == 1
+ if (Options%isRankVerbose() > 0 ) then
+ print *, "Teton: An umpire host allocator and device allocator were both provided. Teton only requires one allocator on single memory architecture platforms. The device allocator will be used."
+ endif
+diff --git a/src/teton/mods/cmake_defines_mod.F90.in b/src/teton/mods/cmake_defines_mod.F90.in
+index fd6db7c..138f8bc 100644
+--- a/src/teton/mods/cmake_defines_mod.F90.in
++++ b/src/teton/mods/cmake_defines_mod.F90.in
+@@ -15,5 +15,6 @@ implicit none
+ integer, parameter :: min_groupset_size = @GSET_MIN_SIZE@
+ integer, parameter :: max_num_sweep_hyperdomains = @MAX_NUM_SWEEP_HYPER_DOMAINS@
+ integer, parameter :: max_num_gta_hyperdomains = @MAX_NUM_GTA_HYPER_DOMAINS@
+-
++ logical, parameter :: omp_unified_memory = .@OPENMP_UNIFIED_MEMORY@.
++ logical, parameter :: omp_is_amdgpu = .@IS_AMDGPU@.
+ end module cmake_defines_mod
+diff --git a/src/teton/rt/addGreyCorrections_OMPOL.F90 b/src/teton/rt/addGreyCorrections_OMPOL.F90
+index 4592199..a13d3aa 100644
+--- a/src/teton/rt/addGreyCorrections_OMPOL.F90
++++ b/src/teton/rt/addGreyCorrections_OMPOL.F90
+@@ -142,7 +142,7 @@
+ TOMP(target teams distribute collapse(2) num_teams(nZoneSets*nSets) &)
+ TOMPC(thread_limit(omp_device_team_thread_limit) default(none) &)
+ TOMPC(shared(nZoneSets, nSets, Quad, GTA, wtiso)&)
+- TOMPC(private(Set, ASet, HypPlanePtr, Groups, NumAngles, c, g0))
++ TOMPC(private(Set, ASet, HypPlanePtr, Groups, NumAngles, c, g0, angle))
+
+ ZoneSetLoop1: do zSetID=1,nZoneSets
+ SetLoop1: do setID=1,nSets
diff --git a/bin/patches/clr-amd-comgr-find-package.patch b/bin/patches/clr-amd-comgr-find-package.patch
new file mode 100644
index 0000000000..b369e2ac7c
--- /dev/null
+++ b/bin/patches/clr-amd-comgr-find-package.patch
@@ -0,0 +1,12 @@
+diff --git a/rocclr/cmake/ROCclrLC.cmake b/rocclr/cmake/ROCclrLC.cmake
+index d8ecf4a..f41d605 100644
+--- a/rocclr/cmake/ROCclrLC.cmake
++++ b/rocclr/cmake/ROCclrLC.cmake
+@@ -20,7 +20,6 @@
+
+ find_package(amd_comgr 2.9 CONFIG
+ PATHS
+- /opt/rocm/
+ ${ROCM_INSTALL_PATH}
+ PATH_SUFFIXES
+ cmake/amd_comgr
diff --git a/bin/patches/clr-findamd-icd.patch b/bin/patches/clr-findamd-icd.patch
new file mode 100644
index 0000000000..7a80f8b2a1
--- /dev/null
+++ b/bin/patches/clr-findamd-icd.patch
@@ -0,0 +1,26 @@
+diff --git a/opencl/tools/clinfo/CMakeLists.txt b/opencl/tools/clinfo/CMakeLists.txt
+index 0af9f1eab..b2bcb7904 100644
+--- a/opencl/tools/clinfo/CMakeLists.txt
++++ b/opencl/tools/clinfo/CMakeLists.txt
+@@ -3,13 +3,18 @@ add_executable(clinfo clinfo.cpp)
+ target_compile_definitions(clinfo PRIVATE CL_TARGET_OPENCL_VERSION=220 HAVE_CL2_HPP)
+
+ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake")
+-find_package(AMD_ICD)
+
+ #todo: to be updated to use header files from other repos
+ target_include_directories(clinfo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../khronos/headers/opencl2.2")
+
+-find_library(AMD_ICD_LIBRARY OpenCL HINTS "${AMD_ICD_LIBRARY_DIR}")
+-target_link_libraries(clinfo PRIVATE ${AMD_ICD_LIBRARY})
++if(BUILD_ICD)
++ add_dependencies(clinfo OpenCL)
++ target_link_libraries(clinfo PRIVATE OpenCL)
++else()
++ find_package(AMD_ICD)
++ find_library(AMD_ICD_LIBRARY OpenCL HINTS "${AMD_ICD_LIBRARY_DIR}")
++ target_link_libraries(clinfo PRIVATE ${AMD_ICD_LIBRARY})
++endif()
+
+ INSTALL(TARGETS clinfo
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/bin/patches/genasis.patch b/bin/patches/genasis.patch
index c5f1beac88..c688df9657 100644
--- a/bin/patches/genasis.patch
+++ b/bin/patches/genasis.patch
@@ -66,133 +66,73 @@ index e2f7ae74..0ea9ace6 100644
end subroutine CopyBigInteger_1D
-diff --git a/Modules/Basics/Devices/DeviceAddress_Function.f90 b/Modules/Basics/Devices/DeviceAddress_Function.f90
-index 5ceafe62..a4c7d39f 100644
---- a/Modules/Basics/Devices/DeviceAddress_Function.f90
-+++ b/Modules/Basics/Devices/DeviceAddress_Function.f90
-@@ -27,7 +27,6 @@ contains
+diff --git a/Modules/Basics/Display/CONSOLE_Singleton.f90 b/Modules/Basics/Display/CONSOLE_Singleton.f90
+index 2f8cd18a..aa5b4ac0 100644
+--- a/Modules/Basics/Display/CONSOLE_Singleton.f90
++++ b/Modules/Basics/Display/CONSOLE_Singleton.f90
+@@ -18,7 +18,7 @@ module CONSOLE_Singleton
+ logical ( KDL ) :: &
+ Muted = .false.
+ procedure ( AbortInterface ), nopass, pointer :: &
+- Abort => null ( )
++ Abort
+ contains
+ procedure, public, nopass :: &
+ Initialize
+@@ -180,7 +180,7 @@ contains
+ end subroutine Unmute
+
- type ( c_ptr ) :: &
- DA
--
- if ( OnDevice ( Value ) ) then
- #ifdef ENABLE_OMP_OFFLOAD
- !$OMP target data use_device_ptr ( Value )
-diff --git a/Modules/Basics/Devices/Device_C_OMP.f90 b/Modules/Basics/Devices/Device_C_OMP.f90
-index 3e3fa4fb..57a2a8b9 100644
---- a/Modules/Basics/Devices/Device_C_OMP.f90
-+++ b/Modules/Basics/Devices/Device_C_OMP.f90
-@@ -25,7 +25,7 @@ module Device_C
- interface
-
- integer ( c_int ) function SetDevice ( iDevice ) &
-- bind ( c, name = 'SetDevice' )
-+ bind ( c, name = 'SetDevice_OMP' )
- use iso_c_binding
- implicit none
- integer ( c_int ), value :: &
-@@ -34,7 +34,7 @@ module Device_C
-
+- elemental subroutine Finalize ( C )
++ impure elemental subroutine Finalize ( C )
- integer ( c_int ) function GetDevice ( iDevice ) &
-- bind ( c, name = 'GetDevice' )
-+ bind ( c, name = 'GetDevice_OMP' )
- use iso_c_binding
- implicit none
- integer ( c_int ) :: &
-@@ -119,7 +119,7 @@ module Device_C
-
-
- type ( c_ptr ) function AllocateHostDouble ( nValues ) &
-- bind ( c, name = 'AllocateHostDouble_Device' )
-+ bind ( c, name = 'AllocateHostDouble_Device_OMP' )
- use iso_c_binding
- implicit none
- integer ( c_int ), value :: &
-@@ -127,7 +127,7 @@ module Device_C
- end function AllocateHostDouble
-
-
-- subroutine FreeHost ( Host ) bind ( c, name = 'FreeHost_Device' )
-+ subroutine FreeHost ( Host ) bind ( c, name = 'FreeHost_Device_OMP' )
- use iso_c_binding
- implicit none
- type ( c_ptr ), value :: &
-@@ -176,7 +176,7 @@ module Device_C
-
-
- integer ( c_int ) function DeviceMemGetInfo ( Free, Total ) &
-- bind ( c, name = 'DeviceMemGetInfo_Device' )
-+ bind ( c, name = 'DeviceMemGetInfo_Device_OMP' )
- use iso_c_binding
- implicit none
- integer ( c_size_t ) :: &
+ type ( ConsoleSingleton ), intent ( inout ) :: &
+ C
+diff --git a/Programs/Examples/Basics/FluidDynamics/PlaneWaveAdvection_Template.f90 b/Programs/Examples/Basics/FluidDynamics/PlaneWaveAdvection_Template.f90
+index a2d813c..335e77b 100644
+--- a/Programs/Examples/Basics/FluidDynamics/PlaneWaveAdvection_Template.f90
++++ b/Programs/Examples/Basics/FluidDynamics/PlaneWaveAdvection_Template.f90
+@@ -104,8 +104,14 @@ contains
+ VZ = K ( 3 ) / ( dot_product ( K, K ) * Period )
+
+ end associate !-- K
+
++#ifdef ENABLE_OMP_OFFLOAD
++ call PF % UpdateDevice ( )
++#endif
+ call PF % ComputeAuxiliary ( PF % Value )
+ call PF % ComputeConserved ( PF % Value )
++#ifdef ENABLE_OMP_OFFLOAD
++ call PF % UpdateHost ( )
++#endif
+
+ !-- FIXME: Implicit do-loop array needed to workaround Cray compiler
+ ! crashes for elemental function argument of array and scalar
+diff --git a/Modules/Basics/Devices/Device_HIP.c b/Modules/Basics/Devices/Device_HIP.c
+index cd2c80a4..1aaed77d 100644
+--- a/Modules/Basics/Devices/Device_HIP.c
++++ b/Modules/Basics/Devices/Device_HIP.c
+@@ -1,3 +1,4 @@
++#ifndef USE_OPENMP_RUNTIME
+ #include
+ #include
+
+@@ -86,3 +87,4 @@ int DeviceMemGetInfo_Device ( size_t * Free, size_t * Total )
+ return -1;
+ #endif
+ }
++#endif
diff --git a/Modules/Basics/Devices/Device_OMP.c b/Modules/Basics/Devices/Device_OMP.c
-index abccbb8d..810753de 100644
+index abccbb8d..0aca89fb 100644
--- a/Modules/Basics/Devices/Device_OMP.c
+++ b/Modules/Basics/Devices/Device_OMP.c
-@@ -3,6 +3,13 @@
- #include
- #include
-
-+#ifdef USE_LLVM_RUNTIME
-+void llvm_omp_target_free_host(void *DevicePtr, int DeviceNum);
-+void llvm_omp_target_free_device(void *DevicePtr, int DeviceNum);
-+void *llvm_omp_target_alloc_host(size_t Size, int DeviceNum);
-+void *llvm_omp_target_alloc_device(size_t Size, int DeviceNum);
-+#endif
-+
- int OnTarget_OMP ( void * Host )
- {
- int iDevice;
-@@ -28,9 +35,13 @@ void * AllocateTargetInteger_OMP ( int nValues )
- /*
- printf("nValues Alloc: %d\n", nValues );
- printf("iDevice: %d\n", iDevice );
-- */
-+ */
-+ #ifdef USE_LLVM_RUNTIME
-+ D_Pointer = llvm_omp_target_alloc_device ( sizeof ( int ) * nValues, iDevice );
-+ #else
- D_Pointer = omp_target_alloc ( sizeof ( int ) * nValues, iDevice );
--
-+ #endif
-+
- // printf("D_Pointer : %p\n", D_Pointer);
- #endif
-
-@@ -53,8 +64,12 @@ void * AllocateTargetDouble_OMP ( int nValues )
- printf("nValues Alloc: %d\n", nValues );
- printf("pre iDevice: %d\n", iDevice );
- */
-+ #ifdef USE_LLVM_RUNTIME
-+ D_Pointer = llvm_omp_target_alloc_device ( sizeof ( double ) * nValues, iDevice );
-+ #else
- D_Pointer = omp_target_alloc ( sizeof ( double ) * nValues, iDevice );
--
-+ #endif
-+
- //printf("D_Pointer : %p\n", D_Pointer);
-
- //omp_set_default_device(iDevice);
-@@ -141,7 +156,11 @@ void FreeTarget_OMP ( void * D_Pointer )
-
- #ifdef ENABLE_OMP_OFFLOAD
- iDevice = omp_get_default_device();
-+ #ifdef USE_LLVM_RUNTIME
-+ llvm_omp_target_free_device ( D_Pointer, iDevice );
-+ #else
- omp_target_free ( D_Pointer, iDevice );
-+ #endif
- #endif
-
- }
-@@ -220,3 +239,60 @@ bool OffloadEnabled ( )
+@@ -220,3 +220,54 @@ bool OffloadEnabled ( )
return false;
#endif
}
+
-+int SetDevice_OMP ( int iDevice )
++#ifdef USE_OPENMP_RUNTIME
++int SetDevice ( int iDevice )
+ {
+ #ifdef ENABLE_OMP_OFFLOAD
+ omp_set_default_device(iDevice);
@@ -203,7 +143,7 @@ index abccbb8d..810753de 100644
+ }
+
+
-+int GetDevice_OMP ( int * iDevice )
++int GetDevice ( int * iDevice )
+ {
+ #ifdef ENABLE_OMP_OFFLOAD
+ *iDevice = omp_get_default_device();
@@ -213,80 +153,32 @@ index abccbb8d..810753de 100644
+ #endif
+ }
+
-+void * AllocateHostDouble_Device_OMP ( int nValues )
++void * AllocateHostDouble_Device ( int nValues )
+ {
+ void * Host;
+
+ #ifdef ENABLE_OMP_OFFLOAD
-+ #ifdef USE_LLVM_RUNTIME
-+ Host = llvm_omp_target_alloc_host(sizeof ( double ) * nValues, omp_get_initial_device());
-+ #else
+ Host = omp_target_alloc( sizeof ( double ) * nValues, omp_get_initial_device());
-+ #endif
+ #else
+ Host = malloc ( sizeof ( double ) * nValues );
+ #endif
+ return Host;
+ }
+
-+void FreeHost_Device_OMP ( void * Host )
++void FreeHost_Device ( void * Host )
+ {
+ #ifdef ENABLE_OMP_OFFLOAD
-+ #ifdef USE_LLVM_RUNTIME
-+ llvm_omp_target_free_host(Host, omp_get_initial_device());
-+ #else
+ omp_target_free(Host, omp_get_initial_device());
-+ #endif
+ #else
+ free ( Host );
+ #endif
+ }
+
-+int DeviceMemGetInfo_Device_OMP ( size_t * Free, size_t * Total )
++int DeviceMemGetInfo_Device ( size_t * Free, size_t * Total )
+ {
+ Free = 0;
+ Total = 0;
+ return -1;
+ }
-diff --git a/Modules/Basics/Display/CONSOLE_Singleton.f90 b/Modules/Basics/Display/CONSOLE_Singleton.f90
-index 2f8cd18a..aa5b4ac0 100644
---- a/Modules/Basics/Display/CONSOLE_Singleton.f90
-+++ b/Modules/Basics/Display/CONSOLE_Singleton.f90
-@@ -18,7 +18,7 @@ module CONSOLE_Singleton
- logical ( KDL ) :: &
- Muted = .false.
- procedure ( AbortInterface ), nopass, pointer :: &
-- Abort => null ( )
-+ Abort
- contains
- procedure, public, nopass :: &
- Initialize
-@@ -180,7 +180,7 @@ contains
- end subroutine Unmute
-
-
-- elemental subroutine Finalize ( C )
-+ impure elemental subroutine Finalize ( C )
-
- type ( ConsoleSingleton ), intent ( inout ) :: &
- C
-diff --git a/Programs/Examples/Basics/FluidDynamics/PlaneWaveAdvection_Template.f90 b/Programs/Examples/Basics/FluidDynamics/PlaneWaveAdvection_Template.f90
-index a2d813c..335e77b 100644
---- a/Programs/Examples/Basics/FluidDynamics/PlaneWaveAdvection_Template.f90
-+++ b/Programs/Examples/Basics/FluidDynamics/PlaneWaveAdvection_Template.f90
-@@ -104,8 +104,14 @@ contains
- VZ = K ( 3 ) / ( dot_product ( K, K ) * Period )
-
- end associate !-- K
-
-+#ifdef ENABLE_OMP_OFFLOAD
-+ call PF % UpdateDevice ( )
-+#endif
- call PF % ComputeAuxiliary ( PF % Value )
- call PF % ComputeConserved ( PF % Value )
-+#ifdef ENABLE_OMP_OFFLOAD
-+ call PF % UpdateHost ( )
+#endif
- !-- FIXME: Implicit do-loop array needed to workaround Cray compiler
- ! crashes for elemental function argument of array and scalar
diff --git a/bin/patches/genasis_basics.patch b/bin/patches/genasis_basics.patch
index d4175aaf19..bc1a43705d 100644
--- a/bin/patches/genasis_basics.patch
+++ b/bin/patches/genasis_basics.patch
@@ -30,3 +30,76 @@ index a2d813c..580d9ab 100644
!-- FIXME: Implicit do-loop array needed to workaround Cray compiler
! crashes for elemental function argument of array and scalar
+diff --git a/Modules/Basics/Devices/Device_HIP.c b/Modules/Basics/Devices/Device_HIP.c
+index cd2c80a..2c0c6e8 100644
+--- a/Modules/Basics/Devices/Device_HIP.c
++++ b/Modules/Basics/Devices/Device_HIP.c
+@@ -1,3 +1,4 @@
++#ifndef USE_OPENMP_RUNTIME
+ #include
+ #include
+
+@@ -86,3 +87,4 @@ int DeviceMemGetInfo_Device ( size_t * Free, size_t * Total )
+ return -1;
+ #endif
+ }
++#endif
+diff --git a/Modules/Basics/Devices/Device_OMP.c b/Modules/Basics/Devices/Device_OMP.c
+index 541eb3f..04bce5b 100644
+--- a/Modules/Basics/Devices/Device_OMP.c
++++ b/Modules/Basics/Devices/Device_OMP.c
+@@ -277,3 +277,54 @@ bool OffloadEnabled ( )
+ return false;
+ #endif
+ }
++
++#ifdef USE_OPENMP_RUNTIME
++int SetDevice ( int iDevice )
++ {
++ #ifdef ENABLE_OMP_OFFLOAD
++ omp_set_default_device(iDevice);
++ return 0;
++ #else
++ return -1;
++ #endif
++ }
++
++
++int GetDevice ( int * iDevice )
++ {
++ #ifdef ENABLE_OMP_OFFLOAD
++ *iDevice = omp_get_default_device();
++ return 0;
++ #else
++ return -1;
++ #endif
++ }
++
++void * AllocateHostDouble_Device ( int nValues )
++ {
++ void * Host;
++
++ #ifdef ENABLE_OMP_OFFLOAD
++ Host = omp_target_alloc( sizeof ( double ) * nValues, omp_get_initial_device());
++ #else
++ Host = malloc ( sizeof ( double ) * nValues );
++ #endif
++ return Host;
++ }
++
++void FreeHost_Device ( void * Host )
++ {
++ #ifdef ENABLE_OMP_OFFLOAD
++ omp_target_free(Host, omp_get_initial_device());
++ #else
++ free ( Host );
++ #endif
++ }
++
++int DeviceMemGetInfo_Device ( size_t * Free, size_t * Total )
++ {
++ Free = 0;
++ Total = 0;
++ return -1;
++ }
++#endif
diff --git a/bin/patches/ninja-nprocs-v1.13.0.patch b/bin/patches/ninja-nprocs-v1.13.0.patch
new file mode 100644
index 0000000000..a0a32ac117
--- /dev/null
+++ b/bin/patches/ninja-nprocs-v1.13.0.patch
@@ -0,0 +1,72 @@
+diff --git a/src/ninja.cc b/src/ninja.cc
+index 85ae6eb..6e07fe9 100644
+--- a/src/ninja.cc
++++ b/src/ninja.cc
+@@ -252,15 +252,40 @@ void Usage(const BuildConfig& config) {
+
+ /// Choose a default value for the -j (parallelism) flag.
+ int GuessParallelism() {
+- switch (int processors = GetProcessorCount()) {
++ int nprocs = GetProcessorCount();
++ switch (nprocs) {
+ case 0:
+ case 1:
+- return 2;
+ case 2:
+- return 3;
++ nprocs++;
++ break;
+ default:
+- return processors + 2;
++ nprocs += 2;
++ break;
+ }
++
++ const char * nprocs_str = getenv("NINJA_NPROCS");
++ if (!nprocs_str) return nprocs;
++
++ char * end;
++ auto nprocs_env = strtol(nprocs_str, &end, 10);
++
++ if (*end != 0 || nprocs_env <= 0) return nprocs;
++
++ return int(nprocs_env);
++}
++
++/// Returns verbosity mode from the environment variable
++int HasVerbose() {
++ const char * verbose_str = getenv("NINJA_VERBOSE");
++ if (!verbose_str) return 0;
++
++ char * end;
++ auto verbose = strtol(verbose_str, &end, 10);
++
++ if (*end != 0 || verbose <= 0) return 0;
++
++ return verbose > 0;
+ }
+
+ /// Rebuild the build manifest, if necessary.
+@@ -1779,6 +1804,9 @@ int ReadFlags(int* argc, char*** argv,
+ *argv += optind;
+ *argc -= optind;
+
++ if (HasVerbose())
++ config->verbosity = BuildConfig::VERBOSE;
++
+ return -1;
+ }
+
+diff --git a/src/version.cc b/src/version.cc
+index 0ee3061..ae5701b 100644
+--- a/src/version.cc
++++ b/src/version.cc
+@@ -20,7 +20,7 @@
+
+ using namespace std;
+
+-const char* kNinjaVersion = "1.13.0";
++const char* kNinjaVersion = "1.13.0-mk";
+
+ void ParseVersion(const string& version, int* major, int* minor) {
+ size_t end = version.find('.');
diff --git a/bin/patches/ninja-nprocs-v1.13.1.patch b/bin/patches/ninja-nprocs-v1.13.1.patch
new file mode 100644
index 0000000000..129d1ede8a
--- /dev/null
+++ b/bin/patches/ninja-nprocs-v1.13.1.patch
@@ -0,0 +1,85 @@
+diff --git a/src/ninja.cc b/src/ninja.cc
+index 92d0761..8e3e1b8 100644
+--- a/src/ninja.cc
++++ b/src/ninja.cc
+@@ -252,15 +252,40 @@ void Usage(const BuildConfig& config) {
+
+ /// Choose a default value for the -j (parallelism) flag.
+ int GuessParallelism() {
+- switch (int processors = GetProcessorCount()) {
++ int nprocs = GetProcessorCount();
++ switch (nprocs) {
+ case 0:
+ case 1:
+- return 2;
+ case 2:
+- return 3;
++ nprocs++;
++ break;
+ default:
+- return processors + 2;
++ nprocs += 2;
++ break;
+ }
++
++ const char * nprocs_str = getenv("NINJA_NPROCS");
++ if (!nprocs_str) return nprocs;
++
++ char * end;
++ auto nprocs_env = strtol(nprocs_str, &end, 10);
++
++ if (*end != 0 || nprocs_env <= 0) return nprocs;
++
++ return int(nprocs_env);
++}
++
++/// Returns verbosity mode from the environment variable
++int HasVerbose() {
++ const char * verbose_str = getenv("NINJA_VERBOSE");
++ if (!verbose_str) return 0;
++
++ char * end;
++ auto verbose = strtol(verbose_str, &end, 10);
++
++ if (*end != 0 || verbose <= 0) return 0;
++
++ return verbose > 0;
+ }
+
+ /// Rebuild the build manifest, if necessary.
+@@ -1781,6 +1806,9 @@ int ReadFlags(int* argc, char*** argv,
+ *argv += optind;
+ *argc -= optind;
+
++ if (HasVerbose())
++ config->verbosity = BuildConfig::VERBOSE;
++
+ return -1;
+ }
+
+diff --git a/src/status_printer.cc b/src/status_printer.cc
+index e69cd15..0b9d0f8 100644
+--- a/src/status_printer.cc
++++ b/src/status_printer.cc
+@@ -51,7 +51,7 @@ StatusPrinter::StatusPrinter(const BuildConfig& config)
+
+ progress_status_format_ = getenv("NINJA_STATUS");
+ if (!progress_status_format_)
+- progress_status_format_ = "[%f/%t] ";
++ progress_status_format_ = "[%es %p %rx %f/%t] ";
+ }
+
+ void StatusPrinter::EdgeAddedToPlan(const Edge* edge) {
+diff --git a/src/version.cc b/src/version.cc
+index 17e59e6..7b8d94c 100644
+--- a/src/version.cc
++++ b/src/version.cc
+@@ -20,7 +20,7 @@
+
+ using namespace std;
+
+-const char* kNinjaVersion = "1.14.0.git";
++const char* kNinjaVersion = "1.13.1-mk";
+
+ void ParseVersion(const string& version, int* major, int* minor) {
+ size_t end = version.find('.');
diff --git a/bin/patches/ninja-nprocs-v1.13.2.patch b/bin/patches/ninja-nprocs-v1.13.2.patch
new file mode 100644
index 0000000000..342aaf57f6
--- /dev/null
+++ b/bin/patches/ninja-nprocs-v1.13.2.patch
@@ -0,0 +1,85 @@
+diff --git a/src/ninja.cc b/src/ninja.cc
+index 92d0761..8e3e1b8 100644
+--- a/src/ninja.cc
++++ b/src/ninja.cc
+@@ -252,15 +252,40 @@ void Usage(const BuildConfig& config) {
+
+ /// Choose a default value for the -j (parallelism) flag.
+ int GuessParallelism() {
+- switch (int processors = GetProcessorCount()) {
++ int nprocs = GetProcessorCount();
++ switch (nprocs) {
+ case 0:
+ case 1:
+- return 2;
+ case 2:
+- return 3;
++ nprocs++;
++ break;
+ default:
+- return processors + 2;
++ nprocs += 2;
++ break;
+ }
++
++ const char * nprocs_str = getenv("NINJA_NPROCS");
++ if (!nprocs_str) return nprocs;
++
++ char * end;
++ auto nprocs_env = strtol(nprocs_str, &end, 10);
++
++ if (*end != 0 || nprocs_env <= 0) return nprocs;
++
++ return int(nprocs_env);
++}
++
++/// Returns verbosity mode from the environment variable
++int HasVerbose() {
++ const char * verbose_str = getenv("NINJA_VERBOSE");
++ if (!verbose_str) return 0;
++
++ char * end;
++ auto verbose = strtol(verbose_str, &end, 10);
++
++ if (*end != 0 || verbose <= 0) return 0;
++
++ return verbose > 0;
+ }
+
+ /// Rebuild the build manifest, if necessary.
+@@ -1781,6 +1806,9 @@ int ReadFlags(int* argc, char*** argv,
+ *argv += optind;
+ *argc -= optind;
+
++ if (HasVerbose())
++ config->verbosity = BuildConfig::VERBOSE;
++
+ return -1;
+ }
+
+diff --git a/src/status_printer.cc b/src/status_printer.cc
+index e69cd15..0b9d0f8 100644
+--- a/src/status_printer.cc
++++ b/src/status_printer.cc
+@@ -51,7 +51,7 @@ StatusPrinter::StatusPrinter(const BuildConfig& config)
+
+ progress_status_format_ = getenv("NINJA_STATUS");
+ if (!progress_status_format_)
+- progress_status_format_ = "[%f/%t] ";
++ progress_status_format_ = "[%es %p %rx %f/%t] ";
+ }
+
+ void StatusPrinter::EdgeAddedToPlan(const Edge* edge) {
+diff --git a/src/version.cc b/src/version.cc
+index b108660..8fbd82b 100644
+--- a/src/version.cc
++++ b/src/version.cc
+@@ -20,7 +20,7 @@
+
+ using namespace std;
+
+-const char* kNinjaVersion = "1.13.2";
++const char* kNinjaVersion = "1.13.2-mk";
+
+ void ParseVersion(const string& version, int* major, int* minor) {
+ size_t end = version.find('.');
diff --git a/bin/patches/patch-control-file_21.0.txt b/bin/patches/patch-control-file_21.0.txt
index 8b3a7e3d65..9db7abd460 100644
--- a/bin/patches/patch-control-file_21.0.txt
+++ b/bin/patches/patch-control-file_21.0.txt
@@ -6,6 +6,7 @@ GenASiS_Basics: genasis_basics.patch
hipamd: hipamd-rpath.patch
bolt: bolt.patch
rocr-runtime: rocr-runtime-combined-numa-remove-gfx940-gfx941.patch
+clr: clr-findamd-icd.patch
rocprofiler: rocprofiler-combined-no-aql-ok-fix-cov6.patch
babelstream: babelstream-usm.patch
llvm-project: ATD_ASO_full.patch
diff --git a/bin/patches/patch-control-file_22.0.txt b/bin/patches/patch-control-file_22.0.txt
new file mode 100644
index 0000000000..ba011601eb
--- /dev/null
+++ b/bin/patches/patch-control-file_22.0.txt
@@ -0,0 +1,13 @@
+openlibm: openlibm.patch
+RAJA: raja.patch
+RAJAPerf: rajaperf.patch
+GenASis: genasis.patch
+GenASiS_Basics: genasis_basics.patch
+hipamd: hipamd-rpath.patch
+bolt: bolt.patch
+rocr-runtime: rocr-runtime-numa.patch
+clr: clr-findamd-icd.patch clr-amd-comgr-find-package.patch
+rocprofiler: rocprofiler-combined-no-aql-ok-fix-cov6.patch
+babelstream: babelstream-usm.patch
+llvm-project: ATD_ASO_full.patch
+UMT: umt.patch
diff --git a/bin/patches/patch-control-file_23.0.txt b/bin/patches/patch-control-file_23.0.txt
new file mode 100644
index 0000000000..ba011601eb
--- /dev/null
+++ b/bin/patches/patch-control-file_23.0.txt
@@ -0,0 +1,13 @@
+openlibm: openlibm.patch
+RAJA: raja.patch
+RAJAPerf: rajaperf.patch
+GenASis: genasis.patch
+GenASiS_Basics: genasis_basics.patch
+hipamd: hipamd-rpath.patch
+bolt: bolt.patch
+rocr-runtime: rocr-runtime-numa.patch
+clr: clr-findamd-icd.patch clr-amd-comgr-find-package.patch
+rocprofiler: rocprofiler-combined-no-aql-ok-fix-cov6.patch
+babelstream: babelstream-usm.patch
+llvm-project: ATD_ASO_full.patch
+UMT: umt.patch
diff --git a/bin/patches/rocr-runtime-numa.patch b/bin/patches/rocr-runtime-numa.patch
index 6c357f7ab8..cef5703248 100644
--- a/bin/patches/rocr-runtime-numa.patch
+++ b/bin/patches/rocr-runtime-numa.patch
@@ -1,13 +1,13 @@
diff --git a/runtime/hsa-runtime/CMakeLists.txt b/runtime/hsa-runtime/CMakeLists.txt
-index fbbcaf03..46977599 100644
+index cfcd3fba..cdc500bb 100644
--- a/runtime/hsa-runtime/CMakeLists.txt
+++ b/runtime/hsa-runtime/CMakeLists.txt
-@@ -292,7 +292,7 @@ if(${IMAGE_SUPPORT})
-
+@@ -335,7 +335,7 @@ if(${IMAGE_SUPPORT})
endif()
--target_link_libraries ( ${CORE_RUNTIME_TARGET} PRIVATE elf::elf dl pthread rt )
-+target_link_libraries ( ${CORE_RUNTIME_TARGET} PRIVATE elf::elf dl pthread rt numa drm_amdgpu drm)
- # For static package rocprofiler-register dependency is not required
- # Link to hsakmt target for shared library builds
- # Link to hsakmt-staticdrm target for static library builds
+ if (UNIX)
+- target_link_libraries ( ${CORE_RUNTIME_TARGET} PRIVATE elf::elf dl pthread rt )
++ target_link_libraries ( ${CORE_RUNTIME_TARGET} PRIVATE elf::elf dl pthread rt numa drm_amdgpu drm)
+ else()
+ target_link_libraries ( ${CORE_RUNTIME_TARGET} PRIVATE Ws2_32 )
+ target_link_directories(${CORE_RUNTIME_TARGET} PRIVATE ${DXCORE_LIB_PATH})
diff --git a/bin/repeat_fprintf.sh b/bin/repeat_fprintf.sh
index dc90ccc030..f3684eae15 100755
--- a/bin/repeat_fprintf.sh
+++ b/bin/repeat_fprintf.sh
@@ -9,8 +9,8 @@ _iters=${2:-100}
_compiler_bin_dir=${3:-/opt/rocm/llvm/bin}
# Check default gfxid using offload-arch
-if [ -f $_compiler_bin_dir/offload-arch ] ; then
- _oa_gfxid=`$_compiler_bin_dir/offload-arch`
+if [ -f "$_compiler_bin_dir/offload-arch" ] ; then
+ _oa_gfxid=$("$_compiler_bin_dir/offload-arch")
if [ "$_oa_gfxid" != "$_gfxid" ] ; then
echo "WARNING: changing gfxid to $_oa_gfxid"
_gfxid=$_oa_gfxid
@@ -20,10 +20,10 @@ fi
# Cleanup old source and binary files
_source_file="/tmp/fprintf.c"
_binary="/tmp/fprintf"
-[ -f $_binary ] && rm $_binary
-[ -f $_source_file ] && rm $_source_file
+[ -f "$_binary" ] && rm "$_binary"
+[ -f "$_source_file" ] && rm "$_source_file"
# Recreate source file from this embedded source
-/bin/cat >$_source_file <<"EOF"
+/bin/cat > "$_source_file" <<"EOF"
#include
#include
@@ -74,16 +74,22 @@ EOF
function run_tests() {
_log=stdout.log
_rc0=0
- for i in `seq 1 $_iters` ; do $_binary ; [ $? == 0 ] && _rc0=$(( $_rc0 + 1 )) ; done >$_log
- _fails=$(( $_iters - $_rc0 ))
- _failrate=$(( ( $_fails * 100 ) / $_iters ))
+ # Disable warning for unused 'i' variable
+ # shellcheck disable=2034
+ for i in $(seq 1 "$_iters") ; do
+ if $_binary ; then
+ _rc0=$(( _rc0 + 1 ))
+ fi
+ done > "$_log"
+ _fails=$(( _iters - _rc0 ))
+ _failrate=$(( ( _fails * 100 ) / _iters ))
}
_compile_cmd="$_compiler_bin_dir/clang -O2 -fopenmp --offload-arch=$_gfxid $_source_file -o $_binary"
echo
-echo $_compile_cmd
+echo "$_compile_cmd"
$_compile_cmd
-[ ! -f $_binary ] && echo "compile fail" && exit 1
+[ ! -f "$_binary" ] && echo "compile fail" && exit 1
echo
echo "Testing $_binary for $_iters iterations ..."
diff --git a/bin/rocm-test/passes/4.3.0/openmpvv45/openmpvv45_passes.txt b/bin/rocm-test/passes/4.3.0/openmpvv45/openmpvv45_passes.txt
new file mode 100644
index 0000000000..734287d96c
--- /dev/null
+++ b/bin/rocm-test/passes/4.3.0/openmpvv45/openmpvv45_passes.txt
@@ -0,0 +1,146 @@
+alpaka_complex_template.cpp
+declare_target_module.F90
+gemv_target.cpp
+gemv_target_teams_dist_par_for.cpp
+gridmini_map_struct_float_mul.cpp
+linked_list.c
+mmm_target.c
+mmm_target_parallel_for_simd.c
+offloading_success.c
+offloading_success.cpp
+offloading_success.F90
+omp_default_device.c
+test_declare_target_end_declare_target.c
+test_declare_target_extended_list.c
+test_declare_target_to_extended_list.c
+test_nested_target_simd.c
+test_nested_target_simd.F90
+test_target_and_task_nowait.c
+test_target_data_if.c
+test_target_data_if.F90
+test_target_data_map_alloc.c
+test_target_data_map_array_sections.c
+test_target_data_map_classes.cpp
+test_target_data_map_components_default.F90
+test_target_data_map_components_to.F90
+test_target_data_map_components_tofrom.F90
+test_target_data_map_devices.c
+test_target_data_map_from.c
+test_target_data_map_pointer_translation.c
+test_target_data_map_to.c
+test_target_data_map_to_from.c
+test_target_data_map_tofrom.c
+test_target_data_pointer_swap.c
+test_target_data_use_device_ptr.c
+test_target_defaultmap.c
+test_target_depends.c
+test_target_device.c
+test_target_enter_data_allocate_array_alloc.F90
+test_target_enter_data_allocate_array_to.F90
+test_target_enter_data_classes_inheritance.cpp
+test_target_enter_data_classes_simple.cpp
+test_target_enter_data_components_to.F90
+test_target_enter_data_depend.c
+test_target_enter_data_devices.c
+test_target_enter_data_global_array.c
+test_target_enter_data_if.F90
+test_target_enter_data_malloced_array.c
+test_target_enter_data_set_default_device.F90
+test_target_enter_data_struct.c
+test_target_enter_exit_data_classes_complex.cpp
+test_target_enter_exit_data_classes_simple.cpp
+test_target_enter_exit_data_depend.c
+test_target_enter_exit_data_devices.c
+test_target_enter_exit_data_if.c
+test_target_enter_exit_data_if.F90
+test_target_enter_exit_data_map_global_array.c
+test_target_enter_exit_data_map_malloced_array.c
+test_target_enter_exit_data_map_pointer_translation.c
+test_target_enter_exit_data_set_default_device.F90
+test_target_enter_exit_data_struct.c
+test_target_firstprivate.c
+test_target_if.c
+test_target_if.F90
+test_target_is_device_ptr.c
+test_target_map_array_default.c
+test_target_map_classes_default.cpp
+test_target_map_components_default.F90
+test_target_map_global_arrays.c
+test_target_map_local_array.c
+test_target_map_module_array.F90
+test_target_map_pointer.c
+test_target_map_pointer_default.F90
+test_target_map_pointer.F90
+test_target_map_pointer_no_map_type_modifier.c
+test_target_map_program_arrays.F90
+test_target_map_scalar_no_map_type_modifier.c
+test_target_map_struct_default.c
+test_target_map_subroutines_arrays.F90
+test_target_map_zero_length_pointer.c
+test_target_parallel.c
+test_target_private.c
+test_target_simd.c
+test_target_simd_collapse.c
+test_target_simd.F90
+test_target_simd_safelen.c
+test_target_simd_safelen.F90
+test_target_simd_simdlen.c
+test_target_simd_simdlen.F90
+test_target_teams_distribute.c
+test_target_teams_distribute_collapse.c
+test_target_teams_distribute_collapse.F90
+test_target_teams_distribute_default_none.c
+test_target_teams_distribute_default_shared.c
+test_target_teams_distribute_depend_array_section.c
+test_target_teams_distribute_depend_disjoint_section.c
+test_target_teams_distribute_depend_in_in.c
+test_target_teams_distribute_depend_in_out.c
+test_target_teams_distribute_depend_list.c
+test_target_teams_distribute_depend_out_in.c
+test_target_teams_distribute_depend_out_out.c
+test_target_teams_distribute_depend_unused_data.c
+test_target_teams_distribute_device.c
+test_target_teams_distribute_dist_schedule.c
+test_target_teams_distribute_if.c
+test_target_teams_distribute_if.F90
+test_target_teams_distribute_is_device_ptr.c
+test_target_teams_distribute_lastprivate.c
+test_target_teams_distribute_map.c
+test_target_teams_distribute_nowait.c
+test_target_teams_distribute_num_teams.c
+test_target_teams_distribute_num_teams.F90
+test_target_teams_distribute_parallel_for_firstprivate.c
+test_target_teams_distribute_parallel_for_if_parallel_modifier.c
+test_target_teams_distribute_parallel_for_if_target_modifier.c
+test_target_teams_distribute_parallel_for_map_from.c
+test_target_teams_distribute_parallel_for_map_from.F90
+test_target_teams_distribute_parallel_for_map_to.c
+test_target_teams_distribute_parallel_for_map_to.F90
+test_target_teams_distribute_parallel_for_num_teams.c
+test_target_teams_distribute_parallel_for_num_threads.c
+test_target_teams_distribute_parallel_for_private.c
+test_target_teams_distribute_parallel_for_schedule_private.c
+test_target_teams_distribute_parallel_for_thread_limit.c
+test_target_teams_distribute_private.c
+test_target_teams_distribute_private.F90
+test_target_teams_distribute_reduction_add.c
+test_target_teams_distribute_reduction_and.c
+test_target_teams_distribute_reduction_bitand.c
+test_target_teams_distribute_reduction_bitor.c
+test_target_teams_distribute_reduction_bitxor.c
+test_target_teams_distribute_reduction_max.c
+test_target_teams_distribute_reduction_min.c
+test_target_teams_distribute_reduction_multiply.c
+test_target_teams_distribute_reduction_or.c
+test_target_teams_distribute_reduction_subtract.c
+test_target_teams_distribute_shared.c
+test_target_teams_distribute_thread_limit.c
+test_target_teams_distribute_thread_limit.F90
+test_target_update_depend.c
+test_target_update_devices.c
+test_target_update_from.c
+test_target_update_if.c
+test_target_update_if.F90
+test_target_update_to.c
+test_target_update_to.F90
+test_task_target.c
diff --git a/bin/rocm-test/passes/4.3.0/openmpvv50/openmpvv50_passes.txt b/bin/rocm-test/passes/4.3.0/openmpvv50/openmpvv50_passes.txt
new file mode 100644
index 0000000000..93c0f17bdc
--- /dev/null
+++ b/bin/rocm-test/passes/4.3.0/openmpvv50/openmpvv50_passes.txt
@@ -0,0 +1,105 @@
+gridmini_map_class.cpp
+gridmini_map_struct_array.cpp
+gridmini_map_struct_float_mul.cpp
+gridmini_map_template_array.cpp
+gridmini_map_template.cpp
+gridmini_ptr.cpp
+test_atomic_acquire_release.c
+test_atomic_hint.c
+test_atomic_num_hint.c
+test_atomic_num_hint_device.c
+test_capture_omp_affinity.c
+test_declare_mapper_target_struct.c
+test_declare_target_device_type_any.c
+test_declare_target_device_type_host.c
+test_declare_target_device_type_nohost.c
+test_declare_variant.c
+test_depobj_depend_update_destroy.cpp
+test_flush_no_memory_order_clause.c
+test_loop_collapse.c
+test_loop_collapse_device.c
+test_loop_lastprivate_device.c
+test_loop_reduction_add_device.c
+test_loop_reduction_and.c
+test_loop_reduction_and_device.c
+test_loop_reduction_bitand.c
+test_loop_reduction_bitand_device.c
+test_loop_reduction_bitor.c
+test_loop_reduction_bitor_device.c
+test_loop_reduction_bitxor_device.c
+test_loop_reduction_max.c
+test_loop_reduction_max_device.c
+test_loop_reduction_min.c
+test_loop_reduction_min_device.c
+test_loop_reduction_multiply.c
+test_loop_reduction_multiply_device.c
+test_loop_reduction_or.c
+test_loop_reduction_or_device.c
+test_loop_reduction_subtract_device.c
+test_master_taskloop.c
+test_master_taskloop_simd.c
+test_omp_get_device_num.c
+test_omp_get_supported_active_levels.c
+test_omp_target_offload_env_DEFAULT.c
+test_omp_target_offload_env_DISABLED.c
+test_omp_target_offload_env_MANDATORY.c
+test_parallel_for_notequals.c
+test_parallel_for_order_concurrent.c
+test_parallel_for_reduction_task.c
+test_parallel_for_simd_atomic.c
+test_parallel_for_simd_atomic.F90
+test_parallel_master.c
+test_parallel_master_taskloop.c
+test_parallel_master_taskloop_simd.c
+test_requires_atomic_default_mem_order_acq_rel.c
+test_requires_atomic_default_mem_order_relaxed.c
+test_requires_atomic_default_mem_order_seq_cst.c
+test_scan.c
+test_set_and_get_omp_affinity.c
+test_simd_if.c
+test_simd_nontemporal.c
+test_simd_order_concurrent.c
+test_target_data_use_device_addr.c
+test_target_data_use_device_ptr.c
+test_target_defaultmap_default.c
+test_target_defaultmap_firstprivate.c
+test_target_defaultmap_none.c
+test_target_defaultmap_to_from_tofrom.c
+test_target_imperfect_loop.c
+test_target_map_classes_default.cpp
+test_target_mapping_before_alloc.c
+test_target_map_with_close_modifier.c
+test_target_parallel_for_notequals.c
+test_target_simd_if.c
+test_target_simd_if.F90
+test_target_simd_nontemporal.c
+test_target_simd_order_concurrent.c
+test_target_teams_distribute_reduction_add.c
+test_target_teams_distribute_reduction_and.c
+test_target_teams_distribute_reduction_bitand.c
+test_target_teams_distribute_reduction_bitor.c
+test_target_teams_distribute_reduction_bitxor.c
+test_target_teams_distribute_reduction_max.c
+test_target_teams_distribute_reduction_min.c
+test_target_teams_distribute_reduction_multiply.c
+test_target_teams_distribute_reduction_or.c
+test_target_teams_distribute_reduction_subtract.c
+test_target_uses_allocators_default.c
+test_target_uses_allocators_high_bw.c
+test_target_uses_allocators_low_lat.c
+test_target_uses_allocators_thread.c
+test_task_affinity.c
+test_task_depend_iterator.cpp
+test_task_depend_mutexinoutset.c
+test_task_detach.c
+test_taskgroup_task_reduction.c
+test_task_in_reduction.c
+test_task_in_reduction_dynamically_enclosed.c
+test_taskloop_in_reduction.c
+test_taskloop_reduction.c
+test_taskloop_simd_in_reduction.c
+test_taskloop_simd_reduction.c
+test_team_default_shared.c
+test_team_default_shared.F90
+test_teams.c
+test_teams_distribute_default_none.c
diff --git a/bin/rocm-test/passes/5.0.0/openmpvv45/openmpvv45_passes.txt b/bin/rocm-test/passes/5.0.0/openmpvv45/openmpvv45_passes.txt
new file mode 100644
index 0000000000..b48780a712
--- /dev/null
+++ b/bin/rocm-test/passes/5.0.0/openmpvv45/openmpvv45_passes.txt
@@ -0,0 +1,50 @@
+gemv_target_many_matrices.cpp
+gemv_target_reduction.cpp
+reduction_separated_directives.c
+reduction_separated_directives.cpp
+test_target_depends.F90
+test_target_map_scalar_default.F90
+test_target_teams_distribute_depend_in_out.F90
+test_target_teams_distribute_depend_list.F90
+test_target_teams_distribute_depend_out_in.F90
+test_target_teams_distribute_depend_out_out.F90
+test_target_teams_distribute_depend_unused_data.F90
+test_target_teams_distribute_parallel_for.c
+test_target_teams_distribute_parallel_for_defaultmap.c
+test_target_teams_distribute_parallel_for.F90
+test_target_teams_distribute_parallel_for_if_no_modifier.c
+test_target_teams_distribute_parallel_for_if_target_modifier.F90
+test_target_teams_distribute_parallel_for_map_default.c
+test_target_teams_distribute_parallel_for_map_default.F90
+test_target_teams_distribute_parallel_for_map_tofrom.c
+test_target_teams_distribute_parallel_for_map_tofrom.F90
+test_target_teams_distribute_parallel_for_private.F90
+test_target_update_from.F90
+qmcpack_target_math.c
+test_declare_target_link_extended_list.c
+test_parallel_sections.c
+test_target_data_map_components_from.F90
+test_target_data_map.F90
+test_target_data_map_from_array_sections.F90
+test_target_data_map_to_array_sections.F90
+test_target_device1.c
+test_target_enter_data_components_alloc.F90
+test_target_enter_data_if.c
+test_target_enter_data_module_array.F90
+test_target_enter_exit_data_module_array.F90
+test_target_taskloop_shared.c
+test_target_teams_distribute_defaultmap.c
+test_target_teams_distribute_firstprivate.c
+test_target_teams_distribute_parallel_for_dist_schedule.c
+test_target_teams_distribute_parallel_for_num_threads.F90
+test_target_teams_distribute_parallel_for_reduction.c
+test_task_critical.c
+test_taskloop_collapse.c
+test_taskloop_final.c
+test_taskloop_firstprivate.c
+test_taskloop_if.c
+test_taskloop_lastprivate.c
+test_taskloop_num_tasks.c
+test_taskloop_private.c
+test_taskloop_shared.c
+test_taskloop_simd_shared.c
diff --git a/bin/rocm-test/passes/5.0.0/openmpvv50/openmpvv50_passes.txt b/bin/rocm-test/passes/5.0.0/openmpvv50/openmpvv50_passes.txt
new file mode 100644
index 0000000000..e572e68bed
--- /dev/null
+++ b/bin/rocm-test/passes/5.0.0/openmpvv50/openmpvv50_passes.txt
@@ -0,0 +1,82 @@
+declare_target_base_and_derived_class.cpp
+declare_target_base_class.cpp
+lsms_triangular_packing.cpp
+test_allocate_allocator.c
+test_allocate.c
+test_declare_target_nested.c
+test_declare_target_parallel_for.c
+test_loop_bind.c
+test_loop_bind_device.c
+test_loop_lastprivate.c
+test_loop_nested.c
+test_loop_nested_device.c
+test_loop_order_concurrent.c
+test_loop_order_concurrent_device.c
+test_loop_private.c
+test_loop_private_device.c
+test_loop_reduction_add.c
+test_loop_reduction_add_mod.c
+test_loop_reduction_bitxor.c
+test_loop_reduction_subtract.c
+test_master_taskloop_device.c
+test_master_taskloop_simd_device.c
+test_metadirective_arch_is_nvidia.c
+test_metadirective_arch_nvidia_or_amd.c
+test_nested_declare_target.c
+test_parallel_for_allocate.c
+test_parallel_master_device.c
+test_parallel_master_taskloop_device.c
+test_parallel_master_taskloop_simd_device.c
+test_requires_unified_address.c
+test_requires_unified_shared_memory.c
+test_requires_unified_shared_memory_heap.c
+test_requires_unified_shared_memory_heap_is_device_ptr.c
+test_requires_unified_shared_memory_heap_map.c
+test_requires_unified_shared_memory_malloc.c
+test_requires_unified_shared_memory_malloc_is_device_ptr.c
+test_requires_unified_shared_memory_malloc_map.c
+test_requires_unified_shared_memory_omp_target_alloc.c
+test_requires_unified_shared_memory_omp_target_alloc_is_device_ptr.c
+test_requires_unified_shared_memory_stack.c
+test_requires_unified_shared_memory_stack_is_device_ptr.c
+test_requires_unified_shared_memory_stack_map.c
+test_requires_unified_shared_memory_static.c
+test_requires_unified_shared_memory_static_is_device_ptr.c
+test_requires_unified_shared_memory_static_map.c
+test_target_allocate.c
+test_target_collapse.c
+test_target_in_reduction.c
+test_target_loop_teams_distribute.cpp
+test_target_parallel_default.c
+test_target_parallel_if_device.c
+test_target_parallel_is_dev_ptr.c
+test_target_parallel_linear.c
+test_target_parallel_loop_bind.c
+test_target_parallel_loop_collapse.c
+test_target_parallel_loop_lastprivate.c
+test_target_parallel_loop_order.c
+test_target_parallel_loop_private.c
+test_target_parallel_loop_reduction.c
+test_target_parallel_reduction.c
+test_target_task_depend_mutexinoutset.c
+test_target_teams_distribute_parallel_for_collapse.c
+test_target_teams_distribute_parallel_for_collapse.F90
+test_target_teams_distribute_parallel_for_simd_atomic.c
+test_target_teams_distribute_parallel_for_simd_atomic.F90
+test_target_teams_is_device_ptr.c
+test_target_teams_loop_allocate.c
+test_target_teams_loop_defaultmap.c
+test_target_teams_loop_depend.c
+test_target_teams_loop_device.c
+test_target_teams_loop_firstprivate.c
+test_target_teams_loop_is_device_ptr.c
+test_target_teams_loop_nowait.c
+test_target_teams_loop_private.c
+test_target_teams_loop_reduction.c
+test_target_teams_num_teams.c
+test_target_teams_reduction.c
+test_target_uses_allocators_cgroup.c
+test_target_uses_allocators_const.c
+test_target_uses_allocators_large_cap.c
+test_target_uses_allocators_pteam.c
+test_taskwait_depend.c
diff --git a/bin/rocm-test/passes/5.0.0/sollve45/sollve45_passes.txt b/bin/rocm-test/passes/5.0.0/sollve45/sollve45_passes.txt
index f7b67bfd44..b48780a712 100644
--- a/bin/rocm-test/passes/5.0.0/sollve45/sollve45_passes.txt
+++ b/bin/rocm-test/passes/5.0.0/sollve45/sollve45_passes.txt
@@ -20,7 +20,6 @@ test_target_teams_distribute_parallel_for_map_tofrom.c
test_target_teams_distribute_parallel_for_map_tofrom.F90
test_target_teams_distribute_parallel_for_private.F90
test_target_update_from.F90
-declare_target_subroutine.F90
qmcpack_target_math.c
test_declare_target_link_extended_list.c
test_parallel_sections.c
@@ -33,17 +32,12 @@ test_target_enter_data_components_alloc.F90
test_target_enter_data_if.c
test_target_enter_data_module_array.F90
test_target_enter_exit_data_module_array.F90
-test_target_parallel.F90
-test_target_simd_collapse.F90
test_target_taskloop_shared.c
test_target_teams_distribute_defaultmap.c
test_target_teams_distribute_firstprivate.c
test_target_teams_distribute_parallel_for_dist_schedule.c
-test_target_teams_distribute_parallel_for_if_no_modifier.F90
-test_target_teams_distribute_parallel_for_num_teams.F90
test_target_teams_distribute_parallel_for_num_threads.F90
test_target_teams_distribute_parallel_for_reduction.c
-test_target_teams_distribute_parallel_for_thread_limit.F90
test_task_critical.c
test_taskloop_collapse.c
test_taskloop_final.c
@@ -54,4 +48,3 @@ test_taskloop_num_tasks.c
test_taskloop_private.c
test_taskloop_shared.c
test_taskloop_simd_shared.c
-test_task_ThrdPrivate.c
diff --git a/bin/rocm-test/passes/5.0.0/sollve50/sollve50_passes.txt b/bin/rocm-test/passes/5.0.0/sollve50/sollve50_passes.txt
index a081273d9a..e572e68bed 100644
--- a/bin/rocm-test/passes/5.0.0/sollve50/sollve50_passes.txt
+++ b/bin/rocm-test/passes/5.0.0/sollve50/sollve50_passes.txt
@@ -3,14 +3,7 @@ declare_target_base_class.cpp
lsms_triangular_packing.cpp
test_allocate_allocator.c
test_allocate.c
-test_atomic_acquire_release.F90
-test_atomic_hint.F90
-test_atomic_num_hint_device.F90
-test_atomic_num_hint.F90
-test_declare_target_device_type_any.F90
-test_declare_target_device_type_host.F90
test_declare_target_nested.c
-test_declare_target_nested_functions.c
test_declare_target_parallel_for.c
test_loop_bind.c
test_loop_bind_device.c
@@ -30,14 +23,10 @@ test_master_taskloop_simd_device.c
test_metadirective_arch_is_nvidia.c
test_metadirective_arch_nvidia_or_amd.c
test_nested_declare_target.c
-test_omp_cancellation_env_1.c
test_parallel_for_allocate.c
test_parallel_master_device.c
test_parallel_master_taskloop_device.c
test_parallel_master_taskloop_simd_device.c
-test_requires_atomic_default_mem_order_acq_rel.F90
-test_requires_atomic_default_mem_order_relaxed.F90
-test_requires_atomic_default_mem_order_seq_cst.F90
test_requires_unified_address.c
test_requires_unified_shared_memory.c
test_requires_unified_shared_memory_heap.c
@@ -54,9 +43,6 @@ test_requires_unified_shared_memory_stack_map.c
test_requires_unified_shared_memory_static.c
test_requires_unified_shared_memory_static_is_device_ptr.c
test_requires_unified_shared_memory_static_map.c
-test_simd_if.F90
-test_simd_nontemporal.F90
-test_simd_order_concurrent.F90
test_target_allocate.c
test_target_collapse.c
test_target_in_reduction.c
@@ -72,8 +58,6 @@ test_target_parallel_loop_order.c
test_target_parallel_loop_private.c
test_target_parallel_loop_reduction.c
test_target_parallel_reduction.c
-test_target_simd_nontemporal.F90
-test_target_simd_order_concurrent.F90
test_target_task_depend_mutexinoutset.c
test_target_teams_distribute_parallel_for_collapse.c
test_target_teams_distribute_parallel_for_collapse.F90
@@ -81,7 +65,6 @@ test_target_teams_distribute_parallel_for_simd_atomic.c
test_target_teams_distribute_parallel_for_simd_atomic.F90
test_target_teams_is_device_ptr.c
test_target_teams_loop_allocate.c
-test_target_teams_loop_collapse.c
test_target_teams_loop_defaultmap.c
test_target_teams_loop_depend.c
test_target_teams_loop_device.c
@@ -97,4 +80,3 @@ test_target_uses_allocators_const.c
test_target_uses_allocators_large_cap.c
test_target_uses_allocators_pteam.c
test_taskwait_depend.c
-test_teams.F90
diff --git a/bin/rocm-test/passes/5.1.0/openmpvv45/openmpvv45_passes.txt b/bin/rocm-test/passes/5.1.0/openmpvv45/openmpvv45_passes.txt
new file mode 100644
index 0000000000..f74870bb25
--- /dev/null
+++ b/bin/rocm-test/passes/5.1.0/openmpvv45/openmpvv45_passes.txt
@@ -0,0 +1 @@
+test_target_teams_distribute_parallel_for_devices.c
diff --git a/bin/rocm-test/passes/5.5.0/smoke-fort-limbo/smoke-fort-limbo_passes.txt b/bin/rocm-test/passes/5.5.0/smoke-fort-limbo/smoke-fort-limbo_passes.txt
index 8d4b918817..6f80b36d6c 100644
--- a/bin/rocm-test/passes/5.5.0/smoke-fort-limbo/smoke-fort-limbo_passes.txt
+++ b/bin/rocm-test/passes/5.5.0/smoke-fort-limbo/smoke-fort-limbo_passes.txt
@@ -2,4 +2,3 @@ clause_task_detach
flang-474712
iso_fortran_env_impl
iso_fortran_env_impl2
-openmp-ver
diff --git a/bin/rocm_quick_check.sh b/bin/rocm_quick_check.sh
index 25690eb31f..6e5ee3d687 100755
--- a/bin/rocm_quick_check.sh
+++ b/bin/rocm_quick_check.sh
@@ -1,4 +1,10 @@
#!/bin/bash
+# Copyright © Advanced Micro Devices, Inc., or its affiliates.
+cat /etc/os-release
+
+if [ -e /proc/cmdline ]; then
+ cat /proc/cmdline
+fi
if [ -e /usr/lib/aomp ]; then
echo "bad version of aomp installed, please uninstall: /usr/lib/aomp"
fi
@@ -24,6 +30,12 @@ else
echo "/usr/bin/python is missing FAIL"
fi
+if [ -e /usr/bin/python3 ]; then
+ echo "/usr/bin/python3 OK"
+else
+ echo "/usr/bin/python3 is missing FAIL"
+fi
+
echo "Checking for libnvida compute pieces "
if [ -e /usr/bin/dpkg ]; then
dpkg -l | grep -i nvid
@@ -33,6 +45,8 @@ fi
echo "Done checking for libnvidia"
if [ -e ~/local/openmpi/lib/libmpi.so ]; then
+ # We don't care that the tilde isn't expanded
+ # shellcheck disable=2088
echo "~/local/openmpi/lib/libmpi.so OK"
elif [ -e /opt/openmpi-4.1.5/lib/libmpi.so ]; then
echo "/opt/openmpi-4.1.5/lib/libmpi.so OK"
@@ -54,17 +68,34 @@ else
echo "No mpi found , not good. FAIL"
fi
+# Find the latest version of FileCheck in a directory given as the first
+# argument. (The highest-numbered FileCheck-nn, or just 'FileCheck' if that's
+# the only version in the directory).
+function latest_filecheck() {
+ local prev_nullglob
+ local indir="$1"
+ prev_nullglob="$(shopt -p nullglob)"
+ shopt -s nullglob
+ pushd "$indir" >& /dev/null || return
+ for FC in FileCheck*; do
+ realpath "$FC"
+ done | sort -t '-' -k 2 -n -r | head -n 1
+ popd >& /dev/null || return
+ eval "$prev_nullglob"
+}
# Look for FileCheck on the system in various places.
# Check local AOMP install first.
-SYSFILECHECK=`ls /usr/bin | grep -m1 -e "FileCheck"`
+SYSFILECHECK=$(latest_filecheck /usr/bin)
if [ "$SYSFILECHECK" == "" ]; then
SYSFILECHECK="FileCheck"
fi
-AOMP=`ls -d /opt/rocm-*/llvm | head -1`
-echo $AOMP
-SYSLLVM=`ls /usr/lib | grep -m1 -e "llvm-[0-9]\+"`
-TESTPACKAGE_BINDIR=`find "$HOME/tmp/openmp-extras" -type f -name 'aomp_common_vars' | xargs dirname`
+# We don't care about non-alphanumeric filenames here.
+# shellcheck disable=2012
+AOMP=$(ls -d /opt/rocm-*/llvm | head -1)
+echo "$AOMP"
+SYSLLVM=$(ls /usr/lib | grep -m1 -e "llvm-[0-9]\+")
+TESTPACKAGE_BINDIR=$(find "$HOME/tmp/openmp-extras" -type f -name 'aomp_common_vars' | xargs dirname)
if [ -e "$TESTPACKAGE_BINDIR/FileCheck" ]; then
echo "$TESTPACKAGE_BINDIR/FileCheck OK"
@@ -75,20 +106,21 @@ elif [ -e "$AOMP/bin/FileCheck" ]; then
elif [ -e /usr/lib/aomp/bin/FileCheck ]; then
echo "/usr/lib/aomp/bin/FileCheck OK"
/usr/lib/aomp/bin/FileCheck --version
-elif [ -e $HOME/git/aomp-test/FileCheck ]; then
+elif [ -e "$HOME"/git/aomp-test/FileCheck ]; then
echo "$HOME/git/aomp-test/FileCheck OK"
$HOME/git/aomp-test/FileCheck --version
-elif [ -e /usr/lib/$SYSLLVM/bin/FileCheck ]; then
+elif [ -e /usr/lib/"$SYSLLVM"/bin/FileCheck ]; then
echo "/usr/lib/$SYSLLVM/bin/FileCheck OK"
/usr/lib/$SYSLLVM/bin/FileCheck --version
-elif [ -e /usr/bin/$SYSFILECHECK ]; then
+elif [ -e /usr/bin/"$SYSFILECHECK" ]; then
echo "/usr/bin/$SYSFILECHECK OK"
/usr/bin/$SYSFILECHECK --version
else
echo "Warning ----Warning---- FileCheck was not found and is needed by smoke tests."
echo "FileCheck notfound. May need to install llvm-XY-tools (where XY is llvm version)."
fi
-
+echo python file check:
+which filecheck
echo "Checking for SRIOV "
if [ -e /sbin/lspci ]; then
diff --git a/bin/rocmlibs/build_hipBLAS.sh b/bin/rocmlibs/build_hipBLAS.sh
index 6483123e42..76849c6ca2 100755
--- a/bin/rocmlibs/build_hipBLAS.sh
+++ b/bin/rocmlibs/build_hipBLAS.sh
@@ -1,5 +1,9 @@
#!/bin/bash
#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
# build_hipblas.sh: Script to build and install hipblas library
#
#
diff --git a/bin/rocmlibs/build_powerinfer.sh b/bin/rocmlibs/build_powerinfer.sh
index c23ce6bd07..a6143a920d 100755
--- a/bin/rocmlibs/build_powerinfer.sh
+++ b/bin/rocmlibs/build_powerinfer.sh
@@ -1,5 +1,9 @@
#!/bin/bash
#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
# build_powerinfer.sh: Script to build and install powerinfer library
# This build is classic cmake, make, make install
#
diff --git a/bin/rocmlibs/build_rccl.sh b/bin/rocmlibs/build_rccl.sh
index 4aab4898de..36c92c5608 100755
--- a/bin/rocmlibs/build_rccl.sh
+++ b/bin/rocmlibs/build_rccl.sh
@@ -2,7 +2,9 @@
#
# build_rccl.sh: Script to build and install rccl.
# This uses a slightly modified install.sh from rccl.
+# It has a dependency on rocm-core.
#
+
BUILD_TYPE=${BUILD_TYPE:-Release}
# --- Start standard header to set AOMP environment variables ----
@@ -22,19 +24,36 @@ else
_set_ninja_gen="--time-trace"
fi
+if [ -d "$HOME/local/rocm-core/.info" ]; then
+ echo Copying rocm-core .info from $HOME/local/rocm-core/.info to $AOMP_INSTALL_DIR
+ cp -r $HOME/local/rocm-core/.info $AOMP_INSTALL_DIR
+else
+ echo "Error: rccl needs $AOMP_INSTALL_DIR/.info to exist. Please run ./build_prereq.sh first."
+ exit 1
+fi
+
patchrepo $_source_dir
+export CC=$LLVM_INSTALL_LOC/bin/clang
+export CXX=$LLVM_INSTALL_LOC/bin/clang++
+export FC=$LLVM_INSTALL_LOC/bin/flang
+export ROCM_DIR=$AOMP_INSTALL_DIR
+export ROCM_PATH=$AOMP_INSTALL_DIR
+# rccl needs cmake 3.25, so put prereq cmake first in path
+export PATH=$AOMP_SUPP/cmake/bin:$AOMP_INSTALL_DIR/bin:$PATH
+export NUM_PROC=$AOMP_JOB_THREADS
+export CXXFLAGS="-I$HOME/local/rocm-core/include"
+export LDFLAGS="-fPIC"
+export EXPLICIT_ROCM_VERSION=$(grep -E "[0-9]+\.[0-9]+\.[0-9]+" < $HOME/local/rocm-core/.info/version)
+
if [ "$AOMP_USE_CCACHE" != 0 ] ; then
_ccache_bin=`which ccache`
export CMAKE_CXX_COMPILER_LAUNCHER=$_ccache_bin
fi
-# rccl needs cmake 3.25, so put prereq cmake first in path
-export PATH=$AOMP_SUPP/cmake/bin:$PATH
-
-if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
- if [ ! -L $AOMP ] ; then
- if [ -d $AOMP ] ; then
+if [ $AOMP_STANDALONE_BUILD == 1 ] ; then
+ if [ ! -L $AOMP ] ; then
+ if [ -d $AOMP ] ; then
echo "ERROR: Directory $AOMP is a physical directory."
echo " It must be a symbolic link or not exist"
exit 1
@@ -45,13 +64,13 @@ else
exit 1
fi
-if [ "$1" == "nocmake" ] ; then
+if [ "$1" == "nocmake" ] ; then
_nocmake_option="--nocmake"
else
_nocmake_option=""
fi
-if [ "$BUILD_TYPE" == "Release" ] ; then
+if [ "$BUILD_TYPE" == "Release" ] ; then
_buildtype_option=""
_build_dir_option="release"
else
@@ -63,7 +82,7 @@ fi
if [ "$1" == "install" ] ; then
$SUDO mkdir -p $AOMP_INSTALL_DIR
$SUDO touch $AOMP_INSTALL_DIR/testfile
- if [ $? != 0 ] ; then
+ if [ $? != 0 ] ; then
echo "ERROR: No update access to $AOMP_INSTALL_DIR"
exit 1
fi
@@ -71,14 +90,14 @@ if [ "$1" == "install" ] ; then
fi
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
- echo
+ echo
echo "This is a FRESH START. ERASING any previous builds in $BUILD_DIR/build/rocmlibs/$_libname"
echo "Use ""$0 install"" to avoid FRESH START."
echo rm -rf $BUILD_DIR/build/rocmlibs/$_libname
rm -rf $BUILD_DIR/build/rocmlibs/$_libname
mkdir -p $BUILD_DIR/build/rocmlibs/$_libname
else
- if [ ! -d $BUILD_DIR/build/rocmlibs/$_libname ] ; then
+ if [ ! -d $BUILD_DIR/build/rocmlibs/$_libname ] ; then
echo "ERROR: The build directory $BUILD_DIR/build/rocmlibs/$_libname does not exist"
echo " run $0 without install and without nocmake option"
exit 1
@@ -92,24 +111,28 @@ if [ "$1" != "install" ] ; then
echo
echo " -----Running cmake in install.sh ---"
echo cd $AOMP_REPOS/build/rocmlibs/$_libname
- cd $AOMP_REPOS/build/rocmlibs/$_libname
- # --noinstall must follow --prefix because --prefix sets install_library=true
- echo $_source_dir/install.sh $_nocmake_option $_buildtype_option -j $AOMP_JOB_THREADS --prefix $AOMP_INSTALL_DIR $_set_ninja_gen --source_dir $_source_dir --noinstall --amdgpu_targets $RCCL_GFXLIST
- $_source_dir/install.sh $_nocmake_option $_buildtype_option -j $AOMP_JOB_THREADS --prefix $AOMP_INSTALL_DIR $_set_ninja_gen --source_dir $_source_dir --noinstall --amdgpu_targets $RCCL_GFXLIST
- if [ $? != 0 ] ; then
- echo "ERROR install failed."
- echo " $MYCMAKEOPTS"
- cd $_curdir
- exit 1
- fi
+ cd $AOMP_REPOS/build/rocmlibs/$_libname
+ echo ${AOMP_CMAKE} --toolchain=toolchain-linux.cmake -DCMAKE_BUILD_TYPE=Release -DGPU_TARGETS="$ROCMLIBS_GFXLIST" -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR -DROCM_PATH=$AOMP_INSTALL_DIR -DCOLLTRACE=OFF -DNPKIT_FLAGS="" -DONLY_FUNCS="" -DEXPLICIT_ROCM_VERSION=$EXPLICIT_ROCM_VERSION $_source_dir
+ ${AOMP_CMAKE} --toolchain=toolchain-linux.cmake -DCMAKE_BUILD_TYPE=Release -DGPU_TARGETS="$ROCMLIBS_GFXLIST" -DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR -DROCM_PATH=$AOMP_INSTALL_DIR -DCOLLTRACE=OFF -DNPKIT_FLAGS="" -DONLY_FUNCS="" -DEXPLICIT_ROCM_VERSION=$EXPLICIT_ROCM_VERSION $_source_dir
+ if [ $? != 0 ] ; then
+ echo "ERROR cmake failed."
+ echo " $MYCMAKEOPTS"
+ cd $_curdir
+ exit 1
+ fi
+ make -j$AOMP_JOB_THREADS
+
+ if [ $? != 0 ] ; then
+ echo "ERROR make -j $AOMP_JOB_THREADS failed"
+ exit 1
+ fi
fi
if [ "$1" == "install" ] ; then
echo " ----- Installing to $AOMP_INSTALL_DIR ----- "
echo cd $AOMP_REPOS/build/rocmlibs/$_libname
cd $AOMP_REPOS/build/rocmlibs/$_libname
- echo "$_source_dir/install.sh --no_clean --nocmake -j $AOMP_JOB_THREADS --prefix $AOMP_INSTALL_DIR $_set_ninja_gen --source_dir $_source_dir"
- $_source_dir/install.sh --no_clean --nocmake -j $AOMP_JOB_THREADS --prefix $AOMP_INSTALL_DIR $_set_ninja_gen --source_dir $_source_dir
+ make -j$AOMP_JOB_THREADS install
if [ $? != 0 ] ; then
echo "ERROR install to $AOMP_INSTALL_DIR failed "
exit 1
@@ -118,9 +141,9 @@ if [ "$1" == "install" ] ; then
echo "SUCCESSFUL INSTALL to $AOMP_INSTALL_DIR"
echo
removepatch $_source_dir
-else
- echo
+else
+ echo
echo "SUCCESSFUL BUILD, please run: $0 install"
echo " to install into $AOMP_INSTALL_DIR"
- echo
+ echo
fi
diff --git a/bin/rocmlibs/build_rocBLAS.sh b/bin/rocmlibs/build_rocBLAS.sh
index 5eef6f8cc5..9a75c22d2b 100755
--- a/bin/rocmlibs/build_rocBLAS.sh
+++ b/bin/rocmlibs/build_rocBLAS.sh
@@ -1,4 +1,9 @@
#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
#
# build_rocblas.sh: Script to build and install rocblas library
#
@@ -137,7 +142,8 @@ if [ "$1" != "install" ] ; then
-DTensile_LAZY_LIBRARY_LOADING=ON
-DTensile_LIBRARY_FORMAT=msgpack
-DBUILD_WITH_HIPBLASLT=OFF
- -DAMDGPU_TARGETS="""$ROCMLIBS_GFXLIST"""
+ -DROCTX_PATH=$AOMP_INSTALL_DIR
+ -DGPU_TARGETS="""$ROCMLIBS_GFXLIST"""
"
echo "Beginning cmake for rocblas..."
cd $BUILD_DIR/build/rocmlibs/rocBLAS
diff --git a/bin/rocmlibs/build_rocPRIM.sh b/bin/rocmlibs/build_rocPRIM.sh
index 32ff54e352..2c49ce1fe8 100755
--- a/bin/rocmlibs/build_rocPRIM.sh
+++ b/bin/rocmlibs/build_rocPRIM.sh
@@ -1,4 +1,9 @@
#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
#
# build_rocPRIM.sh: Script to build and install rocPRIM library
#
diff --git a/bin/rocmlibs/build_rocRAND.sh b/bin/rocmlibs/build_rocRAND.sh
index 38e443b630..d76261daf5 100755
--- a/bin/rocmlibs/build_rocRAND.sh
+++ b/bin/rocmlibs/build_rocRAND.sh
@@ -79,7 +79,7 @@ if [ "$1" != "install" ] ; then
pwd
MYCMAKEOPTS="\
-DCMAKE_CXX_COMPILER=$CXX \
--DCMAKE_CXX_FLAGS=""-I$LLVM_INSTALL_LOC/include\;-D__HIP_PLATFORM_AMD__=1"" \
+-DCMAKE_CXX_FLAGS=""-I$LLVM_INSTALL_LOC/include -D__HIP_PLATFORM_AMD__=1"" \
-DROCM_DIR=$AOMP_INSTALL_DIR \
-DBUILD_FORTRAN_WRAPPER=ON \
-DROCM_PATH=$AOMP_INSTALL_DIR \
@@ -89,6 +89,7 @@ if [ "$1" != "install" ] ; then
-DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR \
-DCPACK_SET_DESTDIR=OFF \
-DCMAKE_BUILD_TYPE=Release \
+-DBUILD_BENCHMARK=ON \
-DAMDGPU_TARGETS="""$ROCMLIBS_GFXLIST""" "
echo " ----- Running $AOMP_CMAKE $MYCMAKEOPTS $_repo_dir -----"
$AOMP_CMAKE $MYCMAKEOPTS $_repo_dir
diff --git a/bin/rocmlibs/build_rocSOLVER.sh b/bin/rocmlibs/build_rocSOLVER.sh
index dd95c90a47..e511511d68 100755
--- a/bin/rocmlibs/build_rocSOLVER.sh
+++ b/bin/rocmlibs/build_rocSOLVER.sh
@@ -1,4 +1,9 @@
#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
#
# build_rocSOLVER.sh: Script to build and install rocSOLVER library
#
diff --git a/bin/rocmlibs/build_rocSPARSE.sh b/bin/rocmlibs/build_rocSPARSE.sh
index e16c20fcd4..bd9ef06c9e 100755
--- a/bin/rocmlibs/build_rocSPARSE.sh
+++ b/bin/rocmlibs/build_rocSPARSE.sh
@@ -1,4 +1,9 @@
#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
#
# build_rocsparse.sh: Script to build and install rocsparse library
#
diff --git a/bin/rocmlibs/build_rocmlibs.sh b/bin/rocmlibs/build_rocmlibs.sh
index 064c1fa712..f6697fd7a7 100755
--- a/bin/rocmlibs/build_rocmlibs.sh
+++ b/bin/rocmlibs/build_rocmlibs.sh
@@ -1,4 +1,9 @@
#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
#
# build_rocmlibs.sh : Build and install ROCm libraries as AOMP components
#
diff --git a/bin/rocmlibs/clone_rocmlibs.sh b/bin/rocmlibs/clone_rocmlibs.sh
index dac87fb085..7ed39dbe68 100755
--- a/bin/rocmlibs/clone_rocmlibs.sh
+++ b/bin/rocmlibs/clone_rocmlibs.sh
@@ -1,5 +1,10 @@
#!/bin/bash
#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
+#
# clone_rocmlibs.sh: Clone the set of rocmlibs
# Currently AOMP needs 14 repositories.
#
diff --git a/bin/rocmlibs/patches/hipblas.patch b/bin/rocmlibs/patches/hipblas.patch
index fe673953db..69a56ebda3 100644
--- a/bin/rocmlibs/patches/hipblas.patch
+++ b/bin/rocmlibs/patches/hipblas.patch
@@ -1,8 +1,8 @@
diff --git a/clients/common/utility.cpp b/clients/common/utility.cpp
-index 2aa6438..1232587 100644
+index a575664..d27a35f 100644
--- a/clients/common/utility.cpp
+++ b/clients/common/utility.cpp
-@@ -460,6 +460,10 @@ hipblasClientProcessor getArch()
+@@ -459,6 +459,10 @@ hipblasClientProcessor getArch()
{
return hipblasClientProcessor::gfx90a;
}
@@ -10,39 +10,18 @@ index 2aa6438..1232587 100644
+ {
+ return hipblasClientProcessor::gfx90c;
+ }
- else if(deviceString.find("gfx940") != std::string::npos)
+ else if(deviceString.find("gfx942") != std::string::npos)
{
- return hipblasClientProcessor::gfx940;
-@@ -500,6 +504,10 @@ hipblasClientProcessor getArch()
- {
- return hipblasClientProcessor::gfx1102;
- }
-+ else if(deviceString.find("gfx1103") != std::string::npos)
-+ {
-+ return hipblasClientProcessor::gfx1103;
-+ }
- return static_cast(0);
- }
-
+ return hipblasClientProcessor::gfx942;
diff --git a/clients/include/utility.h b/clients/include/utility.h
-index 0f3ff7b..a4a1b27 100644
+index bb9e362..3a50954 100644
--- a/clients/include/utility.h
+++ b/clients/include/utility.h
-@@ -486,6 +486,7 @@ typedef enum hipblasClientProcessor
+@@ -494,6 +494,7 @@ typedef enum hipblasClientProcessor
gfx906 = 906,
gfx908 = 908,
gfx90a = 910,
+ gfx90c = 912,
- gfx940 = 940,
- gfx941 = 941,
gfx942 = 942,
-@@ -499,7 +500,8 @@ typedef enum hipblasClientProcessor
- gfx1035 = 1035,
- gfx1100 = 1100,
- gfx1101 = 1101,
-- gfx1102 = 1102
-+ gfx1102 = 1102,
-+ gfx1103 = 1103
- } hipblasClientProcessor;
-
- /* get architecture number */
+ gfx950 = 950,
+ gfx1010 = 1010,
diff --git a/bin/rocmlibs/patches/patch-control-file_22.0.txt b/bin/rocmlibs/patches/patch-control-file_22.0.txt
new file mode 100644
index 0000000000..1be9abe3f7
--- /dev/null
+++ b/bin/rocmlibs/patches/patch-control-file_22.0.txt
@@ -0,0 +1,8 @@
+Tensile: tensile.patch
+rocBLAS: rocblas.patch
+rocPRIM: rocprim.patch
+rocSPARSE: rocsparse.patch
+rocSOLVER: rocsolver.patch
+hipBLAS: hipblas.patch
+rccl: rccl.patch
+PowerInfer: powerinfer.patch
\ No newline at end of file
diff --git a/bin/rocmlibs/patches/powerinfer.patch b/bin/rocmlibs/patches/powerinfer.patch
index e755412e67..200b4ad5f0 100644
--- a/bin/rocmlibs/patches/powerinfer.patch
+++ b/bin/rocmlibs/patches/powerinfer.patch
@@ -4,7 +4,7 @@ index 4cf28d5..2cf69a1 100644
+++ b/flake.nix
@@ -103,7 +103,7 @@
# Build all targets supported by rocBLAS. When updating search for TARGET_LIST_ROCM
- # in github.com/ROCmSoftwarePlatform/rocBLAS/blob/develop/CMakeLists.txt
+ # in github.com/ROCm/rocBLAS/blob/develop/CMakeLists.txt
# and select the line that matches the current nixpkgs version of rocBLAS.
- "-DAMDGPU_TARGETS=gfx803;gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack+;gfx90a:xnack-;gfx940;gfx941;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102"
+ "-DAMDGPU_TARGETS=gfx90a:xnack+;gfx942;gfx1103;gfx1150"
diff --git a/bin/rocmlibs/patches/rccl.patch b/bin/rocmlibs/patches/rccl.patch
index 474095c608..8eeff62b48 100644
--- a/bin/rocmlibs/patches/rccl.patch
+++ b/bin/rocmlibs/patches/rccl.patch
@@ -1,89 +1,3 @@
-diff --git a/install.sh b/install.sh
-index 91915853..8130a38a 100755
---- a/install.sh
-+++ b/install.sh
-@@ -33,6 +33,9 @@ roctx_enabled=true
- run_tests=false
- run_tests_all=false
- time_trace=false
-+skip_cmake=false
-+source_dir="../../."
-+build_only=false
-
- # #################################################
- # helper functions
-@@ -52,6 +55,9 @@ function display_help()
- echo " -f|--fast Quick-build RCCL (local gpu arch only, no backtrace, and collective trace support)"
- echo " -h|--help Prints this help message"
- echo " -i|--install Install RCCL library (see --prefix argument below)"
-+ echo " --noinstall Run cmake and ninja but not install"
-+ echo " --nocmake Skip cmake and install from previous cmake and noinstall"
-+ echo " --source_dir Source directory: (default: ../../. assumes building from rccl/build subdirectory )"
- echo " -j|--jobs Specify how many parallel compilation jobs to run ($num_parallel_jobs by default)"
- echo " -l|--local_gpu_only Only compile for local GPU architecture"
- echo " --amdgpu_targets Only compile for specified GPU architecture(s). For multiple targets, separate by ';' (builds for all supported GPU architectures by default)"
-@@ -77,7 +83,7 @@ function display_help()
- # check if we have a modern version of getopt that can handle whitespace and long parameters
- getopt -T
- if [[ "$?" -eq 4 ]]; then
-- GETOPT_PARSE=$(getopt --name "${0}" --options dfhij:lprt --longoptions address-sanitizer,dependencies,debug,enable_backtrace,disable-colltrace,disable-msccl-kernel,disable-mscclpp,fast,help,install,jobs:,local_gpu_only,amdgpu_targets:,no_clean,npkit-enable,log-trace,openmp-test-enable,roctx-enable,package_build,prefix:,rm-legacy-include-dir,run_tests_all,run_tests_quick,static,tests_build,time-trace,verbose -- "$@")
-+ GETOPT_PARSE=$(getopt --name "${0}" --options dfhij:lprt --longoptions address-sanitizer,dependencies,debug,enable_backtrace,disable-colltrace,disable-msccl-kernel,disable-mscclpp,fast,help,install,noinstall,nocmake,jobs:,local_gpu_only,amdgpu_targets:,no_clean,npkit-enable,log-trace,openmp-test-enable,roctx-enable,package_build,prefix:,source_dir:,rm-legacy-include-dir,run_tests_all,run_tests_quick,static,tests_build,time-trace,verbose -- "$@")
- else
- echo "Need a new version of getopt"
- exit 1
-@@ -103,6 +109,9 @@ while true; do
- -f | --fast) build_local_gpu_only=true; collective_trace=false; msccl_kernel_enabled=false; shift ;;
- -h | --help) display_help; exit 0 ;;
- -i | --install) install_library=true; shift ;;
-+ --noinstall) install_library=false; build_only=true; shift ;;
-+ --nocmake) skip_cmake=true; shift ;;
-+ --source_dir) source_dir=${2}; shift 2 ;;
- -j | --jobs) num_parallel_jobs=${2}; shift 2 ;;
- -l | --local_gpu_only) build_local_gpu_only=true; shift ;;
- --amdgpu_targets) build_amdgpu_targets=${2}; shift 2 ;;
-@@ -192,6 +201,7 @@ if [[ "${build_release}" == true ]]; then
- else
- mkdir -p debug; cd debug
- fi
-+export build_dir=$PWD # for rccl-TimeTrace.sh
-
- # build type
- if [[ "${build_release}" == true ]]; then
-@@ -250,7 +260,7 @@ if [[ "${install_dependencies}" == true ]]; then
- fi
-
- # Install RCCL library
--if [[ "${install_library}" == true ]]; then
-+if [[ "${install_library}" == true ]] || [[ "${build_only}" == true ]]; then
- cmake_common_options="${cmake_common_options} -DCMAKE_INSTALL_PREFIX=${install_prefix}"
- fi
-
-@@ -403,11 +413,14 @@ if [[ "${build_tests}" == true ]] || ([[ "${run_tests}" == true ]] && [[ ! -x ./
- cmake_common_options="${cmake_common_options} -DBUILD_TESTS=ON"
- fi
-
-+if [[ "${skip_cmake}" == false ]]; then
- # Initiate RCCL CMake
- # Passing NPKIT_FLAGS separately (not as part of ${cmake_common_options}) as
- # ${npkit_options} need to be passed "as-is" i.e. with `-D` to CMakeLists.txt
--${cmake_executable} ${cmake_common_options} -DNPKIT_FLAGS="${npkit_options}" -DONLY_FUNCS="${ONLY_FUNCS}" ../../.
--check_exit_code "$?"
-+ echo ${cmake_executable} ${cmake_common_options} -DNPKIT_FLAGS="${npkit_options}" -DONLY_FUNCS="${ONLY_FUNCS}" $source_dir
-+ ${cmake_executable} ${cmake_common_options} -DNPKIT_FLAGS="${npkit_options}" -DONLY_FUNCS="${ONLY_FUNCS}" $source_dir
-+ check_exit_code "$?"
-+fi
-
- # Enable verbose output from Makefile
- if [[ "${build_verbose}" == true ]]; then
-@@ -444,7 +457,7 @@ fi
-
- # Generate time trace for RCCL build using tools/time-trace
- if [[ "${time_trace}" == true ]]; then
-- search_dir="../../tools"
-+ search_dir="$source_dir/tools"
- time_trace_dir=$(find "${search_dir}" -type d -name "time-trace" -print -quit)
-
- if [[ -n "${time_trace_dir}" ]]; then
diff --git a/tools/time-trace/rccl-TimeTrace.sh b/tools/time-trace/rccl-TimeTrace.sh
index 7f0dee6f..765b40b3 100755
--- a/tools/time-trace/rccl-TimeTrace.sh
diff --git a/bin/rocmlibs/patches/rocblas.patch b/bin/rocmlibs/patches/rocblas.patch
index 1d21acd746..13855479c6 100644
--- a/bin/rocmlibs/patches/rocblas.patch
+++ b/bin/rocmlibs/patches/rocblas.patch
@@ -1,21 +1,43 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 2cb3b303..ad442656 100644
+index 2e5638682..6d3a067cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -112,7 +112,7 @@ if (NOT BUILD_ADDRESS_SANITIZER)
- set( TARGET_LIST_ROCM_5.6 "gfx803;gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack+;gfx90a:xnack-;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102")
- set( TARGET_LIST_ROCM_5.7 "gfx803;gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack+;gfx90a:xnack-;gfx940;gfx941;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102")
- set( TARGET_LIST_ROCM_6.0 "gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack+;gfx90a:xnack-;gfx940;gfx941;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102")
-- set( TARGET_LIST_ROCM_6.3 "gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201")
-+ set( TARGET_LIST_ROCM_6.3 "gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201;gfx1103;gfx90c")
+@@ -85,7 +85,7 @@ if (NOT BUILD_ADDRESS_SANITIZER)
+ set( TARGET_LIST_ROCM_6.0 "gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack+;gfx90a:xnack-;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102")
+ set( TARGET_LIST_ROCM_6.3 "gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201")
+ set( TARGET_LIST_ROCM_7.0 "gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a;gfx942;gfx950;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201")
+- set( TARGET_LIST_ROCM_7.1 "gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a;gfx942;gfx950;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1200;gfx1201")
++ set( TARGET_LIST_ROCM_7.1 "gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a;gfx90c;gfx942;gfx950;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1200;gfx1201")
else()
set( TARGET_LIST_ROCM_5.6 "gfx908:xnack+;gfx90a:xnack+")
set( TARGET_LIST_ROCM_5.7 "gfx908:xnack+;gfx90a:xnack+;gfx942:xnack+")
+diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
+index e39c61926..c48ba9b0d 100644
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -87,7 +87,7 @@ function( rocblas_library_settings lib_target_ )
+ set(ROCTX_PATH "" CACHE STRING "Path to the roctx library (directory containing libroctx64.so)")
+
+ find_path(ROCTRACER_INCLUDE_DIR
+- NAMES roctracer/roctx.h
++ NAMES rocprofiler-sdk-roctx/roctx.h
+ HINTS
+ ${ROCTX_PATH}
+ ${ROCTX_PATH}/include
+@@ -96,7 +96,7 @@ function( rocblas_library_settings lib_target_ )
+ DOC "Path to the roctracer include directory containing roctx.h")
+
+ find_library(ROCTX_LIBRARY
+- NAMES roctx64
++ NAMES rocprofiler-sdk-roctx
+ HINTS
+ ${ROCTX_PATH} # User-provided path
+ ${ROCTX_PATH}/lib
diff --git a/library/src/handle.cpp b/library/src/handle.cpp
-index ea1fa1a7..7d2a05c3 100644
+index 7731691ff..4585a58ea 100644
--- a/library/src/handle.cpp
+++ b/library/src/handle.cpp
-@@ -106,6 +106,10 @@ static Processor getActiveArch(int deviceId)
+@@ -255,6 +255,10 @@ Processor _rocblas_handle::getActiveArch()
{
return Processor::gfx90a;
}
@@ -23,50 +45,39 @@ index ea1fa1a7..7d2a05c3 100644
+ {
+ return Processor::gfx90c;
+ }
- else if(deviceString.find("gfx940") != std::string::npos)
- {
- return Processor::gfx940;
-@@ -146,6 +150,14 @@ static Processor getActiveArch(int deviceId)
- {
- return Processor::gfx1102;
- }
-+ else if(deviceString.find("gfx1103") != std::string::npos)
-+ {
-+ return Processor::gfx1103;
-+ }
-+ else if(deviceString.find("gfx1150") != std::string::npos)
-+ {
-+ return Processor::gfx1150;
-+ }
- else if(deviceString.find("gfx1151") != std::string::npos)
+ else if(deviceString.find("gfx942") != std::string::npos)
{
- return Processor::gfx1151;
+ return Processor::gfx942;
diff --git a/library/src/include/handle.hpp b/library/src/include/handle.hpp
-index 70844136..6532c78e 100644
+index f0668632f..a8fe57e75 100644
--- a/library/src/include/handle.hpp
+++ b/library/src/include/handle.hpp
-@@ -82,6 +82,7 @@ enum class Processor : int
+@@ -75,6 +75,7 @@ enum class Processor : int
gfx906 = 906,
gfx908 = 908,
gfx90a = 910,
+ gfx90c = 912,
- gfx940 = 940,
- gfx941 = 941,
gfx942 = 942,
-@@ -96,6 +97,8 @@ enum class Processor : int
- gfx1100 = 1100,
- gfx1101 = 1101,
- gfx1102 = 1102,
-+ gfx1103 = 1103,
-+ gfx1150 = 1150,
- gfx1151 = 1151,
- gfx1200 = 1200,
- gfx1201 = 1201
+ gfx950 = 950,
+ gfx1010 = 1010,
+diff --git a/library/src/logging.cpp b/library/src/logging.cpp
+index 20b5d244c..d673bd93e 100644
+--- a/library/src/logging.cpp
++++ b/library/src/logging.cpp
+@@ -24,7 +24,7 @@
+
+ #ifndef DISABLE_ROCTX
+ #if !defined(ROCBLAS_STATIC_LIB) && !defined(WIN32)
+-#include
++#include
+ #endif
+ #endif
+
diff --git a/library/src/tensile_host.cpp b/library/src/tensile_host.cpp
-index f7d4bdb1..47d69c0d 100644
+index b0e72cc3d..f1b5ed8d3 100644
--- a/library/src/tensile_host.cpp
+++ b/library/src/tensile_host.cpp
-@@ -271,6 +271,10 @@ namespace
+@@ -257,6 +257,10 @@ namespace
{
return Tensile::LazyLoadingInit::gfx90a;
}
@@ -74,17 +85,6 @@ index f7d4bdb1..47d69c0d 100644
+ {
+ return Tensile::LazyLoadingInit::gfx90c;
+ }
- else if(deviceString.find("gfx940") != std::string::npos)
+ else if(deviceString.find("gfx942") != std::string::npos)
{
- return Tensile::LazyLoadingInit::gfx940;
-@@ -311,6 +315,10 @@ namespace
- {
- return Tensile::LazyLoadingInit::gfx1102;
- }
-+ else if(deviceString.find("gfx1103") != std::string::npos)
-+ {
-+ return Tensile::LazyLoadingInit::gfx1103;
-+ }
- return Tensile::LazyLoadingInit::None;
- }
-
+ return Tensile::LazyLoadingInit::gfx942;
diff --git a/bin/rocmlibs/patches/rocprim.patch b/bin/rocmlibs/patches/rocprim.patch
index ac0be44c7c..edfaf41510 100644
--- a/bin/rocmlibs/patches/rocprim.patch
+++ b/bin/rocmlibs/patches/rocprim.patch
@@ -1,13 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index c20fe2be..ac188607 100644
+index 20999f18..f59df162 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -134,7 +134,7 @@ else()
+@@ -162,7 +162,7 @@ else()
)
else()
rocm_check_target_ids(DEFAULT_AMDGPU_TARGETS
-- TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201"
-+ TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1200;gfx1201"
+- TARGETS "gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201"
++ TARGETS "gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1103;gfx1151;gfx1200;gfx1201"
)
endif()
-
+ set(GPU_TARGETS "${DEFAULT_AMDGPU_TARGETS}" CACHE STRING "GPU architectures to compile for" FORCE)
diff --git a/bin/rocmlibs/patches/rocsolver.patch b/bin/rocmlibs/patches/rocsolver.patch
index 897d157ab1..9d03664560 100644
--- a/bin/rocmlibs/patches/rocsolver.patch
+++ b/bin/rocmlibs/patches/rocsolver.patch
@@ -1,13 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index d8e7774..2641b7d 100644
+index 279eb6c..06e91a9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -174,6 +174,8 @@ if(NOT DEFINED AMDGPU_TARGETS)
- gfx1100
- gfx1101
- gfx1102
-+ gfx1103
-+ gfx1150
- gfx1151
- gfx1200
- gfx1201)
+@@ -188,6 +188,8 @@ else()
+ gfx1100
+ gfx1101
+ gfx1102
++ gfx1103
++ gfx1150
+ gfx1151
+ gfx12-generic
+ )
diff --git a/bin/rocmlibs/patches/rocsparse.patch b/bin/rocmlibs/patches/rocsparse.patch
index a3e5e84737..7d59c711e2 100644
--- a/bin/rocmlibs/patches/rocsparse.patch
+++ b/bin/rocmlibs/patches/rocsparse.patch
@@ -1,13 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 5e268039..58fd679b 100644
+index 392c9241..f734ee63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -162,7 +162,7 @@ if(COMMAND rocm_check_target_ids)
+@@ -172,7 +172,7 @@ if(COMMAND rocm_check_target_ids)
TARGETS "gfx908:xnack+;gfx90a:xnack+;gfx942:xnack+")
else()
rocm_check_target_ids(DEFAULT_GPU_TARGETS
-- TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201")
-+ TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151;gfx1200;gfx1201")
+- TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201")
++ TARGETS "gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx950;gfx1030;gfx1100;gfx1101;gfx1102;gfx1103;gfx1151;gfx1200;gfx1201")
endif()
else()
# Use target ID syntax if supported for GPU_TARGETS
diff --git a/bin/rocmlibs/patches/tensile.patch b/bin/rocmlibs/patches/tensile.patch
index 6b1a09a9e3..83fc0b5d2c 100644
--- a/bin/rocmlibs/patches/tensile.patch
+++ b/bin/rocmlibs/patches/tensile.patch
@@ -1,118 +1,21 @@
-diff --git a/Tensile/AsmCaps.py b/Tensile/AsmCaps.py
-index 548b31f2..09adb3ef 100644
---- a/Tensile/AsmCaps.py
-+++ b/Tensile/AsmCaps.py
-@@ -771,6 +771,94 @@ CACHED_ASM_CAPS = \
- 'v_mov_b64': False,
- 'v_pk_fma_f16': True,
- 'v_pk_fmac_f16': False},
-+ (11, 0, 3): {'HasAddLshl': True,
-+ 'HasAtomicAdd': True,
-+ 'HasDirectToLdsDest': False,
-+ 'HasDirectToLdsNoDest': False,
-+ 'HasExplicitCO': True,
-+ 'HasExplicitNC': True,
-+ 'HasGLCModifier': True,
-+ 'HasNTModifier': False,
-+ 'HasLshlOr': True,
-+ 'HasMFMA': False,
-+ 'HasMFMA_b8': False,
-+ 'HasMFMA_bf16_1k': False,
-+ 'HasMFMA_bf16_original': False,
-+ 'HasMFMA_constSrc': False,
-+ 'HasMFMA_f64': False,
-+ 'HasMFMA_f8': False,
-+ 'HasMFMA_i8_908': False,
-+ 'HasMFMA_i8_940': False,
-+ 'HasMFMA_vgpr': False,
-+ 'HasMFMA_xf32': False,
-+ 'HasSMulHi': True,
-+ 'HasWMMA': True,
-+ 'KernargPreloading': False,
-+ 'MaxLgkmcnt': 15,
-+ 'MaxVmcnt': 63,
-+ 'SupportedISA': True,
-+ 'SupportedSource': True,
-+ 'VOP3v_dot4_i32_i8': False,
-+ 'v_dot2_f32_f16': True,
-+ 'v_dot2c_f32_f16': True,
-+ 'v_dot4_i32_i8': False,
-+ 'v_dot4c_i32_i8': False,
-+ 'v_fma_f16': True,
-+ 'v_fma_f32': True,
-+ 'v_fma_f64': True,
-+ 'v_fma_mix_f32': True,
-+ 'v_fmac_f16': False,
-+ 'v_fmac_f32': True,
-+ 'v_mac_f16': False,
-+ 'v_mac_f32': False,
-+ 'v_mad_mix_f32': False,
-+ 'v_mov_b64': False,
-+ 'v_pk_fma_f16': True,
-+ 'v_pk_fmac_f16': False},
-+ (11, 5, 0): {'HasAddLshl': True,
-+ 'HasAtomicAdd': True,
-+ 'HasDirectToLdsDest': False,
-+ 'HasDirectToLdsNoDest': False,
-+ 'HasExplicitCO': True,
-+ 'HasExplicitNC': True,
-+ 'HasGLCModifier': True,
-+ 'HasNTModifier': False,
-+ 'HasLshlOr': True,
-+ 'HasMFMA': False,
-+ 'HasMFMA_b8': False,
-+ 'HasMFMA_bf16_1k': False,
-+ 'HasMFMA_bf16_original': False,
-+ 'HasMFMA_constSrc': False,
-+ 'HasMFMA_f64': False,
-+ 'HasMFMA_f8': False,
-+ 'HasMFMA_i8_908': False,
-+ 'HasMFMA_i8_940': False,
-+ 'HasMFMA_vgpr': False,
-+ 'HasMFMA_xf32': False,
-+ 'HasSMulHi': True,
-+ 'HasWMMA': True,
-+ 'KernargPreloading': False,
-+ 'MaxLgkmcnt': 15,
-+ 'MaxVmcnt': 63,
-+ 'SupportedISA': True,
-+ 'SupportedSource': True,
-+ 'VOP3v_dot4_i32_i8': False,
-+ 'v_dot2_f32_f16': True,
-+ 'v_dot2c_f32_f16': True,
-+ 'v_dot4_i32_i8': False,
-+ 'v_dot4c_i32_i8': False,
-+ 'v_fma_f16': True,
-+ 'v_fma_f32': True,
-+ 'v_fma_f64': True,
-+ 'v_fma_mix_f32': True,
-+ 'v_fmac_f16': False,
-+ 'v_fmac_f32': True,
-+ 'v_mac_f16': False,
-+ 'v_mac_f32': False,
-+ 'v_mad_mix_f32': False,
-+ 'v_mov_b64': False,
-+ 'v_pk_fma_f16': True,
-+ 'v_pk_fmac_f16': False},
- (11, 5, 1): {'HasAddLshl': True,
- 'HasAtomicAdd': True,
- 'HasDirectToLdsDest': False,
+diff --git a/Tensile/Code.py b/Tensile/Code.py
+index eefccff..da321cd 100644
+--- a/Tensile/Code.py
++++ b/Tensile/Code.py
+@@ -632,7 +632,7 @@ class MacInst (Inst):
+ cStr = "v[%s+%u+%u*%u]" % ("vgprValuC", self.aIdx, self.bIdx, self.kernel["ThreadTile0"])
+ aStr = "v[%s+%u]" % ("vgprValuA_X%u_I%u"%(self.PLR,iui), self.aIdx)
+ bStr = "v[%s+%u]" % ("vgprValuB_X%u_I%u"%(self.PLR,iui), self.bIdx)
+- kStr += "v_dot4_i32_i8 %s, %s, %s, %s op_sel:[0,0] op_sel_hi:[1,1] //valuC[%u]%s" % (cStr, aStr, bStr, cStr, cidx, self.endLine)
++ kStr += "v_dot4_i32_i8 %s, %s, %s, %s //valuC[%u]%s" % (cStr, aStr, bStr, cStr, cidx, self.endLine)
+ # single precision
+ elif self.kernel["ProblemType"]["DataType"].isSingle():
+ for iui in range(0, self.innerUnroll):
diff --git a/Tensile/Common.py b/Tensile/Common.py
-index 410c8365..a9f64c47 100644
+index 86c6c57..376afc4 100644
--- a/Tensile/Common.py
+++ b/Tensile/Common.py
-@@ -246,8 +246,8 @@ globalParameters["SupportedISA"] = [(8,0,3),
- (9,0,0), (9,0,6), (9,0,8), (9,0,10),
- (9,4,0), (9,4,1), (9,4,2),
- (10,1,0), (10,1,1), (10,1,2), (10,3,0), (10,3,1),
-- (11,0,0), (11,0,1), (11,0,2),
-- (11,5,1),
-+ (11,0,0), (11,0,1), (11,0,2), (11,0,3),
-+ (11,5,0), (11,5,1),
- (12,0,0), (12,0,1)] # assembly kernels writer supports these architectures
-
- globalParameters["KeepBuildTmp"] = True # Do not remove build artifacts during the build process or build_tmp after build completes
-@@ -305,7 +305,7 @@ globalParameters["SeparateArchitectures"] = False # write Tensile library metada
+@@ -307,7 +307,7 @@ globalParameters["SeparateArchitectures"] = False # write Tensile library metada
globalParameters["LazyLibraryLoading"] = False # Load library and code object files when needed instead of at startup
@@ -121,35 +24,21 @@ index 410c8365..a9f64c47 100644
globalParameters["ExperimentalLogicDir"] = "/experimental/"
-@@ -323,8 +323,8 @@ architectureMap = {
- 'gfx942':'aquavanjaram942', 'gfx942:xnack+':'aquavanjaram942', 'gfx942:xnack-':'aquavanjaram942',
- 'gfx1010':'navi10', 'gfx1011':'navi12', 'gfx1012':'navi14',
- 'gfx1030':'navi21', 'gfx1031':'navi22', 'gfx1032':'navi23', 'gfx1034':'navi24', 'gfx1035':'rembrandt',
-- 'gfx1100':'navi31', 'gfx1101':'navi32', 'gfx1102':'navi33',
-- 'gfx1151':'gfx1151',
-+ 'gfx1100':'navi31', 'gfx1101':'navi32', 'gfx1102':'navi33', 'gfx1103':'phoenix',
-+ 'gfx1150':'gfx1150', 'gfx1151':'gfx1151',
- 'gfx1200':'gfx1200',
- 'gfx1201':'gfx1201'
- }
-diff --git a/Tensile/Source/CMakeLists.txt b/Tensile/Source/CMakeLists.txt
-index e02b209a..4d13ade3 100644
---- a/Tensile/Source/CMakeLists.txt
-+++ b/Tensile/Source/CMakeLists.txt
-@@ -51,9 +51,9 @@ if(CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" OR CMAKE_CXX_COMPILER MATCHES ".*clang
- endif()
-
- if(CMAKE_CXX_COMPILER STREQUAL "hipcc")
-- set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 gfx1035 gfx1100 gfx1101 gfx1102 CACHE STRING "GPU architectures")
-+ set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906:xnack- gfx908:xnack- gfx90a:xnack- gfx90c gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 gfx1035 gfx1100 gfx1101 gfx1102 gfx1103 CACHE STRING "GPU architectures")
- else()
-- set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906 gfx908 gfx90a gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 gfx1035 gfx1100 gfx1101 gfx1102 CACHE STRING "GPU architectures")
-+ set(TENSILE_GPU_ARCHS gfx803 gfx900 gfx906 gfx908 gfx90a gfx90c gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 gfx1035 gfx1100 gfx1101 gfx1102 gfx1103 CACHE STRING "GPU architectures")
- endif()
+diff --git a/Tensile/Components/MAC_I8X4.py b/Tensile/Components/MAC_I8X4.py
+index 72cf802..e8bb772 100644
+--- a/Tensile/Components/MAC_I8X4.py
++++ b/Tensile/Components/MAC_I8X4.py
+@@ -49,7 +49,7 @@ class MAC_I8X4_Plain(MAC):
+ vars["cStr"] = "v[vgprValuC+{a}+{b}*{ThreadTile0}]".format_map(vars)
+ vars["aStr"] = "v[vgprValuA_X{m}_I{iui}+{a}]".format_map(vars)
+ vars["bStr"] = "v[vgprValuB_X{m}_I{iui}+{b}]".format_map(vars)
+- kStr += "v_dot4_i32_i8 {cStr}, {aStr}, {bStr}, {cStr} op_sel:[0,0] op_sel_hi:[1,1] //valuC[{cidx}]{endLine}".format_map(vars)
++ kStr += "v_dot4_i32_i8 {cStr}, {aStr}, {bStr}, {cStr} //valuC[{cidx}]{endLine}".format_map(vars)
+ kStr += priority(writer, 1, "Raise priority while processing macs")
- include(CMakeDependentOption)
+ kStr += priority(writer, 0, "Reset priority after macs")
diff --git a/Tensile/Source/lib/include/Tensile/AMDGPU.hpp b/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
-index 0ab8ced5..0d7a5930 100644
+index 317250d..66eb533 100644
--- a/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
+++ b/Tensile/Source/lib/include/Tensile/AMDGPU.hpp
@@ -60,6 +60,7 @@ namespace Tensile
@@ -157,38 +46,19 @@ index 0ab8ced5..0d7a5930 100644
gfx908 = 908,
gfx90a = 910,
+ gfx90c = 912,
- gfx940 = 940,
- gfx941 = 941,
gfx942 = 942,
-@@ -73,7 +74,8 @@ namespace Tensile
- gfx1035 = 1035,
- gfx1100 = 1100,
- gfx1101 = 1101,
-- gfx1102 = 1102
-+ gfx1102 = 1102,
-+ gfx1103 = 1103
- };
-
- static std::string toString(Processor p)
-@@ -90,6 +92,8 @@ namespace Tensile
+ gfx950 = 950,
+ gfx1010 = 1010,
+@@ -94,6 +95,8 @@ namespace Tensile
return "gfx908";
case AMDGPU::Processor::gfx90a:
return "gfx90a";
+ case AMDGPU::Processor::gfx90c:
+ return "gfx90c";
- case AMDGPU::Processor::gfx940:
- return "gfx940";
- case AMDGPU::Processor::gfx941:
-@@ -118,6 +122,8 @@ namespace Tensile
- return "gfx1101";
- case AMDGPU::Processor::gfx1102:
- return "gfx1102";
-+ case AMDGPU::Processor::gfx1103:
-+ return "gfx1103";
- }
- return "";
- }
-@@ -144,6 +150,10 @@ namespace Tensile
+ case AMDGPU::Processor::gfx942:
+ return "gfx942";
+ case AMDGPU::Processor::gfx950:
+@@ -156,6 +159,10 @@ namespace Tensile
{
return AMDGPU::Processor::gfx90a;
}
@@ -196,22 +66,11 @@ index 0ab8ced5..0d7a5930 100644
+ {
+ return AMDGPU::Processor::gfx90c;
+ }
- else if(deviceString.find("gfx940") != std::string::npos)
- {
- return AMDGPU::Processor::gfx940;
-@@ -184,6 +194,10 @@ namespace Tensile
+ else if(deviceString.find("gfx942") != std::string::npos)
{
- return AMDGPU::Processor::gfx1102;
- }
-+ else if(deviceString.find("gfx1103") != std::string::npos)
-+ {
-+ return AMDGPU::Processor::gfx1103;
-+ }
- else
- {
- return static_cast(0);
+ return AMDGPU::Processor::gfx942;
diff --git a/Tensile/Source/lib/include/Tensile/PlaceholderLibrary.hpp b/Tensile/Source/lib/include/Tensile/PlaceholderLibrary.hpp
-index 10898ec2..f6b5305e 100644
+index a21e584..c941f83 100644
--- a/Tensile/Source/lib/include/Tensile/PlaceholderLibrary.hpp
+++ b/Tensile/Source/lib/include/Tensile/PlaceholderLibrary.hpp
@@ -44,6 +44,7 @@ namespace Tensile
@@ -219,60 +78,35 @@ index 10898ec2..f6b5305e 100644
gfx908,
gfx90a,
+ gfx90c,
- gfx940,
- gfx941,
gfx942,
-@@ -58,6 +59,7 @@ namespace Tensile
- gfx1100,
- gfx1101,
- gfx1102,
-+ gfx1103,
- All
- };
-
-@@ -78,6 +80,8 @@ namespace Tensile
+ gfx950,
+ gfx1010,
+@@ -82,6 +83,8 @@ namespace Tensile
return "TensileLibrary_*_gfx908";
case LazyLoadingInit::gfx90a:
return "TensileLibrary_*_gfx90a";
+ case LazyLoadingInit::gfx90c:
+ return "TensileLibrary_*_gfx90c";
- case LazyLoadingInit::gfx940:
- return "TensileLibrary_*_gfx940";
- case LazyLoadingInit::gfx941:
-@@ -106,6 +110,8 @@ namespace Tensile
- return "TensileLibrary_*_gfx1101";
- case LazyLoadingInit::gfx1102:
- return "TensileLibrary_*_gfx1102";
-+ case LazyLoadingInit::gfx1103:
-+ return "TensileLibrary_*_gfx1103";
- case LazyLoadingInit::None:
- return "";
- }
+ case LazyLoadingInit::gfx942:
+ return "TensileLibrary_*_gfx942";
+ case LazyLoadingInit::gfx950:
diff --git a/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp b/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
-index 87fc0d24..f0c7fef4 100644
+index 361a0e1..b8b4172 100644
--- a/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
+++ b/Tensile/Source/lib/include/Tensile/Serialization/Predicates.hpp
-@@ -218,6 +218,7 @@ namespace Tensile
+@@ -220,6 +220,7 @@ namespace Tensile
iot::enumCase(io, value, "gfx906", AMDGPU::Processor::gfx906);
iot::enumCase(io, value, "gfx908", AMDGPU::Processor::gfx908);
iot::enumCase(io, value, "gfx90a", AMDGPU::Processor::gfx90a);
+ iot::enumCase(io, value, "gfx90c", AMDGPU::Processor::gfx90c);
- iot::enumCase(io, value, "gfx940", AMDGPU::Processor::gfx940);
- iot::enumCase(io, value, "gfx941", AMDGPU::Processor::gfx941);
iot::enumCase(io, value, "gfx942", AMDGPU::Processor::gfx942);
-@@ -232,6 +233,7 @@ namespace Tensile
- iot::enumCase(io, value, "gfx1100", AMDGPU::Processor::gfx1100);
- iot::enumCase(io, value, "gfx1101", AMDGPU::Processor::gfx1101);
- iot::enumCase(io, value, "gfx1102", AMDGPU::Processor::gfx1102);
-+ iot::enumCase(io, value, "gfx1103", AMDGPU::Processor::gfx1103);
- }
- };
-
+ iot::enumCase(io, value, "gfx950", AMDGPU::Processor::gfx950);
+ iot::enumCase(io, value, "gfx1010", AMDGPU::Processor::gfx1010);
diff --git a/Tensile/TensileCreateLib/ParseArguments.py b/Tensile/TensileCreateLib/ParseArguments.py
-index 6970caba..5dc6406c 100644
+index f19dab1..be76194 100644
--- a/Tensile/TensileCreateLib/ParseArguments.py
+++ b/Tensile/TensileCreateLib/ParseArguments.py
-@@ -239,7 +239,7 @@ def parseArguments(input: Optional[List[str]] = None) -> Dict[str, Any]:
+@@ -259,7 +259,7 @@ def parseArguments(input: Optional[List[str]] = None) -> Dict[str, Any]:
"--ignore-asm-cap-cache",
dest="IgnoreAsmCapCache",
action="store_true",
@@ -282,20 +116,20 @@ index 6970caba..5dc6406c 100644
)
parser.add_argument(
diff --git a/docs/src/cli-reference/tensile-create-library-cli.rst b/docs/src/cli-reference/tensile-create-library-cli.rst
-index 7b8f29e0..d4a66577 100644
+index 4826f94..78ec17c 100644
--- a/docs/src/cli-reference/tensile-create-library-cli.rst
+++ b/docs/src/cli-reference/tensile-create-library-cli.rst
-@@ -56,7 +56,7 @@ Here is the list of optional arguments for invoking the ``TensileCreateLibrary``
+@@ -54,7 +54,7 @@ Here is the list of optional arguments for invoking the ``TensileCreateLibrary``
+ - Architectures to generate a library for. When specifying multiple options, use quoted and semicolon-delimited
+ architectures such as \-\-architecture='gfx908;gfx1012'.
Supported architectures include: all; gfx000; gfx803; gfx900; gfx900:xnack-; gfx906; gfx906:xnack+; gfx906:xnack-; gfx908; gfx908:xnack+;
- gfx908:xnack-; gfx90a; gfx90a:xnack+; gfx90a:xnack-; gfx940; gfx940:xnack+; gfx940:xnack-; gfx941; gfx941:xnack+;
+- gfx908:xnack-; gfx90a; gfx90a:xnack+; gfx90a:xnack-; gfx940; gfx940:xnack+; gfx940:xnack-; gfx941; gfx941:xnack+;
++ gfx908:xnack-; gfx90a; gfx90a:xnack+; gfx90a:xnack-; gfx90c; gfx940; gfx940:xnack+; gfx940:xnack-; gfx941; gfx941:xnack+;
gfx941:xnack-; gfx942; gfx942:xnack+; gfx942:xnack-; gfx1010; gfx1011; gfx1012; gfx1030; gfx1031; gfx1032; gfx1034; gfx1035;
-- gfx1100; gfx1101; gfx1102.
-+ gfx1100; gfx1101; gfx1102; gfx1103; gfx1150;
+ gfx1100; gfx1101; gfx1102; gfx1103; gfx1150; gfx1151; gfx1200; gfx1201.
- * - \-\-build-client
- - Builds Tensile client executable that is used for stand alone benchmarking. This option is set by default.
diff --git a/pytest.ini b/pytest.ini
-index 13c43039..70ed7a3c 100644
+index 93384c4..13d9e05 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -92,6 +92,7 @@ markers =
@@ -306,13 +140,7 @@ index 13c43039..70ed7a3c 100644
xfail-gfx940: architecture
xfail-gfx941: architecture
xfail-gfx942: architecture
-@@ -106,11 +107,13 @@ markers =
- xfail-gfx1100: architecture
- xfail-gfx1101: architecture
- xfail-gfx1102: architecture
-+ xfail-gfx1103: architecture
- skip-gfx000: architecture
- skip-gfx900: architecture
+@@ -115,6 +116,7 @@ markers =
skip-gfx906: architecture
skip-gfx908: architecture
skip-gfx90a: architecture
@@ -320,10 +148,3 @@ index 13c43039..70ed7a3c 100644
skip-gfx940: architecture
skip-gfx941: architecture
skip-gfx942: architecture
-@@ -125,4 +128,6 @@ markers =
- skip-gfx1100: architecture
- skip-gfx1101: architecture
- skip-gfx1102: architecture
-+ skip-gfx1103: architecture
-+ skip-gfx1150: architecture
- skip-gfx1151: architecture
diff --git a/bin/rocmlibs/rocmlibs.xml b/bin/rocmlibs/rocmlibs.xml
index f54bd63493..97dcffa51f 100644
--- a/bin/rocmlibs/rocmlibs.xml
+++ b/bin/rocmlibs/rocmlibs.xml
@@ -3,31 +3,31 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/bin/rocmlibs/test_powerinfer.sh b/bin/rocmlibs/test_powerinfer.sh
index 6cd011fd41..ef3adba407 100755
--- a/bin/rocmlibs/test_powerinfer.sh
+++ b/bin/rocmlibs/test_powerinfer.sh
@@ -1,4 +1,9 @@
#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
#
# test_powerinfer.sh: Script to test powerinfer installation with various models
#
diff --git a/bin/run_OpenMP_VV.sh b/bin/run_OpenMP_VV.sh
index 91d7ac485e..a417501e49 100755
--- a/bin/run_OpenMP_VV.sh
+++ b/bin/run_OpenMP_VV.sh
@@ -1,5 +1,10 @@
#!/bin/bash
#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
+#
# run_openmpvv.sh:
# Script for running the OpenMP_VV suite found at
# https://github.com/OpenMP-Validation-and-Verification/OpenMP_VV
@@ -208,8 +213,21 @@ if [ "${make_target}" != "all" ]; then
elif [ "${testcase_omp_version}" == "4.5" ]; then
export openmpvv_compile_flags="${openmpvv_compile_flags} -fopenmp-version=45"
fi
+
+ if gpu_needs_xnack_for_usm "${AOMP_GPU}" && ! is_apu && [ "${HSA_XNACK}" == "" ]; then
+ export HSA_XNACK=1
+ enable_xnack=1
+ echo "Turning on HSA_XNACK=1 to allow USM tests to pass."
+ fi
+
+ # Perform single-test make and run
perform_make OMP_VERSION="${testcase_omp_version}" SOURCES="${testcase}"
rc=$?
+
+ if [ "${enable_xnack}" == 1 ]; then
+ unset HSA_XNACK
+ fi
+
echo
echo "DONE: Single OPENMP_VV test case: ${testcase}"
echo " Source file: ${testcase_file_path}"
diff --git a/bin/run_RSBench.sh b/bin/run_RSBench.sh
index 1d176e23ab..e8ada16342 100755
--- a/bin/run_RSBench.sh
+++ b/bin/run_RSBench.sh
@@ -37,8 +37,14 @@ echo RUN_OPTIONS: $RUN_OPTIONS
for option in $RUN_OPTIONS; do
if [ "$option" == "openmp" ]; then
cd openmp-offload
+ # Update Makefile with detected GPU architecture
+ if [ -f Makefile ]; then
+ sed -i "s/-fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx[0-9a-zA-Z]*/--offload-arch=$AOMP_GPU/g" Makefile
+ echo "Updated Makefile: --offload-arch=$AOMP_GPU"
+ fi
make clean
export PATH=$AOMP/bin:$PATH
+ export LD_LIBRARY_PATH=$AOMP/lib:$LD_LIBRARY_PATH
make COMPILER=amd
if [ $? -ne 1 ]; then
./rsbench -m event 2>&1 | tee -a results.txt
diff --git a/bin/run_XSBench.sh b/bin/run_XSBench.sh
index bc2b99487f..110094943e 100755
--- a/bin/run_XSBench.sh
+++ b/bin/run_XSBench.sh
@@ -37,8 +37,14 @@ echo RUN_OPTIONS: $RUN_OPTIONS
for option in $RUN_OPTIONS; do
if [ "$option" == "openmp" ]; then
cd openmp-offload
+ # Update Makefile with detected GPU architecture
+ if [ -f Makefile ]; then
+ sed -i "s/-fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx[0-9a-zA-Z]*/--offload-arch=$AOMP_GPU/g" Makefile
+ echo "Updated Makefile: --offload-arch=$AOMP_GPU"
+ fi
make clean
export PATH=$AOMP/bin:$PATH
+ export LD_LIBRARY_PATH=$AOMP/lib:$LD_LIBRARY_PATH
make COMPILER=amd
if [ $? -ne 1 ]; then
./XSBench -m event 2>&1 | tee -a results.txt
@@ -46,6 +52,13 @@ for option in $RUN_OPTIONS; do
cd ..
elif [ "$option" == "hip" ]; then
cd hip
+ # Add missing #include to source files if not present
+ for srcfile in io.cpp Materials.cpp; do
+ if [ -f $srcfile ] && ! grep -q '#include ' $srcfile; then
+ sed -i '1i #include ' $srcfile
+ echo "Added #include to $srcfile"
+ fi
+ done
make clean
export PATH=$AOMP/bin:$PATH
make
diff --git a/bin/run_accel2023.sh b/bin/run_accel2023.sh
index f6019e8a19..5ab8dd5e61 100755
--- a/bin/run_accel2023.sh
+++ b/bin/run_accel2023.sh
@@ -1,4 +1,9 @@
#! /usr/bin/env bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
# ACCEL2023_SOURCE_DIR where to clone sources to. Default: AOMP_REPOS_TEST
# ACCEL2023_BUILD_NUM_THREADS Number of parallel compile processes. Default: 32
@@ -20,7 +25,7 @@ if [ "$1" == "-clean" ]; then
cd ${ACCEL2023_SOURCE_DIR} || exit 1
set -x
#WLOC=http://roclogin.amd.com/SPEC
- WLOC=http://aomp-tr01.amd.com/SPEC
+ WLOC=https://compute-artifactory.amd.com/artifactory/rocm-generic-local/compiler-infra
wget --timeout 15 --tries=3 -q $WLOC/accel2023-2.0.18.tar.xz
wget --timeout 15 --tries=3 -q $WLOC/Accel23-scripts.tar
tar xf accel2023-2.0.18.tar.xz
@@ -30,6 +35,6 @@ if [ "$1" == "-clean" ]; then
else
cd ${ACCEL2023_SOURCE_DIR} || exit 1
fi
-export PATH=$AOMP/../bin:$AOMP/../../bin:$PATH
+export PATH=$HOME/openmp-utils/bin:$AOMP/../bin:$AOMP/../../bin:$AOMP/lib/llvm/bin:$PATH
./runOne
#grep ratio= result/*.log
diff --git a/bin/run_babelstream.sh b/bin/run_babelstream.sh
index 09b3f6e9f5..68077f73d3 100755
--- a/bin/run_babelstream.sh
+++ b/bin/run_babelstream.sh
@@ -34,6 +34,9 @@ export ROCR_VISIBLE_DEVICES=0
# --- end standard header ----
if [ "$1" != "nocopy" ] ; then
+pushd $AOMP_REPOS_TEST/$AOMP_BABELSTREAM_REPO_NAME
+git checkout 2f00dfb
+popd
patchrepo $AOMP_REPOS_TEST/$AOMP_BABELSTREAM_REPO_NAME
fi
@@ -111,7 +114,7 @@ fi
omp_cpu_flags="-O3 -fopenmp -DOMP"
hip_flags="-O3 -Wno-unused-result -DHIP"
-stdpar_flags="-O3 -I. --offload-arch=$AOMP_GPU -DNDEBUG -O3 --hipstdpar --hipstdpar-path=/opt/rocm/include/thrust/system/hip --hipstdpar-thrust-path=/opt/rocm/include --hipstdpar-prim-path=/opt/rocm/include -std=c++17 "
+stdpar_flags="-O3 -I. --offload-arch=$AOMP_GPU -DNDEBUG -O3 --hipstdpar --hipstdpar-path=/opt/rocm/include/thrust/system/hip/hipstdpar --hipstdpar-thrust-path=/opt/rocm/include --hipstdpar-prim-path=/opt/rocm/include -std=c++17 "
omp_src="main.cpp OMPStream.cpp"
hip_src="main.cpp HIPStream.cpp"
@@ -160,7 +163,7 @@ echo RUN_OPTIONS: $RUN_OPTIONS
thisdate=`date`
echo >>results.txt
echo "=========> RUNDATE: $thisdate" >>results.txt
-COMPILER=`$AOMP/bin/llc --version | grep version`
+COMPILER=`$AOMP/bin/clang --version | grep version`
echo "=========> COMPILER: $COMPILER" >>results.txt
echo "=========> GPU: $AOMP_GPU" >>results.txt
compile_error=0
diff --git a/bin/run_composable-kernels.sh b/bin/run_composable-kernels.sh
index 7fa0237499..931b65ec8e 100755
--- a/bin/run_composable-kernels.sh
+++ b/bin/run_composable-kernels.sh
@@ -1,6 +1,13 @@
#!/usr/bin/env bash
-CKRepoURL='https://github.com/ROCm/composable_kernel.git'
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
+
+set -x
+CKRepoURL='https://github.com/ROCm/rocm-libraries.git'
CKRepoBranchName='develop'
CKBenchmarkRepoBranchName='main'
@@ -8,6 +15,12 @@ CKBenchmarkRepoBranchName='main'
# when building CK. This is likely a bit conservative.
CKBuildParallelism=$(free -g | grep Mem | awk '{print int($2/10)}')
+# Check if the user overrode number of parallel build jobs
+# via env var
+if [ ! -z ${CK_BUILD_PARALLELISM} ]; then
+ CKBuildParallelism=${CK_BUILD_PARALLELISM}
+fi
+
realpath=$(realpath $0)
thisdir=$(dirname $realpath)
@@ -16,14 +29,16 @@ thisdir=$(dirname $realpath)
export PATH=$AOMP/bin:$PATH
function printHelp {
+ set +x
echo "Usage: run_composable-kernels.sh"
echo " -h: Show this help message"
echo " -i: Install the (incremental) CK build"
+ echo " -l: Library-only build (no examples or tests)"
echo " -r: Rebuild the CK repo"
echo " -u: Update the CK repo"
echo " -b: Update the CK benchmarks repo"
- echo " -s : Select from:" \
- "[benchmarks client-examples]. (Default: benchmarks)"
+ echo " -s : Select from:" \
+ "[benchmarks client-examples smoke regression skip]. (Default: skip)"
echo " -t : Run from selected suite (e.g. 'gemm/fa1.yaml')"
exit 0
}
@@ -42,7 +57,7 @@ function getIndexListByTargetArch {
# Finally, we use xargs to format the results into a tidy, single-line list.
OnlyVisibleDevices=""
if [ ! -z "${ROCR_VISIBLE_DEVICES}" ]; then
- OnlyVisibleDevices="-d ${ROCR_VISIBLE_DEVICES}"
+ OnlyVisibleDevices="$(echo "-d ${ROCR_VISIBLE_DEVICES}" | tr ',' ' ')"
fi
GPUList="$(rocm-smi --showproductname ${OnlyVisibleDevices})"
GPURegex="s/^GPU\[([0-9]+)\].*${TargetArch}$/\1/p"
@@ -105,8 +120,20 @@ function distributeWorkToGPUs {
fi
}
+# Return an export command, prefixing current LD_LIBRARY_PATH with AOMP_LIB_PATH
+function getLDLibraryPathExportCmd {
+ # Make sure that we prefer the AOMP libraries over the system ones
+ LDLibraryPath="${AOMP_LIB_PATH}"
+ if [ -n "${LD_LIBRARY_PATH}" ]; then
+ LDLibraryPath="${LDLibraryPath}:${LD_LIBRARY_PATH}"
+ fi
+ echo "export LD_LIBRARY_PATH=${LDLibraryPath}"
+}
+
# Some tests may require an installed instance of CK.
ShouldInstallCK='no'
+# It my be desired to build the CK library only, without any examples or tests.
+ShouldBuildLibraryOnly='no'
# For some situations during testing it may not be desired to rebuild the CK repo.
ShouldRebuildCK='no'
# While doing perf / other compiler work, keeping CK fix is useful.
@@ -116,13 +143,17 @@ ShouldUpdateCKRepo='no'
ShouldUpdateCKBenchmarks='no'
# CK may be run using different test- or benchmark-suites.
-SelectedSuite='benchmarks'
+SelectedSuite='skip'
# CK may be run using a specfic test from the selected suite.
SelectedTest=''
-while getopts "hirubs:t:" opt; do
+while getopts "j:hilrubs:t:" opt; do
case ${opt} in
+ j)
+ # User-defined parallelism for CK build via argument
+ CKBuildParallelism="${OPTARG}"
+ ;;
h)
printHelp
;;
@@ -130,6 +161,10 @@ while getopts "hirubs:t:" opt; do
# Install the CK build
ShouldInstallCK='yes'
;;
+ l)
+ # Build the CK library only
+ ShouldBuildLibraryOnly='yes'
+ ;;
r)
# Rebuild the CK repo
ShouldRebuildCK='yes'
@@ -146,28 +181,38 @@ while getopts "hirubs:t:" opt; do
# Select benchmark or test suite.
# To support this as an optional argument, we take a look at the next.
case ${OPTARG} in
- benchmarks)
- # Run the CK benchmarks.
- SelectedSuite="${OPTARG}"
- ;;
- client-examples)
- # Build and run the client examples provided by CK.
- SelectedSuite="${OPTARG}"
- # Requires an installed CK build (triggers incremental build)
- ShouldInstallCK='yes'
- ;;
- examples)
- # Build and run the examples provided by CK.
- SelectedSuite="${OPTARG}"
- ;;
- *)
- # If there's a following string which does not start with '-'
- # we interpret it as an attempt at providing an unknown suite.
- if [[ "${OPTARG}" =~ ^[^-].*$ ]]; then
- echo "Unknown suite: ${OPTARG}"
- printHelp
- fi
- ;;
+ skip)
+ # Skip running any suite.
+ SelectedSuite='skip'
+ ;;
+ benchmarks)
+ # Run the CK benchmarks.
+ SelectedSuite="${OPTARG}"
+ ;;
+ client-examples)
+ # Build and run the client examples provided by CK.
+ SelectedSuite="${OPTARG}"
+ ;;
+ examples)
+ # Build and run the examples provided by CK.
+ SelectedSuite="${OPTARG}"
+ ;;
+ smoke)
+ # A minimal smoke test suite.
+ SelectedSuite="${OPTARG}"
+ ;;
+ regression)
+ # A minimal regression test suite.
+ SelectedSuite="${OPTARG}"
+ ;;
+ *)
+ # If there's a following string which does not start with '-'
+ # we interpret it as an attempt at providing an unknown suite.
+ if [[ "${OPTARG}" =~ ^[^-].*$ ]]; then
+ echo "Unknown suite: ${OPTARG}"
+ printHelp
+ fi
+ ;;
esac
;;
t)
@@ -182,18 +227,20 @@ done
# Set the default build prefix, i.e., build-top-level
: ${CK_TOP:=$AOMP_REPOS_TEST/composable-kernels}
-: ${CK_REPO:=$CK_TOP/ck-src}
+: ${CK_REPO:=$CK_TOP/rocm-libraries}
+: ${CK_SRC:=$CK_REPO/projects/composablekernel}
: ${CK_BUILD:=$CK_TOP/ck-build}
: ${CK_BENCHMARK_REPO:=$CK_TOP/ck-benchmark}
# Move this to its own place, to avoid potential permission conflicts with certain setups.
: ${CK_BENCHMARK_RESULT:=$CK_TOP/ck-benchmark-result}
: ${CK_INSTALL:=$CK_TOP/ck-install}
-: ${CK_CLIENT_EXAMPLES_SOURCE:=$CK_REPO/client_example}
+: ${CK_CLIENT_EXAMPLES_SOURCE:=$CK_SRC/client_example}
: ${CK_CLIENT_EXAMPLES_BUILD:=$CK_TOP/ck-client-examples-build}
# Run regular and client examples on multiple GPUs (if present)
: ${CK_EXAMPLES_PARALLEL:='yes'}
: ${CK_EXAMPLES_PREFIX:='example_'}
: ${CK_EXAMPLES_LOG_LOCATION:=$CK_TOP/ck-examples-logs}
+: ${CK_TESTS_LOG_LOCATION:=$CK_TOP/ck-tests-logs}
# Some client-examples may take long, override this to skip tests
# e.g. CK_CLIENT_EXAMPLES_TO_EXCLUDE=("10_grouped_convnd_bwd_data" "24_grouped_conv_activation")
@@ -202,6 +249,7 @@ done
# Get some info on the system
: ${ROCM_PATH:=/opt/rocm}
: ${CK_GPU_TARGETS:=''}
+: ${AOMP_LIB_PATH:="${AOMP}/.."}
if [ -z ${CK_GPU_TARGETS} ]; then
NumGpuArchs=$(amdgpu-arch | sort | uniq | wc -l)
@@ -227,7 +275,7 @@ if [ ! -d ${CK_TOP} ]; then
fi
if [ ! -d ${CK_REPO} ]; then
- git clone ${CKRepoURL} ${CK_REPO}
+ git clone --single-branch --depth 1 ${CKRepoURL} ${CK_REPO}
elif [ "${ShouldUpdateCKRepo}" == 'yes' ]; then
pushd ${CK_REPO} || exit 1
git reset --hard origin/${CKRepoBranchName}
@@ -237,12 +285,29 @@ elif [ "${ShouldUpdateCKRepo}" == 'yes' ]; then
popd
fi
+CKBuildTool='make'
+if command -v ninja >/dev/null; then
+ CmakeGenerator="-GNinja"
+ CKBuildTool='ninja'
+fi
+
# TODO Fix / Finalize the cmake command
-CKCmakeCmd="cmake -GNinja -B ${CK_BUILD} -S ${CK_REPO} -DCMAKE_PREFIX_PATH=${ROCM_PATH} -DCMAKE_INSTALL_PREFIX=${CK_INSTALL} "
+CKCmakeCmd="cmake ${CmakeGenerator} -B ${CK_BUILD} -S ${CK_SRC} -DCMAKE_PREFIX_PATH=${ROCM_PATH} -DCMAKE_INSTALL_PREFIX=${CK_INSTALL} "
CKCmakeCmd+="-DCMAKE_CXX_COMPILER=${AOMP}/bin/clang++ -DCMAKE_HIP_COMPILER=${AOMP}/bin/clang++ "
-CKCmakeCmd+="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache "
-CKCmakeCmd+="-DCMAKE_BUILD_TYPE=Release -DGPU_TARGETS=${CK_GPU_TARGETS}"
+CKCmakeCmd+="-DCMAKE_BUILD_TYPE=Release "
+
+# Handle library-only build for CK
+# Note: GPU_ARCHS takes precedence over GPU_TARGETS and omits examples & tests
+if [ "${ShouldBuildLibraryOnly}" == 'yes' ]; then
+ CKCmakeCmd+="-DGPU_ARCHS=${CK_GPU_TARGETS} "
+else
+ CKCmakeCmd+="-DGPU_TARGETS=${CK_GPU_TARGETS} "
+fi
+
+# For some reason, CK on gfx12 wants this set.
+CKCmakeCmd+="-DBUILD_DEV=On"
+# Ensure CK build directory is cleaned.
if [ "${ShouldRebuildCK}" == 'yes' ]; then
echo "Rebuilding the CK repo w/ ${CKBuildParallelism} parallel jobs."
rm -rf ${CK_BUILD} || exit 1
@@ -254,31 +319,44 @@ if [ "${ShouldRebuildCK}" == 'yes' ]; then
if [ $? -ne 0 ]; then
exit 1
fi
+fi
+# Ensure CK install directory is cleaned.
+if [ "${ShouldInstallCK}" == 'yes' ]; then
+ echo "Purging previous CK installation directory."
+ rm -rf ${CK_INSTALL} || exit 1
+fi
+
+# Perform (incremental) CK build
+if [ "${ShouldRebuildCK}" == 'yes' ] || [ "${ShouldInstallCK}" == 'yes' ]; then
pushd ${CK_BUILD} || exit 1
- time ninja -j ${CKBuildParallelism}
+ # -k parameter avoids stopping at first error
+ # ckProfiler target seems to depend on all library targets, which we want to build first
+ /usr/bin/time -o build-times.tlog ${CKBuildTool} -j ${CKBuildParallelism} -k 0 ckProfiler
if [ $? -ne 0 ]; then
exit 1
fi
+ # Find build success in the build log
+ echo "CK-BUILD-SUCCESS"
+
popd
fi
+# Perform CK installation
if [ "${ShouldInstallCK}" == 'yes' ]; then
pushd ${CK_BUILD} || exit 1
- time ninja -j ${CKBuildParallelism}
- if [ $? -ne 0 ]; then
- exit 1
- fi
-
# TODO: Check parallelism. This may use all available threads.
- time ninja install
+ /usr/bin/time -o install-times.tlog ${CKBuildTool} -k 0 install
if [ $? -ne 0 ]; then
exit 1
fi
+ # Find install success in the log
+ echo "CK-INSTALL-SUCCESS"
+
popd
fi
@@ -287,8 +365,8 @@ echo "Run suite: ${SelectedSuite}"
# Check if parallel execution is requested and possible
UseParallel=0
if ([ "${SelectedSuite}" == 'client-examples' ] ||
- [ "${SelectedSuite}" == 'examples' ]) &&
- [ "${CK_EXAMPLES_PARALLEL}" == 'yes' ]; then
+ [ "${SelectedSuite}" == 'examples' ]) &&
+ [ "${CK_EXAMPLES_PARALLEL}" == 'yes' ]; then
if [ ! -z "$(command -v parallel)" ]; then
UseParallel=1
else
@@ -296,6 +374,28 @@ if ([ "${SelectedSuite}" == 'client-examples' ] ||
fi
fi
+if [ "${SelectedSuite}" == 'smoke' ]; then
+ echo "Running CK smoke tests"
+ if [ ! -d "${CK_TESTS_LOG_LOCATION}" ]; then
+ mkdir -p "${CK_TESTS_LOG_LOCATION}" || exit 1
+ fi
+ pushd ${CK_BUILD} || exit 1
+ ${CKBuildTool} -j 16 smoke 2>&1 | tee "${CK_TESTS_LOG_LOCATION}/smoke_tests.log"
+ echo "Log at ${CK_TESTS_LOG_LOCATION}/smoke_tests.log"
+ popd
+fi
+
+if [ "${SelectedSuite}" == 'regression' ]; then
+ echo "Running CK regression tests"
+ if [ ! -d "${CK_TESTS_LOG_LOCATION}" ]; then
+ mkdir -p "${CK_TESTS_LOG_LOCATION}" || exit 1
+ fi
+ pushd ${CK_BUILD} || exit 1
+ ${CKBuildTool} -j 16 regression 2>&1 | tee "${CK_TESTS_LOG_LOCATION}/regression_tests.log"
+ echo "Log at ${CK_TESTS_LOG_LOCATION}/regression_tests.log"
+ popd
+fi
+
# Handle CK benchmarks (also as default, if no suite has been explicitly selected)
if [ "${SelectedSuite}" == 'benchmarks' ]; then
# The CK benchmarks repo appears to be private (for the time being).
@@ -337,12 +437,14 @@ if [ "${SelectedSuite}" == 'benchmarks' ]; then
CKBenchmarkResultOutput="${CK_BENCHMARK_RESULT}/${CKBenchmarkName}.output"
CKBenchmarkBackend='ck'
CKBenchmarkCmd="./run_gemm.py ${CKBenchmarkBackend} ${CKBenchmarkTest} --output ${CKBenchmarkResultOutput}"
- CKBenchmarkEnvAdditions="export CK_PROFILER_DIR=${CK_BUILD}/bin"
+ CKBenchmarkProfilerExport="export CK_PROFILER_DIR=${CK_BUILD}/bin"
+ CKBenchmarkLDLibraryPathExport=$(getLDLibraryPathExportCmd)
pushd ${CK_BENCHMARK_REPO}/scripts || exit 1
- echo "Benchmark Command: ${CKBenchmarkEnvAdditions} ; ${CKBenchmarkCmd}"
- ${CKBenchmarkEnvAdditions}
+ echo "Benchmark Command: ${CKBenchmarkProfilerExport} ; ${CKBenchmarkCmd}"
+ ${CKBenchmarkLDLibraryPathExport}
+ ${CKBenchmarkProfilerExport}
${CKBenchmarkCmd}
popd
@@ -353,14 +455,21 @@ fi
# Handle CK client examples
if [ "${SelectedSuite}" == 'client-examples' ]; then
# Configure and build the client examples
- # Note: client_example needs hipcc, otherwise there may be assertion failures.
- CKCmakeCmd="cmake -G Ninja "
+ CKCmakeCmd="cmake ${CmakeGenerator} "
CKCmakeCmd+="-B ${CK_CLIENT_EXAMPLES_BUILD} -S ${CK_CLIENT_EXAMPLES_SOURCE} "
- CKCmakeCmd+="-DCMAKE_CXX_COMPILER=${AOMP}/../../bin/hipcc "
+ CKCmakeCmd+="-DCMAKE_CXX_COMPILER=${AOMP}/bin/clang++ "
+ CKCmakeCmd+="-DCMAKE_HIP_COMPILER=${AOMP}/bin/clang++ "
CKCmakeCmd+="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache "
- CKCmakeCmd+="-DCMAKE_PREFIX_PATH=${AOMP};${CK_INSTALL} "
+ CKCmakeCmd+="-DCMAKE_PREFIX_PATH=${AOMP_LIB_PATH}/cmake;${CK_INSTALL} "
CKCmakeCmd+="-DGPU_TARGETS=${CK_GPU_TARGETS} "
+ CKClientExLDLibraryPathExport=$(getLDLibraryPathExportCmd)
+
+ if [ "${ShouldInstallCK}" != 'yes' ]; then
+ echo "Warning: client-examples selected without required CK installation."
+ echo " Please, make sure CK is properly installed."
+ fi
+
echo "Rebuilding the CK client-examples"
rm -rf ${CK_CLIENT_EXAMPLES_BUILD} || exit 1
@@ -374,14 +483,14 @@ if [ "${SelectedSuite}" == 'client-examples' ]; then
pushd ${CK_CLIENT_EXAMPLES_BUILD} || exit 1
- ninja
+ ${CKBuildTool}
if [ $? -ne 0 ]; then
exit 1
fi
# Process directories to exclude
# Usage of here-string to avoid sub-shell and removal of potential parentheses
- read -ra DirsToExclude <<< "${CK_CLIENT_EXAMPLES_TO_EXCLUDE//[()]/}"
+ read -ra DirsToExclude <<<"${CK_CLIENT_EXAMPLES_TO_EXCLUDE//[()]/}"
# Build argument list for find
# If globbed directories are provided, the list is expanded correspondingly
@@ -389,7 +498,7 @@ if [ "${SelectedSuite}" == 'client-examples' ]; then
# directories while traversing the resulting argument (path) list
NumExcludedDirs=0
FindArgs=(. -mindepth 1 -maxdepth 2 -type d \()
- for ExcludedDir in ${DirsToExclude[@]}; do
+ for ExcludedDir in "${DirsToExclude[@]}"; do
FindArgs+=(-path "./${ExcludedDir}" -o)
echo "Excluding client-examples: ./${ExcludedDir}"
((++NumExcludedDirs))
@@ -424,7 +533,7 @@ if [ "${SelectedSuite}" == 'client-examples' ]; then
RunCmd="echo \"Running client-example: ${ExamplePath}\";"
RunCmd+="\"${ExamplePath}\" | tee \"${ExampleLogfile}\""
ExampleRunCmds+=("${RunCmd}")
- done <<< "${ExamplesToRun}"
+ done <<<"${ExamplesToRun}"
NumJobs=${#ExampleRunCmds[@]}
echo "Found ${NumJobs} client-examples to run"
@@ -434,6 +543,9 @@ if [ "${SelectedSuite}" == 'client-examples' ]; then
exit 1
fi
+ # Prepare library path
+ ${CKClientExLDLibraryPathExport}
+
# Run each client-example
if [ ${UseParallel} == 1 ]; then
# Parallel execution, using multiple GPUs
@@ -489,7 +601,7 @@ if [ "${SelectedSuite}" == 'examples' ]; then
RunCmd="echo \"Running example: ${ExamplePath}\";"
RunCmd+="\"${ExamplePath}\" | tee \"${ExampleLogfile}\""
ExampleRunCmds+=("${RunCmd}")
- done <<< "${ExamplesToRun}"
+ done <<<"${ExamplesToRun}"
NumJobs=${#ExampleRunCmds[@]}
echo "Found ${NumJobs} examples to run"
diff --git a/bin/run_fBabel.sh b/bin/run_fBabel.sh
index fa1fca0962..2bab219fed 100755
--- a/bin/run_fBabel.sh
+++ b/bin/run_fBabel.sh
@@ -52,9 +52,9 @@ LLVM_VERSION_STR=`$AOMP/bin/$FLANG --version`
LLVM_VERSION=`echo $LLVM_VERSION_STR | sed -e 's/^.*version[ ]*//' | cut -d"." -f1`
echo "LLVM_VERSION_STR=$LLVM_VERSION_STR"
echo "LLVM_VERSION=$LLVM_VERSION"
-echo $LLVM_VERSION_STR | grep -q "ROCm-Developer-Tools"
+echo $LLVM_VERSION_STR | grep -q "ROCm"
if [ $? -eq 0 ] ; then # AMD build
- echo "Detected: ROCm-Developer-Tools build"
+ echo "Detected: ROCm build"
special_aso_flags="-O3 -fopenmp-target-fast"
#special_aso_flags="-fopenmp-gpu-threads-per-team=256 -fopenmp-target-fast"
else
@@ -112,7 +112,7 @@ echo RUN_OPTIONS: $RUN_OPTIONS
thisdate=`date`
echo >>results.txt
echo "=========> RUNDATE: $thisdate" >>results.txt
-COMPILER=`$AOMP/bin/llc --version | grep version`
+COMPILER=`$AOMP/bin/clang --version | grep version`
echo "=========> COMPILER: $COMPILER" >>results.txt
echo "=========> GPU: $AOMP_GPU" >>results.txt
compile_error=0
diff --git a/bin/run_genasis.sh b/bin/run_genasis.sh
index 806572636e..6d98d28afa 100755
--- a/bin/run_genasis.sh
+++ b/bin/run_genasis.sh
@@ -58,21 +58,21 @@ fi
export GPU_ID=$($ROCM/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
currdir=$(pwd)
if [ -d "$SILO_DIR" ] ; then
- echo "SILO 4.10.2 exists."
+ echo "SILO 4.11.1 exists."
else
- echo "SILO 4.10.2 does not exist. Please run ./build_supp.sh silo in $thisdir"
+ echo "SILO 4.11.1 does not exist. Please run ./build_supp.sh silo in $thisdir"
exit
fi
if [ -d "$HDF5_DIR" ] ; then
- echo "HDF5-1.12.0 exists."
+ echo "HDF5-1.14.0 exists."
export INCLUDE_HDF5="-I$HDF5_DIR/include"
export LIBRARY_HDF5="-L$HDF5_DIR/lib -lhdf5_fortran -lhdf5"
else
- echo "HDF5-1.12.0 does not exist. Please run ./build_supp.sh hdf5 in $thisdir"
+ echo "HDF5-1.14.0 does not exist. Please run ./build_supp.sh hdf5 in $thisdir"
exit
fi
if [ -d "$OPENMPI_DIR" ] ; then
- echo "OpenMPI-4.1.1 exists."
+ echo "OpenMPI-5.0.8 exists."
export MPI=${OPENMPI_DIR}
else
echo "OpenMPI does not exist. Please run ./build_supp.sh openmpi in $thisdir"
diff --git a/bin/run_genasis_flang_new.sh b/bin/run_genasis_flang_new.sh
index 954f077832..7da59262a8 100755
--- a/bin/run_genasis_flang_new.sh
+++ b/bin/run_genasis_flang_new.sh
@@ -19,7 +19,7 @@
# AOMP=/llvm ./build_supp_llvm-flang.sh
#
# To run:
-# AOMP_SUPP=$HOME/local/llvm-flang \
+# AOMP_SUPP=$HOME/local \
# AOMP=/llvm ./run_genasis_flang_new.sh
#
# --- Start standard header to set AOMP environment variables ----
@@ -80,21 +80,21 @@ fi
export GPU_ID=$($ROCM/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
currdir=$(pwd)
if [ -d "$SILO_DIR" ] ; then
- echo "SILO 4.10.2 exists."
+ echo "SILO 4.11.1 exists."
else
- echo "SILO 4.10.2 does not exist. Please run ./build_supp.sh silo in $thisdir"
+ echo "SILO 4.11.1 does not exist. Please run ./build_supp.sh silo in $thisdir"
exit
fi
if [ -d "$HDF5_DIR" ] ; then
- echo "HDF5-1.12.0 exists."
+ echo "HDF5-1.14.0 exists."
export INCLUDE_HDF5="-I$HDF5_DIR/include"
export LIBRARY_HDF5="-L$HDF5_DIR/lib -lhdf5_fortran -lhdf5"
else
- echo "HDF5-1.12.0 does not exist. Please run ./build_supp.sh hdf5 in $thisdir"
+ echo "HDF5-1.14.0 does not exist. Please run ./build_supp.sh hdf5 in $thisdir"
exit
fi
if [ -d "$OPENMPI_DIR" ] ; then
- echo "OpenMPI-4.1.1 exists."
+ echo "OpenMPI-5.0.8 exists."
export MPI=${OPENMPI_DIR}
else
echo "OpenMPI does not exist. Please run ./build_supp.sh openmpi in $thisdir"
@@ -102,14 +102,25 @@ else
fi
OMP_DEFINES="-DENABLE_OMP_OFFLOAD"
-if [ "$ENABLE_OMP_OFFLOAD" -eq "0" ] ; then
+if [[ "$ENABLE_OMP_OFFLOAD" -eq "0" ]] ; then
OMP_DEFINES=
fi
+if [[ "$USE_OPENMP_RUNTIME" -eq "1" ]] ; then
+ OMP_DEFINES+=" -DUSE_OPENMP_RUNTIME"
+fi
+
+IMPLICIT_GPU_FLANG_RT=${IMPLICIT_GPU_FLANG_RT:-1}
+if [[ "$IMPLICIT_GPU_FLANG_RT" -eq "1" ]]; then
+ FORTRAN_OFFLOAD_LIB=
+else
+ FORTRAN_OFFLOAD_LIB="-fno-gpu-flang-rt -lflang_rt.hostdevice"
+fi
+
export LD_LIBRARY_PATH=$AOMP/lib:$AOMPHIP/lib:$OPENMPI_DIR/lib:$LD_LIBRARY_PATH
export FORTRAN_COMPILE="$AOMP/bin/$FLANG -c -fopenmp --offload-arch=$GPU_ID -fPIC -I$OPENMPI_DIR/lib -cpp $OMP_DEFINES -fstack-arrays"
export CC_COMPILE="$AOMP/bin/clang -fPIC"
-export FORTDEV_LIBS=${FORTDEV_LIBS:-"-lflang_rt.hostdevice"}
+export FORTDEV_LIBS=${FORTDEV_LIBS:-"$FORTRAN_OFFLOAD_LIB"}
export FORTHOST_LIBS=${FORTHOST_LIBS:-"-lflang_rt.runtime"}
export OTHER_LIBS="-lm -L$AOMP/lib $FORTHOST_LIBS $FORTDEV_LIBS -lomp -lomptarget -z muldefs "
export FORTRAN_LINK="$AOMP/bin/clang $OTHER_LIBS"
@@ -170,6 +181,24 @@ if [ "$1" != "buildonly" ] ; then
echo ./PROGRAM_HEADER_Singleton_Test_$GENASIS_MACHINE
./PROGRAM_HEADER_Singleton_Test_$GENASIS_MACHINE
echo
+ echo "================= Now running Unitests related to offloading ========"
+ cd $REPO_DIR/Programs/UnitTests/Basics/Devices/Executables
+ ./AllocateDevice_Command_Test_$GENASIS_MACHINE
+ echo "AllocateDevice_Command_Test_$GENASIS_MACHINE done!"
+ ./AllocateHost_Command_Test_$GENASIS_MACHINE
+ echo "AllocateHost_Command_Test_$GENASIS_MACHINE done!"
+ ./AssociateHost_Command_Test_$GENASIS_MACHINE
+ echo "AssociateHost_Command_Test_$GENASIS_MACHINE done!"
+ ./DeallocateDevice_Command_Test_$GENASIS_MACHINE
+ echo "DeallocateDevice_Command_Test_$GENASIS_MACHINE done!"
+ ./DeviceAddress_Function_Test_$GENASIS_MACHINE
+ echo "DeviceAddress_Function_Test_$GENASIS_MACHINE done!"
+ ./DeviceInterface_Test_$GENASIS_MACHINE
+ echo "DeviceInterface_Test_$GENASIS_MACHINE done!"
+ ./DisassociateHost_Command_Test_$GENASIS_MACHINE
+ echo "DisassociateHost_Command_Test_$GENASIS_MACHINE done!"
+ ./UpdateDevice_Command_Test_$GENASIS_MACHINE
+ echo "UpdateDevice_Command_Test_$GENASIS_MACHINE done!"
cd $REPO_DIR/Programs/Examples/Basics/FluidDynamics/Executables
echo
echo "================= 2D RiemannProblem ========"
@@ -193,22 +222,4 @@ if [ "$1" != "buildonly" ] ; then
echo $_cmd
time $_cmd
echo "================= end mpirun ========"
- echo "================= Now running Unitests related to offloading ========"
- cd $REPO_DIR/Programs/UnitTests/Basics/Devices/Executables
- ./AllocateDevice_Command_Test_$GENASIS_MACHINE
- echo "AllocateDevice_Command_Test_$GENASIS_MACHINE done!"
- ./AllocateHost_Command_Test_$GENASIS_MACHINE
- echo "AllocateHost_Command_Test_$GENASIS_MACHINE done!"
- ./AssociateHost_Command_Test_$GENASIS_MACHINE
- echo "AssociateHost_Command_Test_$GENASIS_MACHINE done!"
- ./DeallocateDevice_Command_Test_$GENASIS_MACHINE
- echo "DeallocateDevice_Command_Test_$GENASIS_MACHINE done!"
- ./DeviceAddress_Function_Test_$GENASIS_MACHINE
- echo "DeviceAddress_Function_Test_$GENASIS_MACHINE done!"
- ./DeviceInterface_Test_$GENASIS_MACHINE
- echo "DeviceInterface_Test_$GENASIS_MACHINE done!"
- ./DisassociateHost_Command_Test_$GENASIS_MACHINE
- echo "DisassociateHost_Command_Test_$GENASIS_MACHINE done!"
- ./UpdateDevice_Command_Test_$GENASIS_MACHINE
- echo "UpdateDevice_Command_Test_$GENASIS_MACHINE done!"
fi
diff --git a/bin/run_gpurun_rocprof_env.sh b/bin/run_gpurun_rocprof_env.sh
new file mode 100755
index 0000000000..dcf6b5b7ab
--- /dev/null
+++ b/bin/run_gpurun_rocprof_env.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# run_gpurun_rocprof_env.sh : compare environments with different process launchers
+#
+# Rule1: Always run rocprof, rocgdb binaries from gpurun and not the opposite.
+# Rule2: When using mpirun, always run it first, followed by gpurun, followed by rocXXX, followed by the application binary
+#
+AOMP=${AOMP:-/opt/rocm}
+_gpurun_opts="-m -v"
+echo
+echo "=====1==== env > env_standalone.out"
+env | sort >env_standalone.out
+echo
+echo "=====2==== $AOMP/lib/llvm/bin/gpurun $_gpurun_opts env > env_gpurun.out"
+"$AOMP"/lib/llvm/bin/gpurun $_gpurun_opts env | sort >env_gpurun.out
+
+echo
+echo "=====3==== $AOMP/lib/llvm/bin/gpurun $_gpurun_opts $AOMP/bin/rocprofv3 --kernel-trace --hsa-trace --memory-copy-trace --stats -- env > env_gpurun_rocprof.out"
+"$AOMP"/lib/llvm/bin/gpurun $_gpurun_opts "$AOMP"/bin/rocprofv3 --kernel-trace --hsa-trace --memory-copy-trace --stats -- env | sort >env_gpurun_rocprof.out
+
+echo
+echo "=====4==== mpirun -np 1 $AOMP/lib/llvm/bin/gpurun $_gpurun_opts $AOMP/bin/rocprofv3 --kernel-trace --hsa-trace --memory-copy-trace --stats -- env > env_mpirun_gpurun_rocprof.out"
+mpirun -np 1 "$AOMP"/lib/llvm/bin/gpurun $_gpurun_opts "$AOMP"/bin/rocprofv3 --kernel-trace --hsa-trace --memory-copy-trace --stats -- env | sort >env_mpirun_gpurun_rocprof.out
+
+echo
+echo ---------- diff 1 env_standalone.out 2 env_gpurun.out
+diff env_standalone.out env_gpurun.out
+
+echo
+echo ---------- diff 2 env_gpurun.out 3 env_gpurun_rocprof.out
+diff env_gpurun.out env_gpurun_rocprof.out
+
+echo
+echo ---------- diff 3 env_gpurun_rocprof.out 4 env_mpirun_gpurun_rocprof.out
+diff env_gpurun_rocprof.out env_mpirun_gpurun_rocprof.out
diff --git a/bin/run_hpc2021.sh b/bin/run_hpc2021.sh
index 9fe1d03bb8..cf1fb84bfa 100755
--- a/bin/run_hpc2021.sh
+++ b/bin/run_hpc2021.sh
@@ -1,4 +1,9 @@
#! /usr/bin/env bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
# HPC2021_SOURCE_DIR where to clone sources to. Default: AOMP_REPOS_TEST
# HPC2021_BUILD_NUM_THREADS Number of parallel compile processes. Default: 32
@@ -14,13 +19,18 @@ export AOMP_USE_CCACHE=0
: ${HPC2021_SOURCE_DIR:=$AOMP_REPOS_TEST/hpc2021-1.1.9}
: ${HPC2021_BUILD_NUM_THREADS:=32}
+if [ "$NO_HPC2021_MPI_BLD" == "" ]; then
+ export INST=${INST:-/tmp/npsdbInst$$/openmpi-5-flang}
+ ./npsdb_bld_ompi.sh
+fi
+
if [ "$1" == "-clean" ]; then
rm -rf ${HPC2021_SOURCE_DIR}
mkdir -p ${HPC2021_SOURCE_DIR}
cd ${HPC2021_SOURCE_DIR} || exit 1
set -x
#WLOC=http://roclogin.amd.com/SPEC
- WLOC=http://aomp-tr01.amd.com/SPEC
+ WLOC=https://compute-artifactory.amd.com/artifactory/rocm-generic-local/compiler-infra
wget --timeout 15 --tries=3 -q $WLOC/hpc2021-1.1.9.tar.xz
wget --timeout 15 --tries=3 -q $WLOC/Hpc21-scripts.tar
tar xf hpc2021-1.1.9.tar.xz
@@ -30,6 +40,11 @@ if [ "$1" == "-clean" ]; then
else
cd ${HPC2021_SOURCE_DIR} || exit 1
fi
-export PATH=$AOMP/../bin:$AOMP/../../bin:$PATH
+export PATH=$HOME/openmp-utils/bin:$AOMP/../bin:$AOMP/../../bin:$PATH
+export MPI=$INST
+# strange UCX warnings in dockers using openmpi, this suppresses
+export UCX_LOG_LEVEL=error
+ulimit -t 200
./runOne
+rm -rf $INST
#grep ratio= result/*.log
diff --git a/bin/run_hpcg.sh b/bin/run_hpcg.sh
index c5b0c28cd2..d62edf3183 100755
--- a/bin/run_hpcg.sh
+++ b/bin/run_hpcg.sh
@@ -22,7 +22,7 @@ cd ${HPCG_SOURCE_DIR} || exit 1
if [ ! -d ./rocHPCG ]; then
# Get the sources
- git clone --depth 1 --single-branch -b omptarget https://github.com/ROCmSoftwarePlatform/rocHPCG || exit 1
+ git clone --depth 1 --single-branch -b omptarget https://github.com/ROCm/rocHPCG || exit 1
cd rocHPCG || exit 1
git checkout omptarget || exit 1
fi
@@ -32,6 +32,8 @@ cd omptarget/hpcg || exit 1
mkdir build
cd build || exit 1
+export OFFLOAD_ARCH=${AOMP_GPU}
+
../configure LLVM_OMP_TARGET
make --output-sync -j${HPCG_BUILD_NUM_THREADS}
@@ -48,4 +50,3 @@ fi
# The script does full rebuilds every time, so only one .txt file here.
cat HPCG-*.txt
-
diff --git a/bin/run_llama.sh b/bin/run_llama.sh
new file mode 100755
index 0000000000..2772764577
--- /dev/null
+++ b/bin/run_llama.sh
@@ -0,0 +1,143 @@
+#!/usr/bin/env bash
+
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
+
+# Build script for LLaMA with HIP support using AOMP compiler
+
+. aomp_common_vars
+
+: AOMP_GPU=${AOMP_GPU:=gfx90a}
+: ${LLAMA_GPU:=$AOMP_GPU}
+
+: ${LLAMA_TLDIR:=$AOMP_REPOS_TEST/llama}
+: ${LLAMA_BUILD_DIR:=$LLAMA_TLDIR/build}
+: ${LLAMA_SRC_DIR:=$LLAMA_TLDIR/src}
+: ${LLAMA_BUILD_MODE:=Release}
+: ${LLAMA_TESTS_LOG_LOCATION:=$LLAMA_TLDIR/logs}
+
+# Model to use in benchmarks (default is a smaller model)
+: ${LLAMA_BENCH_HF_ID:="ggml-org/gemma-3-1b-it-GGUF"}
+: ${LLAMA_CACHE:="$HOME/.cache/llama.cpp"}
+
+pushd ${AOMP_REPOS_TEST}
+mkdir -p ${LLAMA_TLDIR} && cd ${LLAMA_TLDIR}
+
+# Run CMake configuration
+DoConfigure='no'
+
+# Run build command
+DoCompile='no'
+
+# Run ctest
+DoCTest='no'
+
+# Run benchmark (llama-bench)
+DoBenchmark='no'
+
+# Update llama sources
+DoUpdate='no'
+
+IsVerbose='no'
+
+while getopts "j:cbtveu" opt; do
+ case ${opt} in
+ j) AOMP_BUILD_JOBS=${OPTARG} ;;
+ c) DoConfigure='yes' ;;
+ b) DoCompile='yes' ;;
+ t) DoCTest='yes' ;;
+ v) IsVerbose='yes' ;;
+ e) DoBenchmark='yes' ;;
+ u) DoUpdate='yes' ;;
+ \?)
+ echo "Usage: cmd [-j build_jobs] [-c configure] [-b build] [-t ctest] [-e benchmark] [-v verbose] [-u update_sources]"
+ exit 1
+ ;;
+ esac
+done
+
+if [ "${IsVerbose}" == "yes" ]; then
+ set -x
+fi
+
+TestBuildTool='make'
+if command -v ninja >/dev/null; then
+ CmakeGenerator="-GNinja"
+ TestBuildTool='ninja'
+fi
+
+if [ ! -d ${LLAMA_TESTS_LOG_LOCATION} ]; then
+ mkdir -p ${LLAMA_TESTS_LOG_LOCATION}
+fi
+
+if [ ! -d ${LLAMA_SRC_DIR} ]; then
+ echo "Cloning llama.cpp repository..."
+ git clone https://github.com/ggml-org/llama.cpp.git src
+elif [ "${DoUpdate}" == "yes" ]; then
+ echo "Updating llama.cpp repository..."
+ cd ${LLAMA_SRC_DIR}
+ git pull
+ cd ..
+fi
+
+if ! command -v git-lfs >/dev/null; then
+ echo "WARNING: git-lfs is not installed. Expect some tests to fail."
+else
+ # Ensure git-lfs is initialized and pulls any large files
+ cd ${LLAMA_SRC_DIR}
+ git lfs install
+ git lfs pull
+ cd ..
+fi
+
+echo "Configuring build with CMake..."
+if [ "${DoConfigure}" == "yes" ]; then
+ rm -rf ${LLAMA_BUILD_DIR}
+ cmake -B build \
+ -S src \
+ -DCMAKE_PREFIX_PATH=${AOMP}/lib/cmake \
+ -DGGML_HIP=On \
+ -DCMAKE_BUILD_TYPE=${LLAMA_BUILD_MODE} \
+ -DGPU_TARGETS=${LLAMA_GPU} \
+ ${CmakeGenerator} \
+ -DCMAKE_C_COMPILER=${AOMP}/bin/clang \
+ -DCMAKE_CXX_COMPILER=${AOMP}/bin/clang++ \
+ -DCMAKE_HIP_COMPILER=${AOMP}/bin/clang++
+fi
+
+if [ "${DoCompile}" == "yes" ]; then
+ echo "Building LLaMA..."
+ cmake --build ${LLAMA_BUILD_DIR} --parallel -j ${AOMP_BUILD_JOBS}
+fi
+
+if [ "${DoCTest}" == "yes" ]; then
+ echo "Running tests..."
+ cd ${LLAMA_BUILD_DIR}
+ echo "Log in ${LLAMA_TESTS_LOG_LOCATION}/ctest.log"
+
+ # Some model files are git-lfs and come from huggingface. They will auto-download during test
+ ctest --output-on-failure 2>&1 | tee "${LLAMA_TESTS_LOG_LOCATION}/ctest.log"
+fi
+
+if [ "${DoBenchmark}" == "yes" ]; then
+ echo "Running benchmark..."
+ cd ${LLAMA_BUILD_DIR}
+ # Download model from HF (this will make it avail in local cache); bench call requires local model file
+ # llama-cli will turn on interactive mode, so echo /exit to it immediately
+ echo "/exit" | ./bin/llama-cli -hf ${LLAMA_BENCH_HF_ID}
+
+ # For the find command, we need to replace '/' with '_' in the LLAMA_BENCH_HF_ID
+ ModelSearchPattern=${LLAMA_BENCH_HF_ID/\//\_}
+ # Pick up first model with that name. Basically, pick up first quantization of that model
+ LlamaModelPath=$(find "$LLAMA_CACHE" -maxdepth 1 -name "${ModelSearchPattern}*.gguf" 2>/dev/null | head -1)
+
+ # Marker for external scripts
+ echo "LLAMA_BENCHMARK_BEGIN" | tee "${LLAMA_TESTS_LOG_LOCATION}/llama-bench.log"
+ # Run benchmark
+ ./bin/llama-bench -ngl 999 -fa 1 -ub 2048 -m "$LlamaModelPath" 2>&1 | tee -a "${LLAMA_TESTS_LOG_LOCATION}/llama-bench.log"
+fi
+
+popd
diff --git a/bin/run_miniapps_test.sh b/bin/run_miniapps_test.sh
new file mode 100755
index 0000000000..9ba8317976
--- /dev/null
+++ b/bin/run_miniapps_test.sh
@@ -0,0 +1,271 @@
+#!/bin/bash
+#
+# run_mini_apps.sh
+# runs nekbone babelstream fortran-babelstream accel2023 hpc2021 openmpapps
+# override with SUITE_LIST
+# Please check with Ron or Ethan for script modifications.
+
+SUITE_LIST=${SUITE_LIST:-"nekbone babelstream fortran-babelstream accel2023 hpc2021 openmpapps"}
+
+export INST=/tmp/npsdbInst$$/openmpi-5-npsdb
+export MPI=$INST
+echo rocmMPI=$MPI
+
+export ROCR_VISIBLE_DEVICES=0
+
+# whats the OS ?
+cat /etc/os-release
+rocm-smi
+rocminfo
+./rocm_quick_check.sh
+
+export AOMP_USE_CCACHE=0
+
+echo $SUITE_LIST
+
+TLOG=/tmp/log$$
+echo "================" >$TLOG
+
+# Use bogus path to avoid using target.lst, a user-defined target list
+# used by rocm_agent_enumerator.
+export ROCM_TARGET_LST=/opt/nowhere
+
+#ulimit -t 1000
+
+realpath=`realpath $0`
+scriptdir=`dirname $realpath`
+parentdir=`eval "cd $scriptdir;pwd;cd - > /dev/null"`
+aompdir="$(dirname "$parentdir")"
+summary=`pwd`"/summary.txt"
+scriptfails=0
+
+EPSDB=1 ./clone_test.sh
+AOMP_TEST_DIR=${AOMP_TEST_DIR:-"$HOME/git/aomp-test"}
+echo AOMP before : $AOMP
+if [ ! -e $AOMP/bin ]; then
+ echo $AOMP does not point to valid location, unsetting
+ unset AOMP
+fi
+# Set AOMP to point to rocm symlink or newest version.
+if [ -e /opt/rocm/lib/llvm/bin ]; then
+ AOMP=${AOMP:-"/opt/rocm/lib/llvm"}
+ ROCMINF=/opt/rocm
+ ROCMDIR=/opt/rocm/lib
+ echo setting 1 $AOMP
+elif [ -e /opt/rocm/llvm/bin ]; then
+ AOMP=${AOMP:-"/opt/rocm/llvm"}
+ ROCMINF=/opt/rocm
+ ROCMDIR=/opt/rocm
+ echo setting 2 $AOMP
+else
+echo "error 1"
+exit
+fi
+export AOMP
+echo "AOMP = $AOMP"
+
+if [ ! -f "$AOMP/bin/gpurun" ]; then
+ rm -f "$HOME/openmp-utils/bin/gpurun"
+ if ! wget -P "$HOME/openmp-utils/bin" https://compute-artifactory.amd.com/artifactory/rocm-generic-local/compiler-infra/gpurun ; then
+ echo "Error: Could not download gpurun"
+ exit 1
+ fi
+ chmod 755 "$HOME/openmp-utils/bin/gpurun"
+ export GPURUN_BINDIR="$HOME/openmp-utils/bin"
+ export PATH=$PATH:$GPURUN_BINDIR
+fi
+
+clangversion=`$AOMP/bin/clang --version`
+aomp=0
+if [[ "$clangversion" =~ "AOMP_STANDALONE" ]]; then
+ aomp=1
+fi
+
+# Make sure clang is present.
+$AOMP/bin/clang --version
+if [ $? -ne 0 ]; then
+ echo "Error: Clang not found at "$AOMP"/bin/clang."
+ exit 1
+fi
+
+$AOMP/bin/flang --version
+if [ $? -ne 0 ]; then
+ echo "Error: flang not found at "$AOMP"/bin/flang."
+ exit 1
+fi
+
+# Set ROCM_LLVM for examples
+export ROCM_LLVM=$AOMP
+
+#unset ROCM_PATH
+
+# Use bogus path to avoid using target.lst, a user-defined target list
+# used by rocm_agent_enumerator.
+export ROCM_TARGET_LST=/opt/nowhere
+
+echo "RAE devices:"
+$ROCMINF/bin/rocm_agent_enumerator
+
+# Set AOMP_GPU.
+# Regex skips first result 'gfx000' and selects second id.
+if [ "$AOMP_GPU" == "" ]; then
+ AOMP_GPU=$($ROCMINF/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
+fi
+
+# mygpu will eventually relocate to /opt/rocm/bin, support both cases for now.
+if [ "$AOMP_GPU" != "" ]; then
+ echo "AOMP_GPU set with rocm_agent_enumerator."
+else
+ echo "AOMP_GPU is empty, use mygpu."
+ if [ -a $AOMP/bin/mygpu ]; then
+ AOMP_GPU=$($AOMP/bin/mygpu)
+ else
+ AOMP_GPU=$($AOMP/../bin/mygpu)
+ fi
+fi
+if [ "$AOMP_GPU" == "" ]; then
+ echo "Error: AOMP_GPU was not able to be set with RAE or mygpu."
+ exit 1
+fi
+echo AOMP_GPU=$AOMP_GPU
+export AOMP_GPU
+
+# Run quick sanity test
+echo
+echo "check-xnack test"
+cd "$aompdir"/test/smoke-dev/check-xnack
+make clean > /dev/null
+VERBOSE=1 make
+./check-xnack
+HSA_XNACK=1 OMPX_APU_MAPS=1 ./check-xnack
+echo
+echo "Helloworld sanity test:"
+cd "$aompdir"/test/smoke/helloworld
+make clean > /dev/null
+OMP_TARGET_OFFLOAD=MANDATORY VERBOSE=1 make run > hello.log 2>&1
+sed -n -e '/ld.lld/,$p' hello.log
+echo
+echo "Checking plugin"
+LIBOMPTARGET_DEBUG=1 OMP_TARGET_OFFLOAD=MANDATORY make run 2>&1 | grep "libomptarget.rtl.amdgpu"
+echo
+
+function openmpapps(){
+ echo "%================ openmpapps"
+ # -----Run Openmpapps-----
+ cd "$AOMP_TEST_DIR"/openmpapps
+ echo rockMPI=$MPI
+ ./check_openmpapps.sh
+ if [ "$?" -eq "0" ]; then
+ echo "Passed openmpapps" >> $TLOG
+ else
+ echo "FAILED openmpapps" >> $TLOG
+ scriptfails=1
+ fi
+}
+
+function nekbone(){
+ echo "%================ nekbone"
+ # -----Run Nekbone-----
+ cd "$aompdir"/bin
+ ( VERBOSE=0 ./run_nekbone.sh )
+ if [ "$?" -eq "0" ]; then
+ echo "Passed Nekbone" >> $TLOG
+ else
+ echo "FAILED Nekbone" >> $TLOG
+ scriptfails=1
+ fi
+}
+
+function babelstream(){
+ echo "%================ baelstream"
+ export AOMPHIP=$ROCMDIR
+ cd "$aompdir"/bin
+ if [ $aomp -eq 0 ]; then
+ export ROCMINFO_BINARY=$ROCMINF/bin/rocminfo
+ fi
+ export RUN_OPTIONS="omp-default omp-fast"
+ ./run_babelstream.sh
+ if [ "$?" -eq "0" ]; then
+ echo "Passed Babelstream" >> $TLOG
+ else
+ echo "FAILED Babelstream" >> $TLOG
+ scriptfails=1
+ fi
+}
+
+function fortran-babelstream(){
+ echo "%================ fortran-babelstream"
+ export AOMPHIP=$ROCMDIR
+ cd "$aompdir"/bin
+ if [ $aomp -eq 0 ]; then
+ export ROCMINFO_BINARY=$ROCMINF/bin/rocminfo
+ fi
+ ./run_fBabel.sh
+ if [ "$?" -eq "0" ]; then
+ echo "Passed fortran-babelstream" >> $TLOG
+ else
+ echo "FAILED fortran-babelstream" >> $TLOG
+ scriptfails=1
+ fi
+}
+
+
+function accel2023(){
+echo "%================ accel2023"
+ cd "$aompdir"/bin
+ export GPURUN_BYPASS=1
+ ./run_accel2023.sh -clean
+ cd $AOMP_TEST_DIR/accel2023-2.0.18
+ grep ratio= result/*.log | tail -12
+ nsucc=$(grep ratio= result/*.log | grep Succ | wc -l)
+ if [ $nsucc -eq 12 ]; then
+ echo "Passed accel2023 $nsucc passes" >> $TLOG
+ else
+ echo "FAILED accel2023 $nsucc passes" >> $TLOG
+ scriptfails=1
+ fi
+}
+
+function hpc2021(){
+echo "%================ hpc2021"
+ grep -q Ubuntu /etc/os-release
+ if [ "$?" -eq "0" ]; then
+ echo "running on ubuntu"
+ cd "$aompdir"/bin
+ unset ROCR_VISIBLE_DEVICES
+ export GPURUN_BYPASS=1
+ echo rockMPI=$MPI
+ ./run_hpc2021.sh -clean
+ cd $AOMP_TEST_DIR/hpc2021-1.1.9
+ grep ratio= result/*.log | tail -9
+ nsucc=$(grep ratio= result/*.log | grep Succ | wc -l)
+ if [ $nsucc -eq 9 ]; then
+ echo "Passed hpc2021 $nsucc passes" >> $TLOG
+ else
+ echo "FAILED hpc2021 $nsucc passes" >> $TLOG
+ scriptfails=1
+ fi
+ fi
+}
+
+echo Running List: $SUITE_LIST
+
+declare -A warnings
+warningcount=0
+for suite in $SUITE_LIST; do
+ $suite
+done
+
+echo "************************************" > $summary
+if [ "$scriptfails" != 0 ]; then
+ echo FAIL >> $summary
+ echo "EPSDB Status: red" >> $summary
+else
+ echo PASS >> $summary
+ echo "EPSDB Status: green" >> $summary
+fi
+cat $TLOG
+echo ""
+echo >> $summary
+cat $summary
+exit $((scriptfails))
diff --git a/bin/run_nekbone.sh b/bin/run_nekbone.sh
index a43f95672a..6d00cf288d 100755
--- a/bin/run_nekbone.sh
+++ b/bin/run_nekbone.sh
@@ -42,11 +42,14 @@ fi
ulimit -s unlimited
PATH=$AOMP/bin/:$PATH make F77=$FLANG -f makefile.aomp ${make_overrides}
VERBOSE=${VERBOSE:-"1"}
+if [ $GPURUN_BYPASS -eq 0 ]; then
+ GPURUNEXE=$GPURUN_BINDIR/gpurun
+fi
set -x
if [ $VERBOSE -eq 0 ]; then
- $GPURUN_BINDIR/gpurun -s ./nekbone 2>&1 | tee nek.log > /dev/null
+ $GPURUNEXE ./nekbone 2>&1 | tee nek.log > /dev/null
else
- $GPURUN_BINDIR/gpurun -s ./nekbone 2>&1 | tee nek.log
+ $GPURUNEXE ./nekbone 2>&1 | tee nek.log
fi
set +x
grep -s Exitting nek.log
diff --git a/bin/run_omptests.sh b/bin/run_omptests.sh
index 919073271c..6acb386492 100755
--- a/bin/run_omptests.sh
+++ b/bin/run_omptests.sh
@@ -1,11 +1,11 @@
#!/bin/bash
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
export AOMP_USE_CCACHE=0
-. $thisdir/aomp_common_vars
+. "$thisdir/aomp_common_vars"
# --- end standard header ----
# Setup AOMP variables
@@ -17,10 +17,10 @@ setaompgpu
DEVICE_ARCH=${DEVICE_ARCH:-$AOMP_GPU}
DEVICE_TARGET=${DEVICE_TARGET:-amdgcn-amd-amdhsa}
-echo DEVICE_ARCH = $DEVICE_ARCH
-echo DEVICE_TARGET = $DEVICE_TARGET
+echo "DEVICE_ARCH = $DEVICE_ARCH"
+echo "DEVICE_TARGET = $DEVICE_TARGET"
-pushd $AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME
+pushd "$AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME" || exit
rm -f runtime-fails.txt
rm -f compile-fails.txt
rm -f passing-tests.txt
@@ -29,44 +29,51 @@ skip_list="t-tdpf-nested-parallel t-reduction-team t-unified-reduction-team t-re
# When HSA_XNACK is explicitely set to 0 by the user assume that they do not
# want to run the unified memory tests so add them to the skip list:
-if [[ $HSA_XNACK == 0 ]]; then
+if [[ "$HSA_XNACK" == 0 ]]; then
echo "Skipping all unified memory tests since HSA_XNACK is 0."
skip_list="${skip_list} t-unified-critical t-unified-barrier t-unified-concurrent-target t-unified-data-sharing t-unified-data-sharing-many-teams t-unified-declare-simd t-unified-defaultmap t-unified-distribute t-unified-distribute-parallel-for-back2back t-unified-distribute-simd t-unified-distribute-simd-clauses t-unified-distribute-simd-dist-clauses t-unified-dpf t-unified-dpfs t-unified-dpfs-dist-clauses t-unified-exceptions t-unified-firstprivate-of-reference t-unified-flush t-unified-for t-unified-for-simd t-unified-ignore-unmappable-types t-unified-implicit-firstprivate t-unified-is-device-ptr-all-directives t-unified-l2-parallel t-unified-large-args t-unified-map-more-than t-unified-master t-unified-multiple-compilation-units t-unified-multiple-parallel t-unified-parallel t-unified-parallel-for t-unified-parallel-for-simd t-unified-parforsimd t-unified-partial-struct t-unified-reduction-struct t-unified-sections t-unified-sequence-distribute-parallel-for t-unified-shared-address-space t-unified-share-reference-orphan-directive t-unified-simd t-unified-single t-unified-target-api t-unified-target-basic t-unified-target-data-2map-same-array t-unified-target-enter-nowait t-unified-target-parallel t-unified-target-parallel-for t-unified-target-parallel-for-simd t-unified-target-parallel-for-simd-clauses t-unified-target-teams t-unified-target-teams-distribute t-unified-target-teams-distribute-parallel-for t-unified-target-teams-distribute-parallel-for-simd t-unified-target-teams-distribute-simd t-unified-target-update t-unified-target-update-not-there t-unified-target-update-nowait t-unified-teams-distribute t-unified-teams-distribute-parallel-for t-unified-teams-distribute-parallel-for-simd"
fi
# Add skip_list tests to runtime fails
for omp_test in $skip_list; do
- echo $omp_test > $AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME/skipped-tests.txt
+ echo "$omp_test" > "$AOMP_REPOS_TEST/$AOMP_OMPTESTS_REPO_NAME/skipped-tests.txt"
done
# Move tests to avoid soft hang
if [ "$SKIP_TESTS" != 0 ]; then
for omp_test in $skip_list; do
- if [ -d test-$omp_test-fail ]; then
- rm -rf test-$omp_test-fail
+ if [ -d "test-$omp_test-fail" ]; then
+ rm -rf "test-$omp_test-fail"
fi
- if [ -d $omp_test ]; then
- mv $omp_test test-$omp_test-fail
+ if [ -d "$omp_test" ]; then
+ mv "$omp_test" "test-$omp_test-fail"
fi
done
fi
log=$(date --iso-8601=minutes).log
-echo env DEVICE_TYPE=amd DEVICE_TARGET=$DEVICE_TARGET DEVICE_ARCH=$DEVICE_ARCH HOSTRTL=$AOMP/lib/libdevice TARGETRTL=$AOMP/lib GLOMPRTL=$AOMP/lib LLVMBIN=$AOMP/bin make -i
+# Show latest git commit
+echo -e "\n$(git show -s)\n"
-env DEVICE_TYPE=amd DEVICE_TARGET=$DEVICE_TARGET DEVICE_ARCH=$DEVICE_ARCH HOSTRTL=$AOMP/lib/libdevice TARGETRTL=$AOMP/lib GLOMPRTL=$AOMP/lib LLVMBIN=$AOMP/bin make -i 2>&1 | tee omptests_run_$log
+echo "env DEVICE_TYPE=amd DEVICE_TARGET=$DEVICE_TARGET DEVICE_ARCH=$DEVICE_ARCH HOSTRTL=$AOMP/lib/libdevice TARGETRTL=$AOMP/lib GLOMPRTL=$AOMP/lib LLVMBIN=$AOMP/bin make -i"
-$thisdir/check_omptests.sh
+env DEVICE_TYPE=amd DEVICE_TARGET="$DEVICE_TARGET" DEVICE_ARCH="$DEVICE_ARCH" HOSTRTL="$AOMP/lib/libdevice" \
+ TARGETRTL="$AOMP/lib" GLOMPRTL="$AOMP/lib" LLVMBIN="$AOMP/bin" \
+ make -i 2>&1 | tee "omptests_run_$log"
+
+export log
+
+"$thisdir"/check_omptests.sh
# Move tests back to avoid polluting the repo
if [ "$SKIP_TESTS" != 0 ]; then
for omp_test in $skip_list; do
- if [ -d $omp_test ]; then
- rm -rf $omp_test
+ if [ -d "$omp_test" ]; then
+ rm -rf "$omp_test"
fi
- if [ -d test-$omp_test-fail ]; then
- mv test-$omp_test-fail $omp_test
+ if [ -d "test-$omp_test-fail" ]; then
+ mv "test-$omp_test-fail" "$omp_test"
fi
done
fi
diff --git a/bin/run_rajaperf.sh b/bin/run_rajaperf.sh
index 6c4d6bad16..727b888c9b 100755
--- a/bin/run_rajaperf.sh
+++ b/bin/run_rajaperf.sh
@@ -1,14 +1,14 @@
#!/bin/bash
# --- Start standard header to set AOMP environment variables ----
-realpath=`realpath $0`
-thisdir=`dirname $realpath`
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
export AOMP_USE_CCACHE=0
-. $thisdir/aomp_common_vars
+. "${thisdir}/aomp_common_vars"
# --- end standard header ----
-function usage(){
+function usage() {
echo ""
echo "------------ Usage ------------"
echo "./run_rajaperf.sh [backend] [option]"
@@ -26,38 +26,34 @@ setaompgpu
# Check cmake version
cmake_regex="(([0-9])+\.([0-9]+)\.[0-9]+)"
-cmake_ver_str=$($AOMP_CMAKE --version)
+cmake_ver_str=$($AOMP_CMAKE --version)
if [[ "$cmake_ver_str" =~ $cmake_regex ]]; then
cmake_ver=${BASH_REMATCH[1]}
- cmake_major_ver=${BASH_REMATCH[2]}
- cmake_minor_ver=${BASH_REMATCH[3]}
echo "Cmake found: version $cmake_ver"
else
echo "ERROR: No cmake found, exiting..."
return 1
fi
-
-if [ "$1" == "hip" ]; then
+if [[ "$1" = "hip" ]]; then
BUILD_SUFFIX=hip
else
BUILD_SUFFIX=omptarget
fi
build_targets="hip openmp"
-if [ "$2" == "build" ]; then
+if [[ "$2" == "build" ]]; then
# Begin configuration
- pushd $AOMP_REPOS_TEST/RAJAPerf
- git reset --hard abb07792a899f7417e77ea40015e7e1dfd52716e
+ pushd "$AOMP_REPOS_TEST"/RAJAPerf || exit
+ git reset --hard 6054ecd30c681b45ce3cf0e2dc486ade7152db29
git submodule update --recursive
-
+
rm -rf build_${BUILD_SUFFIX}
mkdir build_${BUILD_SUFFIX}
- pushd build_${BUILD_SUFFIX}
+ pushd build_${BUILD_SUFFIX} || exit
- if [ "$1" == "hip" ]; then
- $AOMP/bin/clang --version | grep AOMP
- if [ $? -eq 0 ]; then
+ if [[ "$1" = "hip" ]]; then
+ if "$AOMP"/bin/clang --version | grep -q AOMP; then
export HIP_PATH="$AOMP"
export HIP_CLANG_PATH=$AOMP/bin
else
@@ -67,13 +63,13 @@ if [ "$2" == "build" ]; then
export ROCM_PATH=$HIP_PATH
$AOMP_CMAKE \
-DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_CXX_COMPILER=${AOMP}/bin/clang++ \
+ -DCMAKE_CXX_COMPILER="${AOMP}"/bin/clang++ \
-DENABLE_CUDA=Off \
-DENABLE_HIP=On \
-DCMAKE_PREFIX_PATH="$AOMP;$AOMP/..;/opt/rocm" \
-DENABLE_ALL_WARNINGS=Off \
-DCMAKE_INSTALL_PREFIX=../install_${BUILD_SUFFIX} \
- -DCMAKE_HIP_ARCHITECTURES=$AOMP_GPU \
+ -DCMAKE_HIP_ARCHITECTURES="$AOMP_GPU" \
-DENABLE_TESTS=On \
"$@" \
..
@@ -81,7 +77,7 @@ if [ "$2" == "build" ]; then
$AOMP_CMAKE \
-DCMAKE_FIND_DEBUG_MODE=OFF \
-DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_CXX_COMPILER=${AOMP}/bin/clang++ \
+ -DCMAKE_CXX_COMPILER="${AOMP}"/bin/clang++ \
-DENABLE_CUDA=OFF \
-DRAJA_ENABLE_CUDA=OFF \
-DENABLE_HIP=OFF \
@@ -102,40 +98,39 @@ if [ "$2" == "build" ]; then
usage
fi
- LESS_THREADS=$(( AOMP_JOB_THREADS/2 ))
- LESS_THREADS=$(( $LESS_THREADS > 32 ? 32 : $LESS_THREADS ))
+ LESS_THREADS=$((AOMP_JOB_THREADS / 2))
+ LESS_THREADS=$((LESS_THREADS > 32 ? 32 : LESS_THREADS))
MAKE_THREADS=${MAKE_THREADS:-$LESS_THREADS}
echo "Using $MAKE_THREADS threads for make."
- make -j $MAKE_THREADS
# Do not continue if build fails
- if [ $? != 0 ]; then
+ if ! make -j "$MAKE_THREADS"; then
echo "ERROR: Make returned non-zero, exiting..."
exit 1
fi
-
- popd
+
+ popd || exit
exit 0
fi
# Run performance tests or unit tests
-pushd $AOMP_REPOS_TEST/RAJAPerf
+pushd "$AOMP_REPOS_TEST"/RAJAPerf || exit
if [ -d build_${BUILD_SUFFIX} ] && [ "$2" != "build" ]; then
if [ "$2" == "perf" ]; then
if [ "$1" == "hip" ]; then
build_${BUILD_SUFFIX}/bin/raja-perf.exe --show-progress --refvar Base_HIP
- elif [ "$1" == "openmp" ] ; then
- if [ ! -f build_${BUILD_SUFFIX}/bin/raja-perf-omptarget.exe ] ; then
+ elif [ "$1" == "openmp" ]; then
+ if [ ! -f build_${BUILD_SUFFIX}/bin/raja-perf-omptarget.exe ]; then
echo "ERROR file build_${BUILD_SUFFIX}/bin/raja-perf-omptarget.exe not found"
echo " please build raja first"
- exit 1
+ exit 1
fi
build_${BUILD_SUFFIX}/bin/raja-perf-omptarget.exe --show-progress --refvar Base_OMPTarget
fi
elif [ "$2" == "unit" ]; then
- cd build_${BUILD_SUFFIX}
- make test
+ cd build_${BUILD_SUFFIX} || exit
+ make test
else
- echo Error: $2 not a recognized option.
+ echo Error: "$2" not a recognized option.
usage
exit 1
fi
@@ -144,4 +139,4 @@ else
usage
exit 1
fi
-popd
+popd || exit
diff --git a/bin/run_rocm_test.sh b/bin/run_rocm_test.sh
index b3eab9ab14..68b8eb6e12 100755
--- a/bin/run_rocm_test.sh
+++ b/bin/run_rocm_test.sh
@@ -20,18 +20,7 @@ export CLEANUP=0
# whats the OS ?
cat /etc/os-release
-rocm-smi
-rocminfo
-# Export SKIP_USM=1 if xnack can not be turned ON, even with HSA_XNACK=1.
-# Makefile.defs uses SKIP_USM env var to disable compilation and execution
-# of the tests which require USM support.
-SKIP_USM=0
-XNACK_PLUS=$(HSA_XNACK=1 rocminfo | grep -i "xnack+" | wc -l)
-if [ $XNACK_PLUS -eq 0 ]; then
- SKIP_USM=1
-fi
-export SKIP_USM=$SKIP_USM
if [ -e /usr/sbin/lspci ]; then
lspci_loc=/usr/sbin/lspci
@@ -65,18 +54,20 @@ if [ $ISVIRT -eq 1 ] ; then
# run on configurations that do not support USM.
export OMPX_STRICT_SANITY_CHECKS={OMPX_STRICT_SANITY_CHECKS:-1}
-SUITE_LIST=${SUITE_LIST:-"examples smoke-limbo smoke smoke-asan smoke-fort smoke-fort-limbo omp5 openmpapps ovo sollve babelstream fortran-babelstream accel2023 hpc2021"}
+ SUITE_LIST=${SUITE_LIST:-"examples smoke-limbo smoke smoke-asan smoke-fort smoke-fort-limbo omp5 openmpapps ovo babelstream fortran-babelstream accel2023 hpc2021"}
else
-SUITE_LIST=${SUITE_LIST:-"examples smoke-limbo smoke smoke-asan smoke-fort smoke-fort-limbo omp5 openmpapps LLNL nekbone ovo sollve babelstream fortran-babelstream accel2023 hpc2021"}
+ SUITE_LIST=${SUITE_LIST:-"examples smoke-limbo smoke-dev smoke-fort-dev smoke smoke-asan smoke-fort smoke-fort-limbo omp5 openmpapps LLNL nekbone ovo babelstream fortran-babelstream accel2023 hpc2021"}
fi
-blockinglist="examples smoke smoke-limbo openmpapps sollve45 sollve50 babelstream ovo accel2023 hpc2021 nekbone smoke-fort smoke-fort-limbo"
-EPSDB_LIST=${EPSDB_LIST:-"examples smoke-limbo smoke-dev smoke smoke-asan omp5 openmpapps LLNL nekbone ovo sollve babelstream fortran-babelstream accel2023 hpc2021 smoke-fort smoke-fort-limbo smoke-fort-dev"}
+blockinglist="examples smoke smoke-limbo openmpapps sollve45 sollve50 sollve51 sollve52 babelstream ovo accel2023 hpc2021 nekbone smoke-fort smoke-fort-limbo"
+
+EPSDB_LIST=${EPSDB_LIST:-"examples smoke-limbo smoke-dev smoke smoke-asan omp5 openmpapps LLNL nekbone ovo babelstream fortran-babelstream accel2023 hpc2021 smoke-fort smoke-fort-limbo smoke-fort-dev"}
+THEROCK_LIST=${THEROCK_LIST:-"smoke smoke-fort nekbone babelstream fortran-babelstream accel2023 hpc2021"}
export AOMP_USE_CCACHE=0
-echo $SUITE_LIST
-echo $blockinglist
+echo Initial SUITE_LIST: $SUITE_LIST
+echo Blocking List: $blockinglist
# Use bogus path to avoid using target.lst, a user-defined target list
# used by rocm_agent_enumerator.
@@ -112,13 +103,13 @@ fi
# Set AOMP to point to rocm symlink or newest version.
if [ -e /opt/rocm/lib/llvm/bin ]; then
AOMP=${AOMP:-"/opt/rocm/lib/llvm"}
- ROCMINF=/opt/rocm
- ROCMDIR=/opt/rocm/lib
+ ROCMINF="$AOMP/../../"
+ ROCMDIR="$AOMP/../../"
echo setting 1 $AOMP
elif [ -e /opt/rocm/llvm/bin ]; then
AOMP=${AOMP:-"/opt/rocm/llvm"}
- ROCMINF=/opt/rocm
- ROCMDIR=/opt/rocm
+ ROCMINF="$AOMP/../"
+ ROCMDIR="$AOMP/../"
echo setting 2 $AOMP
else
newestrocm=$(ls --sort=time /opt | grep -m 1 rocm)
@@ -137,42 +128,107 @@ fi
export AOMP
echo "AOMP = $AOMP"
export REAL_AOMP=`realpath $AOMP`
+"$ROCMINF/bin/rocm-smi"
+"$ROCMINF/bin/rocminfo"
-function extract_rpm(){
- local test_package=$1
- cd $tmpdir
- rpm2cpio $test_package | cpio -idmv > /dev/null
- script=$(find . -type f -name 'run_rocm_test.sh')
- cd $(dirname $script)
-}
+# Export SKIP_USM=1 if xnack can not be turned ON, even with HSA_XNACK=1.
+# Makefile.defs uses SKIP_USM env var to disable compilation and execution
+# of the tests which require USM support.
+SKIP_USM=0
+XNACK_PLUS=$(HSA_XNACK=1 "$ROCMINFO/binrocminfo" | grep -i "xnack+" | wc -l)
+if [ $XNACK_PLUS -eq 0 ]; then
+ SKIP_USM=1
+fi
+export SKIP_USM=$SKIP_USM
-# Keep support for older release testing that will not have release branch
-# updated. From 6.2 onwards the openmp-extras-tests package will be used for testing.
-if [[ $REAL_AOMP =~ "/opt/rocm-6.0" ]] || [[ $REAL_AOMP =~ "/opt/rocm-6.1" ]]; then
- if [ "$TEST_BRANCH" == "" ]; then
- git reset --hard
- export TEST_BRANCH="aomp-test-6.0-6.1"
- git checkout 080e9bc62ad8501defc4ec9124c90e28a1f749db
+# Download FileCheck if not present
+mkdir -p "$HOME/openmp-utils/bin"
+if [ ! -f "$AOMP/bin/FileCheck" ]; then
+ rm -f "$HOME/openmp-utils/bin/FileCheck"
+ if ! wget -P "$HOME/openmp-utils/bin" https://compute-artifactory.amd.com/artifactory/rocm-generic-local/compiler-infra/FileCheck ; then
+ echo "Error: Could not download FileCheck"
+ exit 1
fi
- echo "+++ Using $TEST_BRANCH +++"
- sleep 5
- ./run_rocm_test.sh
- exit $?
+ chmod 755 "$HOME/openmp-utils/bin/FileCheck"
fi
+if [ ! -f "$AOMP/bin/gpurun" ]; then
+ rm -f "$HOME/openmp-utils/bin/gpurun"
+ if ! wget -P "$HOME/openmp-utils/bin" https://compute-artifactory.amd.com/artifactory/rocm-generic-local/compiler-infra/gpurun ; then
+ echo "Error: Could not download gpurun"
+ exit 1
+ fi
+ chmod 755 "$HOME/openmp-utils/bin/gpurun"
+ export GPURUN_BINDIR="$HOME/openmp-utils/bin"
+fi
clangversion=`$AOMP/bin/clang --version`
aomp=0
if [[ "$clangversion" =~ "AOMP_STANDALONE" ]]; then
aomp=1
fi
+if [ $aomp -eq 0 ]; then
+ # Determine ROCm version.
+ echo ROCMINF=$ROCMINF
+ rocm=$(cat "$ROCMINF"/.info/version*|head -1)
+ rocmregex="([0-9]+\.[0-9]+\.[0-9]+)"
+ therock=0
+ rocmver=0
+ if [[ "$rocm" =~ $rocmregex ]]; then
+ rocmver=$(echo ${BASH_REMATCH[1]} | sed "s/\.//g")
+ echo rocmver: $rocmver
+ if [ $rocmver -ge 7100 ]; then
+ echo "--- Using TheRock Compiler ---"
+ therock=1
+ fi
+ else
+ echo Unable to determine rocm version.
+ exit 1
+ fi
+fi
+
+function extract_rpm(){
+ local test_package=$1
+ cd $tmpdir
+ rpm2cpio $test_package | cpio -idmv > /dev/null
+ script=$(find . -type f -name 'run_rocm_test.sh')
+ cd $(dirname $script)
+}
+
+#if [ $therock -eq 1 ] && [ "$EPSDB" != "1" ] ; then
+# if [ "$TEST_BRANCH" == "" ]; then
+# if ! aomprev=$(grep -Po "OPENMP_TEST_REVISION \K\w+" "$AOMP/include/llvm/Config/llvm-config.h"); then
+# echo "Error: Cannot determine aomp revision from llvm-config.h"
+# exit 1
+# else
+# echo "Using aomp hash: $aomprev"
+# fi
+
+ #if ! git checkout $aomprev ; then
+ # if ! git stash
+ # git reset --hard
+ # fi
+ # if ! git checkout $aomprev; then
+ # echo "Fatal Error: Cannot checkout $aomprev for aomp."
+# exit 1
+# fi
+# fi
+# export TEST_BRANCH=$aomprev
+# fi
+# echo "+++ Using $TEST_BRANCH +++"
+# sleep 5
+# ./run_rocm_test.sh
+# exit $?
+#fi
+
+
# Support for using openmp-extras-tests package.
if [ "$aomp" != 1 ]; then
tmpdir="$HOME/tmp/openmp-extras"
os_name=$(cat /etc/os-release | grep NAME)
test_package_name="openmp-extras-tests"
- if [ "$SKIP_TEST_PACKAGE" != 1 ] && [ "$TEST_BRANCH" == "" ]; then
+ if [ $therock -eq 0 ] && [ "$SKIP_TEST_PACKAGE" != 1 ] && [ "$TEST_BRANCH" == "" ]; then
rm -rf $tmpdir
mkdir -p $tmpdir
export debsupport=0
@@ -344,6 +400,13 @@ if [[ $AOMP_GPU == gfx1* ]]; then
fi
# Run quick sanity test
echo
+echo "check-xnack test"
+cd "$aompdir"/test/smoke-dev/check-xnack
+make clean > /dev/null
+VERBOSE=1 make
+./check-xnack
+HSA_XNACK=1 OMPX_APU_MAPS=1 ./check-xnack
+echo
echo "Helloworld sanity test:"
cd "$aompdir"/test/smoke/helloworld
make clean > /dev/null
@@ -372,30 +435,18 @@ function getversion(){
versions[543]=5.4.3
versions[550]=5.5.0
- if [ $aomp -eq 1 ]; then
- echo "AOMP detected at $AOMP, skipping ROCm version detections"
+ if [ $aomp -eq 1 ] || [ $therock -eq 1 ]; then
maxvers=`echo $supportedvers | grep -o "[0-9].[0-9].[0-9]$" | sed -e 's/\.//g'`
versionregex="(.*${versions[$maxvers]})"
if [[ "$supportedvers" =~ $versionregex ]]; then
finalvers=${BASH_REMATCH[1]}
else
- echo "AOMP - Cannot select proper version list."
+ echo "Error: Cannot select proper version list."
exit 1
fi
+ echo "AOMP or TheRock detected at $AOMP, skipping ROCm version detections"
echo "Selecting highest supported version: ${versions[$maxvers]}"
else
- # Determine ROCm version.
- echo ROCMINF=$ROCMINF
- rocm=$(cat "$ROCMINF"/.info/version*|head -1)
- rocmregex="([0-9]+\.[0-9]+\.[0-9]+)"
- if [[ "$rocm" =~ $rocmregex ]]; then
- rocmver=$(echo ${BASH_REMATCH[1]} | sed "s/\.//g")
- echo rocmver: $rocmver
- else
- echo Unable to determine rocm version.
- exit 1
- fi
-
# Determine OS flavor to properly query openmp-extras version.
osname=$(cat /etc/os-release | grep -e ^NAME=)
# Regex to cover single/multi version installs for deb/rpm.
@@ -459,6 +510,7 @@ function getversion(){
fi
fi
}
+
function notAllMustPass() {
#if [ "$1" != "smoke" ] && [ "$1" != "smoke-limbo" ] && [ "$1" != "smoke-fort" ] && [ "$1" != "smoke-fort-limbo" ]; then
if [ "$1" != "smoke" ] && [ "$1" != "smoke-limbo" ] && [ "$1" != "smoke-fort" ] && [ "$1" != "examples_openmp" ] && [ "$1" != "examples_fortran" ]; then
@@ -599,7 +651,7 @@ function copyresults(){
fi
done
fi
- elif [[ "$1" =~ sollve|ovo|LLNL|openmpapps ]]; then
+ elif [[ "$1" =~ sollve|OpenMP_VV|ovo|LLNL|openmpapps ]]; then
# Combine passing/failing tests, which shows all tests that tried to build/run.
# If the unexpected failure is not on that list, warn the user that test may be missing
# from suite.
@@ -824,7 +876,7 @@ function smoke-fort(){
if [ "$SMOKE_FORT" == "1" ]; then
mkdir -p "$resultsdir"/smoke-fort
cd "$aompdir"/test/smoke-fort
- ./check_smoke_fort.sh
+ AOMP_PARALLEL_SMOKE=1 ./check_smoke_fort.sh
checkrc $?
copyresults smoke-fort "$aompdir"/test/smoke-fort
else
@@ -893,24 +945,24 @@ function OpenMP_VV(){
SKIP_SOLLVE51=1 SKIP_SOLLVE52=1 ./run_OpenMP_VV.sh
fi
- ./check_sollve.sh
+ ./check_openmpvv.sh
checkrc $?
# 4.5 Results
- cd "$AOMP_TEST_DIR"/sollve_vv/results_report45
- copyresults sollve45
+ cd "$AOMP_TEST_DIR"/OpenMP_VV/results_report45
+ copyresults openmpvv45
# 5.0 Results
- cd "$AOMP_TEST_DIR"/sollve_vv/results_report50
- copyresults sollve50
+ cd "$AOMP_TEST_DIR"/OpenMP_VV/results_report50
+ copyresults openmpvv50
# 5.1 Results
- cd "$AOMP_TEST_DIR"/sollve_vv/results_report51
- copyresults sollve51
+ cd "$AOMP_TEST_DIR"/OpenMP_VV/results_report51
+ copyresults openmpvv51
# 5.2 Results
- cd "$AOMP_TEST_DIR"/sollve_vv/results_report52
- copyresults sollve52
+ cd "$AOMP_TEST_DIR"/OpenMP_VV/results_report52
+ copyresults openmpvv52
}
function sollve(){
@@ -1006,7 +1058,8 @@ function accel2023(){
./run_accel2023.sh -clean
cd $AOMP_TEST_DIR/accel2023-2.0.18
grep ratio= result/*.log
- echo "" > make-fail.txt
+ grep "Error building" result/*.log | awk '{print $4}' > "$resultsdir"/accel2023/make-fail.txt
+ cat "$resultsdir"/accel2023/make-fail.txt > make-fail.txt
grep ratio= result/*.log | grep Succ | awk '{print $2}' > "$resultsdir"/accel2023/passing-tests.txt
cat "$resultsdir"/accel2023/passing-tests.txt | tee passing-tests.txt
grep ratio= result/*.log | grep -v Succ | awk '{print $2}' > "$resultsdir"/accel2023/failing-tests.txt
@@ -1026,7 +1079,7 @@ function hpc2021(){
echo "running on ubuntu"
pushd /tmp;
#WLOC=http://roclogin.amd.com/SPEC
- WLOC=http://aomp-tr01.amd.com/SPEC
+ WLOC=https://compute-artifactory.amd.com/artifactory/rocm-generic-local/compiler-infra
wget --timeout 15 --tries=3 -q $WLOC/npsdbOmpi.tar
tar xf npsdbOmpi.tar
rm -f npsdbOmpi.tar
@@ -1038,7 +1091,8 @@ function hpc2021(){
./run_hpc2021.sh -clean
cd $AOMP_TEST_DIR/hpc2021-1.1.9
grep ratio= result/*.log
- echo "" > make-fail.txt
+ grep "Error building" result/*.log | awk '{print $4}' > "$resultsdir"/hpc2021/make-fail.txt
+ cat "$resultsdir"/hpc2021/make-fail.txt > make-fail.txt
grep ratio= result/*.log | grep Succ | awk '{print $2}' > "$resultsdir"/hpc2021/passing-tests.txt
cat "$resultsdir"/hpc2021/passing-tests.txt | tee passing-tests.txt
grep ratio= result/*.log | grep -v Succ | awk '{print $2}' > "$resultsdir"/hpc2021/failing-tests.txt
@@ -1059,7 +1113,9 @@ rm -rf $resultsdir
mkdir -p $resultsdir
# Run Tests
-if [ "$EPSDB" == "1" ]; then
+if [ $therock -eq 1 ]; then
+ SUITE_LIST="$THEROCK_LIST"
+elif [ "$EPSDB" == "1" ]; then
SUITE_LIST="$EPSDB_LIST"
fi
echo Running List: $SUITE_LIST
diff --git a/bin/run_rushlarsen.sh b/bin/run_rushlarsen.sh
index 8a60709d45..f74cbd5c11 100755
--- a/bin/run_rushlarsen.sh
+++ b/bin/run_rushlarsen.sh
@@ -28,7 +28,7 @@ omp_dir="tests/rush_larsen/rush_larsen_gpu_omp"
omp_exec="rush_larsen_gpu_omp"
fomp_f90="$AOMP/bin/$FLANG"
-fomp_flags="-O3 -fopenmp --offload-arch=$AOMP_GPU -DOMP -DOMP_TARGET_GPU -g"
+fomp_flags="-O3 -fopenmp --offload-arch=$AOMP_GPU -DOMP -DOMP_TARGET_GPU -g -save-temps"
fomp_dir="tests/rush_larsen/rush_larsen_gpu_omp_fort"
fomp_exec="rush_larsen_gpu_omp_fort"
diff --git a/bin/run_su3bench.sh b/bin/run_su3bench.sh
index a98a79d74b..629201549f 100755
--- a/bin/run_su3bench.sh
+++ b/bin/run_su3bench.sh
@@ -28,8 +28,8 @@ RUN_OPTIONS=${RUN_OPTIONS:-"openmp"}
#hip_src="main.cpp HIPStream.cpp"
#std="-std=c++11"
-if [ -d $AOMP_REPOS_TEST/su3_bench ]; then
- cd $AOMP_REPOS_TEST/su3_bench
+if [ -d $AOMP_REPOS_TEST/su3bench ]; then
+ cd $AOMP_REPOS_TEST/su3bench
rm -f results.txt
else
echo "ERROR: su3bench found in $AOMP_REPOS_TEST."
@@ -39,8 +39,14 @@ fi
echo RUN_OPTIONS: $RUN_OPTIONS
for option in $RUN_OPTIONS; do
if [ "$option" == "openmp" ]; then
+ # Update Makefile with detected GPU architecture
+ if [ -f Makefile.openmp ]; then
+ sed -i "s/-march=gfx[0-9a-zA-Z]*/-march=$AOMP_GPU/g" Makefile.openmp
+ echo "Updated Makefile.openmp: -march=$AOMP_GPU"
+ fi
make -f Makefile.openmp clean
export PATH=$AOMP/bin:$PATH
+ export LD_LIBRARY_PATH=$AOMP/lib:$LD_LIBRARY_PATH
make -f Makefile.openmp VENDOR=amd ARCH=MI200 all
if [ $? -ne 1 ]; then
./bench_f32_openmp.exe 2>&1 | tee -a results.txt
diff --git a/bin/run_theRockCI.sh b/bin/run_theRockCI.sh
new file mode 100755
index 0000000000..41fbe2107a
--- /dev/null
+++ b/bin/run_theRockCI.sh
@@ -0,0 +1,402 @@
+#!/bin/bash
+# Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+# run_theRockCI.sh
+# runs smoke, smoke-fort, smoke-limbo, smoke-fort-libmo,
+# babelstream fortran-babelstream accel2023 hpc2021 openmpapps
+# override with SUITE_LIST
+# Please check with Ron or Ethan for script modifications.
+date
+SUITE_LIST=${SUITE_LIST:-"smoke-limbo smoke-fort-limbo smoke smoke-fort nekbone babelstream fortran-babelstream accel2023 bldopenmpi hpc2021 openmpapps"}
+declare -A assocSuite=(
+["smoke-limbo"]=" 5 minutes"
+["smoke-fort-limbo"]=" 2 minutes"
+["smoke"]=" 20 minutes"
+["smoke-fort"]=" 8 minutes"
+["nekbone"]=" 1 minute"
+["babelstream"]=" 1 minute"
+["fortran-babelstream"]=" 1 minute"
+["accel2023"]=" 3 minutes"
+["bldopenmpi"]=" 6 minutes"
+["hpc2021"]=" 4 minutes"
+["openmpapps"]=" 2 minutes"
+)
+
+function hide_unrunnable_files() {
+set -x
+pushd $aompdir/test/smoke/
+mkdir .savem
+mv clang-host-targ clang-host-targ2 flags host_targ usm-globals-with-pragma usm-globals-with-pragma usm-globals .savem/
+popd
+pushd $aompdir/test/smoke-fort
+mkdir .savem
+mv flang-gpu-abort .savem/
+popd
+pushd $aompdir/test/smoke-limbo
+mkdir .savem
+mv hipreg_usm usm-locals-pragma-xnack-enabled-xnack-any usm-locals-pragma-xnack-enabled-xnack-plus .savem/
+popd
+set +x
+}
+
+
+ulimit -t 400
+ulimit -s unlimited
+
+tmpfile=/tmp/smoke-$$
+export PATH=$PATH:/opt/rocm/bin
+echo "PATH=" $PATH
+which lspci
+which rocm-smi
+which rocminfo
+which make
+
+export GPURUN_BYPASS=1
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/llvm/lib
+echo "LD_LIBRARY_PATH="$LD_LIBRARY_PATH
+pip install --no-warn-script-location filecheck
+export FILECHECK=`which filecheck`
+echo filecheck: $FILECHECK
+
+RUN_SPEC=1
+WLOC=https://compute-artifactory.amd.com/artifactory/rocm-generic-local/compiler-infra
+wget --timeout 5 --tries=2 $WLOC/Accel23-scripts.tar
+if [ "$?" -ne 0 ]; then
+ echo "SPECScripts not accessible " $?
+ RUN_SPEC=0
+else
+ echo "SPECscripts are available"
+fi
+
+if [ "$SKIP_QUICK" == "" ]; then
+./rocm_quick_check.sh
+fi
+export ROCR_VISIBLE_DEVICES=0
+export AOMP_USE_CCACHE=0
+
+echo $SUITE_LIST
+
+TLOG=/tmp/log$$
+echo "================" >$TLOG
+
+# Use bogus path to avoid using target.lst, a user-defined target list
+# used by rocm_agent_enumerator.
+export ROCM_TARGET_LST=/opt/nowhere
+
+
+realpath=`realpath $0`
+scriptdir=`dirname $realpath`
+parentdir=`eval "cd $scriptdir;pwd;cd - > /dev/null"`
+aompdir="$(dirname "$parentdir")"
+summary=`pwd`"/summary.txt"
+
+if [ "$SKIP_CLONE" == "" ]; then
+ EPSDB=1 ./clone_test.sh
+fi
+AOMP_TEST_DIR=${AOMP_TEST_DIR:-"$HOME/git/aomp-test"}
+echo AOMP before : $AOMP
+if [ ! -e $AOMP/bin ]; then
+ echo $AOMP does not point to valid location, unsetting
+ unset AOMP
+fi
+# Set AOMP to point to rocm symlink or newest version.
+if [ -e /opt/rocm/lib/llvm/bin ]; then
+ AOMP=${AOMP:-"/opt/rocm/lib/llvm"}
+ ROCMINF=/opt/rocm
+ ROCMDIR=/opt/rocm/lib
+ echo setting 1 $AOMP
+elif [ -e /opt/rocm/llvm/bin ]; then
+ AOMP=${AOMP:-"/opt/rocm/llvm"}
+ ROCMINF=/opt/rocm
+ ROCMDIR=/opt/rocm
+ echo setting 2 $AOMP
+else
+ pushd $AOMP
+ cd `realpath .`
+ cd ../..
+ ROCMINF=`pwd`/
+ ROCMDIR=`pwd`
+ popd
+fi
+export AOMP
+echo "AOMP = $AOMP"
+
+if [ ! -f "$AOMP/bin/gpurun" ]; then
+ echo "Error: Could not find gpurun"
+ exit 1
+fi
+
+clangversion=`$AOMP/bin/clang --version`
+aomp=0
+if [[ "$clangversion" =~ "AOMP_STANDALONE" ]]; then
+ aomp=1
+fi
+
+# Make sure clang is present.
+$AOMP/bin/clang --version
+if [ $? -ne 0 ]; then
+ echo "Error: Clang not found at "$AOMP"/bin/clang."
+ exit 1
+fi
+
+$AOMP/bin/flang --version
+if [ $? -ne 0 ]; then
+ echo "Error: flang not found at "$AOMP"/bin/flang."
+ exit 1
+fi
+
+# Use bogus path to avoid using target.lst, a user-defined target list
+# used by rocm_agent_enumerator.
+export ROCM_TARGET_LST=/opt/nowhere
+
+echo "AMDGPU devices:"
+$ROCMINF/bin/rocm_agent_enumerator
+
+# Set AOMP_GPU.
+# Regex skips first result 'gfx000' and selects second id.
+if [ "$AOMP_GPU" == "" ]; then
+ AOMP_GPU=$($ROCMINF/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
+fi
+
+# mygpu will eventually relocate to /opt/rocm/bin, support both cases for now.
+if [ "$AOMP_GPU" != "" ]; then
+ echo "AOMP_GPU set with rocm_agent_enumerator."
+else
+ echo "AOMP_GPU is empty, use mygpu."
+ if [ -a $AOMP/bin/mygpu ]; then
+ AOMP_GPU=$($AOMP/bin/mygpu)
+ else
+ AOMP_GPU=$($AOMP/../bin/mygpu)
+ fi
+fi
+if [ "$AOMP_GPU" == "" ]; then
+ echo "Error: AOMP_GPU was not able to be set with RAE or mygpu."
+ exit 1
+fi
+echo AOMP_GPU=$AOMP_GPU
+export AOMP_GPU
+
+# Run quick sanity test
+echo
+echo "check-xnack test"
+cd "$aompdir"/test/smoke-limbo/check-xnack
+make clean > /dev/null
+VERBOSE=1 make
+./check-xnack
+HSA_XNACK=1 OMPX_APU_MAPS=1 ./check-xnack
+echo
+echo "Helloworld sanity test:"
+cd "$aompdir"/test/smoke/helloworld
+make clean > /dev/null
+OMP_TARGET_OFFLOAD=MANDATORY VERBOSE=1 make run > hello.log 2>&1
+sed -n -e '/ld.lld/,$p' hello.log
+echo
+echo "Checking plugin"
+LIBOMPTARGET_DEBUG=1 OMP_TARGET_OFFLOAD=MANDATORY make run 2>&1 | grep "libomptarget.rtl.amdgpu"
+echo
+
+function checkRes() {
+ tail -100 $1
+ actual=`grep "Passing tests: " $1 | awk -F'[ /\033]' '{print $4}'`
+ expect=`grep "Passing tests: " $1 | awk -F'[ /\033]' '{print $5}'`
+ if [ "$actual" == "$expect" ]; then
+ return 0;
+ else
+ return 1;
+ fi
+}
+
+function smoke-fort(){
+ echo "%================ smoke-fort"
+ cd "$aompdir"/test/smoke-fort
+ ./check_smoke_fort.sh > $tmpfile 2>&1
+ checkRes $tmpfile
+ if [ "$?" == 0 ]; then
+ echo "Passed smoke-fort">> $TLOG
+ else
+ echo "FAILED smoke-fort">> $TLOG
+ fi
+}
+
+function smoke(){
+ echo "%================ smoke"
+ cd "$aompdir"/test/smoke
+ ./check_smoke.sh > $tmpfile 2>&1
+ checkRes $tmpfile
+ if [ "$?" == 0 ]; then
+ echo "Passed smoke" >> $TLOG
+ else
+ echo "FAILED smoke" >> $TLOG
+ fi
+}
+
+function smoke-fort-limbo(){
+ echo "%================ smoke-fort-limbo"
+ cd "$aompdir"/test/smoke-fort-limbo
+ ./check_smoke_fort_limbo.sh > $tmpfile 2>&1
+ checkRes $tmpfile
+ if [ "$?" == 0 ]; then
+ echo "Passed smoke-fort-limbo" >> $TLOG
+ else
+ echo "FAILED smoke-fort-limbo" >> $TLOG
+ fi
+}
+
+function smoke-limbo(){
+ echo "%================ smoke-limbo"
+ cd "$aompdir"/test/smoke-limbo
+ export SKIP_OMPT=1
+ ./check_smoke_limbo.sh > $tmpfile 2>&1
+ unset SKIP_OMPT
+ checkRes $tmpfile
+ if [ "$?" == 0 ]; then
+ echo "Passed smoke-limbo" >> $TLOG
+ else
+ echo "FAILED smoke-limbo" >> $TLOG
+ fi
+}
+
+function openmpapps(){
+ echo "%================ openmpapps"
+ # -----Run Openmpapps-----
+ cd "$AOMP_TEST_DIR"/openmpapps
+ rm -rf matmul_usm hpgmg-mp4
+ echo rockMPI=$MPI
+ ./check_openmpapps.sh
+ git checkout .
+ if [ "$?" == 0 ]; then
+ echo "Passed openmpapps" >> $TLOG
+ else
+ echo "FAILED openmpapps" >> $TLOG
+ fi
+}
+
+function nekbone(){
+ echo "%================ nekbone"
+ # -----Run Nekbone-----
+ cd "$aompdir"/bin
+ ( VERBOSE=0 ./run_nekbone.sh )
+ if [ "$?" == 0 ]; then
+ echo "Passed Nekbone" >> $TLOG
+ else
+ echo "FAILED Nekbone" >> $TLOG
+ fi
+}
+
+function babelstream(){
+ echo "%================ babelestream"
+ export AOMPHIP=$ROCMDIR
+ cd "$aompdir"/bin
+ if [ $aomp -eq 0 ]; then
+ export ROCMINFO_BINARY=$ROCMINF/bin/rocminfo
+ fi
+ export RUN_OPTIONS="omp-default omp-fast"
+ ./run_babelstream.sh
+ if [ "$?" == 0 ]; then
+ echo "Passed Babelstream" >> $TLOG
+ else
+ echo "FAILED Babelstream" >> $TLOG
+ fi
+}
+
+function fortran-babelstream(){
+ echo "%================ fortran-babelstream"
+ export AOMPHIP=$ROCMDIR
+ cd "$aompdir"/bin
+ if [ "$?" != 0 ]; then
+ export ROCMINFO_BINARY=$ROCMINF/bin/rocminfo
+ fi
+ ./run_fBabel.sh
+ if [ "$?" == 0 ]; then
+ echo "Passed fortran-babelstream" >> $TLOG
+ else
+ echo "FAILED fortran-babelstream" >> $TLOG
+ fi
+}
+
+
+function accel2023(){
+ echo "%================ accel2023"
+ if [ "$RUN_SPEC" -eq 0 ]; then
+ echo "Skipping accel2023, runners external to AMD"
+ return 0
+ fi
+ cd "$aompdir"/bin
+ export GPURUN_BYPASS=1
+ ./run_accel2023.sh -clean
+ cd $AOMP_TEST_DIR/accel2023-2.0.18
+ grep ratio= result/*.log | tail -12
+ nsucc=$(grep ratio= result/*.log | grep Succ | wc -l)
+ if [ $nsucc -eq 12 ]; then
+ echo "Passed accel2023 $nsucc passes" >> $TLOG
+ else
+ echo "FAILED accel2023 $nsucc passes" >> $TLOG
+ fi
+}
+
+function hpc2021(){
+ echo "%================ hpc2021"
+ if [ "$RUN_SPEC" -eq 0 ]; then
+ echo "Skipping hpc2021, runners external to AMD"
+ return 0
+ fi
+ cd "$aompdir"/bin
+ unset ROCR_VISIBLE_DEVICES
+ export GPURUN_BYPASS=1
+ echo rockMPI=$MPI
+ ./run_hpc2021.sh -clean
+ cd $AOMP_TEST_DIR/hpc2021-1.1.9
+ grep ratio= result/*.log | tail -9
+ nsucc=$(grep ratio= result/*.log | grep Succ | wc -l)
+ if [ $nsucc -eq 9 ]; then
+ echo "Passed hpc2021 $nsucc passes" >> $TLOG
+ else
+ echo "FAILED hpc2021 $nsucc passes" >> $TLOG
+ fi
+}
+
+function bldopenmpi(){
+ echo "%================ OpenMPI"
+ export NO_HPC2021_MPI_BLD=1
+ export INST=${INST:-/tmp/npsdbInst$$/openmpi-5-flang}
+ export MPI=$INST
+ echo rocmMPI=$MPI
+ pushd $aompdir/bin
+ ./npsdb_bld_ompi.sh
+ popd
+}
+
+echo Running List: $SUITE_LIST
+
+hide_unrunnable_files
+
+declare -A warnings
+warningcount=0
+for suite in $SUITE_LIST; do
+ echo "=== Running $suite `date` ==="
+ echo "--- expected time: ${assocSuite[$suite]}"
+ if [[ "$suite" =~ "smoke" ]]; then
+ $suite 2>&1 |tail -200
+ else
+ $suite
+ fi
+done
+
+echo "************************************" > $summary
+grep -i -q fail $TLOG
+scriptfails=$?
+if [ "$scriptfails" == 0 ]; then
+ echo FAIL >> $summary
+ echo "EPSDB Status: red" >> $summary
+ RC=1
+else
+ echo PASS >> $summary
+ echo "EPSDB Status: green" >> $summary
+ RC=0
+fi
+cat $TLOG
+echo ""
+echo >> $summary
+cat $summary
+date
+exit $((RC))
diff --git a/bin/run_umt.sh b/bin/run_umt.sh
index 75cb3da274..11b2afb416 100755
--- a/bin/run_umt.sh
+++ b/bin/run_umt.sh
@@ -38,7 +38,7 @@ export UMPIRE_SRC_DIR=${UMPIRE_SRC_DIR:-UMPIRE}
export AOMP_SUPP=${AOMP_SUPP:-$HOME/local}
export CMAKE=$AOMP_SUPP/cmake/bin
-export MPI=$AOMP_SUPP/llvm-flang/openmpi
+export MPI=$AOMP_SUPP/openmpi
export LIBRARY_PATH=$AOMP/lib:$AOMPHIP/lib:$MPI/bin:$MPI/include:$LIBRARY_PATH
export LD_LIBRARY_PATH=$AOMP/lib:$AOMPHIP/lib:$MPI/bin:$MPI/include:$LD_LIBRARY_PATH
export PATH=$MPI:$AOMP/bin:$AOMPHIP/bin:$MPI/bin:$MPI/include:$PATH
@@ -52,6 +52,15 @@ function usage(){
echo ""
}
+mystat=0
+allstat=0
+save_status() {
+ mystat=$?
+ allstat=$((allstat+mystat))
+ echo "status: $mystat, allstat: $allstat"
+ return $mystat
+}
+
# Clone and Build UMT and dependencies
# NOTE: May wish to add fixed release/tag versions of each repository rather
# than most recent dev branch. But catching errors as they come seems helpful
@@ -68,7 +77,14 @@ if [ "$1" == "build_umt" ]; then
# no build required for BLT
pushd $AOMP_REPOS_TEST/$BLT_SRC_DIR
git clone https://github.com/LLNL/blt.git .
+ save_status
popd
+ if [[ $mystat -eq 0 ]]; then
+ echo "PATCH SUCCESS BLT"
+ else
+ echo "PATCH FAILED BLT, mystat: $mystat"
+ exit $mystat
+ fi
pushd $AOMP_REPOS_TEST/$CAMP_SRC_DIR
git clone https://github.com/LLNL/camp.git .
@@ -83,6 +99,7 @@ if [ "$1" == "build_umt" ]; then
../
make clean
make install
+ save_status
popd
popd
@@ -116,6 +133,7 @@ if [ "$1" == "build_umt" ]; then
-DENABLE_DOCS=OFF -DENABLE_FORTRAN=ON -DENABLE_MPI=ON -DENABLE_HIP=ON
make clean
make install
+ save_status
popd
popd
@@ -125,7 +143,21 @@ if [ "$1" == "build_umt" ]; then
# This applies specific tweaks to UMT required for Flang, we can likely
# remove this in the near future once it's incorporated into UMT and
# one or two smaller flang bugs are squashed
- git apply $thisdir/patches/UMT-amdflang-mods.patch
+ git apply $thisdir/patches/UMT-5-9-0-amdflang-mods.patch
+ save_status
+ if [[ $mystat -eq 0 ]]; then
+ echo "PATCH SUCCESS UMT"
+ else
+ echo "PATCH FAILED UMT, mystat: $mystat"
+ exit $mystat
+ fi
+
+ IMPLICIT_GPU_FLANG_RT=${IMPLICIT_GPU_FLANG_RT:-1}
+ if [[ $IMPLICIT_GPU_FLANG_RT -eq 1 ]]; then
+ FORTRAN_OFFLOAD_LIB=
+ else
+ FORTRAN_OFFLOAD_LIB=$AOMP/lib/libflang_rt.hostdevice.a
+ fi
rm -rf build
mkdir build
@@ -137,7 +169,7 @@ if [ "$1" == "build_umt" ]; then
-DUMPIRE_ROOT=$AOMP_REPOS_TEST/$UMPIRE_SRC_DIR/install \
-DCAMP_ROOT=$AOMP_REPOS_TEST/$CAMP_SRC_DIR/install \
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_Fortran_COMPILER=$FC \
- -DCMAKE_FORTRAN_OFFLOAD_LIB=$AOMP/lib/libflang_rt.hostdevice.a \
+ -DCMAKE_FORTRAN_OFFLOAD_LIB=$FORTRAN_OFFLOAD_LIB \
-DCMAKE_Fortran_LINKER_WRAPPER_FLAG="-Wl," \
-DENABLE_CUDA=OFF \
-DENABLE_OPENMP=ON -DOPENMP_HAS_FORTRAN_INTERFACE=ON \
@@ -149,29 +181,54 @@ if [ "$1" == "build_umt" ]; then
make clean
make install
+ save_status
popd
popd
- exit 1
+ if [[ $allstat -eq 0 ]]; then
+ echo "BUILD SUCCESS"
+ else
+ echo "BUILD FAILED, allstat: $allstat"
+ fi
+ [[ $allstat -eq 0 ]]
+ exit $?
fi
# Run UMT
if [ "$1" == "run_umt" ]; then
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B global -g -c 20 -u 0 -d 3,3,3 -b 2
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B global -g -c 20 -u 1 -d 3,3,3 -b 2
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B global -g -c 20 -u 2 -d 3,3,3 -b 2
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B global -g -c 20 -u 0 -d 3,3,3 -b 1
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B global -g -c 20 -u 1 -d 3,3,3 -b 1
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B global -g -c 20 -u 2 -d 3,3,3 -b 1
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B local -g -c 20 -u 0 -d 3,3,3 -b 2
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B local -g -c 20 -u 1 -d 3,3,3 -b 2
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B local -g -c 20 -u 2 -d 3,3,3 -b 2
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B local -g -c 20 -u 0 -d 3,3,3 -b 1
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B local -g -c 20 -u 1 -d 3,3,3 -b 1
+ save_status
$AOMP_REPOS_TEST/$UMT_SRC_DIR/install/bin/test_driver -B local -g -c 20 -u 2 -d 3,3,3 -b 1
-
- exit 1
+ save_status
+
+ if [[ $allstat -eq 0 ]]; then
+ echo "TESTS PASSED"
+ else
+ echo "TESTS FAILED, allstat: $allstat"
+ fi
+ [[ $allstat -eq 0 ]]
+ exit $?
fi
usage
diff --git a/bin/spec-configs/hpc2021/amdgpu_clang.cfg b/bin/spec-configs/hpc2021/amdgpu_clang.cfg
index 45dbf0aec4..ecae917365 100644
--- a/bin/spec-configs/hpc2021/amdgpu_clang.cfg
+++ b/bin/spec-configs/hpc2021/amdgpu_clang.cfg
@@ -114,6 +114,8 @@ FPPPORTABILITY += -DSPEC_USE_MPIFH -I${MPI}/include/
513.soma_t,613.soma_s:
PORTABILITY += -DSPEC_NO_VAR_ARRAY_REDUCE
+ 518.tealeaf_t:
+ submit = OMPX_FORCE_SYNC_REGIONS=1 mpirun ${MPIRUN_OPTS} -np $ranks gpurun -s $command
532.sph_exa_t:
MPIRUN_OPTS += --mca topo basic
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
index af505d1350..f067205d6c 100644
--- a/docs/INSTALL.md
+++ b/docs/INSTALL.md
@@ -1,9 +1,6 @@
# AOMP Install
Platform Install Options:
-- [Ubuntu or Debian](UBUNTUINSTALL.md)
-- [SUSE SLES-15-SP5](SLES15INSTALL.md)
-- [RHEL 8/9](RHELINSTALL.md)
-- [Install Without Root](NOROOTINSTALL.md)
+- [Manylinux (alma8)](MANYLINUX.md)
- Build AOMP from source:
* [Prerequisites to install from source](SOURCEINSTALL_PREREQUISITE.md)
* [Build and install from release source tarball](RELEASESOURCEINSTALL.md)
diff --git a/docs/MANYLINUX.md b/docs/MANYLINUX.md
new file mode 100644
index 0000000000..7f7c69a1df
--- /dev/null
+++ b/docs/MANYLINUX.md
@@ -0,0 +1,13 @@
+# Install From Release Binary Tarball
+
+AOMP releases are now built on AlmaLinux (manylinux) can be installed on various operating systems from the release binary tarball.
+
+```
+ cd /usr/local
+ wget https://github.com/ROCm/aomp/releases/download/rel_23.0-0/aomp-23.0-0.tar.gz
+ tar -xzf aomp-23.0-0.tar.gz
+ ln -s aomp_23.0-0 aomp
+```
+```
+AOMP = /usr/local/aomp
+```
diff --git a/docs/RELEASESOURCEINSTALL.md b/docs/RELEASESOURCEINSTALL.md
index e299c6fd99..7efd6d649d 100644
--- a/docs/RELEASESOURCEINSTALL.md
+++ b/docs/RELEASESOURCEINSTALL.md
@@ -1,22 +1,20 @@
# Build and Install From Release Source Tarball
-The AOMP build and install from the release source tarball can be done manually or with spack.
+The AOMP build and install from the release source tarball can be done manually.
Building from source requires a number of platform dependencies.
-These dependencies are not yet provided with the spack configuration file.
-So if you are building from source either manually or building with spack, you must install the prerequisites for the platforms listed below.
## Source Build Prerequisites
-To build AOMP from source you must: 1. Install certain distribution packages, 2. Build CMake 3.25.2 from source, this can be done with build_prereq.sh 3. ensure the KFD kernel module is installed and operating, 4. create the Unix video group, and 5. install spack if required. [This link](SOURCEINSTALL_PREREQUISITE.md) provides instructions to satisfy all the AOMP source build dependencies.
+To build AOMP from source you must: 1. Install certain distribution packages, 2. Build CMake 3.25.2 from source, this can be done with build_prereq.sh 3. ensure the KFD kernel module is installed and operating, and 4. create the Unix video group. [This link](SOURCEINSTALL_PREREQUISITE.md) provides instructions to satisfy all the AOMP source build dependencies.
## Build AOMP manually from release source tarball
To build and install aomp from the release source tarball run these commands:
```
- wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp-21.0-0.tar.gz
- tar -xzf aomp-21.0-0.tar.gz
- cd aomp20.0
+ wget https://github.com/ROCm/aomp/releases/download/rel_23.0-0/aomp-23.0-0-source.tar.gz
+ tar -xzf aomp-23.0-0-source.tar.gz
+ cd aomp23.0
nohup make &
```
Depending on your system, the last command could take a very long time. So it is recommended to use nohup and background the process. The simple Makefile that make will use runs build script "build_aomp.sh" and sets some flags to avoid git checks and applying ROCm patches. Here is that Makefile:
@@ -30,24 +28,6 @@ If you set the environment variable AOMP, the Makefile will install to that dire
Otherwise, the Makefile will install into /usr/local.
So you must have authorization to write into /usr/local if you do not set the environment variable AOMP.
Let's assume you set the environment variable AOMP to "$HOME/rocm/aomp" in .bash_profile.
-The build_aomp.sh script will install into $HOME/rocm/aomp_21.0-0 and create a symbolic link from $HOME/rocm/aomp to $HOME/rocm/aomp_21.0-0.
+The build_aomp.sh script will install into $HOME/rocm/aomp_23.0-0 and create a symbolic link from $HOME/rocm/aomp to $HOME/rocm/aomp_23.0-0.
This feature allows multiple versions of AOMP to be installed concurrently.
-To enable a backlevel version of AOMP, simply set AOMP to $HOME/rocm/aomp_20.0-2.
-
-## Build AOMP with spack
-
-Assuming your have installed the [prerequisites](SOURCEINSTALL_PREREQUISITE.md), use these commands to fetch the source and build aomp. Currently the aomp configuration is not yet in the spack git hub so you must create the spack package first.
-
-```
- wget https://github.com/ROCm-Developer-Tools/aomp/blob/aomp-21.0-0/bin/package.py
- spack create -n aomp -t makefile --force https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp-21.0-0.tar.gz
- spack edit aomp
- spack install aomp
-```
-The "spack create" command will download and start an editor of a newly created spack config file.
-With the exception of the sha256 value, copy the contents of the downloaded package.py file into
-into the spack configuration file. You may restart this editor with the command "spack edit aomp"
-
-Depending on your system, the "spack install aomp" command could take a very long time.
-Unless you set the AOMP environment variable, AOMP will be installed in /usr/local/aomp_ with a symbolic link from /usr/local/aomp to /usr/local/aomp_.
-Be sure you have write access to /usr/local or set AOMP to a location where you have write access.
+To enable a backlevel version of AOMP, simply set AOMP to $HOME/rocm/aomp_22.0-2.
diff --git a/docs/SOURCEINSTALL.md b/docs/SOURCEINSTALL.md
index 6718fd49ed..0ca767b43b 100644
--- a/docs/SOURCEINSTALL.md
+++ b/docs/SOURCEINSTALL.md
@@ -1,4 +1,4 @@
-# Source Install V 21.0-1
+# Source Install V 23.0-0
Build and install from sources is possible. However, the source build for AOMP is complex for several reasons.
- Many repos are required.
@@ -12,9 +12,8 @@ To build and test AOMP from source you must:
```
1. Install certain distribution packages,
2. Build CMake 3.25.2 from source. This can be done with ./build_prereq.sh,
-3. Ensure the KFD kernel module is installed and operating,
-4. Create the Unix video group, and
-5. Install spack if required.
+3. Ensure the KFD kernel module is installed and operating, and
+4. Create the Unix video group
```
[This link](SOURCEINSTALL_PREREQUISITE.md) provides detailed instructions to satisfy all the AOMP source build requirements.
@@ -32,22 +31,22 @@ Here are the commands to do a source build of AOMP:
Development Branch:
```
- export AOMP_VERSION=21.0
+ export AOMP_VERSION=23.0
export AOMP_REPOS=$HOME/git/aomp${AOMP_VERSION}
mkdir -p $AOMP_REPOS
cd $AOMP_REPOS
- git clone -b aomp-dev https://github.com/ROCm-Developer-Tools/aomp
+ git clone -b aomp-dev https://github.com/ROCm/aomp
```
The development version is the next version to be released. It is possible that the development version is broken due to regressions that often occur during development.
-These commands will build a previous release of AOMP such as aomp-21.0-0.
+These commands will build a previous release of AOMP such as aomp-23.0-0.
Release Branch:
```
- export AOMP_VERSION=21.0
+ export AOMP_VERSION=23.0
export AOMP_REPOS=$HOME/git/aomp${AOMP_VERSION}
mkdir -p $AOMP_REPOS
cd $AOMP_REPOS
- git clone -b aomp-21.0-0 https://github.com/ROCm-Developer-Tools/aomp
+ git clone -b aomp-23.0-0 https://github.com/ROCm/aomp
```
Clone and build:
```
@@ -74,7 +73,7 @@ There is a "list" option on the clone\_aomp.sh that provides useful information
```
The above command will produce output like this showing you the location and branch of the repos in the AOMP\_REPOS directory and if there are any discrepencies with respect to the manifest file.
-USED manifest file: /work/grodgers/git/aomp21.0/aomp/bin/../manifests/aompi_21.0.xml
+USED manifest file: /work/grodgers/git/aomp23.0/aomp/bin/../manifests/aompi_23.0.xml
```
repo src branch path repo name last hash updated commitor for author
-------- ------ ---- --------- --------- ------- -------- ----------
@@ -82,15 +81,15 @@ The above command will produce output like this showing you the location and bra
emu amd-staging SPIRV-LLVM-Translator SPIRV-LLVM-Translator 0659e45216b2 2024-12-04 AlexVlx AlexVlx
roc aomp-dev flang flang 88b81b0a8ead 2023-11-30 GitHub Emma Pilkington
roc aomp-dev aomp aomp df5b5d8ddffa 2023-12-05 Dhruva Chakrabarti Dhruva Chakrabarti
- roc release/rocm-rel-6.4 rocprofiler rocprofiler 4e190a02e60e 2023-10-30 GitHub Ammar ELWazir
- roc release/rocm-rel-6.4 roctracer roctracer 6fbf7673aa7f 2023-07-13 Ranjith Ramakrishnan Ranjith Ramakrishnan
- roc release/rocm-rel-6.4 ROCdbgapi ROCdbgapi df1a8df2be08 2023-07-28 Lancelot SIX Lancelot SIX
- roc release/rocm-rel-6.4 ROCgdb ROCgdb 157eed788288 2023-07-28 Lancelot SIX Lancelot SIX
- roc release/rocm-rel-6.4 hip hip 80681169ae20 2023-08-15 Julia Jiang Julia Jiang
- roc release/rocm-rel-6.4 clr clr 1949b1621a80 2023-09-21 Julia Jiang Julia Jiang
- roc release/rocm-rel-6.4 rocminfo rocminfo c8db38ede264 2023-06-02 Mark Searles Mark Searles
- roc release/rocm-rel-6.4 rocm-cmake rocm-cmake 15cbb2e47f0b 2023-07-11 Lauren Wrubleski Lauren Wrubleski
- roc release/rocm-rel-6.4 rocr-runtime ROCR-Runtime b2b6811571bf 2023-09-15 David Yat Sin David Yat Sin
- roc release/rocm-rel-6.4 hipfort hipfort 41f33eeaa3f7 2023-09-07 Sam Wu dependabot[bot]
+ roc release/rocm-rel-7.2 rocprofiler-sdk rocprofiler-sdk 7283f62b2c16 2025-09-22 GitHub Ammar ELWazir
+ roc release/rocm-rel-7.2 roctracer roctracer 6fbf7673aa7f 2023-07-13 Ranjith Ramakrishnan Ranjith Ramakrishnan
+ roc release/rocm-rel-7.2 ROCdbgapi ROCdbgapi df1a8df2be08 2023-07-28 Lancelot SIX Lancelot SIX
+ roc release/rocm-rel-7.2 ROCgdb ROCgdb 157eed788288 2023-07-28 Lancelot SIX Lancelot SIX
+ roc release/rocm-rel-7.2 hip hip 80681169ae20 2023-08-15 Julia Jiang Julia Jiang
+ roc release/rocm-rel-7.2 clr clr 1949b1621a80 2023-09-21 Julia Jiang Julia Jiang
+ roc release/rocm-rel-7.2 rocminfo rocminfo c8db38ede264 2023-06-02 Mark Searles Mark Searles
+ roc release/rocm-rel-7.2 rocm-cmake rocm-cmake 15cbb2e47f0b 2023-07-11 Lauren Wrubleski Lauren Wrubleski
+ roc release/rocm-rel-7.2 rocr-runtime ROCR-Runtime b2b6811571bf 2023-09-15 David Yat Sin David Yat Sin
+ roc release/rocm-rel-7.2 hipfort hipfort 41f33eeaa3f7 2023-09-07 Sam Wu dependabot[bot]
```
For more information, or if you are interested in joining the development of AOMP, please read the AOMP developers README file located here [README](../bin/README.md).
diff --git a/docs/SOURCEINSTALL_PREREQUISITE.md b/docs/SOURCEINSTALL_PREREQUISITE.md
index 5646b82d5f..40cbc7e846 100644
--- a/docs/SOURCEINSTALL_PREREQUISITE.md
+++ b/docs/SOURCEINSTALL_PREREQUISITE.md
@@ -2,16 +2,35 @@
### 1. Required Distribution Packages
+#### ManyLinux (AlmaLinux 8)
+```
+ sudo dnf -y install bison ccache cmake elfutils-libelf-devel elfutis-devel expat-devel flex fmt-devel gcc-c++ gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-gfortran gcc-toolset-12-libatomic-devel gcc-toolset-12-libstdc++-devel gdb git gmp-devel gtest-devel libatomic libbabeltrace-devel libffi-devel libquadmath-devel libtool mesa-libGL-devel mpfr-devel msgpack-devel ncurses-devel numactl-devel openssl-devel ocl-icd-devel pciutils-devel python3-devel rpm-build rsync sqlite-devel systemd-devel texinfo vim wget xz-devel
+
+ # Download and install Python 3.10.18
+ wget https://www.python.org/ftp/python/3.10.18/Python-3.10.18.tgz; tar xf Python-3.10.18.tgz; cd Python-3.10.18; ./configure --enable-optimizations --enable-shared; make altinstall; --prefix=$HOME/local/Python-3.10.18; ln -s $HOME/local/Python-3.10.18/bin/python3.10 $HOME/local/Python-3.10.18/bin/python3
+
+ # Configure environemnt
+ export PATH=$HOME/local/Python-3.10.18/bin:$PATH
+ export LD_LIBRARY_PATH=$HOME/local/Python-3.10.18/lib:$LD_LIBRARY_PATH
+ export LIBRARY_PATH=$HOME/local/Python-3.10.18/lib:$LIBRARY_PATH
+
+ # Finally source the gcc-toolset-12
+ source /opt/rh/gcc-toolset-12/enable
+
+```
#### Debian or Ubuntu Packages
```
- sudo apt-get install wget gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python3 libopenmpi-dev gawk mesa-common-dev libtool libdrm-amdgpu1 libdrm-dev ccache libdw-dev libgtest-dev libsystemd-dev cmake openssl libssl-dev libgmp-dev libmpfr-dev libelf-dev pciutils python3.10-dev libudev-dev libgtest-dev libstdc++-12-dev python3-lxml ocl-icd-opencl-dev libsystemd-dev
+ sudo apt-get install wget gcc g++ pkg-config libpci-dev libnuma-dev libffi-dev git python3 libopenmpi-dev gawk mesa-common-dev libtool libdrm-amdgpu1 libdrm-dev ccache libdw-dev libgtest-dev libsystemd-dev cmake openssl libssl-dev libgmp-dev libmpfr-dev libelf-dev patchelf pciutils python3.10-dev libudev-dev libgtest-dev libstdc++-12-dev python3-lxml ocl-icd-opencl-dev libsystemd-dev libfmt-dev libmsgpack-dev libsqlite3-dev
# Additional packages used by rocgdb
sudo apt-get install texinfo libbison-dev bison flex libbabeltrace-dev python3-pip libncurses5-dev liblzma-dev python3-setuptools python3-dev libudev-dev libgmp-dev libmpfr-dev libdw-dev
# Additional packages used by math librares (aomp-hip-libraries)
sudo apt-get install libfmt-dev libmsgpack-dev python3-venv
+
+ # Additional packages to support development and test
+ sudo apt-get install shellcheck
```
Ubuntu 22.04 Only
@@ -26,7 +45,7 @@ Ubuntu 24.04 Only
#### SLES-15-SP6 Packages
```
- sudo zypper install wget libopenssl-devel elfutils libelf-devel git pciutils-devel libffi-devel gcc gcc-c++ libnuma-devel openmpi4-devel Mesa-libGL-devel libquadmath0 libtool libX11-devel systemd-devel hwdata unzip mpfr-devel ocl-icd-devel gcc7-fortran ncurses-devel
+ sudo zypper install wget libopenssl-devel elfutils libelf-devel git pciutils-devel libffi-devel gcc gcc-c++ libnuma-devel openmpi4-devel Mesa-libGL-devel libquadmath0 libtool libX11-devel systemd-devel hwdata unzip mpfr-devel ocl-icd-devel gcc7-fortran ncurses-devel gcc13-c++ gcc13 libstdc++6-devel-gcc13 libc++-devel sqlite-devel
A symbolic link may be required at /usr/lib64: /usr/lib64/libquadmath.so -> /usr/lib64/libquadmath.so.0.
@@ -42,23 +61,37 @@ Ubuntu 24.04 Only
# Optional: Update python3 symbolic link
rm /usr/bin/python3; ln -s /usr/local/bin/python3.8 /usr/bin/python3
+
+ # Additional packages to support development and test
+ sudo zypper install shellcheck
+
+ # Enable gcc-13
+ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10
+ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10
+ sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 10
+ sudo update-alternatives --set cc /usr/bin/gcc
+ sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 10
+ sudo update-alternatives --set c++ /usr/bin/g++
```
#### RHEL Packages
RHEL 8
```
- sudo yum install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python38 python38-devel ocl-icd-devel libatomic libquadmath-devel
+ sudo yum install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python38 python38-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel
# Additional packages used by rocgdb and roctracer
sudo yum install texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel libatomic libdwarf-devel gtest-devel
# Additional packages used by math librares (aomp-hip-libraries)
sudo yum install libfmt-devel libmsgpack-devel
+
+ # Additional packages to support development and test
+ sudo yum install shellcheck
```
RHEL 9
```
- sudo dnf install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python3-devel ocl-icd-devel libatomic libquadmath-devel
+ sudo dnf install dnf-plugins-core gcc-c++ git wget openssl-devel elfutils-libelf-devel elfutils-devel ccache pciutils-devel numactl-devel libffi-devel mesa-libGL-devel libtool libdrm libdrm-devel gmp-devel rpm-build gcc-gfortran libdw-devel libgtest-devel systemd-devel mpfr-devel python3-devel ocl-icd-devel libatomic libquadmath-devel sqlite-devel
# Additional packages used by rocgdb and roctracer
sudo dnf install texinfo bison flex ncurses-devel expat-devel xz-devel libbabeltrace-devel libatomic libdwarf-devel gtest-devel
@@ -68,12 +101,20 @@ RHEL 9
# To build aomp with Ninja set AOMP_USE_NINJA=1 . You need this installed with dnf
dnf install ninja-build
+
+ # Additional packages to support development and test
+ sudo dnf install shellcheck
```
### 2. User-installed Python Components
After all the required system package from section 1 are installed, there are some python packages that must be locally installed by the user building AOMP. Use this command to install these. Do not install these as root.
+ManyLinux (AlmaLinux 8)
+```
+ python3 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3.10 -m pip install CppHeaderParser argparse wheel lit lxml pandas
+```
+
Ubuntu 22.04
```
python3 -m pip install --ignore-installed --no-cache-dir barectf==3.1.2 PyYAML==5.3.1; python3 -m pip install CppHeaderParser argparse wheel lit lxml pandas
@@ -215,8 +256,3 @@ However, to build AOMP from source, you SHOULD have the Nvidia CUDA SDK version
See [these install instructions](https://developer.nvidia.com/cuda-toolkit-archive)
-
-### 7. Optional Install of Spack
-
-If you expect to install AOMP sources using the release source tarball with spack, you must install Spack. Refer to [these install instructions](https://spack.readthedocs.io/en/latest/getting_started.html#installation) for instructions on installing spack.
-The AOMP spack configuration file is currently missing proper dependencies, so be sure to install the packages listed above before proceeding with source install via spack.
diff --git a/docs/NOROOTINSTALL.md b/docs/deprecated/NOROOTINSTALL.md
similarity index 51%
rename from docs/NOROOTINSTALL.md
rename to docs/deprecated/NOROOTINSTALL.md
index b1a6b8fc0e..91933936ee 100644
--- a/docs/NOROOTINSTALL.md
+++ b/docs/deprecated/NOROOTINSTALL.md
@@ -8,17 +8,17 @@ To install the debian package without root access into your home directory, you
On Ubuntu 22.04:
```
- wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_Ubuntu2204_21.0-0_amd64.deb
- dpkg -x aomp_Ubuntu2204_21.0-0_amd64.deb /tmp/temproot
+ wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_Ubuntu2204_22.0-2_amd64.deb
+ dpkg -x aomp_Ubuntu2204_22.0-2_amd64.deb /tmp/temproot
- Also can be done with aomp-hip-libraries_Ubuntu2204_21.0-0_amd64.deb
+ Also can be done with aomp-hip-libraries_Ubuntu2204_22.0-2_amd64.deb
```
On Ubuntu 24.04:
```
- wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_Ubuntu2404_21.0-0_amd64.deb
- dpkg -x aomp_Ubuntu2404_21.0-0_amd64.deb /tmp/temproot
+ wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_Ubuntu2404_22.0-2_amd64.deb
+ dpkg -x aomp_Ubuntu2404_22.0-2_amd64.deb /tmp/temproot
- Also can be done with aomp-hip-libraries_Ubuntu2404_21.0-0_amd64.deb
+ Also can be done with aomp-hip-libraries_Ubuntu2404_22.0-2_amd64.deb
```
Move to $HOME and set variables:
```
@@ -35,24 +35,24 @@ To install the rpm package without root access into your home directory, you can
```
For SLES15-SP5:
```
- wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_SLES15_SP5-21.0-0.x86_64.rpm
- rpm2cpio aomp_SLES15_SP5-21.0-0.x86_64.rpm | cpio -idmv
+ wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_SLES15_SP5-22.0-2.x86_64.rpm
+ rpm2cpio aomp_SLES15_SP5-22.0-2.x86_64.rpm | cpio -idmv
- Also can be done with aomp-hip-libraries_SLES15_SP5-21.0-0.x86_64.rpm
+ Also can be done with aomp-hip-libraries_SLES15_SP5-22.0-2.x86_64.rpm
```
For RHEL 8:
```
- wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_REDHAT_8-21.0-0.x86_64.rpm
- rpm2cpio aomp_REDHAT_8-21.0-0.x86_64.rpm | cpio -idmv
+ wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_REDHAT_8-22.0-2.x86_64.rpm
+ rpm2cpio aomp_REDHAT_8-22.0-2.x86_64.rpm | cpio -idmv
- Also can be done with aomp-hip-libraries_REDHAT_8-21.0-0.x86_64.rpm
+ Also can be done with aomp-hip-libraries_REDHAT_8-22.0-2.x86_64.rpm
```
For RHEL 9:
```
- wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_REDHAT_9-21.0-0.x86_64.rpm
- rpm2cpio aomp_REDHAT_9-21.0-0.x86_64.rpm | cpio -idmv
+ wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_REDHAT_9-22.0-2.x86_64.rpm
+ rpm2cpio aomp_REDHAT_9-22.0-2.x86_64.rpm | cpio -idmv
- Also can be done with aomp-hip-libraries_REDHAT_9-21.0-0.x86_64.rpm
+ Also can be done with aomp-hip-libraries_REDHAT_9-22.0-2.x86_64.rpm
```
Move to $HOME and set variables:
```
diff --git a/docs/RHELINSTALL.md b/docs/deprecated/RHELINSTALL.md
similarity index 72%
rename from docs/RHELINSTALL.md
rename to docs/deprecated/RHELINSTALL.md
index 700c3b2383..7bd0aff275 100644
--- a/docs/RHELINSTALL.md
+++ b/docs/deprecated/RHELINSTALL.md
@@ -5,19 +5,19 @@ AOMP will install to /usr/lib/aomp. The AOMP environment variable will automatic
### Download and Install (RHEL 9)
```
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_REDHAT_9-21.0-0.x86_64.rpm
-sudo rpm -i aomp_REDHAT_9-21.0-0.x86_64.rpm
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_REDHAT_9-22.0-2.x86_64.rpm
+sudo rpm -i aomp_REDHAT_9-22.0-2.x86_64.rpm
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp-hip-libraries_REDHAT_9-21.0-0.x86_64.rpm
-sudo rpm -i aomp-hip-libraries_REDHAT_9-21.0-0.x86_64.rpm
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp-hip-libraries_REDHAT_9-22.0-2.x86_64.rpm
+sudo rpm -i aomp-hip-libraries_REDHAT_9-22.0-2.x86_64.rpm
```
### Download and Install (RHEL 8)
```
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_REDHAT_8-21.0-0.x86_64.rpm
-sudo rpm -i aomp_REDHAT_8-21.0-0.x86_64.rpm
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_REDHAT_8-22.0-2.x86_64.rpm
+sudo rpm -i aomp_REDHAT_8-22.0-2.x86_64.rpm
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp-hip-libraries_REDHAT_8-21.0-0.x86_64.rpm
-sudo rpm -i aomp-hip-libraries_REDHAT_8-21.0-0.x86_64.rpm
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp-hip-libraries_REDHAT_8-22.0-2.x86_64.rpm
+sudo rpm -i aomp-hip-libraries_REDHAT_8-22.0-2.x86_64.rpm
```
## Prerequisites
diff --git a/docs/SLES15INSTALL.md b/docs/deprecated/SLES15INSTALL.md
similarity index 79%
rename from docs/SLES15INSTALL.md
rename to docs/deprecated/SLES15INSTALL.md
index 5997307ba9..5e615efc78 100644
--- a/docs/SLES15INSTALL.md
+++ b/docs/deprecated/SLES15INSTALL.md
@@ -1,11 +1,11 @@
# AOMP SUSE SLES-15-SP5 Install
AOMP will install to /usr/lib/aomp. The AOMP environment variable will automatically be set to the install location. This may require a new terminal to be launched to see the change.
```
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_SLES15_SP5-21.0-0.x86_64.rpm
-sudo rpm -i aomp_SLES15_SP5-21.0-0.x86_64.rpm
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_SLES15_SP5-22.0-2.x86_64.rpm
+sudo rpm -i aomp_SLES15_SP5-22.0-2.x86_64.rpm
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp-hip-libraries_SLES15_SP5-21.0-0.x86_64.rpm
-sudo rpm -i aomp-hip-libraries_SLES15_SP5-21.0-0.x86_64.rpm
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp-hip-libraries_SLES15_SP5-22.0-2.x86_64.rpm
+sudo rpm -i aomp-hip-libraries_SLES15_SP5-22.0-2.x86_64.rpm
```
## Prerequisites
diff --git a/docs/UBUNTUINSTALL.md b/docs/deprecated/UBUNTUINSTALL.md
similarity index 75%
rename from docs/UBUNTUINSTALL.md
rename to docs/deprecated/UBUNTUINSTALL.md
index 0fa6bd7aca..10f69a9cc7 100644
--- a/docs/UBUNTUINSTALL.md
+++ b/docs/deprecated/UBUNTUINSTALL.md
@@ -3,19 +3,19 @@ AOMP will install to /usr/lib/aomp. The AOMP environment variable will automatic
On Ubuntu 22.04, run these commands:
```
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_Ubuntu2204_21.0-0_amd64.deb
-sudo dpkg -i aomp_Ubuntu2204_21.0-0_amd64.deb
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_Ubuntu2204_22.0-2_amd64.deb
+sudo dpkg -i aomp_Ubuntu2204_22.0-2_amd64.deb
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp-hip-libraries_Ubuntu2204_21.0-0_amd64.deb
-sudo dpkg -i aomp-hip-libraries_Ubuntu2204_21.0-0_amd64.deb
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp-hip-libraries_Ubuntu2204_22.0-2_amd64.deb
+sudo dpkg -i aomp-hip-libraries_Ubuntu2204_22.0-2_amd64.deb
```
On Ubuntu 24.04, run these commands:
```
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp_Ubuntu2404_21.0-0_amd64.deb
-sudo dpkg -i aomp_Ubuntu2404_21.0-0_amd64.deb
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp_Ubuntu2404_22.0-2_amd64.deb
+sudo dpkg -i aomp_Ubuntu2404_22.0-2_amd64.deb
-wget https://github.com/ROCm-Developer-Tools/aomp/releases/download/rel_21.0-0/aomp-hip-libraries_Ubuntu2404_21.0-0_amd64.deb
-sudo dpkg -i aomp-hip-libraries_Ubuntu2404_21.0-0_amd64.deb
+wget https://github.com/ROCm/aomp/releases/download/rel_22.0-2/aomp-hip-libraries_Ubuntu2404_22.0-2_amd64.deb
+sudo dpkg -i aomp-hip-libraries_Ubuntu2404_22.0-2_amd64.deb
```
The AOMP bin directory (which includes the standard clang and llvm binaries) is not intended to be in your PATH for typical operation.
diff --git a/examples/fortran/.Makefile.swp b/examples/fortran/.Makefile.swp
deleted file mode 100644
index 6d450a7e83..0000000000
Binary files a/examples/fortran/.Makefile.swp and /dev/null differ
diff --git a/examples/fortran/fortran-hip-interop/fortran_hip_interop.f95 b/examples/fortran/fortran-hip-interop/fortran_hip_interop.f95
index 6b19469c38..94324b2bf1 100644
--- a/examples/fortran/fortran-hip-interop/fortran_hip_interop.f95
+++ b/examples/fortran/fortran-hip-interop/fortran_hip_interop.f95
@@ -30,8 +30,8 @@ subroutine fortran_callable_init(a,N) bind(c)
call fortran_callable_init(c_loc(arr1),nx)
!$OMP END TARGET DATA
- !$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO PRIVATE(x) &
- !$OMP NOWAIT
+ !$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO PRIVATE(x)
+ !!$OMP NOWAIT NOWAIT NOT YET IMPLEMENTED ON TTDPD
do x=1,nx
crr1(x)=arr1(x)+1.0
end do
diff --git a/examples/inc/find_gpu_and_install_dir.mk b/examples/inc/find_gpu_and_install_dir.mk
index 501088953c..baedec2feb 100644
--- a/examples/inc/find_gpu_and_install_dir.mk
+++ b/examples/inc/find_gpu_and_install_dir.mk
@@ -42,6 +42,9 @@ ifeq ("$(wildcard $(LLVM_INSTALL_DIR))","")
endif
endif
+# Determine clang host target
+CLANG_HOST_TARGET=$(shell $(LLVM_INSTALL_DIR)/bin/clang --version | grep Target: | cut -d" " -f2)
+
# Determine COMPILER_NAME (AMD, AOMP, or clang)
LLVM_COMPILER_NAME := $(shell $(LLVM_INSTALL_DIR)/bin/clang --version | head -n1 | cut -d" " -f1 | cut -d"_" -f1 )
FLANG ?= flang
@@ -67,6 +70,23 @@ else
LLVM_GPU_TRIPLE = amdgcn-amd-amdhsa
endif
+_supports_xnack= gfx90a, gfx90a:xnack+,\
+ gfx90c, gfx90c:xnack+,\
+ gfx940, gfx940:xnack+,\
+ gfx941, gfx941:xnack+,\
+ gfx942, gfx942:xnack+,\
+ gfx950, gfx950:xnack+,\
+ gfx1010, gfx1010:xnack+\
+ gfx1011, gfx1011:xnack+\
+ gfx1012, gfx1012:xnack+\
+ gfx1013, gfx1013:xnack+
+
+ifeq ($(findstring $(LLVM_GPU_ARCH), $(_supports_xnack)),)
+ LLVM_GPU_IS_XNACKABLE=0
+else
+ LLVM_GPU_IS_XNACKABLE=1
+endif
+
# Find where HIP is installed and set HIPDIR and HIPCC
HIPDIR ?= $(LLVM_INSTALL_DIR)
ifeq ("$(wildcard $(HIPDIR)/bin/hipcc)","")
diff --git a/examples/openmp/demo_offload_types/Makefile b/examples/openmp/demo_offload_types/Makefile
index 3b25046294..958aa423ee 100644
--- a/examples/openmp/demo_offload_types/Makefile
+++ b/examples/openmp/demo_offload_types/Makefile
@@ -37,11 +37,11 @@ ifeq ($(LLVM_COMPILER_NAME),clang)
@echo "2 Skipping host-offload because this is broken in trunk"
else
@echo "2. Create binary for host offloading: host-offload"
- $(CC) $(CFLAGS) -fopenmp-targets=x86_64-pc-linux-gnu -Xopenmp-target=x86_64-pc-linux-gnu --march=znver1 $^ -o host-offload
+ $(CC) $(CFLAGS) -fopenmp-targets=$(CLANG_HOST_TARGET) -Xopenmp-target=$(CLANG_HOST_TARGET) --march=znver1 $^ -o host-offload
endif
@echo "3. Create binary that does GPU offload: gpu-offload"
$(CC) $(CFLAGS) $(OAFLAG) $^ -o gpu-offload
-ifneq (sm_,$(findstring sm_,$(LLVM_GPU_ARCH)))
+ifeq ($(LLVM_GPU_IS_XNACKABLE),1)
@echo "4. Create binary for GPU offload compiled with :xnack+"
@echo " The image will require HSA_XNACK=1 at runtime."
$(CC) $(CFLAGS) $(OAQFLAG) $^ -o $(TESTNAME)
@@ -61,7 +61,7 @@ else
endif
@echo "3. gpu-offload"
./gpu-offload
-ifneq (sm_,$(findstring sm_,$(LLVM_GPU_ARCH)))
+ifeq ($(LLVM_GPU_IS_XNACKABLE),1)
@echo "4. GPU offload compiled with :xnack+, Runtime fail will disable offloading."
ifeq ($(LLVM_COMPILER_NAME),AMD)
@echo " SKIPPING SINCE ROCm 6.1 has runtime fail here: env HSA_XNACK=0 ./$(TESTNAME) "
@@ -84,7 +84,7 @@ ifneq ($(LLVM_COMPILER_NAME),clang)
endif
@echo "3. gpu-offload"
env OMP_TARGET_OFFLOAD=DISABLED ./gpu-offload
-ifneq (sm_,$(findstring sm_,$(LLVM_GPU_ARCH)))
+ifeq ($(LLVM_GPU_IS_XNACKABLE),1)
@echo "4. GPU offload compiled with :xnack+ but run with HSA_XNACK=0"
env OMP_TARGET_OFFLOAD=DISABLED HSA_XNACK=0 ./$(TESTNAME)
@echo "5. GPU offload compiled with :xnack+"
@@ -99,7 +99,7 @@ ifneq ($(LLVM_COMPILER_NAME),clang)
endif
@echo "3. GPU offload"
env OMP_TARGET_OFFLOAD=MANDATORY ./gpu-offload
-ifneq (sm_,$(findstring sm_,$(LLVM_GPU_ARCH)))
+ifeq ($(LLVM_GPU_IS_XNACKABLE),1)
@echo "4. SKIPPING execution of binary compiled with xnack+ with OMP_TARGET_OFFLOAD=MANDATORY"
@echo " and run with HSA_XNACK=0 because this always creates expected fatal runtime error."
@echo "5. GPU offload compiled with :xnack+ and run with HSA_XNACK=1"
diff --git a/examples/stdpar/tsp/Makefile b/examples/stdpar/tsp/Makefile
index da8a9b191b..72dfac71be 100644
--- a/examples/stdpar/tsp/Makefile
+++ b/examples/stdpar/tsp/Makefile
@@ -23,7 +23,8 @@ ifeq ("$(wildcard $(HIPSTDPARPRIMPATH)/rocprim)","")
endif
CC = $(LLVM_INSTALL_DIR)/bin/clang++
-opts=-I. -DNDEBUG -O3 --hipstdpar --hipstdpar-path=$(HIPSTDPARPATH) --hipstdpar-thrust-path=$(HIPSTDPARTHRUSTPATH) --hipstdpar-prim-path=$(HIPSTDPARPRIMPATH) --offload-arch=$(LLVM_GPU_ARCH) -std=c++17
+#opts=-I. -DNDEBUG -O3 --hipstdpar --hipstdpar-path=$(HIPSTDPARPATH) --hipstdpar-thrust-path=$(HIPSTDPARTHRUSTPATH) --hipstdpar-prim-path=$(HIPSTDPARPRIMPATH) --offload-arch=$(LLVM_GPU_ARCH) -std=c++17
+opts=-I. -g -O0 --hipstdpar --hipstdpar-path=$(HIPSTDPARPATH) --hipstdpar-thrust-path=$(HIPSTDPARTHRUSTPATH) --hipstdpar-prim-path=$(HIPSTDPARPRIMPATH) --offload-arch=$(LLVM_GPU_ARCH) -std=c++20
# Build both babelstream stdpar binaries
tsp:tsp.o
diff --git a/examples/stdpar/tsp/SimpleTimer.h b/examples/stdpar/tsp/SimpleTimer.h
deleted file mode 100644
index 0babcff677..0000000000
--- a/examples/stdpar/tsp/SimpleTimer.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * borrowed from https://gist.github.com/mcleary/b0bf4fa88830ff7c882d
- */
-
-#include
-#include
-#include
-#include
-
-class SimpleTimer
-{
-public:
- void start()
- {
- m_StartTime = std::chrono::system_clock::now();
- m_bRunning = true;
- }
-
- void stop()
- {
- m_EndTime = std::chrono::system_clock::now();
- m_bRunning = false;
- }
-
- double elapsedMilliseconds()
- {
- std::chrono::time_point endTime;
-
- if(m_bRunning)
- {
- endTime = std::chrono::system_clock::now();
- }
- else
- {
- endTime = m_EndTime;
- }
-
- return std::chrono::duration_cast(endTime - m_StartTime).count();
- }
-
- double elapsedSeconds()
- {
- return elapsedMilliseconds() / 1000.0;
- }
-
-private:
- std::chrono::time_point m_StartTime;
- std::chrono::time_point m_EndTime;
- bool m_bRunning = false;
-
-}; // class Simpletimer
diff --git a/examples/stdpar/tsp/counting_iterator.h b/examples/stdpar/tsp/counting_iterator.h
deleted file mode 100644
index 477aa11c6c..0000000000
--- a/examples/stdpar/tsp/counting_iterator.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef COUNTING_ITERATOR_H_
-#define COUNTING_ITERATOR_H_
-
-#include
-#include // for std::make_signed
-#include
-
-/*
- * This class is borrowed from Lulesh:
- * https://github.com/LLNL/LULESH
- */
-struct counting_iterator
-{
-
-private:
- using self = counting_iterator;
-
-public:
- using Index_t = int64_t;
- using value_type = Index_t;
- using difference_type = typename std::make_signed::type;
- using pointer = Index_t*;
- using reference = Index_t&;
- using iterator_category = std::random_access_iterator_tag;
-
- counting_iterator() : value(0) { }
- explicit counting_iterator(value_type v) : value(v) { }
-
- value_type operator*() const { return value; }
- value_type operator[](difference_type n) const { return value + n; }
-
- self& operator++() { ++value; return *this; }
- self operator++(int) {
- self result{value};
- ++value;
- return result;
- }
- self& operator--() { --value; return *this; }
- self operator--(int) {
- self result{value};
- --value;
- return result;
- }
- self& operator+=(difference_type n) { value += n; return *this; }
- self& operator-=(difference_type n) { value -= n; return *this; }
-
- friend self operator+(self const& i, difference_type n) {
- return self(i.value + n);
- }
- friend self operator+(difference_type n, self const& i) {
- return self(i.value + n);
- }
- friend difference_type operator-(self const& x, self const& y) {
- return x.value - y.value;
- }
- friend self operator-(self const& i, difference_type n) {
- return self(i.value - n);
- }
-
- friend bool operator==(self const& x, self const& y) {
- return x.value == y.value;
- }
- friend bool operator!=(self const& x, self const& y) {
- return x.value != y.value;
- }
- friend bool operator<(self const& x, self const& y) {
- return x.value < y.value;
- }
- friend bool operator<=(self const& x, self const& y) {
- return x.value <= y.value;
- }
- friend bool operator>(self const& x, self const& y) {
- return x.value > y.value;
- }
- friend bool operator>=(self const& x, self const& y) {
- return x.value >= y.value;
- }
-private:
- value_type value;
-};
-
-#endif // COUNTING_ITERATOR_H_
diff --git a/examples/stdpar/tsp/tsp b/examples/stdpar/tsp/tsp
deleted file mode 100755
index b221ba0574..0000000000
Binary files a/examples/stdpar/tsp/tsp and /dev/null differ
diff --git a/examples/stdpar/tsp/tsp.cpp b/examples/stdpar/tsp/tsp.cpp
index fa52ce33ce..48fef359a3 100644
--- a/examples/stdpar/tsp/tsp.cpp
+++ b/examples/stdpar/tsp/tsp.cpp
@@ -1,8 +1,6 @@
#include "route_iterator.h"
#include "route_cost.h"
#include "tsp_utils.h"
-#include "counting_iterator.h"
-#include "SimpleTimer.h"
// #include
// #include
@@ -15,8 +13,13 @@
#include
#include
+#include
#include
#include
+#include
+
+using namespace std;
+using namespace std::chrono;
// ============================================
// ============================================
@@ -79,23 +82,20 @@ void test_city_distance()
} // test_city_distance
-// ============================================
-// ============================================
+
template
route_cost find_best_route(int const* distances)
{
-
+ int X = factorial(N);
return
std::transform_reduce(std::execution::par_unseq,
- counting_iterator(0),
- counting_iterator(factorial(N)),
+ std::views::iota(0, X).begin(),
+ std::views::iota(0, X).end(),
route_cost(),
- //route_cost::minf,
[](route_cost x, route_cost y) { return x.cost < y.cost ? x : y; },
[=](int64_t i)
{
int cost = 0;
-
route_iterator it(i);
// first city visited
@@ -106,40 +106,34 @@ route_cost find_best_route(int const* distances)
while (!it.done())
{
int to = it.next();
- cost += distances[to + N*from];
+ cost += distances[to + N * from];
from = to;
}
-
- // debug
- // printf("route #%d cost=%d\n",i,cost);
-
// update best_route -> reduction
return route_cost(i, cost);
});
-} // find_best_route
+}
// ============================================================
// ============================================================
//! \param[in] nbRepeat number of repeat (for accurate time measurement)
+
template
void solve_traveling_salesman(int nbRepeat = 1)
{
- // find best route
auto distances_small = init_distance_matrix_small(N);
-
route_cost best_route;
- SimpleTimer timer;
- timer.start();
+ auto start = high_resolution_clock::now();
for (int i = 0; i(distances_small.data());
- timer.stop();
- double time = timer.elapsedSeconds()/nbRepeat;
+ auto end = high_resolution_clock::now();
+ duration elapsed = (end - start) / nbRepeat;
// print best route
- printf("Trav Salesman Prob N=%d, best route cost is: %d, average time is %f seconds\n",N, best_route.cost, time);
+ printf("Trav Salesman Prob N=%d, best route cost is: %d, average time is %f seconds\n",N, best_route.cost, elapsed.count());
printf("Solution route is ");
route_iterator rit(best_route.route);
diff --git a/examples/tools/roctracer/MatrixTranspose/Readme.md b/examples/tools/roctracer/MatrixTranspose/Readme.md
index 4a52b862a0..5171f1953b 100644
--- a/examples/tools/roctracer/MatrixTranspose/Readme.md
+++ b/examples/tools/roctracer/MatrixTranspose/Readme.md
@@ -7,7 +7,7 @@ This tutorial shows how to get write simple HIP application. We will write the s
HIP is a C++ runtime API and kernel language that allows developers to create portable applications that can run on AMD and other GPU’s. Our goal was to rise above the lowest-common-denominator paths and deliver a solution that allows you, the developer, to use essential hardware features and maximize your application’s performance on GPU hardware.
## Requirement:
-For hardware requirement and software installation [Installation](https://github.com/ROCm-Developer-Tools/HIP/INSTALL.md)
+For hardware requirement and software installation [Installation](https://github.com/ROCm/HIP/INSTALL.md)
## prerequiste knowledge:
@@ -87,11 +87,11 @@ Use the make command and execute it using ./exe
Use hipcc to build the application, which is using hcc on AMD and nvcc on nvidia.
## More Info:
-- [HIP FAQ](https://github.com/ROCm-Developer-Tools/HIP/docs/markdown/hip_faq.md)
-- [HIP Kernel Language](https://github.com/ROCm-Developer-Tools/HIP/docs/markdown/hip_kernel_language.md)
+- [HIP FAQ](https://github.com/ROCm/HIP/docs/markdown/hip_faq.md)
+- [HIP Kernel Language](https://github.com/ROCm/HIP/docs/markdown/hip_kernel_language.md)
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
-- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/docs/markdown/hip_porting_guide.md)
-- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
-- [hipify-clang](https://github.com/ROCm-Developer-Tools/HIP/hipify-clang/README.md)
-- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/CONTRIBUTING.md)
-- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/RELEASE.md)
+- [HIP Porting Guide](https://github.com/ROCm/HIP/docs/markdown/hip_porting_guide.md)
+- [HIP Terminology](https://github.com/ROCm/HIP/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
+- [hipify-clang](https://github.com/ROCm/HIP/hipify-clang/README.md)
+- [Developer/CONTRIBUTING Info](https://github.com/ROCm/HIP/CONTRIBUTING.md)
+- [Release Notes](https://github.com/ROCm/HIP/RELEASE.md)
diff --git a/examples/tools/roctracer/MatrixTranspose_test/Readme.md b/examples/tools/roctracer/MatrixTranspose_test/Readme.md
index 8f19613f87..2bf410a4a2 100644
--- a/examples/tools/roctracer/MatrixTranspose_test/Readme.md
+++ b/examples/tools/roctracer/MatrixTranspose_test/Readme.md
@@ -7,7 +7,7 @@ This tutorial shows how to get write simple HIP application. We will write the s
HIP is a C++ runtime API and kernel language that allows developers to create portable applications that can run on AMD and other GPU’s. Our goal was to rise above the lowest-common-denominator paths and deliver a solution that allows you, the developer, to use essential hardware features and maximize your application’s performance on GPU hardware.
## Requirement:
-For hardware requirement and software installation [Installation](https://github.com/ROCm-Developer-Tools/HIP/INSTALL.md)
+For hardware requirement and software installation [Installation](https://github.com/ROCm/HIP/INSTALL.md)
## prerequiste knowledge:
@@ -91,11 +91,11 @@ Use the make command and execute it using ./exe
Use hipcc to build the application, which is using hcc on AMD and nvcc on nvidia.
## More Info:
-- [HIP FAQ](https://github.com/ROCm-Developer-Tools/HIP/docs/markdown/hip_faq.md)
-- [HIP Kernel Language](https://github.com/ROCm-Developer-Tools/HIP/docs/markdown/hip_kernel_language.md)
+- [HIP FAQ](https://github.com/ROCm/HIP/docs/markdown/hip_faq.md)
+- [HIP Kernel Language](https://github.com/ROCm/HIP/docs/markdown/hip_kernel_language.md)
- [HIP Runtime API (Doxygen)](http://rocm-developer-tools.github.io/HIP)
-- [HIP Porting Guide](https://github.com/ROCm-Developer-Tools/HIP/docs/markdown/hip_porting_guide.md)
-- [HIP Terminology](https://github.com/ROCm-Developer-Tools/HIP/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
-- [hipify-clang](https://github.com/ROCm-Developer-Tools/HIP/hipify-clang/README.md)
-- [Developer/CONTRIBUTING Info](https://github.com/ROCm-Developer-Tools/HIP/CONTRIBUTING.md)
-- [Release Notes](https://github.com/ROCm-Developer-Tools/HIP/RELEASE.md)
+- [HIP Porting Guide](https://github.com/ROCm/HIP/docs/markdown/hip_porting_guide.md)
+- [HIP Terminology](https://github.com/ROCm/HIP/docs/markdown/hip_terms.md) (including Rosetta Stone of GPU computing terms across CUDA/HIP/HC/AMP/OpenL)
+- [hipify-clang](https://github.com/ROCm/HIP/hipify-clang/README.md)
+- [Developer/CONTRIBUTING Info](https://github.com/ROCm/HIP/CONTRIBUTING.md)
+- [Release Notes](https://github.com/ROCm/HIP/RELEASE.md)
diff --git a/f18bin/build_project.sh b/f18bin/build_project.sh
index 2f4df025c8..3627a6a696 100755
--- a/f18bin/build_project.sh
+++ b/f18bin/build_project.sh
@@ -32,7 +32,7 @@ thisdir=$(getdname $0)
INSTALL_PROJECT=${INSTALL_PROJECT:-$F18_INSTALL_DIR}
-WEBSITE="http\:\/\/github.com\/ROCm-Developer-Tools\/aomp"
+WEBSITE="http\:\/\/github.com\/ROCm\/aomp"
if [ "$F18_PROC" == "ppc64le" ] ; then
echo "ERROR: ppc64le not supported yet"
@@ -62,7 +62,7 @@ else
standalone_word=""
fi
-MYCMAKEOPTS="-DLLVM_ENABLE_PROJECTS=mlir;clang;lld;openmp;flang -DCMAKE_INSTALL_PREFIX=$F18_INSTALL_DIR -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_INSTALL_UTILS=On -DCMAKE_CXX_STANDARD=17 -DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD $F18_ORIGIN_RPATH -DLLVM_VERSION_SUFFIX=_F18${standalone_word}_$F18_VERSION_STRING -DCLANG_VENDOR=F18${standalone_word}_$F18_VERSION_STRING -DBUG_REPORT_URL='https://github.com/ROCm-Developer-Tools/aomp' -DLLVM_INCLUDE_BENCHMARKS=OFF $DO_TESTS"
+MYCMAKEOPTS="-DLLVM_ENABLE_PROJECTS=mlir;clang;lld;openmp;flang -DCMAKE_INSTALL_PREFIX=$F18_INSTALL_DIR -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_INSTALL_UTILS=On -DCMAKE_CXX_STANDARD=17 -DLLVM_TARGETS_TO_BUILD=$TARGETS_TO_BUILD $F18_ORIGIN_RPATH -DLLVM_VERSION_SUFFIX=_F18${standalone_word}_$F18_VERSION_STRING -DCLANG_VENDOR=F18${standalone_word}_$F18_VERSION_STRING -DBUG_REPORT_URL='https://github.com/ROCm/aomp' -DLLVM_INCLUDE_BENCHMARKS=OFF $DO_TESTS"
if [ "$1" == "-h" ] || [ "$1" == "help" ] || [ "$1" == "-help" ] ; then
diff --git a/f18bin/clone_f18.sh b/f18bin/clone_f18.sh
index c23d65edd0..6bef5bfd6a 100755
--- a/f18bin/clone_f18.sh
+++ b/f18bin/clone_f18.sh
@@ -119,7 +119,7 @@ COBRANCH=$F18_FLANG_REPO_BRANCH
clone_or_pull
# ---------------------------------------
-# The following repos are in RadeonOpenCompute
+# The following repos are in ROCm
# ---------------------------------------
repo_web_location=$GITROC
diff --git a/f18bin/f18_common_vars b/f18bin/f18_common_vars
index efb792bd96..7a4c5e43c7 100644
--- a/f18bin/f18_common_vars
+++ b/f18bin/f18_common_vars
@@ -119,7 +119,7 @@ fi
# These are the web sites where the F18 git repos are pulled from
GITROC="https://github.com/radeonopencompute"
-GITROCDEV="https://github.com/ROCm-Developer-Tools"
+GITROCDEV="https://github.com/ROCm"
GITROCLIB="https://github.com/AMDComputeLibraries"
GITKHRONOS="https://github.com/KhronosGroup"
diff --git a/manifests/aomp_13.1.xml b/manifests/aomp_13.1.xml
index b1fe302fd7..359282a45b 100644
--- a/manifests/aomp_13.1.xml
+++ b/manifests/aomp_13.1.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/aomp_14.0-0.xml b/manifests/aomp_14.0-0.xml
index cebfe26b81..4085915edc 100644
--- a/manifests/aomp_14.0-0.xml
+++ b/manifests/aomp_14.0-0.xml
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/manifests/aomp_14.0-1.xml b/manifests/aomp_14.0-1.xml
index 5c71505655..0a0e1f7c8c 100644
--- a/manifests/aomp_14.0-1.xml
+++ b/manifests/aomp_14.0-1.xml
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/manifests/aomp_14.0-2.xml b/manifests/aomp_14.0-2.xml
index 235f36da21..cd28914e99 100644
--- a/manifests/aomp_14.0-2.xml
+++ b/manifests/aomp_14.0-2.xml
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/manifests/aomp_14.0-3.xml b/manifests/aomp_14.0-3.xml
index 16d6cebef8..83e6c912d7 100644
--- a/manifests/aomp_14.0-3.xml
+++ b/manifests/aomp_14.0-3.xml
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/manifests/aomp_14.0.xml b/manifests/aomp_14.0.xml
index 5f59e4012e..982eb59819 100644
--- a/manifests/aomp_14.0.xml
+++ b/manifests/aomp_14.0.xml
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/manifests/aomp_14.1.xml b/manifests/aomp_14.1.xml
index 4251d0bf89..6e1dd83fae 100644
--- a/manifests/aomp_14.1.xml
+++ b/manifests/aomp_14.1.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/aomp_15.0-0.xml b/manifests/aomp_15.0-0.xml
index 225ac72af2..519cf64c48 100644
--- a/manifests/aomp_15.0-0.xml
+++ b/manifests/aomp_15.0-0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_15.0-1.xml b/manifests/aomp_15.0-1.xml
index a6a500ab3f..90668c83e3 100644
--- a/manifests/aomp_15.0-1.xml
+++ b/manifests/aomp_15.0-1.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_15.0-2.xml b/manifests/aomp_15.0-2.xml
index af6ed9d503..8aa0c2c2e3 100644
--- a/manifests/aomp_15.0-2.xml
+++ b/manifests/aomp_15.0-2.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_15.0-3.xml b/manifests/aomp_15.0-3.xml
index afb61d14f3..f2ef666e47 100644
--- a/manifests/aomp_15.0-3.xml
+++ b/manifests/aomp_15.0-3.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_15.0.xml b/manifests/aomp_15.0.xml
index 01a71d3b2d..52f726cafb 100644
--- a/manifests/aomp_15.0.xml
+++ b/manifests/aomp_15.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_16.0-0.xml b/manifests/aomp_16.0-0.xml
index fc8676bd58..8623444476 100644
--- a/manifests/aomp_16.0-0.xml
+++ b/manifests/aomp_16.0-0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_16.0-1.xml b/manifests/aomp_16.0-1.xml
index aaf2a4214a..bc86c55ed0 100644
--- a/manifests/aomp_16.0-1.xml
+++ b/manifests/aomp_16.0-1.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_16.0-2.xml b/manifests/aomp_16.0-2.xml
index 5a20a586a4..81fbe1494b 100644
--- a/manifests/aomp_16.0-2.xml
+++ b/manifests/aomp_16.0-2.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_16.0-3.xml b/manifests/aomp_16.0-3.xml
index 09ed3e484f..473a566a00 100644
--- a/manifests/aomp_16.0-3.xml
+++ b/manifests/aomp_16.0-3.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_16.0.xml b/manifests/aomp_16.0.xml
index 8247c67ef7..e0e7200af1 100644
--- a/manifests/aomp_16.0.xml
+++ b/manifests/aomp_16.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_17.0-0.xml b/manifests/aomp_17.0-0.xml
index c77ae4465c..415694cbd6 100644
--- a/manifests/aomp_17.0-0.xml
+++ b/manifests/aomp_17.0-0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_17.0-1.xml b/manifests/aomp_17.0-1.xml
index 6ae88f2c1e..fb9f9dd247 100644
--- a/manifests/aomp_17.0-1.xml
+++ b/manifests/aomp_17.0-1.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_17.0-2.xml b/manifests/aomp_17.0-2.xml
index a65645f31c..15c37e5aa1 100644
--- a/manifests/aomp_17.0-2.xml
+++ b/manifests/aomp_17.0-2.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_17.0-3.xml b/manifests/aomp_17.0-3.xml
index 336ea83e81..2ceefa2ddf 100644
--- a/manifests/aomp_17.0-3.xml
+++ b/manifests/aomp_17.0-3.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_17.0.xml b/manifests/aomp_17.0.xml
index e576cd85cf..43f9ebbba1 100644
--- a/manifests/aomp_17.0.xml
+++ b/manifests/aomp_17.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_18.0-0.xml b/manifests/aomp_18.0-0.xml
index 734d56d28a..64b8c6e22d 100644
--- a/manifests/aomp_18.0-0.xml
+++ b/manifests/aomp_18.0-0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_21.0-1.xml b/manifests/aomp_21.0-1.xml
new file mode 100644
index 0000000000..0761ab07b8
--- /dev/null
+++ b/manifests/aomp_21.0-1.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manifests/aomp_21.0.xml b/manifests/aomp_21.0.xml
index e0eeb97d46..f36022546c 100644
--- a/manifests/aomp_21.0.xml
+++ b/manifests/aomp_21.0.xml
@@ -9,11 +9,13 @@
+
+
diff --git a/manifests/aomp_22.0-1.xml b/manifests/aomp_22.0-1.xml
new file mode 100644
index 0000000000..a2b4acd00e
--- /dev/null
+++ b/manifests/aomp_22.0-1.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manifests/aomp_22.0-2.xml b/manifests/aomp_22.0-2.xml
new file mode 100644
index 0000000000..297776ffce
--- /dev/null
+++ b/manifests/aomp_22.0-2.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manifests/aomp_22.0.xml b/manifests/aomp_22.0.xml
new file mode 100644
index 0000000000..a4d772cc44
--- /dev/null
+++ b/manifests/aomp_22.0.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manifests/aomp_23.0-0.xml b/manifests/aomp_23.0-0.xml
new file mode 100644
index 0000000000..395f87a5a0
--- /dev/null
+++ b/manifests/aomp_23.0-0.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manifests/aomp_23.0.xml b/manifests/aomp_23.0.xml
new file mode 100644
index 0000000000..e0119381b2
--- /dev/null
+++ b/manifests/aomp_23.0.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manifests/aomp_new_17.0.xml b/manifests/aomp_new_17.0.xml
index ed547a8424..59d97be4a9 100644
--- a/manifests/aomp_new_17.0.xml
+++ b/manifests/aomp_new_17.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_new_18.0.xml b/manifests/aomp_new_18.0.xml
index 15d80d8808..a905afdd78 100644
--- a/manifests/aomp_new_18.0.xml
+++ b/manifests/aomp_new_18.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aomp_new_19.0.xml b/manifests/aomp_new_19.0.xml
index 15d80d8808..a905afdd78 100644
--- a/manifests/aomp_new_19.0.xml
+++ b/manifests/aomp_new_19.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aompi_14.0.xml b/manifests/aompi_14.0.xml
index 9d734b24ba..71fb5e0711 100644
--- a/manifests/aompi_14.0.xml
+++ b/manifests/aompi_14.0.xml
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/manifests/aompi_14.1.xml b/manifests/aompi_14.1.xml
index 4251d0bf89..6e1dd83fae 100644
--- a/manifests/aompi_14.1.xml
+++ b/manifests/aompi_14.1.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/aompi_15.0.xml b/manifests/aompi_15.0.xml
index 0337ebdd5e..a299979ee9 100644
--- a/manifests/aompi_15.0.xml
+++ b/manifests/aompi_15.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aompi_16.0.xml b/manifests/aompi_16.0.xml
index 0f3cd20925..3785d9474e 100644
--- a/manifests/aompi_16.0.xml
+++ b/manifests/aompi_16.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aompi_17.0.xml b/manifests/aompi_17.0.xml
index c32967aa00..b411a87300 100644
--- a/manifests/aompi_17.0.xml
+++ b/manifests/aompi_17.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aompi_21.0.xml b/manifests/aompi_21.0.xml
index fef1414609..15e91c68b5 100644
--- a/manifests/aompi_21.0.xml
+++ b/manifests/aompi_21.0.xml
@@ -8,11 +8,13 @@
+
+
diff --git a/manifests/aompi_22.0.xml b/manifests/aompi_22.0.xml
new file mode 100644
index 0000000000..59ed2dca14
--- /dev/null
+++ b/manifests/aompi_22.0.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manifests/aompi_23.0.xml b/manifests/aompi_23.0.xml
new file mode 100644
index 0000000000..14b23d0363
--- /dev/null
+++ b/manifests/aompi_23.0.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manifests/aompi_new_17.0.xml b/manifests/aompi_new_17.0.xml
index 2287062002..632259f565 100644
--- a/manifests/aompi_new_17.0.xml
+++ b/manifests/aompi_new_17.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aompi_new_18.0.xml b/manifests/aompi_new_18.0.xml
index 60c0c1d067..82b5893828 100644
--- a/manifests/aompi_new_18.0.xml
+++ b/manifests/aompi_new_18.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/aompi_new_19.0.xml b/manifests/aompi_new_19.0.xml
index 60c0c1d067..82b5893828 100644
--- a/manifests/aompi_new_19.0.xml
+++ b/manifests/aompi_new_19.0.xml
@@ -4,9 +4,9 @@
-
-
-
+
+
+
diff --git a/manifests/test_14.0.xml b/manifests/test_14.0.xml
index f0dd6aca85..c315691bf9 100644
--- a/manifests/test_14.0.xml
+++ b/manifests/test_14.0.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/test_15.0.xml b/manifests/test_15.0.xml
index 433ed9bba0..1272f4a0ad 100644
--- a/manifests/test_15.0.xml
+++ b/manifests/test_15.0.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/test_16.0.xml b/manifests/test_16.0.xml
index 433ed9bba0..1272f4a0ad 100644
--- a/manifests/test_16.0.xml
+++ b/manifests/test_16.0.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/test_17.0.xml b/manifests/test_17.0.xml
index c02bd61b16..f3edd6fe82 100644
--- a/manifests/test_17.0.xml
+++ b/manifests/test_17.0.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/test_18.0.xml b/manifests/test_18.0.xml
index a56ecd9ca7..1c19608317 100644
--- a/manifests/test_18.0.xml
+++ b/manifests/test_18.0.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/test_19.0.xml b/manifests/test_19.0.xml
index a56ecd9ca7..1c19608317 100644
--- a/manifests/test_19.0.xml
+++ b/manifests/test_19.0.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/test_20.0.xml b/manifests/test_20.0.xml
index 0344b4712f..6bacf3719d 100644
--- a/manifests/test_20.0.xml
+++ b/manifests/test_20.0.xml
@@ -3,8 +3,8 @@
-
-
+
+
diff --git a/manifests/test_21.0.xml b/manifests/test_21.0.xml
index 0344b4712f..f64df2bfca 100644
--- a/manifests/test_21.0.xml
+++ b/manifests/test_21.0.xml
@@ -3,8 +3,9 @@
-
-
+
+
+
@@ -18,6 +19,7 @@
+
@@ -39,5 +41,7 @@
+
+
diff --git a/manifests/test_22.0.xml b/manifests/test_22.0.xml
new file mode 100644
index 0000000000..8cde6f0723
--- /dev/null
+++ b/manifests/test_22.0.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/manifests/test_23.0.xml b/manifests/test_23.0.xml
new file mode 100644
index 0000000000..8cde6f0723
--- /dev/null
+++ b/manifests/test_23.0.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/srock-bin/README b/srock-bin/README
new file mode 100644
index 0000000000..c781913c64
--- /dev/null
+++ b/srock-bin/README
@@ -0,0 +1,114 @@
+
+Q: What is srock?
+A: Srock is a scripted download and build of the complete ROCm software stack using TheRock;
+where the content of the ROCm compiler components is taken from the amd-staging branches
+of compiler github repos llvm-project and hipify. This builds a software stack where AMD
+compiler developers can test the impact of development changes to the compiler in the
+amd-staging branch. The amd-staging branch is where LLVM upstream and LLVM local
+enhancements are merged on a daily basis.
+
+Q: How to run build_srock.sh
+A: These commands.
+ export SROCK_REPOS=/work/$USER/git/srock-repos
+ mkdir -p $SROCK_REPOS ; cd $SROCK_REPOS
+ git clone https://github.com/ROCm/aomp
+ nohup ./aomp/srock-bin/build_srock.sh &
+
+Q: How is this different than aomp?
+A: Aomp used a set of bash scripts that performed the cmake, make, and make install of
+each component. Srock only has a single script (build_srock.sh) that automates the
+TheRock instructions for downloading and building TheRock. TheRock has a single
+hierarhical github repository with submodules for bringing together all ROCm components.
+Like the classical ROCm build system, aomp built individual components from a linear
+list of github repositories with bash scripts.
+
+Q: Will srock replace aomp?
+A: Yes, srock will replace aomp. Developers that used aomp will switch to using
+the script build_srock.sh. The aomp repository, which includes significant compiler
+testing based on AOMP environment variable will remain. The build_srock.sh
+script and all support for srock will be managed in the aomp repo in the srock-bin
+subdirectory.
+
+Q: Why not just change the submodule file to point compiler repos to amd-staging branch?
+A: TheRock has frequent changes including submodule updates. The build_srock.sh
+script correctly reintegrates these changes and then refixes the llvm-project and
+hipify repos to amd-staging branch. Furthermore, the tip of TheRock is building
+a "release" compiler. Srock builds a development compiler with debug features and/or
+changes to components to work correctly with a more-recent amd-staging compiler.
+These differences may require patching of TheRock and component submodules.
+The build_srock.sh script automates the consistent maintenance and sharing of
+patches that make the ROCm stack build correctly with the amd-staging compiler.
+It also automates consistent configurations of different sets of components
+of TheRock. Because some may work while others are in development or need repair.
+The default srock configuration is minimal to speed build time for compiler
+developers.
+
+Q: TheRock would like all components that it builds with to use the "develop" branch.
+How do changes from amd-staging llvm-project get to the develop branch?
+A: The amd-staging branch is a rapidly moving target rooted in LLVM upstream.
+Compiler (LLVM) developers want these updates merged into the amd-staging branch
+since they are somewhat verified. Merging amd-staging to TheRock develop branch
+will be managed by the compiler leaders and should occur at least every other week.
+Every user (compiler developer) of build_srock.sh will get the tip of TheRock
+unless they specifically avoid it. So Compiler developers will witness merge
+and build problems with srock and resolve them before compiler leadership pushes
+ amd-staging to develop.
+
+Q: Can I use build_srock.sh to build TheRock with develop branch?
+A: YES, but why would you, since this is the same as building the tip of TheRock
+with no changes.
+
+Q: How will TheRock team update the develop branch of llvm-project?
+A: Assuming srock is in a stable state, a simple merge from amd-staging to develop
+might be enough. But recall that srock has a set of patches to TheRock and other
+components to make the amd-staging compiler work. So in addition to the amd-staging
+merge, some additional patch or PRs taken from srocks patches might be necessary.
+
+Q: How do I use the ROCm toolchain created by build_srock.sh
+A: The default installation will be in $HOME/rocm/srock which
+ will be a symbolic link to $HOME/rocm/srock_$SROCK_VERSION_STRING
+ Depending on your test or dev environment, you can set
+ AOMP=~/rocm/srock or ROCM_PATH=~/rocm/srock
+
+Q: How can I customize my build of srock?
+A: Use these environment variables:
+ To change the location of SROCK_REPOS set
+ SROCK_REPOS=$HOME/git/srock-repos
+ The default value is /work/$USER/git/srock-repos
+ To change from a minimal THEROCK config set
+ SROCK_CONFIG=all
+ THe default value is minimal.
+ To change where the build is installed set these two variables
+ SROCK_LINK=/work/$USER/rocm/srock
+ SROCK_INSTALL_DIR=/work/$USER/rocm/my_srock_42
+ Note that SROCK_LINK will be made a symbolic link to SROCK_INSTALL_DIR
+ To change the compiler branch set
+ SROCK_COMPILER_BRANCH=develop
+ "develop" is a special value that will cause build_srock.sh to
+ do a native build of the tip of TheROCK. That is it will not
+ checkout any branch of the compiler submodules.
+ To cause srock to get a fresh new clone of TheRock on next build.
+ rm -rf $SROCK_REPOS/TheRock
+Q: How do I get ROCm-like packages from srock?
+A: You cannot. srock is for build and install direct,
+ srock does no packaging of ROCm components.
+ But we do use TheRock artifact descriptors to control what
+ gets installed from the build.
+
+Q: In addtion to TheRock repo, I see other repos populated in SROCK_REPOS.
+ What are aomp, hipfort, rocdbgapi, and rocgdb repos?
+A: aomp contains the build_srock.sh script as well as the legacy aomp
+ build system. It also contains detailed compiler tests.
+ hipfort, rocdbgapi, and rocgdb are three components that have
+ not yet been integrated into TheRock. These repos will go away
+ when thes components are integrated. build_srock.sh does the
+ cloning and building of these components so that an srock installation
+ is as complete as aomp.
+--------------------------
+More customization controls are being developed, such as
+building TheRock with last known good sha key(LKG).
+Another control will be the ability to restart build_srock.sh
+from a previous fail or minor component changes.
+
+
+
diff --git a/srock-bin/build_cmake.sh b/srock-bin/build_cmake.sh
new file mode 100755
index 0000000000..26cc44a482
--- /dev/null
+++ b/srock-bin/build_cmake.sh
@@ -0,0 +1,490 @@
+#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
+SUPPLEMENTAL_COMPONENTS=${SUPPLEMENTAL_COMPONENTS:-openmpi silo hdf5 fftw ninja}
+PREREQUISITE_COMPONENTS=${PREREQUISITE_COMPONENTS:-cmake rocmsmilib hwloc aqlprofile rocm-core}
+
+# --- Start standard header to set SROCK environment variables ----
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/srock_common_vars"
+# --- end standard header ----
+FLANG=${FLANG:-flang}
+
+function runcmd(){
+ THISCMD=$1
+ if [ "$DRYRUN" ] ; then
+ echo "$THISCMD"
+ else
+ echo "$THISCMD"
+ echo "$THISCMD" >>"$CMDLOGFILE"
+ $THISCMD
+ rc=$?
+ if [ $rc != 0 ] ; then
+ echo "ERROR: The following command failed with return code $rc: "
+ echo " $THISCMD"
+ exit $rc
+ fi
+ fi
+}
+
+function runcmdout(){
+ THISCMD=$1
+ OUTFILE=$2
+ if [ "$DRYRUN" ] ; then
+ echo "$THISCMD > $OUTFILE"
+ else
+ echo "$THISCMD > $OUTFILE"
+ echo "$THISCMD > $OUTFILE" >>"$CMDLOGFILE"
+ $THISCMD > "$OUTFILE"
+ rc=$?
+ if [ $rc != 0 ] ; then
+ echo "ERROR: The following command failed with return code $rc: "
+ echo " $THISCMD > $OUTFILE"
+ exit $rc
+ fi
+ fi
+}
+
+function runcmdin(){
+ THISCMD=$1
+ INFILE=$2
+ if [ "$DRYRUN" ] ; then
+ echo "$THISCMD < $INFILE"
+ else
+ echo "$THISCMD < $INFILE"
+ echo "$THISCMD < $INFILE" >>"$CMDLOGFILE"
+ $THISCMD < "$INFILE"
+ rc=$?
+ if [ $rc != 0 ] ; then
+ echo "ERROR: The following command failed with return code $rc: "
+ echo " $THISCMD < $INFILE"
+ exit $rc
+ fi
+ fi
+}
+
+function checkversion(){
+ # inputs: $_linkfrom, $_cname, $CMDLOGFILE, $_version
+ # output: $SKIPBUILD
+ if [ -L "$_linkfrom" ] ; then
+ existing_install_dir=$(readlink "$_linkfrom")
+ if [ -d "$existing_install_dir" ] ; then
+ existing_version=${existing_install_dir##*-}
+ if [ "$existing_version" == "$_version" ] ; then
+ echo "Info: Skipping build for $_cname, version $_version already exists"
+ echo "# skipping build for $_cname, version $_version already exists" >>"$CMDLOGFILE"
+ SKIPBUILD=TRUE
+ else
+ echo "Info: creating new version of $_cname $_version"
+ echo "Info: creating new version of $_cname $_version" >>"$CMDLOGFILE"
+ fi
+ else
+ echo "Info: Missing existing_install_dir $existing_install_dir, creating version of $_cname $_version"
+ echo "# Missing existing_install_dir $existing_install_dir, creating version of $_cname $_version" >>"$CMDLOGFILE"
+ fi
+ fi
+}
+function buildopenmpi(){
+ # Not all builds, trunk for example, install clang into lib/llvm/bin. Fall back on $SROCK/bin.
+ if [ ! -f "$LLVM_INSTALL_LOC/bin/${FLANG}" ] ; then
+ LLVM_INSTALL_LOC=$SROCK
+ if [ ! -f "$LLVM_INSTALL_LOC/bin/${FLANG}" ] ; then
+ LLVM_INSTALL_LOC=$SROCK/lib/llvm
+ if [ ! -f "$LLVM_INSTALL_LOC/bin/${FLANG}" ] ; then
+ echo "Error: buildopenmpi cannot find ${FLANG} executable. Set SROCK to location of $FLANG "
+ exit 1
+ fi
+ fi
+ fi
+ if [ ! -d "$SROCK_SUPP/hwloc" ] ; then
+ echo "Error: 'build_supp.sh openmpi' requires that hwloc is installed at $SROCK_SUPP/hwloc"
+ echo " Please run 'build_supp.sh hwloc' "
+ exit 1
+ fi
+
+ _cname="openmpi"
+ _version=5.0.7
+ _release=v5.0
+ _installdir=$SROCK_SUPP_INSTALL/$_cname-$_version
+ _linkfrom=$SROCK_SUPP/$_cname
+ _builddir=$SROCK_SUPP_BUILD/$_cname
+
+ SKIPBUILD="FALSE"
+ checkversion
+ if [ "$SKIPBUILD" == "TRUE" ] ; then
+ return
+ fi
+ if [ -d "$_builddir" ] ; then
+ runcmd "rm -rf $_builddir"
+ fi
+ runcmd "mkdir -p $_builddir"
+ runcmd "cd $_builddir"
+ runcmd "wget https://download.open-mpi.org/release/open-mpi/$_release/openmpi-$_version.tar.bz2"
+ runcmd "bzip2 -d openmpi-$_version.tar.bz2"
+ runcmd "tar -xf openmpi-$_version.tar"
+ runcmd "cd openmpi-$_version"
+ if [ -d "$_installdir" ] ; then
+ runcmd "rm -rf $_installdir"
+ fi
+ runcmd "mkdir -p $_installdir"
+ ### update configure to recognize flang
+ runcmd "cp configure configure-orig"
+ runcmdout "sed -e s/flang\s*)/flang*)/ configure-orig" configure
+ ###
+ runcmd "./configure --with-hwloc=$SROCK_SUPP/hwloc --with-hwloc-libdir=$SROCK_SUPP/hwloc/lib OMPI_CC=$LLVM_INSTALL_LOC/bin/clang OMPI_CXX=$LLVM_INSTALL_LOC/bin/clang++ OMPI_F90=$LLVM_INSTALL_LOC/bin/${FLANG} CXX=$LLVM_INSTALL_LOC/bin/clang++ CC=$LLVM_INSTALL_LOC/bin/clang FC=$LLVM_INSTALL_LOC/bin/${FLANG} --prefix=$_installdir"
+ runcmd "make -j8"
+ runcmd "make install"
+ if [ -L "$_linkfrom" ] ; then
+ runcmd "rm $_linkfrom"
+ fi
+ runcmd "ln -sf $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
+}
+
+function buildninja(){
+ _cname="ninja"
+ _version=1.13.2
+ _installdir=$SROCK_SUPP_INSTALL/$_cname-$_version
+ _linkfrom=$SROCK_SUPP/$_cname
+ _builddir=$SROCK_SUPP_BUILD/$_cname
+
+ SKIPBUILD="FALSE"
+ checkversion
+ if [ "$SKIPBUILD" == "TRUE" ] ; then
+ return
+ fi
+ if [ -d "$_builddir" ] ; then
+ runcmd "rm -rf $_builddir"
+ fi
+ runcmd "mkdir -p $_builddir"
+ runcmd "cd $_builddir"
+ runcmd "wget https://github.com/ninja-build/ninja/archive/refs/tags/v${_version}.tar.gz"
+ runcmd "tar -xzf v${_version}.tar.gz"
+ runcmd "cd ninja-$_version"
+ _patch_file="$thisdir/patches/ninja-nprocs-v${_version}.patch"
+ if [ -r "$_patch_file" ]; then
+ runcmd "cp $_patch_file $_builddir"
+ runcmdin "patch --merge -p1" "$_patch_file"
+ fi
+ if [ -d "$_installdir" ] ; then
+ runcmd "rm -rf $_installdir"
+ fi
+ runcmd "mkdir -p $_installdir/bin"
+ runcmd "$SROCK_SUPP/cmake/bin/cmake -Bbuild-cmake"
+ runcmd "$SROCK_SUPP/cmake/bin/cmake --build build-cmake"
+ runcmd "cp -p build-cmake/ninja $_installdir/bin/."
+ if [ -L "$_linkfrom" ] ; then
+ runcmd "rm $_linkfrom"
+ fi
+ runcmd "ln -sf $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
+}
+
+function getrocmpackage(){
+ if [[ "$1" == "" || "$2" == "" || "$3" == "" ]]; then
+ echo "ERROR: getrocmpackage requires 3 parameters - localname packagename componentversion"
+ exit 1
+ fi
+ _cname="$1"
+ _packagename="$2"
+ _componentversion="$3"
+ _directory=$(echo "$2" | cut -b 1)
+ _version=7.0
+ _packageversion=7.0.0
+ _fullversion=70000
+ _buildnumber=38
+ _installdir=$SROCK_SUPP_INSTALL/$_cname-$_version
+ _linkfrom=$SROCK_SUPP/$_cname
+ _builddir=$SROCK_SUPP_BUILD/$_cname
+
+ SKIPBUILD="FALSE"
+ checkversion
+ if [ "$SKIPBUILD" == "TRUE" ] ; then
+ return
+ fi
+ if [ -d "$_builddir" ] ; then
+ runcmd "rm -rf $_builddir"
+ fi
+ runcmd "mkdir -p $_builddir"
+ runcmd "cd $_builddir"
+ osname=$(grep -e ^NAME= < /etc/os-release)
+ if [[ $osname =~ "Ubuntu" ]]; then
+ # not sure if deb_version is 20 or 22
+ deb_version="24"
+ os_version=$(grep VERSION_ID /etc/os-release | cut -d"\"" -f2)
+ [ "$os_version" == "22.04" ] && deb_version="22"
+ #https://repo.radeon.com/rocm/apt/6.1/pool/main/h/hsa-amd-aqlprofile6.1.0/hsa-amd-aqlprofile6.1.0_1.0.0.60100.60100-82~${deb_version}_amd64.deb
+ #https://repo.radeon.com/rocm/apt/6.1/pool/main/h/hsa-amd-aqlprofile6.1.0/hsa-amd-aqlprofile6.1.0_1.0.0.60100.60100-82~22.04_amd64.deb
+ runcmd "wget https://repo.radeon.com/rocm/apt/$_version/pool/main/$_directory/$_packagename$_packageversion/$_packagename${_packageversion}_${_componentversion}.${_fullversion}-${_buildnumber}~${deb_version}.04_amd64.deb"
+
+ runcmd "dpkg -x $_packagename${_packageversion}_${_componentversion}.${_fullversion}-${_buildnumber}~${deb_version}.04_amd64.deb $_builddir"
+ elif [[ $osname =~ "SLES" ]]; then
+ #https://repo.radeon.com/rocm/yum/6.1/main/hsa-amd-aqlprofile6.1.0-1.0.0.60100.60100-82.el7.x86_64.rpm
+ runcmd "wget https://repo.radeon.com/rocm/zyp/$_version/main/$_packagename$_packageversion-$_componentversion.$_fullversion-sles156.$_buildnumber.x86_64.rpm"
+ echo "$_packagename$_packageversion-$_componentversion.$_fullversion-sles156.$_buildnumber.x86_64.rpm | cpio -idm"
+ rpm2cpio "$_packagename$_packageversion-$_componentversion.$_fullversion-sles156.$_buildnumber.x86_64.rpm" | cpio -idm
+ else
+ runcmd "wget https://repo.radeon.com/rocm/rhel8/$_version/main/$_packagename$_packageversion-$_componentversion.$_fullversion-$_buildnumber.el8.x86_64.rpm"
+ echo "$_packagename$_packageversion-$_componentversion.$_fullversion-$_buildnumber.el8.x86_64.rpm | cpio -idm"
+ rpm2cpio "$_packagename$_packageversion-$_componentversion.$_fullversion-$_buildnumber.el8.x86_64.rpm" | cpio -idm
+ fi
+
+ if [ -d "$_installdir" ] ; then
+ runcmd "rm -rf $_installdir"
+ fi
+ if [ "$_cname" == "rocm-core" ] ; then
+ runcmd "mkdir -p $_installdir"
+ runcmd "cp -rp $_builddir/opt/rocm-$_packageversion/. $_installdir"
+ else
+ runcmd "mkdir -p $_installdir/lib"
+ runcmd "cd $_installdir"
+ runcmd "cp -rp $_builddir/opt/rocm-$_packageversion/lib $_installdir"
+ fi
+
+ if [ -L "$_linkfrom" ] ; then
+ runcmd "rm $_linkfrom"
+ fi
+ runcmd "ln -sf $_installdir $_linkfrom"
+ #runcmd "rm -rf $_builddir"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
+}
+
+function buildhdf5(){
+ _cname="hdf5"
+ _version=1.12.0
+ _release=hdf5-1.12
+ _installdir=$SROCK_SUPP_INSTALL/hdf5-$_version
+ _linkfrom=$SROCK_SUPP/hdf5
+ _builddir=$SROCK_SUPP_BUILD/hdf5
+ SKIPBUILD="FALSE"
+ checkversion
+ if [ "$SKIPBUILD" == "TRUE" ] ; then
+ return
+ fi
+
+ if [ -d "$_builddir" ] ; then
+ runcmd "rm -rf $_builddir"
+ fi
+ runcmd "mkdir -p $_builddir"
+ runcmd "cd $_builddir"
+ runcmd " wget https://support.hdfgroup.org/ftp/HDF5/releases/$_release/hdf5-$_version/src/hdf5-$_version.tar.bz2"
+ runcmd "bzip2 -d hdf5-$_version.tar.bz2"
+ runcmd "tar -xf hdf5-$_version.tar"
+ runcmd "cd hdf5-$_version"
+ if [ -d "$_installdir" ] ; then
+ runcmd "rm -rf $_installdir"
+ fi
+ runcmd "mkdir -p $_installdir"
+ runcmd "./configure --enable-fortran --prefix=$_installdir"
+ runcmd "make -j8"
+ runcmd "make install"
+ if [ -L "$_linkfrom" ] ; then
+ runcmd "rm $_linkfrom"
+ fi
+ runcmd "ln -sf $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
+}
+
+function buildsilo(){
+ _cname="silo"
+ _version=4.10.2
+ _installdir=$SROCK_SUPP_INSTALL/silo-$_version
+ _linkfrom=$SROCK_SUPP/silo
+ _builddir=$SROCK_SUPP_BUILD/silo
+ SKIPBUILD="FALSE"
+ checkversion
+ if [ "$SKIPBUILD" == "TRUE" ] ; then
+ return
+ fi
+
+ if [ -d "$_builddir" ] ; then
+ runcmd "rm -rf $_builddir"
+ fi
+ runcmd "mkdir -p $_builddir"
+ runcmd "cd $_builddir"
+ # runcmd "wget https://wci.llnl.gov/sites/wci/files/2021-01/silo-$_version.tgz"
+ # runcmd "tar -xzf silo-$_version.tgz"
+ runcmd "wget https://software.llnl.gov/Silo/ghpages/releases/silo-$_version.tar.xz"
+ runcmd "tar -x --xz -f silo-$_version.tar.xz"
+ runcmd "cd silo-$_version"
+ if [ -d "$_installdir" ] ; then
+ runcmd "rm -rf $_installdir"
+ fi
+ runcmd "mkdir -p $_installdir"
+ runcmd "./configure --prefix=$_installdir"
+ runcmd "make -j8"
+ runcmd "make install"
+ if [ -L "$_linkfrom" ] ; then
+ runcmd "rm $_linkfrom"
+ fi
+ runcmd "ln -sf $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
+}
+
+function buildfftw(){
+ _cname="fftw"
+ _version=3.3.8
+ _installdir=$SROCK_SUPP_INSTALL/fftw-$_version
+ _linkfrom=$SROCK_SUPP/fftw
+ _builddir=$SROCK_SUPP_BUILD/fftw
+ SKIPBUILD="FALSE"
+ checkversion
+ if [ "$SKIPBUILD" == "TRUE" ] ; then
+ return
+ fi
+
+ if [ -d "$_builddir" ] ; then
+ runcmd "rm -rf $_builddir"
+ fi
+ runcmd "mkdir -p $_builddir"
+ runcmd "cd $_builddir"
+ runcmd "wget http://www.fftw.org/fftw-$_version.tar.gz"
+ runcmd "tar -xzf fftw-$_version.tar.gz"
+ runcmd "cd fftw-$_version"
+ if [ -d "$_installdir" ] ; then
+ runcmd "rm -rf $_installdir"
+ fi
+ runcmd "mkdir -p $_installdir"
+ runcmd "./configure --prefix=$_installdir --enable-shared --enable-threads --enable-sse2 --enable-avx"
+ runcmd "make -j8"
+ runcmd "make install"
+ runcmd "make clean"
+ runcmd "./configure --prefix=$_installdir --enable-shared --enable-threads --enable-sse2 --enable-avx --enable-float"
+ runcmd "make -j8"
+ runcmd "make install"
+ if [ -L "$_linkfrom" ] ; then
+ runcmd "rm $_linkfrom"
+ fi
+ runcmd "ln -sf $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
+}
+
+
+function buildcmake(){
+ _cname="cmake"
+ _version=3.25.2
+ _installdir=$SROCK_SUPP_INSTALL/$_cname-$_version
+ _linkfrom=$SROCK_SUPP/$_cname
+ _builddir=$SROCK_SUPP_BUILD/$_cname
+ SKIPBUILD="FALSE"
+ checkversion
+ if [ "$SKIPBUILD" == "TRUE" ] ; then
+ return
+ fi
+
+ if [ -d "$_builddir" ] ; then
+ runcmd "rm -rf $_builddir"
+ fi
+ runcmd "mkdir -p $_builddir"
+ runcmd "cd $_builddir"
+ runcmd "wget https://github.com/Kitware/CMake/releases/download/v$_version/cmake-$_version.tar.gz"
+ runcmd "tar -xzf cmake-$_version.tar.gz"
+ runcmd "cd cmake-$_version"
+ if [ -d "$_installdir" ] ; then
+ runcmd "rm -rf $_installdir"
+ fi
+ runcmd "mkdir -p $_installdir"
+ runcmd "./bootstrap --parallel=8 --prefix=$_installdir"
+ runcmd "make -j8"
+ runcmd "make install"
+ if [ -L "$_linkfrom" ] ; then
+ runcmd "rm $_linkfrom"
+ fi
+ runcmd "ln -sf $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
+}
+
+function buildrocmsmilib(){
+ _cname="rocmsmilib"
+ _version=7.0.x
+ _installdir=$SROCK_SUPP_INSTALL/rocmsmilib-$_version
+ _linkfrom=$SROCK_SUPP/rocmsmilib
+ _builddir=$SROCK_SUPP_BUILD/rocmsmilib
+ SKIPBUILD="FALSE"
+ checkversion
+ if [ "$SKIPBUILD" == "TRUE" ] ; then
+ return
+ fi
+
+ if [ -d "$_builddir" ] ; then
+ runcmd "rm -rf $_builddir"
+ fi
+ runcmd "mkdir -p $_builddir"
+ runcmd "cd $_builddir"
+ runcmd "git clone -b release/rocm-rel-7.0 https://github.com/ROCm/rocm_smi_lib rocmsmilib-$_version"
+ runcmd "cd rocmsmilib-$_version"
+ runcmd "mkdir -p build"
+ runcmd "cd build"
+ runcmd "$SROCK_SUPP/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=$_installdir .."
+ if [ -d "$_installdir" ] ; then
+ runcmd "rm -rf $_installdir"
+ fi
+ runcmd "mkdir -p $_installdir"
+ runcmd "make -j8"
+ runcmd "make install"
+ if [ -L "$_linkfrom" ] ; then
+ runcmd "rm $_linkfrom"
+ fi
+ runcmd "ln -sf $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
+}
+
+function buildhwloc(){
+ _cname="hwloc"
+ _version=2.7
+ _installdir=$SROCK_SUPP_INSTALL/hwloc-$_version
+ _linkfrom=$SROCK_SUPP/hwloc
+ _builddir=$SROCK_SUPP_BUILD/hwloc
+ SKIPBUILD="FALSE"
+ checkversion
+ if [ "$SKIPBUILD" == "TRUE" ] ; then
+ return
+ fi
+
+ if [ ! -d "$SROCK_SUPP/rocmsmilib/lib" ] && [ ! -d "$SROCK_SUPP/rocmsmilib/lib64" ]; then
+ echo "ERROR: Must build rocmsmilib before hwloc. Try:"
+ echo " $0 rocmsmilib"
+ echo "#ERROR: You must build rocmsmilib before hwloc because static build of hwloc depends on rocsmilib">>"$CMDLOGFILE"
+ exit 1
+ fi
+ if [ -d "$_builddir" ] ; then
+ runcmd "rm -rf $_builddir"
+ fi
+ runcmd "mkdir -p $_builddir"
+ runcmd "cd $_builddir"
+ runcmd "git clone https://github.com/open-mpi/hwloc hwloc-$_version"
+ runcmd "cd hwloc-$_version"
+ runcmd "git checkout v$_version"
+ runcmd "./autogen.sh"
+ runcmd "./configure --prefix=$_installdir --with-pic=yes --enable-static=yes --enable-shared=no --disable-io --disable-libudev --disable-libxml2 --with-rocm=$SROCK_SUPP/rocsmilib"
+ if [ -d "$_installdir" ] ; then
+ runcmd "rm -rf $_installdir"
+ fi
+ runcmd "mkdir -p $_installdir"
+ runcmd "make -j8"
+ runcmd "make install"
+ if [ -L "$_linkfrom" ] ; then
+ runcmd "rm $_linkfrom"
+ fi
+ runcmd "ln -sf $_installdir $_linkfrom"
+ echo "# $_linkfrom is now symbolic link to $_installdir " >>"$CMDLOGFILE"
+}
+
+#--------------------------- Main script starts here -----------------------
+
+CMDLOGFILE=$SROCK_SUPP_BUILD/cmdlog
+
+mkdir -p "$SROCK_SUPP_BUILD"
+buildcmake
+buildninja
+
+echo "SROCK_SUPP=$SROCK_SUPP"
+echo "SROCK_JOB_THREADS=$SROCK_JOB_THREADS"
+echo "NINJA_NPROCS=$NINJA_NPROCS"
+_thisdate=$(date)
+echo "# DONE: successful build of cmake on $_thisdate " >>"$CMDLOGFILE"
+
diff --git a/srock-bin/build_hipfort.sh b/srock-bin/build_hipfort.sh
new file mode 100755
index 0000000000..e09c323d1f
--- /dev/null
+++ b/srock-bin/build_hipfort.sh
@@ -0,0 +1,106 @@
+#!/bin/bash
+#
+# File: build_hipfort.sh
+#
+# MIT License
+#
+# Copyright (c) 2017 Advanced Micro Devices, Inc. All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use, copy,
+# modify, merge, publish, distribute, sublicense, and/or sell copies
+# of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# This is sourced from build_srock.sh so no header needed.
+
+REPO_DIR=$SROCK_REPOS/hipfort
+BUILD_DIR=${REPO_DIR}/build
+LLVM_INSTALL_LOC=$SROCK_INSTALL_DIR/lib/llvm
+export HIP_PLATFORM=amd
+
+if [ ! -f "$SROCK_CMAKE" ] ; then
+ echo "ERROR: $0 requires SROCK_CMAKE env be set to qualified cmake"
+ echo " Did you source prebuild_srock.sh ? "
+fi
+if [ ! -d "$REPO_DIR" ] ; then
+ echo "ERROR: Missing repository $REPO_DIR/"
+ exit 1
+fi
+
+if [ ! -f "$SROCK_INSTALL_DIR/lib/llvm/bin/clang" ] ; then
+ echo "ERROR: Missing file $SROCK_INSTALL_DIR/lib/llvm/bin/clang"
+ echo " "
+ exit 1
+fi
+
+if [ -d "$BUILD_DIR" ] ; then
+ if [ "$_build_srock_mode" == "restart" ] ; then
+ echo "===== Skipping $0"
+ return
+ fi
+ echo
+ echo "===== hipfort FRESH START, CLEANING UP FROM PREVIOUS BUILD"
+ echo " rm -rf $BUILD_DIR"
+ rm -rf "$BUILD_DIR"
+fi
+mkdir -p $BUILD_DIR
+
+declare -a MYCMAKEOPTS
+MYCMAKEOPTS=(-DCMAKE_INSTALL_PREFIX="$SROCK_INSTALL_DIR/lib/llvm"
+ -DCMAKE_BUILD_TYPE=Release
+ -DCMAKE_Fortran_COMPILER="$LLVM_INSTALL_LOC/bin/flang"
+ -DCMAKE_Fortran_FLAGS_DEBUG=""
+ -DCMAKE_PREFIX_PATH="$SROCK_INSTALL_DIR/lib/cmake"
+ -DCMAKE_AR="$LLVM_INSTALL_LOC/bin/llvm-ar"
+ -DCMAKE_RANLIB="$LLVM_INSTALL_LOC/bin/llvm-ranlib")
+
+cd "$REPO_DIR" || exit
+echo
+echo "===== Running $SROCK_CMAKE for hipfort"
+$SROCK_CMAKE -S. -Bbuild ${MYCMAKEOPTS[@]} -DCMAKE_Fortran_FLAGS='-ffree-form -fPIC' $REPO_DIRi
+_cmakerc=$?
+echo "===== DONE Running hipfort cmake"
+if [ $_cmakerc != 0 ] ; then
+ echo
+ echo "ERROR hipfort cmake failed with $SROCK_CMAKE. Cmake flags:"
+ echo " ${MYCMAKEOPTS[@]} -DCMAKE_Fortran_FLAGS='-ffree-form -fPIC'"
+ exit 1
+fi
+
+echo
+cd "$BUILD_DIR" || exit
+echo "===== Running make -j16 for hipfort"
+make -j16
+_makerc=$?
+if [ $_makerc != 0 ] ; then
+ echo " "
+ echo "ERROR: make -j16 FAILED"
+ echo "To restart:"
+ echo " cd $BUILD_DIR"
+ echo " make "
+ exit 1
+fi
+
+echo
+echo "===== Running make install"
+make install
+_makerc=$?
+if [ $_makerc != 0 ] ; then
+ echo "ERROR make install failed "
+ exit 1
+fi
diff --git a/srock-bin/build_srock.sh b/srock-bin/build_srock.sh
new file mode 100755
index 0000000000..020acc2c29
--- /dev/null
+++ b/srock-bin/build_srock.sh
@@ -0,0 +1,341 @@
+#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
+#
+# build_srock.sh: Clone and build TheRock with amd-staging compiler.
+#
+# --- Start standard header to set SROCK environment variables ----
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/srock_common_vars"
+# --- end standard header ----
+function test_apply_patch() {
+ if ! patch -p1 -t -N --merge --dry-run < $_patch_file >/dev/null; then
+ echo "ERROR: patch --dry-run failed. Could not apply $_patch_file "
+ cd $_curdir
+ exit 1
+ else
+ echo "patch -p1 --no-backup-if-mismatch --merge < $_patch_file"
+ patch -p1 --no-backup-if-mismatch --merge < $_patch_file
+ fi
+}
+
+_curdir=$PWD
+_start_date=$(date)
+_start_secs=$(date +%s)
+
+# build_srock.sh Modes:
+# The default mode "fullupdate" will
+# - if TheRock repo exists, remove all previous updates
+# and update TheRock and submodules to the tip
+# else clone TheRock
+# - if not develop, get fresh amd-staging updates to compiler repos
+# - rerun fetch_sources.py
+# - if not develop, apply srock patches/amd-staging/* patches
+# - remove previous build dir completely
+# - Run TheRock cmake configuration.
+# - do full build
+# The restart mode
+# - assumes TheRock repo exists
+# - assumes TheRocke/build dir exists
+# - assumes TheRock config has been run
+# - assumes all data preparation has been run
+# - restarts build in TheRock dir with cmake --build build
+# FIXME: Add support for build modes: newclone and newbuild
+#
+_build_srock_mode=${1:-fullupdate}
+_cmake_enable=""
+
+# This TheRock config is full build minus failing components
+if [ "$SROCK_CONFIG" == "all" ] ; then
+ _cmake_enable="\
+-DTHEROCK_ENABLE_ALL=ON \
+-DTHEROCK_ENABLE_MIOPEN=OFF \
+-DTHEROCK_ENABLE_COMPOSABLE_KERNEL=OFF \
+-DTHEROCK_ENABLE_FFT=OFF \
+"
+fi
+
+# This is full build which could include failing components
+if [ "$SROCK_CONFIG" == "all-debug" ] ; then
+ _cmake_enable="\
+-DTHEROCK_ENABLE_ALL=ON \
+"
+fi
+
+# Default is minimal for compiler developers
+if [ "$SROCK_CONFIG" == "minimal" ] ; then
+ _cmake_enable="\
+-DTHEROCK_ENABLE_ALL=OFF \
+-DTHEROCK_ENABLE_HIP=ON \
+-DTHEROCK_ENABLE_HIP_RUNTIME=ON \
+-DTHEROCK_ENABLE_HIPIFY=ON \
+-DTHEROCK_BUNDLE_SYSDEPS=ON \
+-DTHEROCK_ENABLE_COMPILER=ON \
+"
+fi
+
+_gfxsemicolons=$(echo "$GFXLIST" | tr ' ' ';')
+_gfamsemicolons=$(echo "$GFXFAM" | tr ' ' ';')
+
+_cmake_args="-B build -GNinja \
+-DTHEROCK_AMDGPU_TARGETS='$_gfxsemicolons' \
+-DTHEROCK_AMDGPU_FAMILIES='$_gfamsemicolons' \
+-DTHEROCK_AMDGPU_DIST_BUNDLE_NAME=srock \
+-DTHEROCK_BACKGROUND_BUILD_JOBS=1 \
+-DTHEROCK_ENABLE_LLVM_TESTS=1 \
+$_cmake_enable \
+$SROCK_THEROCK_DIR"
+
+# Print the start banner similar to DONE banner, useful if fails
+echo
+echo "===== START $0 on $_start_date"
+echo " THEROCK targets: $_gfxsemicolons"
+echo " THEROCK families: $_gfamsemicolons"
+echo " ROCm install dir: $SROCK_INSTALL_DIR"
+echo " TheRock Dir: $SROCK_THEROCK_DIR"
+echo " TheRock branch: $SROCK_THEROCK_BRANCH"
+echo " Compiler branch: $SROCK_COMPILER_BRANCH"
+echo " Build Mode: $_build_srock_mode"
+echo " SROCK config name: $SROCK_CONFIG"
+echo " cmake args: $_cmake_args"
+
+# Run srock prebuild which includes finding suitable cmake
+echo
+echo "===== Sourcing prebuild_srock.sh"
+. $thisdir/prebuild_srock.sh
+echo "===== DONE Sourcing prebuild_srock.sh"
+
+if [ "$_build_srock_mode" != "restart" ] ; then
+# ------------ BEGINNING of NOT restart mode ------------
+
+# srock_common_vars ensures that SROCK_REPOS is created
+mkdir -p $SROCK_REPOS
+if [ ! -d $SROCK_REPOS ] ; then
+ echo
+ echo "ERROR: $0 could not create directory $SROCK_REPOS"
+ echo " Consider setting SROCK_REPOS to use a large fast fileystem."
+ echo " or $HOME/git/srock-repos"
+ echo
+ exit 1
+fi
+
+if [ -d $SROCK_THEROCK_DIR ] ; then
+ echo
+ echo "===== Updating existing TheRock clone in $SROCK_THEROCK_DIR"
+ echo " --- cd $SROCK_THEROCK_DIR/compiler/amd-llvm"
+ cd $SROCK_THEROCK_DIR/compiler/amd-llvm
+ echo " --- git checkout . (clean previous amd-llvm local patches)"
+ git checkout .
+ echo " --- cd $SROCK_THEROCK_DIR"
+ cd $SROCK_THEROCK_DIR
+ echo " --- git checkout . (clean TheRock repo for update and to be patched)"
+ git checkout .
+ echo " --- git checkout $SROCK_THEROCK_BRANCH"
+ git checkout $SROCK_THEROCK_BRANCH
+ echo " --- git pull"
+ git pull
+ echo " --- git submodule update --remote --recursive"
+ git submodule update --remote --recursive
+ echo " --- cd $SROCK_THEROCK_DIR/rocm-systems"
+ cd $SROCK_THEROCK_DIR/rocm-systems
+ echo " --- git submodule update (to pickup changes to external repos)"
+ git submodule update
+else
+ cd $SROCK_REPOS
+ echo
+ echo "===== git clone https://github.com/ROCm/TheRock.git -b $SROCK_THEROCK_BRANCH TheRock"
+ git clone https://github.com/ROCm/TheRock.git -b $SROCK_THEROCK_BRANCH TheRock
+fi
+
+cd $SROCK_THEROCK_DIR
+
+if [ ! -d $SROCK_THEROCK_DIR/.venv/bin ] ; then
+ echo
+ echo "===== Building virtual environment in .venv and updating PATH ====="
+ cd $SROCK_THEROCK_DIR
+ echo "python3 -m venv .venv && source .venv/bin/activate"
+ python3 -m venv .venv && source .venv/bin/activate
+ echo "pip install -r requirements.txt"
+ pip install -r requirements.txt
+fi
+export PATH=$SROCK_THEROCK_DIR/.venv/bin:$PATH
+
+echo
+echo "===== Running python ./build_tools/fetch_sources.py ====="
+python ./build_tools/fetch_sources.py
+echo "===== Done running python ./build_tools/fetch_sources.py"
+
+echo "cd $SROCK_THEROCK_DIR"
+cd "$SROCK_THEROCK_DIR" || exit
+[ -d build ] && echo "rm -rf build" && rm -rf build
+
+echo
+echo "===== Running build_tools/setup_ccache.py"
+eval "$(python3 ./build_tools/setup_ccache.py)"
+
+# Make updates to compiler submodules unless this is native TheRock build
+if [ "$SROCK_COMPILER_BRANCH" != "develop" ] ; then
+ # FIXME: Before wiping out current amd-staging changes,
+ # to save current changes in the patches directory.
+ # Otherwise, this is not a real development environment"
+ echo
+ echo "===== Switch to $SROCK_COMPILER_BRANCH branch for compiler components"
+ echo " --- cd $SROCK_THEROCK_DIR/compiler/hipify"
+ cd $SROCK_THEROCK_DIR/compiler/hipify
+ echo " --- git checkout ."
+ git checkout .
+ echo " --- git checkout $SROCK_COMPILER_BRANCH (WARNING: This may leave commits behind"
+ git checkout $SROCK_COMPILER_BRANCH
+ echo " --- git pull (gets most recent updates to $SROCK_COMPILER_BRANCH)"
+ git pull
+
+ echo " --- cd $SROCK_THEROCK_DIR/compiler/spirv-llvm-translator"
+ cd $SROCK_THEROCK_DIR/compiler/spirv-llvm-translator
+ echo " --- git checkout ."
+ git checkout .
+ echo " --- git checkout $SROCK_COMPILER_BRANCH"
+ git checkout $SROCK_COMPILER_BRANCH
+ echo " --- git pull (gets most recent updates to $SROCK_COMPILER_BRANCH)"
+ git pull
+
+ echo " --- cd $SROCK_THEROCK_DIR/compiler/amd-llvm"
+ cd $SROCK_THEROCK_DIR/compiler/amd-llvm
+ echo " --- git checkout ."
+ git checkout .
+ echo " --- git checkout $SROCK_COMPILER_BRANCH (WARNING: This leaves commits behind for amd-llvm)"
+ git checkout $SROCK_COMPILER_BRANCH
+ echo " --- git pull (gets most recent updates to $SROCK_COMPILER_BRANCH)"
+ git pull
+
+ if [ -d "$thisdir/patches/$SROCK_COMPILER_BRANCH" ] ; then
+ cd $SROCK_THEROCK_DIR
+ _patch_file=$thisdir/patches/$SROCK_COMPILER_BRANCH/_TheRock.patch
+ if [ -f "$_patch_file" ] ; then
+ test_apply_patch
+ fi
+ _tmpfile=/tmp/submod$$
+ git submodule > $_tmpfile
+ while read _line ; do
+ _subdir=`echo $_line | cut -d" " -f2`
+ cd $SROCK_THEROCK_DIR/$_subdir
+ _subdirname=`echo $_subdir | tr "/" "_"`
+ _patch_file=$thisdir/patches/$SROCK_COMPILER_BRANCH/$_subdirname.patch
+ if [ -f "$_patch_file" ] ; then
+ test_apply_patch
+ fi
+ done < $_tmpfile
+ rm $_tmpfile
+ fi
+echo " --- end compiler submodule updates for $SROCK_COMPILER_BRANCH"
+fi # END compiler submodule updates
+
+(
+cd $SROCK_THEROCK_DIR
+# reconstruct .amd-llvm.smrev using the current SHA
+cd compiler/amd-llvm || exit
+smrev="../.amd-llvm.smrev"
+git config --get remote.origin.url > "$smrev"
+smsha=$(git rev-parse HEAD)
+echo "${smsha}${LLVM_SHA_EXTRA}" >> "$smrev"
+)
+
+cd $SROCK_THEROCK_DIR
+echo
+echo "===== cmake CMD: $SROCK_CMAKE $_cmake_args"
+# shellcheck disable=SC2090
+$SROCK_CMAKE $_cmake_args
+_rc=$? && [ "$_rc" != 0 ] && cd "$_curdir" && exit "$_rc"
+# ------------ end of NOT restart mode ------------
+fi
+
+_prep_secs=$(date +%s)
+
+# restart mode starts here
+cd $SROCK_THEROCK_DIR
+_cmd="cmake --build build"
+echo
+echo "===== build CMD: $_cmd"
+$_cmd
+_rc=$? && [ "$_rc" != 0 ] && cd "$_curdir" && exit "$_rc"
+date
+
+# Usually nothing to do for therock-dist
+cd build || exit
+_cmd="ninja therock-dist"
+echo
+echo "===== dist CMD: $_cmd"
+$_cmd
+_rc=$? && [ "$_rc" != 0 ] && cd "$_curdir" && exit "$_rc"
+date
+
+echo
+echo "===== copying ROCm build from $SROCK_THEROCK_DIR/build/dest/rocm to $SROCK_INSTALL_DIR"
+# FIXME: instead of rsync --delete consider using artifact descriptors to copy files to installation
+cd "$SROCK_THEROCK_DIR/build" || exit
+echo "mkdir -p $SROCK_INSTALL_DIR"
+mkdir -p "$SROCK_INSTALL_DIR"
+echo "rsync -a$_rsync_v --delete dist/rocm/ $SROCK_INSTALL_DIR/"
+rsync -a$_rsync_v --delete dist/rocm/ "$SROCK_INSTALL_DIR"/
+# FileCheck binary not found in dist/rocm, so get it from amd-llvm build
+echo cp -p ./compiler/amd-llvm/build/bin/FileCheck "$SROCK_INSTALL_DIR/lib/llvm/bin/FileCheck"
+cp -p ./compiler/amd-llvm/build/bin/FileCheck "$SROCK_INSTALL_DIR/lib/llvm/bin/FileCheck"
+
+if [ ! -d ${SROCK_REPOS}/hipfort/build ] ; then
+ echo
+ echo "===== Sourcing build_hipfort.sh to build and install hipfort"
+ . $thisdir/build_hipfort.sh
+fi
+# FIXME: Add builds for rocdbgapi and rocgdb here
+
+echo
+echo "===== Creating compiler cfg files "
+amd_compiler_cfg=("clang" "clang++" "clang-cpp" "clang-${SROCK_MAJOR_VERSION}" "clang-cl" "flang")
+echo "--rocm-path='/../../..'" >"$SROCK_INSTALL_DIR"/lib/llvm/bin/rocm.cfg
+echo "-frtlib-add-rpath" >>"$SROCK_INSTALL_DIR"/lib/llvm/bin/rocm.cfg
+for ii in "${amd_compiler_cfg[@]}" ; do
+ if [ -f "${SROCK_INSTALL_DIR}/lib/llvm/bin/$ii" ] ; then
+ echo "Creating config file: ${ii}.cfg in ${SROCK_INSTALL_DIR}/lib/llvm//bin"
+ config_file="${SROCK_INSTALL_DIR}/lib/llvm/bin/${ii}.cfg"
+ echo "@rocm.cfg" > "$config_file"
+ fi
+done
+
+# Gather some build stats
+_end_date=$(date)
+_end_secs=$(date +%s)
+_secs_to_prep=$(( _prep_secs - _start_secs ))
+_secs_to_build=$(( _end_secs - _prep_secs ))
+_filecount=$(find "$SROCK_INSTALL_DIR" -type f | wc -l)
+_size=$(du -hs "$SROCK_INSTALL_DIR" | cut -f1)
+
+echo
+echo "===== Linking $SROCK_INSTALL_DIR to $SROCK_LINK"
+if [ -L "SROCK_LINK" ] ; then
+ rm "$SROCK_LINK"
+fi
+echo ln -sf "$SROCK_INSTALL_DIR" "$SROCK_LINK"
+ln -sf "$SROCK_INSTALL_DIR" "$SROCK_LINK"
+
+echo
+echo "===== DONE $0 on $_end_date"
+echo " THEROCK targets: $_gfxsemicolons"
+echo " ROCm install dir: $SROCK_INSTALL_DIR"
+echo " TheRock Dir: $SROCK_THEROCK_DIR"
+echo " TheRock branch: $SROCK_THEROCK_BRANCH"
+echo " Compiler branch: $SROCK_COMPILER_BRANCH"
+echo " Build Mode: $_build_srock_mode"
+echo " SROCK config name: $SROCK_CONFIG"
+echo " cmake command: $SROCK_CMAKE"
+echo " cmake args: $_cmake_args"
+echo " Data prep time: $_secs_to_prep (seconds)"
+echo " Build time: $_secs_to_build (seconds)"
+echo " Files: $_filecount"
+echo " Size: $_size"
+echo
+echo " For aomp testing, set AOMP=$SROCK_LINK"
+echo " or AOMP=$SROCK_INSTALL_DIR"
+echo
diff --git a/srock-bin/create_patch.sh b/srock-bin/create_patch.sh
new file mode 100755
index 0000000000..fc877d4388
--- /dev/null
+++ b/srock-bin/create_patch.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
+# tr_create_patch.sh : Build set of patches to TheRock including submodules
+#
+# --- Start standard header to set AOMP environment variables ----
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/srock_common_vars"
+# --- end standard header ----
+_patch_dir=$thisdir/patches/$SROCK_COMPILER_BRANCH
+echo " mkdir -p $_patch_dir"
+mkdir -p $_patch_dir
+cd $SROCK_THEROCK_DIR
+_patch_file=$_patch_dir/_TheRock.patch
+git diff --ignore-submodules . > $_patch_file
+[ ! -s "$_patch_file" ] && rm $_patch_file
+
+_tmpfile=/tmp/submod$$
+git submodule > $_tmpfile
+while read _line ; do
+ _subdir=`echo $_line | cut -d" " -f2`
+ cd $SROCK_THEROCK_DIR/$_subdir
+ _subdirname=`echo $_subdir | tr "/" "_"`
+ _patch_file=$_patch_dir/$_subdirname.patch
+ git diff . > $_patch_file
+ [ ! -s "$_patch_file" ] && rm $_patch_file
+done < $_tmpfile
+rm $_tmpfile
+echo "DONE $0"
diff --git a/srock-bin/patches/amd-staging/_TheRock.patch b/srock-bin/patches/amd-staging/_TheRock.patch
new file mode 100644
index 0000000000..92013f8c9b
--- /dev/null
+++ b/srock-bin/patches/amd-staging/_TheRock.patch
@@ -0,0 +1,101 @@
+diff --git a/compiler/CMakeLists.txt b/compiler/CMakeLists.txt
+index 9db31320..8552b77c 100644
+--- a/compiler/CMakeLists.txt
++++ b/compiler/CMakeLists.txt
+@@ -10,6 +10,10 @@ if(THEROCK_ENABLE_COMPILER)
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ list(APPEND _extra_llvm_cmake_args "-DLLVM_ENABLE_PEDANTIC=OFF")
+ endif()
++ if (DEFINED ENV{SROCK_VERSION_MOD})
++ list(APPEND _extra_llvm_cmake_args "-DLLVM_VERSION_SUFFIX=_SROCK")
++ list(APPEND _extra_llvm_cmake_args "-DLLVM_VERSION_PATCH=$ENV{SROCK_VERSION_MOD}")
++ endif()
+
+ # Building Flang is very memory-intensive on systems with many cores. Allow
+ # users to specify the level of concurrency for these tasks so they can
+@@ -71,6 +75,9 @@ if(THEROCK_ENABLE_COMPILER)
+
+ # Features
+ -DLLVM_INCLUDE_TESTS=${THEROCK_ENABLE_LLVM_TESTS}
++ -DLLVM_BUILD_TESTS=${THEROCK_ENABLE_LLVM_TESTS}
++ -DCLANG_INCLUDE_TESTS=${THEROCK_ENABLE_LLVM_TESTS}
++ -DLLVM_LIT_ARGS='-vv --show-unsupported --show-xfail -j 16'
+ -DLLVM_ENABLE_ZLIB=FORCE_ON
+ -DLLVM_ENABLE_Z3_SOLVER=OFF
+ -DLLVM_ENABLE_LIBXML2=OFF
+@@ -92,6 +99,9 @@ if(THEROCK_ENABLE_COMPILER)
+ -DCLANG_ENABLE_CLANGD=OFF
+ -DCLANG_TIDY_ENABLE_STATIC_ANALYZER=OFF
+
++ -DLIBOMP_USE_HWLOC=ON
++ -DROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_NEW=${CMAKE_CURRENT_BINARY_DIR}/lib/clang/${LLVM_VERSION_MAJOR}/lib/amdgcn
++
+ -DCLANG_TOOL_CLANG_LINKER_WRAPPER_BUILD=${THEROCK_CONDITION_IS_NON_WINDOWS}
+ -DCLANG_TOOL_OFFLOAD_ARCH_BUILD=${THEROCK_CONDITION_IS_NON_WINDOWS}
+ -DOPENMP_ENABLE_LIBOMPTARGET=${THEROCK_CONDITION_IS_NON_WINDOWS}
+diff --git a/compiler/artifact-amd-llvm.toml b/compiler/artifact-amd-llvm.toml
+index b0645ebe..54755ad2 100644
+--- a/compiler/artifact-amd-llvm.toml
++++ b/compiler/artifact-amd-llvm.toml
+@@ -7,6 +7,7 @@ unmatched_exclude = [
+ # Various docs or utilities we don't care about.
+ "lib/llvm/share/clang-doc/**",
+ "lib/llvm/share/clang/**",
++ "lib/llvm/lib/amdgcn-amd-amdhsa/**"
+ ]
+
+ # LLVM deviates from the defaults in some key ways:
+diff --git a/compiler/pre_hook_amd-llvm.cmake b/compiler/pre_hook_amd-llvm.cmake
+index 48aa6a8b..20ea73f1 100644
+--- a/compiler/pre_hook_amd-llvm.cmake
++++ b/compiler/pre_hook_amd-llvm.cmake
+@@ -121,9 +121,9 @@ set(LLVM_EXTERNAL_PROJECTS "rocm-device-libs;spirv-llvm-translator" CACHE STRING
+ # options to manage this transition but they require knowing the clange resource
+ # dir. In order to avoid drift, we just fixate that too. This can all be
+ # removed in a future version.
+-# set(CLANG_RESOURCE_DIR "../lib/clang/${LLVM_VERSION_MAJOR}" CACHE STRING "Resource dir" FORCE)
+-# set(ROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_NEW "lib/clang/${LLVM_VERSION_MAJOR}/amdgcn" CACHE STRING "New devicelibs loc" FORCE)
+-# set(ROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_OLD "amdgcn" CACHE STRING "Old devicelibs loc" FORCE)
++set(CLANG_RESOURCE_DIR "../lib/clang/${LLVM_VERSION_MAJOR}" CACHE STRING "Resource dir" FORCE)
++set(ROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_NEW "lib/clang/${LLVM_VERSION_MAJOR}/lib/amdgcn" CACHE STRING "New devicelibs loc" FORCE)
++set(ROCM_DEVICE_LIBS_BITCODE_INSTALL_LOC_OLD "amdgcn" CACHE STRING "Old devicelibs loc" FORCE)
+
+ # Setup the install rpath (let CMake handle build RPATH per usual):
+ # * Executables and libraries can always search their adjacent lib directory
+diff --git a/profiler/CMakeLists.txt b/profiler/CMakeLists.txt
+index 4b1f02ef..fef7efed 100644
+--- a/profiler/CMakeLists.txt
++++ b/profiler/CMakeLists.txt
+@@ -81,11 +81,16 @@ endif(THEROCK_BUILD_TESTING)
+ EXTERNAL_SOURCE_DIR "${THEROCK_ROCM_SYSTEMS_SOURCE_DIR}/projects/rocprofiler-sdk"
+ BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/rocprofiler-sdk"
+ BACKGROUND_BUILD
++ # INTERFACE_INCLUDE_DIRS not working as expected so add compiler flags
+ CMAKE_ARGS
++ -DCMAKE_CXX_FLAGS=-I${THEROCK_SOURCE_DIR}/build/dist/rocm/include
++ -DCMAKE_C_FLAGS=-I${THEROCK_SOURCE_DIR}/build/dist/rocm/include
+ -DHIP_PLATFORM=amd
+ -DROCPROFILER_PYTHON_VERSIONS:STRING="${_detected_python_versions_str}"
+ CMAKE_INCLUDES
+ therock_explicit_finders.cmake
++ INTERFACE_INCLUDE_DIRS
++ ${THEROCK_SOURCE_DIR}/build/dist/rocm/include
+ COMPILER_TOOLCHAIN
+ amd-hip
+ RUNTIME_DEPS
+@@ -160,11 +165,15 @@ endif(THEROCK_BUILD_TESTING)
+ # Must build with the HIP compiler.
+ amd-hip
+ CMAKE_ARGS
++ -DCMAKE_CXX_FLAGS=-I${THEROCK_SOURCE_DIR}/build/dist/rocm/include
++ -DCMAKE_C_FLAGS=-I${THEROCK_SOURCE_DIR}/build/dist/rocm/include
+ -DHIP_PLATFORM=amd
+ INTERFACE_INCLUDE_DIRS
+ # All old clients of roctx64 expect to just be able to find its include
+ # with no further qualification. Bad design, but also deprecated, so meh.
+ include
++ # to include hip/* stuff
++ ${THEROCK_SOURCE_DIR}/build/dist/rocm/include
+ INTERFACE_LINK_DIRS
+ # So that dependents can find the roctx library via find_library()
+ lib
diff --git a/srock-bin/patches/ninja-nprocs-v1.13.2.patch b/srock-bin/patches/ninja-nprocs-v1.13.2.patch
new file mode 100644
index 0000000000..342aaf57f6
--- /dev/null
+++ b/srock-bin/patches/ninja-nprocs-v1.13.2.patch
@@ -0,0 +1,85 @@
+diff --git a/src/ninja.cc b/src/ninja.cc
+index 92d0761..8e3e1b8 100644
+--- a/src/ninja.cc
++++ b/src/ninja.cc
+@@ -252,15 +252,40 @@ void Usage(const BuildConfig& config) {
+
+ /// Choose a default value for the -j (parallelism) flag.
+ int GuessParallelism() {
+- switch (int processors = GetProcessorCount()) {
++ int nprocs = GetProcessorCount();
++ switch (nprocs) {
+ case 0:
+ case 1:
+- return 2;
+ case 2:
+- return 3;
++ nprocs++;
++ break;
+ default:
+- return processors + 2;
++ nprocs += 2;
++ break;
+ }
++
++ const char * nprocs_str = getenv("NINJA_NPROCS");
++ if (!nprocs_str) return nprocs;
++
++ char * end;
++ auto nprocs_env = strtol(nprocs_str, &end, 10);
++
++ if (*end != 0 || nprocs_env <= 0) return nprocs;
++
++ return int(nprocs_env);
++}
++
++/// Returns verbosity mode from the environment variable
++int HasVerbose() {
++ const char * verbose_str = getenv("NINJA_VERBOSE");
++ if (!verbose_str) return 0;
++
++ char * end;
++ auto verbose = strtol(verbose_str, &end, 10);
++
++ if (*end != 0 || verbose <= 0) return 0;
++
++ return verbose > 0;
+ }
+
+ /// Rebuild the build manifest, if necessary.
+@@ -1781,6 +1806,9 @@ int ReadFlags(int* argc, char*** argv,
+ *argv += optind;
+ *argc -= optind;
+
++ if (HasVerbose())
++ config->verbosity = BuildConfig::VERBOSE;
++
+ return -1;
+ }
+
+diff --git a/src/status_printer.cc b/src/status_printer.cc
+index e69cd15..0b9d0f8 100644
+--- a/src/status_printer.cc
++++ b/src/status_printer.cc
+@@ -51,7 +51,7 @@ StatusPrinter::StatusPrinter(const BuildConfig& config)
+
+ progress_status_format_ = getenv("NINJA_STATUS");
+ if (!progress_status_format_)
+- progress_status_format_ = "[%f/%t] ";
++ progress_status_format_ = "[%es %p %rx %f/%t] ";
+ }
+
+ void StatusPrinter::EdgeAddedToPlan(const Edge* edge) {
+diff --git a/src/version.cc b/src/version.cc
+index b108660..8fbd82b 100644
+--- a/src/version.cc
++++ b/src/version.cc
+@@ -20,7 +20,7 @@
+
+ using namespace std;
+
+-const char* kNinjaVersion = "1.13.2";
++const char* kNinjaVersion = "1.13.2-mk";
+
+ void ParseVersion(const string& version, int* major, int* minor) {
+ size_t end = version.find('.');
diff --git a/srock-bin/prebuild_srock.sh b/srock-bin/prebuild_srock.sh
new file mode 100755
index 0000000000..c8b941aa23
--- /dev/null
+++ b/srock-bin/prebuild_srock.sh
@@ -0,0 +1,119 @@
+#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
+# prebuild_srock.sh: Source this file from build_srock.sh
+# update the srock repo
+# clone or update hipfort repo
+# clone or update rocdbgapi repo
+# clone or update rocgdb repo
+# builds cmake if necessary in ~/local/cmake using
+#
+# --- Start standard header to set SROCK environment variables ----
+realpath=$(realpath "$0")
+thisdir=$(dirname "$realpath")
+. "$thisdir/srock_common_vars"
+# --- end standard header ----
+
+echo "= 1 = Checking if suitable cmake is available"
+SROCK_CMAKE=`which cmake`
+_build_cmake=1
+_cmake_ver=`cmake --version 2>/dev/null | grep version | cut -d" " -f3`
+if [ "$_cmake_ver" != "" ] ; then
+ _cmake_major=${_cmake_ver%%.*}
+ _cmake_rel=`echo $_cmake_ver | cut -d"." -f2`
+ if [ $_cmake_major -ge 3 ] && [ $_cmake_rel -ge 25 ] ; then
+ # Default cmake is ok
+ echo " Default cmake is ok"
+ _build_cmake=0
+ fi
+fi
+# Check the local build of cmake
+_cmake_local=$HOME/local/cmake/bin/cmake
+if [ $_build_cmake == 1 ] && [ -f $_cmake_local ] ; then
+ _cmake_ver=`$_cmake_local --version 2>/dev/null | grep version | cut -d" " -f3`
+ _cmake_major=${_cmake_ver%%.*}
+ _cmake_rel=`echo $_cmake_ver | cut -d"." -f2`
+ if [ $_cmake_major -ge 3 ] && [ $_cmake_rel -ge 25 ] ; then
+ _build_cmake=0
+ export PATH=$HOME/local/cmake/bin:$PATH
+ echo " $_cmake_local cmake is ok"
+ SROCK_CMAKE=$_cmake_local
+ fi
+fi
+if [ $_build_cmake == 1 ] ; then
+ $thisdir/build_cmake.sh
+ export PATH=$HOME/local/cmake/bin:$PATH
+ SROCK_CMAKE=$_cmake_local
+fi
+echo " The cmake for srock is $SROCK_CMAKE"
+export SROCK_CMAKE
+
+# Skip these updates if this is a restart
+if [ "$_build_srock_mode" == "restart" ] ; then
+ return
+fi
+
+cd $SROCK_REPOS
+echo "= 2 = Updating aomp repo"
+if [ -d $SROCK_REPOS/aomp ] ; then
+ echo " Skipping aomp clone, $SROCK_REPOS/srock already exists"
+else
+ echo " git clone -b $SROCK_DEV_BRANCH https://github.com/ROCm/aomp"
+ git clone -b $SROCK_DEV_BRANCH https://github.com/ROCm/aomp 2>/dev/null >/dev/null
+fi
+echo " cd $SROCK_REPOS/aomp"
+cd $SROCK_REPOS/aomp
+echo " git checkout $SROCK_DEV_BRANCH"
+git checkout $SROCK_DEV_BRANCH
+echo " git pull"
+git pull
+
+cd $SROCK_REPOS
+echo "= 3 = Updating hipfort repo"
+if [ -d $SROCK_REPOS/hipfort ] ; then
+ echo " Skipping hipfort clone, $SROCK_REPOS/hipfort already exists"
+else
+ echo " git clone -b $SROCK_HIPFORT_BRANCH https://github.com/ROCm/hipfort"
+ git clone -b $SROCK_HIPFORT_BRANCH https://github.com/ROCm/hipfort 2>/dev/null >/dev/null
+fi
+echo " cd $SROCK_REPOS/hipfort"
+cd $SROCK_REPOS/hipfort
+echo " git checkout $SROCK_HIPFORT_BRANCH"
+git checkout $SROCK_HIPFORT_BRANCH
+echo " git pull"
+git pull
+
+cd $SROCK_REPOS
+echo "= 4 = Cloning or updating rocgdb repo"
+if [ -d $SROCK_REPOS/rocgdb ] ; then
+ echo " Skipping rocgdb clone, $SROCK_REPOS/rocgdb already exists"
+else
+ echo " git clone -b $SROCK_ROCGDB_BRANCH https://github.com/ROCm/rocgdb"
+ git clone -b $SROCK_ROCGDB_BRANCH https://github.com/ROCm/rocgdb 2>/dev/null >/dev/null
+fi
+echo " cd $SROCK_REPOS/rocgdb"
+cd $SROCK_REPOS/rocgdb
+echo " git checkout $SROCK_ROCGDB_BRANCH"
+git checkout $SROCK_ROCGDB_BRANCH
+echo " git pull"
+git pull
+
+cd $SROCK_REPOS
+echo "= 5 = Cloning or updating rocdbgapi repo"
+if [ -d $SROCK_REPOS/rocdbgapi ] ; then
+ echo " Skipping rocdbgapi clone, $SROCK_REPOS/rocdbgapi already exists"
+else
+ echo " git clone -b $SROCK_ROCDBGAPI_BRANCH https://github.com/ROCm/rocdbgapi"
+ git clone -b $SROCK_ROCDBGAPI_BRANCH https://github.com/ROCm/rocdbgapi 2>/dev/null >/dev/null
+fi
+echo " cd $SROCK_REPOS/rocdbgapi"
+cd $SROCK_REPOS/rocdbgapi
+echo " git checkout $SROCK_ROCDBGAPI_BRANCH"
+git checkout $SROCK_ROCGDBGAPI_BRANCH
+echo " git pull"
+git pull
+
+
diff --git a/srock-bin/srock_common_vars b/srock-bin/srock_common_vars
new file mode 100644
index 0000000000..05e7be6d1e
--- /dev/null
+++ b/srock-bin/srock_common_vars
@@ -0,0 +1,87 @@
+#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
+# srock_common_vars: This file is sourced by srock scripts to set
+# set common SROCK environment variables.
+#
+# The bash syntax ENVNAME=${ENVNAME:-value} checks if ENVNAME is
+# already set. If not, it assigns it the value following the :-
+# So, if you preset any SROCK env vars such as in .bashrc,
+# you override the default specified here. Most importantly,
+# You should set SROCK_REPOS to an updateable high performance and
+# large capacity (100GB+) directory 100GB+
+
+SROCK="NEVER_USE_'\$SROCK'_ENV_VARIABLE" # Use SROCK_LINK
+
+# SROCK_REPOS is the parent directory for TheRock and srock repos.
+SROCK_REPOS=${SROCK_REPOS:-/work/$USER/git/srock-repos}
+if [ ! -d $SROCK_REPOS ] ; then
+ mkdir -p $SROCK_REPOS
+ [ $? != 0 ] && echo "ERROR: Could not create $SROCK_REPOS" && exit 1
+fi
+
+SROCK_VERSION=${SROCK_VERSION:-"23.0"}
+SROCK_VERSION_MOD=${SROCK_VERSION_MOD:-"0"}
+SROCK_VERSION_STRING=${SROCK_VERSION_STRING:-"$SROCK_VERSION-$SROCK_VERSION_MOD"}
+SROCK_MAJOR_VERSION=${SROCK_VERSION%.*}
+
+# Set SROCK_COMPILER_BRANCH to develop to get a native TheRock build
+SROCK_COMPILER_BRANCH=${SROCK_COMPILER_BRANCH:-amd-staging}
+SROCK_THEROCK_BRANCH=${SROCK_THEROCK_BRANCH:-compiler/amd-staging}
+SROCK_CONFIG=${SROCK_CONFIG:-minimal}
+
+# Set default value for ROCm install directory SROCK_INSTALL_DIR.
+# Unlike aomp, which installs each component after build, build_srock.sh
+# will install into $SROCK_INSTALL_DIR only after a fully successful
+# build of all TheRock configured components. It will then create
+# a symbolic link from $SROCK to the versioned name $SROCK_INSTALL_DIR.
+SROCK_LINK=${SROCK_LINK:-$HOME/rocm/srock}
+SROCK_INSTALL_DIR=${SROCK_LINK}_${SROCK_VERSION_STRING}
+
+SROCK_THEROCK_DIR=$SROCK_REPOS/TheRock
+
+export SROCK_REPOS SROCK_VERSION_STRING SROCK_VERSION SROCK_VERSION_MOD SROCK_MAJOR_VERSION SROCK_LINK SROCK_INSTALL_DIR SROCK_THEROCK_DIR
+
+SROCK_REPO_NAME=${SROCK_REPO_NAME:-aomp}
+# These local variables are only used during build to log important information.
+SROCK_VERSION_INFO_DIR=$SROCK_REPOS/$SROCK_REPO_NAME/srock-bin/srock_$SROCK_VERSION_STRING
+SROCK_INFO_FILE=$SROCK_VERSION_INFO_DIR/srock_$SROCK_VERSION_STRING.info
+SROCK_SUBMOD_FILE=$SROCK_VERSION_INFO_DIR/srock_$SROCK_VERSION_STRING.submodules
+
+# SROCK_SUPP is for SUPPlemental software components needed for testing.
+# such as openmpi, hdf5, and silo. Applications that need supplemental
+# components can get the latest version with $SROCK_SUPP/
+SROCK_SUPP=${SROCK_SUPP:-$HOME/local}
+# SROCK_SUPP_BUILD could be a temp directory but defaults to $SROCK_SUPP/build
+SROCK_SUPP_BUILD=${SROCK_SUPP_BUILD:-$SROCK_SUPP/build}
+# SROCK_SUPP_INSTALL must be permanent directory.
+SROCK_SUPP_INSTALL=${SROCK_SUPP_INSTALL:-$SROCK_SUPP/install}
+export SROCK_SUPP SROCK_SUPP_BUILD SROCK_SUPP_INSTALL
+export PATH=$SROCK_SUPP/cmake/bin:$SROCK_SUPP/ninja/bin:$PATH
+
+# Specify target GFXLIST/GFXFAM
+# gfx not currently supported by TheRock:
+# gfx900 gfx902 gfx90c gfx1031 gfx1052 gfx1053
+# gfx9-generic gfx9-4-generic gfx10-1-generic gfx10-3-generic gfx11-generic gfx12-generic
+GFXLIST=${GFXLIST:-"gfx906 gfx908 gfx90a gfx942 gfx950 gfx1010 gfx1011 gfx1012 gfx1030 gfx1032 gfx1035 gfx1036 gfx1100 gfx1101 gfx1102 gfx1103 gfx1150 gfx1151 gfx1200 gfx1201"}
+export GFXLIST
+GFXFAM=${GFXFAM:-"dcgpu-all dgpu-all igpu-all"}
+export GFXFAM
+
+# Calculate the number of threads to use for make
+COMP_THREADS=1
+if [ "$(which getconf)" ] && [ "$(which bc)" ]; then
+ COMP_THREADS=$(getconf _NPROCESSORS_ONLN)
+ COMP_THREADS=$(echo "$COMP_THREADS/2.5" | bc)
+fi
+SROCK_JOB_THREADS=${SROCK_JOB_THREADS:-$COMP_THREADS}
+NINJA_NPROCS=${NINJA_NPROCS:-$SROCK_JOB_THREADS}
+export SROCK_JOB_THREADS NINJA_NPROCS
+
+SROCK_DEV_BRANCH=${SROCK_DEV_BRANCH:-aomp-dev}
+SROCK_HIPFORT_BRANCH=${SROCK_HIPFORT_BRANCH:-release/rocm-rel-7.0}
+SROCK_ROCGDB_BRANCH=${SROCK_ROCGDB_BRANCH:-release/rocm-rel-7.0}
+SROCK_ROCDBGAPI_BRANCH=${SROCK_ROCDBGAPI_BRANCH:-release/rocm-rel-7.0}
diff --git a/test/Makefile.defs b/test/Makefile.defs
index c4b2711c84..35d5dcbf9d 100644
--- a/test/Makefile.defs
+++ b/test/Makefile.defs
@@ -1,5 +1,6 @@
SHELL=/bin/bash -o pipefail
+TESTS_DIR=$(shell find . -maxdepth 1 -name \* -type d -and -not -name . | sort)
# Set the value of SKIP_USM to 1 if the system is a VM, else sets SKIP_USM to 0.
# a system is considered a VM if it has the HyperV or VMWare names present in
@@ -67,6 +68,12 @@ ifeq ("$(wildcard $(AOMP)/bin/clang)","")
endif
# --- End Standard Makefile check for AOMP installation ---
+CLANG_HOST_TARGET=$(shell $(AOMP)/bin/clang --version | grep Target: | cut -d" " -f2)
+
+ifeq ($(CLANG_HOST_TARGET),)
+ $(error Error Could not determine LLVM_TARGET_TRIPLE from $(AOMP)/lib/cmake/llvm/LLVMConfig.cmake)
+endif
+
ifneq ($(TIMEOUT),)
TKILL= timeout $(TIMEOUT)
endif
@@ -94,17 +101,19 @@ else
AOMPHIP = $(AOMP)/../..
endif
endif
-
-# Look for FileCheck on the system in various places.
-# Check local AOMP install first.
-FILECHECK=$(AOMP)/bin/FileCheck
-FILECHECK_RT=$(shell ls $(FILECHECK) 2>/dev/null || echo error)
-ifeq ($(FILECHECK_RT),error)
-TESTPACKAGE_BINDIR=$(shell find $(HOME)/tmp/openmp-extras -type f -name 'aomp_common_vars' | xargs dirname)
-FILECHECK=$(TESTPACKAGE_BINDIR)/FileCheck
+# look file pip installed filecheck first
+FILECHECK?=/home/$(USER)/.local/bin/filecheck
FILECHECK_RT=$(shell ls $(FILECHECK) 2>/dev/null || echo error)
-endif
ifeq ($(FILECHECK_RT),error)
+# Look for FileCheck on the system in various places.
+# Check local AOMP install first.
+ FILECHECK=$(AOMP)/bin/FileCheck
+ FILECHECK_RT=$(shell ls $(FILECHECK) 2>/dev/null || echo error)
+ ifeq ($(FILECHECK_RT),error)
+ FILECHECK=$(HOME)/openmp-utils/bin/FileCheck
+ FILECHECK_RT=$(shell ls $(FILECHECK) 2>/dev/null || echo error)
+ endif
+ ifeq ($(FILECHECK_RT),error)
# Check default AOMP release location.
FILECHECK=/usr/lib/aomp/bin/FileCheck
FILECHECK_RT=$(shell ls $(FILECHECK) 2> /dev/null || echo error)
@@ -136,7 +145,9 @@ ifeq ($(FILECHECK_RT),error)
endif
endif
endif
+ endif
endif
+#$(warning ----INFO---- FileCheck found at $(FILECHECK))
OMPIDIR ?= ~/local/openmpi
@@ -346,6 +357,13 @@ ifeq ($(TEMPS),1)
VERBOSE += -save-temps
endif
+IMPLICIT_GPU_FLANG_RT ?= 1
+ifeq ($(IMPLICIT_GPU_FLANG_RT),1)
+ FLANG_GPU_LINK_FLAGS =
+else
+ FLANG_GPU_LINK_FLAGS = -fno-gpu-flang-rt -lflang_rt.hostdevice
+endif
+
ifeq ($(NOOPT),1)
CFLAGS =
else
@@ -368,8 +386,12 @@ else
RUNENV = env $(SET_DEVICE_DEBUG) $(TKILL) $(CBL_ENV)
endif
-# Header include path + linker flag for libomptest based OMPT tests
-OMPTEST = -I$(AOMP)/lib/omptest/include -lomptest
+# ompTest: Set header include path + linker flag for corresponding OMPT tests
+OMPTEST = -I$(AOMP)/include/omptest -lomptest
+
+# ompTest: Set and export CMake config path
+omptest_DIR = $(AOMP)/lib/cmake/openmp/omptest/
+export omptest_DIR
# Individual tests need to set OVERFLOW_GUARD=1 to enable available memory
# computation at the runtime and passing it to the test as the first argument.
diff --git a/test/omp5/Makefile b/test/omp5/Makefile
index fd968ab22b..1a0e24d00b 100644
--- a/test/omp5/Makefile
+++ b/test/omp5/Makefile
@@ -1,20 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- concur_update \
- declare_variant \
- declare_target_nested \
- loop \
- mapper_prob \
- nestedSIMD \
- noncontig \
- prag_error \
- reduc_map_prob \
- red_bug_51 \
- reduc_map_prob \
- rush_larsen \
- shape_noncontig
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/run_test_suite.sh b/test/run_test_suite.sh
index e7ad9a0ec8..fa3ac36226 100755
--- a/test/run_test_suite.sh
+++ b/test/run_test_suite.sh
@@ -16,14 +16,14 @@
DISABLED_LIST="raja omptests"
# Available Suites - Qmcpack will timeout at 20 minutes
-SUITE_LIST=${SUITE_LIST:-"ovo examples smoke hipopenmp omp5 openmpapps nekbone sollve llnl openlibm qmcpack"}
+SUITE_LIST=${SUITE_LIST:-"ovo examples smoke smokefails smokelimbo hipopenmp omp5 openmpapps nekbone sollve llnl openlibm qmcpack"}
#Groups
GROUP_LIST="epsdb"
EPSDB_LIST=${EPSDB_LIST:-"examples smoke hipopenmp omp5 openmpapps nekbone sollve"}
# Set up variables
-AOMP_REPOS=${AOMP_REPOS:-"$HOME/git/aomp21.0"}
+AOMP_REPOS=${AOMP_REPOS:-"$HOME/git/aomp22.0"}
AOMP_SRC=${AOMP_SRC:-$AOMP_REPOS/aomp}
AOMP_BIN=${AOMP_BIN:-$AOMP_SRC/bin}
AOMP_REPOS_TEST=${AOMP_REPOS_TEST:-"$HOME/git/aomp-test"}
@@ -153,7 +153,7 @@ function smoke(){
}
function smokefails(){
- # -----Run Smoke-----
+ # -----Run Smoke Fails-----
header SMOKEFAILS
cd $AOMP_SRC/test/smoke-fails > /dev/null
echo "Log file at: $log_dir/smoke-fails.log"
@@ -161,6 +161,15 @@ function smokefails(){
update_logs bin check_smoke_fails.sh gatherdata
}
+function smokelimbo(){
+ # -----Run Smoke Limbo-----
+ header SMOKELIMBO
+ cd $AOMP_SRC/test/smoke-limbo > /dev/null
+ echo "Log file at: $log_dir/smoke-limbo.log"
+ AOMP_PARALLEL_SMOKE=1 ./check_smoke_limbo.sh > $log_dir/smoke-limbo.log 2>&1
+ update_logs bin check_smoke_limbo.sh gatherdata
+}
+
function hipopenmp(){
# -----Run Hip-openmp-----
header HIP-OPENMP
diff --git a/test/smoke-asan/Makefile b/test/smoke-asan/Makefile
index 6a38928694..664c3e618f 100644
--- a/test/smoke-asan/Makefile
+++ b/test/smoke-asan/Makefile
@@ -1,27 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- hip-gbo \
- hip-hbo \
- hip-uaf \
- hip-device-malloc-hbo \
- hip-device-free-uaf \
- hip-static-direct-lbo \
- hip-dynamic-direct-lbo \
- hip-static-indirect-lbo \
- hip-dynamic-indirect-lbo \
- hip-function-parameters-lbo \
- omp-gbo \
- omp-hbo \
- omp-uaf \
- omp-device-malloc-hbo \
- omp-device-free-uaf \
- omp-static-direct-lbo \
- omp-dynamic-direct-lbo \
- omp-static-indirect-lbo \
- omp-dynamic-indirect-lbo \
- omp-function-parameters-lbo
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/smoke-asan/hip-gbo/hip-gbo.cpp b/test/smoke-asan/hip-gbo/hip-gbo.cpp
index 23adcbd79c..3059aaf958 100644
--- a/test/smoke-asan/hip-gbo/hip-gbo.cpp
+++ b/test/smoke-asan/hip-gbo/hip-gbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#define __HIP_PLATFORM_AMD__ 1
#include
diff --git a/test/smoke-asan/hip-hbo/hip-hbo.cpp b/test/smoke-asan/hip-hbo/hip-hbo.cpp
index 625cb59355..e5b8c7348a 100644
--- a/test/smoke-asan/hip-hbo/hip-hbo.cpp
+++ b/test/smoke-asan/hip-hbo/hip-hbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#define __HIP_PLATFORM_AMD__ 1
#include
diff --git a/test/smoke-asan/hip-managed-hbo/Makefile b/test/smoke-asan/hip-managed-hbo/Makefile
new file mode 100644
index 0000000000..226c76e2f6
--- /dev/null
+++ b/test/smoke-asan/hip-managed-hbo/Makefile
@@ -0,0 +1,30 @@
+include ../../Makefile.defs
+
+TESTNAME = hip-managed-hbo
+TESTSRC_MAIN = hip-managed-hbo.cpp
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+VERS = $(shell $(AOMP)/bin/clang --version | grep -oP '(?<=clang version )[0-9]+')
+ifeq ($(shell expr $(VERS) \>= 12.0), 1)
+ RPTH = -Wl,-rpath,$(AOMPHIP)/lib/asan
+ LLIB = -L$(AOMPHIP)/lib/asan
+endif
+
+CFLAGS = -x hip -std=c++11 $(LLIB) -lamdhip64 $(RPTH)
+
+HSA_XNACK ?= 1
+RUNENV += HSA_XNACK=$(HSA_XNACK)
+
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) --strict-whitespace --match-full-lines $(TESTSRC_MAIN)
+
+CLANG ?= clang++
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+
+SUPPORTED = gfx908:xnack+,gfx90a:xnack+,gfx940:xnack+,gfx941:xnack+,gfx942:xnack+
+
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-asan/hip-managed-hbo/hip-managed-hbo.cpp b/test/smoke-asan/hip-managed-hbo/hip-managed-hbo.cpp
new file mode 100644
index 0000000000..7dfcd07181
--- /dev/null
+++ b/test/smoke-asan/hip-managed-hbo/hip-managed-hbo.cpp
@@ -0,0 +1,41 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
+#define __HIP_PLATFORM_AMD__ 1
+#include
+
+void printHipError(hipError_t error) {
+ printf("Hip Error: %s\n", hipGetErrorString(error));
+}
+
+bool hipCallSuccessfull(hipError_t error) {
+ if (error != hipSuccess)
+ printHipError(error);
+ return error == hipSuccess;
+}
+
+__global__ void TestKernel(int n, int *ptr) {
+ int index = blockDim.x * blockIdx.x + threadIdx.x;
+ if (index < n) {
+ ptr[index + 1] = 2 * (index + 1);
+ }
+}
+
+int main(int argc, char *argv[]) {
+ int N = 100;
+ size_t NBytes = N * sizeof(int);
+ int *D_Ptr;
+ int NumOfThreadBlocks = (N + 64 - 1) / 64;
+ int ThreadBlockSize = 64;
+ hipCallSuccessfull(hipMallocManaged(&D_Ptr, NBytes));
+ hipLaunchKernelGGL(TestKernel, dim3(NumOfThreadBlocks), dim3(ThreadBlockSize),
+ 0, 0, N, D_Ptr);
+ hipCallSuccessfull(hipFree(D_Ptr));
+ return 0;
+}
+
+/// CHECK:=================================================================
+/// CHECK-NEXT:=={{[0-9]+}}==ERROR: AddressSanitizer: heap-buffer-overflow on amdgpu device 0 at pc [[PC:.*]]
+/// CHECK-NEXT:WRITE of size 4 in workgroup id ({{[0-9]+}},0,0)
+/// CHECK-NEXT: #0 [[PC]] in TestKernel(int, int*) at {{.*}}aomp/test/smoke-asan/hip-managed-hbo/hip-managed-hbo.cpp:17:{{[0-9]+}}
diff --git a/test/smoke-asan/hip-managed-uaf/Makefile b/test/smoke-asan/hip-managed-uaf/Makefile
new file mode 100644
index 0000000000..33407d0d04
--- /dev/null
+++ b/test/smoke-asan/hip-managed-uaf/Makefile
@@ -0,0 +1,30 @@
+include ../../Makefile.defs
+
+TESTNAME = hip-managed-uaf
+TESTSRC_MAIN = hip-managed-uaf.cpp
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+VERS = $(shell $(AOMP)/bin/clang --version | grep -oP '(?<=clang version )[0-9]+')
+ifeq ($(shell expr $(VERS) \>= 12.0), 1)
+ RPTH = -Wl,-rpath,$(AOMPHIP)/lib/asan
+ LLIB = -L$(AOMPHIP)/lib/asan
+endif
+
+CFLAGS = -x hip -std=c++11 $(LLIB) -lamdhip64 $(RPTH)
+
+HSA_XNACK ?= 1
+RUNENV += HSA_XNACK=$(HSA_XNACK)
+
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) --strict-whitespace --match-full-lines $(TESTSRC_MAIN)
+
+CLANG ?= clang++
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+
+SUPPORTED = gfx908:xnack+,gfx90a:xnack+,gfx940:xnack+,gfx941:xnack+,gfx942:xnack+
+
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-asan/hip-managed-uaf/hip-managed-uaf.cpp b/test/smoke-asan/hip-managed-uaf/hip-managed-uaf.cpp
new file mode 100644
index 0000000000..92fac67407
--- /dev/null
+++ b/test/smoke-asan/hip-managed-uaf/hip-managed-uaf.cpp
@@ -0,0 +1,41 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
+#define __HIP_PLATFORM_AMD__ 1
+#include
+
+void printHipError(hipError_t error) {
+ printf("Hip Error: %s\n", hipGetErrorString(error));
+}
+
+bool hipCallSuccessfull(hipError_t error) {
+ if (error != hipSuccess)
+ printHipError(error);
+ return error == hipSuccess;
+}
+
+__global__ void TestKernel(int n, int *ptr) {
+ int index = blockDim.x * blockIdx.x + threadIdx.x;
+ if (index < n) {
+ ptr[index] = 2 * (index + 1);
+ }
+}
+
+int main(int argc, char *argv[]) {
+ int N = 100;
+ size_t NBytes = N * sizeof(int);
+ int *D_Ptr;
+ int NumOfThreadBlocks = (N + 64 - 1) / 64;
+ int ThreadBlockSize = 64;
+ hipCallSuccessfull(hipMallocManaged(&D_Ptr, NBytes));
+ hipCallSuccessfull(hipFree(D_Ptr));
+ hipLaunchKernelGGL(TestKernel, dim3(NumOfThreadBlocks), dim3(ThreadBlockSize),
+ 0, 0, N, D_Ptr);
+ return 0;
+}
+
+/// CHECK:=================================================================
+/// CHECK-NEXT:=={{[0-9]+}}==ERROR: AddressSanitizer: heap-use-after-free on amdgpu device 0 at pc [[PC:.*]]
+/// CHECK-NEXT:WRITE of size 4 in workgroup id ({{[0-9]+}},0,0)
+/// CHECK-NEXT: #0 [[PC]] in TestKernel(int, int*) at {{.*}}aomp/test/smoke-asan/hip-managed-uaf/hip-managed-uaf.cpp:17:{{[0-9]+}}
diff --git a/test/smoke-asan/hip-uaf/hip-uaf.cpp b/test/smoke-asan/hip-uaf/hip-uaf.cpp
index 8324ab4785..4f9ce0d2b8 100644
--- a/test/smoke-asan/hip-uaf/hip-uaf.cpp
+++ b/test/smoke-asan/hip-uaf/hip-uaf.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#define __HIP_PLATFORM_AMD__ 1
#include
diff --git a/test/smoke-asan/omp-device-free-uaf/omp-device-free-uaf.cpp b/test/smoke-asan/omp-device-free-uaf/omp-device-free-uaf.cpp
index c00a3b02b1..af33819760 100644
--- a/test/smoke-asan/omp-device-free-uaf/omp-device-free-uaf.cpp
+++ b/test/smoke-asan/omp-device-free-uaf/omp-device-free-uaf.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
int main(int argc, char *argv[]) {
diff --git a/test/smoke-asan/omp-device-malloc-hbo/omp-device-malloc-hbo.cpp b/test/smoke-asan/omp-device-malloc-hbo/omp-device-malloc-hbo.cpp
index b0792efea6..e53d59fbaf 100644
--- a/test/smoke-asan/omp-device-malloc-hbo/omp-device-malloc-hbo.cpp
+++ b/test/smoke-asan/omp-device-malloc-hbo/omp-device-malloc-hbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
int main(int argc, char *argv[]) {
diff --git a/test/smoke-asan/omp-dynamic-direct-lbo/omp-dynamic-direct-lbo.cpp b/test/smoke-asan/omp-dynamic-direct-lbo/omp-dynamic-direct-lbo.cpp
index 146eb89fa7..19fab6bdfc 100644
--- a/test/smoke-asan/omp-dynamic-direct-lbo/omp-dynamic-direct-lbo.cpp
+++ b/test/smoke-asan/omp-dynamic-direct-lbo/omp-dynamic-direct-lbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#define LDS_ATTR __attribute__((address_space(3)))
diff --git a/test/smoke-asan/omp-dynamic-indirect-lbo/omp-dynamic-indirect-lbo.cpp b/test/smoke-asan/omp-dynamic-indirect-lbo/omp-dynamic-indirect-lbo.cpp
index 1e06d00d8e..1ee7d6929a 100644
--- a/test/smoke-asan/omp-dynamic-indirect-lbo/omp-dynamic-indirect-lbo.cpp
+++ b/test/smoke-asan/omp-dynamic-indirect-lbo/omp-dynamic-indirect-lbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#define LDS_ATTR volatile __attribute__((address_space(3)))
diff --git a/test/smoke-asan/omp-function-parameters-lbo/omp-function-parameters-lbo.cpp b/test/smoke-asan/omp-function-parameters-lbo/omp-function-parameters-lbo.cpp
index 9af33096e4..e3723c9518 100644
--- a/test/smoke-asan/omp-function-parameters-lbo/omp-function-parameters-lbo.cpp
+++ b/test/smoke-asan/omp-function-parameters-lbo/omp-function-parameters-lbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#define LDS_ATTR volatile __attribute__((address_space(3)))
diff --git a/test/smoke-asan/omp-gbo/omp-gbo.cpp b/test/smoke-asan/omp-gbo/omp-gbo.cpp
index bb96f742ea..1fb8d79073 100644
--- a/test/smoke-asan/omp-gbo/omp-gbo.cpp
+++ b/test/smoke-asan/omp-gbo/omp-gbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#define N 100
diff --git a/test/smoke-asan/omp-hbo/omp-hbo.cpp b/test/smoke-asan/omp-hbo/omp-hbo.cpp
index d55b81e0aa..9939673af0 100644
--- a/test/smoke-asan/omp-hbo/omp-hbo.cpp
+++ b/test/smoke-asan/omp-hbo/omp-hbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
int main(int argc, char *argv[]) {
diff --git a/test/smoke-asan/omp-static-direct-lbo/omp-static-direct-lbo.cpp b/test/smoke-asan/omp-static-direct-lbo/omp-static-direct-lbo.cpp
index 95cdd365fa..7f4b0c709f 100644
--- a/test/smoke-asan/omp-static-direct-lbo/omp-static-direct-lbo.cpp
+++ b/test/smoke-asan/omp-static-direct-lbo/omp-static-direct-lbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#define LDS_ATTR volatile __attribute__((address_space(3)))
diff --git a/test/smoke-asan/omp-static-indirect-lbo/omp-static-indirect-lbo.cpp b/test/smoke-asan/omp-static-indirect-lbo/omp-static-indirect-lbo.cpp
index da35374f88..76dbbe350a 100644
--- a/test/smoke-asan/omp-static-indirect-lbo/omp-static-indirect-lbo.cpp
+++ b/test/smoke-asan/omp-static-indirect-lbo/omp-static-indirect-lbo.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#define LDS_ATTR volatile __attribute__((address_space(3)))
diff --git a/test/smoke-asan/omp-uaf/omp-uaf.cpp b/test/smoke-asan/omp-uaf/omp-uaf.cpp
index c0a31e13ff..765e7e9f34 100644
--- a/test/smoke-asan/omp-uaf/omp-uaf.cpp
+++ b/test/smoke-asan/omp-uaf/omp-uaf.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
int main(int argc, char *argv[]) {
diff --git a/test/smoke-dev/Makefile b/test/smoke-dev/Makefile
index 19a6532e38..c353bf7252 100644
--- a/test/smoke-dev/Makefile
+++ b/test/smoke-dev/Makefile
@@ -1,66 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- aomp_mappings_newrt \
- check-xnack \
- clang-ifaces \
- fast_fp_atomics_mi200_default_usm_map \
- fast_fp_atomics_mi200_enable_corase_grain_usm_map \
- fast_fp_atomics_mi200_not_enable_corase_grain_usm_map \
- flang-280342 \
- flang_deviceio \
- flang-f90print \
- flang-host-targ \
- flang-loop0 \
- flang-TL-0 \
- flang-TL-1 \
- flang-TP-0 \
- flang-TP-1 \
- global-usm-fort \
- gpurun-l-m \
- hipreg_usm \
- launch_latency \
- lib-debug \
- mix_hipmemset_omp \
- occupancy-based-opt \
- occupancy-based-opt-big-jump-loop \
- occupancy-based-opt-xteam-reduction \
- omp_lock \
- red_bug_51 \
- reduction_team \
- reduction_teams \
- rt-tuning-envar \
- snap_red \
- swdev-461650 \
- test-offload-profile-envar \
- usm-locals-pragma-xnack-disabled-xnack-any \
- usm-locals-pragma-xnack-disabled-xnack-minus \
- veccopy-ompt-target-emi-tracing-dag \
- vmulsum-hsa-stats \
- xteam-red-4 \
- xteam-red-callee \
- xteam-red-callee-default-option \
- xteam-red-callee-ptr \
- xteam-red-cmdline-default-option \
- xteam-red-collapse \
- xteam-red-collapse-default-option \
- xteam-red-default-option-1 \
- xteam-red-default-option-1-g \
- xteam-red-fast-default-option \
- xteam-red-incr \
- xteam-red-incr-default-option \
- xteam-red-sched-default-option \
- xteam-red-small-precision \
- xteam-red-split-collapse-default-option \
- xteam-red-split-default-option-1 \
- xteam-red-split-default-option-2 \
- xteam-red-teams-default-option \
- xteam-red-threads-default-option \
- xteam-scan-1 \
- xteam-scan-no-loop \
- zero-copy-xnack-enable-dgpu-map-disable-apu \
- zero-copy-xnack-enable-dgpu-map-enable-apu
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/smoke-dev/Makefile.rules b/test/smoke-dev/Makefile.rules
deleted file mode 100644
index c00ca2955b..0000000000
--- a/test/smoke-dev/Makefile.rules
+++ /dev/null
@@ -1,320 +0,0 @@
-ifeq ($(TESTSRC_ALL),)
- $(info WARNING: TESTSRC_ALL is empty)
-endif
-TESTNAMES_ALL = $(basename $(TESTSRC_ALL))
-TIMEOUT ?= 60s
-SMOKE_TIMEOUT ?= timeout --foreground $(TIMEOUT)
-CHECK_COMMAND ?= $(or $(RUNCMD), ./$(TESTNAME) $(ARGS))
-
-SKIP_COMPILE_SUPPORTED = Skipped compiling $(TESTNAME) for $(GPU_W_FEATURES) (supported only on $(SUPPORTED))
-SKIP_COMPILE_UNSUPPORTED = Skipped compiling $(TESTNAME): not supported on $(UNSUPPORTED)
-SKIP_RUN_SUPPORTED = Skipped running $(TESTNAME) on $(GPU_W_FEATURES) (supported only on $(SUPPORTED))
-SKIP_RUN_UNSUPPORTED = Skipped running $(TESTNAME): not supported on $(UNSUPPORTED)
-
-all: $(TESTNAME)
-
-.PRECIOUS: %.o %.ll %.ll.s %.s %.s.o
-
-.PHONY: prerequisites
-
-ifneq ($(SCRIPT_INIT),)
-prerequisites:
- @echo "<<< $(SCRIPT_INIT) <<<"
- . ./$(SCRIPT_INIT)
- @echo ">>> $(SCRIPT_INIT) >>>"
-endif
-
-# ----- If SUPPORTED is empty then it means that there is no
-# restriction for the test and the test can be compiled and run
-# on the current GPU architecture.
-ifeq ($(AOMP_TARGET_FEATURES),)
-GPU_W_FEATURES = $(AOMP_GPU)
-else
-GPU_W_FEATURES = $(AOMP_GPU)$(AOMP_TARGET_FEATURES)
-endif
-
-ifeq ($(SUPPORTED),)
-SUPPORTED = $(GPU_W_FEATURES)
-endif
-
-# ----- Demo compile and link in one step, no object code saved
-ifeq ($(AOMP_NO_PREREQ),)
-$(TESTNAME): prerequisites $(TESTSRC_ALL)
-else
-$(TESTNAME): $(TESTSRC_ALL)
-endif
-ifneq (,$(findstring $(GPU_W_FEATURES),$(SUPPORTED)))
-ifeq (,$(findstring $(GPU_W_FEATURES),$(UNSUPPORTED)))
-ifdef nvidia_targets
- $(CC) $(make_options) $(nvidia_targets) $(march) $(cuda) -o $@
-else ifdef march
- $(CC) $(make_options) $(march) -o $@
-else ifdef make_options
- $(CC) $(make_options) -o $@
-else
-ifeq ($(AOMP_NO_PREREQ),)
- $(SETENV) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OMP_FLAGS) $(wordlist 2,$(words $^),$^) -o $@ $(LINK_FLAGS)
-else
- $(SETENV) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OMP_FLAGS) $^ -o $@ $(LINK_FLAGS)
-endif
-endif
-else
- @echo " $(SKIP_COMPILE_UNSUPPORTED)"
-endif
-else
- @echo " $(SKIP_COMPILE_SUPPORTED)"
-endif
-
-run: $(TESTNAME)
-ifneq (,$(findstring $(GPU_W_FEATURES),$(SUPPORTED)))
-ifeq (,$(findstring $(GPU_W_FEATURES),$(UNSUPPORTED)))
- $(RUNENV) $(RUNPROF) $(RUNPROF_FLAGS) $(CHECK_COMMAND) 2>&1 | tee $@.log
-else
- @echo " $(SKIP_RUN_UNSUPPORTED)" 2>&1 | tee $@.log
-endif
-else
- @echo " $(SKIP_RUN_SUPPORTED)" 2>&1 | tee $@.log
-endif
-
-$(TESTNAME)_og11: $(TESTSRC_ALL)
- $(OG11CC) $^ -o $@
-og11run: $(TESTNAME)_og11
- $(OG11ENV) ./$(TESTNAME)_og11
-gpurun: $(TESTNAME)
- $(AOMP)/bin/gpurun $(RUNENV) $(RUNPROF) ./$(TESTNAME) 2>&1 | tee $@.log
-
-# Just verify output
-verify: run
- $(CC) verify_output.c -o verify_output
- ./verify_output
-
-# Verify output and log results, used for check_smoke.sh
-verify-log: run
- $(CC) verify_output.c -o verify_output
- path=`pwd`; \
- base=`basename $$path`; \
- ( \
- flock -e 9 && echo "" >> ../check-smoke.txt; \
- ./verify_output; \
- vrfy_status=$$?; \
- echo $$base $$test_num return code: $$vrfy_status >> ../check-smoke.txt; \
- echo "" >> ../check-smoke.txt; \
- if [ $$vrfy_status -eq 0 ]; then echo $$base $$test_num >> ../passing-tests.txt; \
- else echo $$base $$test_num >> ../failing-tests.txt; fi; \
- )9>../lockfile;
-
-check: $(TESTNAME)
-ifneq (,$(findstring $(GPU_W_FEATURES),$(SUPPORTED)))
-ifeq (,$(findstring $(GPU_W_FEATURES),$(UNSUPPORTED)))
- path=`pwd`; \
- base=`basename $$path`; \
- ( \
- flock -e 9 && echo "" >> ../check-smoke.txt; \
- $(RUNENV) $(SMOKE_TIMEOUT) $(RUNPROF) $(RUNPROF_FLAGS) $(CHECK_COMMAND) > /dev/null 2>&1; \
- test_status=$$?; \
- echo "$$test_status" > TEST_STATUS; \
- echo $$base $$test_num return code: $$test_status >> ../check-smoke.txt; \
- echo "" >> ../check-smoke.txt; \
- if [ $$test_status -eq 0 ]; then echo $$base $$test_num >> ../passing-tests.txt; \
- else echo $$base $$test_num >> ../failing-tests.txt; fi; \
- )9>../lockfile;
-else
- @echo " $(SKIP_RUN_UNSUPPORTED)"
-endif
-else
- @echo " $(SKIP_RUN_SUPPORTED)"
-endif
-
-check-asan: $(TESTNAME)
-ifneq (,$(findstring $(GPU_W_FEATURES),$(SUPPORTED)))
-ifeq (,$(findstring $(GPU_W_FEATURES),$(UNSUPPORTED)))
- path=`pwd`; \
- base=`basename $$path`; \
- ( \
- flock -e 9 && echo "" >> ../check-smoke-asan.txt; \
- # CmdStatus: Associative Container which keeps track of execution status of any command in the pipeline. \
- declare -A CmdStatus; \
- # GetPipedCmdStatus: Function which on demand populates the CmdStatus container with execution status values of each command executing in a given input pipeline. \
- # param_1: pipeline as string. \
- # param_2: pipestatus computed from PIPESTATUS as array. \
- # param_3: Cmd Name as string. \
- # param_4: CmdRunIndex of Cmd as positive integer. \
- function GetPipedCmdStatus() { \
- # pstat: Pipeline status list. \
- local -n pstat=$$2; \
- # Cmd: Command Name \
- Cmd="$$3"; \
- # CmdRunIndex: Index value of Cmd executing in the pipeline. \
- # Ex. pipeline = "Cmd1 | Cmd2 | Cmd3 | Cmd1 | Cmd4 | Cmd3" \
- # CmdRunIndex of Cmd1(First Time): 1 \
- # CmdRunIndex of Cmd2(First Time): 1 \
- # CmdRunIndex of Cmd1(Second Time): 2 \
- CmdRunIndex="$$4"; \
- # CmdRunIndexList: Index List of each Cmd. \
- # Ex. pipeline = "Cmd1 | Cmd2 | Cmd1 | Cmd3" \
- # CmdRunIndexList of Cmd1: (1,3) \
- CmdRunIndexList=($$(echo $$1 | awk -F'|' '{for(i=1;i<=NF;i++) {gsub(/^[ \t]+|[ \t]+$$/, "", $$i); print $$i}}' | awk -v Cmd_Pattern="$$Cmd " '$$0~Cmd_Pattern {print NR}')); \
- for CmdIndex in "$${CmdRunIndexList[@]}"; do \
- if [ -v CmdStatus["$$Cmd"] ]; then \
- ArrString=$${CmdStatus["$$Cmd"]}; \
- ArrString+=",$${pstat[$$CmdIndex-1]}"; \
- CmdStatus["$$Cmd"]=$${ArrString}; \
- else \
- NewArrString=$${pstat[$$CmdIndex-1]}; \
- CmdStatus["$$Cmd"]=$${NewArrString}; \
- fi; \
- done; \
- if [ -v CmdStatus[$$Cmd] ] && [ $$CmdRunIndex -gt 0 ];then \
- IFS=',' read -ra CmdStatusList <<< "$${CmdStatus[$$Cmd]}"; \
- return $${CmdStatusList["$$CmdRunIndex"-1]}; \
- fi; \
- }; \
- pipeline="$(RUNENV) $(SMOKE_TIMEOUT) $(RUNPROF) $(RUNPROF_FLAGS) $(CHECK_COMMAND) > /dev/null 2>&1"; \
- $(RUNENV) $(SMOKE_TIMEOUT) $(RUNPROF) $(RUNPROF_FLAGS) $(CHECK_COMMAND) > /dev/null 2>&1; \
- pipestatus=($${PIPESTATUS[@]}); \
- GetPipedCmdStatus "$$pipeline" "pipestatus" "$(TESTNAME)" "1"; \
- test_status=$$?; \
- GetPipedCmdStatus "$$pipeline" "pipestatus" "FileCheck" "1"; \
- filecheck_status=$$?; \
- echo "$$test_status" > TEST_STATUS; \
- echo "$$filecheck_status" > FILECHECK_STATUS; \
- echo $$base $$test_num return code: $$test_status >> ../check-smoke-asan.txt; \
- echo "" >> ../check-smoke-asan.txt; \
- if [ $$filecheck_status -eq 0 ]; then echo $$base $$test_num >> ../passing-tests.txt; \
- else echo $$base $$test_num >> ../failing-tests.txt; fi; \
- )9>../lockfile;
-else
- @echo " $(SKIP_RUN_UNSUPPORTED)"
-endif
-else
- @echo " $(SKIP_RUN_SUPPORTED)"
-endif
-
-
-# ----- Demo compile and link to object file
-ifneq ($(TESTNAME), $(findstring $(TESTNAME),$(TESTNAMES_ALL)))
-.PHONY: $(TESTNAME).o
-$(TESTNAME).o: $(addsuffix .o, $(TESTNAMES_ALL))
-endif
-
-%.o: %.c*
- $(SETENV) $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(OMP_FLAGS) $^ -o $@
-
-obin: $(TESTNAME).o
- $(SETENV) $(CC) $(OMP_FLAGS) $(LINK_FLAGS) $(addsuffix .o, $(TESTNAMES_ALL)) -o $@
-
-run_obin: obin
- $(RUNENV) $(RUNPROF) ./obin 2>&1 | tee $@.log
-
-help:
- @echo
- @echo "Compiler: $(OMP_BIN)"
- @echo "LLVM Tool Chain: $(AOMP)/bin"
- @echo "Offload Targets: $(TARGET)"
- @echo "Host Target: $(AOMP_CPUTARGET)"
- @echo "Application Binary: $(TESTNAME)"
- @echo
- @echo "This Makefile supports the following flags:"
- @echo
- @echo " make $(TESTNAME).ll // Compile pass only : -c -S -emit-llvm"
- @echo " make $(TESTNAME).ll.s // Backend pass only : -c -S"
- @echo " make $(TESTNAME).ll.o // Assemble pass only : -c"
- @echo " make llbin // Link pass only"
- @echo " make run_llbin // Execute llbin"
- @echo
- @echo " make $(TESTNAME).s // Compile & Backend passes : -c -S"
- @echo " make $(TESTNAME).s.o // Assemble pass only : -c"
- @echo " make sbin // Link pass only"
- @echo " make run_sbin // Execute sbin"
- @echo
- @echo " make $(TESTNAME).o // Compile, Backend, Assemble : -c"
- @echo " make obin // Link pass only"
- @echo " make run_obin // Execute obin"
- @echo
- @echo " make // All passes, build $(TESTNAME)"
- @echo " make run // Execute $(TESTNAME) binary"
- @echo
- @echo " make clean"
- @echo " make clean_log"
- @echo " make help"
- @echo
- @echo " Environment variables to control compilation & execution"
- @echo " VERBOSE=1 See lots of compiler messages and driver actions"
- @echo " TEMPS=1 Do not delete intermediate files"
- @echo " OFFLOAD_DEBUG=1-4 Runtime diagnostics:"
- @echo " 1 - LIBOMPTARGET"
- @echo " 2 - LIBOMPTARGET_DEVICE_RTL_DEBUG"
- @echo " 3 - LIBOMPTARGET AND LIBOMPTARGET_DEVICE_RTL_DEBUG"
- @echo " 4 - ATMI debug only"
- @echo
- @echo " Compile Environment: $(SETENV)"
- @echo
- @echo " Run Environment: $(RUNENV)"
- @echo
- @echo " Compile Flags: $(CFLAGS) $(EXTRA_CFLAGS)"
- @echo
- @echo " OMP Compile Flags: $(OMP_FLAGS) $(EXTRA_OMP_FLAGS)"
- @echo
- @echo " Link Flags: $(LINK_FLAGS) $(EXTRA_LDFLAGS)"
- @echo
-
-# ---- Demo compilation to LLVM IR and backend steps
-ifneq ($(TESTNAME), $(findstring $(TESTNAME),$(TESTNAMES_ALL)))
-.PHONY: $(TESTNAME).ll
-$(TESTNAME).ll: $(addsuffix .ll, $(TESTNAMES_ALL))
-endif
-
-%.ll: %.c*
- $(SETENV) $(CC) -c -S -emit-llvm $(CFLAGS) $(EXTRA_CFLAGS) $(OMP_FLAGS) $^ -o $@
-
-ifneq ($(TESTNAME), $(findstring $(TESTNAME),$(TESTNAMES_ALL)))
-.PHONY: $(TESTNAME).ll.s
-$(TESTNAME).ll.s: $(addsuffix .ll.s, $(TESTNAMES_ALL))
-endif
-
-%.ll.s: %.ll
- $(SETENV) $(CC) -c -S $(OMP_FLAGS) $^ -o $@
-
-ifneq ($(TESTNAME), $(findstring $(TESTNAME),$(TESTNAMES_ALL)))
-.PHONY: $(TESTNAME).ll.o
-$(TESTNAME).ll.o: $(addsuffix .ll.o, $(TESTNAMES_ALL))
-endif
-
-%.ll.o: %.ll.s
- $(SETENV) $(CC) -c $(OMP_FLAGS) $^ -o $@
-
-llbin: $(addsuffix .ll.o, $(TESTNAMES_ALL))
- $(SETENV) $(CC) $(OMP_FLAGS) $(LINK_FLAGS) $^ -o $@
-
-run_llbin: llbin
- $(RUNENV) $(RUNPROF) ./llbin 2>&1 | tee $@.log
-
-# ---- Demo compilation to assembler/final LL and assembly steps
-ifneq ($(TESTNAME), $(findstring $(TESTNAME),$(TESTNAMES_ALL)))
-.PHONY: $(TESTNAME).s
-$(TESTNAME).s: $(addsuffix .s, $(TESTNAMES_ALL))
-endif
-
-%.s: %.c*
- $(SETENV) $(CC) -c -S $(CFLAGS) $(EXTRA_CFLAGS) $(OMP_FLAGS) $^ -o $@
-
-ifneq ($(TESTNAME), $(findstring $(TESTNAME),$(TESTNAMES_ALL)))
-.PHONY: $(TESTNAME).s.o
-$(TESTNAME).s.o: $(addsuffix .s.o, $(TESTNAMES_ALL))
-endif
-
-%.s.o: %.s
- $(SETENV) $(CC) -c $(OMP_FLAGS) $^ -o $@
-
-sbin: $(addsuffix .s.o, $(TESTNAMES_ALL))
- $(SETENV) $(CC) $(OMP_FLAGS) $(LINK_FLAGS) $^ -o $@
-
-run_sbin: sbin
- $(RUNENV) $(RUNPROF) ./sbin 2>&1 | tee $@.log
-
-# Cleanup anything this makefile can create
-clean::
- rm -f $(TESTNAME) $(TESTNAME).a llbin sbin obin *.i *.ii *.bc *.lk a.out-* *.ll *.s *.o *.log *.mod verify_output *.stb *.ilm *.cmod *.cmdx *.so $(TESTNAME)_og11 make-log.txt TEST_STATUS FILECHECK_STATUS
-
-clean_log:
- rm -f *.log
diff --git a/test/smoke-dev/Makefile.rules b/test/smoke-dev/Makefile.rules
new file mode 120000
index 0000000000..b963453533
--- /dev/null
+++ b/test/smoke-dev/Makefile.rules
@@ -0,0 +1 @@
+../smoke/Makefile.rules
\ No newline at end of file
diff --git a/test/smoke/aomp-issue376/Makefile b/test/smoke-dev/aomp-issu376-a/Makefile
similarity index 100%
rename from test/smoke/aomp-issue376/Makefile
rename to test/smoke-dev/aomp-issu376-a/Makefile
diff --git a/test/smoke/aomp-issue376/aomp-issue376.cpp b/test/smoke-dev/aomp-issu376-a/aomp-issue376.cpp
similarity index 88%
rename from test/smoke/aomp-issue376/aomp-issue376.cpp
rename to test/smoke-dev/aomp-issu376-a/aomp-issue376.cpp
index 469c3e68ed..d6deae491c 100644
--- a/test/smoke/aomp-issue376/aomp-issue376.cpp
+++ b/test/smoke-dev/aomp-issu376-a/aomp-issue376.cpp
@@ -1,4 +1,4 @@
-/* Based on https://github.com/ROCm-Developer-Tools/aomp/issues/376 */
+/* Based on https://github.com/ROCm/aomp/issues/376 */
#include
#include
@@ -34,6 +34,9 @@ int main()
}
}
+ if (!DeviceMapPtr)
+ return 0;
+
for (auto Dev : *DeviceMapPtr)
flush_trace(Dev);
@@ -42,8 +45,3 @@ int main()
/// CHECK: Callback Target
/// CHECK-SAME: device_num=0
-
-
-
-
-
diff --git a/test/smoke-limbo/aomp-issue531/callbacks.h b/test/smoke-dev/aomp-issu376-a/callbacks.h
similarity index 100%
rename from test/smoke-limbo/aomp-issue531/callbacks.h
rename to test/smoke-dev/aomp-issu376-a/callbacks.h
diff --git a/test/smoke-limbo/aomp-issue376/Makefile b/test/smoke-dev/aomp-issue376/Makefile
similarity index 100%
rename from test/smoke-limbo/aomp-issue376/Makefile
rename to test/smoke-dev/aomp-issue376/Makefile
diff --git a/test/smoke-limbo/aomp-issue376/aomp-issue376.c b/test/smoke-dev/aomp-issue376/aomp-issue376.c
similarity index 77%
rename from test/smoke-limbo/aomp-issue376/aomp-issue376.c
rename to test/smoke-dev/aomp-issue376/aomp-issue376.c
index d9dd8f6401..0f20302b22 100644
--- a/test/smoke-limbo/aomp-issue376/aomp-issue376.c
+++ b/test/smoke-dev/aomp-issue376/aomp-issue376.c
@@ -1,4 +1,8 @@
-/* Based on https://github.com/ROCm-Developer-Tools/aomp/issues/376 */
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
+/* Based on https://github.com/ROCm/aomp/issues/376 */
#include
#include
diff --git a/test/smoke-limbo/aomp-issue531/Makefile b/test/smoke-dev/aomp-issue531/Makefile
similarity index 100%
rename from test/smoke-limbo/aomp-issue531/Makefile
rename to test/smoke-dev/aomp-issue531/Makefile
diff --git a/test/smoke-limbo/aomp-issue531/aomp-issue531.cpp b/test/smoke-dev/aomp-issue531/aomp-issue531.cpp
similarity index 89%
rename from test/smoke-limbo/aomp-issue531/aomp-issue531.cpp
rename to test/smoke-dev/aomp-issue531/aomp-issue531.cpp
index 067e1eb645..a1e7e67e58 100644
--- a/test/smoke-limbo/aomp-issue531/aomp-issue531.cpp
+++ b/test/smoke-dev/aomp-issue531/aomp-issue531.cpp
@@ -1,4 +1,4 @@
-// Test case from https://github.com/ROCm-Developer-Tools/aomp/issues/531
+// Test case from https://github.com/ROCm/aomp/issues/531
// [OMPT] Device tracing interface buffer records have fixed thread_id of 0
#include
diff --git a/test/smoke/aomp-issue376/callbacks.h b/test/smoke-dev/aomp-issue531/callbacks.h
similarity index 100%
rename from test/smoke/aomp-issue376/callbacks.h
rename to test/smoke-dev/aomp-issue531/callbacks.h
diff --git a/test/smoke-dev/check_smoke_dev.sh b/test/smoke-dev/check_smoke_dev.sh
deleted file mode 100755
index 1249428bb6..0000000000
--- a/test/smoke-dev/check_smoke_dev.sh
+++ /dev/null
@@ -1,314 +0,0 @@
-#!/bin/bash
-#
-# Checks all tests in smoke-dev using make check.
-# Programs return 0 for success or a number > 0 for failure.
-# Tests that need to be visually inspected: devices, pfspecify, pfspecify_str, stream
-#
-#
-
-#Text Colors
-RED="\033[0;31m"
-GRN="\033[0;32m"
-BLU="\033[0;34m"
-ORG="\033[0;33m"
-BLK="\033[0m"
-
-function gatherdata(){
- #Gather Test Data
- passing_tests=0
- if [ -e passing-tests.txt ]; then
- ((passing_tests=$(wc -l < passing-tests.txt)))
- total_tests=$passing_tests
- fi
- if [ -e make-fail.txt ]; then
- ((total_tests+=$(wc -l < make-fail.txt)))
- fi
- if [ -e failing-tests.txt ]; then
- ((total_tests+=$(wc -l < failing-tests.txt)))
- fi
-
- #Print Results
- echo -e "$BLU"-------------------- Results --------------------"$BLK"
- echo -e "$BLU"Number of tests: $total_tests"$BLK"
- echo ""
- echo -e "$GRN"Passing tests: $passing_tests/$total_tests""
-
- #Print passing tests, if any
- if [ -e passing-tests.txt ]; then
- echo "--------------------"
- cat passing-tests.txt
- fi
-
- #Print failed tests
- echo -e "$RED"
- echo ""
- if [ -e failing-tests.txt ]; then
- echo "Runtime Fails"
- echo "--------------------"
- cat failing-tests.txt
- echo ""
- fi
-
- if [ -e make-fail.txt ]; then
- echo "Compile Fails"
- echo "--------------------"
- cat make-fail.txt
- fi
- echo -e "$BLK"
-}
-
-if [ "$1" == "gatherdata" ]; then
- gatherdata
- exit 0
-fi
-
-cleanup(){
- rm -f passing-tests.txt
- rm -f failing-tests.txt
- rm -f check-smoke.txt
- rm -f make-fail.txt
-}
-
-script_dir=$(dirname "$0")
-pushd $script_dir
-path=$(pwd)
-
-#Clean all testing directories
-cleanup
-
-if [ "$1" == "-clean" ]; then
- for directory in ./*/; do
- pushd $directory > /dev/null
- make clean
- popd > /dev/null
- done
- exit 0
-fi
-
-export OMP_TARGET_OFFLOAD=${OMP_TARGET_OFFLOAD:-MANDATORY}
-echo OMP_TARGET_OFFLOAD=$OMP_TARGET_OFFLOAD
-
-echo ""
-echo -e "$ORG"RUNNING ALL TESTS IN: $path"$BLK"
-echo ""
-
-echo "************************************************************************************" > check-smoke.txt
-echo " A non-zero exit code means a failure occured." >> check-smoke.txt
-echo "***********************************************************************************" >> check-smoke.txt
-
-skip_tests=""
-if [ "$SKIP_FORTRAN" == 1 ] ; then
- skip_tests+="`find . -iname '*.f9[50]' | sed s^./^^ | awk -F/ '{print $1}'` "
- echo $skip_tests
-fi
-
-# ---------- Begin parallel logic ----------
-if [ "$AOMP_PARALLEL_SMOKE" == 1 ]; then
- sem --help > /dev/null
- if [ $? -eq 0 ]; then
- COMP_THREADS=1
- MAX_THREADS=16
- if [ ! -z `which "getconf"` ]; then
- COMP_THREADS=$(`which "getconf"` _NPROCESSORS_ONLN)
- if [ "$AOMP_PROC" == "ppc64le" ] ; then
- COMP_THREADS=$(( COMP_THREADS / 6))
- fi
- if [ "$AOMP_PROC" == "aarch64" ] ; then
- COMP_THREADS=$(( COMP_THREADS / 4))
- fi
- fi
- AOMP_JOB_THREADS=${AOMP_JOB_THREADS:-$COMP_THREADS}
- if [ $AOMP_JOB_THREADS -gt 16 ]; then
- AOMP_JOB_THREADS=16
- echo "Limiting job threads to $AOMP_JOB_THREADS."
- fi
- echo THREADS: $AOMP_JOB_THREADS
- # Parallel Make
- for directory in ./*/; do
- pushd $directory > /dev/null
- base=$(basename `pwd`)
- echo Make: $base
- if [ $base == "gpus" ]; then # Compile and link only test
- make clean > /dev/null
- make &> make-log.txt
- if [ $? -ne 0 ]; then
- flock -e lockfile -c "echo $base: Make Failed >> ../make-fail.txt"
- else
- flock -e lockfile -c "echo $base >> ../passing-tests.txt"
- fi
- else
- sem --jobs $AOMP_JOB_THREADS --id def_sem -u 'base=$(basename $(pwd)); make clean > /dev/null; make &> make-log.txt; if [ $? -ne 0 ]; then flock -e lockfile -c "echo $base: Make Failed >> ../make-fail.txt"; fi;'
- fi
- popd > /dev/null
- done
-
- # Wait for jobs to finish before execution
- sem --wait --id def_sem
-
- # Parallel execution, currently limited to 4 jobs
- for directory in ./*/; do
- pushd $directory > /dev/null
- base=$(basename `pwd`)
- echo RUN $base
- if [ $base == 'hip_rocblas' ] ; then
- ls $AOMPROCM/rocblas > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo -e "$RED"$base - needs rocblas installed at $AOMPROCM/rocblas:"$BLK"
- echo -e "$RED"$base - ROCBLAS NOT FOUND!!! SKIPPING TEST!"$BLK"
- popd > /dev/null
- continue
- fi
- elif [ $base == 'devices' ] || [ $base == 'stream' ] ; then
- sem --jobs 4 --id def_sem -u 'make run > /dev/null 2>&1'
- sem --jobs 4 --id def_sem -u 'make check > /dev/null 2>&1'
- elif [ $base == 'printf_parallel_for_target' ] || [ $base == 'omp_places' ] || [ $base == 'pfspecifier' ] || [ $base == 'pfspecifier_str' ] ; then
- sem --jobs 4 --id def_sem -u 'make verify-log > /dev/null'
- elif [ $base == 'flags' ] ; then
- make run
- elif [ $base == 'liba_bundled' ] || [ $base == 'liba_bundled_cmdline' ]; then
- sem --jobs 4 --id def_sem -u 'base=$(basename $(pwd)); make check > /dev/null; if [ $? -ne 0 ]; then flock -e lockfile -c "echo $base: Make Failed >> ../make-fail.txt"; fi;'
- elif [ $base == "gpus" ]; then # Compile and link only test
- echo gpus is compile only!
- else
- sem --jobs 4 --id def_sem -u 'make check > /dev/null 2>&1'
- fi
- popd > /dev/null
- done
-
- # Wait for jobs to finish executing
- sem --wait --id def_sem
- gatherdata
- exit
- else
- echo
- echo "Warning: Parallel smoke requested, but the parallel package needed is not installed. Continuing with sequential version..."
- echo
- fi
-fi
-# ---------- End parallel logic ----------
-
-
-#Loop over all directories and make run / make check depending on directory name
-for directory in ./*/; do
- (cd "$directory" && path=$(pwd) && base=$(basename $path)
- if [ "$NO_CLEAN" != 1 ] ; then
- make clean
- fi
- #Skip tests that are known failures
- skip=0
- for test in $skip_tests ; do
- if [ $test == $base ] ; then
- skip=1
- echo "$test $base"
- break
- fi
- done
- if [ $skip -ne 0 ] ; then
- echo "Skipping $base"
- echo ""
- else
- AOMPROCM=${AOMPROCM:-/opt/rocm}
- if [ $base == 'hip_rocblas' ] ; then
- ls $AOMPROCM/rocblas > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo -e "$RED"$base - needs rocblas installed at $AOMPROCM/rocblas:"$BLK"
- echo -e "$RED"$base - ROCBLAS NOT FOUND!!! SKIPPING TEST!"$BLK"
- continue
- fi
- fi
- if [ $base == 'devices' ] || [ $base == 'pfspecifier' ] || [ $base == 'pfspecifier_str' ] || [ $base == 'stream' ] ; then
- make
- if [ $? -ne 0 ]; then
- echo "$base: Make Failed" >> ../make-fail.txt
- fi
- make run > /dev/null 2>&1
- make check > /dev/null 2>&1
-
- #flags has multiple runs
- elif [ $base == 'flags' ] ; then
- make
- make run > /dev/null 2>&1
- elif [ $base == 'printf_parallel_for_target' ] ; then
- make verify-log
- else
- make
- if [ $? -ne 0 ]; then
- echo "$base: Make Failed" >> ../make-fail.txt
- fi
- make check > /dev/null 2>&1
- #liba_bundled has an additional Makefile, that may fail on the make check
- if [ $? -ne 0 ] && ( [ $base == 'liba_bundled' ] || [ $base == 'liba_bundled_cmdline' ] ) ; then
- echo "$base: Make Failed" >> ../make-fail.txt
- fi
- fi
- fi
- echo ""
- )
-
-done
-
-#Print run.log for all tests that need visual inspection
-for directory in ./*/; do
- (cd "$directory" && path=$(pwd) && base=$(basename $path)
- if [ $base == 'devices' ] || [ $base == 'pfspecifier' ] || [ $base == 'pfspecifier_str' ] || [ $base == 'stream' ] ; then
- echo ""
- echo -e "$ORG"$base - Run Log:"$BLK"
- echo "--------------------------"
- if [ -e run.log ]; then
- cat run.log
- fi
- echo ""
- echo ""
- fi
- )
-done
-
-#Replace false positive return codes with 'Check the run.log' so that user knows to visually inspect those.
-sed -i '/pfspecifier/ {s/0/Check the run.log above/}; /devices/ {s/0/Check the run.log above/}; /stream/ {s/0/Check the run.log above/}' check-smoke.txt
-echo ""
-if [ -e check-smoke.txt ]; then
- cat check-smoke.txt
-fi
-if [ -e make-fail.txt ]; then
- cat make-fail.txt
-fi
-echo ""
-
-gatherdata
-
-# Print run logs for runtime fails, EPSDB only
-# Disable printing of runtime fails for smoke-dev
-if [ "$EPSDB" == 2 ] ; then
- file='failing-tests.txt'
- flags_test_done=0
- if [ -e $file ]; then
- echo ----------Printing Runtime Fail Logs---------
- while read -r line; do
- # The flags test has multiple numbered runs. We cannot pushd flags 1 because only the flags dir exists.
- # We must re-run the entire flags test to get run.log. If more than one flags subtest fails only run once.
- if [[ "$line" =~ "flags" ]]; then
- if [[ "$flags_test_done" == 0 ]]; then
- echo
- pushd flags > /dev/null
- echo Test: flags run log:
- echo The flags test must run all iterations if one subtest fails.
- make run
- cat run.log
- flags_test_done=1
- popd > /dev/null
- fi
- else
- echo
- pushd $line > /dev/null
- echo
- make run > /dev/null
- echo Test: $line run log:
- cat run.log
- popd > /dev/null
- fi
- done < "$file"
- echo
- fi
-fi
-
-popd
diff --git a/test/smoke-dev/check_smoke_dev.sh b/test/smoke-dev/check_smoke_dev.sh
new file mode 120000
index 0000000000..9beff5fdbe
--- /dev/null
+++ b/test/smoke-dev/check_smoke_dev.sh
@@ -0,0 +1 @@
+../smoke/check_smoke.sh
\ No newline at end of file
diff --git a/test/smoke-dev/clang-325070/Makefile b/test/smoke-dev/clang-325070-1/Makefile
similarity index 100%
rename from test/smoke-dev/clang-325070/Makefile
rename to test/smoke-dev/clang-325070-1/Makefile
diff --git a/test/smoke-dev/clang-325070/clang-325070.cpp b/test/smoke-dev/clang-325070-1/clang-325070.cpp
similarity index 100%
rename from test/smoke-dev/clang-325070/clang-325070.cpp
rename to test/smoke-dev/clang-325070-1/clang-325070.cpp
diff --git a/test/smoke-dev/clang-325070/doit.gdb b/test/smoke-dev/clang-325070-1/doit.gdb
similarity index 100%
rename from test/smoke-dev/clang-325070/doit.gdb
rename to test/smoke-dev/clang-325070-1/doit.gdb
diff --git a/test/smoke-dev/fast_fp_atomics_mi200_default_usm_map/fast_fp_atomics_mi200_default_usm_map.cpp b/test/smoke-dev/fast_fp_atomics_mi200_default_usm_map/fast_fp_atomics_mi200_default_usm_map.cpp
index b40547cadb..2fc0432c0b 100644
--- a/test/smoke-dev/fast_fp_atomics_mi200_default_usm_map/fast_fp_atomics_mi200_default_usm_map.cpp
+++ b/test/smoke-dev/fast_fp_atomics_mi200_default_usm_map/fast_fp_atomics_mi200_default_usm_map.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-dev/fast_fp_atomics_mi200_not_enable_corase_grain_usm_map/fast_fp_atomics_mi200_not_enable_coarse_grain_usm_map.cpp b/test/smoke-dev/fast_fp_atomics_mi200_not_enable_corase_grain_usm_map/fast_fp_atomics_mi200_not_enable_coarse_grain_usm_map.cpp
index 5035e90842..dc3cd7fdc7 100644
--- a/test/smoke-dev/fast_fp_atomics_mi200_not_enable_corase_grain_usm_map/fast_fp_atomics_mi200_not_enable_coarse_grain_usm_map.cpp
+++ b/test/smoke-dev/fast_fp_atomics_mi200_not_enable_corase_grain_usm_map/fast_fp_atomics_mi200_not_enable_coarse_grain_usm_map.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-dev/generic-spmd-use-small-blocksize/Makefile b/test/smoke-dev/generic-spmd-use-small-blocksize/Makefile
new file mode 100644
index 0000000000..63fbe5685a
--- /dev/null
+++ b/test/smoke-dev/generic-spmd-use-small-blocksize/Makefile
@@ -0,0 +1,17 @@
+include ../../Makefile.defs
+
+TESTNAME = generic-spmd-use-small-blocksize
+TESTSRC_MAIN = generic-spmd-use-small-blocksize.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+CLANG ?= clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-dev/generic-spmd-use-small-blocksize/generic-spmd-use-small-blocksize.c b/test/smoke-dev/generic-spmd-use-small-blocksize/generic-spmd-use-small-blocksize.c
new file mode 100644
index 0000000000..8a197606c5
--- /dev/null
+++ b/test/smoke-dev/generic-spmd-use-small-blocksize/generic-spmd-use-small-blocksize.c
@@ -0,0 +1,34 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
+#define N 2097152
+#define NUM_THREADS 256
+#define NUM_DISTR (N / NUM_THREADS)
+
+#include
+#include
+
+int main() {
+ int *a = (int*)malloc(sizeof(int)*N);
+ int i, j;
+
+#pragma omp target teams distribute map(tofrom:a[0:N])
+ for (i = 0; i < NUM_DISTR; i++)
+#pragma omp parallel for
+ for (j = 0; j < NUM_THREADS; j++)
+ a[i * NUM_THREADS + j] = (i * NUM_THREADS + j);
+
+ for (i = 0; i < N; i++)
+ if (a[i] != i) {
+ printf("wrong value: a[%d]=%d\n", i, a[i]);
+ free(a);
+ return 1;
+ }
+ printf("Success\n");
+ free(a);
+ return 0;
+}
+
+/// CHECK: SGN:3
+/// CHECK: teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
diff --git a/test/smoke-dev/gpurun-l-m/gpurun-l-m.c b/test/smoke-dev/gpurun-l-m/gpurun-l-m.c
index 64c74dc0c7..efe0a8c640 100644
--- a/test/smoke-dev/gpurun-l-m/gpurun-l-m.c
+++ b/test/smoke-dev/gpurun-l-m/gpurun-l-m.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
#include
diff --git a/test/smoke-dev/gpurun-l-m/gpurun-l-m.py b/test/smoke-dev/gpurun-l-m/gpurun-l-m.py
index cc814f0bef..da0336781b 100644
--- a/test/smoke-dev/gpurun-l-m/gpurun-l-m.py
+++ b/test/smoke-dev/gpurun-l-m/gpurun-l-m.py
@@ -1,3 +1,7 @@
+# Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+# SPDX-License-Identifier: MIT
+
# Python program to check the gpurun -m and -l options.
import subprocess
diff --git a/test/smoke-dev/gpurun-tests/Makefile b/test/smoke-dev/gpurun-tests/Makefile
new file mode 100644
index 0000000000..ab48baa517
--- /dev/null
+++ b/test/smoke-dev/gpurun-tests/Makefile
@@ -0,0 +1,13 @@
+include ../../Makefile.defs
+
+TESTNAME = gpurun-tests
+TESTSRC_MAIN = gpurun-tests.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./chkit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-dev/gpurun-tests/chkit.sh b/test/smoke-dev/gpurun-tests/chkit.sh
new file mode 100755
index 0000000000..39647ebacf
--- /dev/null
+++ b/test/smoke-dev/gpurun-tests/chkit.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+export EX=./$1
+export PATH=$AOMP/bin:$PATH
+which gpurun
+set -x
+gpurun -help
+gpurun -topo
+gpurun -rocmsmi $EX
+gpurun -nm $EX
+gpurun -nr $EX
+gpurun -l $EX
+gpurun -md 1 $EX
+gpurun -m $EX
+gpurun -dryrun $EX
+gpurun -nomask $EX
+gpurun -nomask $EX
+
+gpurun -v $EX
+gpurun -vv $EX
+gpurun -vvv $EX
diff --git a/test/smoke-dev/gpurun-tests/gpurun-tests.c b/test/smoke-dev/gpurun-tests/gpurun-tests.c
new file mode 100644
index 0000000000..76b8a015cd
--- /dev/null
+++ b/test/smoke-dev/gpurun-tests/gpurun-tests.c
@@ -0,0 +1,5 @@
+#include "stdio.h"
+int main() {
+ fprintf(stderr, "howdy from gpurun\n");
+ return 0;
+}
diff --git a/test/smoke-dev/launch_latency/printLatency.py b/test/smoke-dev/launch_latency/printLatency.py
deleted file mode 100644
index 9955a01cf8..0000000000
--- a/test/smoke-dev/launch_latency/printLatency.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Python program to print the launch latency in file: result.csv.
-#
-# Example:
-#
-# lstringe@r7:~/git/aomp18.0/aomp/test/smoke/launch_latency$ head results.csv
-# "Index","KernelName","gpu-id","queue-id","queue-index","pid","tid","grd","wgr","lds","scr","arch_vgpr","accum_vgpr","sgpr","wave_size","sig","obj","DispatchNs","BeginNs","EndNs","CompleteNs","DurationNs"
-# 0,"__omp_offloading_fd00_5871764_main_l19.kd",2,1,0,3495164,3495164,256,256,512,0,4,4,16,64,"0x153e64afca00","0x153d64770ec0",5323868593531200,5323868593552306,5323868593554226,5323868593566416,1920
-# 1,"__omp_offloading_fd00_5871764_main_l28.kd",2,2,0,3495164,3495164,257,257,512,0,4,4,16,64,"0x153e64afca00","0x153d64770f00",5323868597609543,5323868597625664,5323868597648223,5323868597650689,22559
-# 2,"__omp_offloading_fd00_5871764_main_l28.kd",2,3,0,3495164,3495164,257,257,512,0,4,4,16,64,"0x153e64afca00","0x153d64770f00",5323868601572039,5323868601587825,5323868601610545,5323868601613071,22720
-# 3,"__omp_offloading_fd00_5871764_main_l28.kd",2,0,0,3495164,3495164,257,257,512,0,4,4,16,64,"0x153e64afca00","0x153d64770f00",5323868601623008,5323868601645584,5323868601668144,5323868601669341,22560
-#
-
-dict = {}
-f = open("results.csv", "r")
-for line in f:
- line = line.rstrip() # strip off the carriage return and line feed at the end of line
- # print (line)
- pList = line.split(",")
- grd = pList[7]
- if grd == "\"grd\"":
- continue
- durationNS = int(pList[-1])
- if grd in dict:
- count, sum = dict[grd]
- count = count + 1
- sum = sum + durationNS
- dict[grd] = (count, sum)
- else:
- dict[grd] = (1, durationNS)
-
-count,sum = dict["256"]
-latencyaverage = (float(sum) / count) * 1e-9
-print ("1st kernel Time", "{:11.9f} seconds".format(latencyaverage))
-dict.pop("256")
-
-j = 1
-for key in dict:
- count, sum = dict[key]
- latencyaverage = (float(sum) / count) * 1e-9
- # "avg kernel Time %12.8f TEAMS=%d\n"
- print ("avg kernel Time", "{:11.9f} seconds".format(latencyaverage), "TEAMS=", j)
- j = j * 2
-
diff --git a/test/smoke-dev/mpi-allreduce/Makefile b/test/smoke-dev/mpi-allreduce/Makefile
index 676e82bede..a1be9c5850 100644
--- a/test/smoke-dev/mpi-allreduce/Makefile
+++ b/test/smoke-dev/mpi-allreduce/Makefile
@@ -1,8 +1,8 @@
+include ../../Makefile.defs
TESTNAME = mpi-allreduce
TESTSRC = mpi-allreduce.cpp
AOMP ?= $(HOME)/rocm/aomp
-_gpu = $(shell $(AOMP)/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
-CFLAGS = -O3 -fopenmp --offload-arch=$(_gpu)
+CFLAGS = -O3 -fopenmp --offload-arch=$(AOMP_GPU)
AOMP_SUPP ?= $(HOME)/local
MPI ?= $(AOMP_SUPP)/openmpi
CC_MPI = $(MPI)/bin/mpic++
@@ -13,7 +13,7 @@ $(TESTNAME): $(TESTSRC)
OMPI_CC=$(CLANG_DIR)/clang++ $(CC_MPI) $(CFLAGS) $(LFLAGS) $^ -o $@
run: $(TESTNAME)
- $(MPI)/bin/mpirun -np 2 $(CLANG_DIR)/gpurun -v ./$(TESTNAME)
+ $(MPI)/bin/mpirun -np 2 $(AOMP)/bin/gpurun -v ./$(TESTNAME)
clean:
rm -f $(TESTNAME) obin *.i *.ii *.bc *.lk a.out-* *.ll *.s *.o *.cubin
diff --git a/test/smoke-dev/mpi-allreduce/mpi-allreduce b/test/smoke-dev/mpi-allreduce/mpi-allreduce
deleted file mode 100755
index 24d00d70fc..0000000000
Binary files a/test/smoke-dev/mpi-allreduce/mpi-allreduce and /dev/null differ
diff --git a/test/smoke-dev/mpi-reduce/Makefile b/test/smoke-dev/mpi-reduce/Makefile
index b5b6fa7431..45fd9dec3a 100644
--- a/test/smoke-dev/mpi-reduce/Makefile
+++ b/test/smoke-dev/mpi-reduce/Makefile
@@ -1,8 +1,9 @@
+include ../../Makefile.defs
+
TESTNAME = mpi-reduce
TESTSRC = mpi-reduce.cpp
AOMP ?= $(HOME)/rocm/aomp
-_gpu = $(shell $(AOMP)/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
-CFLAGS = -O3 -fopenmp --offload-arch=$(_gpu)
+CFLAGS = -O3 -fopenmp --offload-arch=$(AOMP_GPU)
AOMP_SUPP ?= $(HOME)/local
MPI ?= $(AOMP_SUPP)/openmpi
CC_MPI = $(MPI)/bin/mpic++
@@ -13,7 +14,7 @@ $(TESTNAME): $(TESTSRC)
OMPI_CC=$(CLANG_DIR)/clang++ $(CC_MPI) $(CFLAGS) $(LFLAGS) $^ -o $@
run: $(TESTNAME)
- $(MPI)/bin/mpirun -np 2 $(CLANG_DIR)/gpurun -v ./$(TESTNAME)
+ $(MPI)/bin/mpirun -np 2 $(AOMP)/bin/gpurun -v ./$(TESTNAME)
clean:
rm -f $(TESTNAME) obin *.i *.ii *.bc *.lk a.out-* *.ll *.s *.o *.cubin
diff --git a/test/smoke-dev/mpi-reduce/mpi-reduce b/test/smoke-dev/mpi-reduce/mpi-reduce
deleted file mode 100755
index 3bf4ce940e..0000000000
Binary files a/test/smoke-dev/mpi-reduce/mpi-reduce and /dev/null differ
diff --git a/test/smoke-dev/occupancy-based-opt-generic-spmd-use-small-blocksize/Makefile b/test/smoke-dev/occupancy-based-opt-generic-spmd-use-small-blocksize/Makefile
new file mode 100644
index 0000000000..abfdd20c7b
--- /dev/null
+++ b/test/smoke-dev/occupancy-based-opt-generic-spmd-use-small-blocksize/Makefile
@@ -0,0 +1,18 @@
+include ../../Makefile.defs
+
+TESTNAME = occupancy-based-opt-generic-spmd-use-small-blocksize
+TESTSRC_MAIN = occupancy-based-opt-generic-spmd-use-small-blocksize.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+RUNENV += OMPX_GENERIC_SPMD_OCCUPANCY_BASED_OPT=1
+
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+CLANG ?= clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-dev/occupancy-based-opt-generic-spmd-use-small-blocksize/occupancy-based-opt-generic-spmd-use-small-blocksize.c b/test/smoke-dev/occupancy-based-opt-generic-spmd-use-small-blocksize/occupancy-based-opt-generic-spmd-use-small-blocksize.c
new file mode 100644
index 0000000000..c10b93f92a
--- /dev/null
+++ b/test/smoke-dev/occupancy-based-opt-generic-spmd-use-small-blocksize/occupancy-based-opt-generic-spmd-use-small-blocksize.c
@@ -0,0 +1,36 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
+#define N 4194304
+#define NUM_THREADS 256
+#define NUM_DISTR (N / NUM_THREADS)
+
+#include
+#include
+
+int main() {
+ int *a = (int*)malloc(sizeof(int)*N);
+ int i, j;
+
+#pragma omp target teams distribute map(tofrom:a[0:N])
+ for (i = 0; i < NUM_DISTR; i++)
+#pragma omp parallel for
+ for (j = 0; j < NUM_THREADS; j++)
+ a[i * NUM_THREADS + j] = (i * NUM_THREADS + j);
+
+ for (i = 0; i < N; i++)
+ if (a[i] != i) {
+ printf("wrong value: a[%d]=%d\n", i, a[i]);
+ free(a);
+ return 1;
+ }
+ printf("Success\n");
+ free(a);
+ return 0;
+}
+
+/// CHECK: SGN:3
+/// CHECK: teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: Achieved Occupancy: 100%
+
diff --git a/test/smoke-dev/occupancy-based-opt-generic-spmd/Makefile b/test/smoke-dev/occupancy-based-opt-generic-spmd/Makefile
new file mode 100644
index 0000000000..08e02b189d
--- /dev/null
+++ b/test/smoke-dev/occupancy-based-opt-generic-spmd/Makefile
@@ -0,0 +1,18 @@
+include ../../Makefile.defs
+
+TESTNAME = occupancy_based_opt_generic_spmd
+TESTSRC_MAIN = occupancy_based_opt_generic_spmd.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+RUNENV += OMPX_GENERIC_SPMD_OCCUPANCY_BASED_OPT=1
+
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+CLANG ?= clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-dev/occupancy-based-opt-generic-spmd/occupancy_based_opt_generic_spmd.c b/test/smoke-dev/occupancy-based-opt-generic-spmd/occupancy_based_opt_generic_spmd.c
new file mode 100644
index 0000000000..3a1a2bb135
--- /dev/null
+++ b/test/smoke-dev/occupancy-based-opt-generic-spmd/occupancy_based_opt_generic_spmd.c
@@ -0,0 +1,30 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
+#define N 1048576
+#define NUM_THREADS 256
+#define NUM_DISTR (N / NUM_THREADS)
+
+#include
+
+int main() {
+ int a[N];
+ int i, j;
+
+#pragma omp target teams distribute
+ for (i = 0; i < NUM_DISTR; i++)
+#pragma omp parallel for
+ for (j = 0; j < NUM_THREADS; j++)
+ a[i * NUM_THREADS + j] = (i * NUM_THREADS + j);
+
+ for (i = 0; i < N; i++)
+ if (a[i] != i) {
+ printf("wrong value: a[%d]=%d\n", i, a[i]);
+ return 1;
+ }
+ printf("Success\n");
+ return 0;
+}
+
+/// CHECK: Achieved Occupancy: 100%
diff --git a/test/smoke-dev/occupancy-based-opt-xteam-reduction/Makefile b/test/smoke-dev/occupancy-based-opt-xteam-reduction/Makefile
index 4e37e0c871..6be7601355 100644
--- a/test/smoke-dev/occupancy-based-opt-xteam-reduction/Makefile
+++ b/test/smoke-dev/occupancy-based-opt-xteam-reduction/Makefile
@@ -4,7 +4,7 @@ TESTNAME = occupancy_based_opt_xteam_reduction
TESTSRC_MAIN = occupancy_based_opt_xteam_reduction.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1 LIBOMPTARGET_AMDGPU_XTEAM_BLOCKSIZE=512
RUNENV += OMPX_XTEAMREDUCTION_OCCUPANCY_BASED_OPT=1
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
diff --git a/test/smoke-dev/occupancy-based-opt-xteam-reduction/occupancy_based_opt_xteam_reduction.c b/test/smoke-dev/occupancy-based-opt-xteam-reduction/occupancy_based_opt_xteam_reduction.c
index 44503f25fa..6e548056a4 100644
--- a/test/smoke-dev/occupancy-based-opt-xteam-reduction/occupancy_based_opt_xteam_reduction.c
+++ b/test/smoke-dev/occupancy-based-opt-xteam-reduction/occupancy_based_opt_xteam_reduction.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-limbo/veccopy-ompt-target-cmake/CMakeLists.txt b/test/smoke-dev/omptest-device-emi/CMakeLists.txt
similarity index 63%
rename from test/smoke-limbo/veccopy-ompt-target-cmake/CMakeLists.txt
rename to test/smoke-dev/omptest-device-emi/CMakeLists.txt
index e4d8cea929..7cc1ae7167 100644
--- a/test/smoke-limbo/veccopy-ompt-target-cmake/CMakeLists.txt
+++ b/test/smoke-dev/omptest-device-emi/CMakeLists.txt
@@ -18,15 +18,6 @@ message(STATUS "AOMP directory: '${AOMP_DIR}'")
# Retrieve package information from omptest
find_package(omptest REQUIRED)
-# Use default compiler values of omptest.
-set(CMAKE_C_COMPILER ${omptest_C_COMPILER})
-set(CMAKE_CXX_COMPILER ${omptest_CXX_COMPILER})
-message(STATUS " CMAKE_C_COMPILER: '${CMAKE_C_COMPILER}'")
-message(STATUS "CMAKE_CXX_COMPILER: '${CMAKE_CXX_COMPILER}'")
-
-# Make sure to include and esp. link directories before 'add_executable'
-include_directories(${omptest_INCLUDE_DIR})
-link_directories(${omptest_LIBRARY_ROOT})
add_executable(${PROJECT_NAME}
${PROJECT_NAME}.cpp)
@@ -37,7 +28,8 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
# Link
# Note: omp[target] will be linked automatically because of the offload options
-target_link_libraries(${PROJECT_NAME} PRIVATE ${OFFLOAD_OPTIONS} omptest)
+target_link_libraries(${PROJECT_NAME} PRIVATE
+ ${OFFLOAD_OPTIONS} omptest::omptest)
-# Notify: this test does not use GoogleTest
-message(STATUS "GoogleTest: OFF")
+# Notify: Test either uses GoogleTest-based ompTest or 'standalone'
+message(STATUS "Standalone: ${LIBOMPTEST_BUILD_STANDALONE}")
diff --git a/test/smoke-limbo/omptest-device-emi/Makefile b/test/smoke-dev/omptest-device-emi/Makefile
similarity index 96%
rename from test/smoke-limbo/omptest-device-emi/Makefile
rename to test/smoke-dev/omptest-device-emi/Makefile
index e3718127ce..1afcf77776 100644
--- a/test/smoke-limbo/omptest-device-emi/Makefile
+++ b/test/smoke-dev/omptest-device-emi/Makefile
@@ -23,4 +23,4 @@ CC = $(DUMMYSRC) | $(OMP_BIN) $(DUMMYOPT)
include ../Makefile.rules
clean::
- git clean -dfx ./build
+ rm -rf ./build
diff --git a/test/smoke-limbo/omptest-device-emi/omptest-device-emi.cpp b/test/smoke-dev/omptest-device-emi/omptest-device-emi.cpp
similarity index 99%
rename from test/smoke-limbo/omptest-device-emi/omptest-device-emi.cpp
rename to test/smoke-dev/omptest-device-emi/omptest-device-emi.cpp
index d3d1b6baed..167509d32a 100644
--- a/test/smoke-limbo/omptest-device-emi/omptest-device-emi.cpp
+++ b/test/smoke-dev/omptest-device-emi/omptest-device-emi.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include "omp.h"
#include "OmptTester.h"
@@ -11,6 +15,32 @@ using namespace internal;
int c[X];
#pragma omp end declare target
+TEST(InitFiniSuite, DeviceLoad) {
+ OMPT_SUPPRESS_EVENT(EventTy::TargetEmi)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetDataOpEmi)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetSubmitEmi)
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRequest);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferComplete);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRecord);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRecordDeallocation);
+
+ int N = 128;
+ int a[N];
+
+ for (int DeviceNum = 0; DeviceNum < omp_get_num_devices(); ++DeviceNum) {
+ // Even on multi-GPU systems, only default-device is immediately initialized
+ OMPT_ASSERT_SEQUENCE(DeviceLoad, /*DeviceNum=*/DeviceNum);
+
+#pragma omp target parallel for device(DeviceNum)
+ {
+ for (int j = 0; j < N; j++)
+ a[j] = 0;
+ }
+
+ OMPT_ASSERT_SYNC_POINT("After DeviceLoad " + std::to_string(DeviceNum));
+ }
+}
+
TEST(VeccopyCallbacks, OnDevice_Sequenced) {
OMPT_SUPPRESS_EVENT(EventTy::BufferRecord);
OMPT_SUPPRESS_EVENT(EventTy::BufferRequest);
@@ -966,34 +996,4 @@ TEST(VeccopyTraces, OnDeviceCallbacks_teams_distribute_parallel_for_nowait_w_tim
}
}
-// FIXME: Leave this suite here, so it gets discovered last and executed first.
-TEST(InitFiniSuite, DeviceLoad) {
- OMPT_SUPPRESS_EVENT(EventTy::TargetEmi)
- OMPT_SUPPRESS_EVENT(EventTy::TargetDataOpEmi)
- OMPT_SUPPRESS_EVENT(EventTy::TargetSubmitEmi)
- OMPT_SUPPRESS_EVENT(EventTy::BufferRequest);
- OMPT_SUPPRESS_EVENT(EventTy::BufferComplete);
- OMPT_SUPPRESS_EVENT(EventTy::BufferRecord);
- OMPT_SUPPRESS_EVENT(EventTy::BufferRecordDeallocation);
-
- int N = 128;
- int a[N];
-
- for (int DeviceNum = 0; DeviceNum < omp_get_num_devices(); ++DeviceNum) {
- // Even on multi-GPU systems, only default-device is immediately initialized
- OMPT_ASSERT_SEQUENCE(DeviceLoad, /*DeviceNum=*/DeviceNum);
-
-#pragma omp target parallel for device(DeviceNum)
- {
- for (int j = 0; j < N; j++)
- a[j] = 0;
- }
-
- OMPT_ASSERT_SYNC_POINT("After DeviceLoad " + std::to_string(DeviceNum));
- }
-}
-
-int main(int argc, char **argv) {
- Runner R;
- return R.run();
-}
+OMPTEST_TESTSUITE_MAIN()
diff --git a/test/smoke-limbo/omptest-device-emi/performBuildRun.sh b/test/smoke-dev/omptest-device-emi/performBuildRun.sh
similarity index 83%
rename from test/smoke-limbo/omptest-device-emi/performBuildRun.sh
rename to test/smoke-dev/omptest-device-emi/performBuildRun.sh
index ff8a36e696..861777d333 100755
--- a/test/smoke-limbo/omptest-device-emi/performBuildRun.sh
+++ b/test/smoke-dev/omptest-device-emi/performBuildRun.sh
@@ -1,3 +1,8 @@
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
#!/bin/bash
set -x
@@ -40,12 +45,14 @@ if [ ! -d ${AOMP_DIR} ]; then
fi
echo " >>> Clean ..."
-git clean -fdx ./${BUILD_DIR}
+rm -rf ./${BUILD_DIR}
echo " >>> Configure ..."
cmake -B ${BUILD_DIR} -S . \
-DAOMP_DIR=${AOMP_DIR} \
--DTGT_OFFLOAD_ARCH=${TGT_OFFLOAD_ARCH}
+-DTGT_OFFLOAD_ARCH=${TGT_OFFLOAD_ARCH} \
+-DCMAKE_C_COMPILER=${AOMP_DIR}/bin/clang \
+-DCMAKE_CXX_COMPILER=${AOMP_DIR}/bin/clang++
echo " >>> Build ..."
cmake --build ${BUILD_DIR} --clean-first --parallel || exit 1
diff --git a/test/smoke-limbo/omptest-device-emi/CMakeLists.txt b/test/smoke-dev/omptest-device-non-emi/CMakeLists.txt
similarity index 63%
rename from test/smoke-limbo/omptest-device-emi/CMakeLists.txt
rename to test/smoke-dev/omptest-device-non-emi/CMakeLists.txt
index e4d8cea929..7cc1ae7167 100644
--- a/test/smoke-limbo/omptest-device-emi/CMakeLists.txt
+++ b/test/smoke-dev/omptest-device-non-emi/CMakeLists.txt
@@ -18,15 +18,6 @@ message(STATUS "AOMP directory: '${AOMP_DIR}'")
# Retrieve package information from omptest
find_package(omptest REQUIRED)
-# Use default compiler values of omptest.
-set(CMAKE_C_COMPILER ${omptest_C_COMPILER})
-set(CMAKE_CXX_COMPILER ${omptest_CXX_COMPILER})
-message(STATUS " CMAKE_C_COMPILER: '${CMAKE_C_COMPILER}'")
-message(STATUS "CMAKE_CXX_COMPILER: '${CMAKE_CXX_COMPILER}'")
-
-# Make sure to include and esp. link directories before 'add_executable'
-include_directories(${omptest_INCLUDE_DIR})
-link_directories(${omptest_LIBRARY_ROOT})
add_executable(${PROJECT_NAME}
${PROJECT_NAME}.cpp)
@@ -37,7 +28,8 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
# Link
# Note: omp[target] will be linked automatically because of the offload options
-target_link_libraries(${PROJECT_NAME} PRIVATE ${OFFLOAD_OPTIONS} omptest)
+target_link_libraries(${PROJECT_NAME} PRIVATE
+ ${OFFLOAD_OPTIONS} omptest::omptest)
-# Notify: this test does not use GoogleTest
-message(STATUS "GoogleTest: OFF")
+# Notify: Test either uses GoogleTest-based ompTest or 'standalone'
+message(STATUS "Standalone: ${LIBOMPTEST_BUILD_STANDALONE}")
diff --git a/test/smoke-limbo/omptest-device-non-emi/Makefile b/test/smoke-dev/omptest-device-non-emi/Makefile
similarity index 96%
rename from test/smoke-limbo/omptest-device-non-emi/Makefile
rename to test/smoke-dev/omptest-device-non-emi/Makefile
index 253ed72663..aa1a595263 100644
--- a/test/smoke-limbo/omptest-device-non-emi/Makefile
+++ b/test/smoke-dev/omptest-device-non-emi/Makefile
@@ -22,4 +22,4 @@ CC = $(DUMMYSRC) | $(OMP_BIN) $(DUMMYOPT)
include ../Makefile.rules
clean::
- git clean -dfx ./build
+ rm -rf ./build
diff --git a/test/smoke-limbo/omptest-device-non-emi/omptest-device-non-emi.cpp b/test/smoke-dev/omptest-device-non-emi/omptest-device-non-emi.cpp
similarity index 95%
rename from test/smoke-limbo/omptest-device-non-emi/omptest-device-non-emi.cpp
rename to test/smoke-dev/omptest-device-non-emi/omptest-device-non-emi.cpp
index 9d4fc171a0..7f93749b80 100644
--- a/test/smoke-limbo/omptest-device-non-emi/omptest-device-non-emi.cpp
+++ b/test/smoke-dev/omptest-device-non-emi/omptest-device-non-emi.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include "omp.h"
#include "OmptTester.h"
@@ -11,6 +15,32 @@ using namespace internal;
int c[X];
#pragma omp end declare target
+TEST(InitFiniSuite, DeviceLoad) {
+ OMPT_SUPPRESS_EVENT(EventTy::Target)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit)
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRequest);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferComplete);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRecord);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRecordDeallocation);
+
+ int N = 128;
+ int a[N];
+
+ for (int DeviceNum = 0; DeviceNum < omp_get_num_devices(); ++DeviceNum) {
+ // Even on multi-GPU systems, only default-device is immediately initialized
+ OMPT_ASSERT_SEQUENCE(DeviceLoad, /*DeviceNum=*/DeviceNum);
+
+#pragma omp target parallel for device(DeviceNum)
+ {
+ for (int j = 0; j < N; j++)
+ a[j] = 0;
+ }
+
+ OMPT_ASSERT_SYNC_POINT("After DeviceLoad " + std::to_string(DeviceNum));
+ }
+}
+
TEST(VeccopyCallbacks, OnDeviceDefaultTeams_Sequenced) {
OMPT_SUPPRESS_EVENT(EventTy::BufferRequest);
OMPT_SUPPRESS_EVENT(EventTy::BufferComplete);
@@ -561,7 +591,49 @@ TEST(DataOpTests, ExplicitAllocatorAndUpdate_DataOpStack) {
omp_target_free(d_a, omp_get_default_device());
}
-TEST_XFAIL(DataOpTests, ExplicitAllocatorMultiDevice) {
+TEST(DataOpTests, ExplicitAllocationTimeNonZero) {
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRequest);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferComplete);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRecordDeallocation);
+ OMPT_SUPPRESS_EVENT(EventTy::Target);
+ OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit);
+ OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp);
+
+ const int N = 1000;
+ int *d_a=nullptr;
+ auto DataSize = N * sizeof(int);
+
+ OMPT_ASSERT_SET(BufferRecord, CB_DATAOP, ALLOC, DataSize, 1);
+ OMPT_ASSERT_SET(BufferRecord, CB_DATAOP, DELETE, 0);
+
+ d_a = (int *)omp_target_alloc(DataSize, omp_get_default_device());
+ omp_target_free(d_a, omp_get_default_device());
+
+ OMPT_ASSERT_SYNC_POINT("After de-alloc");
+}
+
+TEST(DataOpTestsPass, ExplicitDeallocationTimeNonZero) {
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRequest);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferComplete);
+ OMPT_SUPPRESS_EVENT(EventTy::BufferRecordDeallocation);
+ OMPT_SUPPRESS_EVENT(EventTy::Target);
+ OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit);
+ OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp);
+
+ const int N = 1000;
+ int *d_a=nullptr;
+ auto DataSize = N * sizeof(int);
+
+ OMPT_ASSERT_SET(BufferRecord, CB_DATAOP, ALLOC, DataSize);
+ OMPT_ASSERT_SET(BufferRecord, CB_DATAOP, DELETE, 0, 1);
+
+ d_a = (int *)omp_target_alloc(DataSize, omp_get_default_device());
+ omp_target_free(d_a, omp_get_default_device());
+
+ OMPT_ASSERT_SYNC_POINT("After de-alloc");
+}
+
+TEST_XFAIL(DataOpTestsFail, ExplicitAllocatorMultiDevice) {
OMPT_SUPPRESS_EVENT(EventTy::BufferRequest);
OMPT_SUPPRESS_EVENT(EventTy::BufferComplete);
OMPT_SUPPRESS_EVENT(EventTy::BufferRecord);
@@ -913,34 +985,4 @@ TEST(VeccopyTraces, OnDeviceCallbacks_teams_distribute_parallel_for_nowait_w_tim
}
}
-// FIXME: Leave this suite here, so it gets discovered last and executed first.
-TEST(InitFiniSuite, DeviceLoad) {
- OMPT_SUPPRESS_EVENT(EventTy::Target)
- OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp)
- OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit)
- OMPT_SUPPRESS_EVENT(EventTy::BufferRequest);
- OMPT_SUPPRESS_EVENT(EventTy::BufferComplete);
- OMPT_SUPPRESS_EVENT(EventTy::BufferRecord);
- OMPT_SUPPRESS_EVENT(EventTy::BufferRecordDeallocation);
-
- int N = 128;
- int a[N];
-
- for (int DeviceNum = 0; DeviceNum < omp_get_num_devices(); ++DeviceNum) {
- // Even on multi-GPU systems, only default-device is immediately initialized
- OMPT_ASSERT_SEQUENCE(DeviceLoad, /*DeviceNum=*/DeviceNum);
-
-#pragma omp target parallel for device(DeviceNum)
- {
- for (int j = 0; j < N; j++)
- a[j] = 0;
- }
-
- OMPT_ASSERT_SYNC_POINT("After DeviceLoad " + std::to_string(DeviceNum));
- }
-}
-
-int main(int argc, char **argv) {
- Runner R;
- return R.run();
-}
+OMPTEST_TESTSUITE_MAIN()
diff --git a/test/smoke-limbo/omptest-device-non-emi/performBuildRun.sh b/test/smoke-dev/omptest-device-non-emi/performBuildRun.sh
similarity index 83%
rename from test/smoke-limbo/omptest-device-non-emi/performBuildRun.sh
rename to test/smoke-dev/omptest-device-non-emi/performBuildRun.sh
index ff8a36e696..861777d333 100755
--- a/test/smoke-limbo/omptest-device-non-emi/performBuildRun.sh
+++ b/test/smoke-dev/omptest-device-non-emi/performBuildRun.sh
@@ -1,3 +1,8 @@
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
#!/bin/bash
set -x
@@ -40,12 +45,14 @@ if [ ! -d ${AOMP_DIR} ]; then
fi
echo " >>> Clean ..."
-git clean -fdx ./${BUILD_DIR}
+rm -rf ./${BUILD_DIR}
echo " >>> Configure ..."
cmake -B ${BUILD_DIR} -S . \
-DAOMP_DIR=${AOMP_DIR} \
--DTGT_OFFLOAD_ARCH=${TGT_OFFLOAD_ARCH}
+-DTGT_OFFLOAD_ARCH=${TGT_OFFLOAD_ARCH} \
+-DCMAKE_C_COMPILER=${AOMP_DIR}/bin/clang \
+-DCMAKE_CXX_COMPILER=${AOMP_DIR}/bin/clang++
echo " >>> Build ..."
cmake --build ${BUILD_DIR} --clean-first --parallel || exit 1
diff --git a/test/smoke-limbo/omptest-device-non-emi/CMakeLists.txt b/test/smoke-dev/veccopy-ompt-target-cmake/CMakeLists.txt
similarity index 63%
rename from test/smoke-limbo/omptest-device-non-emi/CMakeLists.txt
rename to test/smoke-dev/veccopy-ompt-target-cmake/CMakeLists.txt
index e4d8cea929..7cc1ae7167 100644
--- a/test/smoke-limbo/omptest-device-non-emi/CMakeLists.txt
+++ b/test/smoke-dev/veccopy-ompt-target-cmake/CMakeLists.txt
@@ -18,15 +18,6 @@ message(STATUS "AOMP directory: '${AOMP_DIR}'")
# Retrieve package information from omptest
find_package(omptest REQUIRED)
-# Use default compiler values of omptest.
-set(CMAKE_C_COMPILER ${omptest_C_COMPILER})
-set(CMAKE_CXX_COMPILER ${omptest_CXX_COMPILER})
-message(STATUS " CMAKE_C_COMPILER: '${CMAKE_C_COMPILER}'")
-message(STATUS "CMAKE_CXX_COMPILER: '${CMAKE_CXX_COMPILER}'")
-
-# Make sure to include and esp. link directories before 'add_executable'
-include_directories(${omptest_INCLUDE_DIR})
-link_directories(${omptest_LIBRARY_ROOT})
add_executable(${PROJECT_NAME}
${PROJECT_NAME}.cpp)
@@ -37,7 +28,8 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
# Link
# Note: omp[target] will be linked automatically because of the offload options
-target_link_libraries(${PROJECT_NAME} PRIVATE ${OFFLOAD_OPTIONS} omptest)
+target_link_libraries(${PROJECT_NAME} PRIVATE
+ ${OFFLOAD_OPTIONS} omptest::omptest)
-# Notify: this test does not use GoogleTest
-message(STATUS "GoogleTest: OFF")
+# Notify: Test either uses GoogleTest-based ompTest or 'standalone'
+message(STATUS "Standalone: ${LIBOMPTEST_BUILD_STANDALONE}")
diff --git a/test/smoke-limbo/veccopy-ompt-target-cmake/Makefile b/test/smoke-dev/veccopy-ompt-target-cmake/Makefile
similarity index 96%
rename from test/smoke-limbo/veccopy-ompt-target-cmake/Makefile
rename to test/smoke-dev/veccopy-ompt-target-cmake/Makefile
index dd8b95b287..ef68b72c75 100644
--- a/test/smoke-limbo/veccopy-ompt-target-cmake/Makefile
+++ b/test/smoke-dev/veccopy-ompt-target-cmake/Makefile
@@ -21,4 +21,4 @@ CC = $(DUMMYSRC) | $(OMP_BIN) $(DUMMYOPT)
include ../Makefile.rules
clean::
- git clean -dfx ./build
+ rm -rf ./build
diff --git a/test/smoke-limbo/veccopy-ompt-target-cmake/performBuildRun.sh b/test/smoke-dev/veccopy-ompt-target-cmake/performBuildRun.sh
similarity index 82%
rename from test/smoke-limbo/veccopy-ompt-target-cmake/performBuildRun.sh
rename to test/smoke-dev/veccopy-ompt-target-cmake/performBuildRun.sh
index 7c50a93dcb..a3156cb80b 100755
--- a/test/smoke-limbo/veccopy-ompt-target-cmake/performBuildRun.sh
+++ b/test/smoke-dev/veccopy-ompt-target-cmake/performBuildRun.sh
@@ -1,4 +1,9 @@
#!/bin/bash
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
set -x
usage() { echo "Usage: $0 [-a ]" \
@@ -40,12 +45,14 @@ if [ ! -d ${AOMP_DIR} ]; then
fi
echo " >>> Clean ..."
-git clean -fdx ./${BUILD_DIR}
+rm -rf ./${BUILD_DIR}
echo " >>> Configure ..."
cmake -B ${BUILD_DIR} -S . \
-DAOMP_DIR=${AOMP_DIR} \
--DTGT_OFFLOAD_ARCH=${TGT_OFFLOAD_ARCH}
+-DTGT_OFFLOAD_ARCH=${TGT_OFFLOAD_ARCH} \
+-DCMAKE_C_COMPILER=${AOMP_DIR}/bin/clang \
+-DCMAKE_CXX_COMPILER=${AOMP_DIR}/bin/clang++
echo " >>> Build ..."
cmake --build ${BUILD_DIR} --clean-first --parallel || exit 1
@@ -53,4 +60,4 @@ cmake --build ${BUILD_DIR} --clean-first --parallel || exit 1
echo " >>> Run ..."
./${BUILD_DIR}/${PROJECT_NAME} || exit 1
-echo " >>> DONE!"
\ No newline at end of file
+echo " >>> DONE!"
diff --git a/test/smoke-limbo/veccopy-ompt-target-cmake/veccopy-ompt-target-cmake.cpp b/test/smoke-dev/veccopy-ompt-target-cmake/veccopy-ompt-target-cmake.cpp
similarity index 97%
rename from test/smoke-limbo/veccopy-ompt-target-cmake/veccopy-ompt-target-cmake.cpp
rename to test/smoke-dev/veccopy-ompt-target-cmake/veccopy-ompt-target-cmake.cpp
index eae0166b3a..588179e42a 100644
--- a/test/smoke-limbo/veccopy-ompt-target-cmake/veccopy-ompt-target-cmake.cpp
+++ b/test/smoke-dev/veccopy-ompt-target-cmake/veccopy-ompt-target-cmake.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include "OmptTester.h"
@@ -5,6 +9,24 @@
using namespace omptest;
using namespace internal;
+TEST(InitialTestSuite, uut_device_init_load) {
+ /* The Test Body */
+ OMPT_SUPPRESS_EVENT(EventTy::Target)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit)
+
+ int N = 128;
+ int a[N];
+
+ OMPT_ASSERT_SEQUENCE(DeviceLoad, /*DeviceNum=*/0)
+
+#pragma omp target parallel for
+ {
+ for (int j = 0; j < N; j++)
+ a[j] = 0;
+ }
+}
+
TEST_XFAIL(SequenceSuiteXFail, uut_target_xfail_wrong_order) {
/* The Test Body */
OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp)
@@ -216,28 +238,4 @@ TEST(SequenceSuite, veccopy_ompt_target) {
printf("Success\n");
}
-// FIXME: Leave this suite here, so it gets discovered last and executed first.
-TEST(InitialTestSuite, uut_device_init_load) {
- /* The Test Body */
- OMPT_SUPPRESS_EVENT(EventTy::Target)
- OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp)
- OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit)
-
- int N = 128;
- int a[N];
-
- OMPT_ASSERT_SEQUENCE(DeviceLoad, /*DeviceNum=*/0)
-
-#pragma omp target parallel for
- {
- for (int j = 0; j < N; j++)
- a[j] = 0;
- }
-}
-
-int main(int argc, char **argv) {
- Runner R;
- R.run();
-
- return 0;
-}
+OMPTEST_TESTSUITE_MAIN()
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-map/Makefile b/test/smoke-dev/veccopy-ompt-target-emi-map/Makefile
similarity index 100%
rename from test/smoke-limbo/veccopy-ompt-target-emi-map/Makefile
rename to test/smoke-dev/veccopy-ompt-target-emi-map/Makefile
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-map/veccopy-ompt-target-emi-map.c b/test/smoke-dev/veccopy-ompt-target-emi-map/veccopy-ompt-target-emi-map.c
similarity index 96%
rename from test/smoke-limbo/veccopy-ompt-target-emi-map/veccopy-ompt-target-emi-map.c
rename to test/smoke-dev/veccopy-ompt-target-emi-map/veccopy-ompt-target-emi-map.c
index 2f5c96f6b0..a7c87524de 100644
--- a/test/smoke-limbo/veccopy-ompt-target-emi-map/veccopy-ompt-target-emi-map.c
+++ b/test/smoke-dev/veccopy-ompt-target-emi-map/veccopy-ompt-target-emi-map.c
@@ -1,3 +1,6 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
#include
#include
#include
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-async/Makefile b/test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-async/Makefile
similarity index 100%
rename from test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-async/Makefile
rename to test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-async/Makefile
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-async/veccopy-ompt-target-emi-tracing-sync-async.c b/test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-async/veccopy-ompt-target-emi-tracing-sync-async.c
similarity index 99%
rename from test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-async/veccopy-ompt-target-emi-tracing-sync-async.c
rename to test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-async/veccopy-ompt-target-emi-tracing-sync-async.c
index 110363c9c7..c5579f989e 100644
--- a/test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-async/veccopy-ompt-target-emi-tracing-sync-async.c
+++ b/test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-async/veccopy-ompt-target-emi-tracing-sync-async.c
@@ -1,3 +1,7 @@
+
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
#include
#include
#include
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-force/Makefile b/test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-force/Makefile
similarity index 100%
rename from test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-force/Makefile
rename to test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-force/Makefile
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-force/veccopy-ompt-target-emi-tracing-sync-force.c b/test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-force/veccopy-ompt-target-emi-tracing-sync-force.c
similarity index 98%
rename from test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-force/veccopy-ompt-target-emi-tracing-sync-force.c
rename to test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-force/veccopy-ompt-target-emi-tracing-sync-force.c
index fd8bd91f1a..9df99790c9 100644
--- a/test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-force/veccopy-ompt-target-emi-tracing-sync-force.c
+++ b/test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-force/veccopy-ompt-target-emi-tracing-sync-force.c
@@ -1,3 +1,6 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
#include
#include
#include
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-size/Makefile b/test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-size/Makefile
similarity index 100%
rename from test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-size/Makefile
rename to test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-size/Makefile
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-size/veccopy-ompt-target-emi-tracing-sync-size.c b/test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-size/veccopy-ompt-target-emi-tracing-sync-size.c
similarity index 98%
rename from test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-size/veccopy-ompt-target-emi-tracing-sync-size.c
rename to test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-size/veccopy-ompt-target-emi-tracing-sync-size.c
index fd8bd91f1a..775508d17b 100644
--- a/test/smoke-limbo/veccopy-ompt-target-emi-tracing-sync-size/veccopy-ompt-target-emi-tracing-sync-size.c
+++ b/test/smoke-dev/veccopy-ompt-target-emi-tracing-sync-size/veccopy-ompt-target-emi-tracing-sync-size.c
@@ -1,3 +1,7 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
#include
#include
#include
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-tracing/Makefile b/test/smoke-dev/veccopy-ompt-target-emi-tracing/Makefile
similarity index 100%
rename from test/smoke-limbo/veccopy-ompt-target-emi-tracing/Makefile
rename to test/smoke-dev/veccopy-ompt-target-emi-tracing/Makefile
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi-tracing/veccopy-ompt-target-emi-tracing.c b/test/smoke-dev/veccopy-ompt-target-emi-tracing/veccopy-ompt-target-emi-tracing.c
similarity index 98%
rename from test/smoke-limbo/veccopy-ompt-target-emi-tracing/veccopy-ompt-target-emi-tracing.c
rename to test/smoke-dev/veccopy-ompt-target-emi-tracing/veccopy-ompt-target-emi-tracing.c
index fd8bd91f1a..775508d17b 100644
--- a/test/smoke-limbo/veccopy-ompt-target-emi-tracing/veccopy-ompt-target-emi-tracing.c
+++ b/test/smoke-dev/veccopy-ompt-target-emi-tracing/veccopy-ompt-target-emi-tracing.c
@@ -1,3 +1,7 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
#include
#include
#include
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi/Makefile b/test/smoke-dev/veccopy-ompt-target-emi/Makefile
similarity index 100%
rename from test/smoke-limbo/veccopy-ompt-target-emi/Makefile
rename to test/smoke-dev/veccopy-ompt-target-emi/Makefile
diff --git a/test/smoke-limbo/veccopy-ompt-target-emi/veccopy-ompt-target-emi.c b/test/smoke-dev/veccopy-ompt-target-emi/veccopy-ompt-target-emi.c
similarity index 96%
rename from test/smoke-limbo/veccopy-ompt-target-emi/veccopy-ompt-target-emi.c
rename to test/smoke-dev/veccopy-ompt-target-emi/veccopy-ompt-target-emi.c
index ff4993e990..15a4fe963b 100644
--- a/test/smoke-limbo/veccopy-ompt-target-emi/veccopy-ompt-target-emi.c
+++ b/test/smoke-dev/veccopy-ompt-target-emi/veccopy-ompt-target-emi.c
@@ -1,3 +1,6 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
#include
#include
#include
diff --git a/test/smoke-limbo/veccopy-ompt-target-map/Makefile b/test/smoke-dev/veccopy-ompt-target-map/Makefile
similarity index 100%
rename from test/smoke-limbo/veccopy-ompt-target-map/Makefile
rename to test/smoke-dev/veccopy-ompt-target-map/Makefile
diff --git a/test/smoke-limbo/veccopy-ompt-target-map/veccopy-ompt-target-map.c b/test/smoke-dev/veccopy-ompt-target-map/veccopy-ompt-target-map.c
similarity index 96%
rename from test/smoke-limbo/veccopy-ompt-target-map/veccopy-ompt-target-map.c
rename to test/smoke-dev/veccopy-ompt-target-map/veccopy-ompt-target-map.c
index 030d01f1e1..9c9f435381 100644
--- a/test/smoke-limbo/veccopy-ompt-target-map/veccopy-ompt-target-map.c
+++ b/test/smoke-dev/veccopy-ompt-target-map/veccopy-ompt-target-map.c
@@ -1,3 +1,7 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
#include
#include
diff --git a/test/smoke-limbo/veccopy-ompt-target/Makefile b/test/smoke-dev/veccopy-ompt-target/Makefile
similarity index 100%
rename from test/smoke-limbo/veccopy-ompt-target/Makefile
rename to test/smoke-dev/veccopy-ompt-target/Makefile
diff --git a/test/smoke-limbo/veccopy-ompt-target/veccopy-ompt-target.c b/test/smoke-dev/veccopy-ompt-target/veccopy-ompt-target.c
similarity index 96%
rename from test/smoke-limbo/veccopy-ompt-target/veccopy-ompt-target.c
rename to test/smoke-dev/veccopy-ompt-target/veccopy-ompt-target.c
index 7ad3a98794..8aad4539f3 100644
--- a/test/smoke-limbo/veccopy-ompt-target/veccopy-ompt-target.c
+++ b/test/smoke-dev/veccopy-ompt-target/veccopy-ompt-target.c
@@ -1,3 +1,7 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
#include
#include
diff --git a/test/smoke-dev/xteam-red-min-max-float-multi-device/Makefile b/test/smoke-dev/xteam-red-min-max-float-multi-device/Makefile
index 4927838c2a..d90453c20c 100644
--- a/test/smoke-dev/xteam-red-min-max-float-multi-device/Makefile
+++ b/test/smoke-dev/xteam-red-min-max-float-multi-device/Makefile
@@ -4,7 +4,7 @@ TESTNAME = xteam-red-min-max-float-multi-device
TESTSRC_MAIN = xteam-red-min-max-float-multi-device.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-RUNENV += HSA_XNACK=1 OMPX_APU_MAPS=1 LIBOMPTARGET_NUM_MULTI_DEVICES=1
+RUNENV += HSA_XNACK=1 OMPX_APU_MAPS=1 LIBOMPTARGET_NUM_MULTI_DEVICES=1 LIBOMPTARGET_KERNEL_TRACE=1
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
diff --git a/test/smoke-dev/xteam-scan-1/xteam_scan_1.cpp b/test/smoke-dev/xteam-scan-1/xteam_scan_1.cpp
index fb18b2addf..e7a9c5ec4e 100644
--- a/test/smoke-dev/xteam-scan-1/xteam_scan_1.cpp
+++ b/test/smoke-dev/xteam-scan-1/xteam_scan_1.cpp
@@ -17,7 +17,7 @@ void run_test() {
T sum1 = T(0);
-#pragma omp target teams distribute parallel for reduction(inscan, +:sum1) map(tofrom: in[0:N], out1[0:N])
+#pragma omp target teams distribute parallel for reduction(inscan, +:sum1) map(tofrom: in[0:N], out1[0:N]) num_threads(1024)
for (int i = 0; i < N; i++) {
sum1 += in[i]; // input phase
#pragma omp scan inclusive(sum1)
@@ -37,7 +37,7 @@ void run_test() {
T sum2 = T(0);
-#pragma omp target teams distribute parallel for reduction(inscan, +:sum2) map(tofrom: in[0:N], out2[0:N])
+#pragma omp target teams distribute parallel for reduction(inscan, +:sum2) map(tofrom: in[0:N], out2[0:N]) num_threads(1024)
for (int i = 0; i < N; i++) {
out2[i] = sum2; // scan phase
#pragma omp scan exclusive(sum2)
@@ -196,4 +196,4 @@ int main() {
/// CHECK: Testing for datatype float
/// CHECK: Inclusive Scan: Success!
-/// CHECK: Exclusive Scan: Success!
\ No newline at end of file
+/// CHECK: Exclusive Scan: Success!
diff --git a/test/smoke-dev/zero-copy-xnack-enable-dgpu-map-disable-apu/zero_copy.cpp b/test/smoke-dev/zero-copy-xnack-enable-dgpu-map-disable-apu/zero_copy.cpp
index 06961db90a..c196d09a3b 100644
--- a/test/smoke-dev/zero-copy-xnack-enable-dgpu-map-disable-apu/zero_copy.cpp
+++ b/test/smoke-dev/zero-copy-xnack-enable-dgpu-map-disable-apu/zero_copy.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
// When OMPX_DGPU_MAPS=0 and HSA_XNACK=1, it performs zero-copy on APU.
diff --git a/test/smoke-dev/zero-copy-xnack-enable-dgpu-map-enable-apu/zero_copy.cpp b/test/smoke-dev/zero-copy-xnack-enable-dgpu-map-enable-apu/zero_copy.cpp
index 2db5e038c7..71876d4d8d 100644
--- a/test/smoke-dev/zero-copy-xnack-enable-dgpu-map-enable-apu/zero_copy.cpp
+++ b/test/smoke-dev/zero-copy-xnack-enable-dgpu-map-enable-apu/zero_copy.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
// When OMPX_DGPU_MAPS=1 and HSA_XNACK=1, it performs copy on APU.
diff --git a/test/smoke-fails/FNew-flang-tracekernel/Makefile b/test/smoke-fails/FNew-flang-tracekernel/Makefile
index 7910771061..b697f44ee1 100644
--- a/test/smoke-fails/FNew-flang-tracekernel/Makefile
+++ b/test/smoke-fails/FNew-flang-tracekernel/Makefile
@@ -16,8 +16,7 @@ CC = $(OMP_BIN) $(VERBOSE)
LIBPATH = $(AOMPHIP)/lib:/opt/rocm/lib
RUNENV += PATH=$(ROCM)/bin:$(PATH) LD_LIBRARY_PATH=$(LIBPATH):$(LD_LIBRARY_PATH) LIBOMPTARGET_KERNEL_TRACE=2
-RUNPROF = $(AOMPHIP)/bin/rocprof
-RUNPROF_FLAGS = --roctx-trace --sys-trace
+RUNPROF = $(AOMPHIP)/bin/rocprofv3 --output-format csv --marker-trace --runtime-trace --stats --
UNSUPPORTED = ASAN_COMPILE
diff --git a/test/smoke-fails/FNew-use_device_ptr/fortran_callable_init.hip b/test/smoke-fails/FNew-use_device_ptr/fortran_callable_init.hip
index a6bd393bce..72fef8ca74 100644
--- a/test/smoke-fails/FNew-use_device_ptr/fortran_callable_init.hip
+++ b/test/smoke-fails/FNew-use_device_ptr/fortran_callable_init.hip
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include "hip/hip_runtime.h"
#include
__global__ void init_array(float *arr1){
diff --git a/test/smoke-fails/Makefile b/test/smoke-fails/Makefile
index cc5de6a0e1..c353bf7252 100644
--- a/test/smoke-fails/Makefile
+++ b/test/smoke-fails/Makefile
@@ -1,67 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- alt_clang \
- alt_veclib \
- ancestorF \
- aomp_mappings \
- bugz-50967 \
- clang-274983-2 \
- clang-280954 \
- clang-284324 \
- clang-296953-ornla-38 \
- clang-317896 \
- clang-326105 \
- clang-440121 \
- clang_llnl-58 \
- clang_llnl-58-1 \
- clang-nwchem-s1_1 \
- clang-reduction-and \
- closed_bug1 \
- const_global_ctor-308039 \
- exp-303973 \
- flang-251450 \
- flang-272343-3 \
- flang-272534-2 \
- flang-272534-3 \
- flang-274773 \
- flang-273990-1 \
- flang-275472 \
- flang-275472-O0 \
- flang-288183 \
- flang-288641 \
- flang-289039 \
- flang-305550 \
- flang-305553 \
- flang-313435 \
- flang-315455 \
- flang-318074 \
- flang-320332 \
- flang-320332-2 \
- flang-321838 \
- flang-321838-2 \
- flang-322947 \
- flang-324206 \
- flang-324387 \
- flang-324643 \
- flang-325095 \
- flang-329920 \
- flang-351976 \
- flang-flags-308205 \
- flang_atomic_hint \
- flang_dev_write \
- helloworld%n \
- lds-prob4 \
- lds-prob5 \
- memory_mgmt_pinned_predefined \
- nwchem-s1_1 \
- requires_directive \
- targ_static \
- targc-273739 \
- target_teams_reduction \
- target-shared-variables \
- tasks
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/smoke-fails/aomp-issue374/aomp-issue374.cpp b/test/smoke-fails/aomp-issue374/aomp-issue374.cpp
index 5572516f45..ba83b29e12 100644
--- a/test/smoke-fails/aomp-issue374/aomp-issue374.cpp
+++ b/test/smoke-fails/aomp-issue374/aomp-issue374.cpp
@@ -1,4 +1,4 @@
-/* Based on https://github.com/ROCm-Developer-Tools/aomp/issues/374 */
+/* Based on https://github.com/ROCm/aomp/issues/374 */
#include
#include
diff --git a/test/smoke-fails/atomic-contended/performBuildRun.sh b/test/smoke-fails/atomic-contended/performBuildRun.sh
index f0c97712b7..db91303899 100755
--- a/test/smoke-fails/atomic-contended/performBuildRun.sh
+++ b/test/smoke-fails/atomic-contended/performBuildRun.sh
@@ -87,11 +87,11 @@ if [[ -z ${LLVMIR} && -z ${ASSEMBLY} ]]; then
# Generate AMDGPU assembly files, format output and then filecheck for the
# expected instructions within the embedded object.
echo " > FileChecks"
- ${GEN_ASM_DPP} -o - | ${EXTRACT_EMBEDDED} | ${AOMP}/bin/FileCheck $TESTSRC \
+ ${GEN_ASM_DPP} -o - | ${EXTRACT_EMBEDDED} | $FILECHECK $TESTSRC \
--check-prefix=DPP || exit 1
- ${GEN_ASM_ITER} -o - | ${EXTRACT_EMBEDDED} | ${AOMP}/bin/FileCheck $TESTSRC \
+ ${GEN_ASM_ITER} -o - | ${EXTRACT_EMBEDDED} | $FILECHECK $TESTSRC \
--check-prefix=ITERATIVE || exit 1
- ${GEN_ASM_NONE} -o - | ${EXTRACT_EMBEDDED} | ${AOMP}/bin/FileCheck $TESTSRC \
+ ${GEN_ASM_NONE} -o - | ${EXTRACT_EMBEDDED} | $FILECHECK $TESTSRC \
--check-prefix=NONE || exit 1
# Compile and execute. Performing a simple check for an expected result.
diff --git a/test/smoke-fails/big-jump-loop-nonrect-collapse/big_jump_loop_nonrect_collapse.cpp b/test/smoke-fails/big-jump-loop-nonrect-collapse/big_jump_loop_nonrect_collapse.cpp
index 888aa02dae..0d52a67156 100644
--- a/test/smoke-fails/big-jump-loop-nonrect-collapse/big_jump_loop_nonrect_collapse.cpp
+++ b/test/smoke-fails/big-jump-loop-nonrect-collapse/big_jump_loop_nonrect_collapse.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
@@ -125,8 +129,8 @@ int main() {
return errors != 0;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
/// CHECK: SUCCESS
diff --git a/test/smoke-fails/clang-298140/NPB_LU/MG/.buildit.swp b/test/smoke-fails/clang-298140/NPB_LU/MG/.buildit.swp
deleted file mode 100644
index 2f1fa8fe37..0000000000
Binary files a/test/smoke-fails/clang-298140/NPB_LU/MG/.buildit.swp and /dev/null differ
diff --git a/test/smoke-fails/clang-506539/clang-506539.cpp b/test/smoke-fails/clang-506539/clang-506539.cpp
index b8e031d0cd..5293493d41 100644
--- a/test/smoke-fails/clang-506539/clang-506539.cpp
+++ b/test/smoke-fails/clang-506539/clang-506539.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-dev/clang-ifaces/Makefile b/test/smoke-fails/clang-ifaces/Makefile
similarity index 100%
rename from test/smoke-dev/clang-ifaces/Makefile
rename to test/smoke-fails/clang-ifaces/Makefile
diff --git a/test/smoke-dev/clang-ifaces/clang-ifaces.c b/test/smoke-fails/clang-ifaces/clang-ifaces.c
similarity index 85%
rename from test/smoke-dev/clang-ifaces/clang-ifaces.c
rename to test/smoke-fails/clang-ifaces/clang-ifaces.c
index 6d29f656c3..2b588c0629 100644
--- a/test/smoke-dev/clang-ifaces/clang-ifaces.c
+++ b/test/smoke-fails/clang-ifaces/clang-ifaces.c
@@ -1,3 +1,7 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
#include
#include
diff --git a/test/smoke-fails/cuda_arch/cuda_arch.c b/test/smoke-fails/cuda_arch/cuda_arch.c
index 0ecd9c6809..e4d278697f 100644
--- a/test/smoke-fails/cuda_arch/cuda_arch.c
+++ b/test/smoke-fails/cuda_arch/cuda_arch.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
//#include
int main(int argc, char **argv) {
diff --git a/test/smoke-fails/flang-314750/NPB_FT/sys/setparams b/test/smoke-fails/flang-314750/NPB_FT/sys/setparams
index 7820518620..919990e915 100755
Binary files a/test/smoke-fails/flang-314750/NPB_FT/sys/setparams and b/test/smoke-fails/flang-314750/NPB_FT/sys/setparams differ
diff --git a/test/smoke-fails/gpus/gpus.c b/test/smoke-fails/gpus/gpus.c
index 8cc302974f..11c0460837 100644
--- a/test/smoke-fails/gpus/gpus.c
+++ b/test/smoke-fails/gpus/gpus.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
// Copy of helloworld smoke test to verify compile/link for all GPUs
// in the GFXLIST located in aomp_common_vars.
diff --git a/test/smoke-fails/hsa-lazy-queues/Makefile b/test/smoke-fails/hsa-lazy-queues/Makefile
index c1ce09cec0..b179b1bed4 100644
--- a/test/smoke-fails/hsa-lazy-queues/Makefile
+++ b/test/smoke-fails/hsa-lazy-queues/Makefile
@@ -5,12 +5,7 @@ TESTSRC_MAIN = async-events.cpp
TESTSRC_AUX = empty-sink.c
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-AOMPROCM ?= $(AOMPHIP)
-ifneq (,$(wildcard $(AOMPROCM)/bin/rocprof))
- RUNPROF = $(AOMPROCM)/bin/rocprof
-else
- RUNPROF = $(AOMPROCM)/../bin/rocprof
-endif
+RUNPROF = $(AOMPHIP)/bin/rocprofv3
# If 'ROCR_VISIBLE_DEVICES' is empty, default to zero. Otherwise, split on ','
# and use the first device marked visible by the environmental variable. The
@@ -23,7 +18,7 @@ else
RUNENV = ROCR_VISIBLE_DEVICES=$(DEVICE)
endif
-RUNPROF_FLAGS = --hsa-trace
+RUNPROF_FLAGS = -o results.json --output-format json --hsa-trace True --stats True --
RUNENV += OMP_NUM_THREADS=2 LIBOMPTARGET_AMDGPU_HSA_QUEUE_BUSY_TRACKING=1
RUNCMD = ./$(TESTNAME) && python3 countQueueCreateEvents.py 2
diff --git a/test/smoke-fails/hsa-lazy-queues/countQueueCreateEvents.py b/test/smoke-fails/hsa-lazy-queues/countQueueCreateEvents.py
index d3c4bfe3a9..ae5783367e 100644
--- a/test/smoke-fails/hsa-lazy-queues/countQueueCreateEvents.py
+++ b/test/smoke-fails/hsa-lazy-queues/countQueueCreateEvents.py
@@ -7,26 +7,33 @@
parser = argparse.ArgumentParser()
parser.add_argument('num_occurences', type=int, help='How many hsa_queue_create events are expected')
-filename = 'results.json'
+filename = 'results.json_results.json'
hsa_queue_create_name = 'hsa_queue_create'
def searchAndCount(TheJSON, args) -> None:
- TraceEvents = TheJSON['traceEvents']
+ Data = TheJSON['rocprofiler-sdk-tool']
+ for D in Data:
+ if 'summary' in D:
+ Summary = D['summary']
- ExpectedNumOccurs = args.num_occurences
- NumOccurs = 0
- for e in TraceEvents:
- if len(e) == 0:
+ for E in Summary:
+ if E['domain'] != 'HSA_API':
continue
- if e['name'] == hsa_queue_create_name:
- NumOccurs += 1
+ Stats = E['stats']
+ Ops = Stats['operations']
+ for Op in Ops:
+ if Op['key'] == hsa_queue_create_name:
+ NumOccur = Op['value']['count']
+ # Return error if numbers don't match
+ sys.exit(NumOccur - args.num_occurences)
- if NumOccurs != ExpectedNumOccurs:
- sys.exit(1)
+ # When not found
+ sys.exit(1)
if __name__ == '__main__':
args = parser.parse_args()
+ print("Reading JSON file:", filename)
with open(filename, "r") as f:
J = json.load(f)
searchAndCount(J, args)
diff --git a/test/smoke-fails/iteam-red-1/iteam_red_1.c b/test/smoke-fails/iteam-red-1/iteam_red_1.c
index ebb3aa90da..74f7835b2a 100644
--- a/test/smoke-fails/iteam-red-1/iteam_red_1.c
+++ b/test/smoke-fails/iteam-red-1/iteam_red_1.c
@@ -35,11 +35,15 @@ void vmul_omp(double*a, double*b, double*c, int N) {
}
void vmul_sim(double*a, double*b, double*c, int N) {
-#pragma omp target map(to: a[0:N], b[0:N]) map(from:c[0:N])
+// The number of threads launched must match the tripcount of the k-loop.
+// The best way to (almost) guarantee that is to use the thread_limit clause
+// on the target construct. The num_threads clause on the inner parallel construct has
+// no effect since the OpenMP runtime is not fed that information from the inner parallel.
+#pragma omp target map(to: a[0:N], b[0:N]) map(from:c[0:N]) thread_limit(NUM_THREADS)
#pragma omp teams distribute
for(int i=0; i
#include
@@ -125,8 +129,8 @@ int main() {
return errors != 0;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
/// CHECK: SUCCESS
diff --git a/test/smoke-fails/nwchem-s1_1/printTime.py b/test/smoke-fails/nwchem-s1_1/printTime.py
deleted file mode 100644
index c1bc73696b..0000000000
--- a/test/smoke-fails/nwchem-s1_1/printTime.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Python program to print the TotalDurationsNs in file: result.stats.csv.
-#
-# Example:
-#
-# "Name","Calls","TotalDurationNs","AverageNs","Percentage"
-# "__nv_tgt_sd_t_s1_1__TARGET_F1L23_1_.kd",1,4540333,4540333,100.0
-#
-
-f = open("results.stats.csv", "r")
-for line in f:
- if line.startswith("\"Name\""):
- continue
- pList = line.split(",")
- TotalDurationNS = pList[2]
- print("Runtime: ", TotalDurationNS, "nanoseconds")
diff --git a/test/smoke-fails/omp_lock/omp_lock.c b/test/smoke-fails/omp_lock/omp_lock.c
index 78f3193965..141c758af3 100644
--- a/test/smoke-fails/omp_lock/omp_lock.c
+++ b/test/smoke-fails/omp_lock/omp_lock.c
@@ -1,3 +1,8 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT
+*/
+
#include
#include
diff --git a/test/smoke-fails/omptest-testsuite-emi-tracing/omptest_testsuite_emi_tracing.cpp b/test/smoke-fails/omptest-testsuite-emi-tracing/omptest_testsuite_emi_tracing.cpp
index e5b1dae8a2..de1176cc63 100644
--- a/test/smoke-fails/omptest-testsuite-emi-tracing/omptest_testsuite_emi_tracing.cpp
+++ b/test/smoke-fails/omptest-testsuite-emi-tracing/omptest_testsuite_emi_tracing.cpp
@@ -15,6 +15,20 @@ ompt_set_result_t libomptarget_ompt_set_trace_ompt(int DeviceId,
using namespace omptest;
using namespace internal;
+// Place this suite at the top, so it gets discovered and executed first.
+TEST(InitialTestSuite, uut_device_init_load_multi_gpu) {
+ // We only want to assert on DeviceLoads: ignore other events
+ OMPT_ASSERT_SET_MODE_RELAXED()
+
+ for (int i = 0; i < omp_get_num_devices(); ++i) {
+ OMPT_ASSERT_SET(DeviceLoad, /*DeviceNum=*/i)
+#pragma omp target device(i)
+ {
+ ;
+ }
+ }
+}
+
TEST(MultiGPUTracingSuite, uut_device_set_trace_disabled) {
int N = 128;
int a[N];
@@ -251,9 +265,9 @@ TEST(MultiGPUTracingSuite, uut_device_set_trace_target_submit) {
}
}
-TEST(DisabledSuite, DISABLED_uut_target_disabled) {
- assert(false && "This test should have been disabled");
-}
+// TEST(DisabledSuite, DISABLED_uut_target_disabled) {
+// assert(false && "This test should have been disabled");
+// }
TEST(SequenceAssertion, uut_target_sequence) {
int N = 128;
@@ -532,23 +546,4 @@ TEST(MixedAssertionSuite, uut_target_sequence_and_set) {
printf("Success\n");
}
-// Leave this suite down here so it gets discovered last and executed first.
-TEST(InitialTestSuite, uut_device_init_load_multi_gpu) {
- // We only want to assert on DeviceLoads: ignore other events
- OMPT_ASSERT_SET_MODE_RELAXED()
-
- for (int i = 0; i < omp_get_num_devices(); ++i) {
- OMPT_ASSERT_SET(DeviceLoad, /*DeviceNum=*/i)
-#pragma omp target device(i)
- {
- ;
- }
- }
-}
-
-#ifndef LIBOFFLOAD_LIBOMPTEST_USE_GOOGLETEST
-int main(int argc, char **argv) {
- Runner R;
- return R.run();
-}
-#endif
+OMPTEST_TESTSUITE_MAIN()
diff --git a/test/smoke-fails/omptest-testsuite-emi/omptest_testsuite_emi.cpp b/test/smoke-fails/omptest-testsuite-emi/omptest_testsuite_emi.cpp
index f4ee190200..6f54f74511 100644
--- a/test/smoke-fails/omptest-testsuite-emi/omptest_testsuite_emi.cpp
+++ b/test/smoke-fails/omptest-testsuite-emi/omptest_testsuite_emi.cpp
@@ -5,6 +5,25 @@
using namespace omptest;
using namespace internal;
+// Place this suite at the top, so it gets discovered and executed first.
+TEST(InitialTestSuite, uut_device_init_load) {
+ /* The Test Body */
+ OMPT_SUPPRESS_EVENT(EventTy::TargetEmi)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetDataOpEmi)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetSubmitEmi)
+
+ int N = 128;
+ int a[N];
+
+ OMPT_ASSERT_SET(DeviceLoad, /*DeviceNum=*/0)
+
+#pragma omp target parallel for
+ {
+ for (int j = 0; j < N; j++)
+ a[j] = 0;
+ }
+}
+
TEST(SequenceSuite, uut_target) {
/* The Test Body */
OMPT_SUPPRESS_EVENT(EventTy::TargetDataOpEmi)
@@ -111,7 +130,7 @@ TEST(SetSuite, uut_target) {
}
}
-TEST_XFAIL(SetSuite, uut_target_xfail_banned_begin_end) {
+TEST_XFAIL(SetSuiteFail, uut_target_xfail_banned_begin_end) {
/* The Test Body */
int N = 128;
int a[N];
@@ -382,26 +401,4 @@ TEST(SequenceSuite, veccopy_ompt_target) {
printf("Success\n");
}
-// Leave this suite down here so it gets discovered last and executed first.
-TEST(InitialTestSuite, uut_device_init_load) {
- /* The Test Body */
- OMPT_SUPPRESS_EVENT(EventTy::TargetEmi)
- OMPT_SUPPRESS_EVENT(EventTy::TargetDataOpEmi)
- OMPT_SUPPRESS_EVENT(EventTy::TargetSubmitEmi)
-
- int N = 128;
- int a[N];
-
- OMPT_ASSERT_SET(DeviceLoad, /*DeviceNum=*/0)
-
-#pragma omp target parallel for
- {
- for (int j = 0; j < N; j++)
- a[j] = 0;
- }
-}
-
-int main(int argc, char **argv) {
- Runner R;
- return R.run();
-}
+OMPTEST_TESTSUITE_MAIN()
diff --git a/test/smoke-fails/omptest-testsuite/omptest_testsuite.cpp b/test/smoke-fails/omptest-testsuite/omptest_testsuite.cpp
index be7272f70b..5eff8ba1c4 100644
--- a/test/smoke-fails/omptest-testsuite/omptest_testsuite.cpp
+++ b/test/smoke-fails/omptest-testsuite/omptest_testsuite.cpp
@@ -5,7 +5,26 @@
using namespace omptest;
using namespace internal;
-TEST_XFAIL(SequenceSuite, uut_target_xfail_wrong_order) {
+// Place this suite at the top, so it gets discovered and executed first.
+TEST(InitialTestSuite, uut_device_init_load) {
+ /* The Test Body */
+ OMPT_SUPPRESS_EVENT(EventTy::Target)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp)
+ OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit)
+
+ int N = 128;
+ int a[N];
+
+ OMPT_ASSERT_SEQUENCE(DeviceLoad, /*DeviceNum=*/0)
+
+#pragma omp target parallel for
+ {
+ for (int j = 0; j < N; j++)
+ a[j] = 0;
+ }
+}
+
+TEST_XFAIL(SequenceSuiteFail, uut_target_xfail_wrong_order) {
/* The Test Body */
OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp)
OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit)
@@ -26,7 +45,7 @@ TEST_XFAIL(SequenceSuite, uut_target_xfail_wrong_order) {
}
}
-TEST_XFAIL(SequenceSuite, uut_target_xfail_banned_begin_end) {
+TEST_XFAIL(SequenceSuiteFail, uut_target_xfail_banned_begin_end) {
/* The Test Body */
OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp)
OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit)
@@ -216,26 +235,4 @@ TEST(SequenceSuite, veccopy_ompt_target) {
printf("Success\n");
}
-// Leave this suite down here so it gets discovered last and executed first.
-TEST(InitialTestSuite, uut_device_init_load) {
- /* The Test Body */
- OMPT_SUPPRESS_EVENT(EventTy::Target)
- OMPT_SUPPRESS_EVENT(EventTy::TargetDataOp)
- OMPT_SUPPRESS_EVENT(EventTy::TargetSubmit)
-
- int N = 128;
- int a[N];
-
- OMPT_ASSERT_SEQUENCE(DeviceLoad, /*DeviceNum=*/0)
-
-#pragma omp target parallel for
- {
- for (int j = 0; j < N; j++)
- a[j] = 0;
- }
-}
-
-int main(int argc, char **argv) {
- Runner R;
- return R.run();
-}
+OMPTEST_TESTSUITE_MAIN()
diff --git a/test/smoke-fails/omptest-unittest/omptest.cpp b/test/smoke-fails/omptest-unittest/omptest.cpp
index 5449580bba..38f1915c03 100644
--- a/test/smoke-fails/omptest-unittest/omptest.cpp
+++ b/test/smoke-fails/omptest-unittest/omptest.cpp
@@ -6,13 +6,13 @@ TEST(ManualSuite, ParallelFor) {
/* The Test Body */
int arr[10] = {0};
SequenceAsserter->insert(omptest::OmptAssertEvent::ParallelBegin(
- "User Parallel Begin", "Group", omptest::ObserveState::always,
+ "User Parallel Begin", "Group", omptest::ObserveState::Always,
/*NumThreads=*/2));
SequenceAsserter->insert(omptest::OmptAssertEvent::ThreadBegin(
- "User Thread Begin", "Group", omptest::ObserveState::always,
+ "User Thread Begin", "Group", omptest::ObserveState::Always,
ompt_thread_initial));
SequenceAsserter->insert(omptest::OmptAssertEvent::ParallelEnd(
- "User Parallel End", "Group", omptest::ObserveState::always));
+ "User Parallel End", "Group", omptest::ObserveState::Always));
SequenceAsserter->permitEvent(omptest::internal::EventTy::ParallelBegin);
SequenceAsserter->permitEvent(omptest::internal::EventTy::ParallelEnd);
@@ -33,18 +33,18 @@ TEST(ManualSuite, ParallelForActivation) {
/* The Test Body */
int arr[10] = {0};
SequenceAsserter->insert(omptest::OmptAssertEvent::ParallelBegin(
- "User Parallel Begin", "Group", omptest::ObserveState::always,
+ "User Parallel Begin", "Group", omptest::ObserveState::Always,
/*NumThreads=*/2));
SequenceAsserter->insert(omptest::OmptAssertEvent::ParallelEnd(
- "User Parallel End", "Group", omptest::ObserveState::always));
+ "User Parallel End", "Group", omptest::ObserveState::Always));
// The last sequence we want to observe does not contain
// another thread begin.
SequenceAsserter->insert(omptest::OmptAssertEvent::ParallelBegin(
- "User Parallel Begin", "Group", omptest::ObserveState::always,
+ "User Parallel Begin", "Group", omptest::ObserveState::Always,
/*NumThreads=*/2));
SequenceAsserter->insert(omptest::OmptAssertEvent::ParallelEnd(
- "User Parallel End", "Group", omptest::ObserveState::always));
+ "User Parallel End", "Group", omptest::ObserveState::Always));
SequenceAsserter->permitEvent(omptest::internal::EventTy::ParallelBegin);
SequenceAsserter->permitEvent(omptest::internal::EventTy::ParallelEnd);
@@ -174,7 +174,4 @@ TEST(ManualSuite, veccopy_ompt_target) {
OMPT_ASSERT_SEQUENCE_ENABLE();
}
-int main(int argc, char **argv) {
- Runner R;
- return R.run();
-}
+OMPTEST_TESTSUITE_MAIN()
diff --git a/test/smoke-fails/swdev-507161/clang-507161.cpp b/test/smoke-fails/swdev-507161/clang-507161.cpp
index 413fcc8401..865ad9ee1e 100644
--- a/test/smoke-fails/swdev-507161/clang-507161.cpp
+++ b/test/smoke-fails/swdev-507161/clang-507161.cpp
@@ -1,3 +1,6 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
template
class A {
diff --git a/test/smoke-fails/task_affinity/Makefile b/test/smoke-fails/task_affinity/Makefile
new file mode 100644
index 0000000000..f1b226f454
--- /dev/null
+++ b/test/smoke-fails/task_affinity/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = task_affinity
+TESTSRC_MAIN = task_affinity.cpp
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+CLANG = clang++
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fails/task_affinity/task_affinity.cpp b/test/smoke-fails/task_affinity/task_affinity.cpp
new file mode 100644
index 0000000000..0eb6a5bddd
--- /dev/null
+++ b/test/smoke-fails/task_affinity/task_affinity.cpp
@@ -0,0 +1,46 @@
+#include
+
+double * alloc_init_B(double *A, int N) {
+ double *B = new double[N];
+ for(int i = 0; i < N; i++)
+ B[i] = A[i];
+ return B;
+}
+
+void compute_on_B(double *B, int N) {
+ for(int i = 0; i < N; i++)
+ B[i] += 1.0;
+}
+
+int check_B(double *B, int N) {
+ int err = 0;
+ for(int i = 0; i < N; i++)
+ if (B[i] != (double)i+1.0) {
+ err++;
+ printf("Error at %d: got %lf, expected %lf\n", i, B[i], (double)i+1.0);
+ if (err > 10) return err;
+ }
+ return err;
+}
+
+int main() {
+ int N = 1024;
+ double *A = new double[N];
+ double *B;
+
+ for(int i = 0; i < N; i++)
+ A[i] = i;
+
+ #pragma omp task depend(out:B) shared(B) affinity(A[0:N])
+ {
+ B = alloc_init_B(A,N);
+ }
+ #pragma omp task depend( in:B) shared(B) affinity(A[0:N])
+ {
+ compute_on_B(B,N);
+ }
+
+ #pragma opm taskwait
+
+ return check_B(B, N);
+}
diff --git a/test/smoke-fails/veccopy-ompTest/veccopy.cpp b/test/smoke-fails/veccopy-ompTest/veccopy.cpp
index 605c5e4991..3c7e3e044e 100644
--- a/test/smoke-fails/veccopy-ompTest/veccopy.cpp
+++ b/test/smoke-fails/veccopy-ompTest/veccopy.cpp
@@ -17,45 +17,45 @@ TEST(InitialSuite, veccopy) {
b[i]=i;
SequenceAsserter->insert(omptest::OmptAssertEvent::DeviceLoad(
- "User DeviceLoad", "Group", omptest::ObserveState::always,
+ "User DeviceLoad", "Group", omptest::ObserveState::Always,
/*DeviceNum=*/0));
SequenceAsserter->insert(omptest::OmptAssertEvent::Target(
- "User Target", "Group", omptest::ObserveState::always, /*Kind=*/TARGET,
+ "User Target", "Group", omptest::ObserveState::Always, /*Kind=*/TARGET,
/*Endpoint=*/BEGIN));
SequenceAsserter->insert(omptest::OmptAssertEvent::TargetDataOp(
- "User Target DataOp", "Group", omptest::ObserveState::always,
+ "User Target DataOp", "Group", omptest::ObserveState::Always,
/*OpType=*/ALLOC, /*Bytes=*/sizeof(a)));
SequenceAsserter->insert(omptest::OmptAssertEvent::TargetDataOp(
- "User Target DataOp", "Group", omptest::ObserveState::always,
+ "User Target DataOp", "Group", omptest::ObserveState::Always,
/*OpType=*/H2D, /*Bytes=*/sizeof(a)));
SequenceAsserter->insert(omptest::OmptAssertEvent::TargetDataOp(
- "User Target DataOp", "Group", omptest::ObserveState::always,
+ "User Target DataOp", "Group", omptest::ObserveState::Always,
/*OpType=*/ALLOC, /*Bytes=*/sizeof(a)));
SequenceAsserter->insert(omptest::OmptAssertEvent::TargetDataOp(
- "User Target DataOp", "Group", omptest::ObserveState::always,
+ "User Target DataOp", "Group", omptest::ObserveState::Always,
/*OpType=*/H2D, /*Bytes=*/sizeof(a)));
SequenceAsserter->insert(omptest::OmptAssertEvent::TargetSubmit(
- "User Target Submit", "Group", omptest::ObserveState::always,
+ "User Target Submit", "Group", omptest::ObserveState::Always,
/*RequestedNumTeams=*/1));
SequenceAsserter->insert(omptest::OmptAssertEvent::TargetDataOp(
- "User Target DataOp", "Group", omptest::ObserveState::always,
+ "User Target DataOp", "Group", omptest::ObserveState::Always,
/*OpType=*/D2H, /*Bytes=*/sizeof(a)));
SequenceAsserter->insert(omptest::OmptAssertEvent::TargetDataOp(
- "User Target DataOp", "Group", omptest::ObserveState::always,
+ "User Target DataOp", "Group", omptest::ObserveState::Always,
/*OpType=*/D2H, /*Bytes=*/sizeof(a)));
SequenceAsserter->insert(omptest::OmptAssertEvent::TargetDataOp(
- "User Target DataOp", "Group", omptest::ObserveState::always,
+ "User Target DataOp", "Group", omptest::ObserveState::Always,
/*OpType=*/DELETE));
SequenceAsserter->insert(omptest::OmptAssertEvent::TargetDataOp(
- "User Target DataOp", "Group", omptest::ObserveState::always,
+ "User Target DataOp", "Group", omptest::ObserveState::Always,
/*OpType=*/DELETE));
SequenceAsserter->insert(omptest::OmptAssertEvent::Target(
- "User Target", "Group", omptest::ObserveState::always, /*Kind=*/TARGET,
+ "User Target", "Group", omptest::ObserveState::Always, /*Kind=*/TARGET,
/*Endpoint=*/END));
#pragma omp target parallel for
@@ -75,7 +75,4 @@ TEST(InitialSuite, veccopy) {
printf("Success\n");
}
-int main(int argc, char **argv) {
- Runner R;
- return R.run();
-}
+OMPTEST_TESTSUITE_MAIN()
diff --git a/test/smoke-fails/veccopy-ompt-target-emi-flush-trace/callbacks.h b/test/smoke-fails/veccopy-ompt-target-emi-flush-trace/callbacks.h
index 1305476534..f75623b82e 100644
--- a/test/smoke-fails/veccopy-ompt-target-emi-flush-trace/callbacks.h
+++ b/test/smoke-fails/veccopy-ompt-target-emi-flush-trace/callbacks.h
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
#include
diff --git a/test/smoke-fails/veccopy-ompt-target-emi-flush-trace/veccopy-ompt-target-emi-tracing.cpp b/test/smoke-fails/veccopy-ompt-target-emi-flush-trace/veccopy-ompt-target-emi-tracing.cpp
index b50ad376c0..b7a70497db 100644
--- a/test/smoke-fails/veccopy-ompt-target-emi-flush-trace/veccopy-ompt-target-emi-tracing.cpp
+++ b/test/smoke-fails/veccopy-ompt-target-emi-flush-trace/veccopy-ompt-target-emi-tracing.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
#include
diff --git a/test/smoke-fort-dev/Makefile b/test/smoke-fort-dev/Makefile
index aa36199eb5..c353bf7252 100644
--- a/test/smoke-fort-dev/Makefile
+++ b/test/smoke-fort-dev/Makefile
@@ -1,26 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- do-concurrent-device \
- do-concurrent-host \
- flang-464660-2 \
- flang-471469 \
- flang-523587 \
- flang-527219 \
- flang-529628 \
- hipfort \
- multi-generic \
- multi-generic-exe \
- rocm-issue-201 \
- tgt-abort-lhostdev \
- tgt-firstprivate \
- tgt-print-hello-lhostdev \
- tgt-print-val-lhostdev \
- tgt-stop-lhostdev \
- tgt-write-lhostdev \
- whole-archive \
- whole-archive-module
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/smoke-fort-dev/byref-reduction-scalar-allocatable/Makefile b/test/smoke-fort-dev/byref-reduction-scalar-allocatable/Makefile
new file mode 100644
index 0000000000..2e4faaeee8
--- /dev/null
+++ b/test/smoke-fort-dev/byref-reduction-scalar-allocatable/Makefile
@@ -0,0 +1,16 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = byref_reduction_scalar_allocatable
+TESTSRC_MAIN = byref_reduction_scalar_allocatable.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN)
+
+FLANG ?= flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/byref-reduction-scalar-allocatable/byref_reduction_scalar_allocatable.f90 b/test/smoke-fort-dev/byref-reduction-scalar-allocatable/byref_reduction_scalar_allocatable.f90
new file mode 100644
index 0000000000..9178f3a435
--- /dev/null
+++ b/test/smoke-fort-dev/byref-reduction-scalar-allocatable/byref_reduction_scalar_allocatable.f90
@@ -0,0 +1,33 @@
+program main
+ implicit none
+
+ real, allocatable :: scalar_alloc
+ integer :: i
+ real, parameter :: num_iters = 1000000
+
+ allocate(scalar_alloc)
+ scalar_alloc = 0
+
+ !$omp target map(tofrom: scalar_alloc)
+ call foo(scalar_alloc)
+ !$omp end target
+
+ print *, "result: ", scalar_alloc
+
+ if (scalar_alloc /= num_iters) then
+ print *, "Incorrect result! (actual): ", scalar_alloc, " vs. (expected): ", num_iters
+ stop 1
+ end if
+
+contains
+ subroutine foo(scalar_alloc)
+ implicit none
+ integer :: i
+ real, allocatable, intent(inout) :: scalar_alloc
+
+ !$omp parallel do reduction(+: scalar_alloc)
+ do i = 1, num_iters
+ scalar_alloc = scalar_alloc + 1
+ end do
+ end subroutine
+end program
diff --git a/test/smoke-fort-dev/byref-reduction-static-array/Makefile b/test/smoke-fort-dev/byref-reduction-static-array/Makefile
new file mode 100644
index 0000000000..a00b82d9a0
--- /dev/null
+++ b/test/smoke-fort-dev/byref-reduction-static-array/Makefile
@@ -0,0 +1,16 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = byref_reduction_static_array
+TESTSRC_MAIN = byref_reduction_static_array.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN)
+
+FLANG ?= flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/byref-reduction-static-array/byref_reduction_static_array.f90 b/test/smoke-fort-dev/byref-reduction-static-array/byref_reduction_static_array.f90
new file mode 100644
index 0000000000..4502c2ce40
--- /dev/null
+++ b/test/smoke-fort-dev/byref-reduction-static-array/byref_reduction_static_array.f90
@@ -0,0 +1,37 @@
+program main
+ implicit none
+
+ real, parameter :: num_iters = 1000000
+ integer, parameter :: arr_size = 10
+ real :: arr(arr_size)
+ real :: expected_arr(arr_size)
+ integer :: i
+
+ do i = 1, arr_size
+ arr(i) = i
+ expected_arr(i) = i + num_iters
+ end do
+
+ !$omp target map(tofrom: arr)
+ call foo(arr)
+ !$omp end target
+
+ print *, "result: ", arr
+
+ if (any(arr /= expected_arr)) then
+ print *, "Incorrect result! (actual): ", arr, " vs. (expected): ", expected_arr
+ stop 1
+ end if
+
+contains
+ subroutine foo(arr)
+ implicit none
+ integer :: i
+ real, intent(inout) :: arr(arr_size)
+
+ !$omp parallel do reduction(+: arr)
+ do i = 1, num_iters
+ arr = arr + 1
+ end do
+ end subroutine
+end program
diff --git a/test/smoke-fort-dev/chk-intdo-permutation/Makefile b/test/smoke-fort-dev/chk-intdo-permutation/Makefile
new file mode 100644
index 0000000000..b7e5a75cd9
--- /dev/null
+++ b/test/smoke-fort-dev/chk-intdo-permutation/Makefile
@@ -0,0 +1,19 @@
+# NOOPT = 1
+# NOOMP = 1
+# OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = intdo-permutation
+TESTSRC_MAIN = intdo-permutation.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/chk-intdo-permutation/intdo-permutation.f90 b/test/smoke-fort-dev/chk-intdo-permutation/intdo-permutation.f90
new file mode 100644
index 0000000000..1326a1e931
--- /dev/null
+++ b/test/smoke-fort-dev/chk-intdo-permutation/intdo-permutation.f90
@@ -0,0 +1,46 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+! RUN: %flang %flags %openmp_flags -fopenmp-version=60 %s -o %t.exe
+! RUN: %t.exe | $FILECHECK %s --match-full-lines
+
+program interchange_intdo
+ integer :: i, j
+ print *, 'do'
+
+ !$OMP INTERCHANGE PERMUTATION(2,3,1)
+ do i = 7, 15, 3
+ do j = -1, 1, 2
+ do k = 3, 1, -1
+ print '("i=", I0, " j=", I0, " k=", I0)', i, j, k
+ end do
+ end do
+ end do
+ !$OMP END INTERCHANGE
+
+ print *, 'done'
+end program
+
+
+! CHECK: do
+! CHECK-NEXT: i=7 j=-1 k=3
+! CHECK-NEXT: i=10 j=-1 k=3
+! CHECK-NEXT: i=13 j=-1 k=3
+! CHECK-NEXT: i=7 j=-1 k=2
+! CHECK-NEXT: i=10 j=-1 k=2
+! CHECK-NEXT: i=13 j=-1 k=2
+! CHECK-NEXT: i=7 j=-1 k=1
+! CHECK-NEXT: i=10 j=-1 k=1
+! CHECK-NEXT: i=13 j=-1 k=1
+! CHECK-NEXT: i=7 j=1 k=3
+! CHECK-NEXT: i=10 j=1 k=3
+! CHECK-NEXT: i=13 j=1 k=3
+! CHECK-NEXT: i=7 j=1 k=2
+! CHECK-NEXT: i=10 j=1 k=2
+! CHECK-NEXT: i=13 j=1 k=2
+! CHECK-NEXT: i=7 j=1 k=1
+! CHECK-NEXT: i=10 j=1 k=1
+! CHECK-NEXT: i=13 j=1 k=1
+! CHECK-NEXT: done
diff --git a/test/smoke-fort-dev/chk-intdo/Makefile b/test/smoke-fort-dev/chk-intdo/Makefile
new file mode 100644
index 0000000000..a65f4567d9
--- /dev/null
+++ b/test/smoke-fort-dev/chk-intdo/Makefile
@@ -0,0 +1,19 @@
+# NOOPT = 1
+# NOOMP = 1
+# OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = intdo
+TESTSRC_MAIN = intdo.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/chk-intdo/intdo.f90 b/test/smoke-fort-dev/chk-intdo/intdo.f90
new file mode 100644
index 0000000000..e3f504a5c2
--- /dev/null
+++ b/test/smoke-fort-dev/chk-intdo/intdo.f90
@@ -0,0 +1,35 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+! RUN: %flang %flags %openmp_flags -fopenmp-version=60 %s -o %t.exe
+! RUN: %t.exe | $FILECHECK %s --match-full-lines
+
+program interchange_intdo
+ integer :: i, j
+ print *, 'do'
+
+ !$OMP INTERCHANGE
+ do i = 7, 15, 3
+ do j = -1, 1
+ print '("i=", I0, " j=", I0)', i, j
+ end do
+ end do
+ !$OMP END INTERCHANGE
+
+ print *, 'done'
+end program
+
+
+! CHECK: do
+! CHECK-NEXT: i=7 j=-1
+! CHECK-NEXT: i=10 j=-1
+! CHECK-NEXT: i=13 j=-1
+! CHECK-NEXT: i=7 j=0
+! CHECK-NEXT: i=10 j=0
+! CHECK-NEXT: i=13 j=0
+! CHECK-NEXT: i=7 j=1
+! CHECK-NEXT: i=10 j=1
+! CHECK-NEXT: i=13 j=1
+! CHECK-NEXT: done
diff --git a/test/smoke-fort-dev/device_aassign/Makefile b/test/smoke-fort-dev/device_aassign/Makefile
new file mode 100644
index 0000000000..737a4c7880
--- /dev/null
+++ b/test/smoke-fort-dev/device_aassign/Makefile
@@ -0,0 +1,15 @@
+include ../../Makefile.defs
+
+TESTNAME = device_aassign
+TESTSRC_MAIN = device_aassign.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/device_aassign/device_aassign.f90 b/test/smoke-fort-dev/device_aassign/device_aassign.f90
new file mode 100644
index 0000000000..9b6273d265
--- /dev/null
+++ b/test/smoke-fort-dev/device_aassign/device_aassign.f90
@@ -0,0 +1,43 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+module mod
+ implicit none
+contains
+ subroutine assgn(a, b)
+ implicit none
+ real, dimension(:), allocatable :: a
+ real, dimension(:), allocatable :: b
+
+ !$omp target
+ a = b + 1.0
+ !$omp end target
+ end subroutine assgn
+end module mod
+
+program bla
+ use mod
+ implicit none
+
+ integer, parameter :: n = 1024
+ real, dimension(:), allocatable :: a
+ real, dimension(:), allocatable :: b
+
+ allocate(a(n), b(n))
+
+ b = 41.0
+
+ !$omp target enter data map(to:a, b)
+ call assgn(a, b)
+ !$omp target exit data map(from: a,b)
+
+ if (sum(a / 42.0) /= real(n)) then
+ print '(a)', 'ERROR'
+ stop 1
+ end if
+ print '(a)', 'SUCCESS'
+
+ deallocate(a, b)
+end program bla
diff --git a/test/smoke-fort-dev/device_intrinsics/Makefile b/test/smoke-fort-dev/device_intrinsics/Makefile
new file mode 100644
index 0000000000..6bfa04f9da
--- /dev/null
+++ b/test/smoke-fort-dev/device_intrinsics/Makefile
@@ -0,0 +1,18 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -fopenmp
+include ../../Makefile.defs
+
+TESTNAME = device_intrinsics
+TESTSRC_MAIN = device_intrinsics.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/device_intrinsics/device_intrinsics.f90 b/test/smoke-fort-dev/device_intrinsics/device_intrinsics.f90
new file mode 100644
index 0000000000..b6a8cfcb07
--- /dev/null
+++ b/test/smoke-fort-dev/device_intrinsics/device_intrinsics.f90
@@ -0,0 +1,50 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+module mod
+ implicit none
+contains
+ subroutine assgn(a, ma, mi, ms)
+ implicit none
+ real, dimension(:), allocatable :: a
+ real :: ma, mi, ms
+
+ !$omp target
+ ma = maxval(a)
+ mi = minval(a)
+ ms = sum(a)
+ !$omp end target
+ end subroutine assgn
+end module mod
+
+program device_intrinsics
+ use mod
+ implicit none
+
+ integer, parameter :: n = 1024
+ integer :: i
+ real, dimension(:), allocatable :: a
+ real, dimension(:), allocatable :: b
+ real :: ma, mi, ms
+
+ allocate(a(n))
+ allocate(b(n))
+
+ a = [( real(i),i=1,n )]
+ b = [( real(i),i=1,n )]
+
+ !$omp target enter data map(to:a) map(alloc:ma,mi,ms)
+ call assgn(a, ma, mi, ms)
+ !$omp target exit data map(delete:a) map(from:ma,mi,ms)
+
+ print *, mi, ma, ms
+ if (mi /= minval(b) .or. ma /= maxval(b) .or. ms /= sum(b)) then
+ print '(a)', 'ERROR'
+ stop 1
+ end if
+ print '(a)', 'SUCCESS'
+
+ deallocate(a)
+end program device_intrinsics
diff --git a/test/smoke-fort/flang-274768-1/Makefile b/test/smoke-fort-dev/flang-274768-1/Makefile
similarity index 100%
rename from test/smoke-fort/flang-274768-1/Makefile
rename to test/smoke-fort-dev/flang-274768-1/Makefile
diff --git a/test/smoke-fort/flang-274768-1/assumed-nosize.f90 b/test/smoke-fort-dev/flang-274768-1/assumed-nosize.f90
similarity index 100%
rename from test/smoke-fort/flang-274768-1/assumed-nosize.f90
rename to test/smoke-fort-dev/flang-274768-1/assumed-nosize.f90
diff --git a/test/smoke-fort/flang-274768-1/buildit.sh b/test/smoke-fort-dev/flang-274768-1/buildit.sh
similarity index 100%
rename from test/smoke-fort/flang-274768-1/buildit.sh
rename to test/smoke-fort-dev/flang-274768-1/buildit.sh
diff --git a/test/smoke-fort/flang-274768-1/expected.err b/test/smoke-fort-dev/flang-274768-1/expected.err
similarity index 100%
rename from test/smoke-fort/flang-274768-1/expected.err
rename to test/smoke-fort-dev/flang-274768-1/expected.err
diff --git a/test/smoke-fort-dev/flang-464660-2/Makefile b/test/smoke-fort-dev/flang-464660-2/Makefile
index 7638190378..04b080e2ab 100644
--- a/test/smoke-fort-dev/flang-464660-2/Makefile
+++ b/test/smoke-fort-dev/flang-464660-2/Makefile
@@ -9,7 +9,7 @@ TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
FLANG ?= flang
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
-OMP_FLAGS += -lflang_rt.hostdevice
+OMP_FLAGS += $(FLANG_GPU_LINK_FLAGS)
#-ccc-print-phases
#"-\#\#\#"
diff --git a/test/smoke-fort-fails/flang-519158/Makefile b/test/smoke-fort-dev/flang-519158/Makefile
similarity index 92%
rename from test/smoke-fort-fails/flang-519158/Makefile
rename to test/smoke-fort-dev/flang-519158/Makefile
index 8f06f0fd66..6e23199b9a 100644
--- a/test/smoke-fort-fails/flang-519158/Makefile
+++ b/test/smoke-fort-dev/flang-519158/Makefile
@@ -12,4 +12,6 @@ CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
#"-\#\#\#"
+RUNENV = HSA_XNACK=1
+
include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-519158/test_sections_target_withallocatable.f90 b/test/smoke-fort-dev/flang-519158/test_sections_target_withallocatable.f90
similarity index 100%
rename from test/smoke-fort-fails/flang-519158/test_sections_target_withallocatable.f90
rename to test/smoke-fort-dev/flang-519158/test_sections_target_withallocatable.f90
diff --git a/test/smoke-fort-dev/flang-529628/Makefile b/test/smoke-fort-dev/flang-529628/Makefile
index cb15b12586..057d3d8d38 100644
--- a/test/smoke-fort-dev/flang-529628/Makefile
+++ b/test/smoke-fort-dev/flang-529628/Makefile
@@ -8,7 +8,7 @@ TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
FLANG ?= flang
-CFLAGS = -lflang_rt.hostdevice
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
diff --git a/test/smoke-fort-dev/hipfort/Makefile b/test/smoke-fort-dev/hipfort/Makefile
index 3dc519ff98..601791a4fc 100644
--- a/test/smoke-fort-dev/hipfort/Makefile
+++ b/test/smoke-fort-dev/hipfort/Makefile
@@ -11,19 +11,23 @@ TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
FLANG ?= flang
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
+HIP_LIB_PATH ?= $(realpath $(realpath ${AOMP})/../../lib)
#-ccc-print-phases
#"-\#\#\#"
include ../Makefile.rules
PATH := ${AOMP}/../../bin:${AOMP}/../bin:${AOMP}/bin:${PATH}
+LD_LIBRARY_PATH := ${HIP_LIB_PATH}:${LD_LIBRARY_PATH}
RUNCMD = echo "Done hipfort"
.PHONY: hipfort
hipfort:
+ echo PATH=${PATH}
+ echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
make -f Make.hipfort clean_all
env PATH=${PATH} make -f Make.hipfort build_all
- make -f Make.hipfort run_all
+ env LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make -f Make.hipfort run_all
echo "Done Make.hipfort"
clean::
diff --git a/test/smoke-fort-dev/hipfort/f2003/roctx/Makefile b/test/smoke-fort-dev/hipfort/f2003/roctx/Makefile
index fe800dac9b..90ff4c64e4 100644
--- a/test/smoke-fort-dev/hipfort/f2003/roctx/Makefile
+++ b/test/smoke-fort-dev/hipfort/f2003/roctx/Makefile
@@ -6,7 +6,7 @@ main: main.f03 hip_implementation.cpp
hipfc $(CFLAGS) main.f03 hip_implementation.cpp -o main -lroctx64
run: main
- rocprof -d rocprof_out -o rocprof_out/results.csv --hip-trace --roctx-trace ./main
+ $(AOMPHIP)/bin/rocprofv3 --output-format csv --marker-trace --runtime-trace --stats -- ./main
clean:
- rm -rf main *.o *.mod rocprof_out
+ rm -rf main *.o *.mod rocprof_out `hostname`
diff --git a/test/smoke-fails/nwchem-s1_1/Makefile b/test/smoke-fort-dev/nwchem-s1_1/Makefile
similarity index 79%
rename from test/smoke-fails/nwchem-s1_1/Makefile
rename to test/smoke-fort-dev/nwchem-s1_1/Makefile
index 3074d32f59..ebf2dd900e 100644
--- a/test/smoke-fails/nwchem-s1_1/Makefile
+++ b/test/smoke-fort-dev/nwchem-s1_1/Makefile
@@ -15,5 +15,5 @@ CC = $(OMP_BIN) $(VERBOSE)
include ../Makefile.rules
run: $(TESTNAME)
ulimit -s unlimited ; \
- $(AOMP)/bin/rocprof --stats ./$(TESTNAME) > run.log 2>&1 ; \
+ $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) > run.log 2>&1 ; \
python3 printTime.py
diff --git a/test/smoke-fails/nwchem-s1_1/nwchem-s1_1.f90 b/test/smoke-fort-dev/nwchem-s1_1/nwchem-s1_1.f90
similarity index 90%
rename from test/smoke-fails/nwchem-s1_1/nwchem-s1_1.f90
rename to test/smoke-fort-dev/nwchem-s1_1/nwchem-s1_1.f90
index dc9392db44..665265f83f 100644
--- a/test/smoke-fails/nwchem-s1_1/nwchem-s1_1.f90
+++ b/test/smoke-fort-dev/nwchem-s1_1/nwchem-s1_1.f90
@@ -1,3 +1,8 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
! mimic NWChem tgt_sd_t_s1_1 kernel
! RL: do not redefine simd clause to be schedule(static, 1)
! RL: make the schedule clause usage be explicit
diff --git a/test/smoke-fort-dev/nwchem-s1_1/printTime.py b/test/smoke-fort-dev/nwchem-s1_1/printTime.py
new file mode 100644
index 0000000000..3b2513c4d3
--- /dev/null
+++ b/test/smoke-fort-dev/nwchem-s1_1/printTime.py
@@ -0,0 +1,117 @@
+#!/usr/bin/env python3
+# Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+# SPDX-License-Identifier: MIT
+
+# flang-494405.py
+# LLM: GPT-4
+# Date: 2025-08-20
+"""
+Write a Python program specified by the following. If an error, return a negative error code.
+
+In a comment in the program, specify the LLM/version and the current date. Include this query into the program as documentation.
+
+In the directory where this program was executed, there is a directory with the current machine's name.
+In that directory, there is a file called: "*_kernel_stats.csv", for example: "1428133_kernel_stats.csv". Read that file.
+This CSV file has the following format (for example):
+
+"Name","Calls","TotalDurationNs","AverageNs","Percentage"
+"__omp_offloading_10302_2d86ff6_tgt_sd_t_s1_1__l23.kd",1,888032,888032,100.0
+
+Print out the information collected in the following format. What follows is an example:
+
+"Name" "Calls" "TotalDurationNs" "AverageNs" "Percentage"
+"__omp_offloading_10302_2d8735b_glsc3_acc__l5.kd" 1 447886 447886 100.0
+
+Delete the directory with the current machine's name.
+"""
+
+import os
+import sys
+import socket
+import glob
+import csv
+import shutil
+
+def print_row(name, calls, total_ns, average_ns, percentage):
+ # Format to match requested output: columns aligned similar to example
+ print(f'{name:<50} {calls:<8} {total_ns:<18} {average_ns:<12} {percentage}')
+
+def main():
+ try:
+ hostname = socket.gethostname()
+ hostname_dir = os.path.join(os.getcwd(), hostname)
+
+ if not os.path.isdir(hostname_dir):
+ print(f"Error: directory '{hostname}' not found in current directory.", file=sys.stderr)
+ return -1
+
+ pattern = os.path.join(hostname_dir, "*_kernel_stats.csv")
+ files = glob.glob(pattern)
+ if not files:
+ print(f"Error: no file matching '*_kernel_stats.csv' in '{hostname}'.", file=sys.stderr)
+ return -2
+
+ csv_file = files[0]
+
+ # Read CSV and print rows
+ with open(csv_file, newline='') as f:
+ # The CSV may have quoted header; use csv.DictReader to be robust
+ reader = csv.DictReader(f)
+ # Print header line as requested
+ print(f'{"Name":<50} {"Calls":<8} {"TotalDurationNs":<18} {"AverageNs":<12} {"Percentage"}')
+
+ # Validate required columns present
+ required = ("Name", "Calls", "TotalDurationNs", "AverageNs", "Percentage")
+ for col in required:
+ if col not in reader.fieldnames:
+ print(f"Error: expected column '{col}' not found in CSV.", file=sys.stderr)
+ return -3
+
+ for row in reader:
+ raw_name = row.get("Name", "").strip()
+ if not raw_name:
+ # skip empty names
+ continue
+ # Ensure .kd suffix as in example
+ name = raw_name if raw_name.endswith(".kd") else raw_name + ".kd"
+ calls = row.get("Calls", "").strip()
+ total_ns = row.get("TotalDurationNs", "").strip()
+ # AverageNs may be float-like; format as integer when appropriate
+ avg_raw = row.get("AverageNs", "").strip()
+ try:
+ avg_val = int(float(avg_raw)) if avg_raw != "" else ""
+ except ValueError:
+ avg_val = avg_raw
+ perc_raw = row.get("Percentage", "").strip()
+ try:
+ perc_val = float(perc_raw) if perc_raw != "" else ""
+ except ValueError:
+ perc_val = perc_raw
+
+ print_row(name, calls, total_ns, avg_val, perc_val)
+
+ # Delete the hostname directory (recursively)
+ try:
+ shutil.rmtree(hostname_dir)
+ except PermissionError:
+ print(f"Error: permission denied when deleting directory '{hostname_dir}'.", file=sys.stderr)
+ return -4
+ except OSError as e:
+ print(f"Error: failed to delete directory '{hostname_dir}': {e}", file=sys.stderr)
+ return -5
+
+ return 0
+
+ except FileNotFoundError as e:
+ print(f"Error: file not found: {e}", file=sys.stderr)
+ return -6
+ except PermissionError as e:
+ print(f"Error: permission error: {e}", file=sys.stderr)
+ return -7
+ except Exception as e:
+ print(f"Error: unexpected error: {e}", file=sys.stderr)
+ return -8
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/test/smoke-fort-limbo/openmp-ver/Makefile b/test/smoke-fort-dev/openmp-ver/Makefile
similarity index 100%
rename from test/smoke-fort-limbo/openmp-ver/Makefile
rename to test/smoke-fort-dev/openmp-ver/Makefile
diff --git a/test/smoke-fort-limbo/openmp-ver/doit.sh b/test/smoke-fort-dev/openmp-ver/doit.sh
similarity index 91%
rename from test/smoke-fort-limbo/openmp-ver/doit.sh
rename to test/smoke-fort-dev/openmp-ver/doit.sh
index d8583ccd0f..349aa6cce7 100755
--- a/test/smoke-fort-limbo/openmp-ver/doit.sh
+++ b/test/smoke-fort-dev/openmp-ver/doit.sh
@@ -1,3 +1,8 @@
+#
+#Copyright © Advanced Micro Devices, Inc., or its affiliates.
+#
+#SPDX-License-Identifier: MIT
+#
#!/bin/bash
echo "Verifying initial test"
diff --git a/test/smoke-fort-limbo/openmp-ver/test.f90 b/test/smoke-fort-dev/openmp-ver/test.f90
similarity index 100%
rename from test/smoke-fort-limbo/openmp-ver/test.f90
rename to test/smoke-fort-dev/openmp-ver/test.f90
diff --git a/test/smoke-fort-dev/rocm-issue-201/Makefile b/test/smoke-fort-dev/rocm-issue-201/Makefile
index 614425a1bc..d9aa145946 100644
--- a/test/smoke-fort-dev/rocm-issue-201/Makefile
+++ b/test/smoke-fort-dev/rocm-issue-201/Makefile
@@ -9,7 +9,7 @@ TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
FLANG ?= flang
-CFLAGS = -lflang_rt.hostdevice
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
diff --git a/test/smoke-fort-dev/swdev-566120/Makefile b/test/smoke-fort-dev/swdev-566120/Makefile
new file mode 100644
index 0000000000..afbdfc75ac
--- /dev/null
+++ b/test/smoke-fort-dev/swdev-566120/Makefile
@@ -0,0 +1,20 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = gpu_kernel_latency
+TESTSRC_MAIN = gpu_kernel_latency.F90
+TESTSRC_AUX = gpu_kernel_latency_mod.F90
+TESTSRC_ALL = $(TESTSRC_AUX) $(TESTSRC_MAIN)
+
+FLANG = flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS) -O2 -g -fopenmp
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./doit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/swdev-566120/doit.sh b/test/smoke-fort-dev/swdev-566120/doit.sh
new file mode 100755
index 0000000000..567c273950
--- /dev/null
+++ b/test/smoke-fort-dev/swdev-566120/doit.sh
@@ -0,0 +1,3 @@
+set -x
+./gpu_kernel_latency
+
diff --git a/test/smoke-fort-dev/swdev-566120/gpu_kernel_latency.F90 b/test/smoke-fort-dev/swdev-566120/gpu_kernel_latency.F90
new file mode 100644
index 0000000000..8fac07f038
--- /dev/null
+++ b/test/smoke-fort-dev/swdev-566120/gpu_kernel_latency.F90
@@ -0,0 +1,130 @@
+program gpu_kernel_latency
+ use gpu_kernel_latency_mod
+#ifdef _OPENMP
+ use omp_lib
+#endif
+ implicit none
+ integer, parameter :: nproma=10000, nlev=40, nb=100, niter=1000
+ ! integer, parameter :: nproma=5, nlev=4, nb=1, niter=1
+ integer :: i, j, k, map_id, ind_s, ind_e, it, nteams
+
+ real(kind=real64), allocatable :: arr(:,:,:), arr_out_ref(:,:,:)
+ real(kind=real64), allocatable :: arr_out(:,:,:)
+ real(kind=real64) :: t_tot, t_avg_launch
+ real(kind=real64) :: t_start, t_end
+#ifndef USE_NOWAIT
+ character(len=*), parameter :: nowait_str = ''
+#else
+ character(len=*), parameter :: nowait_str = 'nowait '
+#endif
+
+ allocate(arr(nproma, nlev, nb), &
+ arr_out_ref(nproma, nlev, nb))
+ arr_out_ref=0
+
+ allocate(arr_out(nproma, nlev, nb))
+ arr_out=0
+
+ ! Initialize data
+ do k=1,nb
+ do j=1,nlev
+ do i=1,nproma
+ arr(i,j,k)=((-1)**(mod(i,2)+1))*real(nproma*nb*(k-1)+nproma*(j-1)+i, real64) ! Use linear index as data
+ arr_out(i,j,k)=0
+ arr_out_ref(i,j,k)=0
+ end do
+ end do
+ end do
+
+ ind_s=1
+ ind_e=nproma
+
+ ! Compute reference result
+ call gpu_kernel_latency_ref(nproma, nlev, nb, ind_s, ind_e, arr, arr_out_ref)
+
+!$omp target data map(to: arr) map(tofrom: arr_out)
+
+ ! Warmup
+#ifndef USE_NOWAIT
+ call gpu_kernel_latency_basic(nproma, nlev, nb, ind_s, ind_e, arr, arr_out, .true.)
+#else
+ call gpu_kernel_latency_nowait(nproma, nlev, nb, ind_s, ind_e, arr, arr_out, .true.)
+#endif
+ ! Benchmark
+ t_start=ftimer()
+ do it=1,niter
+#ifndef USE_NOWAIT
+ call gpu_kernel_latency_basic(nproma, nlev, nb, ind_s, ind_e, arr, arr_out, .true.)
+#else
+ call gpu_kernel_latency_nowait(nproma, nlev, nb, ind_s, ind_e, arr, arr_out, .true.)
+#endif
+ end do
+ t_end=ftimer()
+ t_tot=t_end-t_start
+ t_avg_launch=t_tot/(niter*nb)
+
+!$omp end target data
+
+#if 0
+ do k=1,nb
+ write (*,*) 'k=', k
+ write (*,*) 'arr_out:'
+ call print_2d_array(arr_out(:,:,k))
+ write (*,*) 'arr_out_ref:'
+ call print_2d_array(arr_out_ref(:,:,k))
+#ifdef USE_NOWAIT
+ write (*,*) 'arr_out_nowait:'
+ call print_2d_array(arr_out_nowait(:,:,k))
+#endif
+ end do
+#endif
+
+ ! Output timing
+ write (*,'(A)') 'Parameters:'
+ write (*,'(X,A,I0)') 'nproma=', nproma
+ write (*,'(X,A,I0)') 'nlev=', nlev
+ write (*,'(X,A,I0)') 'nb=', nb
+ write (*,'(X,A,I0)') 'niter=', niter
+ write (*,'(A,A,A,F18.5)') 'Time ', nowait_str, '(s)=', t_tot
+ write (*,'(A,A,A,F18.5)') 'Time ', nowait_str, 'per kernel (us)=', t_avg_launch*1e6
+
+ ! Validate results
+ if (all(abs(arr_out_ref-arr_out)/abs(arr_out_ref) < epstol)) then
+ write (*,'(A)') 'arr_out validates'
+ else
+ write (*,'(A)') 'ERROR: arr_out does not validate'
+ end if
+ deallocate(arr, arr_out_ref)
+
+ deallocate(arr_out)
+
+contains
+
+ function ftimer() result(timerval)
+ use iso_fortran_env, only : real64, int64
+ implicit none
+ real(kind=real64) :: timerval
+
+#ifndef _OPENMP
+ integer(kind=int64) :: t, rate
+ call system_clock(t,count_rate=rate)
+ timerval = real(t,real64)/real(rate,real64)
+#else
+ timerval = omp_get_wtime()
+#endif
+ end function ftimer
+
+ subroutine print_2d_array(array)
+ real(kind=real64), intent(in) :: array(:,:)
+
+ integer :: i, j
+
+ do i=1,size(array,1)
+ do j=1,size(array,2)
+ write (*,'(F18.5,X)', ADVANCE='NO') array(i,j)
+ end do
+ write (*,'(A)')
+ end do
+ end subroutine print_2d_array
+
+end program gpu_kernel_latency
diff --git a/test/smoke-fort-dev/swdev-566120/gpu_kernel_latency_mod.F90 b/test/smoke-fort-dev/swdev-566120/gpu_kernel_latency_mod.F90
new file mode 100644
index 0000000000..0c47c9e311
--- /dev/null
+++ b/test/smoke-fort-dev/swdev-566120/gpu_kernel_latency_mod.F90
@@ -0,0 +1,137 @@
+module gpu_kernel_latency_mod
+ use iso_fortran_env, only : real64
+#ifdef _OPENMP
+ use omp_lib
+#endif
+ implicit none
+
+ real(kind=real64) :: epstol = 100*tiny(real(1,real64))
+
+#ifdef USE_ROCTX
+ interface
+ ! int roctxRangePushA(const char* message);
+ integer(kind=c_int) function roctxRangePushA(message) &
+ bind(C, name='roctxRangePushA')
+ use iso_c_binding, only: c_int, c_char
+ implicit none
+ character(kind=c_char) :: message(*)
+ end function roctxRangePushA
+
+ ! int roctxRangePop();
+ integer(kind=c_int) function roctxRangePop() &
+ bind(C, name='roctxRangePop')
+ use iso_c_binding, only: c_int
+ implicit none
+ end function roctxRangePop
+ end interface
+#endif
+#ifdef USE_NVTX
+ interface
+ ! int nvtxRangePushA(const char* message);
+ integer(kind=c_int) function nvtxRangePushA(message) &
+ bind(C, name='nvtxRangePushA')
+ use iso_c_binding, only: c_int, c_char
+ implicit none
+ character(kind=c_char) :: message(*)
+ end function nvtxRangePushA
+
+ ! int nvtxRangePop();
+ integer(kind=c_int) function nvtxRangePop() &
+ bind(C, name='nvtxRangePop')
+ use iso_c_binding, only: c_int
+ implicit none
+ end function nvtxRangePop
+ end interface
+#endif
+contains
+
+#ifndef USE_NOWAIT
+ subroutine gpu_kernel_latency_basic(nproma, nlev, nb, idx_s, idx_e, arr_in, arr_out, lzacc)
+ integer, intent(in) :: nproma, nlev, nb, idx_s, idx_e
+ real(kind=real64), intent(in) :: arr_in(nproma,nlev,nb)
+ real(kind=real64), intent(out) :: arr_out(nproma,nlev,nb)
+ logical :: lzacc
+
+ integer :: jec, jb, jk, ji, rocstat, nvstat
+ character(len=*), parameter :: kernel_name = 'gpu_kernel_latency_basic'
+
+#ifdef USE_ROCTX
+ rocstat = roctxRangePushA(kernel_name)
+#endif
+#ifdef USE_NVTX
+ nvstat = nvtxRangePushA(kernel_name)
+#endif
+ do jb=1,nb
+!$omp target teams loop collapse(2) &
+!$omp if(lzacc)&
+!$omp ! nowait
+ do jk = 1,nlev
+ do ji=idx_s,idx_e
+ arr_out(ji,jk,jb)=arr_in(ji,jk,jb)
+ end do
+ end do
+ end do
+#ifdef USE_ROCTX
+ rocstat = roctxRangePop()
+#endif
+#ifdef USE_NVTX
+ nvstat = nvtxRangePop()
+#endif
+
+!$omp taskwait
+ end subroutine gpu_kernel_latency_basic
+#else
+ subroutine gpu_kernel_latency_nowait(nproma, nlev, nb, idx_s, idx_e, arr_in, arr_out, lzacc)
+ integer, intent(in) :: nproma, nlev, nb, idx_s, idx_e
+ real(kind=real64), intent(in) :: arr_in(nproma,nlev,nb)
+ real(kind=real64), intent(out) :: arr_out(nproma,nlev,nb)
+ logical :: lzacc
+
+ integer :: jec, jb, jk, ji, rocstat, nvstat
+ character(len=*), parameter :: kernel_name = 'gpu_kernel_latency_nowait'
+
+#ifdef USE_ROCTX
+ rocstat = roctxRangePushA(kernel_name)
+#endif
+#ifdef USE_NVTX
+ nvstat = nvtxRangePushA(kernel_name)
+#endif
+ do jb=1,nb
+!$omp target teams loop collapse(2) &
+!$omp if(lzacc)&
+!$omp nowait
+ do jk = 1,nlev
+ do ji=idx_s,idx_e
+ arr_out(ji,jk,jb)=arr_in(ji,jk,jb)
+ end do
+ end do
+ end do
+#ifdef USE_ROCTX
+ rocstat = roctxRangePop()
+#endif
+#ifdef USE_NVTX
+ nvstat = nvtxRangePop()
+#endif
+
+!$omp taskwait
+ end subroutine gpu_kernel_latency_nowait
+#endif // USE_NOWAIT
+
+ subroutine gpu_kernel_latency_ref(nproma, nlev, nb, idx_s, idx_e, arr_in, arr_out)
+ integer, intent(in) :: nproma, nlev, nb, idx_s, idx_e
+ real(kind=real64), intent(in) :: arr_in(nproma, nlev, nb)
+ real(kind=real64), intent(out) :: arr_out(nproma, nlev, nb)
+
+ integer :: jec, jb, jk, ji
+
+ ! From ICON
+ do jb=1,nb
+ do jk = 1, nlev
+ do ji=idx_s,idx_e
+ arr_out(ji,jk,jb)=arr_in(ji,jk,jb)
+ end do
+ end do
+ end do
+ end subroutine gpu_kernel_latency_ref
+
+end module gpu_kernel_latency_mod
diff --git a/test/smoke-fort-dev/swdev-566120/orig.Makefile b/test/smoke-fort-dev/swdev-566120/orig.Makefile
new file mode 100644
index 0000000000..6a3ccf00b6
--- /dev/null
+++ b/test/smoke-fort-dev/swdev-566120/orig.Makefile
@@ -0,0 +1,56 @@
+COMP=amd
+
+ifeq ($(COMP),amd)
+FC=amdflang
+FCFLAGS=-g -O2 -fopenmp -fPIC --offload-arch=gfx90a,gfx942 -DUSE_ROCTX # -DUSE_NOWAIT
+LDFLAGS=-L$(ROCM_RUNTIME_PATH)/lib
+LDLIBS=-lrocprofiler-sdk -lroctracer64 -lroctx64
+
+PROFILE_CMD=rocprofv3 -o gpu_kernel_latency_trace --kernel-trace \
+ --memory-copy-trace --memory-allocation-trace \
+ --scratch-memory-trace --marker-trace --output-format pftrace --
+endif
+
+ifeq ($(COMP),nvidia)
+FC=nvfortran
+FCFLAGS=-g -O2 -mp=gpu -gpu=cc80 -fPIC -DUSE_NVTX # -DUSE_NOWAIT
+LDFLAGS=-L$(CUDA_HOME)/targets/x86_64-linux/lib
+LDLIBS=-lnvtx3interop
+
+PROFILE_CMD=nsys profile -o gpu_kernel_latency_trace_results -t cuda,nvtx,openmp,openacc
+endif
+
+ifeq ($(COMP),gnu)
+FC=gfortran
+FCFLAGS=-g -O2 -fPIC
+LDFLAGS=
+LDLIBS=
+endif
+
+EXE1=gpu_kernel_latency.x
+all: $(EXE1)
+
+OBJS1=gpu_kernel_latency.o gpu_kernel_latency_mod.o
+
+gpu_kernel_latency.o: gpu_kernel_latency.F90 gpu_kernel_latency_mod.o
+gpu_kernel_latency_mod.o: gpu_kernel_latency_mod.F90
+
+$(EXE1): $(OBJS1)
+ $(FC) $(FCFLAGS) $^ $(LDFLAGS) $(LDLIBS) -o $@
+
+%.o: %.F90
+ $(FC) $(FCFLAGS) -c $< -o $@
+
+%.o: %.c
+ $(CC) $(CCFLAGS) -c $< -o $@
+
+run: $(EXE1)
+ ./$(EXE1)
+
+prof: $(EXE1)
+ $(PROFILE_CMD) ./$(EXE1)
+
+.PHONY: clean
+
+clean:
+ -/bin/rm -f $(EXE1) a.out *.o *~ *.mod *.so *.pftrace *.nsys-rep
diff --git a/test/smoke-fort-dev/swdev-566304/Makefile b/test/smoke-fort-dev/swdev-566304/Makefile
new file mode 100644
index 0000000000..54147a6769
--- /dev/null
+++ b/test/smoke-fort-dev/swdev-566304/Makefile
@@ -0,0 +1,20 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = rush_larsen_gpu_omp_fort
+TESTSRC_MAIN = rush_larsen_gpu_omp_fort.F90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS) -O3 -g -fopenmp
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./doit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/swdev-566304/doit.sh b/test/smoke-fort-dev/swdev-566304/doit.sh
new file mode 100755
index 0000000000..d5d4764f5a
--- /dev/null
+++ b/test/smoke-fort-dev/swdev-566304/doit.sh
@@ -0,0 +1,6 @@
+set -x
+HSA_XNACK=0 numactl -N0 ./rush_larsen_gpu_omp_fort 1000 20 2>&1 | tee out0
+HSA_XNACK=1 numactl -N0 ./rush_larsen_gpu_omp_fort 1000 20 2>&1 | tee out1
+grep STATS out0
+grep STATS out1
+
diff --git a/test/smoke-fort/flang-446525/rush_larsen_gpu_omp_fort.F90 b/test/smoke-fort-dev/swdev-566304/rush_larsen_gpu_omp_fort.F90
similarity index 100%
rename from test/smoke-fort/flang-446525/rush_larsen_gpu_omp_fort.F90
rename to test/smoke-fort-dev/swdev-566304/rush_larsen_gpu_omp_fort.F90
diff --git a/test/smoke-fort-dev/target-cmplx4-div/Makefile b/test/smoke-fort-dev/target-cmplx4-div/Makefile
new file mode 100644
index 0000000000..993964ce16
--- /dev/null
+++ b/test/smoke-fort-dev/target-cmplx4-div/Makefile
@@ -0,0 +1,20 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = target-cmplx4-div
+TESTSRC_MAIN = target-cmplx4-div.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./doit.sh ${TESTNAME} && ./chkit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/tgt-print-hello-lhostdev/chk.stderr b/test/smoke-fort-dev/target-cmplx4-div/chk.stderr
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-hello-lhostdev/chk.stderr
rename to test/smoke-fort-dev/target-cmplx4-div/chk.stderr
diff --git a/test/smoke-fort-dev/target-cmplx4-div/chk.stdout b/test/smoke-fort-dev/target-cmplx4-div/chk.stdout
new file mode 100644
index 0000000000..68f97d70b6
--- /dev/null
+++ b/test/smoke-fort-dev/target-cmplx4-div/chk.stdout
@@ -0,0 +1,11 @@
+ (0.,2.)
+ (1.,1.) (.5,-.5)
+ (2.,2.) (1.,-1.)
+ (3.,3.) (1.5,-1.5)
+ (4.,4.) (2.,-2.)
+ (5.,5.) (2.5,-2.5)
+ (6.,6.) (3.,-3.)
+ (7.,7.) (3.5,-3.5)
+ (8.,8.) (4.,-4.)
+ (9.,9.) (4.5,-4.5)
+ (10.,10.) (5.,-5.)
diff --git a/test/smoke-fort-dev/tgt-abort-lhostdev/chkit.sh b/test/smoke-fort-dev/target-cmplx4-div/chkit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-abort-lhostdev/chkit.sh
rename to test/smoke-fort-dev/target-cmplx4-div/chkit.sh
diff --git a/test/smoke-fort-dev/tgt-print-hello-lhostdev/doit.sh b/test/smoke-fort-dev/target-cmplx4-div/doit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-hello-lhostdev/doit.sh
rename to test/smoke-fort-dev/target-cmplx4-div/doit.sh
diff --git a/test/smoke-fort-dev/target-cmplx4-div/target-cmplx4-div.f90 b/test/smoke-fort-dev/target-cmplx4-div/target-cmplx4-div.f90
new file mode 100644
index 0000000000..c0ee2d96e2
--- /dev/null
+++ b/test/smoke-fort-dev/target-cmplx4-div/target-cmplx4-div.f90
@@ -0,0 +1,37 @@
+program SAXPY_COMPLEX
+INTEGER,PARAMETER :: n=10
+integer :: i
+complex :: a
+complex, dimension(n) :: x
+complex, dimension(n) :: y
+
+a=(0, 2)
+print*,a
+do i =1,n
+ x(i) = CMPLX(i,i)
+end do
+y=0.0d0
+
+
+call saxpy(a, x, y, n)
+
+do i =1,n
+ print*, x(i),y(i)
+end do
+
+
+end program
+
+
+subroutine saxpy(a, x, y, n)
+IMPLICIT NONE
+integer :: n, i
+complex :: a
+complex, dimension(n) :: x
+complex, dimension(n) :: y
+!$omp target
+do i=1,n
+y(i) = x(i)/a + y(i)
+end do
+!$omp end target
+end subroutine
diff --git a/test/smoke-fort-dev/target-cmplx8-div/Makefile b/test/smoke-fort-dev/target-cmplx8-div/Makefile
new file mode 100644
index 0000000000..265cd1e583
--- /dev/null
+++ b/test/smoke-fort-dev/target-cmplx8-div/Makefile
@@ -0,0 +1,20 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = target-cmplx8-div
+TESTSRC_MAIN = target-cmplx8-div.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./doit.sh ${TESTNAME} && ./chkit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/tgt-print-val-lhostdev/chk.stderr b/test/smoke-fort-dev/target-cmplx8-div/chk.stderr
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-val-lhostdev/chk.stderr
rename to test/smoke-fort-dev/target-cmplx8-div/chk.stderr
diff --git a/test/smoke-fort-dev/target-cmplx8-div/chk.stdout b/test/smoke-fort-dev/target-cmplx8-div/chk.stdout
new file mode 100644
index 0000000000..68f97d70b6
--- /dev/null
+++ b/test/smoke-fort-dev/target-cmplx8-div/chk.stdout
@@ -0,0 +1,11 @@
+ (0.,2.)
+ (1.,1.) (.5,-.5)
+ (2.,2.) (1.,-1.)
+ (3.,3.) (1.5,-1.5)
+ (4.,4.) (2.,-2.)
+ (5.,5.) (2.5,-2.5)
+ (6.,6.) (3.,-3.)
+ (7.,7.) (3.5,-3.5)
+ (8.,8.) (4.,-4.)
+ (9.,9.) (4.5,-4.5)
+ (10.,10.) (5.,-5.)
diff --git a/test/smoke-fort-dev/tgt-print-hello-lhostdev/chkit.sh b/test/smoke-fort-dev/target-cmplx8-div/chkit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-hello-lhostdev/chkit.sh
rename to test/smoke-fort-dev/target-cmplx8-div/chkit.sh
diff --git a/test/smoke-fort-dev/tgt-print-val-lhostdev/doit.sh b/test/smoke-fort-dev/target-cmplx8-div/doit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-val-lhostdev/doit.sh
rename to test/smoke-fort-dev/target-cmplx8-div/doit.sh
diff --git a/test/smoke-fort-dev/target-cmplx8-div/target-cmplx8-div.f90 b/test/smoke-fort-dev/target-cmplx8-div/target-cmplx8-div.f90
new file mode 100644
index 0000000000..c5c44dfeea
--- /dev/null
+++ b/test/smoke-fort-dev/target-cmplx8-div/target-cmplx8-div.f90
@@ -0,0 +1,37 @@
+program SAXPY_COMPLEX
+INTEGER,PARAMETER :: n=10
+integer :: i
+complex(8) :: a
+complex(8), dimension(n) :: x
+complex(8), dimension(n) :: y
+
+a=(0, 2)
+print*,a
+do i =1,n
+ x(i) = CMPLX(i,i)
+end do
+y=0.0d0
+
+
+call saxpy(a, x, y, n)
+
+do i =1,n
+ print*, x(i),y(i)
+end do
+
+
+end program
+
+
+subroutine saxpy(a, x, y, n)
+IMPLICIT NONE
+integer :: n, i
+complex(8) :: a
+complex(8), dimension(n) :: x
+complex(8), dimension(n) :: y
+!$omp target
+do i=1,n
+y(i) = x(i)/a + y(i)
+end do
+!$omp end target
+end subroutine
diff --git a/test/smoke-fort-dev/tgt-firstprivate/Makefile b/test/smoke-fort-dev/tgt-firstprivate/Makefile
index 2cc256e807..d4f708dc1f 100644
--- a/test/smoke-fort-dev/tgt-firstprivate/Makefile
+++ b/test/smoke-fort-dev/tgt-firstprivate/Makefile
@@ -7,7 +7,7 @@ TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN)
FLANG ?= flang
-CFLAGS = -lflang_rt.hostdevice
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
diff --git a/test/smoke-fort-dev/tgt-firstprivate/test_firstprivate.f90 b/test/smoke-fort-dev/tgt-firstprivate/test_firstprivate.f90
index 7becf8e74f..5948dbde59 100644
--- a/test/smoke-fort-dev/tgt-firstprivate/test_firstprivate.f90
+++ b/test/smoke-fort-dev/tgt-firstprivate/test_firstprivate.f90
@@ -25,6 +25,17 @@ subroutine memcpy_int_custom_lbub(a0, a1, lb, ub)
end do
!$omp end target
end subroutine memcpy_int_custom_lbub
+
+ subroutine memcpy_char(src, dst)
+ character(len=*), intent(in) :: src
+ character(len=*), intent(out) :: dst
+
+ !$omp target firstprivate(src) map(from:dst)
+ dst = src
+ !$omp end target
+
+ end subroutine memcpy_char
+
end module tests
program test_firstprivate
@@ -34,9 +45,11 @@ program test_firstprivate
logical :: main_result
main_result = .TRUE.
- main_result = test_int_non_allocatable()
- main_result = test_int_allocatable(10)
- main_result = test_int_allocatable_with_bounds(-5, 5)
+ main_result = main_result .AND. test_int_non_allocatable()
+ main_result = main_result .AND. test_int_allocatable(10)
+ main_result = main_result .AND. test_int_allocatable_with_bounds(-5, 5)
+ main_result = main_result .AND. test_char_non_allocatable()
+ main_result = main_result .AND. test_char_allocatable()
if (.not. main_result) then
print *, "(test_firstprivate): FAIL"
stop 1
@@ -51,7 +64,8 @@ function test_int_non_allocatable() result(test_result)
call initialize(b, 1, 10, val=0)
call memcpy_int(a, b, 10)
- test_result = match(a, b, 1, 10)
+ test_result = match_int(a, b, 1, 10)
+ call print_result(test_result, "test_int_non_allocatable")
end function test_int_non_allocatable
function test_int_allocatable(n) result(test_result)
@@ -67,10 +81,11 @@ function test_int_allocatable(n) result(test_result)
call initialize(b, 1, n, val=0)
call memcpy_int(a, b, n)
- test_result = match(a, b, 1, n)
+ test_result = match_int(a, b, 1, n)
deallocate(a)
deallocate(b)
+ call print_result(test_result, "test_int_allocatable")
end function test_int_allocatable
function test_int_allocatable_with_bounds(lb, ub) result(test_result)
@@ -86,12 +101,42 @@ function test_int_allocatable_with_bounds(lb, ub) result(test_result)
call initialize(b, lb, ub, 0)
call memcpy_int_custom_lbub(a, b, lb, ub)
- test_result = match(a, b, lb, ub)
+ test_result = match_int(a, b, lb, ub)
deallocate(a)
deallocate(b)
+ call print_result(test_result, "test_int_allocatable_with_bounds")
end function test_int_allocatable_with_bounds
+ function test_char_non_allocatable() result(test_result)
+ character(len=10) :: a, b
+ logical :: test_result
+
+ a = "john"
+
+ call memcpy_char(a, b)
+ test_result = match_char(a, b)
+ call print_result(test_result, "test_char_non_allocatable")
+ end function test_char_non_allocatable
+
+ function test_char_allocatable() result(test_result)
+ character(len=:), allocatable :: a, b
+ integer :: n
+ logical :: test_result
+ n = 10
+
+ allocate(character(len=n) :: a)
+ allocate(character(len=n) :: b)
+ a = "john"
+ call memcpy_char(a, b)
+ test_result = match_char(a, b)
+
+ deallocate(a)
+ deallocate(b)
+ call print_result(test_result, "test_char_allocatable")
+
+ end function test_char_allocatable
+
subroutine initialize(arr, lb, ub, val)
integer, optional, intent(in) :: val
integer, intent(in) :: lb, ub
@@ -109,7 +154,18 @@ subroutine initialize(arr, lb, ub, val)
end if
end subroutine initialize
- function match(a, b, lb, ub) result(check_result)
+ subroutine print_result(res, msg)
+ logical, intent(in) :: res
+ character(len=*), intent(in) :: msg
+
+ if (res) then
+ print *, "PASS: ", msg
+ else
+ print *, "FAIL: ", msg
+ end if
+ end subroutine print_result
+
+ function match_int(a, b, lb, ub) result(check_result)
integer, intent(in) :: lb, ub
integer, dimension(lb:ub), intent(in) :: a, b
integer :: i
@@ -122,5 +178,16 @@ function match(a, b, lb, ub) result(check_result)
end if
end do
check_result = .TRUE.
- end function match
+ end function match_int
+
+ function match_char(a, b) result(check_result)
+ character(len=*), intent(in) :: a
+ character(len=*), intent(in) :: b
+ logical :: check_result
+ if (a .ne. b) then
+ check_result = .FALSE.
+ return
+ end if
+ check_result = .TRUE.
+ end function match_char
end program test_firstprivate
diff --git a/test/smoke-fort-dev/tgt-write-lhostdev/Makefile b/test/smoke-fort-dev/tgt-write-lhostdev/Makefile
deleted file mode 100644
index 5012481a6e..0000000000
--- a/test/smoke-fort-dev/tgt-write-lhostdev/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# For testing without openmp:
-# OMP_FLAGS = -DNO_OMP
-include ../../Makefile.defs
-
-TESTNAME = test
-TESTSRC_MAIN = test.f90
-TESTSRC_AUX =
-TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-
-FLANG ?= flang
-CFLAGS = -lflang_rt.hostdevice
-OMP_BIN = $(AOMP)/bin/$(FLANG)
-CC = $(OMP_BIN) $(VERBOSE)
-#-ccc-print-phases
-#"-\#\#\#"
-
-#RUNENV += LIBOMPTARGET_INFO=-1
-RUNCMD = ./doit.sh ${TESTNAME} && ./chkit.sh ${TESTNAME}
-
-include ../Makefile.rules
diff --git a/test/smoke-fort-fails/Makefile b/test/smoke-fort-fails/Makefile
index ba8cf8a6a0..c353bf7252 100644
--- a/test/smoke-fort-fails/Makefile
+++ b/test/smoke-fort-fails/Makefile
@@ -1,46 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- crayptr-default \
- flang-364228-2 \
- flang-364228-3 \
- flang-421111-3 \
- flang-445999 \
- flang-446033b_loop \
- flang-446033b_ttdpd \
- flang-463332 \
- flang-469194 \
- flang-476122a \
- flang-480581 \
- flang-505726 \
- flang-509589 \
- flang-519158 \
- flang-519158-par \
- flang-522059 \
- flang-523213 \
- flang-522365-loop-1-1 \
- flang-522365-loop-2a \
- flang-522365-loop-2s \
- flang-522365-ttdpd-2a \
- flang-523313 \
- flang-523626 \
- flang-523344-device \
- flang-523344-host \
- flang-524183 \
- flang-529634 \
- flang-gpu-exit \
- flang_red_bug_51 \
- kernel-exec-modes-host \
- mathquad-tgt \
- rocm-aomp-issue-842 \
- rocm-issue-208 \
- rocm-issue-241 \
- rocm-issue-251 \
- rocm-issue-253-none \
- rocm-issue-253-device \
- rocm-issue-253-host \
- target-array-element-reduction
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/smoke-fort/flang-325095/Makefile b/test/smoke-fort-fails/flang-325095/Makefile
similarity index 100%
rename from test/smoke-fort/flang-325095/Makefile
rename to test/smoke-fort-fails/flang-325095/Makefile
diff --git a/test/smoke-fort/flang-325095/flang-325095.f90 b/test/smoke-fort-fails/flang-325095/flang-325095.f90
similarity index 100%
rename from test/smoke-fort/flang-325095/flang-325095.f90
rename to test/smoke-fort-fails/flang-325095/flang-325095.f90
diff --git a/test/smoke-fort/flang-446525/Makefile b/test/smoke-fort-fails/flang-446525/Makefile
similarity index 100%
rename from test/smoke-fort/flang-446525/Makefile
rename to test/smoke-fort-fails/flang-446525/Makefile
diff --git a/test/smoke-fort/flang-446525/chkit.sh b/test/smoke-fort-fails/flang-446525/chkit.sh
similarity index 100%
rename from test/smoke-fort/flang-446525/chkit.sh
rename to test/smoke-fort-fails/flang-446525/chkit.sh
diff --git a/test/smoke-fort/flang-446525/doit.sh b/test/smoke-fort-fails/flang-446525/doit.sh
similarity index 100%
rename from test/smoke-fort/flang-446525/doit.sh
rename to test/smoke-fort-fails/flang-446525/doit.sh
diff --git a/test/smoke-fort/flang-446525/rush_larsen_gpu_omp.cc b/test/smoke-fort-fails/flang-446525/rush_larsen_gpu_omp.cc
similarity index 100%
rename from test/smoke-fort/flang-446525/rush_larsen_gpu_omp.cc
rename to test/smoke-fort-fails/flang-446525/rush_larsen_gpu_omp.cc
diff --git a/test/smoke-fort-fails/flang-446525/rush_larsen_gpu_omp_fort.F90 b/test/smoke-fort-fails/flang-446525/rush_larsen_gpu_omp_fort.F90
new file mode 100644
index 0000000000..29cf9e9b75
--- /dev/null
+++ b/test/smoke-fort-fails/flang-446525/rush_larsen_gpu_omp_fort.F90
@@ -0,0 +1,795 @@
+! Copyright (c) 2019-21, Lawrence Livermore National Security, LLC. and other
+! Goulash project contributors LLNL-CODE-795383, All rights reserved.
+! For details about use and distribution, please read LICENSE and NOTICE from
+! the Goulash project repository: http://github.com/llnl/goulash
+! SPDX-License-Identifier: BSD-3-Clause
+!
+! Designed to allow direct performance comparisons between
+! naively written HIP/CUDA and OpenMP GPU offloading schemes
+! in a variety of coding styles and languages of a
+! parameterized embarrassingly parallel Rush Larsen kernel.
+! Also allows testing build systems (including SPACK) handling
+! of complicated build situations that LLNL cares about.
+!
+! Designed to create several single file test variants
+! where no -D options required to select the variant
+! and no include files are needed.
+! As of goulash 2.1, the finalize_source script
+! is used to generate customized source files
+! for each test, from a common source.
+!
+! The key computational kernel can be located by
+! searching for: KERNEL
+!
+! Designed to create trivial variants of the same
+! test to be compiled with different compilers for
+! the interoperability tests. This is why most
+! functions are static and the main kernel test
+! is called rush_larsen_gpu_omp_fort (preprocessor
+! defines this and VARIANT_DESC based on
+! variant configuration).
+!
+! The naming convention of the variant copies is
+! intended to indicate variant abilities:
+! _cpu_serial - single threaded, no OpenMP, on CPU
+! _cpu_omp - use OpenMP to spawn threads on CPU
+! _gpu_omp - uses OpenMP to offload to GPU
+! _gpu_hip - uses HIP to offload to AMD or Nvidia GPU
+! _gpu_lambda_hip - RAJA-like lambda HIP variant
+! _gpu_cuda - uses CUDA to offload to Nvidia GPU
+! _gpu_lambda_cuda - RAJA-like lambda CUDA variant
+! *_mpi - uses and exercises MPI e.g. _gpu_omp_mpi
+! *_fort - Fortran version e.g. _gpu_omp_mpi_fort
+!
+! For the interop tests, there is an additional suffix
+! to indicate different copies of the same configuration
+! that are intended to be compiled by different compilers:
+! _compiler1 - E.g., rush_larsen_gpu_omp_compiler1.cc
+!
+! VARIANT_DESC set by preprocessor directives to
+! the configuration of this file.
+!
+! Recommended that a -DCOMPILERID be set to the compiler used to compile each file:
+!
+! /opt/rocm-4.0.1/llvm/bin/clang++ -o rush_larsen_cpu_omp -O3 -g "-DCOMPILERID=rocm-4.0.1" -fopenmp rush_larsen_cpu_omp.cc
+!
+! Run with no arguments for suggested arguments, for example:
+! Usage: ./rush_larsen_cpu_omp Iterations Kernel_GBs_used
+!
+! Measure serial launch overhead: env OMP_NUM_THREADS=1 ./rush_larsen_cpu_omp 100000 .00000001
+! Measure launch overhead: ./rush_larsen_cpu_omp 100000 .00000001
+! Measure kernel performance: ./rush_larsen_cpu_omp 100 10
+!
+! The Goulash project conceived of and designed by David Richards,
+! Tom Scogland, and John Gyllenhaal at LLNL Oct 2019.
+! Please contact John Gyllenhaal (gyllenhaal1@llnl.gov) with questions.
+!
+! Rush Larsen core CUDA/OpenMP kernels written by Rob Blake (LLNL) Sept 2016.
+! The goulash Rush Larsen tests add benchmarking infrastructure
+! around this incredibly useful compact GPU test kernel. Thank you Rob!
+!
+! Inline performance measurements added (nvprof not needed)
+! by John Gyllenhaal at LLNL 11/10/20.
+!
+! Command line argument handling, performance difference printing in
+! form easily found with grep, OpenMP thread mapping and initial data
+! sanity checks on just the first array element calculated by kernel
+! by John Gyllenhaal at LLNL 03/22/21
+!
+! Pulled code from print_openmp_mapping.c by John Gyllenhaal at
+! LLNL written June 2020 which was based on mpibind tests
+! (https://github.com/LLNL/mpibind) by Edgar Leon at LLNL
+!
+! RAJA-perf-suite-like (https://github.com/LLNL/RAJAPerf)
+! C++ lambda versions created by Jason Burmark at LLNL 06/16/21
+!
+! C-like Fortran ports (by hand) of C++ version of
+! rush larsen variants by John Gyllenhaal at LLNL 06/28/21.
+!
+! MPI stat aggregation and MPI exercisers written
+! by John Gyllenhaal at LLNL based on previous user issue reproducers.
+! Pulled into rush larsen tests on 07/02/21 by John Gyllenhaal at LLNL.
+!
+! Enhanced data checks of all kernel generated array data, including
+! across MPI ranks by John Gyllenhaal at LLNL 07/03/21
+!
+! Interop versions create by John Gyllenhaal at LLNL 07/14/21
+! to test mixing all the Rush Larsen tests with multiple GPU compilers
+! all in one final executable.
+!
+! Initial test generator from template files, including Makefiles
+! created by John Gyllenhaal at LLNL 07/21/21 for V2.0RC1
+!
+! V2.0 RC1 07/21/21 Added MPI support, interop version, enhanced data checks.
+! V1.2 06/28/21 Fortran and C++ lambda versions added, consistent use of long type
+! V1.1 03/22/21 command line args, perf diffs, maps, checks return codes and answer
+! V1.0 11/10/20 initial release, hard coded inputs, no error checking
+
+! Allow version to be printed in output
+#define VERSION_STRING "Version 2.0 RC1 (7/21/21)"
+
+! Sets up and runs the doRushLarsen kernel 'iterations' times,
+! allocating CPU arrays and perhaps GPU arrays to consume
+! kernel_mem_used GBs of memory.
+!
+! This polynomial is a fit to the dynamics of a small part of a cardiac
+! myocyte, specifically the fast sodium m-gate described here:
+! https://www.ncbi.nlm.nih.gov/pubmed/16565318
+!
+! Does exactly the same work on every cell. Can scale from one cell
+! to filling entire memory. Does use cell's value as input
+! to calculations.
+!
+! Returns number of data check failures, returns 0 if all data checks out.
+function rush_larsen_gpu_omp_fort(iterations_, kernel_mem_used_)
+
+ ! Only include OpenMP for variants that need it
+ use omp_lib
+
+ ! Get mappings to stdout, etc. so can flush output
+ use, intrinsic :: iso_fortran_env, only : stdin=>input_unit, &
+ & stdout=>output_unit, &
+ & stderr=>error_unit
+
+ ! Catch misspelled variables
+ implicit none
+
+ ! Declare arguments
+ integer :: rush_larsen_gpu_omp_fort
+ integer(8), intent(IN) :: iterations_
+ integer(8) :: iterations
+ real(8), intent(IN) :: kernel_mem_used_
+ real(8) :: kernel_mem_used
+
+ ! Declare local variables
+ ! NOTE: All subroutines and functions called by this routine
+ ! can access these variables!
+ ! Used for variant_desc, kernel_mem_used_str, timestamp, sec_str, us_str, ierr
+ character(1024) :: variant_desc
+ character(50) :: timestamp
+ character(50) :: kernel_mem_used_str
+ character(50) :: sec_str, us_str, transfer_str
+ real(8) :: kernel_starttime, kernel_endtime, kernel_runtime, base_time, last_timestamp, cur_secs
+ real(8) :: transfer_starttime, transfer_endtime, transfer_runtime
+ integer(8) :: nCells, status_point
+ integer :: rank = 0 ! Rank will be 0 for the no MPI case
+ integer :: ierr
+ integer(8) :: fail_count = 0
+ real(8) :: sum1, sum2, x, mhu, tauR
+ integer(8) :: itime, ii
+ integer(4) :: j, k
+ real(8), allocatable :: m_gate(:), Vm(:)
+ integer(4), parameter :: Mhu_l = 10
+ integer(4), parameter :: Mhu_m = 5
+ integer(4), parameter :: Tau_m = 18
+ ! Must use 'd' in every constant in order to get full real*8 values and matching results
+ real(8) :: Mhu_a(0:14) = (/&
+ & 9.9632117206253790d-01, 4.0825738726469545d-02, 6.3401613233199589d-04,&
+ & 4.4158436861700431d-06, 1.1622058324043520d-08, 1.0000000000000000d+00,&
+ & 4.0568375699663400d-02, 6.4216825832642788d-04, 4.2661664422410096d-06,&
+ & 1.3559930396321903d-08, -1.3573468728873069d-11, -4.2594802366702580d-13,&
+ & 7.6779952208246166d-15, 1.4260675804433780d-16, -2.6656212072499249d-18/)
+ ! Must use 'd' in every constant in order to get full real*8 values and matching results
+ real(8) :: Tau_a(0:18) = (/&
+ & 1.7765862602413648d+01*0.02d+00, 5.0010202770602419d-02*0.02d+00, -7.8002064070783474d-04*0.02d+00,&
+ & -6.9399661775931530d-05*0.02d+00, 1.6936588308244311d-06*0.02d+00, 5.4629017090963798d-07*0.02d+00,&
+ & -1.3805420990037933d-08*0.02d+00, -8.0678945216155694d-10*0.02d+00, 1.6209833004622630d-11*0.02d+00,&
+ & 6.5130101230170358d-13*0.02d+00, -6.9931705949674988d-15*0.02d+00, -3.1161210504114690d-16*0.02d+00,&
+ & 5.0166191902609083d-19*0.02d+00, 7.8608831661430381d-20*0.02d+00, 4.3936315597226053d-22*0.02d+00,&
+ & -7.0535966258003289d-24*0.02d+00, -9.0473475495087118d-26*0.02d+00, -2.9878427692323621d-28*0.02d+00,&
+ & 1.0000000000000000d+00/)
+
+ ! Allow compiler to be passed in at compile time
+ ! Must pass in quoted string on command line, i.e., '-DCOMPILERID="CCE"'
+#if defined(COMPILERID)
+ write (variant_desc, 20) "gpu_omp_fort", ' [', COMPILERID , ']'
+20 format(a, a,a,a)
+#else
+ variant_desc="gpu_omp_fort"
+#endif
+
+ ! To make interop performance easier to compare,
+ ! start this file's timers over every time called.
+ !
+ ! Reset this file's secs_elapsed() counter to 0
+ cur_secs = get_raw_secs()
+ base_time = get_base_time(cur_secs)
+
+ ! Synchronize printf timestamps across MPI ranks
+ last_timestamp = get_last_timestamp(secs_elapsed())
+
+ if (rank == 0) then
+ ! Print separator before and after output with function name
+ call get_timestamp_string(timestamp)
+ print '(a,"--------------- Begin rush_larsen_",a," (timer zeroed) ---------------")', &
+ & trim(timestamp), trim(variant_desc)
+ flush(stdout)
+ end if
+
+ ! For print niceness, make .00000001 lower bound on GB memory
+ if (kernel_mem_used_ < .00000001) then
+ kernel_mem_used = .00000001
+ else
+ kernel_mem_used = kernel_mem_used_
+ end if
+
+ ! Calculate nCells from target memory target
+ nCells = ((kernel_mem_used * 1024.0 * 1024.0 * 1024.0) / (8 * 2))
+
+ ! Must have at least 1 cell
+ if (nCells < 1) then
+ nCells = 1
+ end if
+
+ ! Must have at least 1 iteration
+ if (iterations_ < 1) then
+ iterations=1
+ else
+ iterations=iterations_
+ end if
+
+ ! Give status every 10% of iterations
+ status_point=iterations/10
+ ! Must be at least 1 to make mod work
+ if (status_point < 1) then
+ status_point = 1
+ end if
+
+ ! Print what we are running
+ ! Convert kernel_mem_used to left justified string with leading 0
+ ! This str is used in other subroutines and functions
+ write (kernel_mem_used_str, 50) kernel_mem_used
+50 format(F16.8)
+ kernel_mem_used_str=adjustl(kernel_mem_used_str)
+ ! This kernel_mem_used_str used in several other messages as is
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a," START Rush Larsen ",i0," iters ",i0," cells ",a," GBs ",a)',&
+ & trim(timestamp),iterations, nCells, trim(kernel_mem_used_str), trim(variant_desc)
+
+ call get_timestamp_string(timestamp)
+ print '(a," ",a)', trim(timestamp), trim(VERSION_STRING)
+ flush(stdout)
+ end if
+
+ ! If using OpenMP offloading, make sure GPU works before doing test
+ call verify_gpu_openmp(0)
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a," ",a)', trim(timestamp), "Allocating and initializing kernel arrays"
+ flush(stdout)
+ end if
+
+ ! Porting from C, so make all arrays start at index 0 to make port easier
+ allocate(m_gate(0:nCells-1))
+ m_gate=0.0
+
+ ! Porting from C, so make all arrays start at index 0 to make port easier
+ allocate(Vm(0:nCells-1))
+ Vm=0.0
+
+ ! No data transfer time if not using GPU
+ transfer_starttime=0.0
+ transfer_endtime=0.0
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a," Starting omp data map of CPU arrays to GPU")', trim(timestamp)
+ flush(stdout)
+ end if
+
+ transfer_starttime=secs_elapsed()
+ !$omp target enter data map(to: m_gate(0:nCells-1))
+ !$omp target enter data map(to: Vm(0:nCells-1))
+ !$omp target enter data map(to: Mhu_a(0:14))
+ !$omp target enter data map(to: Tau_a(0:18))
+ transfer_endtime=secs_elapsed()
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a," Finished omp data map of CPU arrays to GPU")', trim(timestamp)
+ flush(stdout)
+ end if
+
+ transfer_runtime=transfer_endtime-transfer_starttime
+
+ ! Do the iterations asked for plus 1 for warmup
+ do itime=0,iterations
+ ! Print warmup message for 0th iteration
+ if (itime == 0) then
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a,a)', trim(timestamp), " Launching warmup iteration (not included in timings)"
+ flush(stdout)
+ end if
+ ! Print status every 10% of iterations
+ else if (modulo((itime-1), status_point) == 0) then
+ if (itime == 1) then
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a," Starting kernel timings for Rush Larsen ",i0," ",a)',&
+ & trim(timestamp),iterations, trim(kernel_mem_used_str)
+ flush(stdout)
+ end if
+ end if
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a,a,i6)', trim(timestamp), " Starting iteration ", itime
+ flush(stdout)
+ end if
+ end if
+
+ ! Start timer after warm-up iteration 0
+ if (itime == 1) then
+ kernel_starttime = secs_elapsed()
+ end if
+
+ !
+ ! RUSH LARSEN KERNEL BEING TIMED START
+ !
+ ! Target GPU with OpenMP, data already mapped to GPU
+ !$omp target teams distribute parallel do simd private(ii,x,sum1,j,sum2,k,mhu,tauR)
+ do ii=0,nCells-1
+ x = Vm(ii)
+ sum1 = 0.0
+ do j = Mhu_m-1, 0, -1
+ sum1 = Mhu_a(j) + x*sum1
+ end do
+ sum2 = 0.0
+ k = Mhu_m + Mhu_l - 1
+ do j = k, Mhu_m, -1
+ sum2 = Mhu_a(j) + x * sum2
+ end do
+ mhu = sum1/sum2
+
+ sum1 = 0.0
+ do j = Tau_m-1, 0, -1
+ sum1 = Tau_a(j) + x*sum1
+ end do
+ tauR = sum1
+
+ m_gate(ii) = m_gate(ii) + (mhu - m_gate(ii))*(1-exp(-tauR))
+ end do
+ ! End Target GPU with OpenMP, data already mapped to GPU
+ !$omp end target teams distribute parallel do simd
+
+ !
+ ! RUSH LARSEN KERNEL BEING TIMED END
+ !
+ end do
+
+ ! Get time after all iterations
+ kernel_endtime = secs_elapsed ()
+
+ ! Calculate kernel runtime
+ kernel_runtime = kernel_endtime-kernel_starttime
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a,a,i0,a,a)',&
+ & trim(timestamp)," Finished kernel timings for Rush Larsen ", iterations, " ", trim(kernel_mem_used_str)
+ flush(stdout)
+ end if
+
+ ! Print kernel runtime stats, syncs and aggregates MPI rank (if MPI mode)
+ call print_runtime_stats(iterations, kernel_mem_used, kernel_runtime, transfer_runtime)
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a, " Starting omp target update of GPU result array to CPU array")', trim(timestamp)
+ flush(stdout)
+ end if
+
+ ! Transfer GPU m_gate kernel memory to CPU kernel memory for data checks
+ !$omp target update from (m_gate(0:nCells-1))
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a, " Finished omp target update of GPU result array to CPU array")', trim(timestamp)
+ flush(stdout)
+ end if
+
+ ! Do sanity and consistency checks on all of m_gate. Including cross-rank if in MPI mode.
+ ! Prints PASS or FAIL based on data check results
+ ! Returns fail count so can be returned to caller.
+ fail_count = data_check (m_gate, iterations, kernel_mem_used, nCells)
+
+ ! Free kernel GPU memory
+ !$omp target exit data map(delete: m_gate(0:nCells-1))
+ !$omp target exit data map(delete: Vm(0:nCells-1))
+ !$omp target exit data map(delete: Mhu_a(0:14))
+ !$omp target exit data map(delete: Tau_a(0:18))
+
+ deallocate(Vm)
+ deallocate(m_gate)
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a," ",a,a)', trim(timestamp), "DONE Freed memory ", trim(variant_desc)
+ flush(stdout)
+ ! Print separator before and after output with function name
+ call get_timestamp_string(timestamp)
+ print '(a,"--------------- End rush_larsen_",a," ---------------")', &
+ & trim(timestamp), trim(variant_desc)
+ flush(stdout)
+ end if
+
+ ! Return number of data check failures
+ rush_larsen_gpu_omp_fort = fail_count
+
+contains
+
+ ! Ends program either with MPI_Abort or STOP 1
+ subroutine die()
+ stop 1
+ end subroutine die
+
+
+ ! Get raw time in seconds as double (a large number).
+ function get_raw_secs()
+ ! Catch misspelled variables
+ implicit none
+ real(8) :: get_raw_secs
+ integer(8) :: count, count_rate, count_max
+ real(8) :: dcount, dcount_rate
+
+ ! Get wall-clock time
+ call system_clock(count, count_rate, count_max)
+ dcount = count
+ dcount_rate = count_rate
+ ! Convert values to double (in seconds ) (a large number)
+ get_raw_secs = dcount/dcount_rate
+ end function get_raw_secs
+
+
+ ! Returns base time. If new_time > 0,
+ ! sets base_time to new_time before returning.
+ ! Using this as access method to static variable
+ ! in a way I can trivially emulate in fortran.
+ !
+ ! Note: Lock shouldn't be needed, since even if multiple
+ ! threads initialize this, it will be to basically
+ ! the same value.
+ !
+ function get_base_time(new_time)
+ ! Catch misspelled variables
+ implicit none
+ real(8), intent(IN):: new_time
+ real(8):: get_base_time
+ real(8), save :: base_time = -1.0
+
+ !If passed value > 0
+ if (new_time > 0.0) then
+ base_time = new_time
+ end if
+
+ get_base_time = base_time
+ end function get_base_time
+
+
+ ! Returns time in seconds (double) since the first call to secs_elapsed
+ ! (i.e., the first call returns 0.0).
+ function secs_elapsed ()
+ ! Catch misspelled variables
+ implicit none
+ real(8) :: secs_elapsed
+ real(8) :: new_time, base_time
+
+ ! Get current raw time (a big number)
+ new_time = get_raw_secs()
+
+ base_time = get_base_time(-1.0_8)
+
+ ! If base time not set (negative), set to current time (pass in positive secs)
+ if (base_time < 0.0) then
+ base_time=get_base_time(new_time)
+ end if
+
+ ! Returned offset from first time called
+ secs_elapsed = new_time - base_time
+ end function secs_elapsed
+
+
+ function get_last_timestamp(new_time)
+ ! Catch misspelled variables
+ implicit none
+ real(8), intent(IN):: new_time
+ real(8):: get_last_timestamp
+ real(8), save :: last_timestamp = -1.0
+
+ !If passed value > 0
+ if (new_time >= 0.0) then
+ last_timestamp = new_time
+ end if
+
+ get_last_timestamp = last_timestamp
+ end function get_last_timestamp
+
+
+ ! Cannot wrap print in fortran so create utility function
+ ! for creating timestamp prefix with diff from last timestamp.
+ ! Generate timestamp string of this form:
+ ! 0.095 (0.000s):
+ subroutine get_timestamp_string (timestamp_string)
+ ! Only include mpi for variants that need it
+ ! Catch misspelled variables
+ implicit none
+ character(len=*), intent(OUT) :: timestamp_string
+ real(8) :: last_timestamp
+ real(8) :: sec, diff
+ integer :: rank = -1
+
+ ! Get wall-clock time since first call to secs_elapsed
+ sec = secs_elapsed ()
+
+ ! Query last timestamp, set first time if needed
+ last_timestamp = get_last_timestamp(-1.0_8)
+ if (last_timestamp < 0.0) then
+ last_timestamp=get_last_timestamp(sec)
+ end if
+
+ diff = sec - last_timestamp
+
+ ! Set new last timestamp
+ last_timestamp=get_last_timestamp(sec)
+
+ ! No MPI case
+ if (rank < 0) then
+ ! Write out timestamp and diff seconds to buffer
+ write (timestamp_string, 10) sec, ' (', diff, 's): '
+10 format(f7.3,a,f5.3,a)
+
+ ! MPI case, add rank
+ else
+ ! Write out timestamp and diff seconds to buffer
+ write (timestamp_string, 11) rank, ": ", sec, ' (', diff, 's): '
+11 format(i3,a,f7.3,a,f5.3,a)
+ end if
+ end subroutine get_timestamp_string
+
+
+ ! If using OpenMP offloading, make sure GPU works before doing test
+ subroutine verify_gpu_openmp(gpu_id)
+ use omp_lib
+ integer, intent(in) :: gpu_id
+
+ character(50) :: mpi_desc=""
+
+ ! If using GPU, make sure GPU OpenMP gpu offloading works before doing test
+ integer:: runningOnGPU
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a," Selecting GPU ",i0, " as default device",a)', trim(timestamp), gpu_id, trim(mpi_desc)
+ flush(stdout)
+ end if
+
+ ! Pick GPU to use to exercise selection call
+ call omp_set_default_device(gpu_id)
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a," Launching OpenMP GPU test kernel",a)', trim(timestamp), trim(mpi_desc)
+ flush(stdout)
+ end if
+
+ ! Test if GPU is available using OpenMP4.5 legal code
+ runningOnGPU = 0
+ !$omp target map(from:runningOnGPU)
+ if (.not. omp_is_initial_device()) then
+ runningOnGPU = 1
+ else
+ runningOnGPU = 2
+ end if
+ !$omp end target
+
+ ! If still running on CPU, GPU must not be available, punt
+ if (runningOnGPU .ne. 1) then
+ call get_timestamp_string(timestamp)
+ print '(a," ", a, i0," ",a)', trim(timestamp), &
+ & "ERROR: OpenMP GPU test kernel did NOT run on GPU ", gpu_id, trim(variant_desc)
+ flush(stdout)
+ call die()
+ end if
+
+ if (rank == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a," Verified OpenMP target test kernel ran on GPU",a)', trim(timestamp), trim(mpi_desc)
+ flush(stdout)
+ end if
+ end subroutine verify_gpu_openmp
+
+
+ !Print kernel runtime stats and aggregate across MPI processes if necessary.
+ !Prints one liner if not using MPI
+ subroutine print_runtime_stats(iterations, kernel_mem_used, kernel_runtime, transfer_runtime)
+ ! Catch misspelled variables
+ implicit none
+ integer(8), intent(in) :: iterations
+ real(8), intent(in) :: kernel_mem_used
+ real(8), intent(in) :: kernel_runtime, transfer_runtime
+
+ ! NO MPI CASE - print one line
+ ! Print time stats
+ ! Convert runtime into same format as C using string manipulation
+ write (sec_str, 63) kernel_runtime
+63 format(f18.4)
+ sec_str=adjustl(sec_str)
+ write (us_str, 64) kernel_runtime*1000000.0_8/(1.0d+0*iterations)
+64 format(f18.2)
+ us_str=adjustl(us_str)
+ call get_timestamp_string(timestamp)
+ print '(a,a,i0,a,a,a,a,a,a,a,a,a)', trim(timestamp), &
+ &" RUSHSTATS Rush Larsen ", iterations, " ", trim(kernel_mem_used_str), " ", &
+ & trim(sec_str), " s ", trim(us_str), " us/iter ", trim(variant_desc)
+ flush(stdout)
+ end subroutine print_runtime_stats
+
+
+ ! Do sanity and consistency checks on all of m_gate. Including cross-rank if MPI mode
+ ! Prints PASS or FAIL based on data check results
+ ! If bad data found, will print up to 5 lines of debug info per MPI rank.
+ ! Returns fail count so can be returned to caller.
+ function data_check (m_gate, iterations, kernel_mem_used, nCells)
+ ! Catch misspelled variables
+ implicit none
+ real(8), dimension(0:), intent(inout) :: m_gate
+ integer(8), intent(in) :: iterations
+ real(8), intent(in) :: kernel_mem_used
+ integer(8), intent(in) :: nCells
+ integer(8) :: data_check ! Return value
+
+ ! Local variables
+ integer(8) :: fail_count
+
+ ! In non-MPI mode, treat only process as rank 0
+ integer :: rank = 0
+
+ integer(8) :: i
+
+ ! Initialize variables on every entry
+ fail_count = 0
+
+ if (rank == 0) then
+ ! Print separator before and after output with function name
+ call get_timestamp_string(timestamp)
+ print '(a," Starting data check for sanity and consistency")', trim(timestamp)
+ flush(stdout)
+ end if
+
+ ! Sanity check that kernel not giving garbage
+ ! Found m_gate[0] to be ~.0.506796353074569 after 1 iteration (really 2 with warmup)
+ ! and converges to 0.996321172062538 after 100 iterations. Make sure in that bounds
+ ! for now. With a little slop (~.000001) for now (not sure rounding error expected)
+ if (m_gate(0) < 0.506796) then
+ call get_timestamp_string(timestamp)
+ print '(a," ",a,f17.15,a,a)', trim(timestamp), &
+ & "ERROR Data sanity check m_gate[0]=", m_gate(0), " < 0.506796 (0.506796353074569 min expected value) ", &
+ & trim(variant_desc)
+ flush(stdout)
+ fail_count = fail_count + 1
+
+ else if (m_gate(0) > 0.996322) then
+ call get_timestamp_string(timestamp)
+ print '(a," ",a,f17.15,a,a)', trim(timestamp), &
+ & "ERROR Data sanity check m_gate[0]=", m_gate(0), " > 0.996322 (0.996321172062538 max expected value) ", &
+ & trim(variant_desc)
+ flush(stdout)
+ fail_count = fail_count + 1
+ end if
+
+ ! Every array entry should have the same value as m_gate[0], make sure that is true
+ do i=1,nCells-1
+ if (m_gate(i) .ne. m_gate(0)) then
+ fail_count = fail_count + 1
+ ! Only print at most 5 warnings per rank
+ if (fail_count < 5) then
+ call get_timestamp_string(timestamp)
+ print '(a," ",a,i0,a,f17.15,a,f17.15,a)', trim(timestamp), &
+ & "ERROR Data sanity check m_gate[", i, "]=", m_gate(i), " != m_gate[0]=", m_gate(0), &
+ & trim(variant_desc)
+ flush(stdout)
+ end if
+ if (fail_count == 5) then
+ call get_timestamp_string(timestamp)
+ print '(a," ", a,a)', trim(timestamp), &
+ & "ERROR Data consistency check REMAINING ERROR MESSAGES SUPPRESSED! ", trim(variant_desc)
+ flush(stdout)
+ end if
+ end if
+ end do
+
+ ! Value looks ok, check all ranks match if using MPI
+
+ ! Print out summary PASSED or FAILED count from rank 0 only
+ if (rank == 0) then
+ if (fail_count == 0) then
+ call get_timestamp_string(timestamp)
+ print '(a,a,i0,a,a,a,f17.15,a,a)',&
+ & trim(timestamp)," PASSED Data check ", iterations, " ", trim(kernel_mem_used_str), &
+ & " m_gate[0]=", m_gate(0), " ", trim(variant_desc)
+
+ flush(stdout)
+ else
+ ! Convert kernel_mem_used to left justified string with leading 0
+ call get_timestamp_string(timestamp)
+ print '(a,a,i0,a,a,a,i0,a,f17.15,a,a)',&
+ & trim(timestamp)," FAILED Data check ", iterations, " ", trim(kernel_mem_used_str), &
+ & " with ", fail_count, " DATA CHECK ERRORS m_gate[0]=", m_gate(0), " ", trim(variant_desc)
+
+ flush(stdout)
+ end if
+ end if
+
+ data_check = fail_count
+ end function data_check
+end function rush_larsen_gpu_omp_fort
+
+
+program rush_larsen_fort
+ ! Only include mpi for variants that need it
+ ! Catch misspelled variables
+ implicit none
+ interface
+ function rush_larsen_gpu_omp_fort(iterations, kernel_mem_used)
+ integer(8), intent(IN) :: iterations
+ real(8), intent(IN) :: kernel_mem_used
+ integer :: rush_larsen_gpu_omp_fort
+ end function rush_larsen_gpu_omp_fort
+ end interface
+
+ ! For command line argument parsing
+ character(1000) :: progName
+ character(100) :: arg1char
+ character(100) :: arg2char
+ integer(8) :: max_iterations
+ real(8) :: kernel_mem_used
+ character(100) :: tag
+ integer :: rank = 0 !Rank will be 0 for the no MPI case
+ integer :: fail_count = 0
+
+ call get_command_argument(0,progName) !Get program name from arg 0
+
+ !First, make sure the right number of inputs have been provided
+ if(command_argument_count().ne.2) then
+ if (rank == 0) then
+ write(*,*) "Usage: ", trim(progName), " Iterations Kernel_GBs_used"
+ write(*,*) " "
+ write(*,*) "Measure serial baseline small: ", trim(progName), " 100000 .00000001"
+ write(*,*) "Measure serial baseline large: ", trim(progName), " 100 10"
+ write(*,*) " "
+ write(*,*) trim(VERSION_STRING)
+ write(*,*) " "
+#if defined(COMPILERID)
+ write(*,*) "VARIANT_DESC: ", "gpu_omp_fort", " [", COMPILERID, "]"
+#endif /* defined(COMPILERID) */
+#if !defined(COMPILERID)
+ write(*,*) "VARIANT_DESC: ", "gpu_omp_fort"
+#endif /* !defined(COMPILERID) */
+ write(*,*) " "
+ write(*,*) "Questions? Contact John Gyllenhaal (gyllenhaal1@llnl.gov)\n"
+ end if
+ stop 1
+ end if
+
+ call get_command_argument(1,arg1char) !read in the two values
+ call get_command_argument(2,arg2char)
+
+ read(arg1char,*)max_iterations !then, convert them to REALs
+ read(arg2char,*)kernel_mem_used
+
+ ! Don't print MPI_Init time for MPI version since the way I hid
+ ! functions to enable interop makes timer routines hard to get to.
+
+ ! Run the test
+ fail_count = rush_larsen_gpu_omp_fort (max_iterations, kernel_mem_used)
+
+ ! Return 1 if data checks failed, before MPI Finalize
+ if (fail_count .ne. 0) then
+ stop 1
+ end if
+
+end program rush_larsen_fort
diff --git a/test/smoke-fort-fails/flang-503993/Makefile b/test/smoke-fort-fails/flang-503993/Makefile
new file mode 100644
index 0000000000..bf949841c5
--- /dev/null
+++ b/test/smoke-fort-fails/flang-503993/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = SIMD.2
+TESTSRC_MAIN = SIMD.2.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-503993/SIMD.2.f90 b/test/smoke-fort-fails/flang-503993/SIMD.2.f90
new file mode 100644
index 0000000000..7e58d64b96
--- /dev/null
+++ b/test/smoke-fort-fails/flang-503993/SIMD.2.f90
@@ -0,0 +1,43 @@
+program main
+ implicit none
+ integer, parameter :: N=32
+ integer :: i
+ double precision :: a(N), b(N)
+ do i = 1,N
+ a(i) = i-1
+ b(i) = N-(i-1)
+ end do
+ call work(a, b, N )
+ do i = 1,N
+ print*, i,a(i)
+ end do
+end program
+
+function add1(a,b,fact) result(c)
+ implicit none
+!$omp declare simd(add1) uniform(fact)
+ double precision :: a,b,fact, c
+ c = a + b + fact
+end function
+
+function add2(a,b,i, fact) result(c)
+ implicit none
+!$omp declare simd(add2) uniform(a,b,fact) linear(i:1)
+ integer :: i
+ double precision :: a(*),b(*),fact, c
+ c = a(i) + b(i) + fact
+end function
+
+subroutine work(a, b, n )
+ implicit none
+ double precision :: a(n),b(n), tmp
+ integer :: n, i
+ double precision, external :: add1, add2
+
+ !$omp simd private(tmp)
+ do i = 1,n
+ tmp = add1(a(i), b(i), 1.0d0)
+ a(i) = add2(a, b, i, 1.0d0) + tmp
+ a(i) = a(i) + b(i) + 1.0d0
+ end do
+end subroutine
diff --git a/test/smoke-fort-fails/flang-520335/Makefile b/test/smoke-fort-fails/flang-520335/Makefile
new file mode 100644
index 0000000000..065e7f1e8d
--- /dev/null
+++ b/test/smoke-fort-fails/flang-520335/Makefile
@@ -0,0 +1,16 @@
+#NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = real10
+TESTSRC_MAIN = real10.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-520335/real10.f90 b/test/smoke-fort-fails/flang-520335/real10.f90
new file mode 100644
index 0000000000..aea56f6428
--- /dev/null
+++ b/test/smoke-fort-fails/flang-520335/real10.f90
@@ -0,0 +1,29 @@
+subroutine routine()
+ implicit none
+ !$omp declare target
+ real(kind=10) :: a
+end subroutine routine
+
+
+program real10
+ use, intrinsic :: ieee_arithmetic
+ implicit none
+
+ integer, parameter :: rk = 10
+ real(kind=rk) :: a
+ real(kind=rk) :: b
+ real(kind=rk) :: m
+
+ a = 1.0_rk
+ b = 1.0_rk
+
+ m = ieee_min(a, b)
+ print *, a, b, m
+
+ !$omp target map(tofrom:a,b) map(from:m)
+ a = a + 1.0_rk
+ b = b - 5.0_rk
+ m = ieee_min(a, b)
+ !$omp end target
+ print *, a, b, m
+end program
diff --git a/test/smoke-fort-fails/flang-524208/Makefile b/test/smoke-fort-fails/flang-524208/Makefile
new file mode 100644
index 0000000000..c22559f750
--- /dev/null
+++ b/test/smoke-fort-fails/flang-524208/Makefile
@@ -0,0 +1,17 @@
+include ../../Makefile.defs
+
+TESTNAME = cycle_not_allowed
+TESTSRC_MAIN = cycle_not_allowed.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./doit.sh > ${TESTNAME}.out 2>&1 && ./chkit.sh ${TESTNAME}.out
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-524208/cycle_not_allowed.f90 b/test/smoke-fort-fails/flang-524208/cycle_not_allowed.f90
new file mode 100644
index 0000000000..bcc9fc7543
--- /dev/null
+++ b/test/smoke-fort-fails/flang-524208/cycle_not_allowed.f90
@@ -0,0 +1,30 @@
+program test
+ implicit none
+ integer,parameter :: np = 100
+ integer :: I,J
+ real,allocatable,dimension(:,:) :: A
+
+ allocate(A(np,np))
+ A=0
+
+ !$omp target enter data map(alloc:A)
+ !$omp target teams distribute map(present,to:A)
+ do i=1,np
+
+ !$omp parallel do
+ do j=1,np
+ A(j,i) = j + (i - 1) * np
+ end do
+
+ if(i < 5) CYCLE
+
+ !$omp parallel do
+ do j=1,np
+ A(j,i) = A(j,i) + abs(A(i,j))
+ end do
+
+ end do
+ !$omp target exit data map(release:A)
+ deallocate(A)
+
+end program test
diff --git a/test/smoke-fort-fails/flang-527182/Makefile b/test/smoke-fort-fails/flang-527182/Makefile
new file mode 100644
index 0000000000..048d3ea909
--- /dev/null
+++ b/test/smoke-fort-fails/flang-527182/Makefile
@@ -0,0 +1,21 @@
+include ../../Makefile.defs
+
+TESTNAME = buildrun
+TESTSRC_MAIN =
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+FC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
+
+buildrun:
+ ${FC} ${OMP_FLAGS} -fPIC -c foo.F90 -o foo.o
+ ${FC} ${OMP_FLAGS} -fPIC -c main.F90 -o main.o
+ ${FC} -Wl,--disable-new-dtags -shared -Wl,-soname,libfoo.so -o libfoo.so foo.o -Wl,-rpath,"$$ORIGIN/../lib64"
+ ${FC} ${OMP_FLAGS} -Wl,--disable-new-dtags main.o -o test -L . -lfoo $(FLANG_GPU_LINK_FLAGS)
+ LD_LIBRARY_PATH="." ./test
diff --git a/test/smoke-fort-fails/flang-527182/foo.F90 b/test/smoke-fort-fails/flang-527182/foo.F90
new file mode 100644
index 0000000000..eaaa590f09
--- /dev/null
+++ b/test/smoke-fort-fails/flang-527182/foo.F90
@@ -0,0 +1,44 @@
+module foo
+
+ implicit none
+ public
+
+ type foo_type
+ real(4), allocatable, dimension(:) :: x
+ contains
+ procedure :: allocate => allocate_foo
+ procedure :: deallocate => deallocate_foo
+ procedure, nopass :: create_device
+ procedure, nopass :: delete_device
+ end type foo_type
+
+ contains
+ subroutine create_device(this)
+ type(foo_type), intent(inout) :: this
+ integer i
+ !$omp target enter data map(alloc:this%x) if(allocated(this%x))
+
+ ! initialize with a kenrel to 0
+ !$omp target teams distribute parallel do
+ do i=1,size(this%x,1)
+ this%x(i)=0.0
+ enddo
+ !$omp end target teams distribute parallel do
+ end subroutine create_device
+
+ subroutine delete_device(this)
+ type(foo_type), intent(inout) :: this
+ !$omp target exit data map(delete:this%x) if(allocated(this%x))
+ end subroutine delete_device
+
+ subroutine allocate_foo(this, n)
+ class(foo_type), intent(inout) :: this
+ integer, intent(in) :: n
+ allocate(this%x(n))
+ end subroutine allocate_foo
+
+ subroutine deallocate_foo(this)
+ class(foo_type), intent(inout) :: this
+ deallocate(this%x)
+ end subroutine deallocate_foo
+end module foo
diff --git a/test/smoke-fort-fails/flang-527182/main.F90 b/test/smoke-fort-fails/flang-527182/main.F90
new file mode 100644
index 0000000000..d434902b08
--- /dev/null
+++ b/test/smoke-fort-fails/flang-527182/main.F90
@@ -0,0 +1,13 @@
+program main
+ use foo, only: foo_type
+ implicit none
+ type(foo_type) :: bar
+
+ call bar%allocate(10)
+ !$omp target enter data map(TO:bar)
+ call bar%create_device(bar)
+ call bar%delete_device(bar)
+ !$omp target exit data map(delete:bar)
+ call bar%deallocate()
+
+end program main
diff --git a/test/smoke-fort-fails/flang-528116/Makefile b/test/smoke-fort-fails/flang-528116/Makefile
new file mode 100644
index 0000000000..8090ae583c
--- /dev/null
+++ b/test/smoke-fort-fails/flang-528116/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = target-firstprivate
+TESTSRC_MAIN = target-firstprivate.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-528116/target-firstprivate.f90 b/test/smoke-fort-fails/flang-528116/target-firstprivate.f90
new file mode 100644
index 0000000000..febb3b4a19
--- /dev/null
+++ b/test/smoke-fort-fails/flang-528116/target-firstprivate.f90
@@ -0,0 +1,14 @@
+program foo
+ implicit none
+ integer :: i
+ i = 42
+ ! if(.false.) is intentional to execute the target region on the host
+ ! to see if it still adheres to OpenMP semantics and host execution
+ !$omp target if(.false.)
+ i = 21
+ !$omp end target
+ if (i.ne.42) then
+ print '("Got ",I," but expected ",I)', i, 42
+ stop 1
+ end if
+end program foo
diff --git a/test/smoke-fort-fails/flang-463332/Makefile b/test/smoke-fort-fails/flang-533615/Makefile
similarity index 84%
rename from test/smoke-fort-fails/flang-463332/Makefile
rename to test/smoke-fort-fails/flang-533615/Makefile
index 21e7e8da70..66245d1931 100644
--- a/test/smoke-fort-fails/flang-463332/Makefile
+++ b/test/smoke-fort-fails/flang-533615/Makefile
@@ -1,8 +1,8 @@
NOOPT = 1
include ../../Makefile.defs
-TESTNAME = present
-TESTSRC_MAIN = present.F90
+TESTNAME = gpumem2
+TESTSRC_MAIN = gpumem2.f90
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
diff --git a/test/smoke-fort-fails/flang-533615/gpumem2.f90 b/test/smoke-fort-fails/flang-533615/gpumem2.f90
new file mode 100644
index 0000000000..678c14686c
--- /dev/null
+++ b/test/smoke-fort-fails/flang-533615/gpumem2.f90
@@ -0,0 +1,16 @@
+module mod
+ implicit none
+ type :: mattype
+ real(4),pointer :: array(:,:,:)
+ integer(4) :: scalar
+ end type
+ type :: data
+ type(mattype) :: memb
+ end type
+contains
+ subroutine us_gpumem(dat)
+ implicit none
+ type(data), pointer :: dat
+ !$omp target enter data map(to:dat,dat%memb)
+ end subroutine us_gpumem
+end module mod
diff --git a/test/smoke-fort-fails/flang-535320/Makefile b/test/smoke-fort-fails/flang-535320/Makefile
new file mode 100644
index 0000000000..9310cb4256
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535320/Makefile
@@ -0,0 +1,18 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = test
+TESTSRC_MAIN = test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-535320/test.f90 b/test/smoke-fort-fails/flang-535320/test.f90
new file mode 100644
index 0000000000..641219cc60
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535320/test.f90
@@ -0,0 +1,25 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+module foo
+
+contains
+ subroutine rout(ids, nb)
+ implicit none
+ !$omp declare target
+ integer(kind=4), dimension(:), intent(in) :: ids
+ integer(kind=4), intent(in) :: nb
+ integer(kind=4), dimension(1) :: tmp
+ tmp = findloc(ids, -nb)
+ end subroutine rout
+end module
+
+program finder
+ implicit none
+
+ !$omp target
+ !$omp end target
+
+end program
diff --git a/test/smoke-fort-fails/flang-535416-O0/Makefile b/test/smoke-fort-fails/flang-535416-O0/Makefile
new file mode 100644
index 0000000000..733e7e54c5
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535416-O0/Makefile
@@ -0,0 +1,20 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = test
+TESTSRC_MAIN = test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+CFLAGS = -O0 $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNENV = HSA_XNACK=1
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-535416-O0/test.f90 b/test/smoke-fort-fails/flang-535416-O0/test.f90
new file mode 100644
index 0000000000..296ced3116
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535416-O0/test.f90
@@ -0,0 +1,60 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+MODULE rep2
+ implicit none
+ public :: nvars
+
+ INTEGER :: nvars = 5
+END MODULE
+
+MODULE rep
+
+ use rep2, ONLY:nvars
+ implicit none
+
+ public :: foo
+
+ contains
+
+ SUBROUTINE foo()
+ implicit none
+ INTEGER :: i,j,k
+ INTEGER :: n, m
+ REAL(KIND=8), DIMENSION(:,:,:), allocatable :: b
+
+ REAL(KIND=8) :: mm(nvars), mm2(nvars)
+ n=100
+ m=29
+
+ ALLOCATE(b(1:nvars,1:m,1:n))
+ b=1.0_8
+
+ !$omp target teams distribute parallel do collapse(2) private(mm,mm2)
+ DO k=1,n
+ DO j=1,m
+ !in the true app something else here
+ mm = 2.0_8
+ mm2 = 1.0_8
+ DO i=1,nvars
+ b(i,j,k) = b(i,j,k) + (mm(i) - mm2(i))
+ END DO
+ END DO
+ END DO
+
+ IF(ANY(ABS(b-2.0_8)>1.0e-9_8)) THEN
+ WRITE(*,*) "failed",b(1,1,1), b(2,1,1)
+ ELSE
+ WRITE(*,*) "success"
+ END IF
+ END SUBROUTINE
+END MODULE
+
+PROGRAM rep_arraysyntax
+ use :: rep, ONLY:foo
+ implicit none
+ CALL foo()
+
+END PROGRAM
diff --git a/test/smoke-fort-fails/flang-535416-O2/Makefile b/test/smoke-fort-fails/flang-535416-O2/Makefile
new file mode 100644
index 0000000000..9202dd5046
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535416-O2/Makefile
@@ -0,0 +1,20 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = test
+TESTSRC_MAIN = test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+CFLAGS = -O2 $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNENV = HSA_XNACK=1
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-535416-O2/test.f90 b/test/smoke-fort-fails/flang-535416-O2/test.f90
new file mode 100644
index 0000000000..296ced3116
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535416-O2/test.f90
@@ -0,0 +1,60 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+MODULE rep2
+ implicit none
+ public :: nvars
+
+ INTEGER :: nvars = 5
+END MODULE
+
+MODULE rep
+
+ use rep2, ONLY:nvars
+ implicit none
+
+ public :: foo
+
+ contains
+
+ SUBROUTINE foo()
+ implicit none
+ INTEGER :: i,j,k
+ INTEGER :: n, m
+ REAL(KIND=8), DIMENSION(:,:,:), allocatable :: b
+
+ REAL(KIND=8) :: mm(nvars), mm2(nvars)
+ n=100
+ m=29
+
+ ALLOCATE(b(1:nvars,1:m,1:n))
+ b=1.0_8
+
+ !$omp target teams distribute parallel do collapse(2) private(mm,mm2)
+ DO k=1,n
+ DO j=1,m
+ !in the true app something else here
+ mm = 2.0_8
+ mm2 = 1.0_8
+ DO i=1,nvars
+ b(i,j,k) = b(i,j,k) + (mm(i) - mm2(i))
+ END DO
+ END DO
+ END DO
+
+ IF(ANY(ABS(b-2.0_8)>1.0e-9_8)) THEN
+ WRITE(*,*) "failed",b(1,1,1), b(2,1,1)
+ ELSE
+ WRITE(*,*) "success"
+ END IF
+ END SUBROUTINE
+END MODULE
+
+PROGRAM rep_arraysyntax
+ use :: rep, ONLY:foo
+ implicit none
+ CALL foo()
+
+END PROGRAM
diff --git a/test/smoke-fort-fails/flang-535416-no-aassign/Makefile b/test/smoke-fort-fails/flang-535416-no-aassign/Makefile
new file mode 100644
index 0000000000..ef8b0a02b6
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535416-no-aassign/Makefile
@@ -0,0 +1,20 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = test
+TESTSRC_MAIN = test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+CFLAGS = -O2
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNENV = HSA_XNACK=1
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-535416-no-aassign/test.f90 b/test/smoke-fort-fails/flang-535416-no-aassign/test.f90
new file mode 100644
index 0000000000..87fec6fc1a
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535416-no-aassign/test.f90
@@ -0,0 +1,62 @@
+! This test works if we replace nvars with 5 in target region
+MODULE rep2
+ implicit none
+ public :: nvars
+
+ INTEGER :: nvars = 5
+END MODULE
+
+MODULE rep
+
+ use rep2, ONLY:nvars
+ implicit none
+
+ public :: foo
+
+ contains
+
+ SUBROUTINE foo()
+ implicit none
+ INTEGER :: i,j,k,i1,i2
+ INTEGER :: n, m
+ REAL(KIND=8), DIMENSION(:,:,:), allocatable :: b
+
+ REAL(KIND=8) :: mm(nvars), mm2(nvars)
+ n=100
+ m=29
+
+ ALLOCATE(b(1:nvars,1:m,1:n))
+ b=1.0_8
+
+ !$omp target teams distribute parallel do collapse(2) private(mm,mm2)
+ DO k=1,n
+ DO j=1,m
+ !replaced mm = 2.0_8
+ DO i1 =1,nvars
+ mm(i1) = 2.0_8
+ END DO
+ !replaced mm2 = 1.0_8
+ DO i2 =1,nvars
+ mm2(i2) = 1.0_8
+ END DO
+ !in the true app something else here
+ DO i=1,nvars
+ b(i,j,k) = b(i,j,k) + (mm(i) - mm2(i))
+ END DO
+ END DO
+ END DO
+
+ IF(ANY(ABS(b-2.0_8)>1.0e-9_8)) THEN
+ WRITE(*,*) "failed",b(1,1,1), b(2,1,1)
+ ELSE
+ WRITE(*,*) "success"
+ END IF
+ END SUBROUTINE
+END MODULE
+
+PROGRAM rep_arraysyntax
+ use :: rep, ONLY:foo
+ implicit none
+ CALL foo()
+
+END PROGRAM
diff --git a/test/smoke-fort-fails/flang-535416-private/Makefile b/test/smoke-fort-fails/flang-535416-private/Makefile
new file mode 100644
index 0000000000..33bbf1f055
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535416-private/Makefile
@@ -0,0 +1,20 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = test
+TESTSRC_MAIN = test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+CFLAGS = -O0
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNENV = HSA_XNACK=1
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-535416-private/test.f90 b/test/smoke-fort-fails/flang-535416-private/test.f90
new file mode 100644
index 0000000000..794c2017b3
--- /dev/null
+++ b/test/smoke-fort-fails/flang-535416-private/test.f90
@@ -0,0 +1,34 @@
+MODULE rep2
+ implicit none
+ public :: nvars
+
+ INTEGER :: nvars = 5
+END MODULE
+
+MODULE rep
+
+ use rep2, ONLY:nvars
+ implicit none
+
+ public :: foo
+
+ contains
+
+ SUBROUTINE foo()
+ implicit none
+ INTEGER :: i
+ REAL(KIND=8) :: mm(5)
+ !$omp target teams distribute parallel do private(mm)
+ DO i =1,nvars
+ mm(i) = 2.0_8
+ END DO
+ WRITE(*,*) "success"
+ END SUBROUTINE
+END MODULE
+
+PROGRAM rep_arraysyntax
+ use :: rep, ONLY:foo
+ implicit none
+ CALL foo()
+
+END PROGRAM
diff --git a/test/smoke-fort-fails/flang-537499/Makefile b/test/smoke-fort-fails/flang-537499/Makefile
new file mode 100644
index 0000000000..8fc489a5d5
--- /dev/null
+++ b/test/smoke-fort-fails/flang-537499/Makefile
@@ -0,0 +1,20 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = test
+TESTSRC_MAIN = test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNENV = HSA_XNACK=1
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-537499/test.f90 b/test/smoke-fort-fails/flang-537499/test.f90
new file mode 100644
index 0000000000..003ce8c7e8
--- /dev/null
+++ b/test/smoke-fort-fails/flang-537499/test.f90
@@ -0,0 +1,28 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+program main
+ implicit none
+
+ !$omp requires unified_shared_memory
+
+ !only fails if a is in a type
+ TYPE :: polytype
+ REAL, DIMENSION(:),ALLOCATABLE :: a
+ END TYPE
+ TYPE(polytype) :: poly
+
+ integer,parameter :: n = 10
+ integer :: j
+
+ ALLOCATE(poly%a(1:3))
+ !$omp target teams distribute parallel do private(poly)
+ do j=1,n
+ poly%a = 2.0_8 !array assign in kernel to a type member is the issue
+ enddo
+ !$omp end target teams distribute parallel do
+
+ DEALLOCATE(poly%a)
+end program
diff --git a/test/smoke-fort-fails/flang-537934/Makefile b/test/smoke-fort-fails/flang-537934/Makefile
new file mode 100644
index 0000000000..118dc34b19
--- /dev/null
+++ b/test/smoke-fort-fails/flang-537934/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = reproducer
+TESTSRC_MAIN = reproducer.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-537934/reproducer.f90 b/test/smoke-fort-fails/flang-537934/reproducer.f90
new file mode 100644
index 0000000000..5a6c6d034d
--- /dev/null
+++ b/test/smoke-fort-fails/flang-537934/reproducer.f90
@@ -0,0 +1,42 @@
+PROGRAM reproducer
+ IMPLICIT NONE
+
+ REAL, ALLOCATABLE, TARGET, DIMENSION(:) :: arr
+
+ INTEGER, PARAMETER :: ngrids = 2
+ INTEGER, PARAMETER :: cellsperdim = 4
+ INTEGER, PARAMETER :: cellspergrid = cellsperdim**3
+ INTEGER :: iouter, ip3
+
+ ALLOCATE(arr(ngrids * cellspergrid), source=-1.0)
+
+ !$omp target teams distribute private(ip3) map(tofrom: arr)
+ DO iouter = 1, ngrids
+ ip3 = (iouter - 1) * cellspergrid + 1
+ CALL kernel(arr(ip3))
+ END DO
+ !$omp end target teams distribute
+
+ PRINT *, arr
+ DEALLOCATE(arr)
+CONTAINS
+ SUBROUTINE kernel(gridarr)
+ !$omp declare target
+
+ ! Subroutine arguments
+ REAL, INTENT(INOUT), DIMENSION(cellsperdim, cellsperdim, cellsperdim) :: gridarr
+
+ ! Local variables
+ INTEGER :: i, j, k
+
+ !$omp parallel do collapse(2) private(i, j, k) shared(gridarr)
+ DO i = 1, cellsperdim
+ DO j = 1, cellsperdim
+ DO k = 1, cellsperdim
+ gridarr(k, j, i) = REAL(i)
+ END DO
+ END DO
+ END DO
+ !$omp end parallel do
+ END SUBROUTINE kernel
+END PROGRAM reproducer
diff --git a/test/smoke-fort-fails/flang-539234/Makefile b/test/smoke-fort-fails/flang-539234/Makefile
new file mode 100644
index 0000000000..0fb4f77224
--- /dev/null
+++ b/test/smoke-fort-fails/flang-539234/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = split_teams_distribute_parallel_do
+TESTSRC_MAIN = split_teams_distribute_parallel_do.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-539234/split_teams_distribute_parallel_do.f90 b/test/smoke-fort-fails/flang-539234/split_teams_distribute_parallel_do.f90
new file mode 100644
index 0000000000..ef7cc791cf
--- /dev/null
+++ b/test/smoke-fort-fails/flang-539234/split_teams_distribute_parallel_do.f90
@@ -0,0 +1,53 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+! compile with:
+!
+! amdflang -O2 -fopenmp --offload-arch=gfx90a -o split_teams_distribute_parallel_do split_teams_distribute_parallel_do.f90
+
+module foo_mod
+ implicit none
+contains
+ subroutine foo(ib,val,arr)
+ implicit none
+ integer, intent(in) :: ib, val
+ integer, dimension(:), intent(inout) :: arr
+ integer :: i
+ !$omp declare target(foo)
+
+ !$omp parallel do
+ do i=1,ib
+ arr(i)=arr(i)+val
+ end do
+ end subroutine foo
+end module foo_mod
+
+program hierarchical
+ use foo_mod
+ implicit none
+ integer :: i, j, val
+ integer :: a(10,10)
+
+ a=1
+ val=2
+ !$omp target enter data map(to:a)
+
+ !$omp target teams distribute
+ do j=1,10
+ call foo(10,val,a(:,j))
+ end do
+
+ !$omp target update from(a)
+ do j=1,10
+ do i=1,10
+ if (a(i,j)/=3) then
+ print *, 'Error for indexes', i, j
+ print *, 'Value is', a(i,j)
+ stop 1
+ end if
+ end do
+ end do
+ print *, 'Success!!!'
+end program hierarchical
diff --git a/test/smoke-fort-fails/flang-539854/Makefile b/test/smoke-fort-fails/flang-539854/Makefile
new file mode 100644
index 0000000000..0d404dcb12
--- /dev/null
+++ b/test/smoke-fort-fails/flang-539854/Makefile
@@ -0,0 +1,16 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = reproducer-539854
+TESTSRC_MAIN = reproducer-539854.F
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-539854/reproducer-539854.F b/test/smoke-fort-fails/flang-539854/reproducer-539854.F
new file mode 100644
index 0000000000..8d0ae3ed3c
--- /dev/null
+++ b/test/smoke-fort-fails/flang-539854/reproducer-539854.F
@@ -0,0 +1,11 @@
+ subroutine rout()
+ real, dimension(29) :: arr1, arr2
+ data arr1/1.11,1.11,1.11,1.11,1.11,1.11,1.11,1.11,1.11,1.11
+ $ ,1.11,1.11,1.11,1.11,1.11,1.11,1.11,1.11,1.11,1.11,1.11,1.11
+ $ ,1.11,1.11,1.11,1.11,1.11,1.11,1.11/, arr2/1 .11E
+ $ -11,1.11E-11,1.11E-11,1.11E-11,1.11E-11,1.11E -11,1.11E -11,1
+ $ .11E-11,1.11E+11,1.11E+11,1.11E+11,1.11E+11,1 .11E+11,1 .11E
+ $ +11,1.11E+11,1.11E+11,1.11E+11,1.11E+11,1.11E+11 ,1.11E +11,1
+ $ .11E+11,1.11E-11,1.11E-11,1.11E-11,1.11E-11,1.11E -11,1 .11E
+ $ -11,1.11E-11,1.11E-11/
+ end subroutine rout
diff --git a/test/smoke-fort-fails/flang-550360/Makefile b/test/smoke-fort-fails/flang-550360/Makefile
new file mode 100644
index 0000000000..0f63e4a002
--- /dev/null
+++ b/test/smoke-fort-fails/flang-550360/Makefile
@@ -0,0 +1,16 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = parameter_dsa
+TESTSRC_MAIN = parameter_dsa.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-550360/parameter_dsa.f90 b/test/smoke-fort-fails/flang-550360/parameter_dsa.f90
new file mode 100644
index 0000000000..4d0cda52b3
--- /dev/null
+++ b/test/smoke-fort-fails/flang-550360/parameter_dsa.f90
@@ -0,0 +1,15 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+program shrd
+ implicit none
+ integer, parameter :: n = 7
+ real, parameter :: m = 7.0
+
+
+ !$omp parallel shared(n) firstprivate(m)
+ print *, n, m
+ !$omp end parallel
+end program shrd
diff --git a/test/smoke-fort-fails/flang-577054/Makefile b/test/smoke-fort-fails/flang-577054/Makefile
new file mode 100644
index 0000000000..b7a258e8fd
--- /dev/null
+++ b/test/smoke-fort-fails/flang-577054/Makefile
@@ -0,0 +1,16 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = flang-577054
+TESTSRC_MAIN = flang-577054.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/flang-577054/flang-577054.f90 b/test/smoke-fort-fails/flang-577054/flang-577054.f90
new file mode 100644
index 0000000000..e1031393d0
--- /dev/null
+++ b/test/smoke-fort-fails/flang-577054/flang-577054.f90
@@ -0,0 +1,19 @@
+module reproducer
+ implicit none
+ type::inner
+ sequence
+ integer :: intgr
+ type(inner), pointer :: ptr
+ end type
+ type::outer
+ sequence
+ real, allocatable :: arr
+ type(inner), pointer :: ptr
+ end type
+contains
+ subroutine routine(arg)
+ implicit none
+ type(outer) :: arg
+ !$omp target enter data map(to:arg)
+ end subroutine routine
+end module reproducer
\ No newline at end of file
diff --git a/test/smoke-fort-fails/inc_omp_lib_h/Makefile b/test/smoke-fort-fails/inc_omp_lib_h/Makefile
new file mode 100644
index 0000000000..eef69cac32
--- /dev/null
+++ b/test/smoke-fort-fails/inc_omp_lib_h/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = inc_omp_lib_h
+TESTSRC_MAIN = inc_omp_lib_h.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/inc_omp_lib_h/inc_omp_lib_h.f90 b/test/smoke-fort-fails/inc_omp_lib_h/inc_omp_lib_h.f90
new file mode 100644
index 0000000000..fe0c17b405
--- /dev/null
+++ b/test/smoke-fort-fails/inc_omp_lib_h/inc_omp_lib_h.f90
@@ -0,0 +1,7 @@
+ PROGRAM PGD
+ IMPLICIT NONE
+ INCLUDE 'omp_lib.h'
+ INTEGER :: x
+ X=0
+ write(*,*) "hello ", X
+ END PROGRAM PGD
diff --git a/test/smoke-fort-dev/multi-generic-exe/Makefile b/test/smoke-fort-fails/multi-generic-exe/Makefile
similarity index 100%
rename from test/smoke-fort-dev/multi-generic-exe/Makefile
rename to test/smoke-fort-fails/multi-generic-exe/Makefile
diff --git a/test/smoke-fort-dev/multi-generic-exe/main.f90 b/test/smoke-fort-fails/multi-generic-exe/main.f90
similarity index 100%
rename from test/smoke-fort-dev/multi-generic-exe/main.f90
rename to test/smoke-fort-fails/multi-generic-exe/main.f90
diff --git a/test/smoke-fort-dev/multi-generic-exe/vadd.f90 b/test/smoke-fort-fails/multi-generic-exe/vadd.f90
similarity index 100%
rename from test/smoke-fort-dev/multi-generic-exe/vadd.f90
rename to test/smoke-fort-fails/multi-generic-exe/vadd.f90
diff --git a/test/smoke-fort-dev/multi-generic-exe/vmul.f90 b/test/smoke-fort-fails/multi-generic-exe/vmul.f90
similarity index 100%
rename from test/smoke-fort-dev/multi-generic-exe/vmul.f90
rename to test/smoke-fort-fails/multi-generic-exe/vmul.f90
diff --git a/test/smoke-fort-fails/target-cmplx4-pow2/Makefile b/test/smoke-fort-fails/target-cmplx4-pow2/Makefile
new file mode 100644
index 0000000000..329c7783a7
--- /dev/null
+++ b/test/smoke-fort-fails/target-cmplx4-pow2/Makefile
@@ -0,0 +1,17 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = target-cmplx4-pow2
+TESTSRC_MAIN = target-cmplx4-pow2.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/target-cmplx4-pow2/target-cmplx4-pow2.f90 b/test/smoke-fort-fails/target-cmplx4-pow2/target-cmplx4-pow2.f90
new file mode 100644
index 0000000000..bf7e55e45d
--- /dev/null
+++ b/test/smoke-fort-fails/target-cmplx4-pow2/target-cmplx4-pow2.f90
@@ -0,0 +1,41 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+program test
+ implicit none
+ integer :: i
+ integer,parameter :: N = 10
+ complex(4) :: A(N), B(N)
+ real(8) :: rdiff, idiff, remax, iemax
+ real(8),parameter :: eps = 1.0e-5
+
+ do i = 1, N
+ A(i) = i * (2, 1)
+ B(i) = A(i) ** 2
+ enddo
+
+!$omp target parallel do map(tofrom:A)
+ do i = 1, N
+ A(i) = A(i) ** 2
+ enddo
+!$omp end target parallel do
+
+ write(*, *), "A=", A
+ write(*, *), "B=", B
+
+ do i = 1, N
+ rdiff = abs(A(i)%re - B(i)%re)
+ idiff = abs(A(i)%im - B(i)%im)
+ remax = 2 * max(eps, eps * abs(B(i)%re))
+ iemax = 2 * max(eps, eps * abs(B(i)%im))
+ if ((rdiff > remax) .or. (idiff > iemax)) then
+ write(*,*) 'Error A != B', A(i), B(i)
+ write(*,*) ' diff:(', rdiff, ', ', idiff, ')'
+ write(*,*) ' emax:(', remax, ', ', iemax, ')'
+ stop 1
+ stop 1
+ endif
+ enddo
+end program test
diff --git a/test/smoke-fort-fails/target-cmplx8-pow2/Makefile b/test/smoke-fort-fails/target-cmplx8-pow2/Makefile
new file mode 100644
index 0000000000..817a12cddd
--- /dev/null
+++ b/test/smoke-fort-fails/target-cmplx8-pow2/Makefile
@@ -0,0 +1,17 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = target-cmplx8-pow2
+TESTSRC_MAIN = target-cmplx8-pow2.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG = flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/target-cmplx8-pow2/target-cmplx8-pow2.f90 b/test/smoke-fort-fails/target-cmplx8-pow2/target-cmplx8-pow2.f90
new file mode 100644
index 0000000000..f83577e13a
--- /dev/null
+++ b/test/smoke-fort-fails/target-cmplx8-pow2/target-cmplx8-pow2.f90
@@ -0,0 +1,40 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+program test
+ implicit none
+ integer :: i
+ integer,parameter :: N = 10
+ complex(8) :: A(N), B(N)
+ real(8) :: rdiff, idiff, remax, iemax
+ real(8),parameter :: eps = 1.0e-7
+
+ do i = 1, N
+ A(i) = i * (2, 1)
+ B(i) = A(i) ** 2
+ enddo
+
+!$omp target parallel do map(tofrom:A)
+ do i = 1, N
+ A(i) = A(i) ** 2
+ enddo
+!$omp end target parallel do
+
+ write(*, *), "A=", A
+ write(*, *), "B=", B
+
+ do i = 1, N
+ rdiff = abs(A(i)%re - B(i)%re)
+ idiff = abs(A(i)%im - B(i)%im)
+ remax = 2 * max(eps, eps * abs(B(i)%re))
+ iemax = 2 * max(eps, eps * abs(B(i)%im))
+ if ((rdiff > remax) .or. (idiff > iemax)) then
+ write(*,*) 'Error A != B', A(i), B(i)
+ write(*,*) ' diff:(', rdiff, ', ', idiff, ')'
+ write(*,*) ' emax:(', remax, ', ', iemax, ')'
+ stop 1
+ endif
+ enddo
+end program test
diff --git a/test/smoke-fort-fails/target-teams-call/Makefile b/test/smoke-fort-fails/target-teams-call/Makefile
new file mode 100644
index 0000000000..62daf4622c
--- /dev/null
+++ b/test/smoke-fort-fails/target-teams-call/Makefile
@@ -0,0 +1,18 @@
+NOOPT = 1
+NOOMP = 1
+include ../../Makefile.defs
+
+TESTNAME = target-teams-call
+TESTSRC_MAIN = target-teams-call.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang -O0
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+#RUNCMD = ./doit.sh > ${TESTNAME}.out 2>&1 && ./chkit.sh ${TESTNAME}.out
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/target-teams-call/target-teams-call.f90 b/test/smoke-fort-fails/target-teams-call/target-teams-call.f90
new file mode 100644
index 0000000000..26e79ba878
--- /dev/null
+++ b/test/smoke-fort-fails/target-teams-call/target-teams-call.f90
@@ -0,0 +1,30 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+program repro
+ implicit none
+ integer :: k
+ real, allocatable, dimension(:) :: data1
+
+ allocate(data1(1))
+ data1(1) = 1
+
+ !$omp target teams distribute parallel do map(tofrom: data1)
+ do k=1,1
+ call matrix_vector_code(42., data1)
+ end do
+ !$omp end target teams distribute parallel do
+
+ print *, ">>>> data1=", data1
+
+contains
+
+ subroutine matrix_vector_code(cell, lhs)
+ implicit none
+ real, intent(in) :: cell
+ real, dimension(1), intent(inout) :: lhs
+ lhs(1) = cell
+ end subroutine matrix_vector_code
+end program repro
diff --git a/test/smoke-fort-fails/tgt-generic-parallel-reduction/Makefile b/test/smoke-fort-fails/tgt-generic-parallel-reduction/Makefile
new file mode 100644
index 0000000000..e2d276dfdb
--- /dev/null
+++ b/test/smoke-fort-fails/tgt-generic-parallel-reduction/Makefile
@@ -0,0 +1,12 @@
+include ../../Makefile.defs
+
+TESTNAME = tgt-generic-parallel-reduction
+TESTSRC_MAIN = tgt-generic-parallel-reduction.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/tgt-generic-parallel-reduction/tgt-generic-parallel-reduction.f90 b/test/smoke-fort-fails/tgt-generic-parallel-reduction/tgt-generic-parallel-reduction.f90
new file mode 100644
index 0000000000..1a7ef03fa4
--- /dev/null
+++ b/test/smoke-fort-fails/tgt-generic-parallel-reduction/tgt-generic-parallel-reduction.f90
@@ -0,0 +1,29 @@
+subroutine generic_parallel_reduction(output_var)
+ implicit none
+ integer, intent(out) :: output_var
+
+ integer :: i
+ integer :: private_var
+
+ !$omp target private(private_var) map(from: output_var)
+ private_var = 0
+
+ !$omp parallel do reduction(+:private_var)
+ do i = 1, 32
+ private_var = private_var + 1
+ end do
+
+ output_var = private_var
+ !$omp end target
+end subroutine
+
+program main
+ implicit none
+ integer :: val
+
+ call generic_parallel_reduction(val)
+ if ( val .ne. 32 ) then
+ print *, 'Unexpected result:', val
+ stop 1
+ end if
+end program
diff --git a/test/smoke-fort-fails/tgt-outlined-parallel/Makefile b/test/smoke-fort-fails/tgt-outlined-parallel/Makefile
new file mode 100644
index 0000000000..0dfdf39554
--- /dev/null
+++ b/test/smoke-fort-fails/tgt-outlined-parallel/Makefile
@@ -0,0 +1,12 @@
+include ../../Makefile.defs
+
+TESTNAME = tgt-outlined-parallel
+TESTSRC_MAIN = tgt-outlined-parallel.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-fails/tgt-outlined-parallel/tgt-outlined-parallel.f90 b/test/smoke-fort-fails/tgt-outlined-parallel/tgt-outlined-parallel.f90
new file mode 100644
index 0000000000..bf0176f63a
--- /dev/null
+++ b/test/smoke-fort-fails/tgt-outlined-parallel/tgt-outlined-parallel.f90
@@ -0,0 +1,76 @@
+module mymod
+ implicit none
+contains
+ subroutine reduction_and_val(val, res)
+ implicit none
+ integer, intent(in) :: val
+ integer, intent(inout) :: res
+ integer :: i
+
+ !$omp parallel do reduction(+:res)
+ do i=1,10
+ res=res+val
+ end do
+ end subroutine
+
+ subroutine assumed_shape_array(arr)
+ implicit none
+ integer, dimension(:), intent(inout) :: arr
+ integer :: i
+
+ !$omp parallel do
+ do i=1,10
+ arr(i)=arr(i)+2
+ end do
+ end subroutine
+
+ subroutine reduction_and_temp(val, ib)
+ implicit none
+ integer, intent(inout) :: val
+ integer, intent(in) :: ib
+ integer :: i
+
+ !$omp parallel do reduction(+:val)
+ do i=1,ib
+ val = val + 1
+ end do
+ end subroutine
+end module mymod
+
+program main
+ use mymod
+ implicit none
+ integer :: i, val, a, b(10), c
+
+ val=2
+ a=0
+ !$omp target teams distribute reduction(+:a)
+ do i=1,10
+ call reduction_and_val(val, a)
+ end do
+ if (a /= 200) then
+ print *, "Test failed (1): Expected 200 but got", a
+ stop 1
+ end if
+
+ b=1
+ !$omp target map(tofrom:b)
+ call assumed_shape_array(b)
+ !$omp end target
+ do i=1,10
+ if (b(i) /= 3) then
+ print *, "Test failed (2): Expected all 3 but got", b
+ stop 1
+ end if
+ end do
+
+ c=0
+ !$omp target teams distribute reduction(+:c)
+ do i=1,10
+ call reduction_and_temp(c, 10)
+ end do
+ if (c /= 100) then
+ print *, "Test failed (3): Expected 100 but got", c
+ stop 1
+ end if
+end program
diff --git a/test/smoke-fort-limbo/Makefile b/test/smoke-fort-limbo/Makefile
index 34bcf9ae35..c353bf7252 100644
--- a/test/smoke-fort-limbo/Makefile
+++ b/test/smoke-fort-limbo/Makefile
@@ -1,13 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- clause_task_detach \
- flang-444386 \
- flang-474712 \
- iso_fortran_env_impl \
- iso_fortran_env_impl2 \
- openmp-ver
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/smoke-fort-limbo/amdflang-test/Makefile b/test/smoke-fort-limbo/amdflang-test/Makefile
new file mode 100644
index 0000000000..2fd6bb121d
--- /dev/null
+++ b/test/smoke-fort-limbo/amdflang-test/Makefile
@@ -0,0 +1,15 @@
+#NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = amdflang-test
+TESTSRC_MAIN = amdflang-test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= amdflang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/amdflang-test/amdflang-test.f90 b/test/smoke-fort-limbo/amdflang-test/amdflang-test.f90
new file mode 100644
index 0000000000..977716864e
--- /dev/null
+++ b/test/smoke-fort-limbo/amdflang-test/amdflang-test.f90
@@ -0,0 +1,6 @@
+program amdflangtest
+ implicit none
+
+ print *, "Success: amdflang is alive"
+
+end program amdflangtest
diff --git a/test/smoke-fort-limbo/chk-ffast-ama/Makefile b/test/smoke-fort-limbo/chk-ffast-ama/Makefile
new file mode 100644
index 0000000000..e10113255e
--- /dev/null
+++ b/test/smoke-fort-limbo/chk-ffast-ama/Makefile
@@ -0,0 +1,18 @@
+NOOPT = 1
+NOOMP = 1
+OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = test
+TESTSRC_MAIN = test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CFLAGS = -ffast-amd-memory-allocator
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/chk-ffast-ama/test.f90 b/test/smoke-fort-limbo/chk-ffast-ama/test.f90
new file mode 100644
index 0000000000..a6a9baf65e
--- /dev/null
+++ b/test/smoke-fort-limbo/chk-ffast-ama/test.f90
@@ -0,0 +1 @@
+end
diff --git a/test/smoke-fort-limbo/chk-ffast-fmod/Makefile b/test/smoke-fort-limbo/chk-ffast-fmod/Makefile
new file mode 100644
index 0000000000..d6d784667d
--- /dev/null
+++ b/test/smoke-fort-limbo/chk-ffast-fmod/Makefile
@@ -0,0 +1,18 @@
+NOOPT = 1
+NOOMP = 1
+OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = test
+TESTSRC_MAIN = test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CFLAGS = -ffast-real-mod
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/chk-ffast-fmod/test.f90 b/test/smoke-fort-limbo/chk-ffast-fmod/test.f90
new file mode 100644
index 0000000000..a6a9baf65e
--- /dev/null
+++ b/test/smoke-fort-limbo/chk-ffast-fmod/test.f90
@@ -0,0 +1 @@
+end
diff --git a/test/smoke-fort-limbo/clause_task_detach/task_detach.f90 b/test/smoke-fort-limbo/clause_task_detach/task_detach.f90
index cb6943073d..6fe6e7895a 100644
--- a/test/smoke-fort-limbo/clause_task_detach/task_detach.f90
+++ b/test/smoke-fort-limbo/clause_task_detach/task_detach.f90
@@ -1,6 +1,6 @@
! REQUIRES: openmp_runtime
-! RUN: %not_todo_cmd bbc -emit-fir %openmp_flags -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s
-! RUN: %not_todo_cmd %flang_fc1 -emit-fir %openmp_flags -fopenmp -fopenmp-version=50 -o - %s 2>&1 | FileCheck %s
+! RUN: %not_todo_cmd bbc -emit-fir %openmp_flags -fopenmp -fopenmp-version=50 -o - %s 2>&1 | $FILECHECK %s
+! RUN: %not_todo_cmd %flang_fc1 -emit-fir %openmp_flags -fopenmp -fopenmp-version=50 -o - %s 2>&1 | $FILECHECK %s
!===============================================================================
! `detach` clause
diff --git a/test/smoke-fort-fails/crayptr-default/Makefile b/test/smoke-fort-limbo/crayptr-default/Makefile
similarity index 100%
rename from test/smoke-fort-fails/crayptr-default/Makefile
rename to test/smoke-fort-limbo/crayptr-default/Makefile
diff --git a/test/smoke-fort-fails/crayptr-default/README.txt b/test/smoke-fort-limbo/crayptr-default/README.txt
similarity index 100%
rename from test/smoke-fort-fails/crayptr-default/README.txt
rename to test/smoke-fort-limbo/crayptr-default/README.txt
diff --git a/test/smoke-fort-fails/crayptr-default/crayptr-default.f90 b/test/smoke-fort-limbo/crayptr-default/crayptr-default.f90
similarity index 100%
rename from test/smoke-fort-fails/crayptr-default/crayptr-default.f90
rename to test/smoke-fort-limbo/crayptr-default/crayptr-default.f90
diff --git a/test/smoke-fort-fails/crayptr-dsa/Makefile b/test/smoke-fort-limbo/crayptr-dsa/Makefile
similarity index 100%
rename from test/smoke-fort-fails/crayptr-dsa/Makefile
rename to test/smoke-fort-limbo/crayptr-dsa/Makefile
diff --git a/test/smoke-fort-fails/crayptr-dsa/README.txt b/test/smoke-fort-limbo/crayptr-dsa/README.txt
similarity index 100%
rename from test/smoke-fort-fails/crayptr-dsa/README.txt
rename to test/smoke-fort-limbo/crayptr-dsa/README.txt
diff --git a/test/smoke-fort-fails/crayptr-dsa/crayptr_dsa.f90 b/test/smoke-fort-limbo/crayptr-dsa/crayptr_dsa.f90
similarity index 100%
rename from test/smoke-fort-fails/crayptr-dsa/crayptr_dsa.f90
rename to test/smoke-fort-limbo/crayptr-dsa/crayptr_dsa.f90
diff --git a/test/smoke-fort-dev/do-concurrent-device/Makefile b/test/smoke-fort-limbo/do-concurrent-device/Makefile
similarity index 100%
rename from test/smoke-fort-dev/do-concurrent-device/Makefile
rename to test/smoke-fort-limbo/do-concurrent-device/Makefile
diff --git a/test/smoke-fort-dev/do-concurrent-device/saxpy-2d-device.f90 b/test/smoke-fort-limbo/do-concurrent-device/saxpy-2d-device.f90
similarity index 100%
rename from test/smoke-fort-dev/do-concurrent-device/saxpy-2d-device.f90
rename to test/smoke-fort-limbo/do-concurrent-device/saxpy-2d-device.f90
diff --git a/test/smoke-fort-dev/do-concurrent-host/Makefile b/test/smoke-fort-limbo/do-concurrent-host/Makefile
similarity index 100%
rename from test/smoke-fort-dev/do-concurrent-host/Makefile
rename to test/smoke-fort-limbo/do-concurrent-host/Makefile
diff --git a/test/smoke-fort-dev/do-concurrent-host/saxpy-2d-host.f90 b/test/smoke-fort-limbo/do-concurrent-host/saxpy-2d-host.f90
similarity index 100%
rename from test/smoke-fort-dev/do-concurrent-host/saxpy-2d-host.f90
rename to test/smoke-fort-limbo/do-concurrent-host/saxpy-2d-host.f90
diff --git a/test/smoke-fort/flang-315421/Makefile b/test/smoke-fort-limbo/flang-315421/Makefile
similarity index 88%
rename from test/smoke-fort/flang-315421/Makefile
rename to test/smoke-fort-limbo/flang-315421/Makefile
index 739615f087..afd87871c8 100644
--- a/test/smoke-fort/flang-315421/Makefile
+++ b/test/smoke-fort-limbo/flang-315421/Makefile
@@ -8,6 +8,7 @@ TESTSRC_ALL = $(TESTSRC_AUX) $(TESTSRC_MAIN)
FLANG ?= flang
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
OMP_FLAGS += -DFAIL
include ../Makefile.rules
diff --git a/test/smoke-fort/flang-315421/blk_par.h b/test/smoke-fort-limbo/flang-315421/blk_par.h
similarity index 100%
rename from test/smoke-fort/flang-315421/blk_par.h
rename to test/smoke-fort-limbo/flang-315421/blk_par.h
diff --git a/test/smoke-fort/flang-315421/ft.f90 b/test/smoke-fort-limbo/flang-315421/ft.f90
similarity index 100%
rename from test/smoke-fort/flang-315421/ft.f90
rename to test/smoke-fort-limbo/flang-315421/ft.f90
diff --git a/test/smoke-fort/flang-315421/ft_data.f90 b/test/smoke-fort-limbo/flang-315421/ft_data.f90
similarity index 98%
rename from test/smoke-fort/flang-315421/ft_data.f90
rename to test/smoke-fort-limbo/flang-315421/ft_data.f90
index 108bfd95bb..7df06c893e 100644
--- a/test/smoke-fort/flang-315421/ft_data.f90
+++ b/test/smoke-fort-limbo/flang-315421/ft_data.f90
@@ -1,3 +1,8 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
!---------------------------------------------------------------------
!---------------------------------------------------------------------
!
diff --git a/test/smoke-fort/flang-315421/npbparams.h b/test/smoke-fort-limbo/flang-315421/npbparams.h
similarity index 91%
rename from test/smoke-fort/flang-315421/npbparams.h
rename to test/smoke-fort-limbo/flang-315421/npbparams.h
index 94a4ab7db3..9cf7bb4540 100644
--- a/test/smoke-fort/flang-315421/npbparams.h
+++ b/test/smoke-fort-limbo/flang-315421/npbparams.h
@@ -1,3 +1,8 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
! CLASS = A
!
!
diff --git a/test/smoke-fort/flang-315421/randdp.f90 b/test/smoke-fort-limbo/flang-315421/randdp.f90
similarity index 98%
rename from test/smoke-fort/flang-315421/randdp.f90
rename to test/smoke-fort-limbo/flang-315421/randdp.f90
index fa20c4dedb..b972a8c786 100644
--- a/test/smoke-fort/flang-315421/randdp.f90
+++ b/test/smoke-fort-limbo/flang-315421/randdp.f90
@@ -1,3 +1,8 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
!---------------------------------------------------------------------
!---------------------------------------------------------------------
diff --git a/test/smoke-fort-limbo/flang-325095-2/Makefile b/test/smoke-fort-limbo/flang-325095-2/Makefile
new file mode 100644
index 0000000000..9552f93117
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-325095-2/Makefile
@@ -0,0 +1,14 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = use_dev_addr_fort
+TESTSRC_MAIN = use_dev_addr_fort.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-325095-2/use_dev_addr_fort.f90 b/test/smoke-fort-limbo/flang-325095-2/use_dev_addr_fort.f90
new file mode 100644
index 0000000000..1604546dd8
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-325095-2/use_dev_addr_fort.f90
@@ -0,0 +1,104 @@
+program omp_subroutine
+ implicit none
+ integer, parameter :: N = 3
+ double precision, allocatable, dimension(:) :: c
+
+ allocate(c(N))
+ c = -42.0
+
+ call test0(c)
+ if (c(3) .ne. 1.0) then
+ write (*,*) "FAIL : test0:", c
+ stop 2
+ endif
+
+ print *, c
+ c(3) = -42.0
+
+ ! Expected output c(3) = 1
+ call test1(c)
+ if (c(3) .ne. 1.0) then
+ write (*,*) "FAIL : test1:", c
+ stop 2
+ endif
+
+ print *, c
+ c(3) = -42.0
+
+ !$omp target enter data map(to:c)
+ call test2(c)
+ !$omp target update from(c)
+ if (c(3) .ne. 1.0) then
+ write (*,*) "FAIL : test2:", c
+ stop 2
+ endif
+
+ print *, c
+ c(3) = -42.0
+
+ call test3()
+ if (c(3) .ne. -42.0) then
+ write (*,*) "FAIL : test3:", c
+ stop 2
+ endif
+
+ print *, c
+ c(3) = -42.0
+
+ call test4(c)
+ if (c(3) .ne. 1.0) then
+ write (*,*) "FAIL : test4:", c
+ stop 2
+ endif
+
+ print *, c
+ print *, "PASS"
+ return
+contains
+ subroutine test0(c)
+ double precision, intent(inout) :: c(:)
+ !$omp target data use_device_ptr(c) map(tofrom: c)
+ c(3) = 1.0
+ !$omp end target data
+ end subroutine
+
+ subroutine test1(c)
+ double precision, intent(inout) :: c(:)
+ !$omp target enter data map(to:c)
+ !$omp target data use_device_ptr(c)
+ c(3) = 1.0
+ !$omp end target data
+ !$omp target update from(c)
+ end subroutine
+
+ subroutine test2(c)
+ double precision, intent(inout) :: c(:)
+ !$omp target data use_device_ptr(c)
+ c(3) = 1.0
+ !$omp end target data
+ end subroutine
+
+ subroutine test3()
+ double precision, allocatable, dimension(:) :: c
+ allocate(c(N))
+ !$omp target enter data map(to:c)
+ !$omp target data use_device_ptr(c)
+ c(3) = 1.0
+ !$omp end target data
+ !$omp target update from(c)
+ write (*,*) "test3:", c
+ end subroutine
+
+
+ subroutine test4(c)
+ double precision, allocatable, dimension(:), intent(inout) :: c
+ deallocate(c)
+ allocate(c(N))
+ !$omp target enter data map(to:c)
+ !$omp target data use_device_ptr(c)
+ c(3) = 1.0
+ !$omp end target data
+ !$omp target update from(c)
+ end subroutine
+
+end program omp_subroutine
\ No newline at end of file
diff --git a/test/smoke-fort-limbo/flang-463332/Makefile b/test/smoke-fort-limbo/flang-463332/Makefile
new file mode 100644
index 0000000000..38de17bcef
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-463332/Makefile
@@ -0,0 +1,18 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = present
+TESTSRC_MAIN = present.F90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./doit.sh ${TESTNAME} && ./chkit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-463332/chk.stderr b/test/smoke-fort-limbo/flang-463332/chk.stderr
new file mode 100644
index 0000000000..ba00617dd2
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-463332/chk.stderr
@@ -0,0 +1,5 @@
+omptarget message: device mapping required by 'present' map type modifier does not exist for host address 0xXXXX (4000 bytes)
+omptarget error: Call to getTargetPointer returned null pointer ('present' map type modifier).
+omptarget error: Consult https://openmp.llvm.org/design/Runtimes.html for debugging options.
+omptarget error: Source location information not present. Compile with -g or -gline-tables-only.
+omptarget fatal error 1: failure of target construct while offloading is mandatory
diff --git a/test/smoke-fort-dev/tgt-abort-lhostdev/chk.stdout b/test/smoke-fort-limbo/flang-463332/chk.stdout
similarity index 100%
rename from test/smoke-fort-dev/tgt-abort-lhostdev/chk.stdout
rename to test/smoke-fort-limbo/flang-463332/chk.stdout
diff --git a/test/smoke-fort-limbo/flang-463332/chkit.sh b/test/smoke-fort-limbo/flang-463332/chkit.sh
new file mode 100755
index 0000000000..811dc8d78f
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-463332/chkit.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+flterr=$1.flterr.log
+cat $1.stderr.log | sed -e 's/0x[0-9a-f]*/0xXXXX/ig' > $flterr
+diff -w $flterr chk.stderr
+diff -w $1.stdout.log chk.stdout
diff --git a/test/smoke-fort-dev/tgt-stop-lhostdev/doit.sh b/test/smoke-fort-limbo/flang-463332/doit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-stop-lhostdev/doit.sh
rename to test/smoke-fort-limbo/flang-463332/doit.sh
diff --git a/test/smoke-fort-fails/flang-463332/present.F90 b/test/smoke-fort-limbo/flang-463332/present.F90
similarity index 100%
rename from test/smoke-fort-fails/flang-463332/present.F90
rename to test/smoke-fort-limbo/flang-463332/present.F90
diff --git a/test/smoke-fort-dev/flang-463690/Makefile b/test/smoke-fort-limbo/flang-463690/Makefile
similarity index 100%
rename from test/smoke-fort-dev/flang-463690/Makefile
rename to test/smoke-fort-limbo/flang-463690/Makefile
diff --git a/test/smoke-fort-dev/flang-463690/multired.f90 b/test/smoke-fort-limbo/flang-463690/multired.f90
similarity index 100%
rename from test/smoke-fort-dev/flang-463690/multired.f90
rename to test/smoke-fort-limbo/flang-463690/multired.f90
diff --git a/test/smoke-fort-dev/flang-471469/M.orig b/test/smoke-fort-limbo/flang-471469/M.orig
similarity index 100%
rename from test/smoke-fort-dev/flang-471469/M.orig
rename to test/smoke-fort-limbo/flang-471469/M.orig
diff --git a/test/smoke-fort-dev/flang-471469/Makefile b/test/smoke-fort-limbo/flang-471469/Makefile
similarity index 78%
rename from test/smoke-fort-dev/flang-471469/Makefile
rename to test/smoke-fort-limbo/flang-471469/Makefile
index de0fd71324..78f5db1803 100644
--- a/test/smoke-fort-dev/flang-471469/Makefile
+++ b/test/smoke-fort-limbo/flang-471469/Makefile
@@ -18,18 +18,21 @@ HIPCC = ${AOMP}/bin/clang -x hip
FC = ${AOMP}/bin/flang
#HIP_LIB_PATH ?= ${ROCM_PATH}/hip/lib
#HIP_LIB_PATH ?= /COD/LATEST/aomp/lib
-HIP_LIB_PATH ?= /opt/rocm/lib
+#HIP_LIB_PATH ?= /opt/rocm/lib
+HIP_LIB_PATH ?= $(realpath $(realpath ${AOMP})/../../lib)
# Compiler flags
HIP_FLAGS = -O3 --offload-arch=${AOMP_GPU}
F_FLAGS = -O2 -fopenmp -fopenmp-version=50 --offload-arch=${AOMP_GPU}
-LD_FLAGS = -O3 -L${HIP_LIB_PATH} -lamdhip64 -lstdc++
+LD_FLAGS = -O3 -L${HIP_LIB_PATH} -lamdhip64 -lstdc++ -Wl,-rpath,${HIP_LIB_PATH}
# To verify HIP runs, use:
# AMD_LOG_LEVEL=1 ...
# AMD_LOG_LEVEL=3 ...
test:
mkdir -p obj
+ echo AOMP=${AOMP}
+ echo HIP_LIB_PATH=${HIP_LIB_PATH}
${HIPCC} ${HIP_FLAGS} -c kernel.cpp -o obj/kernel.o
${FC} ${F_FLAGS} -c driver.f90 -o obj/driver.o
${FC} ${F_FLAGS} ${LD_FLAGS} -o test obj/driver.o obj/kernel.o
diff --git a/test/smoke-fort-dev/flang-471469/driver.f90 b/test/smoke-fort-limbo/flang-471469/driver.f90
similarity index 100%
rename from test/smoke-fort-dev/flang-471469/driver.f90
rename to test/smoke-fort-limbo/flang-471469/driver.f90
diff --git a/test/smoke-fort-dev/flang-471469/kernel.cpp b/test/smoke-fort-limbo/flang-471469/kernel.cpp
similarity index 100%
rename from test/smoke-fort-dev/flang-471469/kernel.cpp
rename to test/smoke-fort-limbo/flang-471469/kernel.cpp
diff --git a/test/smoke-fort-limbo/flang-491114/Makefile b/test/smoke-fort-limbo/flang-491114/Makefile
new file mode 100644
index 0000000000..69b2b232cc
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-491114/Makefile
@@ -0,0 +1,17 @@
+include ../../Makefile.defs
+
+TESTNAME = vmm
+TESTSRC_MAIN = vmm.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNENV = LIBOMPTARGET_KERNEL_TRACE=1
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-491114/vmm.f90 b/test/smoke-fort-limbo/flang-491114/vmm.f90
new file mode 100644
index 0000000000..7e8d8c47d6
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-491114/vmm.f90
@@ -0,0 +1,18 @@
+program vmm
+ implicit none
+ integer, parameter :: N = 100000
+ integer a(N), b(N), c(N)
+ integer j,i, num, flag;
+ num = N
+
+!$omp target teams map(to: a,b) map(from: c)
+!$omp loop
+ do j=1,1000
+!$omp loop
+ do i=1,N
+ c(i) = a(i) * b(i)
+ end do
+ end do
+!$omp end target teams
+ print *,'done'
+end program
diff --git a/test/smoke-fort/flang-494405/Makefile b/test/smoke-fort-limbo/flang-494405/Makefile
similarity index 74%
rename from test/smoke-fort/flang-494405/Makefile
rename to test/smoke-fort-limbo/flang-494405/Makefile
index 760834276a..d20d151f55 100644
--- a/test/smoke-fort/flang-494405/Makefile
+++ b/test/smoke-fort-limbo/flang-494405/Makefile
@@ -14,5 +14,5 @@ CC = $(OMP_BIN) $(VERBOSE)
include ../Makefile.rules
run: $(TESTNAME)
ulimit -s unlimited ; \
- rocprof --stats ./$(TESTNAME) > run.log 2>&1 ; \
- column -t -s , < results.stats.csv
+ rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) > run.log 2>&1 ; \
+ python3 flang-494405.py
diff --git a/test/smoke-fort-limbo/flang-494405/flang-494405.py b/test/smoke-fort-limbo/flang-494405/flang-494405.py
new file mode 100644
index 0000000000..6024ae54e8
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-494405/flang-494405.py
@@ -0,0 +1,74 @@
+# Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+# SPDX-License-Identifier: MIT
+
+# flang-494405.py
+# LLM: ChatGPT-4o (OpenAI), 2024-06-08
+#
+# User query (included as documentation):
+#
+# In the directory where this program was executed, there is a directory with the current machine's name.
+# In that directory, there is a file called: "*_kernel_stats.csv", for example: "1428133_kernel_stats.csv". Read that file.
+# This CSV file has the following format (for example):
+#
+# "Name","Calls","TotalDurationNs","AverageNs","Percentage","MinNs","MaxNs","StdDev"
+# "__omp_offloading_10302_2d8735b_glsc3_acc__l5",1,85531,85531.000000,100.00,85531,85531,0.00000000e+00
+#
+# Print out the information collected in the following format. What follows is an example:
+#
+# "Name" "Calls" "TotalDurationNs" "AverageNs" "Percentage"
+# "__omp_offloading_10302_2d8735b_glsc3_acc__l5.kd" 1 447886 447886 100.0
+#
+
+import os
+import socket
+import glob
+import csv
+
+def main():
+ # Get the current machine's hostname
+ machine_name = socket.gethostname()
+ # Build the path to the subdirectory named after the machine
+ subdir = os.path.join(os.getcwd(), machine_name)
+
+ if not os.path.isdir(subdir):
+ print(f'No directory named {machine_name} in current working directory.')
+ return
+
+ # Search for *_kernel_stats.csv in the directory
+ csv_files = glob.glob(os.path.join(subdir, '*_kernel_stats.csv'))
+ if not csv_files:
+ print(f'No *_kernel_stats.csv file found in {subdir}.')
+ return
+
+ csv_path = csv_files[0]
+
+ # Read CSV file
+ with open(csv_path, newline='') as f:
+ reader = csv.DictReader(f)
+ rows = [row for row in reader]
+
+ if not rows:
+ print('No data found in CSV file.')
+ return
+
+ # Prepare and print header
+ header_fmt = '{:<52} {:<7} {:<16} {:<12} {:<10}'
+ print(header_fmt.format(
+ '"Name"', '"Calls"', '"TotalDurationNs"', '"AverageNs"', '"Percentage"'
+ ))
+
+ # Print each row in requested format, appending ".kd" to Name
+ row_fmt = '{:<52} {:<7} {:<16} {:<12} {:<10}'
+ for row in rows:
+ name = f'{row["Name"]}.kd'
+ calls = row["Calls"]
+ total = int(float(row["TotalDurationNs"]))
+ avg = int(float(row["AverageNs"]))
+ perc = round(float(row["Percentage"]), 1)
+ print(row_fmt.format(
+ f'"{name}"', calls, total, avg, perc
+ ))
+
+if __name__ == '__main__':
+ main()
diff --git a/test/smoke-fort/flang-494405/redprob.f90 b/test/smoke-fort-limbo/flang-494405/redprob.f90
similarity index 82%
rename from test/smoke-fort/flang-494405/redprob.f90
rename to test/smoke-fort-limbo/flang-494405/redprob.f90
index e4e4f07915..3a161a618a 100644
--- a/test/smoke-fort/flang-494405/redprob.f90
+++ b/test/smoke-fort-limbo/flang-494405/redprob.f90
@@ -1,3 +1,8 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
function glsc3_acc(a,b,mult,n)
real a(n),b(n),mult(n)
real tmp,work(1)
diff --git a/test/smoke-fort-fails/flang-505726/Makefile b/test/smoke-fort-limbo/flang-505726/Makefile
similarity index 100%
rename from test/smoke-fort-fails/flang-505726/Makefile
rename to test/smoke-fort-limbo/flang-505726/Makefile
diff --git a/test/smoke-fort-fails/flang-505726/README.txt b/test/smoke-fort-limbo/flang-505726/README.txt
similarity index 100%
rename from test/smoke-fort-fails/flang-505726/README.txt
rename to test/smoke-fort-limbo/flang-505726/README.txt
diff --git a/test/smoke-fort-fails/flang-505726/chkit.sh b/test/smoke-fort-limbo/flang-505726/chkit.sh
similarity index 100%
rename from test/smoke-fort-fails/flang-505726/chkit.sh
rename to test/smoke-fort-limbo/flang-505726/chkit.sh
diff --git a/test/smoke-fort-fails/flang-505726/doit.sh b/test/smoke-fort-limbo/flang-505726/doit.sh
similarity index 100%
rename from test/smoke-fort-fails/flang-505726/doit.sh
rename to test/smoke-fort-limbo/flang-505726/doit.sh
diff --git a/test/smoke-fort-fails/flang-505726/ttds.f90 b/test/smoke-fort-limbo/flang-505726/ttds.f90
similarity index 100%
rename from test/smoke-fort-fails/flang-505726/ttds.f90
rename to test/smoke-fort-limbo/flang-505726/ttds.f90
diff --git a/test/smoke-fort-limbo/flang-509074/Makefile b/test/smoke-fort-limbo/flang-509074/Makefile
new file mode 100644
index 0000000000..797743fc11
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-509074/Makefile
@@ -0,0 +1,16 @@
+#NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = nowait_reproducer
+TESTSRC_MAIN = nowait_reproducer.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS = -g
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-509074/nowait_reproducer.f90 b/test/smoke-fort-limbo/flang-509074/nowait_reproducer.f90
new file mode 100644
index 0000000000..4cf557ca89
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-509074/nowait_reproducer.f90
@@ -0,0 +1,47 @@
+! Build Type:
+! - Debug: does not compile
+! - `inlinable function call in a function with debug info must have a !dbg location`
+! - Release: compiles
+
+program nowait_reproducer
+ use omp_lib
+ implicit none
+
+ integer, parameter :: n = 100
+ real, allocatable :: array(:)
+ integer :: i
+ logical :: success
+
+ ! Allocate array
+ allocate (array(n))
+
+ ! Initialize the array
+ array = 0.0
+
+ !$omp target map(tofrom: array) nowait
+ !$omp parallel do
+ do i = 1, n
+ array(i) = real(i)
+ end do
+ !$omp end parallel do
+ !$omp end target
+
+ ! Check results
+ success = .true. ! Assume success initially
+ do i = 1, n
+ if (array(i) /= real(i)) then
+ success = .false.
+ print *, "Error at index ", i, ": ", array(i)
+ end if
+ end do
+
+ ! Print final status
+ if (success) then
+ print *, "Success: All values are as expected"
+ else
+ print *, "Errors found in the computation"
+ end if
+
+ ! Deallocate array
+ deallocate (array)
+end program nowait_reproducer
diff --git a/test/smoke-fort-limbo/flang-519081/Makefile b/test/smoke-fort-limbo/flang-519081/Makefile
new file mode 100644
index 0000000000..62098d581a
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-519081/Makefile
@@ -0,0 +1,17 @@
+# For testing without openmp:
+# OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = real10
+TESTSRC_MAIN = real10.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-519081/real10.f90 b/test/smoke-fort-limbo/flang-519081/real10.f90
new file mode 100644
index 0000000000..fca8145c58
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-519081/real10.f90
@@ -0,0 +1,4 @@
+program real10
+ use ieee_arithmetic
+ implicit none
+end program
diff --git a/test/smoke-fort-fails/flang-522365-loop-1-1/Makefile b/test/smoke-fort-limbo/flang-522365-loop-1-1/Makefile
similarity index 100%
rename from test/smoke-fort-fails/flang-522365-loop-1-1/Makefile
rename to test/smoke-fort-limbo/flang-522365-loop-1-1/Makefile
diff --git a/test/smoke-fort-fails/flang-522365-loop-1-1/loop-red-1-1.f90 b/test/smoke-fort-limbo/flang-522365-loop-1-1/loop-red-1-1.f90
similarity index 100%
rename from test/smoke-fort-fails/flang-522365-loop-1-1/loop-red-1-1.f90
rename to test/smoke-fort-limbo/flang-522365-loop-1-1/loop-red-1-1.f90
diff --git a/test/smoke-fort-fails/flang-522365-loop-2s/Makefile b/test/smoke-fort-limbo/flang-522365-loop-2s/Makefile
similarity index 100%
rename from test/smoke-fort-fails/flang-522365-loop-2s/Makefile
rename to test/smoke-fort-limbo/flang-522365-loop-2s/Makefile
diff --git a/test/smoke-fort-fails/flang-522365-loop-2s/loop-red-2s.f90 b/test/smoke-fort-limbo/flang-522365-loop-2s/loop-red-2s.f90
similarity index 100%
rename from test/smoke-fort-fails/flang-522365-loop-2s/loop-red-2s.f90
rename to test/smoke-fort-limbo/flang-522365-loop-2s/loop-red-2s.f90
diff --git a/test/smoke-fort-fails/flang-523213/Makefile b/test/smoke-fort-limbo/flang-523213/Makefile
similarity index 100%
rename from test/smoke-fort-fails/flang-523213/Makefile
rename to test/smoke-fort-limbo/flang-523213/Makefile
diff --git a/test/smoke-fort-fails/flang-523213/repro_optional_shared.F90 b/test/smoke-fort-limbo/flang-523213/repro_optional_shared.F90
similarity index 100%
rename from test/smoke-fort-fails/flang-523213/repro_optional_shared.F90
rename to test/smoke-fort-limbo/flang-523213/repro_optional_shared.F90
diff --git a/test/smoke-fort-fails/flang-523344-device/Makefile b/test/smoke-fort-limbo/flang-523344-device/Makefile
similarity index 100%
rename from test/smoke-fort-fails/flang-523344-device/Makefile
rename to test/smoke-fort-limbo/flang-523344-device/Makefile
diff --git a/test/smoke-fort-fails/flang-523344-device/saxpy_gpu_do_concurrent_device.F90 b/test/smoke-fort-limbo/flang-523344-device/saxpy_gpu_do_concurrent_device.F90
similarity index 100%
rename from test/smoke-fort-fails/flang-523344-device/saxpy_gpu_do_concurrent_device.F90
rename to test/smoke-fort-limbo/flang-523344-device/saxpy_gpu_do_concurrent_device.F90
diff --git a/test/smoke-fort-fails/flang-523344-host/Makefile b/test/smoke-fort-limbo/flang-523344-host/Makefile
similarity index 100%
rename from test/smoke-fort-fails/flang-523344-host/Makefile
rename to test/smoke-fort-limbo/flang-523344-host/Makefile
diff --git a/test/smoke-fort-fails/flang-523344-host/saxpy_gpu_do_concurrent_host.F90 b/test/smoke-fort-limbo/flang-523344-host/saxpy_gpu_do_concurrent_host.F90
similarity index 100%
rename from test/smoke-fort-fails/flang-523344-host/saxpy_gpu_do_concurrent_host.F90
rename to test/smoke-fort-limbo/flang-523344-host/saxpy_gpu_do_concurrent_host.F90
diff --git a/test/smoke-fort-dev/flang-523587/Makefile b/test/smoke-fort-limbo/flang-523587/Makefile
similarity index 100%
rename from test/smoke-fort-dev/flang-523587/Makefile
rename to test/smoke-fort-limbo/flang-523587/Makefile
diff --git a/test/smoke-fort-dev/flang-523587/test.f90 b/test/smoke-fort-limbo/flang-523587/test.f90
similarity index 100%
rename from test/smoke-fort-dev/flang-523587/test.f90
rename to test/smoke-fort-limbo/flang-523587/test.f90
diff --git a/test/smoke-fort-fails/flang-523626/Makefile b/test/smoke-fort-limbo/flang-523626/Makefile
similarity index 89%
rename from test/smoke-fort-fails/flang-523626/Makefile
rename to test/smoke-fort-limbo/flang-523626/Makefile
index 917a141e31..858890d847 100644
--- a/test/smoke-fort-fails/flang-523626/Makefile
+++ b/test/smoke-fort-limbo/flang-523626/Makefile
@@ -8,7 +8,7 @@ TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
FLANG ?= flang
-CFLAGS = -lflang_rt.hostdevice
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
diff --git a/test/smoke-fort-fails/flang-523626/spread.f90 b/test/smoke-fort-limbo/flang-523626/spread.f90
similarity index 100%
rename from test/smoke-fort-fails/flang-523626/spread.f90
rename to test/smoke-fort-limbo/flang-523626/spread.f90
diff --git a/test/smoke-fort-fails/flang-524183/Makefile b/test/smoke-fort-limbo/flang-524183/Makefile
similarity index 100%
rename from test/smoke-fort-fails/flang-524183/Makefile
rename to test/smoke-fort-limbo/flang-524183/Makefile
diff --git a/test/smoke-fort-fails/flang-524183/repro_derived_type_arr_map.f90 b/test/smoke-fort-limbo/flang-524183/repro_derived_type_arr_map.f90
similarity index 100%
rename from test/smoke-fort-fails/flang-524183/repro_derived_type_arr_map.f90
rename to test/smoke-fort-limbo/flang-524183/repro_derived_type_arr_map.f90
diff --git a/test/smoke-fort-limbo/flang-524638-aO0/Makefile b/test/smoke-fort-limbo/flang-524638-aO0/Makefile
new file mode 100644
index 0000000000..d86278b2dd
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-524638-aO0/Makefile
@@ -0,0 +1,16 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = map_alloc
+TESTSRC_MAIN = map_alloc.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS = -O0
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-524638-aO0/map_alloc.f90 b/test/smoke-fort-limbo/flang-524638-aO0/map_alloc.f90
new file mode 100644
index 0000000000..a77133f72e
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-524638-aO0/map_alloc.f90
@@ -0,0 +1,186 @@
+module kernels
+ interface kernel
+ module procedure :: kernel_1d, kernel_2d, kernel_3d, &
+ kernel_4d, kernel_5d, kernel_6d, &
+ kernel_7d
+ end interface
+contains
+ subroutine kernel_1d(array)
+ implicit none
+ real, dimension(:) :: array
+ integer :: i
+
+ print *, 'kernel_1d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do
+ do i=1, ubound(array, 1)
+ array(i) = 42.0
+ end do
+ print *, 'kernel_1d end'
+ end subroutine
+
+ subroutine kernel_2d(array)
+ implicit none
+ real, dimension(:,:) :: array
+ integer :: i, j
+
+ print *, 'kernel_2d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(2)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j) = 42.0
+ end do
+ end do
+ print *, 'kernel_2d end'
+ end subroutine
+
+ subroutine kernel_3d(array)
+ implicit none
+ real, dimension(:,:,:) :: array
+ integer :: i, j, k
+
+ print *, 'kernel_3d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(3)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k) = 42.0
+ end do
+ end do
+ end do
+ print *, 'kernel_3d end'
+ end subroutine
+
+ subroutine kernel_4d(array)
+ implicit none
+ real, dimension(:,:,:,:) :: array
+ integer :: i, j, k, l
+
+ print *, 'kernel_4d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(4)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ print *, 'kernel_4d end'
+ end subroutine
+
+ subroutine kernel_5d(array)
+ implicit none
+ real, dimension(:,:,:,:,:) :: array
+ integer :: i, j, k, l, m
+
+ print *, 'kernel_5d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(5)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ print *, 'kernel_5d end'
+ end subroutine
+
+ subroutine kernel_6d(array)
+ implicit none
+ real, dimension(:,:,:,:,:,:) :: array
+ integer :: i, j, k, l, m, n
+
+ print *, 'kernel_6d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(6)
+ do n=1, ubound(array, 6)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m,n) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ enddo
+ print *, 'kernel_6d end'
+ end subroutine
+
+ subroutine kernel_7d(array)
+ implicit none
+ real, dimension(:,:,:,:,:,:,:) :: array
+ integer :: i, j, k, l, m, n, o
+
+ print *, 'kernel_7d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(7)
+ do o=1, ubound(array, 7)
+ do n=1, ubound(array, 6)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m,n,o) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ enddo
+ enddo
+ print *, 'kernel_7d end'
+ end subroutine
+end module
+
+module wrap
+ use kernels, only: kernel
+end module
+
+program map_alloc
+ use wrap, only: kernel
+ implicit none
+
+ integer, parameter :: n = 10
+ real, dimension(: ), allocatable :: array1
+ real, dimension(:,: ), allocatable :: array2
+ real, dimension(:,:,: ), allocatable :: array3
+ real, dimension(:,:,:,: ), allocatable :: array4
+ real, dimension(:,:,:,:,: ), allocatable :: array5
+ real, dimension(:,:,:,:,:,: ), allocatable :: array6
+ real, dimension(:,:,:,:,:,:,:), allocatable :: array7
+
+ allocate(array1(n))
+ call kernel(array1)
+
+ allocate(array2(n, n))
+ call kernel(array2)
+
+ allocate(array3(n, n, n))
+ call kernel(array3)
+
+ allocate(array4(n, n, n, n))
+ call kernel(array4)
+
+ allocate(array5(n, n, n, n, n))
+ call kernel(array5)
+
+ allocate(array6(n, n, n, n, n, n))
+ call kernel(array6)
+
+ allocate(array7(n, n, n, n, n, n, n))
+ call kernel(array7)
+end program
\ No newline at end of file
diff --git a/test/smoke-fort-limbo/flang-524638-aO3/Makefile b/test/smoke-fort-limbo/flang-524638-aO3/Makefile
new file mode 100644
index 0000000000..a6635c7a21
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-524638-aO3/Makefile
@@ -0,0 +1,16 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = map_alloc
+TESTSRC_MAIN = map_alloc.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS = -O3
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-524638-aO3/map_alloc.f90 b/test/smoke-fort-limbo/flang-524638-aO3/map_alloc.f90
new file mode 100644
index 0000000000..a77133f72e
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-524638-aO3/map_alloc.f90
@@ -0,0 +1,186 @@
+module kernels
+ interface kernel
+ module procedure :: kernel_1d, kernel_2d, kernel_3d, &
+ kernel_4d, kernel_5d, kernel_6d, &
+ kernel_7d
+ end interface
+contains
+ subroutine kernel_1d(array)
+ implicit none
+ real, dimension(:) :: array
+ integer :: i
+
+ print *, 'kernel_1d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do
+ do i=1, ubound(array, 1)
+ array(i) = 42.0
+ end do
+ print *, 'kernel_1d end'
+ end subroutine
+
+ subroutine kernel_2d(array)
+ implicit none
+ real, dimension(:,:) :: array
+ integer :: i, j
+
+ print *, 'kernel_2d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(2)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j) = 42.0
+ end do
+ end do
+ print *, 'kernel_2d end'
+ end subroutine
+
+ subroutine kernel_3d(array)
+ implicit none
+ real, dimension(:,:,:) :: array
+ integer :: i, j, k
+
+ print *, 'kernel_3d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(3)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k) = 42.0
+ end do
+ end do
+ end do
+ print *, 'kernel_3d end'
+ end subroutine
+
+ subroutine kernel_4d(array)
+ implicit none
+ real, dimension(:,:,:,:) :: array
+ integer :: i, j, k, l
+
+ print *, 'kernel_4d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(4)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ print *, 'kernel_4d end'
+ end subroutine
+
+ subroutine kernel_5d(array)
+ implicit none
+ real, dimension(:,:,:,:,:) :: array
+ integer :: i, j, k, l, m
+
+ print *, 'kernel_5d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(5)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ print *, 'kernel_5d end'
+ end subroutine
+
+ subroutine kernel_6d(array)
+ implicit none
+ real, dimension(:,:,:,:,:,:) :: array
+ integer :: i, j, k, l, m, n
+
+ print *, 'kernel_6d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(6)
+ do n=1, ubound(array, 6)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m,n) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ enddo
+ print *, 'kernel_6d end'
+ end subroutine
+
+ subroutine kernel_7d(array)
+ implicit none
+ real, dimension(:,:,:,:,:,:,:) :: array
+ integer :: i, j, k, l, m, n, o
+
+ print *, 'kernel_7d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(7)
+ do o=1, ubound(array, 7)
+ do n=1, ubound(array, 6)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m,n,o) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ enddo
+ enddo
+ print *, 'kernel_7d end'
+ end subroutine
+end module
+
+module wrap
+ use kernels, only: kernel
+end module
+
+program map_alloc
+ use wrap, only: kernel
+ implicit none
+
+ integer, parameter :: n = 10
+ real, dimension(: ), allocatable :: array1
+ real, dimension(:,: ), allocatable :: array2
+ real, dimension(:,:,: ), allocatable :: array3
+ real, dimension(:,:,:,: ), allocatable :: array4
+ real, dimension(:,:,:,:,: ), allocatable :: array5
+ real, dimension(:,:,:,:,:,: ), allocatable :: array6
+ real, dimension(:,:,:,:,:,:,:), allocatable :: array7
+
+ allocate(array1(n))
+ call kernel(array1)
+
+ allocate(array2(n, n))
+ call kernel(array2)
+
+ allocate(array3(n, n, n))
+ call kernel(array3)
+
+ allocate(array4(n, n, n, n))
+ call kernel(array4)
+
+ allocate(array5(n, n, n, n, n))
+ call kernel(array5)
+
+ allocate(array6(n, n, n, n, n, n))
+ call kernel(array6)
+
+ allocate(array7(n, n, n, n, n, n, n))
+ call kernel(array7)
+end program
\ No newline at end of file
diff --git a/test/smoke-fort-limbo/flang-524638-sO0/Makefile b/test/smoke-fort-limbo/flang-524638-sO0/Makefile
new file mode 100644
index 0000000000..4ea78cafb2
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-524638-sO0/Makefile
@@ -0,0 +1,16 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = map_static
+TESTSRC_MAIN = map_static.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS = -O0
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-524638-sO0/map_static.f90 b/test/smoke-fort-limbo/flang-524638-sO0/map_static.f90
new file mode 100644
index 0000000000..5d1186c80d
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-524638-sO0/map_static.f90
@@ -0,0 +1,179 @@
+module kernels
+ interface kernel
+ module procedure :: kernel_1d, kernel_2d, kernel_3d, &
+ kernel_4d, kernel_5d, kernel_6d, &
+ kernel_7d
+ end interface
+contains
+ subroutine kernel_1d(array)
+ implicit none
+ real, dimension(:) :: array
+ integer :: i
+
+ print *, 'kernel_1d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do
+ do i=1, ubound(array, 1)
+ array(i) = 42.0
+ end do
+ print *, 'kernel_1d end'
+ end subroutine
+
+ subroutine kernel_2d(array)
+ implicit none
+ real, dimension(:,:) :: array
+ integer :: i, j
+
+ print *, 'kernel_2d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(2)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j) = 42.0
+ end do
+ end do
+ print *, 'kernel_2d end'
+ end subroutine
+
+ subroutine kernel_3d(array)
+ implicit none
+ real, dimension(:,:,:) :: array
+ integer :: i, j, k
+
+ print *, 'kernel_3d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(3)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k) = 42.0
+ end do
+ end do
+ end do
+ print *, 'kernel_3d end'
+ end subroutine
+
+ subroutine kernel_4d(array)
+ implicit none
+ real, dimension(:,:,:,:) :: array
+ integer :: i, j, k, l
+
+ print *, 'kernel_4d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(4)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ print *, 'kernel_4d end'
+ end subroutine
+
+ subroutine kernel_5d(array)
+ implicit none
+ real, dimension(:,:,:,:,:) :: array
+ integer :: i, j, k, l, m
+
+ print *, 'kernel_5d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(5)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ print *, 'kernel_5d end'
+ end subroutine
+
+ subroutine kernel_6d(array)
+ implicit none
+ real, dimension(:,:,:,:,:,:) :: array
+ integer :: i, j, k, l, m, n
+
+ print *, 'kernel_6d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(6)
+ do n=1, ubound(array, 6)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m,n) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ enddo
+ print *, 'kernel_6d end'
+ end subroutine
+
+ subroutine kernel_7d(array)
+ implicit none
+ real, dimension(:,:,:,:,:,:,:) :: array
+ integer :: i, j, k, l, m, n, o
+
+ print *, 'kernel_7d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(7)
+ do o=1, ubound(array, 7)
+ do n=1, ubound(array, 6)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m,n,o) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ enddo
+ enddo
+ print *, 'kernel_7d end'
+ end subroutine
+end module
+
+module wrap
+ use kernels, only: kernel
+end module
+
+program map_alloc
+ use wrap, only: kernel
+ implicit none
+
+ integer, parameter :: n = 10
+ real :: array1(n )
+ real :: array2(n,n )
+ real :: array3(n,n,n )
+ real :: array4(n,n,n,n )
+ real :: array5(n,n,n,n,n )
+ real :: array6(n,n,n,n,n,n )
+ real :: array7(n,n,n,n,n,n,n)
+
+ call kernel(array1)
+
+ call kernel(array2)
+
+ call kernel(array3)
+
+ call kernel(array4)
+
+ call kernel(array5)
+
+ call kernel(array6)
+
+ call kernel(array7)
+end program
\ No newline at end of file
diff --git a/test/smoke-fort-limbo/flang-524638-sO3/Makefile b/test/smoke-fort-limbo/flang-524638-sO3/Makefile
new file mode 100644
index 0000000000..923ec275c2
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-524638-sO3/Makefile
@@ -0,0 +1,16 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = map_static
+TESTSRC_MAIN = map_static.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS = -O3
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-524638-sO3/map_static.f90 b/test/smoke-fort-limbo/flang-524638-sO3/map_static.f90
new file mode 100644
index 0000000000..5d1186c80d
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-524638-sO3/map_static.f90
@@ -0,0 +1,179 @@
+module kernels
+ interface kernel
+ module procedure :: kernel_1d, kernel_2d, kernel_3d, &
+ kernel_4d, kernel_5d, kernel_6d, &
+ kernel_7d
+ end interface
+contains
+ subroutine kernel_1d(array)
+ implicit none
+ real, dimension(:) :: array
+ integer :: i
+
+ print *, 'kernel_1d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do
+ do i=1, ubound(array, 1)
+ array(i) = 42.0
+ end do
+ print *, 'kernel_1d end'
+ end subroutine
+
+ subroutine kernel_2d(array)
+ implicit none
+ real, dimension(:,:) :: array
+ integer :: i, j
+
+ print *, 'kernel_2d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(2)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j) = 42.0
+ end do
+ end do
+ print *, 'kernel_2d end'
+ end subroutine
+
+ subroutine kernel_3d(array)
+ implicit none
+ real, dimension(:,:,:) :: array
+ integer :: i, j, k
+
+ print *, 'kernel_3d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(3)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k) = 42.0
+ end do
+ end do
+ end do
+ print *, 'kernel_3d end'
+ end subroutine
+
+ subroutine kernel_4d(array)
+ implicit none
+ real, dimension(:,:,:,:) :: array
+ integer :: i, j, k, l
+
+ print *, 'kernel_4d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(4)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ print *, 'kernel_4d end'
+ end subroutine
+
+ subroutine kernel_5d(array)
+ implicit none
+ real, dimension(:,:,:,:,:) :: array
+ integer :: i, j, k, l, m
+
+ print *, 'kernel_5d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(5)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ print *, 'kernel_5d end'
+ end subroutine
+
+ subroutine kernel_6d(array)
+ implicit none
+ real, dimension(:,:,:,:,:,:) :: array
+ integer :: i, j, k, l, m, n
+
+ print *, 'kernel_6d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(6)
+ do n=1, ubound(array, 6)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m,n) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ enddo
+ print *, 'kernel_6d end'
+ end subroutine
+
+ subroutine kernel_7d(array)
+ implicit none
+ real, dimension(:,:,:,:,:,:,:) :: array
+ integer :: i, j, k, l, m, n, o
+
+ print *, 'kernel_7d'
+ !$omp target enter data map(alloc:array)
+ !$omp target teams distribute parallel do collapse(7)
+ do o=1, ubound(array, 7)
+ do n=1, ubound(array, 6)
+ do m=1, ubound(array, 5)
+ do l=1, ubound(array, 4)
+ do k=1, ubound(array, 3)
+ do j=1, ubound(array, 2)
+ do i=1, ubound(array, 1)
+ array(i,j,k,l,m,n,o) = 42.0
+ end do
+ end do
+ end do
+ enddo
+ enddo
+ enddo
+ enddo
+ print *, 'kernel_7d end'
+ end subroutine
+end module
+
+module wrap
+ use kernels, only: kernel
+end module
+
+program map_alloc
+ use wrap, only: kernel
+ implicit none
+
+ integer, parameter :: n = 10
+ real :: array1(n )
+ real :: array2(n,n )
+ real :: array3(n,n,n )
+ real :: array4(n,n,n,n )
+ real :: array5(n,n,n,n,n )
+ real :: array6(n,n,n,n,n,n )
+ real :: array7(n,n,n,n,n,n,n)
+
+ call kernel(array1)
+
+ call kernel(array2)
+
+ call kernel(array3)
+
+ call kernel(array4)
+
+ call kernel(array5)
+
+ call kernel(array6)
+
+ call kernel(array7)
+end program
\ No newline at end of file
diff --git a/test/smoke-fort-dev/flang-527219/Makefile b/test/smoke-fort-limbo/flang-527219/Makefile
similarity index 100%
rename from test/smoke-fort-dev/flang-527219/Makefile
rename to test/smoke-fort-limbo/flang-527219/Makefile
diff --git a/test/smoke-fort-dev/flang-527219/cond.f b/test/smoke-fort-limbo/flang-527219/cond.f
similarity index 100%
rename from test/smoke-fort-dev/flang-527219/cond.f
rename to test/smoke-fort-limbo/flang-527219/cond.f
diff --git a/test/smoke-fort-fails/flang-529634/Makefile b/test/smoke-fort-limbo/flang-529634/Makefile
similarity index 100%
rename from test/smoke-fort-fails/flang-529634/Makefile
rename to test/smoke-fort-limbo/flang-529634/Makefile
diff --git a/test/smoke-fort-fails/flang-529634/test_ns3d_stackarray.f90 b/test/smoke-fort-limbo/flang-529634/test_ns3d_stackarray.f90
similarity index 100%
rename from test/smoke-fort-fails/flang-529634/test_ns3d_stackarray.f90
rename to test/smoke-fort-limbo/flang-529634/test_ns3d_stackarray.f90
diff --git a/test/smoke-fort-limbo/flang-544421-2/Makefile b/test/smoke-fort-limbo/flang-544421-2/Makefile
new file mode 100644
index 0000000000..27ffc5d8aa
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-544421-2/Makefile
@@ -0,0 +1,21 @@
+#NOOPT = 1
+#NOOMP = 1
+include ../../Makefile.defs
+
+# Required for the test to succeed at the moment, but also
+# required to hit the original problem.
+RUNENV += HSA_XNACK=1
+OMP_FLAGS = -fopenmp-force-usm --offload-arch=$(AOMP_GPU)
+
+TESTNAME = repro_544421-2
+TESTSRC_MAIN = repro_544421-2.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-544421-2/repro_544421-2.f90 b/test/smoke-fort-limbo/flang-544421-2/repro_544421-2.f90
new file mode 100644
index 0000000000..79f6cf9fe9
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-544421-2/repro_544421-2.f90
@@ -0,0 +1,129 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+module reproducer_mod
+contains
+ subroutine branching_target_call(dt, dt2, dt3, switch, switch2, switch3)
+ implicit none
+ real(4), dimension(:), intent(inout) :: dt
+ real(4), dimension(:, :), intent(inout) :: dt2
+ real(4), dimension(:, :, :), intent(inout) :: dt3
+ logical, intent(in) :: switch, switch2, switch3
+ integer :: dim, idx
+
+ dim = size(dt)
+
+ ! Large mostly irrelevant nested series of if's trying to trick
+ ! the compiler into missing out on assigning to a local copy of
+ ! the descriptor that'll be used inside the kernel
+ if (switch) then
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = 20
+ end do
+ if (switch2) then
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = dt(idx) + 30
+ end do
+ else
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = dt(idx) + 3000
+ end do
+ end if
+ if (switch3) then
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt2(idx, 4) = dt3(idx, idx, 2) + 10
+ end do
+ else
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt2(idx, 4) = dt(idx) + 15
+ end do
+ end if
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = dt2(idx, idx) + dt3(idx, idx, idx)
+ end do
+ else
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = dt(idx) + 1000
+ end do
+ if (switch2) then
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = dt2(idx, idx) + 20
+ end do
+ if (switch3) then
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = dt2(idx, idx) + dt3(idx, idx, idx)
+ end do
+ else
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt3(idx, idx, idx) = dt3(idx, idx, idx) + 15
+ end do
+ end if
+ else
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = dt2(idx, idx) + dt3(idx, idx, idx) + 111
+ end do
+ if (switch3) then
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt3(idx, idx, idx) = dt2(idx, idx) + 130
+ end do
+ else
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = dt2(idx, idx) + 120
+ end do
+ end if
+ end if
+ !$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = dt(idx) + 4000
+ end do
+ end if
+ end subroutine branching_target_call
+end module reproducer_mod
+
+program reproducer
+ use reproducer_mod
+ implicit none
+ real(4), dimension(:), allocatable :: dt
+ real(4), dimension(:, :), allocatable :: dt2
+ real(4), dimension(:, :, :), allocatable :: dt3
+ integer :: n = 100
+ integer :: i, j, k
+
+ allocate (dt(n))
+ allocate (dt2(n, n))
+ allocate (dt3(n, n, n))
+
+ dt = 1.
+ dt2 = 2.
+ dt3 = 3.
+
+ ! We're less interested in the results and more interested in if we
+ ! can cause a memory access violation at runtime in this test which
+ ! would indicate a regression in the handling of the input arguments
+ ! being mapped to targets in multiple divergent branches.
+ call branching_target_call(dt, dt2, dt3, .false., .false., .false.)
+ call branching_target_call(dt, dt2, dt3, .false., .true., .false.)
+ call branching_target_call(dt, dt2, dt3, .false., .true., .true.)
+ call branching_target_call(dt, dt2, dt3, .true., .true., .true.)
+ call branching_target_call(dt, dt2, dt3, .true., .true., .false.)
+ call branching_target_call(dt, dt2, dt3, .true., .false., .false.)
+ call branching_target_call(dt, dt2, dt3, .true., .false., .true.)
+ call branching_target_call(dt, dt2, dt3, .false., .false., .true.)
+
+ print *, "success"
+end program reproducer
diff --git a/test/smoke-fort-limbo/flang-544421/Makefile b/test/smoke-fort-limbo/flang-544421/Makefile
new file mode 100644
index 0000000000..433e402c29
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-544421/Makefile
@@ -0,0 +1,21 @@
+#NOOPT = 1
+#NOOMP = 1
+include ../../Makefile.defs
+
+# Required for the test to succeed at the moment, but also
+# required to hit the original problem.
+RUNENV += HSA_XNACK=1
+OMP_FLAGS = -fopenmp-force-usm --offload-arch=$(AOMP_GPU)
+
+TESTNAME = repro_544421
+TESTSRC_MAIN = repro_544421.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-544421/repro_544421.f90 b/test/smoke-fort-limbo/flang-544421/repro_544421.f90
new file mode 100644
index 0000000000..616a67af04
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-544421/repro_544421.f90
@@ -0,0 +1,60 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+module reproducer_mod
+contains
+ subroutine branching_target_call(dt, switch)
+ implicit none
+ real(4), dimension(:), intent(inout) :: dt
+ logical, intent(in) :: switch
+ integer :: dim, idx
+
+ dim = size(dt)
+
+ if (switch) then
+
+!$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = 20
+ end do
+
+ else
+
+!$omp target teams distribute parallel do
+ do idx = 1, dim
+ dt(idx) = 30
+ end do
+ end if
+
+ end subroutine branching_target_call
+end module reproducer_mod
+
+program reproducer
+ use reproducer_mod
+ implicit none
+ real(4), dimension(:), allocatable :: dt
+ integer :: n = 21312
+ integer :: i
+
+ allocate (dt(n))
+
+ call branching_target_call(dt, .FALSE.)
+
+ do i = 1, n
+ if (dt(i) /= 30) then
+ print *, "failed"
+ end if
+ end do
+
+ call branching_target_call(dt, .TRUE.)
+
+ do i = 1, n
+ if (dt(i) /= 20) then
+ print *, "failed"
+ end if
+ end do
+
+ print *, "success"
+end program reproducer
diff --git a/test/smoke-fort-limbo/flang-561059/Makefile b/test/smoke-fort-limbo/flang-561059/Makefile
new file mode 100644
index 0000000000..400514970a
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-561059/Makefile
@@ -0,0 +1,18 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = array_slice_repro
+TESTSRC_MAIN = array_slice_repro.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./doit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-561059/array_slice_repro.f90 b/test/smoke-fort-limbo/flang-561059/array_slice_repro.f90
new file mode 100644
index 0000000000..f1c319373a
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-561059/array_slice_repro.f90
@@ -0,0 +1,104 @@
+module foo
+ implicit none
+contains
+ subroutine bar(n, a, b, c)
+ implicit none
+ integer, intent(in) :: n
+ real(8), intent(in) :: a(n)
+ real(8), intent(in) :: b(n)
+ real(8), intent(out) :: c(n)
+ integer :: i
+ !$omp target data map(present, alloc:a, b, c)
+ !$omp end target data
+
+ !$omp target teams distribute parallel do
+ do i=1,n
+ c(i) = b(i) + a(i)
+ end do
+
+ end subroutine bar
+end module foo
+
+program main
+ use foo, only : bar
+ implicit none
+ integer :: n1, n2, n3, i1, i2, i3, iinbeg, iinend, ioutbeg, ioutend, ifldstot, choice
+ real(kind=8), allocatable :: zrgp(:,:,:) ! monolithic IFS data structure
+ real(kind=8), allocatable :: cpu(:,:,:) ! monolithic IFS data structure
+ CHARACTER(LEN=256) :: arg_string
+ INTEGER :: my_integer_value
+ INTEGER :: status
+
+ CALL GET_COMMAND_ARGUMENT(1, arg_string, STATUS=status)
+ READ(arg_string, *, IOSTAT=status) choice
+
+ IF (choice == 0) THEN
+ ! This size works.
+ n1=100
+ n2=100
+ n3=1
+ ELSE IF (choice == 1) THEN
+ ! This size fails
+ n1=100
+ n2=101
+ n3=1
+ ELSE
+ ! This choice creates a a failure with present alloc similar to what's seen in ECRad.
+ n2=100
+ n3=2
+ n1=50
+ END IF
+
+ iinbeg= 1
+ iinend= 30
+ ifldstot= n2
+ ioutbeg = iinend+1
+ ioutend = 60
+
+ allocate(zrgp(1:n1,1:n2,1:n3))
+ allocate(cpu(1:n1,1:n2,1:n3))
+
+ do i1=1, n1
+ do i2=1, n2
+ do i3=1, n3
+ zrgp(i1,i2,i3) = i2
+ end do
+ end do
+ end do
+
+ do i3=1, n3
+ do i1=1,n1
+ cpu(i1,ioutbeg,i3) = zrgp(i1,iinbeg,i3) + zrgp(i1,ioutend+1,i3)
+ cpu(i1,ioutend,i3) = zrgp(i1,iinend,i3) + zrgp(i1,ifldstot,i3)
+ end do
+
+ !$OMP TARGET ENTER DATA MAP(ALLOC:zrgp(1:n1,:,i3))
+
+ !$OMP TARGET UPDATE TO(zrgp(1:n1,iinbeg:iinend,i3), &
+ !$OMP& zrgp(1:n1,ioutend+1:ifldstot,i3))
+
+ call bar(n1,zrgp(:,iinbeg,i3),zrgp(:,ioutend+1,i3),zrgp(:,ioutbeg,i3))
+ call bar(n1,zrgp(:,iinend,i3),zrgp(:,ifldstot,i3),zrgp(:,ioutend,i3))
+
+ !$OMP TARGET UPDATE FROM(zrgp(1:n1,ioutbeg:ioutend,i3))
+ !$OMP TARGET EXIT DATA MAP(DELETE:zrgp(1:n1,:,i3))
+
+ write(*,*) "CPU(:,",ioutbeg,",",i3,")=", cpu(1,ioutbeg,i3), cpu(2,ioutbeg,i3), cpu(n1,ioutbeg,i3)
+ write(*,*) "GPU(:,",ioutbeg,",",i3,")=", zrgp(1,ioutbeg,i3), zrgp(2,ioutbeg,i3), zrgp(n1,ioutbeg,i3)
+
+ write(*,*) "CPU(:,",ioutend,",",i3,")=", cpu(1,ioutend,i3), cpu(2,ioutend,i3), cpu(n1,ioutend,i3)
+ write(*,*) "GPU(:,",ioutend,",",i3,")=", zrgp(1,ioutend,i3), zrgp(2,ioutend,i3), zrgp(n1,ioutend,i3)
+
+ if (cpu(1,ioutend,i3) /= zrgp(1,ioutend,i3) .OR. cpu(2,ioutbeg,i3) /= zrgp(2,ioutbeg,i3) .OR. &
+ cpu(n1,ioutbeg,i3) /= zrgp(n1,ioutbeg,i3) .OR. cpu(1,ioutend,i3) /= zrgp(1,ioutend,i3) .OR. &
+ cpu(2,ioutend,i3) /= zrgp(2,ioutend,i3) .OR. cpu(n1,ioutend,i3) /= zrgp(n1,ioutend,i3)) then
+ print *, "======= FORTRAN Test Failed! ======="
+ stop 1
+ endif
+ end do
+
+ deallocate(zrgp)
+
+ ! Reached end without early exiting above, results were correct.
+ print *, "======= FORTRAN Test PASSED! ======="
+end program main
\ No newline at end of file
diff --git a/test/smoke-fort-limbo/flang-561059/doit.sh b/test/smoke-fort-limbo/flang-561059/doit.sh
new file mode 100755
index 0000000000..ef4b9fe743
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-561059/doit.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+# Each value selects different array slice ranges for the program to run with.
+./$1 0
+./$1 1
+./$1 2
diff --git a/test/smoke-fort-limbo/flang-568012/Makefile b/test/smoke-fort-limbo/flang-568012/Makefile
new file mode 100644
index 0000000000..e998c2660c
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-568012/Makefile
@@ -0,0 +1,18 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = getDevNum
+TESTSRC_MAIN = getDevNum.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./doit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-568012/doit.sh b/test/smoke-fort-limbo/flang-568012/doit.sh
new file mode 100755
index 0000000000..683515e75a
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-568012/doit.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+export OMP_TARGET_OFFLOAD=DISABLED
+./$1
diff --git a/test/smoke-fort-limbo/flang-568012/getDevNum.f90 b/test/smoke-fort-limbo/flang-568012/getDevNum.f90
new file mode 100644
index 0000000000..1a56a522a9
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-568012/getDevNum.f90
@@ -0,0 +1,53 @@
+PROGRAM DisableOffload
+ USE OMP_LIB
+ USE ISO_C_BINDING
+
+ IMPLICIT NONE
+
+ INTEGER, PARAMETER :: N = 10000000
+ REAL, ALLOCATABLE, target :: host_array(:)
+ TYPE(C_PTR) :: c_host_ptr
+ INTEGER :: device_num
+ LOGICAL :: is_present_on_device
+ integer i
+
+
+ ALLOCATE(host_array(N))
+ host_array = 1.0
+
+ call omp_set_default_device(2);
+
+
+ device_num = OMP_GET_DEFAULT_DEVICE()
+
+
+ c_host_ptr = C_LOC(host_array)
+
+
+ is_present_on_device = OMP_TARGET_IS_PRESENT(c_host_ptr, device_num)
+
+ print *, 'Data is on device ', is_present_on_device
+
+ !$OMP TARGET ENTER DATA MAP(TO: host_array)
+
+ is_present_on_device = OMP_TARGET_IS_PRESENT(c_host_ptr, device_num)
+
+ print *, 'Data is on device ', is_present_on_device
+
+ !$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO &
+ !$OMP& map(present, alloc: host_array)
+ DO i = 1, N
+ host_array(i) = host_array(i) * 2.0
+ END DO
+
+ !$OMP TARGET EXIT DATA MAP(FROM: host_array)
+
+ is_present_on_device = OMP_TARGET_IS_PRESENT(c_host_ptr, device_num)
+
+ print *, 'Data is on device ', is_present_on_device
+
+ print *, host_array(55)
+
+ DEALLOCATE(host_array)
+
+END PROGRAM
diff --git a/test/smoke-fort-limbo/flang-local-aa/Makefile b/test/smoke-fort-limbo/flang-local-aa/Makefile
new file mode 100644
index 0000000000..3ae9ec7eda
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-local-aa/Makefile
@@ -0,0 +1,16 @@
+include ../../Makefile.defs
+
+TESTNAME = flang-local-aa
+TESTSRC_MAIN = flang-local-aa.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+OPT_FLAGS = -O3
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE) $(OPT_FLAGS)
+
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-local-aa/flang-local-aa.f90 b/test/smoke-fort-limbo/flang-local-aa/flang-local-aa.f90
new file mode 100644
index 0000000000..cb7fe96188
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-local-aa/flang-local-aa.f90
@@ -0,0 +1,100 @@
+! The initial version of the test case was taken from Fujitsu test suite:
+! https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0614/0614_0005.f
+! Fujitsu test suite is ARM-focused open source test suite:
+! https://github.com/fujitsu/compiler-test-suite
+! The original version does not explicitly state that the Cray pointer
+! from sub2 can alias, leading to miscompilation on the ARM platform
+! because Flang assumes that Cray pointers never alias.
+! This version includes the target attribute for the variable 'a',
+! which prevents miscompilation on ARM platforms.
+! See https://github.com/llvm/llvm-project/issues/141928 for more details.
+
+module mymodule
+contains
+ subroutine sub2(a,b)
+ integer, target:: a(10)
+ integer b(10),pa,pb
+ pointer (p1 ,pa)
+ pointer (p2 ,pb)
+
+ p1 = loc(a(1))
+ p2 = loc(b(1))
+
+ do i = 1,9
+ pa = pa + a(i+1)
+ p1 = p1 + 4
+ end do
+
+ b(1:10) = a(1:10) + b(1:10)
+
+ return
+ end
+end module mymodule
+
+ program main
+ use mymodule
+ structure /str1/
+ integer*4 ia(10)/10,9,8,7,6,5,4,3,2,1/
+ integer*4 ib(10)/1,2,3,4,5,6,7,8,9,10/
+ end structure
+ structure /str2/
+ integer*4 ia(10)
+ integer*4 ib(10)
+ end structure
+ structure /str3/
+ integer*4 ia(10)/ 3, 5, 7, 9,11,13,15,17,19,10/
+ integer*4 ib(10)/13,14,15,16,17,18,19,20,21,11/
+ end structure
+
+ record /str1/ z
+ record /str2/ zp
+ record /str3/ x
+ pointer (p,zp)
+ integer,allocatable:: alc(:,:)
+ integer za(10),zb(10),err/0/
+
+ p = loc(z)
+ call sub(zp.ia ,zp.ib)
+
+ allocate(alc(z.ia(10),z.ib(9)))
+ alc = 0
+ alc(:,1) = z.ia
+ alc(:,2) = z.ib
+ za = alc(:,1)
+ zb = alc(:,2)
+ call sub2(za,zb)
+ alc(:,1) = za
+ alc(:,2) = zb
+ do 10 i=1,10
+ if ( x.ia(i) .ne. alc(i,1) )err=1
+ if ( x.ib(i) .ne. alc(i,2) )err=1
+ 10 continue
+ if (err .eq. 0) then
+ write(6,*)'*** ok ***'
+ else
+ write(6,*)'*** ng ***'
+ write(6,*)alc
+ stop 1
+ endif
+
+ deallocate(alc)
+ end
+
+ subroutine sub(a,b)
+ integer,allocatable:: x(:,:)
+ integer*4 a(10),b(10)
+
+ allocate(x(b(10),b(2)))
+
+ x(:,1) = a
+ x(:,2) = b
+ x(:,1) = x(:,1) + x(:,2)
+ x(:,2) = x(:,1) - x(:,2)
+ x(:,1) = x(:,1) - x(:,2)
+ a = x(:,1)
+ b = x(:,2)
+
+ deallocate (x)
+ return
+ end
+
diff --git a/test/smoke-fort/flang-nestRed/Makefile b/test/smoke-fort-limbo/flang-nestRed/Makefile
similarity index 71%
rename from test/smoke-fort/flang-nestRed/Makefile
rename to test/smoke-fort-limbo/flang-nestRed/Makefile
index 760834276a..22a39b044c 100644
--- a/test/smoke-fort/flang-nestRed/Makefile
+++ b/test/smoke-fort-limbo/flang-nestRed/Makefile
@@ -14,5 +14,5 @@ CC = $(OMP_BIN) $(VERBOSE)
include ../Makefile.rules
run: $(TESTNAME)
ulimit -s unlimited ; \
- rocprof --stats ./$(TESTNAME) > run.log 2>&1 ; \
- column -t -s , < results.stats.csv
+ $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) > run.log 2>&1 ; \
+ python3 flang-nestRed.py
diff --git a/test/smoke-fort-limbo/flang-nestRed/flang-nestRed.py b/test/smoke-fort-limbo/flang-nestRed/flang-nestRed.py
new file mode 100644
index 0000000000..e66624e584
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-nestRed/flang-nestRed.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python3
+# Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+# SPDX-License-Identifier: MIT
+
+"""
+LLM: Claude 3.5 Sonnet
+Date: December 2024
+
+Query: Write a Python program specified by the following. If an error, return a negative error code.
+
+In a comment in the program, specify the LLM/version and the current date. Include this query into the program as documentation.
+
+In the directory where this program was executed, there is a directory with the current machine's name.
+In that directory, there is a file called: "*_kernel_stats.csv", for example: "1428133_kernel_stats.csv". Read that file.
+This CSV file has the following format (for example):
+
+"Name","Calls","TotalDurationNs","AverageNs","Percentage","MinNs","MaxNs","StdDev"
+"__omp_offloading_10302_2d8735b_glsc3_acc__l5",1,85531,85531.000000,100.00,85531,85531,0.00000000e+00
+
+Print out the information collected in the following format. What follows is an example:
+
+"Name" "Calls" "TotalDurationNs" "AverageNs" "Percentage"
+"__omp_offloading_10302_2d8735b_glsc3_acc__l5.kd" 1 447886 447886 100.0
+
+Delete the directory with the current machine's name.
+"""
+
+import os
+import csv
+import glob
+import shutil
+import socket
+import sys
+
+def main():
+ try:
+ # Get current machine's hostname
+ machine_name = socket.gethostname()
+
+ # Check if directory exists
+ if not os.path.isdir(machine_name):
+ print(f"Error: Directory '{machine_name}' not found.")
+ return -1
+
+ # Find the *_kernel_stats.csv file inside the directory
+ pattern = os.path.join(machine_name, "*_kernel_stats.csv")
+ csv_files = glob.glob(pattern)
+
+ if not csv_files:
+ print(f"Error: No '*_kernel_stats.csv' file found in '{machine_name}'.")
+ return -2
+
+ if len(csv_files) > 1:
+ print(f"Error: Multiple '*_kernel_stats.csv' files found in '{machine_name}'.")
+ return -3
+
+ csv_file = csv_files[0]
+
+ # Read CSV and print formatted output
+ with open(csv_file, newline='') as f:
+ reader = csv.DictReader(f)
+
+ # Print header
+ print(f'{"Name":<50} {"Calls":<8} {"TotalDurationNs":<18} {"AverageNs":<12} {"Percentage"}')
+
+ for row in reader:
+ name = row["Name"] + ".kd"
+ calls = row["Calls"]
+ total_duration = row["TotalDurationNs"]
+ average_ns = int(float(row["AverageNs"]))
+ percentage = float(row["Percentage"])
+
+ print(f'{name:<50} {calls:<8} {total_duration:<18} {average_ns:<12} {percentage}')
+
+ # Delete the directory with the machine name
+ shutil.rmtree(machine_name)
+
+ return 0
+
+ except Exception as e:
+ print(f"Error: {e}")
+ return -4
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/test/smoke-fort/flang-nestRed/redprob.f90 b/test/smoke-fort-limbo/flang-nestRed/redprob.f90
similarity index 84%
rename from test/smoke-fort/flang-nestRed/redprob.f90
rename to test/smoke-fort-limbo/flang-nestRed/redprob.f90
index 9fc6dba8e9..9a36cbdb5a 100644
--- a/test/smoke-fort/flang-nestRed/redprob.f90
+++ b/test/smoke-fort-limbo/flang-nestRed/redprob.f90
@@ -1,3 +1,8 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
function glsc3_acc(a,b,mult,n)
real a(n),b(n),mult(n)
real tmp,work(1)
diff --git a/test/smoke-fort-limbo/flang-offload-disabled-env/Makefile b/test/smoke-fort-limbo/flang-offload-disabled-env/Makefile
new file mode 100644
index 0000000000..4984bd8be1
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-offload-disabled-env/Makefile
@@ -0,0 +1,18 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = getInitDevice
+TESTSRC_MAIN = getInitDevice.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS =
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+RUNCMD = ./doit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-offload-disabled-env/doit.sh b/test/smoke-fort-limbo/flang-offload-disabled-env/doit.sh
new file mode 100755
index 0000000000..d8f80125a0
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-offload-disabled-env/doit.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# Test with OMP_DEFAULT_DEVICE=2 and OMP_TARGET_OFFLOAD=DISABLED
+# Before the fix, this would crash with "device number '2' out of range"
+# After the fix, omp_get_default_device() should return 0 (the initial device)
+export OMP_DEFAULT_DEVICE=2
+export OMP_TARGET_OFFLOAD=DISABLED
+./$1
+
+
diff --git a/test/smoke-fort-limbo/flang-offload-disabled-env/getInitDevice.f90 b/test/smoke-fort-limbo/flang-offload-disabled-env/getInitDevice.f90
new file mode 100644
index 0000000000..05893e7009
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-offload-disabled-env/getInitDevice.f90
@@ -0,0 +1,30 @@
+ program test_offload_disabled_env
+ use omp_lib
+ integer num, initial_dev
+
+ ! Test that omp_get_default_device returns the initial device
+ ! when OMP_TARGET_OFFLOAD=DISABLED, even when OMP_DEFAULT_DEVICE=2
+
+ ! Get initial device (should be 0 when offload is disabled)
+ initial_dev = omp_get_initial_device()
+ print *, 'initial device =', initial_dev
+
+ ! Get default device (should also be 0, not 2, when offload is disabled)
+ num = omp_get_default_device()
+ print *, 'default device =', num
+
+ ! Call from within target region
+ !$OMP TARGET
+ num = omp_get_default_device()
+ !$OMP END TARGET
+ print *, 'default device from target =', num
+
+ ! Verify they match
+ if (num .eq. initial_dev) then
+ print *, 'PASS: default device equals initial device'
+ else
+ print *, 'FAIL: default device does not equal initial device'
+ call exit(1)
+ end if
+
+ end
diff --git a/test/smoke-fort-limbo/flang-quadmath/Makefile b/test/smoke-fort-limbo/flang-quadmath/Makefile
new file mode 100644
index 0000000000..c759ad5cbc
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-quadmath/Makefile
@@ -0,0 +1,17 @@
+#NOOPT = 1
+#NOOMP = 1
+#OMP_FLAGS = -fopenmp
+include ../../Makefile.defs
+
+TESTNAME = qmath
+TESTSRC_MAIN = qmath.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang -lquadmath
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/flang-quadmath/qmath.f90 b/test/smoke-fort-limbo/flang-quadmath/qmath.f90
new file mode 100644
index 0000000000..67453f3f05
--- /dev/null
+++ b/test/smoke-fort-limbo/flang-quadmath/qmath.f90
@@ -0,0 +1,15 @@
+program vmm
+ implicit none
+ integer, parameter :: N = 100000
+ integer a(N), b(N), c(N)
+ integer j,i, num, flag;
+ num = N
+
+!$omp target teams map(to: a,b) map(from: c)
+!$omp loop
+ do i=1,1000
+ c(i) = a(i) * b(i)
+ end do
+!$omp end target teams
+ print *,'done'
+end program
diff --git a/test/smoke-fort-fails/kernel-exec-modes-host/Makefile b/test/smoke-fort-limbo/kernel-exec-modes-host/Makefile
similarity index 100%
rename from test/smoke-fort-fails/kernel-exec-modes-host/Makefile
rename to test/smoke-fort-limbo/kernel-exec-modes-host/Makefile
diff --git a/test/smoke-fort-fails/kernel-exec-modes-host/kernel-exec-modes-host.f90 b/test/smoke-fort-limbo/kernel-exec-modes-host/kernel-exec-modes-host.f90
similarity index 100%
rename from test/smoke-fort-fails/kernel-exec-modes-host/kernel-exec-modes-host.f90
rename to test/smoke-fort-limbo/kernel-exec-modes-host/kernel-exec-modes-host.f90
diff --git a/test/smoke-fort/kernel-exec-modes/Makefile b/test/smoke-fort-limbo/kernel-exec-modes/Makefile
similarity index 100%
rename from test/smoke-fort/kernel-exec-modes/Makefile
rename to test/smoke-fort-limbo/kernel-exec-modes/Makefile
diff --git a/test/smoke-fort/kernel-exec-modes/kernel-exec-modes.f90 b/test/smoke-fort-limbo/kernel-exec-modes/kernel-exec-modes.f90
similarity index 72%
rename from test/smoke-fort/kernel-exec-modes/kernel-exec-modes.f90
rename to test/smoke-fort-limbo/kernel-exec-modes/kernel-exec-modes.f90
index 6932c96307..a075932bbb 100644
--- a/test/smoke-fort/kernel-exec-modes/kernel-exec-modes.f90
+++ b/test/smoke-fort-limbo/kernel-exec-modes/kernel-exec-modes.f90
@@ -28,6 +28,34 @@ subroutine validate(v, cols, rows, name)
end do
end subroutine validate
+subroutine validate_generic_spmd(v, cols, rows, name)
+ implicit none
+ integer, intent(in) :: cols, rows
+ integer, intent(inout) :: v(cols, rows)
+ character(len = *), intent(in) :: name
+ integer :: i, j
+ logical :: single_thread_detected
+
+ single_thread_detected = v(2, 2) .eq. 1
+ do i=1,rows
+ do j=1,cols
+ if (single_thread_detected) then
+ if (v(j, i) .ne. (i-1)) then
+ write(*,*) name, v(:, :)
+ call exit(1)
+ endif
+ else if (v(j, i) .ne. (i-1) * cols + (j-1)) then
+ write(*,*) name, v(:, :)
+ call exit(1)
+ endif
+ end do
+ end do
+
+ if (single_thread_detected) then
+ write(*,*) "Warning: ", name, " ran in single-threaded mode. This might cause performance issues."
+ endif
+end subroutine validate_generic_spmd
+
program kernel_exec_modes
use omp_lib
implicit none
@@ -66,7 +94,7 @@ program kernel_exec_modes
a(j, i) = omp_get_team_num() * omp_get_num_threads() + omp_get_thread_num()
end do
end do
- call validate(a, threads, teams, "Combined Generic-SPMD")
+ call validate_generic_spmd(a, threads, teams, "Combined Generic-SPMD")
! Split Generic-SPMD
call init_arr(a, threads, teams)
@@ -79,7 +107,7 @@ program kernel_exec_modes
end do
end do
!$omp end target teams
- call validate(a, threads, teams, "Split Generic-SPMD")
+ call validate_generic_spmd(a, threads, teams, "Split Generic-SPMD")
! Generic
call init_arr(a, threads, teams)
diff --git a/test/smoke-fort/mathquad/Makefile b/test/smoke-fort-limbo/mathquad/Makefile
similarity index 100%
rename from test/smoke-fort/mathquad/Makefile
rename to test/smoke-fort-limbo/mathquad/Makefile
diff --git a/test/smoke-fort/mathquad/mathquad.f90 b/test/smoke-fort-limbo/mathquad/mathquad.f90
similarity index 100%
rename from test/smoke-fort/mathquad/mathquad.f90
rename to test/smoke-fort-limbo/mathquad/mathquad.f90
diff --git a/test/smoke-fort-dev/multi-generic/Makefile b/test/smoke-fort-limbo/multi-generic/Makefile
similarity index 100%
rename from test/smoke-fort-dev/multi-generic/Makefile
rename to test/smoke-fort-limbo/multi-generic/Makefile
diff --git a/test/smoke-fort-dev/multi-generic/main.f90 b/test/smoke-fort-limbo/multi-generic/main.f90
similarity index 100%
rename from test/smoke-fort-dev/multi-generic/main.f90
rename to test/smoke-fort-limbo/multi-generic/main.f90
diff --git a/test/smoke-fort-dev/multi-generic/vadd.f90 b/test/smoke-fort-limbo/multi-generic/vadd.f90
similarity index 100%
rename from test/smoke-fort-dev/multi-generic/vadd.f90
rename to test/smoke-fort-limbo/multi-generic/vadd.f90
diff --git a/test/smoke-fort-dev/multi-generic/vmul.f90 b/test/smoke-fort-limbo/multi-generic/vmul.f90
similarity index 100%
rename from test/smoke-fort-dev/multi-generic/vmul.f90
rename to test/smoke-fort-limbo/multi-generic/vmul.f90
diff --git a/test/smoke-fort-dev/tgt-stop-lhostdev/Makefile b/test/smoke-fort-limbo/tgt-abort-lhostdev/Makefile
similarity index 91%
rename from test/smoke-fort-dev/tgt-stop-lhostdev/Makefile
rename to test/smoke-fort-limbo/tgt-abort-lhostdev/Makefile
index 5012481a6e..77511f0af9 100644
--- a/test/smoke-fort-dev/tgt-stop-lhostdev/Makefile
+++ b/test/smoke-fort-limbo/tgt-abort-lhostdev/Makefile
@@ -8,7 +8,7 @@ TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
FLANG ?= flang
-CFLAGS = -lflang_rt.hostdevice
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
diff --git a/test/smoke-fort-dev/tgt-abort-lhostdev/README.txt b/test/smoke-fort-limbo/tgt-abort-lhostdev/README.txt
similarity index 100%
rename from test/smoke-fort-dev/tgt-abort-lhostdev/README.txt
rename to test/smoke-fort-limbo/tgt-abort-lhostdev/README.txt
diff --git a/test/smoke-fort-dev/tgt-abort-lhostdev/chk.stderr b/test/smoke-fort-limbo/tgt-abort-lhostdev/chk.stderr
similarity index 100%
rename from test/smoke-fort-dev/tgt-abort-lhostdev/chk.stderr
rename to test/smoke-fort-limbo/tgt-abort-lhostdev/chk.stderr
diff --git a/test/smoke-fort-dev/tgt-stop-lhostdev/chk.stdout b/test/smoke-fort-limbo/tgt-abort-lhostdev/chk.stdout
similarity index 100%
rename from test/smoke-fort-dev/tgt-stop-lhostdev/chk.stdout
rename to test/smoke-fort-limbo/tgt-abort-lhostdev/chk.stdout
diff --git a/test/smoke-fort-dev/tgt-print-val-lhostdev/chkit.sh b/test/smoke-fort-limbo/tgt-abort-lhostdev/chkit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-val-lhostdev/chkit.sh
rename to test/smoke-fort-limbo/tgt-abort-lhostdev/chkit.sh
diff --git a/test/smoke-fort-dev/tgt-abort-lhostdev/doit.sh b/test/smoke-fort-limbo/tgt-abort-lhostdev/doit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-abort-lhostdev/doit.sh
rename to test/smoke-fort-limbo/tgt-abort-lhostdev/doit.sh
diff --git a/test/smoke-fort-dev/tgt-abort-lhostdev/test.f90 b/test/smoke-fort-limbo/tgt-abort-lhostdev/test.f90
similarity index 100%
rename from test/smoke-fort-dev/tgt-abort-lhostdev/test.f90
rename to test/smoke-fort-limbo/tgt-abort-lhostdev/test.f90
diff --git a/test/smoke-fort-dev/tgt-abort-lhostdev/Makefile b/test/smoke-fort-limbo/tgt-print-hello-lhostdev/Makefile
similarity index 91%
rename from test/smoke-fort-dev/tgt-abort-lhostdev/Makefile
rename to test/smoke-fort-limbo/tgt-print-hello-lhostdev/Makefile
index 5012481a6e..77511f0af9 100644
--- a/test/smoke-fort-dev/tgt-abort-lhostdev/Makefile
+++ b/test/smoke-fort-limbo/tgt-print-hello-lhostdev/Makefile
@@ -8,7 +8,7 @@ TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
FLANG ?= flang
-CFLAGS = -lflang_rt.hostdevice
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
diff --git a/test/smoke-fort-dev/tgt-print-hello-lhostdev/README.txt b/test/smoke-fort-limbo/tgt-print-hello-lhostdev/README.txt
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-hello-lhostdev/README.txt
rename to test/smoke-fort-limbo/tgt-print-hello-lhostdev/README.txt
diff --git a/test/smoke-fort-dev/tgt-write-lhostdev/chk.stderr b/test/smoke-fort-limbo/tgt-print-hello-lhostdev/chk.stderr
similarity index 100%
rename from test/smoke-fort-dev/tgt-write-lhostdev/chk.stderr
rename to test/smoke-fort-limbo/tgt-print-hello-lhostdev/chk.stderr
diff --git a/test/smoke-fort-dev/tgt-print-hello-lhostdev/chk.stdout b/test/smoke-fort-limbo/tgt-print-hello-lhostdev/chk.stdout
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-hello-lhostdev/chk.stdout
rename to test/smoke-fort-limbo/tgt-print-hello-lhostdev/chk.stdout
diff --git a/test/smoke-fort-dev/tgt-stop-lhostdev/chkit.sh b/test/smoke-fort-limbo/tgt-print-hello-lhostdev/chkit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-stop-lhostdev/chkit.sh
rename to test/smoke-fort-limbo/tgt-print-hello-lhostdev/chkit.sh
diff --git a/test/smoke-fort-dev/tgt-write-lhostdev/doit.sh b/test/smoke-fort-limbo/tgt-print-hello-lhostdev/doit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-write-lhostdev/doit.sh
rename to test/smoke-fort-limbo/tgt-print-hello-lhostdev/doit.sh
diff --git a/test/smoke-fort-dev/tgt-print-hello-lhostdev/test.f90 b/test/smoke-fort-limbo/tgt-print-hello-lhostdev/test.f90
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-hello-lhostdev/test.f90
rename to test/smoke-fort-limbo/tgt-print-hello-lhostdev/test.f90
diff --git a/test/smoke-fort-dev/tgt-print-hello-lhostdev/Makefile b/test/smoke-fort-limbo/tgt-print-val-lhostdev/Makefile
similarity index 91%
rename from test/smoke-fort-dev/tgt-print-hello-lhostdev/Makefile
rename to test/smoke-fort-limbo/tgt-print-val-lhostdev/Makefile
index 5012481a6e..77511f0af9 100644
--- a/test/smoke-fort-dev/tgt-print-hello-lhostdev/Makefile
+++ b/test/smoke-fort-limbo/tgt-print-val-lhostdev/Makefile
@@ -8,7 +8,7 @@ TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
FLANG ?= flang
-CFLAGS = -lflang_rt.hostdevice
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
diff --git a/test/smoke-fort-dev/tgt-print-val-lhostdev/README.txt b/test/smoke-fort-limbo/tgt-print-val-lhostdev/README.txt
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-val-lhostdev/README.txt
rename to test/smoke-fort-limbo/tgt-print-val-lhostdev/README.txt
diff --git a/test/smoke-fort-limbo/tgt-print-val-lhostdev/chk.stderr b/test/smoke-fort-limbo/tgt-print-val-lhostdev/chk.stderr
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/test/smoke-fort-dev/tgt-print-val-lhostdev/chk.stdout b/test/smoke-fort-limbo/tgt-print-val-lhostdev/chk.stdout
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-val-lhostdev/chk.stdout
rename to test/smoke-fort-limbo/tgt-print-val-lhostdev/chk.stdout
diff --git a/test/smoke-fort-dev/tgt-write-lhostdev/chkit.sh b/test/smoke-fort-limbo/tgt-print-val-lhostdev/chkit.sh
similarity index 100%
rename from test/smoke-fort-dev/tgt-write-lhostdev/chkit.sh
rename to test/smoke-fort-limbo/tgt-print-val-lhostdev/chkit.sh
diff --git a/test/smoke-fort-limbo/tgt-print-val-lhostdev/doit.sh b/test/smoke-fort-limbo/tgt-print-val-lhostdev/doit.sh
new file mode 100755
index 0000000000..d55b82dd5b
--- /dev/null
+++ b/test/smoke-fort-limbo/tgt-print-val-lhostdev/doit.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+rm -f $1.stdout.log $1.stderr.log
+./$1 2> $1.stderr.log | tee -a $1.stdout.log
diff --git a/test/smoke-fort-dev/tgt-print-val-lhostdev/test.f90 b/test/smoke-fort-limbo/tgt-print-val-lhostdev/test.f90
similarity index 100%
rename from test/smoke-fort-dev/tgt-print-val-lhostdev/test.f90
rename to test/smoke-fort-limbo/tgt-print-val-lhostdev/test.f90
diff --git a/test/smoke-fort-dev/tgt-print-val-lhostdev/Makefile b/test/smoke-fort-limbo/tgt-stop-lhostdev/Makefile
similarity index 91%
rename from test/smoke-fort-dev/tgt-print-val-lhostdev/Makefile
rename to test/smoke-fort-limbo/tgt-stop-lhostdev/Makefile
index 5012481a6e..77511f0af9 100644
--- a/test/smoke-fort-dev/tgt-print-val-lhostdev/Makefile
+++ b/test/smoke-fort-limbo/tgt-stop-lhostdev/Makefile
@@ -8,7 +8,7 @@ TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
FLANG ?= flang
-CFLAGS = -lflang_rt.hostdevice
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
OMP_BIN = $(AOMP)/bin/$(FLANG)
CC = $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
diff --git a/test/smoke-fort-dev/tgt-stop-lhostdev/README.txt b/test/smoke-fort-limbo/tgt-stop-lhostdev/README.txt
similarity index 100%
rename from test/smoke-fort-dev/tgt-stop-lhostdev/README.txt
rename to test/smoke-fort-limbo/tgt-stop-lhostdev/README.txt
diff --git a/test/smoke-fort-dev/tgt-stop-lhostdev/chk.stderr b/test/smoke-fort-limbo/tgt-stop-lhostdev/chk.stderr
similarity index 100%
rename from test/smoke-fort-dev/tgt-stop-lhostdev/chk.stderr
rename to test/smoke-fort-limbo/tgt-stop-lhostdev/chk.stderr
diff --git a/test/smoke-fort-limbo/tgt-stop-lhostdev/chk.stdout b/test/smoke-fort-limbo/tgt-stop-lhostdev/chk.stdout
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/test/smoke-fort-limbo/tgt-stop-lhostdev/chkit.sh b/test/smoke-fort-limbo/tgt-stop-lhostdev/chkit.sh
new file mode 100755
index 0000000000..567f1d41a5
--- /dev/null
+++ b/test/smoke-fort-limbo/tgt-stop-lhostdev/chkit.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+diff -w $1.stderr.log chk.stderr
+diff -w $1.stdout.log chk.stdout
diff --git a/test/smoke-fort-limbo/tgt-stop-lhostdev/doit.sh b/test/smoke-fort-limbo/tgt-stop-lhostdev/doit.sh
new file mode 100755
index 0000000000..d55b82dd5b
--- /dev/null
+++ b/test/smoke-fort-limbo/tgt-stop-lhostdev/doit.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+rm -f $1.stdout.log $1.stderr.log
+./$1 2> $1.stderr.log | tee -a $1.stdout.log
diff --git a/test/smoke-fort-dev/tgt-stop-lhostdev/test.f90 b/test/smoke-fort-limbo/tgt-stop-lhostdev/test.f90
similarity index 100%
rename from test/smoke-fort-dev/tgt-stop-lhostdev/test.f90
rename to test/smoke-fort-limbo/tgt-stop-lhostdev/test.f90
diff --git a/test/smoke-fort-limbo/tgt-variable-array-dimension/Makefile b/test/smoke-fort-limbo/tgt-variable-array-dimension/Makefile
new file mode 100644
index 0000000000..854f0b745f
--- /dev/null
+++ b/test/smoke-fort-limbo/tgt-variable-array-dimension/Makefile
@@ -0,0 +1,14 @@
+NOOPT = 1
+include ../../Makefile.defs
+
+TESTNAME = tgt-variable-array-dimension
+TESTSRC_MAIN = tgt-variable-array-dimension.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+CFLAGS = -O0
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-limbo/tgt-variable-array-dimension/tgt-variable-array-dimension.f90 b/test/smoke-fort-limbo/tgt-variable-array-dimension/tgt-variable-array-dimension.f90
new file mode 100644
index 0000000000..43ca61f8eb
--- /dev/null
+++ b/test/smoke-fort-limbo/tgt-variable-array-dimension/tgt-variable-array-dimension.f90
@@ -0,0 +1,40 @@
+subroutine init_array(ub, v)
+ implicit none
+
+ integer, intent(in) :: ub
+ real, dimension(1:ub+1, 1:ub+1), intent(out) :: v
+
+ integer :: i, j
+
+ !$omp target teams distribute
+ do i=1,6
+ !$omp parallel do
+ do j=1,6
+ v(j, i) = 100.0
+ end do
+ end do
+end subroutine
+
+program main
+ implicit none
+
+ real, dimension(:, :), allocatable :: v
+ integer :: i, j
+
+ allocate(v(1:6, 1:6))
+
+ !$omp target enter data map(alloc: v)
+ call init_array(5, v)
+ !$omp target exit data map(from: v)
+
+ do i=1,6
+ do j=1,6
+ if (v(j, i) /= 100.0) then
+ print *, "Expected values: 100.0. Actual values:", v(:,:)
+ stop 1
+ end if
+ end do
+ end do
+
+ deallocate(v)
+end program
diff --git a/test/smoke-fort-limbo/tgt-write-lhostdev/Makefile b/test/smoke-fort-limbo/tgt-write-lhostdev/Makefile
new file mode 100644
index 0000000000..77511f0af9
--- /dev/null
+++ b/test/smoke-fort-limbo/tgt-write-lhostdev/Makefile
@@ -0,0 +1,20 @@
+# For testing without openmp:
+# OMP_FLAGS = -DNO_OMP
+include ../../Makefile.defs
+
+TESTNAME = test
+TESTSRC_MAIN = test.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+CFLAGS = $(FLANG_GPU_LINK_FLAGS)
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+#RUNENV += LIBOMPTARGET_INFO=-1
+RUNCMD = ./doit.sh ${TESTNAME} && ./chkit.sh ${TESTNAME}
+
+include ../Makefile.rules
diff --git a/test/smoke-fort-dev/tgt-write-lhostdev/README.txt b/test/smoke-fort-limbo/tgt-write-lhostdev/README.txt
similarity index 100%
rename from test/smoke-fort-dev/tgt-write-lhostdev/README.txt
rename to test/smoke-fort-limbo/tgt-write-lhostdev/README.txt
diff --git a/test/smoke-fort-limbo/tgt-write-lhostdev/chk.stderr b/test/smoke-fort-limbo/tgt-write-lhostdev/chk.stderr
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/test/smoke-fort-dev/tgt-write-lhostdev/chk.stdout b/test/smoke-fort-limbo/tgt-write-lhostdev/chk.stdout
similarity index 100%
rename from test/smoke-fort-dev/tgt-write-lhostdev/chk.stdout
rename to test/smoke-fort-limbo/tgt-write-lhostdev/chk.stdout
diff --git a/test/smoke-fort-limbo/tgt-write-lhostdev/chkit.sh b/test/smoke-fort-limbo/tgt-write-lhostdev/chkit.sh
new file mode 100755
index 0000000000..567f1d41a5
--- /dev/null
+++ b/test/smoke-fort-limbo/tgt-write-lhostdev/chkit.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+diff -w $1.stderr.log chk.stderr
+diff -w $1.stdout.log chk.stdout
diff --git a/test/smoke-fort-limbo/tgt-write-lhostdev/doit.sh b/test/smoke-fort-limbo/tgt-write-lhostdev/doit.sh
new file mode 100755
index 0000000000..d55b82dd5b
--- /dev/null
+++ b/test/smoke-fort-limbo/tgt-write-lhostdev/doit.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+rm -f $1.stdout.log $1.stderr.log
+./$1 2> $1.stderr.log | tee -a $1.stdout.log
diff --git a/test/smoke-fort-dev/tgt-write-lhostdev/test.f90 b/test/smoke-fort-limbo/tgt-write-lhostdev/test.f90
similarity index 100%
rename from test/smoke-fort-dev/tgt-write-lhostdev/test.f90
rename to test/smoke-fort-limbo/tgt-write-lhostdev/test.f90
diff --git a/test/smoke-fort-dev/whole-archive-module/Makefile b/test/smoke-fort-limbo/whole-archive-module/Makefile
similarity index 100%
rename from test/smoke-fort-dev/whole-archive-module/Makefile
rename to test/smoke-fort-limbo/whole-archive-module/Makefile
diff --git a/test/smoke-fort-dev/whole-archive-module/main.f90 b/test/smoke-fort-limbo/whole-archive-module/main.f90
similarity index 100%
rename from test/smoke-fort-dev/whole-archive-module/main.f90
rename to test/smoke-fort-limbo/whole-archive-module/main.f90
diff --git a/test/smoke-fort-dev/whole-archive-module/mymod.f90 b/test/smoke-fort-limbo/whole-archive-module/mymod.f90
similarity index 100%
rename from test/smoke-fort-dev/whole-archive-module/mymod.f90
rename to test/smoke-fort-limbo/whole-archive-module/mymod.f90
diff --git a/test/smoke-fort-dev/whole-archive-module/mymod_impl.f90 b/test/smoke-fort-limbo/whole-archive-module/mymod_impl.f90
similarity index 100%
rename from test/smoke-fort-dev/whole-archive-module/mymod_impl.f90
rename to test/smoke-fort-limbo/whole-archive-module/mymod_impl.f90
diff --git a/test/smoke-fort-dev/whole-archive/Makefile b/test/smoke-fort-limbo/whole-archive/Makefile
similarity index 100%
rename from test/smoke-fort-dev/whole-archive/Makefile
rename to test/smoke-fort-limbo/whole-archive/Makefile
diff --git a/test/smoke-fort-dev/whole-archive/main.f90 b/test/smoke-fort-limbo/whole-archive/main.f90
similarity index 100%
rename from test/smoke-fort-dev/whole-archive/main.f90
rename to test/smoke-fort-limbo/whole-archive/main.f90
diff --git a/test/smoke-fort-dev/whole-archive/vadd.f90 b/test/smoke-fort-limbo/whole-archive/vadd.f90
similarity index 100%
rename from test/smoke-fort-dev/whole-archive/vadd.f90
rename to test/smoke-fort-limbo/whole-archive/vadd.f90
diff --git a/test/smoke-fort/Makefile b/test/smoke-fort/Makefile
index 223ea6f741..669b978778 100644
--- a/test/smoke-fort/Makefile
+++ b/test/smoke-fort/Makefile
@@ -1,182 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- 1D-full-bounds-exp-map \
- 1D-partial-bounds-exp-map \
- bycopy-implicit-map \
- clause_num_teams \
- clause_num_threads \
- clause_thread_limit \
- declare-target-and-explicit-map \
- declare-target-and-implicit-and-explicit-map \
- declare-target-link-1 \
- declare-target-link-2 \
- declare-target-link-3 \
- distribute-parallel-do-if-host \
- end \
- end-ffixed-form \
- end-fopenmp \
- exp-real-map \
- f2018-select-rank \
- fdefault-sizeof \
- fdefault-type-8 \
- flang-274768 \
- flang-274768-1 \
- flang-315421 \
- flang-325095 \
- flang-364228-0 \
- flang-364228-1 \
- flang-404247 \
- flang-416048 \
- flang-420573 \
- flang-421111-1 \
- flang-421111-2 \
- flang-421353 \
- flang-439387 \
- flang-439387a \
- flang-439387b \
- flang-439387c \
- flang-440121 \
- flang-441477 \
- flang-443915 \
- flang-444386-1 \
- flang-445718 \
- flang-445718-fortran-intrinsic \
- flang-445718-sign \
- flang-445882 \
- flang-445888 \
- flang-446005a \
- flang-446005b \
- flang-446033a_loop \
- flang-446033a_ttdpd \
- flang-446033c_loop \
- flang-446033c_ttdpd \
- flang-446033d_loop \
- flang-446033d_ttdpd \
- flang-446034 \
- flang-446057a \
- flang-446057b \
- flang-446057c \
- flang-446057d \
- flang-446525 \
- flang-453308 \
- flang-453308a \
- flang-457354 \
- flang-458684 \
- flang-460740 \
- flang-462537 \
- flang-463690 \
- flang-464541 \
- flang-464660 \
- flang-464660-1 \
- flang-471982 \
- flang-472452 \
- flang-476122 \
- flang-476419 \
- flang-478281 \
- flang-479382 \
- flang-479382-1 \
- flang-479382-2 \
- flang-479382-3 \
- flang-479382-4 \
- flang-479382-5 \
- flang-485161 \
- flang-485265 \
- flang-489239 \
- flang-489863 \
- flang-491971 \
- flang-494405 \
- flang-495125 \
- flang-502486 \
- flang-511356 \
- flang-520127_loop-bind \
- flang-520127_loop-parbind \
- flang-522104 \
- flang-522365-ttdpd-1-1 \
- flang-522365-ttdpd-2s \
- flang-nested-parallel-do-loops \
- flang-nestRed \
- flang-pr-93 \
- flang-target-associate-ptr \
- flang-TL-0 \
- flang-TL-1 \
- flang-TP-0 \
- flang-TP-1 \
- flang-gpu-abort \
- flang-gpu-stop-integer \
- flang-gpu-stop-string \
- flang-use-device \
- hellofort-io \
- hellofort-nio \
- intrin-rename-func \
- intrin-rename-sub \
- iso_flush \
- jacobi \
- kernel-exec-modes \
- kernel-exec-modes-reductions \
- LaunchLatency \
- lg-squaretri \
- llvm-issue-82047 \
- math-acos \
- mathdbl \
- mathdbl-tgt \
- math-erfc \
- mathquad \
- milestone-1 \
- milestone-2 \
- milestone-3-babel \
- milestone-3-babel-drop-1 \
- milestone-3-babel-noteams \
- mix-host-target \
- olcf-tc-0-serial \
- olcf-tc-1-openmp-cpu \
- olcf-tc-2-openmp-gpu-teams \
- olcf-tc-3-openmp-gpu-parallel \
- olcf-tc-4-openmp-gpu-data \
- olcf-tc-5-openmp-gpu-implicit \
- olcf-tc-6-openmp-combined \
- olcf-tc-7-loop-combined \
- olcf-tf-0-serial \
- olcf-tf-1-openmp-cpu \
- olcf-tf-2-openmp-gpu-teams \
- olcf-tf-3-openmp-gpu-teams-parallel \
- olcf-tf-4-openmp-gpu-teams-parallel-data \
- olcf-tf-5-openmp-gpu-teams-parallel-implicit-map \
- olcf-tf-6-combined \
- olcf-tf-7-loop-combined \
- recursive-ack \
- recursive-ackmemo \
- recursive-fact \
- recursive-factmemo \
- recursive-fib \
- recursive-fibmemo \
- rocm-aomp-issue-1148 \
- rocm-issue-202 \
- single-value-map \
- split-dist-f90 \
- split-dist-par-c \
- split-dist-par-f90 \
- split-outer2 \
- target-cray-pointer \
- teams-distribute-no-parallel \
- teams-ditribute-collapse \
- tgt-abort \
- tgt-print-val \
- tgt-print-hello \
- tgt-printf-c \
- tgt-stop \
- tgt-write \
- vaddt-complex2 \
- vaddt-complex4 \
- vaddt-complex8 \
- vaddt-integer2 \
- vaddt-integer4 \
- vaddt-integer8 \
- vaddt-real2 \
- vaddt-real4 \
- vaddt-real8 \
- vmuln
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/smoke-fort/flang-523229/Makefile b/test/smoke-fort/flang-523229/Makefile
new file mode 100644
index 0000000000..f23386ff7c
--- /dev/null
+++ b/test/smoke-fort/flang-523229/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = type_bound_proc_target
+TESTSRC_MAIN = type_bound_proc_target.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-fort/flang-523229/type_bound_proc_target.f90 b/test/smoke-fort/flang-523229/type_bound_proc_target.f90
new file mode 100644
index 0000000000..0495b156c6
--- /dev/null
+++ b/test/smoke-fort/flang-523229/type_bound_proc_target.f90
@@ -0,0 +1,36 @@
+!
+!Copyright © Advanced Micro Devices, Inc., or its affiliates.
+!
+!SPDX-License-Identifier: MIT
+!
+! Reproducer for tickets SWDEV-523229 and SWDEV-540611.
+! Compilation would fail while lowering to LLVM IR due to leftover host
+! operations in the device MLIR module.
+
+module mymodule
+ implicit none
+
+ type :: myclass
+ contains
+ procedure :: myfunc => myfunc
+ end type myclass
+
+contains
+ subroutine myfunc(self)
+ class(myclass) :: self
+ end subroutine
+end module
+
+program main
+ use mymodule, only : myclass
+ implicit none
+
+ class(myclass), allocatable :: x
+ allocate(x)
+
+ call x%myfunc()
+ !$omp target
+ !$omp end target
+
+ deallocate(x)
+end program
diff --git a/test/smoke-fort/flang-target-associate-ptr/device-omp.c b/test/smoke-fort/flang-target-associate-ptr/device-omp.c
index af2ad3121c..194bc8158b 100644
--- a/test/smoke-fort/flang-target-associate-ptr/device-omp.c
+++ b/test/smoke-fort/flang-target-associate-ptr/device-omp.c
@@ -1,3 +1,8 @@
+/*
+ Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT
+*/
#include
#include
#include
diff --git a/test/smoke-fort/milestone-3-babel-drop-1/doit.sh b/test/smoke-fort/milestone-3-babel-drop-1/doit.sh
index 27a5d0fb76..bd21d0bdff 100755
--- a/test/smoke-fort/milestone-3-babel-drop-1/doit.sh
+++ b/test/smoke-fort/milestone-3-babel-drop-1/doit.sh
@@ -6,6 +6,10 @@ set -x
save_status
./milestone-3-babel -n 20 -s 100000000 # 2400.0 MB
save_status
+if [[ "$AOMP_GPU" =~ ^gfx12.* ]]; then
+ echo "$AOMP_GPU: Skipping remaining larger memory tests"
+ exit $rval
+fi
./milestone-3-babel -n 20 -s 200000000 # 4800.0 MB
save_status
if [[ "$AOMP_GPU" =~ ^gfx900 ]] ||
diff --git a/test/smoke-fort/milestone-3-babel/doit.sh b/test/smoke-fort/milestone-3-babel/doit.sh
index 7a186e7ca5..b9a3208773 100755
--- a/test/smoke-fort/milestone-3-babel/doit.sh
+++ b/test/smoke-fort/milestone-3-babel/doit.sh
@@ -11,6 +11,10 @@ save_status
$PRECMD ./milestone-3-babel -n 20 -s 100000000 # 2400.0 MB
save_status
+if [[ "$AOMP_GPU" =~ ^gfx12.* ]]; then
+ echo "$AOMP_GPU: Skipping remaining larger memory tests"
+ exit $rval
+fi
$PRECMD ./milestone-3-babel -n 20 -s 200000000 # 4800.0 MB
save_status
if [[ "$AOMP_GPU" =~ ^gfx900 ]] ||
diff --git a/test/smoke-fort/split-dist-par-c/split-dist-par.c b/test/smoke-fort/split-dist-par-c/split-dist-par.c
index 40e6f9482b..3300e94221 100644
--- a/test/smoke-fort/split-dist-par-c/split-dist-par.c
+++ b/test/smoke-fort/split-dist-par-c/split-dist-par.c
@@ -1,3 +1,6 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
#include
#include
diff --git a/test/smoke-limbo/Makefile b/test/smoke-limbo/Makefile
index 01d0d1db84..c353bf7252 100644
--- a/test/smoke-limbo/Makefile
+++ b/test/smoke-limbo/Makefile
@@ -1,63 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- SAtealeaf \
- aomp-issue376 \
- aomp-issue531 \
- link-missing-file \
- multi-sdma \
- no-loop-1 \
- no-loop-2 \
- no-loop-3 \
- no-loop-4 \
- no-loop-5 \
- no-loop-6 \
- no-loop-7 \
- no-loop-threads \
- omptest-device-emi \
- omptest-device-non-emi \
- opt-kernel-global-iv \
- opt-kernel-inner-pragma-1 \
- opt_kerns_clauses \
- usm-locals-pragma-xnack-disabled-xnack-plus \
- usm-locals-pragma-xnack-enabled-xnack-any \
- usm-locals-pragma-xnack-enabled-xnack-minus \
- usm-locals-pragma-xnack-enabled-xnack-plus \
- usm-locals-xnack-disabled-xnack-any \
- usm-locals-xnack-disabled-xnack-any-apu-maps \
- usm-locals-xnack-disabled-xnack-minus \
- usm-locals-xnack-disabled-xnack-plus \
- usm-locals-xnack-enabled-xnack-any-apu \
- usm-locals-xnack-enabled-xnack-any-apu-maps-non-apu \
- usm-locals-xnack-enabled-xnack-any-non-apu \
- usm-locals-xnack-enabled-xnack-minus \
- usm-locals-xnack-enabled-xnack-plus-apu \
- usm-locals-xnack-enabled-xnack-plus-apu-maps-non-apu \
- usm-locals-xnack-enabled-xnack-plus-non-apu \
- veccopy-ctor-1 \
- veccopy-ompt-ctor-1 \
- veccopy-ompt-target \
- veccopy-ompt-target-cmake \
- veccopy-ompt-target-data-emi \
- veccopy-ompt-target-data-tracing-emi \
- veccopy-ompt-target-default-device \
- veccopy-ompt-target-devices \
- veccopy-ompt-target-emi \
- veccopy-ompt-target-emi-map \
- veccopy-ompt-target-emi-tracing \
- veccopy-ompt-target-emi-tracing-sync-async \
- veccopy-ompt-target-emi-tracing-sync-force \
- veccopy-ompt-target-emi-tracing-sync-size \
- veccopy-ompt-target-map \
- veccopy-ompt-target-tracing \
- veccopy-ompt-target-translate-time \
- veccopy-ompt-target-type-device-time \
- workgroup_size_option1 \
- workgroup_size_option2 \
- xteam-red-fast-1 \
- xteam-red-split-1 \
- xteam-red-split-2 \
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/smoke-dev/Threads1xxx/Makefile b/test/smoke-limbo/Threads1xxx/Makefile
similarity index 100%
rename from test/smoke-dev/Threads1xxx/Makefile
rename to test/smoke-limbo/Threads1xxx/Makefile
diff --git a/test/smoke-dev/Threads1xxx/NRUN b/test/smoke-limbo/Threads1xxx/NRUN
similarity index 100%
rename from test/smoke-dev/Threads1xxx/NRUN
rename to test/smoke-limbo/Threads1xxx/NRUN
diff --git a/test/smoke-dev/Threads1xxx/Threads1xxx.c b/test/smoke-limbo/Threads1xxx/Threads1xxx.c
similarity index 100%
rename from test/smoke-dev/Threads1xxx/Threads1xxx.c
rename to test/smoke-limbo/Threads1xxx/Threads1xxx.c
diff --git a/test/smoke-dev/aomp_mappings_newrt/Makefile b/test/smoke-limbo/aomp_mappings_newrt/Makefile
similarity index 100%
rename from test/smoke-dev/aomp_mappings_newrt/Makefile
rename to test/smoke-limbo/aomp_mappings_newrt/Makefile
diff --git a/test/smoke-dev/aomp_mappings_newrt/aomp_mappings_newrt.c b/test/smoke-limbo/aomp_mappings_newrt/aomp_mappings_newrt.c
similarity index 95%
rename from test/smoke-dev/aomp_mappings_newrt/aomp_mappings_newrt.c
rename to test/smoke-limbo/aomp_mappings_newrt/aomp_mappings_newrt.c
index f84e60756f..174ebafb51 100644
--- a/test/smoke-dev/aomp_mappings_newrt/aomp_mappings_newrt.c
+++ b/test/smoke-limbo/aomp_mappings_newrt/aomp_mappings_newrt.c
@@ -314,17 +314,20 @@ int main()
#pragma omp target teams
{
int j = omp_get_team_num();
- thread_num[j] = omp_get_thread_num();
- num_threads[j] = omp_get_num_threads();
- team_num[j] = omp_get_team_num();
- num_teams[j] = omp_get_num_teams();
- default_dev[j] = omp_get_default_device();
- warp_id[j] = omp_ext_get_warp_id();
- lane_id[j] = omp_ext_get_lane_id();
- active_mask[j] = omp_ext_get_active_threads_mask();
- smid[j] = omp_ext_get_smid();
- master_thread_id[j] = omp_ext_get_master_thread_id();
- is_spmd_mode[j] = omp_ext_is_spmd_mode();
+ // Number of teams on a GPU might exceed array size, e.g., gfx942.
+ if (j < N) {
+ thread_num[j] = omp_get_thread_num();
+ num_threads[j] = omp_get_num_threads();
+ team_num[j] = omp_get_team_num();
+ num_teams[j] = omp_get_num_teams();
+ default_dev[j] = omp_get_default_device();
+ warp_id[j] = omp_ext_get_warp_id();
+ lane_id[j] = omp_ext_get_lane_id();
+ active_mask[j] = omp_ext_get_active_threads_mask();
+ smid[j] = omp_ext_get_smid();
+ master_thread_id[j] = omp_ext_get_master_thread_id();
+ is_spmd_mode[j] = omp_ext_is_spmd_mode();
+ }
}
diff --git a/test/smoke-dev/check-xnack/Makefile b/test/smoke-limbo/check-xnack/Makefile
similarity index 100%
rename from test/smoke-dev/check-xnack/Makefile
rename to test/smoke-limbo/check-xnack/Makefile
diff --git a/test/smoke-dev/check-xnack/check-xnack.cpp b/test/smoke-limbo/check-xnack/check-xnack.cpp
similarity index 100%
rename from test/smoke-dev/check-xnack/check-xnack.cpp
rename to test/smoke-limbo/check-xnack/check-xnack.cpp
diff --git a/test/smoke-limbo/clang-ifaces/Makefile b/test/smoke-limbo/clang-ifaces/Makefile
new file mode 100644
index 0000000000..720c5f5f7a
--- /dev/null
+++ b/test/smoke-limbo/clang-ifaces/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = clang-ifaces
+TESTSRC_MAIN = clang-ifaces.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+CLANG ?= clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-limbo/clang-ifaces/clang-ifaces.c b/test/smoke-limbo/clang-ifaces/clang-ifaces.c
new file mode 100644
index 0000000000..2b588c0629
--- /dev/null
+++ b/test/smoke-limbo/clang-ifaces/clang-ifaces.c
@@ -0,0 +1,51 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
+#include
+#include
+
+int main(){
+ int a[256];
+ int b[256];
+ int c;
+ int d;
+ int e[256];
+ int f;
+
+#pragma omp target teams distribute parallel for map(tofrom: a)
+for (int i =0; i <256; i++)
+{
+ a[i] =i;
+}
+
+#pragma omp target teams distribute map(tofrom: b)
+for(int i = 0; i <256; i++)
+{
+ b[i]= i;
+}
+
+#pragma omp target parallel map(tofrom: c)
+{
+ c = 2;
+}
+#pragma omp target teams map(tofrom: d)
+{
+ d = 3;
+}
+
+#pragma omp target parallel for map(tofrom: e)
+for (int i =0; i <256; i++)
+{
+ e[i] =i;
+}
+
+#pragma omp target map(tofrom: f)
+{
+ f = 4;
+}
+if (f != 4) return 1;
+return 0;
+}
+
+
diff --git a/test/smoke-limbo/clang-nested-parallel-for/Makefile b/test/smoke-limbo/clang-nested-parallel-for/Makefile
new file mode 100644
index 0000000000..11a72580d0
--- /dev/null
+++ b/test/smoke-limbo/clang-nested-parallel-for/Makefile
@@ -0,0 +1,15 @@
+include ../../Makefile.defs
+
+TESTNAME = clang-nested-parallel-for
+TESTSRC_MAIN = clang-nested-parallel-for.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+CLANG ?= clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+OMP_FLAGS += -O0
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-limbo/clang-nested-parallel-for/clang-nested-parallel-for.c b/test/smoke-limbo/clang-nested-parallel-for/clang-nested-parallel-for.c
new file mode 100644
index 0000000000..cd8d1867a4
--- /dev/null
+++ b/test/smoke-limbo/clang-nested-parallel-for/clang-nested-parallel-for.c
@@ -0,0 +1,20 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
+#include
+int main () {
+ int a[1024];
+ int i,j;
+
+#pragma omp target teams distribute parallel for map(tofrom:a)
+ for (i =0; i <16; i++)
+#pragma omp parallel for
+ for (j=0; j< 64; j++)
+ a[i*64 + j] = (i*64 + j);
+
+ for (i=0; i<1024;i++)
+ if (a[i] != i)
+ return 1;
+ return 0;
+}
diff --git a/test/smoke-dev/fast_fp_atomics_mi200_enable_corase_grain_usm_map/Makefile b/test/smoke-limbo/fast_fp_atomics_mi200_enable_corase_grain_usm_map/Makefile
similarity index 100%
rename from test/smoke-dev/fast_fp_atomics_mi200_enable_corase_grain_usm_map/Makefile
rename to test/smoke-limbo/fast_fp_atomics_mi200_enable_corase_grain_usm_map/Makefile
diff --git a/test/smoke-dev/fast_fp_atomics_mi200_enable_corase_grain_usm_map/fast_fp_atomics_mi200_enable_coarse_grain_usm_map.cpp b/test/smoke-limbo/fast_fp_atomics_mi200_enable_corase_grain_usm_map/fast_fp_atomics_mi200_enable_coarse_grain_usm_map.cpp
similarity index 91%
rename from test/smoke-dev/fast_fp_atomics_mi200_enable_corase_grain_usm_map/fast_fp_atomics_mi200_enable_coarse_grain_usm_map.cpp
rename to test/smoke-limbo/fast_fp_atomics_mi200_enable_corase_grain_usm_map/fast_fp_atomics_mi200_enable_coarse_grain_usm_map.cpp
index e9f71c02bf..6d3e8e6bcb 100644
--- a/test/smoke-dev/fast_fp_atomics_mi200_enable_corase_grain_usm_map/fast_fp_atomics_mi200_enable_coarse_grain_usm_map.cpp
+++ b/test/smoke-limbo/fast_fp_atomics_mi200_enable_corase_grain_usm_map/fast_fp_atomics_mi200_enable_coarse_grain_usm_map.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-dev/flang-280342/Makefile b/test/smoke-limbo/flang-280342/Makefile
similarity index 100%
rename from test/smoke-dev/flang-280342/Makefile
rename to test/smoke-limbo/flang-280342/Makefile
diff --git a/test/smoke-dev/flang-280342/flang-280342.f90 b/test/smoke-limbo/flang-280342/flang-280342.f90
similarity index 100%
rename from test/smoke-dev/flang-280342/flang-280342.f90
rename to test/smoke-limbo/flang-280342/flang-280342.f90
diff --git a/test/smoke-dev/flang-TL-0/Makefile b/test/smoke-limbo/flang-TL-0/Makefile
similarity index 100%
rename from test/smoke-dev/flang-TL-0/Makefile
rename to test/smoke-limbo/flang-TL-0/Makefile
diff --git a/test/smoke-dev/flang-TL-0/loopTest.f90 b/test/smoke-limbo/flang-TL-0/loopTest.f90
similarity index 100%
rename from test/smoke-dev/flang-TL-0/loopTest.f90
rename to test/smoke-limbo/flang-TL-0/loopTest.f90
diff --git a/test/smoke-dev/flang-TL-1/Makefile b/test/smoke-limbo/flang-TL-1/Makefile
similarity index 100%
rename from test/smoke-dev/flang-TL-1/Makefile
rename to test/smoke-limbo/flang-TL-1/Makefile
diff --git a/test/smoke-dev/flang-TL-1/loopTest.f90 b/test/smoke-limbo/flang-TL-1/loopTest.f90
similarity index 100%
rename from test/smoke-dev/flang-TL-1/loopTest.f90
rename to test/smoke-limbo/flang-TL-1/loopTest.f90
diff --git a/test/smoke-dev/flang-TP-0/Makefile b/test/smoke-limbo/flang-TP-0/Makefile
similarity index 100%
rename from test/smoke-dev/flang-TP-0/Makefile
rename to test/smoke-limbo/flang-TP-0/Makefile
diff --git a/test/smoke-dev/flang-TP-0/loopTest.f90 b/test/smoke-limbo/flang-TP-0/loopTest.f90
similarity index 100%
rename from test/smoke-dev/flang-TP-0/loopTest.f90
rename to test/smoke-limbo/flang-TP-0/loopTest.f90
diff --git a/test/smoke-dev/flang-TP-1/Makefile b/test/smoke-limbo/flang-TP-1/Makefile
similarity index 100%
rename from test/smoke-dev/flang-TP-1/Makefile
rename to test/smoke-limbo/flang-TP-1/Makefile
diff --git a/test/smoke-dev/flang-TP-1/loopTest.f90 b/test/smoke-limbo/flang-TP-1/loopTest.f90
similarity index 100%
rename from test/smoke-dev/flang-TP-1/loopTest.f90
rename to test/smoke-limbo/flang-TP-1/loopTest.f90
diff --git a/test/smoke-dev/flang-f90print/Makefile b/test/smoke-limbo/flang-f90print/Makefile
similarity index 100%
rename from test/smoke-dev/flang-f90print/Makefile
rename to test/smoke-limbo/flang-f90print/Makefile
diff --git a/test/smoke-dev/flang-f90print/flang-f90print.f90 b/test/smoke-limbo/flang-f90print/flang-f90print.f90
similarity index 100%
rename from test/smoke-dev/flang-f90print/flang-f90print.f90
rename to test/smoke-limbo/flang-f90print/flang-f90print.f90
diff --git a/test/smoke-dev/flang-loop0/Makefile b/test/smoke-limbo/flang-loop0/Makefile
similarity index 100%
rename from test/smoke-dev/flang-loop0/Makefile
rename to test/smoke-limbo/flang-loop0/Makefile
diff --git a/test/smoke-dev/flang-loop0/vmuln.f90 b/test/smoke-limbo/flang-loop0/vmuln.f90
similarity index 100%
rename from test/smoke-dev/flang-loop0/vmuln.f90
rename to test/smoke-limbo/flang-loop0/vmuln.f90
diff --git a/test/smoke-dev/flang_deviceio/Makefile b/test/smoke-limbo/flang_deviceio/Makefile
similarity index 100%
rename from test/smoke-dev/flang_deviceio/Makefile
rename to test/smoke-limbo/flang_deviceio/Makefile
diff --git a/test/smoke-dev/flang_deviceio/f90deviceio.example.f90 b/test/smoke-limbo/flang_deviceio/f90deviceio.example.f90
similarity index 100%
rename from test/smoke-dev/flang_deviceio/f90deviceio.example.f90
rename to test/smoke-limbo/flang_deviceio/f90deviceio.example.f90
diff --git a/test/smoke-dev/flang_deviceio/flang_deviceio.f90 b/test/smoke-limbo/flang_deviceio/flang_deviceio.f90
similarity index 100%
rename from test/smoke-dev/flang_deviceio/flang_deviceio.f90
rename to test/smoke-limbo/flang_deviceio/flang_deviceio.f90
diff --git a/test/smoke/flang_real16_prob/Makefile b/test/smoke-limbo/flang_real16_prob/Makefile
similarity index 100%
rename from test/smoke/flang_real16_prob/Makefile
rename to test/smoke-limbo/flang_real16_prob/Makefile
diff --git a/test/smoke/flang_real16_prob/flang_real16_prob.f90 b/test/smoke-limbo/flang_real16_prob/flang_real16_prob.f90
similarity index 100%
rename from test/smoke/flang_real16_prob/flang_real16_prob.f90
rename to test/smoke-limbo/flang_real16_prob/flang_real16_prob.f90
diff --git a/test/smoke-dev/hipreg_usm/Makefile b/test/smoke-limbo/hipreg_usm/Makefile
similarity index 100%
rename from test/smoke-dev/hipreg_usm/Makefile
rename to test/smoke-limbo/hipreg_usm/Makefile
diff --git a/test/smoke-dev/hipreg_usm/hip_hostreg.h b/test/smoke-limbo/hipreg_usm/hip_hostreg.h
similarity index 100%
rename from test/smoke-dev/hipreg_usm/hip_hostreg.h
rename to test/smoke-limbo/hipreg_usm/hip_hostreg.h
diff --git a/test/smoke-dev/hipreg_usm/hip_hostreg.hip b/test/smoke-limbo/hipreg_usm/hip_hostreg.hip
similarity index 100%
rename from test/smoke-dev/hipreg_usm/hip_hostreg.hip
rename to test/smoke-limbo/hipreg_usm/hip_hostreg.hip
diff --git a/test/smoke-dev/hipreg_usm/omp.cpp b/test/smoke-limbo/hipreg_usm/omp.cpp
similarity index 100%
rename from test/smoke-dev/hipreg_usm/omp.cpp
rename to test/smoke-limbo/hipreg_usm/omp.cpp
diff --git a/test/smoke-dev/launch_latency/Makefile b/test/smoke-limbo/launch_latency/Makefile
similarity index 72%
rename from test/smoke-dev/launch_latency/Makefile
rename to test/smoke-limbo/launch_latency/Makefile
index 43bd6a33a0..0fe4ada40f 100644
--- a/test/smoke-dev/launch_latency/Makefile
+++ b/test/smoke-limbo/launch_latency/Makefile
@@ -9,9 +9,7 @@ CLANG ?= clang
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
RUNENV = ulimit -s unlimited;
-RUNPROF = $(AOMPHIP)/bin/rocprof
-RUNPROF_FLAGS = --stats
-POSTRUN = python3 printLatency.py
+RUNCMD = $(AOMPHIP)/bin/rocprofv3 --output-format csv --kernel-trace --stats -- ./$(TESTNAME) && python3 printLatency.py
#-ccc-print-phases
#"-\#\#\#"
diff --git a/test/smoke-dev/launch_latency/launch_latency.c b/test/smoke-limbo/launch_latency/launch_latency.c
similarity index 100%
rename from test/smoke-dev/launch_latency/launch_latency.c
rename to test/smoke-limbo/launch_latency/launch_latency.c
diff --git a/test/smoke-limbo/launch_latency/printLatency.py b/test/smoke-limbo/launch_latency/printLatency.py
new file mode 100644
index 0000000000..c865f2a975
--- /dev/null
+++ b/test/smoke-limbo/launch_latency/printLatency.py
@@ -0,0 +1,126 @@
+#!/usr/bin/env python3
+#
+# LLM: AMD Nabu (GPT-4, 2024-06-12)
+# Date: 2024-06-12
+#
+# Query:
+# Write a Python program specified by the following. If an error, return a negative error code.
+#
+# In a comment in the program, specify the LLM/version and the current date.
+#
+# Include this query into the program as documentation. In a comment in the program, specify the LLM/version and the current date
+#
+# In the directory where this program was executed, there is a directory with the current machine's name.
+# In that directory, there is a file called: "*_kernel_trace.csv", for example: "759776_kernel_trace.csv". Read that file.
+# This CSV file has the following format (for example):
+#
+# "Kind","Agent_Id","Queue_Id","Stream_Id","Thread_Id","Dispatch_Id","Kernel_Id","Kernel_Name","Correlation_Id","Start_Timestamp","End_Timestamp","LDS_Block_Size","Scratch_Size","VGPR_Count","Accum_VGPR_Count","SGPR_Count","Workgroup_Size_X","Workgroup_Size_Y","Workgroup_Size_Z","Grid_Size_X","Grid_Size_Y","Grid_Size_Z"
+# "KERNEL_DISPATCH","Agent 1",1,0,759776,1,1,"__omp_offloading_10302_2d86c1c_main_l19",1,1147738380281408,1147738380284052,0,0,4,4,16,256,1,1,256,1,1
+# ...
+#
+# The calculation for TEAMS is (Grid_Size_X * Grid_Size_Y*Grid_Size_Z) / (Workgroup_Size_X*Workgroup_Size_Y*Workgroup_Size_Z).
+#
+# For each TEAMS, sum their execution times. Each execution time is End_Timestamp - Start_Timestamp. These units are nano-seconds.
+#
+# Print out the information collected in the following format. Note the units are now in seconds. What follows is an example:
+#
+# 1st kernel Time 0.000003680 seconds
+# avg kernel Time 0.000002235 seconds TEAMS= 1
+# avg kernel Time 0.000002284 seconds TEAMS= 2
+# avg kernel Time 0.000002293 seconds TEAMS= 4
+# ...
+# avg kernel Time 0.000003024 seconds TEAMS= 512
+# avg kernel Time 0.000003670 seconds TEAMS= 1024
+# avg kernel Time 0.000005049 seconds TEAMS= 2048
+#
+# Delete the directory with the current machine's name.
+
+import os
+import sys
+import platform
+import glob
+import csv
+import shutil
+from collections import defaultdict
+
+def main():
+ try:
+ machine_name = platform.node()
+ if not machine_name:
+ print("Error: Could not determine machine name.", file=sys.stderr)
+ return -2
+
+ machine_dir = os.path.join(os.getcwd(), machine_name)
+ if not os.path.isdir(machine_dir):
+ print(f"Error: Directory '{machine_dir}' does not exist.", file=sys.stderr)
+ return -3
+
+ csv_pattern = os.path.join(machine_dir, "*_kernel_trace.csv")
+ csv_files = glob.glob(csv_pattern)
+ if not csv_files:
+ print(f"Error: No *_kernel_trace.csv found in {machine_dir}", file=sys.stderr)
+ return -4
+
+ csv_file = csv_files[0]
+
+ kernel_records = []
+ with open(csv_file, newline='') as f:
+ reader = csv.DictReader(f)
+ for row in reader:
+ try:
+ kind = row["Kind"]
+ if kind != "KERNEL_DISPATCH":
+ continue
+ wsx = int(row["Workgroup_Size_X"])
+ wsy = int(row["Workgroup_Size_Y"])
+ wsz = int(row["Workgroup_Size_Z"])
+ gsx = int(row["Grid_Size_X"])
+ gsy = int(row["Grid_Size_Y"])
+ gsz = int(row["Grid_Size_Z"])
+ start = int(row["Start_Timestamp"])
+ end = int(row["End_Timestamp"])
+ except Exception as e:
+ print(f"Error: Malformed row ({e})", file=sys.stderr)
+ return -5
+
+ if wsx == 0 or wsy == 0 or wsz == 0:
+ print(f"Error: Workgroup size is zero in row", file=sys.stderr)
+ return -6
+
+ teams = (gsx * gsy * gsz) // (wsx * wsy * wsz)
+ exec_time_ns = end - start
+ kernel_records.append((exec_time_ns, teams))
+
+ if not kernel_records:
+ print("Error: No valid kernel records found.", file=sys.stderr)
+ return -7
+
+ # Print first kernel time in seconds
+ first_kernel_time_sec = kernel_records[0][0] / 1e9
+ print(f"1st kernel Time {first_kernel_time_sec:.9f} seconds")
+
+ # Aggregate by TEAMS and average
+ teams_data = defaultdict(list)
+ for exec_time_ns, teams in kernel_records:
+ teams_data[teams].append(exec_time_ns)
+
+ for teams in sorted(teams_data):
+ times = teams_data[teams]
+ avg_ns = sum(times) / len(times)
+ print(f"avg kernel Time {avg_ns/1e9:.9f} seconds TEAMS= {teams}")
+
+ # Remove the machine directory
+ try:
+ shutil.rmtree(machine_dir)
+ except Exception as e:
+ print(f"Error: Failed to delete directory {machine_dir}: {e}", file=sys.stderr)
+ return -8
+
+ return 0
+
+ except Exception as e:
+ print(f"Unhandled exception: {e}", file=sys.stderr)
+ return -9
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/test/smoke-dev/lib-debug/Makefile b/test/smoke-limbo/lib-debug/Makefile
similarity index 100%
rename from test/smoke-dev/lib-debug/Makefile
rename to test/smoke-limbo/lib-debug/Makefile
diff --git a/test/smoke-dev/lib-debug/lib-debug.c b/test/smoke-limbo/lib-debug/lib-debug.c
similarity index 84%
rename from test/smoke-dev/lib-debug/lib-debug.c
rename to test/smoke-limbo/lib-debug/lib-debug.c
index ce79c906ff..4bbcc06c11 100644
--- a/test/smoke-dev/lib-debug/lib-debug.c
+++ b/test/smoke-limbo/lib-debug/lib-debug.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#define N 10
diff --git a/test/smoke-limbo/link-missing-file/Makefile b/test/smoke-limbo/link-missing-file/Makefile
index 19d09a6589..d82ff2da99 100644
--- a/test/smoke-limbo/link-missing-file/Makefile
+++ b/test/smoke-limbo/link-missing-file/Makefile
@@ -12,6 +12,6 @@ TESTSRC_ALL = link-missing-file.c
# Since llvm-link would return a non-zero exit-code, use the dummy program to
# indicate 'success'.
RUNCMD = $(AOMP)/bin/llvm-link MissingFile.bc 2>&1 | \
- $(AOMP)/bin/FileCheck $(TESTSRC_ALL); ./$(TESTNAME)
+ $(FILECHECK) $(TESTSRC_ALL); ./$(TESTNAME)
include ../Makefile.rules
diff --git a/test/smoke-dev/mix_hipmemset_omp/Makefile b/test/smoke-limbo/mix_hipmemset_omp/Makefile
similarity index 100%
rename from test/smoke-dev/mix_hipmemset_omp/Makefile
rename to test/smoke-limbo/mix_hipmemset_omp/Makefile
diff --git a/test/smoke-dev/mix_hipmemset_omp/hip_memset.h b/test/smoke-limbo/mix_hipmemset_omp/hip_memset.h
similarity index 100%
rename from test/smoke-dev/mix_hipmemset_omp/hip_memset.h
rename to test/smoke-limbo/mix_hipmemset_omp/hip_memset.h
diff --git a/test/smoke-dev/mix_hipmemset_omp/hip_memset.hip b/test/smoke-limbo/mix_hipmemset_omp/hip_memset.hip
similarity index 100%
rename from test/smoke-dev/mix_hipmemset_omp/hip_memset.hip
rename to test/smoke-limbo/mix_hipmemset_omp/hip_memset.hip
diff --git a/test/smoke-dev/mix_hipmemset_omp/memset.cpp b/test/smoke-limbo/mix_hipmemset_omp/memset.cpp
similarity index 100%
rename from test/smoke-dev/mix_hipmemset_omp/memset.cpp
rename to test/smoke-limbo/mix_hipmemset_omp/memset.cpp
diff --git a/test/smoke-limbo/multi-sdma/Makefile b/test/smoke-limbo/multi-sdma/Makefile
index f6c7553b3a..dd67b69c0d 100644
--- a/test/smoke-limbo/multi-sdma/Makefile
+++ b/test/smoke-limbo/multi-sdma/Makefile
@@ -9,6 +9,8 @@ RUNENV = LIBOMPTARGET_AMDGPU_USE_MULTIPLE_SDMA_ENGINES=true
RUNENV += LIBOMPTARGET_DEBUG=1
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+UNSUPPORTED = gfx1151
+
CLANG ?= clang++
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
diff --git a/test/smoke-limbo/multi-sdma/multi-sdma.cpp b/test/smoke-limbo/multi-sdma/multi-sdma.cpp
index 245e693dad..78ad7ea2f2 100644
--- a/test/smoke-limbo/multi-sdma/multi-sdma.cpp
+++ b/test/smoke-limbo/multi-sdma/multi-sdma.cpp
@@ -34,5 +34,3 @@ int main(int argc, char **argv) {
// CHECK: TARGET AMDGPU RTL --> Running Async Copy on SDMA Engine: 2
// CHECK: TARGET AMDGPU RTL --> Running Async Copy on SDMA Engine: 1
// CHECK: TARGET AMDGPU RTL --> Running Async Copy on SDMA Engine: 2
-// CHECK: TARGET AMDGPU RTL --> Running Async Copy on SDMA Engine: 1
-// CHECK: TARGET AMDGPU RTL --> Running Async Copy on SDMA Engine: 2
diff --git a/test/smoke-limbo/no-loop-1/no_loop_1.c b/test/smoke-limbo/no-loop-1/no_loop_1.c
index 9a6d9e27ed..08732f019f 100644
--- a/test/smoke-limbo/no-loop-1/no_loop_1.c
+++ b/test/smoke-limbo/no-loop-1/no_loop_1.c
@@ -71,8 +71,8 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
diff --git a/test/smoke-limbo/no-loop-2/no_loop_2.c b/test/smoke-limbo/no-loop-2/no_loop_2.c
index 6eceae7d1d..3bc44836c1 100644
--- a/test/smoke-limbo/no-loop-2/no_loop_2.c
+++ b/test/smoke-limbo/no-loop-2/no_loop_2.c
@@ -71,8 +71,8 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
diff --git a/test/smoke-limbo/no-loop-3/no_loop_3.c b/test/smoke-limbo/no-loop-3/no_loop_3.c
index 9a6d9e27ed..08732f019f 100644
--- a/test/smoke-limbo/no-loop-3/no_loop_3.c
+++ b/test/smoke-limbo/no-loop-3/no_loop_3.c
@@ -71,8 +71,8 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
diff --git a/test/smoke-limbo/no-loop-4/no_loop_4.c b/test/smoke-limbo/no-loop-4/no_loop_4.c
index f538de6359..2b9cf6261f 100644
--- a/test/smoke-limbo/no-loop-4/no_loop_4.c
+++ b/test/smoke-limbo/no-loop-4/no_loop_4.c
@@ -71,8 +71,8 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
diff --git a/test/smoke-limbo/no-loop-5/no_loop_5.c b/test/smoke-limbo/no-loop-5/no_loop_5.c
index 7737ef9b52..f808a97aa6 100644
--- a/test/smoke-limbo/no-loop-5/no_loop_5.c
+++ b/test/smoke-limbo/no-loop-5/no_loop_5.c
@@ -71,8 +71,8 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:512 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
diff --git a/test/smoke-limbo/no-loop-6/no_loop_6.c b/test/smoke-limbo/no-loop-6/no_loop_6.c
index 8c90360c4e..f7625367e5 100644
--- a/test/smoke-limbo/no-loop-6/no_loop_6.c
+++ b/test/smoke-limbo/no-loop-6/no_loop_6.c
@@ -62,7 +62,7 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
diff --git a/test/smoke-limbo/no-loop-7/no_loop_7.c b/test/smoke-limbo/no-loop-7/no_loop_7.c
index f538de6359..2b9cf6261f 100644
--- a/test/smoke-limbo/no-loop-7/no_loop_7.c
+++ b/test/smoke-limbo/no-loop-7/no_loop_7.c
@@ -71,8 +71,8 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
diff --git a/test/smoke-limbo/no-loop-over-subscription/Makefile b/test/smoke-limbo/no-loop-over-subscription/Makefile
new file mode 100644
index 0000000000..6d285250d4
--- /dev/null
+++ b/test/smoke-limbo/no-loop-over-subscription/Makefile
@@ -0,0 +1,18 @@
+include ../../Makefile.defs
+
+TESTNAME = no_loop_over_subscription
+TESTSRC_MAIN = no_loop_over_subscription.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+CFLAGS += -fopenmp-assume-teams-oversubscription -fopenmp-assume-threads-oversubscription
+CLANG = clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-limbo/no-loop-over-subscription/no_loop_over_subscription.c b/test/smoke-limbo/no-loop-over-subscription/no_loop_over_subscription.c
new file mode 100644
index 0000000000..3c1e363a4f
--- /dev/null
+++ b/test/smoke-limbo/no-loop-over-subscription/no_loop_over_subscription.c
@@ -0,0 +1,43 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
+#include
+#include
+
+int main()
+{
+ int N = 100000;
+
+ int a[N];
+ int b[N];
+
+ int i;
+
+ for (i=0; i
#include
int main() {
- int N = 10;
+ int N = 1000000;
int a[N];
int b[N];
diff --git a/test/smoke-dev/occupancy-based-opt/Makefile b/test/smoke-limbo/occupancy-based-opt/Makefile
similarity index 100%
rename from test/smoke-dev/occupancy-based-opt/Makefile
rename to test/smoke-limbo/occupancy-based-opt/Makefile
diff --git a/test/smoke-dev/occupancy-based-opt/occupancy_based_opt.c b/test/smoke-limbo/occupancy-based-opt/occupancy_based_opt.c
similarity index 80%
rename from test/smoke-dev/occupancy-based-opt/occupancy_based_opt.c
rename to test/smoke-limbo/occupancy-based-opt/occupancy_based_opt.c
index 5c6ac7a54c..38d9741580 100644
--- a/test/smoke-dev/occupancy-based-opt/occupancy_based_opt.c
+++ b/test/smoke-limbo/occupancy-based-opt/occupancy_based_opt.c
@@ -1,9 +1,13 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
int main()
{
- int N = 10;
+ int N = 1000000;
int a[N];
int b[N];
diff --git a/test/smoke-dev/omp_lock/Makefile b/test/smoke-limbo/omp_lock/Makefile
similarity index 100%
rename from test/smoke-dev/omp_lock/Makefile
rename to test/smoke-limbo/omp_lock/Makefile
diff --git a/test/smoke-dev/omp_lock/NRUN b/test/smoke-limbo/omp_lock/NRUN
similarity index 100%
rename from test/smoke-dev/omp_lock/NRUN
rename to test/smoke-limbo/omp_lock/NRUN
diff --git a/test/smoke-dev/omp_lock/omp_lock.c b/test/smoke-limbo/omp_lock/omp_lock.c
similarity index 100%
rename from test/smoke-dev/omp_lock/omp_lock.c
rename to test/smoke-limbo/omp_lock/omp_lock.c
diff --git a/test/smoke-limbo/ompx-bare/Makefile b/test/smoke-limbo/ompx-bare/Makefile
new file mode 100644
index 0000000000..3158a2a88b
--- /dev/null
+++ b/test/smoke-limbo/ompx-bare/Makefile
@@ -0,0 +1,17 @@
+include ../../Makefile.defs
+
+TESTNAME = ompx_bare
+TESTSRC_MAIN = ompx_bare.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+CLANG ?= clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-limbo/ompx-bare/ompx_bare.c b/test/smoke-limbo/ompx-bare/ompx_bare.c
new file mode 100644
index 0000000000..8beb60dc92
--- /dev/null
+++ b/test/smoke-limbo/ompx-bare/ompx_bare.c
@@ -0,0 +1,35 @@
+// Check that the bare kernel has SGN 0, 64 teams, and 64 threads.
+// Based on existing test offload/test/offloading/ompx_bare.c.
+//
+#include
+#include
+#include
+#include
+
+int main(int argc, char *argv[]) {
+ const int num_blocks = 64;
+ const int block_size = 64;
+ const int N = num_blocks * block_size;
+ int *data = (int *)malloc(N * sizeof(int));
+
+#pragma omp target teams ompx_bare num_teams(num_blocks) thread_limit(block_size) map(from: data[0:N])
+ {
+ int bid = ompx_block_id_x();
+ int bdim = ompx_block_dim_x();
+ int tid = ompx_thread_id_x();
+ int idx = bid * bdim + tid;
+ data[idx] = idx;
+ }
+
+ for (int i = 0; i < N; ++i)
+ assert(data[i] == i);
+
+ printf("PASS\n");
+
+ return 0;
+}
+
+// CHECK: SGN:0
+// CHECK: teamsXthrds:( 64X 64)
+// CHECK: PASS
+
diff --git a/test/smoke-limbo/opt-kernel-global-iv/opt_kernel_global_iv.c b/test/smoke-limbo/opt-kernel-global-iv/opt_kernel_global_iv.c
index 9dcf6d45e9..3b8aece312 100644
--- a/test/smoke-limbo/opt-kernel-global-iv/opt_kernel_global_iv.c
+++ b/test/smoke-limbo/opt-kernel-global-iv/opt_kernel_global_iv.c
@@ -49,6 +49,6 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
diff --git a/test/smoke-limbo/opt-kernel-inner-pragma-1/opt_kernel_inner_pragma_1.c b/test/smoke-limbo/opt-kernel-inner-pragma-1/opt_kernel_inner_pragma_1.c
index ad88035811..9b709a43e4 100644
--- a/test/smoke-limbo/opt-kernel-inner-pragma-1/opt_kernel_inner_pragma_1.c
+++ b/test/smoke-limbo/opt-kernel-inner-pragma-1/opt_kernel_inner_pragma_1.c
@@ -53,5 +53,5 @@ int main(){
}
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
diff --git a/test/smoke-limbo/opt_kerns_clauses/opt_kerns_clauses.c b/test/smoke-limbo/opt_kerns_clauses/opt_kerns_clauses.c
index 0c9fe7ce67..0c5e5537d3 100644
--- a/test/smoke-limbo/opt_kerns_clauses/opt_kerns_clauses.c
+++ b/test/smoke-limbo/opt_kerns_clauses/opt_kerns_clauses.c
@@ -43,6 +43,6 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
diff --git a/test/smoke-dev/red_bug_51/Makefile b/test/smoke-limbo/red_bug_51/Makefile
similarity index 100%
rename from test/smoke-dev/red_bug_51/Makefile
rename to test/smoke-limbo/red_bug_51/Makefile
diff --git a/test/smoke-dev/red_bug_51/red_bug_51.cpp b/test/smoke-limbo/red_bug_51/red_bug_51.cpp
similarity index 90%
rename from test/smoke-dev/red_bug_51/red_bug_51.cpp
rename to test/smoke-limbo/red_bug_51/red_bug_51.cpp
index 2d841d7afe..6ae5a73464 100644
--- a/test/smoke-dev/red_bug_51/red_bug_51.cpp
+++ b/test/smoke-limbo/red_bug_51/red_bug_51.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-dev/reduction_team/Makefile b/test/smoke-limbo/reduction_team/Makefile
similarity index 100%
rename from test/smoke-dev/reduction_team/Makefile
rename to test/smoke-limbo/reduction_team/Makefile
diff --git a/test/smoke-dev/reduction_team/reduction_team.c b/test/smoke-limbo/reduction_team/reduction_team.c
similarity index 96%
rename from test/smoke-dev/reduction_team/reduction_team.c
rename to test/smoke-limbo/reduction_team/reduction_team.c
index cad63f94db..f1ba9e3fdf 100644
--- a/test/smoke-dev/reduction_team/reduction_team.c
+++ b/test/smoke-limbo/reduction_team/reduction_team.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-dev/reduction_teams/Makefile b/test/smoke-limbo/reduction_teams/Makefile
similarity index 100%
rename from test/smoke-dev/reduction_teams/Makefile
rename to test/smoke-limbo/reduction_teams/Makefile
diff --git a/test/smoke-dev/reduction_teams/NRUN b/test/smoke-limbo/reduction_teams/NRUN
similarity index 100%
rename from test/smoke-dev/reduction_teams/NRUN
rename to test/smoke-limbo/reduction_teams/NRUN
diff --git a/test/smoke-dev/reduction_teams/reduction_teams.c b/test/smoke-limbo/reduction_teams/reduction_teams.c
similarity index 96%
rename from test/smoke-dev/reduction_teams/reduction_teams.c
rename to test/smoke-limbo/reduction_teams/reduction_teams.c
index be84403a92..c51aa12bc9 100644
--- a/test/smoke-dev/reduction_teams/reduction_teams.c
+++ b/test/smoke-limbo/reduction_teams/reduction_teams.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-limbo/rt-memory-threshold-env/AMDGPUMemoryManager_threshold_env.c b/test/smoke-limbo/rt-memory-threshold-env/AMDGPUMemoryManager_threshold_env.c
new file mode 100644
index 0000000000..076ee40830
--- /dev/null
+++ b/test/smoke-limbo/rt-memory-threshold-env/AMDGPUMemoryManager_threshold_env.c
@@ -0,0 +1,37 @@
+#include
+#include
+
+int main() {
+ int N = 10;
+
+ int a[N];
+ int b[N];
+
+ int i;
+
+ for (i = 0; i < N; i++)
+ a[i] = 0;
+
+ for (i = 0; i < N; i++)
+ b[i] = i;
+
+#pragma omp target parallel for
+ {
+ for (int j = 0; j < N; j++)
+ a[j] = b[j];
+ }
+
+ int rc = 0;
+ for (i = 0; i < N; i++)
+ if (a[i] != b[i]) {
+ rc++;
+ printf("Wrong varlue: a[%d]=%d\n", i, a[i]);
+ }
+
+ if (!rc)
+ printf("Success\n");
+
+ return rc;
+}
+
+/// CHECK: TARGET AMDGPU RTL --> AMDGPUMemoryManager threshhold was set to: 1048576 B
diff --git a/test/smoke-limbo/rt-memory-threshold-env/Makefile b/test/smoke-limbo/rt-memory-threshold-env/Makefile
new file mode 100644
index 0000000000..e17ae95409
--- /dev/null
+++ b/test/smoke-limbo/rt-memory-threshold-env/Makefile
@@ -0,0 +1,18 @@
+include ../../Makefile.defs
+
+TESTNAME = AMDGPUMemoryManager_threshold_env
+TESTSRC_MAIN = AMDGPUMemoryManager_threshold_env.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+RUNENV += LIBOMPTARGET_DEBUG=1
+# This runtime flag sets the memory manager threshold to 2^20 = 1048576 B.
+RUNENV += OMPX_AMD_MEMORY_MANAGER_THRESHOLD_EXP_2=20
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+CLANG ?= clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-dev/rt-tuning-envar/Makefile b/test/smoke-limbo/rt-tuning-envar/Makefile
similarity index 87%
rename from test/smoke-dev/rt-tuning-envar/Makefile
rename to test/smoke-limbo/rt-tuning-envar/Makefile
index 04abcfd27a..96d469f24b 100644
--- a/test/smoke-dev/rt-tuning-envar/Makefile
+++ b/test/smoke-limbo/rt-tuning-envar/Makefile
@@ -5,7 +5,7 @@ TESTSRC_MAIN = rt_tuning_envar.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
RUNENV += OMPX_ENABLE_RUNTIME_AUTOTUNING=1
-RUNENV += LIBOMPTARGET_AMDGPU_ENABLE_QUEUE_PROFILING=1
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
diff --git a/test/smoke-dev/rt-tuning-envar/rt_tuning_envar.c b/test/smoke-limbo/rt-tuning-envar/rt_tuning_envar.c
similarity index 59%
rename from test/smoke-dev/rt-tuning-envar/rt_tuning_envar.c
rename to test/smoke-limbo/rt-tuning-envar/rt_tuning_envar.c
index fd60a94f10..d71fd3fbe6 100644
--- a/test/smoke-dev/rt-tuning-envar/rt_tuning_envar.c
+++ b/test/smoke-limbo/rt-tuning-envar/rt_tuning_envar.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
@@ -26,7 +30,7 @@ int main()
for (i=0; i
#define N 10
diff --git a/test/smoke-dev/swdev-461650/Makefile b/test/smoke-limbo/swdev-461650/Makefile
similarity index 100%
rename from test/smoke-dev/swdev-461650/Makefile
rename to test/smoke-limbo/swdev-461650/Makefile
diff --git a/test/smoke-dev/swdev-461650/swdev_461650.c b/test/smoke-limbo/swdev-461650/swdev_461650.c
similarity index 89%
rename from test/smoke-dev/swdev-461650/swdev_461650.c
rename to test/smoke-limbo/swdev-461650/swdev_461650.c
index 29444417b4..aca077d397 100644
--- a/test/smoke-dev/swdev-461650/swdev_461650.c
+++ b/test/smoke-limbo/swdev-461650/swdev_461650.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
@@ -40,4 +44,4 @@ int main() {
}
-/// CHECK: SGN:4
+/// CHECK: SGN:6
diff --git a/test/smoke-dev/test-offload-profile-envar/Makefile b/test/smoke-limbo/test-offload-profile-envar/Makefile
similarity index 100%
rename from test/smoke-dev/test-offload-profile-envar/Makefile
rename to test/smoke-limbo/test-offload-profile-envar/Makefile
diff --git a/test/smoke-dev/test-offload-profile-envar/veccopy.c b/test/smoke-limbo/test-offload-profile-envar/veccopy.c
similarity index 81%
rename from test/smoke-dev/test-offload-profile-envar/veccopy.c
rename to test/smoke-limbo/test-offload-profile-envar/veccopy.c
index be6acf0b1c..b74fb84b0d 100644
--- a/test/smoke-dev/test-offload-profile-envar/veccopy.c
+++ b/test/smoke-limbo/test-offload-profile-envar/veccopy.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-dev/usm-locals-pragma-xnack-disabled-xnack-any/Makefile b/test/smoke-limbo/usm-locals-pragma-xnack-disabled-xnack-any/Makefile
similarity index 100%
rename from test/smoke-dev/usm-locals-pragma-xnack-disabled-xnack-any/Makefile
rename to test/smoke-limbo/usm-locals-pragma-xnack-disabled-xnack-any/Makefile
diff --git a/test/smoke-dev/usm-locals-pragma-xnack-disabled-xnack-any/usm_locals.cpp b/test/smoke-limbo/usm-locals-pragma-xnack-disabled-xnack-any/usm_locals.cpp
similarity index 100%
rename from test/smoke-dev/usm-locals-pragma-xnack-disabled-xnack-any/usm_locals.cpp
rename to test/smoke-limbo/usm-locals-pragma-xnack-disabled-xnack-any/usm_locals.cpp
diff --git a/test/smoke-dev/usm-locals-pragma-xnack-disabled-xnack-minus/Makefile b/test/smoke-limbo/usm-locals-pragma-xnack-disabled-xnack-minus/Makefile
similarity index 100%
rename from test/smoke-dev/usm-locals-pragma-xnack-disabled-xnack-minus/Makefile
rename to test/smoke-limbo/usm-locals-pragma-xnack-disabled-xnack-minus/Makefile
diff --git a/test/smoke-dev/usm-locals-pragma-xnack-disabled-xnack-minus/usm_locals.cpp b/test/smoke-limbo/usm-locals-pragma-xnack-disabled-xnack-minus/usm_locals.cpp
similarity index 100%
rename from test/smoke-dev/usm-locals-pragma-xnack-disabled-xnack-minus/usm_locals.cpp
rename to test/smoke-limbo/usm-locals-pragma-xnack-disabled-xnack-minus/usm_locals.cpp
diff --git a/test/smoke-limbo/usm-locals-xnack-enabled-xnack-minus/Makefile b/test/smoke-limbo/usm-locals-xnack-enabled-xnack-minus/Makefile
index 16ffc4b251..720dcbeede 100644
--- a/test/smoke-limbo/usm-locals-xnack-enabled-xnack-minus/Makefile
+++ b/test/smoke-limbo/usm-locals-xnack-enabled-xnack-minus/Makefile
@@ -14,7 +14,7 @@ CLANG = clang++
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
-SUPPORTED = gfx90a,gfx940,gfx941,gfx942
+SUPPORTED = $(SUPPORTS_USM)
#-ccc-print-phases
#"-\#\#\#"
diff --git a/test/smoke-dev/veccopy-ompt-selective-tracing-dataop/Makefile b/test/smoke-limbo/veccopy-ompt-selective-tracing-dataop/Makefile
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-selective-tracing-dataop/Makefile
rename to test/smoke-limbo/veccopy-ompt-selective-tracing-dataop/Makefile
diff --git a/test/smoke-dev/veccopy-ompt-selective-tracing-dataop/callbacks.h b/test/smoke-limbo/veccopy-ompt-selective-tracing-dataop/callbacks.h
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-selective-tracing-dataop/callbacks.h
rename to test/smoke-limbo/veccopy-ompt-selective-tracing-dataop/callbacks.h
diff --git a/test/smoke-dev/veccopy-ompt-selective-tracing-dataop/veccopy_ompt_selective_tracing_dataop.cpp b/test/smoke-limbo/veccopy-ompt-selective-tracing-dataop/veccopy_ompt_selective_tracing_dataop.cpp
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-selective-tracing-dataop/veccopy_ompt_selective_tracing_dataop.cpp
rename to test/smoke-limbo/veccopy-ompt-selective-tracing-dataop/veccopy_ompt_selective_tracing_dataop.cpp
diff --git a/test/smoke-dev/veccopy-ompt-selective-tracing-kernel/Makefile b/test/smoke-limbo/veccopy-ompt-selective-tracing-kernel/Makefile
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-selective-tracing-kernel/Makefile
rename to test/smoke-limbo/veccopy-ompt-selective-tracing-kernel/Makefile
diff --git a/test/smoke-dev/veccopy-ompt-selective-tracing-kernel/callbacks.h b/test/smoke-limbo/veccopy-ompt-selective-tracing-kernel/callbacks.h
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-selective-tracing-kernel/callbacks.h
rename to test/smoke-limbo/veccopy-ompt-selective-tracing-kernel/callbacks.h
diff --git a/test/smoke-dev/veccopy-ompt-selective-tracing-kernel/veccopy_ompt_selective_tracing_kernel.cpp b/test/smoke-limbo/veccopy-ompt-selective-tracing-kernel/veccopy_ompt_selective_tracing_kernel.cpp
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-selective-tracing-kernel/veccopy_ompt_selective_tracing_kernel.cpp
rename to test/smoke-limbo/veccopy-ompt-selective-tracing-kernel/veccopy_ompt_selective_tracing_kernel.cpp
diff --git a/test/smoke-dev/veccopy-ompt-target-emi-tracing-dag/Makefile b/test/smoke-limbo/veccopy-ompt-target-emi-tracing-dag/Makefile
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-target-emi-tracing-dag/Makefile
rename to test/smoke-limbo/veccopy-ompt-target-emi-tracing-dag/Makefile
diff --git a/test/smoke-dev/veccopy-ompt-target-emi-tracing-dag/callbacks.h b/test/smoke-limbo/veccopy-ompt-target-emi-tracing-dag/callbacks.h
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-target-emi-tracing-dag/callbacks.h
rename to test/smoke-limbo/veccopy-ompt-target-emi-tracing-dag/callbacks.h
diff --git a/test/smoke-dev/veccopy-ompt-target-emi-tracing-dag/veccopy-ompt-target-emi-tracing-dag.cpp b/test/smoke-limbo/veccopy-ompt-target-emi-tracing-dag/veccopy-ompt-target-emi-tracing-dag.cpp
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-target-emi-tracing-dag/veccopy-ompt-target-emi-tracing-dag.cpp
rename to test/smoke-limbo/veccopy-ompt-target-emi-tracing-dag/veccopy-ompt-target-emi-tracing-dag.cpp
diff --git a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-api-use/Makefile b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-api-use/Makefile
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-api-use/Makefile
rename to test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-api-use/Makefile
diff --git a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-api-use/callbacks.h b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-api-use/callbacks.h
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-api-use/callbacks.h
rename to test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-api-use/callbacks.h
diff --git a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-api-use/veccopy-ompt-target-emi-tracing.cpp b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-api-use/veccopy-ompt-target-emi-tracing.cpp
similarity index 89%
rename from test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-api-use/veccopy-ompt-target-emi-tracing.cpp
rename to test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-api-use/veccopy-ompt-target-emi-tracing.cpp
index 37dc91e2a2..4827b27eb7 100644
--- a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-api-use/veccopy-ompt-target-emi-tracing.cpp
+++ b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-api-use/veccopy-ompt-target-emi-tracing.cpp
@@ -3,7 +3,7 @@
* LIBOMPTARGET_OMPT_FLUSH_ON_BUFFER_FULL=false while doing explicit flushing
* using ompt_flush_trace. The intention is to check whether trace records are
* properly flushed when the program/tool uses the ompt_flush_trace API. There
- * should be 22 trace records returned to the tool.
+ * should be 23 trace records returned to the tool.
*/
#include
#include
@@ -85,9 +85,14 @@ int main() {
/// CHECK-DAG: rec=
/// CHECK-DAG: rec=
/// CHECK-DAG: rec=
+/// CHECK-DAG: rec=
+/// CHECK-DAG: rec=
/// CHECK-NOT: rec=
/// CHECK-DAG: Success
+/// The user calls flush before printing success, so
+/// no more records should be returned here.
+
/// CHECK-NOT: rec=
/// CHECK-NOT: host_op_id=0x0
diff --git a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-buffer-full/Makefile b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-buffer-full/Makefile
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-buffer-full/Makefile
rename to test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-buffer-full/Makefile
diff --git a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-buffer-full/callbacks.h b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-buffer-full/callbacks.h
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-buffer-full/callbacks.h
rename to test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-buffer-full/callbacks.h
diff --git a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-buffer-full/veccopy-ompt-target-emi-tracing.cpp b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-buffer-full/veccopy-ompt-target-emi-tracing.cpp
similarity index 86%
rename from test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-buffer-full/veccopy-ompt-target-emi-tracing.cpp
rename to test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-buffer-full/veccopy-ompt-target-emi-tracing.cpp
index a0c9c7420e..951fbf7f81 100644
--- a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-buffer-full/veccopy-ompt-target-emi-tracing.cpp
+++ b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-buffer-full/veccopy-ompt-target-emi-tracing.cpp
@@ -3,9 +3,8 @@
* ompt_flush_trace is not invoked by the user/tool. The intention is to check
* whether trace records are properly flushed as a buffer fills up. Currently,
* the buffer size in callbacks.h implies that every buffer holds 2 trace
- * records. With this assumption, there should be 20 trace records. The last 2
- * trace records are not flushed because the runtime does not know yet that the
- * last buffer is full.
+ * records. With this assumption, there should be 22 trace records. The last
+ * trace record is not flushed because the last buffer is not yet full.
*/
#include
#include
@@ -79,9 +78,7 @@ int main() {
/// CHECK-DAG: rec=
/// CHECK-DAG: rec=
/// CHECK-DAG: rec=
-/// CHECK-NOT: rec=
-
-/// CHECK-DAG: Success
-
+/// CHECK-DAG: rec=
+/// CHECK-DAG: rec=
/// CHECK-NOT: rec=
/// CHECK-NOT: host_op_id=0x0
diff --git a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-shutdown/Makefile b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-shutdown/Makefile
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-shutdown/Makefile
rename to test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-shutdown/Makefile
diff --git a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-shutdown/callbacks.h b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-shutdown/callbacks.h
similarity index 100%
rename from test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-shutdown/callbacks.h
rename to test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-shutdown/callbacks.h
diff --git a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-shutdown/veccopy-ompt-target-emi-tracing.cpp b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-shutdown/veccopy-ompt-target-emi-tracing.cpp
similarity index 93%
rename from test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-shutdown/veccopy-ompt-target-emi-tracing.cpp
rename to test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-shutdown/veccopy-ompt-target-emi-tracing.cpp
index 2a8fa3ece3..67e3fc7942 100644
--- a/test/smoke-dev/veccopy-ompt-target-tracing-flush-only-on-shutdown/veccopy-ompt-target-emi-tracing.cpp
+++ b/test/smoke-limbo/veccopy-ompt-target-tracing-flush-only-on-shutdown/veccopy-ompt-target-emi-tracing.cpp
@@ -1,7 +1,7 @@
/*
* This test is run with LIBOMPTARGET_OMPT_FLUSH_ON_BUFFER_FULL=false and
* ompt_flush_trace is not invoked by the user/tool. The intention is to check
- * whether trace records are properly flushed on shutdown. 22 trace records
+ * whether trace records are properly flushed on shutdown. 23 trace records
* should be flushed during shutdown.
*/
#include
@@ -78,6 +78,8 @@ int main() {
/// CHECK-DAG: rec=
/// CHECK-DAG: rec=
/// CHECK-DAG: rec=
+/// CHECK-DAG: rec=
+/// CHECK-DAG: rec=
/// CHECK-NOT: rec=
/// CHECK-NOT: host_op_id=0x0
diff --git a/test/smoke-limbo/veccopy-ompt-target-tracing/callbacks.h b/test/smoke-limbo/veccopy-ompt-target-tracing/callbacks.h
index a442c1e8b9..cfb5fd4147 100644
--- a/test/smoke-limbo/veccopy-ompt-target-tracing/callbacks.h
+++ b/test/smoke-limbo/veccopy-ompt-target-tracing/callbacks.h
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
#include
diff --git a/test/smoke-limbo/veccopy-ompt-target-tracing/veccopy-ompt-target-tracing.cpp b/test/smoke-limbo/veccopy-ompt-target-tracing/veccopy-ompt-target-tracing.cpp
index e8721b85c7..e10ac3fc16 100644
--- a/test/smoke-limbo/veccopy-ompt-target-tracing/veccopy-ompt-target-tracing.cpp
+++ b/test/smoke-limbo/veccopy-ompt-target-tracing/veccopy-ompt-target-tracing.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
#include
diff --git a/test/smoke-dev/veccopy-shared-ctor-1/Makefile b/test/smoke-limbo/veccopy-shared-ctor-1/Makefile
similarity index 100%
rename from test/smoke-dev/veccopy-shared-ctor-1/Makefile
rename to test/smoke-limbo/veccopy-shared-ctor-1/Makefile
diff --git a/test/smoke-dev/veccopy-shared-ctor-1/veccopy-ctor-1.cpp b/test/smoke-limbo/veccopy-shared-ctor-1/veccopy-ctor-1.cpp
similarity index 100%
rename from test/smoke-dev/veccopy-shared-ctor-1/veccopy-ctor-1.cpp
rename to test/smoke-limbo/veccopy-shared-ctor-1/veccopy-ctor-1.cpp
diff --git a/test/smoke-dev/veccopy-shared-ctor-1/veccopy.cpp b/test/smoke-limbo/veccopy-shared-ctor-1/veccopy.cpp
similarity index 100%
rename from test/smoke-dev/veccopy-shared-ctor-1/veccopy.cpp
rename to test/smoke-limbo/veccopy-shared-ctor-1/veccopy.cpp
diff --git a/test/smoke-dev/veccopy-shared-ompt-ctor-1/Makefile b/test/smoke-limbo/veccopy-shared-ompt-ctor-1/Makefile
similarity index 100%
rename from test/smoke-dev/veccopy-shared-ompt-ctor-1/Makefile
rename to test/smoke-limbo/veccopy-shared-ompt-ctor-1/Makefile
diff --git a/test/smoke-dev/veccopy-shared-ompt-ctor-1/callbacks.h b/test/smoke-limbo/veccopy-shared-ompt-ctor-1/callbacks.h
similarity index 100%
rename from test/smoke-dev/veccopy-shared-ompt-ctor-1/callbacks.h
rename to test/smoke-limbo/veccopy-shared-ompt-ctor-1/callbacks.h
diff --git a/test/smoke-dev/veccopy-shared-ompt-ctor-1/veccopy-ctor-1.cpp b/test/smoke-limbo/veccopy-shared-ompt-ctor-1/veccopy-ctor-1.cpp
similarity index 100%
rename from test/smoke-dev/veccopy-shared-ompt-ctor-1/veccopy-ctor-1.cpp
rename to test/smoke-limbo/veccopy-shared-ompt-ctor-1/veccopy-ctor-1.cpp
diff --git a/test/smoke-dev/veccopy-shared-ompt-ctor-1/veccopy.cpp b/test/smoke-limbo/veccopy-shared-ompt-ctor-1/veccopy.cpp
similarity index 100%
rename from test/smoke-dev/veccopy-shared-ompt-ctor-1/veccopy.cpp
rename to test/smoke-limbo/veccopy-shared-ompt-ctor-1/veccopy.cpp
diff --git a/test/smoke-dev/vmulsum-hsa-stats/Makefile b/test/smoke-limbo/vmulsum-hsa-stats/Makefile
similarity index 80%
rename from test/smoke-dev/vmulsum-hsa-stats/Makefile
rename to test/smoke-limbo/vmulsum-hsa-stats/Makefile
index 1c2994f205..4917eb470b 100644
--- a/test/smoke-dev/vmulsum-hsa-stats/Makefile
+++ b/test/smoke-limbo/vmulsum-hsa-stats/Makefile
@@ -8,8 +8,7 @@ TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
CLANG ?= clang
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
-RUNPROF = $(AOMPHIP)/bin/rocprof
-RUNPROF_FLAGS = --hsa-trace
+RUNPROF = $(AOMPHIP)/bin/rocprofv3 --output-format csv --hsa-trace --stats --
#-ccc-print-phases
#"-\#\#\#"
diff --git a/test/smoke-dev/vmulsum-hsa-stats/README b/test/smoke-limbo/vmulsum-hsa-stats/README
similarity index 100%
rename from test/smoke-dev/vmulsum-hsa-stats/README
rename to test/smoke-limbo/vmulsum-hsa-stats/README
diff --git a/test/smoke-dev/vmulsum-hsa-stats/main.c b/test/smoke-limbo/vmulsum-hsa-stats/main.c
similarity index 100%
rename from test/smoke-dev/vmulsum-hsa-stats/main.c
rename to test/smoke-limbo/vmulsum-hsa-stats/main.c
diff --git a/test/smoke-dev/vmulsum-hsa-stats/onesrc.c b/test/smoke-limbo/vmulsum-hsa-stats/onesrc.c
similarity index 100%
rename from test/smoke-dev/vmulsum-hsa-stats/onesrc.c
rename to test/smoke-limbo/vmulsum-hsa-stats/onesrc.c
diff --git a/test/smoke-dev/vmulsum-hsa-stats/vmul.c b/test/smoke-limbo/vmulsum-hsa-stats/vmul.c
similarity index 100%
rename from test/smoke-dev/vmulsum-hsa-stats/vmul.c
rename to test/smoke-limbo/vmulsum-hsa-stats/vmul.c
diff --git a/test/smoke-dev/vmulsum-hsa-stats/vsum.c b/test/smoke-limbo/vmulsum-hsa-stats/vsum.c
similarity index 100%
rename from test/smoke-dev/vmulsum-hsa-stats/vsum.c
rename to test/smoke-limbo/vmulsum-hsa-stats/vsum.c
diff --git a/test/smoke-limbo/workgroup_size_option1/workgroup_size_option1.c b/test/smoke-limbo/workgroup_size_option1/workgroup_size_option1.c
index e8aa2740f9..8cfd3a69fa 100644
--- a/test/smoke-limbo/workgroup_size_option1/workgroup_size_option1.c
+++ b/test/smoke-limbo/workgroup_size_option1/workgroup_size_option1.c
@@ -77,5 +77,5 @@ int main() {
/// CHECK: DEVID: 0 SGN:2 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
/// CHECK_WAVE64: DEVID: 0 SGN:3 ConstWGSize:961 args: 8 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
/// CHECK_WAVE32: DEVID: 0 SGN:3 ConstWGSize:993 args: 8 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
-/// CHECK: DEVID: 0 SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
-/// CHECK: DEVID: 0 SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID: 0 SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
+/// CHECK: DEVID: 0 SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
diff --git a/test/smoke-limbo/workgroup_size_option2/workgroup_size_option2.c b/test/smoke-limbo/workgroup_size_option2/workgroup_size_option2.c
index bb4efea16f..1c7ce9a338 100644
--- a/test/smoke-limbo/workgroup_size_option2/workgroup_size_option2.c
+++ b/test/smoke-limbo/workgroup_size_option2/workgroup_size_option2.c
@@ -77,5 +77,5 @@ int main() {
/// CHECK: DEVID: 0 SGN:3 ConstWGSize:257 args: 2 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
/// CHECK: DEVID: 0 SGN:2 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
/// CHECK: DEVID: 0 SGN:3 ConstWGSize:129 args: 8 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 129)
-/// CHECK: DEVID: 0 SGN:5 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID: 0 SGN:5 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID: 0 SGN:7 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
+/// CHECK: DEVID: 0 SGN:7 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
diff --git a/test/smoke-dev/xteam-red-4/Makefile b/test/smoke-limbo/xteam-red-4/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-4/Makefile
rename to test/smoke-limbo/xteam-red-4/Makefile
diff --git a/test/smoke-dev/xteam-red-4/xteam_red_4.c b/test/smoke-limbo/xteam-red-4/xteam_red_4.c
similarity index 100%
rename from test/smoke-dev/xteam-red-4/xteam_red_4.c
rename to test/smoke-limbo/xteam-red-4/xteam_red_4.c
diff --git a/test/smoke-dev/xteam-red-callee-default-option/Makefile b/test/smoke-limbo/xteam-red-callee-default-option/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-callee-default-option/Makefile
rename to test/smoke-limbo/xteam-red-callee-default-option/Makefile
diff --git a/test/smoke-dev/xteam-red-callee-default-option/xteam_red_callee.cpp b/test/smoke-limbo/xteam-red-callee-default-option/xteam_red_callee.cpp
similarity index 100%
rename from test/smoke-dev/xteam-red-callee-default-option/xteam_red_callee.cpp
rename to test/smoke-limbo/xteam-red-callee-default-option/xteam_red_callee.cpp
diff --git a/test/smoke-dev/xteam-red-callee-ptr/Makefile b/test/smoke-limbo/xteam-red-callee-ptr/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-callee-ptr/Makefile
rename to test/smoke-limbo/xteam-red-callee-ptr/Makefile
diff --git a/test/smoke-dev/xteam-red-callee-ptr/xteam_red_callee.cpp b/test/smoke-limbo/xteam-red-callee-ptr/xteam_red_callee.cpp
similarity index 100%
rename from test/smoke-dev/xteam-red-callee-ptr/xteam_red_callee.cpp
rename to test/smoke-limbo/xteam-red-callee-ptr/xteam_red_callee.cpp
diff --git a/test/smoke-dev/xteam-red-callee/Makefile b/test/smoke-limbo/xteam-red-callee/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-callee/Makefile
rename to test/smoke-limbo/xteam-red-callee/Makefile
diff --git a/test/smoke-dev/xteam-red-callee/xteam_red_callee.cpp b/test/smoke-limbo/xteam-red-callee/xteam_red_callee.cpp
similarity index 100%
rename from test/smoke-dev/xteam-red-callee/xteam_red_callee.cpp
rename to test/smoke-limbo/xteam-red-callee/xteam_red_callee.cpp
diff --git a/test/smoke-dev/xteam-red-cmdline-default-option/Makefile b/test/smoke-limbo/xteam-red-cmdline-default-option/Makefile
similarity index 84%
rename from test/smoke-dev/xteam-red-cmdline-default-option/Makefile
rename to test/smoke-limbo/xteam-red-cmdline-default-option/Makefile
index d883adafef..b502b35072 100644
--- a/test/smoke-dev/xteam-red-cmdline-default-option/Makefile
+++ b/test/smoke-limbo/xteam-red-cmdline-default-option/Makefile
@@ -4,7 +4,7 @@ TESTNAME = xteam_red_cmdline_option1
TESTSRC_MAIN = xteam_red_cmdline_option1.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1 LIBOMPTARGET_AMDGPU_XTEAM_BLOCKSIZE=512
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
diff --git a/test/smoke-dev/xteam-red-cmdline-default-option/xteam_red_cmdline_option1.c b/test/smoke-limbo/xteam-red-cmdline-default-option/xteam_red_cmdline_option1.c
similarity index 100%
rename from test/smoke-dev/xteam-red-cmdline-default-option/xteam_red_cmdline_option1.c
rename to test/smoke-limbo/xteam-red-cmdline-default-option/xteam_red_cmdline_option1.c
diff --git a/test/smoke-dev/xteam-red-collapse-default-option/Makefile b/test/smoke-limbo/xteam-red-collapse-default-option/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-collapse-default-option/Makefile
rename to test/smoke-limbo/xteam-red-collapse-default-option/Makefile
diff --git a/test/smoke-dev/xteam-red-collapse-default-option/xteam_red_collapse.c b/test/smoke-limbo/xteam-red-collapse-default-option/xteam_red_collapse.c
similarity index 100%
rename from test/smoke-dev/xteam-red-collapse-default-option/xteam_red_collapse.c
rename to test/smoke-limbo/xteam-red-collapse-default-option/xteam_red_collapse.c
diff --git a/test/smoke-dev/xteam-red-collapse/Makefile b/test/smoke-limbo/xteam-red-collapse/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-collapse/Makefile
rename to test/smoke-limbo/xteam-red-collapse/Makefile
diff --git a/test/smoke-dev/xteam-red-collapse/xteam_red_collapse.c b/test/smoke-limbo/xteam-red-collapse/xteam_red_collapse.c
similarity index 91%
rename from test/smoke-dev/xteam-red-collapse/xteam_red_collapse.c
rename to test/smoke-limbo/xteam-red-collapse/xteam_red_collapse.c
index 1c83629b97..1dbd52adf5 100644
--- a/test/smoke-dev/xteam-red-collapse/xteam_red_collapse.c
+++ b/test/smoke-limbo/xteam-red-collapse/xteam_red_collapse.c
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke-limbo/xteam-red-debug-info/Makefile b/test/smoke-limbo/xteam-red-debug-info/Makefile
new file mode 100644
index 0000000000..ac40d50114
--- /dev/null
+++ b/test/smoke-limbo/xteam-red-debug-info/Makefile
@@ -0,0 +1,16 @@
+include ../../Makefile.defs
+
+TESTNAME = xteam_red_debug_info
+TESTSRC_MAIN = xteam_red_debug_info.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+RUNENV += LIBOMPTARGET_INFO=1
+RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+CLANG ?= clang -g
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-limbo/xteam-red-debug-info/xteam_red_debug_info.c b/test/smoke-limbo/xteam-red-debug-info/xteam_red_debug_info.c
new file mode 100644
index 0000000000..1bbf718e67
--- /dev/null
+++ b/test/smoke-limbo/xteam-red-debug-info/xteam_red_debug_info.c
@@ -0,0 +1,25 @@
+#include
+
+// This test checks if the debug infomation were correctly
+// mapped for cross-tream reduction code.
+
+int main()
+{
+ int N = 100000;
+ double x[N];
+ double sum = 0.0;
+
+ #pragma omp target teams distribute parallel for reduction(+: sum)
+ for (int i=0; i&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
+CLANG = clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-limbo/xteam-red-inner-simd-reduction/xteam_red_inner_simd_reduction.c b/test/smoke-limbo/xteam-red-inner-simd-reduction/xteam_red_inner_simd_reduction.c
new file mode 100644
index 0000000000..804cf8fb63
--- /dev/null
+++ b/test/smoke-limbo/xteam-red-inner-simd-reduction/xteam_red_inner_simd_reduction.c
@@ -0,0 +1,190 @@
+#include
+#include
+
+int N = 100;
+
+void init(double *sum, double c[][N]) {
+ *sum = 0;
+ for (int i = 0; i < N; ++i) {
+ for (int k = 0; k < N; ++k) {
+ c[i][k] = 0;
+ }
+ }
+}
+
+int check(double sum, double c[][N]) {
+ return sum != 495000 || c[10][20] != 4950;
+}
+
+int main()
+{
+ double a[N];
+ double c[N][N];
+
+ for (int i=0; i
-#include
#include
#include
@@ -12,48 +11,48 @@ int main()
{
int N = 10000;
- int a[N];
+ double a[N];
for (int i=0; i
-#include
#include
#include
@@ -14,48 +14,48 @@ int main()
{
int N = 10000;
- int a[N];
+ double a[N];
for (int i=0; i&1 | $(FILECHECK) $(TESTSRC_MAIN)
+
EXTRA_LDFLAGS += -lm
CLANG = clang++
OMP_BIN = $(AOMP)/bin/$(CLANG)
diff --git a/test/smoke-dev/xteam-red-min-max-std/xteam-red-min-max-std.cpp b/test/smoke-limbo/xteam-red-min-max-std/xteam-red-min-max-std.cpp
similarity index 66%
rename from test/smoke-dev/xteam-red-min-max-std/xteam-red-min-max-std.cpp
rename to test/smoke-limbo/xteam-red-min-max-std/xteam-red-min-max-std.cpp
index cda0b1cf49..b7531038f1 100644
--- a/test/smoke-dev/xteam-red-min-max-std/xteam-red-min-max-std.cpp
+++ b/test/smoke-limbo/xteam-red-min-max-std/xteam-red-min-max-std.cpp
@@ -63,3 +63,21 @@ int main()
std::cout << "Failed\n";
return rc;
}
+
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8
+
diff --git a/test/smoke-dev/xteam-red-min-max/Makefile b/test/smoke-limbo/xteam-red-min-max/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-min-max/Makefile
rename to test/smoke-limbo/xteam-red-min-max/Makefile
diff --git a/test/smoke-dev/xteam-red-min-max/xteam-red-min-max.cpp b/test/smoke-limbo/xteam-red-min-max/xteam-red-min-max.cpp
similarity index 100%
rename from test/smoke-dev/xteam-red-min-max/xteam-red-min-max.cpp
rename to test/smoke-limbo/xteam-red-min-max/xteam-red-min-max.cpp
diff --git a/test/smoke-dev/xteam-red-ptr/Makefile b/test/smoke-limbo/xteam-red-ptr/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-ptr/Makefile
rename to test/smoke-limbo/xteam-red-ptr/Makefile
diff --git a/test/smoke-dev/xteam-red-ptr/xteam-red-ptr.cpp b/test/smoke-limbo/xteam-red-ptr/xteam-red-ptr.cpp
similarity index 100%
rename from test/smoke-dev/xteam-red-ptr/xteam-red-ptr.cpp
rename to test/smoke-limbo/xteam-red-ptr/xteam-red-ptr.cpp
diff --git a/test/smoke-dev/xteam-red-reference/Makefile b/test/smoke-limbo/xteam-red-reference/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-reference/Makefile
rename to test/smoke-limbo/xteam-red-reference/Makefile
diff --git a/test/smoke-dev/xteam-red-reference/xteam-red-reference.cpp b/test/smoke-limbo/xteam-red-reference/xteam-red-reference.cpp
similarity index 100%
rename from test/smoke-dev/xteam-red-reference/xteam-red-reference.cpp
rename to test/smoke-limbo/xteam-red-reference/xteam-red-reference.cpp
diff --git a/test/smoke-dev/xteam-red-sched-default-option/Makefile b/test/smoke-limbo/xteam-red-sched-default-option/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-sched-default-option/Makefile
rename to test/smoke-limbo/xteam-red-sched-default-option/Makefile
diff --git a/test/smoke-dev/xteam-red-sched-default-option/xteam_red_sched.c b/test/smoke-limbo/xteam-red-sched-default-option/xteam_red_sched.c
similarity index 100%
rename from test/smoke-dev/xteam-red-sched-default-option/xteam_red_sched.c
rename to test/smoke-limbo/xteam-red-sched-default-option/xteam_red_sched.c
diff --git a/test/smoke-dev/xteam-red-small-precision/Makefile b/test/smoke-limbo/xteam-red-small-precision/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-small-precision/Makefile
rename to test/smoke-limbo/xteam-red-small-precision/Makefile
diff --git a/test/smoke-dev/xteam-red-small-precision/xteam_red_small_precision.c b/test/smoke-limbo/xteam-red-small-precision/xteam_red_small_precision.c
similarity index 100%
rename from test/smoke-dev/xteam-red-small-precision/xteam_red_small_precision.c
rename to test/smoke-limbo/xteam-red-small-precision/xteam_red_small_precision.c
diff --git a/test/smoke-limbo/xteam-red-split-1/Makefile b/test/smoke-limbo/xteam-red-split-1/Makefile
index a84cd95275..d268953eb7 100644
--- a/test/smoke-limbo/xteam-red-split-1/Makefile
+++ b/test/smoke-limbo/xteam-red-split-1/Makefile
@@ -4,7 +4,7 @@ TESTNAME = xteam_red_split_1
TESTSRC_MAIN = xteam_red_split_1.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1 LIBOMPTARGET_AMDGPU_XTEAM_BLOCKSIZE=512
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
diff --git a/test/smoke-limbo/xteam-red-split-1/xteam_red_split_1.c b/test/smoke-limbo/xteam-red-split-1/xteam_red_split_1.c
index fe3d0479ce..5f6a9ba9d0 100644
--- a/test/smoke-limbo/xteam-red-split-1/xteam_red_split_1.c
+++ b/test/smoke-limbo/xteam-red-split-1/xteam_red_split_1.c
@@ -1,3 +1,6 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
#include
#include
@@ -138,17 +141,17 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:64 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:128 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:128 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:128 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:256 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:128 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args:10 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args:10 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:64 args:10 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
diff --git a/test/smoke-limbo/xteam-red-split-2/xteam_red_split_2.c b/test/smoke-limbo/xteam-red-split-2/xteam_red_split_2.c
index 8c2d174d49..59f333032a 100644
--- a/test/smoke-limbo/xteam-red-split-2/xteam_red_split_2.c
+++ b/test/smoke-limbo/xteam-red-split-2/xteam_red_split_2.c
@@ -1,3 +1,8 @@
+/*
+ Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT
+*/
#include
#include
diff --git a/test/smoke-dev/xteam-red-split-collapse-default-option/Makefile b/test/smoke-limbo/xteam-red-split-collapse-default-option/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-split-collapse-default-option/Makefile
rename to test/smoke-limbo/xteam-red-split-collapse-default-option/Makefile
diff --git a/test/smoke-dev/xteam-red-split-collapse-default-option/xteam_red_split_collapse.c b/test/smoke-limbo/xteam-red-split-collapse-default-option/xteam_red_split_collapse.c
similarity index 100%
rename from test/smoke-dev/xteam-red-split-collapse-default-option/xteam_red_split_collapse.c
rename to test/smoke-limbo/xteam-red-split-collapse-default-option/xteam_red_split_collapse.c
diff --git a/test/smoke-dev/xteam-red-split-default-option-1/Makefile b/test/smoke-limbo/xteam-red-split-default-option-1/Makefile
similarity index 81%
rename from test/smoke-dev/xteam-red-split-default-option-1/Makefile
rename to test/smoke-limbo/xteam-red-split-default-option-1/Makefile
index eb2aabb7c5..e4b3aecf6e 100644
--- a/test/smoke-dev/xteam-red-split-default-option-1/Makefile
+++ b/test/smoke-limbo/xteam-red-split-default-option-1/Makefile
@@ -4,7 +4,7 @@ TESTNAME = xteam_red_split_1
TESTSRC_MAIN = xteam_red_split_1.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1 LIBOMPTARGET_AMDGPU_XTEAM_BLOCKSIZE=512
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
diff --git a/test/smoke-dev/xteam-red-split-default-option-1/xteam_red_split_1.c b/test/smoke-limbo/xteam-red-split-default-option-1/xteam_red_split_1.c
similarity index 80%
rename from test/smoke-dev/xteam-red-split-default-option-1/xteam_red_split_1.c
rename to test/smoke-limbo/xteam-red-split-default-option-1/xteam_red_split_1.c
index fe3d0479ce..5f6a9ba9d0 100644
--- a/test/smoke-dev/xteam-red-split-default-option-1/xteam_red_split_1.c
+++ b/test/smoke-limbo/xteam-red-split-default-option-1/xteam_red_split_1.c
@@ -1,3 +1,6 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
#include
#include
@@ -138,17 +141,17 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:64 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:128 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:128 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:128 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:256 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:128 args: 7 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args:10 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args:10 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:64 args:10 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
diff --git a/test/smoke-dev/xteam-red-split-default-option-2/Makefile b/test/smoke-limbo/xteam-red-split-default-option-2/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-split-default-option-2/Makefile
rename to test/smoke-limbo/xteam-red-split-default-option-2/Makefile
diff --git a/test/smoke-dev/xteam-red-split-default-option-2/xteam_red_split_2.c b/test/smoke-limbo/xteam-red-split-default-option-2/xteam_red_split_2.c
similarity index 100%
rename from test/smoke-dev/xteam-red-split-default-option-2/xteam_red_split_2.c
rename to test/smoke-limbo/xteam-red-split-default-option-2/xteam_red_split_2.c
diff --git a/test/smoke-dev/xteam-red-teams-default-option/Makefile b/test/smoke-limbo/xteam-red-teams-default-option/Makefile
similarity index 81%
rename from test/smoke-dev/xteam-red-teams-default-option/Makefile
rename to test/smoke-limbo/xteam-red-teams-default-option/Makefile
index 8653b9f8ff..8f8c18eda7 100644
--- a/test/smoke-dev/xteam-red-teams-default-option/Makefile
+++ b/test/smoke-limbo/xteam-red-teams-default-option/Makefile
@@ -4,7 +4,7 @@ TESTNAME = xteam_red_teams
TESTSRC_MAIN = xteam_red_teams.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1 LIBOMPTARGET_AMDGPU_XTEAM_BLOCKSIZE=512
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
diff --git a/test/smoke-dev/xteam-red-teams-default-option/xteam_red_teams.c b/test/smoke-limbo/xteam-red-teams-default-option/xteam_red_teams.c
similarity index 70%
rename from test/smoke-dev/xteam-red-teams-default-option/xteam_red_teams.c
rename to test/smoke-limbo/xteam-red-teams-default-option/xteam_red_teams.c
index 743d704a29..a83c42355e 100644
--- a/test/smoke-dev/xteam-red-teams-default-option/xteam_red_teams.c
+++ b/test/smoke-limbo/xteam-red-teams-default-option/xteam_red_teams.c
@@ -43,8 +43,8 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:( 1X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:( 50X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:( 40X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:( 10X1024)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:( 1X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:( 50X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:( 40X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:( 10X 512)
diff --git a/test/smoke/xteam-red-teams/Makefile b/test/smoke-limbo/xteam-red-teams/Makefile
similarity index 83%
rename from test/smoke/xteam-red-teams/Makefile
rename to test/smoke-limbo/xteam-red-teams/Makefile
index 03f3eb79c7..aedd0cf3d5 100644
--- a/test/smoke/xteam-red-teams/Makefile
+++ b/test/smoke-limbo/xteam-red-teams/Makefile
@@ -4,7 +4,7 @@ TESTNAME = xteam_red_teams
TESTSRC_MAIN = xteam_red_teams.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1 LIBOMPTARGET_AMDGPU_XTEAM_BLOCKSIZE=512
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
diff --git a/test/smoke/xteam-red-teams/xteam_red_teams.c b/test/smoke-limbo/xteam-red-teams/xteam_red_teams.c
similarity index 66%
rename from test/smoke/xteam-red-teams/xteam_red_teams.c
rename to test/smoke-limbo/xteam-red-teams/xteam_red_teams.c
index f0175cf51b..45a6383b4c 100644
--- a/test/smoke/xteam-red-teams/xteam_red_teams.c
+++ b/test/smoke-limbo/xteam-red-teams/xteam_red_teams.c
@@ -1,3 +1,7 @@
+/* Copyright © Advanced Micro Devices, Inc., or its affiliates.
+
+ SPDX-License-Identifier: MIT */
+
#include
#include
@@ -43,8 +47,8 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:( 1X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:( 5X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:( 40X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:1024 args: 7 teamsXthrds:( 10X1024)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:( 1X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:( 5X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:( 40X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:8 ConstWGSize:512 args: 7 teamsXthrds:( 10X 512)
diff --git a/test/smoke-dev/xteam-red-threads-default-option/Makefile b/test/smoke-limbo/xteam-red-threads-default-option/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-threads-default-option/Makefile
rename to test/smoke-limbo/xteam-red-threads-default-option/Makefile
diff --git a/test/smoke-dev/xteam-red-threads-default-option/xteam_red_threads.c b/test/smoke-limbo/xteam-red-threads-default-option/xteam_red_threads.c
similarity index 100%
rename from test/smoke-dev/xteam-red-threads-default-option/xteam_red_threads.c
rename to test/smoke-limbo/xteam-red-threads-default-option/xteam_red_threads.c
diff --git a/test/smoke-dev/xteam-red-unsupported/Makefile b/test/smoke-limbo/xteam-red-unsupported/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-red-unsupported/Makefile
rename to test/smoke-limbo/xteam-red-unsupported/Makefile
diff --git a/test/smoke-dev/xteam-red-unsupported/NRUN b/test/smoke-limbo/xteam-red-unsupported/NRUN
similarity index 100%
rename from test/smoke-dev/xteam-red-unsupported/NRUN
rename to test/smoke-limbo/xteam-red-unsupported/NRUN
diff --git a/test/smoke-dev/xteam-red-unsupported/xteam_red_unsupported.c b/test/smoke-limbo/xteam-red-unsupported/xteam_red_unsupported.c
similarity index 100%
rename from test/smoke-dev/xteam-red-unsupported/xteam_red_unsupported.c
rename to test/smoke-limbo/xteam-red-unsupported/xteam_red_unsupported.c
diff --git a/test/smoke-dev/xteam-scan-no-loop/Makefile b/test/smoke-limbo/xteam-scan-no-loop/Makefile
similarity index 100%
rename from test/smoke-dev/xteam-scan-no-loop/Makefile
rename to test/smoke-limbo/xteam-scan-no-loop/Makefile
diff --git a/test/smoke-dev/xteam-scan-no-loop/xteam_scan_no_loop.cpp b/test/smoke-limbo/xteam-scan-no-loop/xteam_scan_no_loop.cpp
similarity index 100%
rename from test/smoke-dev/xteam-scan-no-loop/xteam_scan_no_loop.cpp
rename to test/smoke-limbo/xteam-scan-no-loop/xteam_scan_no_loop.cpp
diff --git a/test/smoke-dev/xteamr/Makefile b/test/smoke-limbo/xteamr/Makefile
similarity index 84%
rename from test/smoke-dev/xteamr/Makefile
rename to test/smoke-limbo/xteamr/Makefile
index d9a3ac8933..a6fd639c73 100644
--- a/test/smoke-dev/xteamr/Makefile
+++ b/test/smoke-limbo/xteamr/Makefile
@@ -8,7 +8,7 @@ TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
CLANG ?= clang++
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
-CFLAGS = -O3 -std=c++11 -fopenmp-target-fast -latomic
+CFLAGS = -O3 -std=c++11 -fopenmp-target-fast
#-ccc-print-phases
#"-\#\#\#"
diff --git a/test/smoke-dev/xteamr/NRUN b/test/smoke-limbo/xteamr/NRUN
similarity index 100%
rename from test/smoke-dev/xteamr/NRUN
rename to test/smoke-limbo/xteamr/NRUN
diff --git a/test/smoke-dev/xteamr/README b/test/smoke-limbo/xteamr/README
similarity index 100%
rename from test/smoke-dev/xteamr/README
rename to test/smoke-limbo/xteamr/README
diff --git a/test/smoke-dev/xteamr/test_xteamr.cpp b/test/smoke-limbo/xteamr/test_xteamr.cpp
similarity index 100%
rename from test/smoke-dev/xteamr/test_xteamr.cpp
rename to test/smoke-limbo/xteamr/test_xteamr.cpp
diff --git a/test/smoke-dev/xteamr_extended/test_xteamr.h b/test/smoke-limbo/xteamr/test_xteamr.h
similarity index 99%
rename from test/smoke-dev/xteamr_extended/test_xteamr.h
rename to test/smoke-limbo/xteamr/test_xteamr.h
index c14606a793..93243eed5c 100644
--- a/test/smoke-dev/xteamr_extended/test_xteamr.h
+++ b/test/smoke-limbo/xteamr/test_xteamr.h
@@ -1,3 +1,6 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
// Header file: overload_to_externs.h
// generated by utility gen_externs
diff --git a/test/smoke-dev/xteamr_builtins/Makefile b/test/smoke-limbo/xteamr_builtins/Makefile
similarity index 89%
rename from test/smoke-dev/xteamr_builtins/Makefile
rename to test/smoke-limbo/xteamr_builtins/Makefile
index 5aed1fdfda..b1a3413961 100644
--- a/test/smoke-dev/xteamr_builtins/Makefile
+++ b/test/smoke-limbo/xteamr_builtins/Makefile
@@ -8,7 +8,7 @@ TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
CLANG ?= clang++
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
-CFLAGS = -O3 -std=c++11 -latomic
+CFLAGS = -O3 -std=c++11
#-ccc-print-phases
#"-\#\#\#"
diff --git a/test/smoke-dev/xteamr_builtins/README b/test/smoke-limbo/xteamr_builtins/README
similarity index 100%
rename from test/smoke-dev/xteamr_builtins/README
rename to test/smoke-limbo/xteamr_builtins/README
diff --git a/test/smoke-dev/xteamr_builtins/test_xteamr.cpp b/test/smoke-limbo/xteamr_builtins/test_xteamr.cpp
similarity index 100%
rename from test/smoke-dev/xteamr_builtins/test_xteamr.cpp
rename to test/smoke-limbo/xteamr_builtins/test_xteamr.cpp
diff --git a/test/smoke-dev/xteamr_builtins/test_xteamr.h b/test/smoke-limbo/xteamr_builtins/test_xteamr.h
similarity index 100%
rename from test/smoke-dev/xteamr_builtins/test_xteamr.h
rename to test/smoke-limbo/xteamr_builtins/test_xteamr.h
diff --git a/test/smoke-dev/xteamr_extended/Makefile b/test/smoke-limbo/xteamr_extended/Makefile
similarity index 100%
rename from test/smoke-dev/xteamr_extended/Makefile
rename to test/smoke-limbo/xteamr_extended/Makefile
diff --git a/test/smoke-dev/xteamr_extended/README b/test/smoke-limbo/xteamr_extended/README
similarity index 100%
rename from test/smoke-dev/xteamr_extended/README
rename to test/smoke-limbo/xteamr_extended/README
diff --git a/test/smoke-dev/xteamr_extended/test_xteamr.cpp b/test/smoke-limbo/xteamr_extended/test_xteamr.cpp
similarity index 100%
rename from test/smoke-dev/xteamr_extended/test_xteamr.cpp
rename to test/smoke-limbo/xteamr_extended/test_xteamr.cpp
diff --git a/test/smoke-dev/xteamr/test_xteamr.h b/test/smoke-limbo/xteamr_extended/test_xteamr.h
similarity index 100%
rename from test/smoke-dev/xteamr/test_xteamr.h
rename to test/smoke-limbo/xteamr_extended/test_xteamr.h
diff --git a/test/smoke-training/Makefile b/test/smoke-training/Makefile
new file mode 100644
index 0000000000..669b978778
--- /dev/null
+++ b/test/smoke-training/Makefile
@@ -0,0 +1,82 @@
+include ../Makefile.defs
+
+all:
+ @for test_dir in $(TESTS_DIR); do \
+ echo; \
+ test_name=`grep "TESTNAME *=" $$test_dir/Makefile | sed "s/.*= *//"`; \
+ echo "TEST_DIR: $$test_dir\tTEST_NAME: $$test_name\tMAKE: $(MAKE) -C $$test_dir"; \
+ $(MAKE) -C $$test_dir; \
+ done
+
+run run_obin run_sbin run_llbin clean clean_log llbin sbin obin:
+ @for test_dir in $(TESTS_DIR); do \
+ echo $$nnn; \
+ test_name=`grep "TESTNAME *=" $$test_dir/Makefile | sed "s/.*= *//"`; \
+ echo "TEST_DIR: $$test_dir\tTEST_NAME: $$test_name\tMAKE: $(MAKE) -C $$test_dir $@"; \
+ $(MAKE) -C $$test_dir $@; \
+ done
+
+check:
+ @for test_dir in $(TESTS_DIR); do \
+ echo $$nnn; \
+ test_name=`grep "TESTNAME *=" $$test_dir/Makefile | sed "s/.*= *//"`; \
+ echo "TEST_DIR: $$test_dir\tTEST_NAME: $$test_name\tMAKE: $(MAKE) -C $$test_dir $@"; \
+ $(MAKE) -C $$test_dir $@; \
+ done
+
+.ll .ll.s .ll.o .s .s.o .o:
+ @for test_dir in $(TESTS_DIR); do \
+ echo $$nnn; \
+ test_name=`grep "TESTNAME *=" $$test_dir/Makefile | sed "s/.*= *//"`; \
+ echo "TEST_DIR: $$test_dir\tTEST_NAME: $$test_name\tMAKE: $(MAKE) -C $$test_dir $$test_name$@"; \
+ $(MAKE) -C $$test_dir $$test_name$@; \
+ done
+
+help:
+ @echo
+ @echo "LLVM Tool Chain: $(AOMP)/bin"
+ @echo "Offload Targets: $(TARGET)"
+ @echo "Host Target: $(AOMP_CPUTARGET)"
+ @echo "Application Dirs: $(TESTS_DIR)"
+ @echo
+ @echo "This Makefile supports the following flags:"
+ @echo
+ @echo " make llbin // Link pass only"
+ @echo " make run_llbin // Execute llbin"
+ @echo
+ @echo " make sbin // Link pass only"
+ @echo " make run_sbin // Execute sbin"
+ @echo
+ @echo " make obin // Link pass only"
+ @echo " make run_obin // Execute obin"
+ @echo
+ @echo " make .ll // Compile pass only : -c -S -emit-llvm"
+ @echo " make .ll.s // Backend pass only : -c -S"
+ @echo " make .ll.o // Assemble pass only : -c"
+ @echo " make .s // Compile & Backend passes : -c -S"
+ @echo " make .s.o // Assemble pass only : -c"
+ @echo " make .o // Compile, Backend, Assemble : -c"
+ @echo
+ @echo " make // All passes, build all examples from Application Dirs"
+ @echo " make run // Execute all binaries from Application Dirs"
+ @echo
+ @echo " make clean"
+ @echo " make clean_log"
+ @echo " make help"
+ @echo
+ @echo " Environment variables to control compilation & execution"
+ @echo " VERBOSE=1 See lots of compiler messages and driver actions"
+ @echo " TEMPS=1 Do not delete intermediate files"
+ @echo " OFFLOAD_DEBUG=1 See Runtime diagnostics for each call to libomptarget API"
+ @echo " TARGET= Override Makefile target"
+ @echo
+ @echo " Compile Environment: $(SETENV)"
+ @echo
+ @echo " Run Environment: $(RUNENV)"
+ @echo
+ @echo " Compile Flags: $(CFLAGS) $(EXTRA_CFLAGS)"
+ @echo
+ @echo " OMP Compile Flags: $(OMP_FLAGS) $(EXTRA_OMP_FLAGS)"
+ @echo
+ @echo " Link Flags: $(LINK_FLAGS) $(EXTRA_LDFLAGS)"
+ @echo
diff --git a/test/smoke-training/Makefile.rules b/test/smoke-training/Makefile.rules
new file mode 120000
index 0000000000..b963453533
--- /dev/null
+++ b/test/smoke-training/Makefile.rules
@@ -0,0 +1 @@
+../smoke/Makefile.rules
\ No newline at end of file
diff --git a/test/smoke-training/check_smoke_training.sh b/test/smoke-training/check_smoke_training.sh
new file mode 120000
index 0000000000..9beff5fdbe
--- /dev/null
+++ b/test/smoke-training/check_smoke_training.sh
@@ -0,0 +1 @@
+../smoke/check_smoke.sh
\ No newline at end of file
diff --git a/test/smoke-training/hellofort/Makefile b/test/smoke-training/hellofort/Makefile
new file mode 100644
index 0000000000..bb592a0150
--- /dev/null
+++ b/test/smoke-training/hellofort/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = hellofort
+TESTSRC_MAIN = hellofort.f90
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+FLANG ?= flang
+OMP_BIN = $(AOMP)/bin/$(FLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-training/hellofort/hellofort.f90 b/test/smoke-training/hellofort/hellofort.f90
new file mode 100644
index 0000000000..7263ee70ba
--- /dev/null
+++ b/test/smoke-training/hellofort/hellofort.f90
@@ -0,0 +1,20 @@
+program main
+ use omp_lib
+ integer :: isHost = 1
+
+!$omp target map(tofrom: isHost)
+ isHost = omp_is_initial_device()
+ print *, "Hello world. ", 100
+ do i = 1, 5
+ print *, "Hello world. iteration ", i
+ enddo
+!$omp end target
+
+ if (isHost .eq. 1) then
+ print *, "Target region executed on the host"
+ else
+ print *, "Target region executed on the device"
+ endif
+
+ call exit(isHost)
+end program
diff --git a/test/smoke-training/helloworld/Makefile b/test/smoke-training/helloworld/Makefile
new file mode 100644
index 0000000000..a1a8198587
--- /dev/null
+++ b/test/smoke-training/helloworld/Makefile
@@ -0,0 +1,14 @@
+include ../../Makefile.defs
+
+TESTNAME = helloworld
+TESTSRC_MAIN = helloworld.c
+TESTSRC_AUX =
+TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+
+CLANG ?= clang
+OMP_BIN = $(AOMP)/bin/$(CLANG)
+CC = $(OMP_BIN) $(VERBOSE)
+#-ccc-print-phases
+#"-\#\#\#"
+
+include ../Makefile.rules
diff --git a/test/smoke-training/helloworld/helloworld.c b/test/smoke-training/helloworld/helloworld.c
new file mode 100644
index 0000000000..e76fe0645b
--- /dev/null
+++ b/test/smoke-training/helloworld/helloworld.c
@@ -0,0 +1,20 @@
+#include
+#include
+
+int main(void) {
+ int isHost = 1;
+
+#pragma omp target map(tofrom: isHost)
+ {
+ isHost = omp_is_initial_device();
+ printf("Hello world. %d\n", 100);
+ for (int i =0; i<5; i++) {
+ printf("Hello world. iteration %d\n", i);
+ }
+ }
+
+ printf("Target region executed on the %s\n", isHost ? "host" : "device");
+
+ return isHost;
+}
+
diff --git a/test/smoke/Makefile b/test/smoke/Makefile
index 0b9b051ef8..c353bf7252 100644
--- a/test/smoke/Makefile
+++ b/test/smoke/Makefile
@@ -1,287 +1,5 @@
include ../Makefile.defs
-TESTS_DIR = \
- DeclareSharedMemory \
- alignedattribute \
- ancestorC \
- aomp_mappings_newrt \
- assertok_error \
- atomic \
- atomic_double \
- CanonNE \
- clang-274983 \
- clang-262701 \
- clang-host-targ \
- clang-host-targ2 \
- clang-red-SglComplex \
- clang-red-DblComplex \
- clang-tracekernel \
- class \
- closed_bug2 \
- collapse \
- collapse-nonrectangle \
- complex \
- complex2 \
- d2h_slow_copy \
- data_enter_issue01 \
- data_issue_59 \
- data_share1 \
- data_share2 \
- decl_targ \
- declare_target_pointer \
- devices \
- devito_prob1 \
- extern_init \
- firstprivate \
- firstprivate2 \
- flags \
- famd-opt-279975 \
- flang-272328 \
- flang-272343 \
- flang-272343-2 \
- flang-273762 \
- flang-273990-2 \
- flang-274775-dcmplx \
- flang-275194-2 \
- flang-275194-3 \
- flang-275490 \
- flang-272285 \
- flang-272521 \
- flang-272534 \
- flang-272730-complex \
- flang-272878 \
- flang-273281 \
- flang-273284 \
- flang-274768 \
- flang-274775 \
- flang-274983 \
- flang-275194 \
- flang-275194-1 \
- flang_2regions \
- flang-atomic \
- flang_blkdata-g \
- flang_char_kind \
- flang_deviceio \
- flang_gen_sptr_prob \
- flang-host-targ \
- flang_isystem_prob \
- flang_klemm_map \
- flang_math \
- flang_omp_map \
- flang_omp_red_3d \
- flang_real16_prob \
- flang_reduction_offload \
- flang_red_swdev-273281 \
- flang_red_swdev-273281-spmd \
- flang_teams \
- flang_tgt_alloc_ptr \
- flang-tracekernel \
- fprintf \
- function \
- function_overload \
- function_template \
- gdb_teams \
- global_allocate \
- gpus \
- helloworld \
- hip_device_compile \
- hip_rocblas \
- host_targ \
- host_teams_numa_affinity \
- icvars-nest \
- icvars-nestF \
- issue_flang_libomp \
- issue_001 \
- issue_002 \
- kmpc_alloc \
- kokkos_log2 \
- launch_latency \
- liba_bundled \
- liba_bundled_cmdline \
- libgomp-292348 \
- longDouble \
- lto_teams \
- ManyKernels \
- map_to_from_prob \
- map_zero_bug \
- MasterBarrier \
- math_exp \
- math_flog \
- math_max \
- math_modff \
- math_pow \
- math_sqrt_float \
- matmul_fun \
- MaxNumThrds \
- mem_foot_print \
- memory_mgmt_routines \
- nativetests \
- nested_loop \
- nested_loop_trunk \
- nested_loop_trunk1 \
- nested_par3 \
- nested_targ \
- nest_call_par2 \
- omp_get_device_num \
- omp_get_initial \
- omp_lock \
- omp_num_teams_SPMD \
- omp_num_teams_generic \
- omp_places \
- omp_target_is \
- omp_targ_err1 \
- omp_wtime \
- pfspecifier \
- pfspecifier_str \
- printf_parallel_for_target \
- red_bug_51 \
- reduce \
- reduction \
- reduction_array_section \
- reduction_issue_16 \
- reduction_team \
- reduction_teams \
- reduction_teams_distribute_parallel \
- reduction_shared_array \
- reduc_map_prob \
- schedule \
- simd \
- simple_ctor \
- slices \
- snap_red \
- stream \
- targ-273742 \
- targc-273738 \
- targ_declare \
- target-in-other-source \
- targets_in_loop \
- task-helper \
- taskwait_prob \
- teams \
- teams_nest \
- teams_notarget \
- teams_notarget_get_num_teams \
- teams_notarget_get_team_num \
- team_prob \
- teams512-info \
- test \
- test_offload_macros \
- thread_limit\
- threads \
- Threads1xxx \
- unique-kernel-name \
- use_device_ptr \
- use_device_addr \
- vasp1 \
- veccopy \
- vmuldemo \
- vmulsum \
- wgs64 \
- bugz-50968 \
- clang-273738 \
- clang-273739 \
- clang-279673 \
- clang-282491-1 \
- clang-282491-3 \
- decl_map_targ \
- flang-273759 \
- flang-273805 \
- flang-273807 \
- flang-274775-critDcmplx \
- flang-274775-redDcmplx \
- flang-274983-2 \
- flang-278342 \
- flang-280342 \
- flang-288452 \
- flang-288613-2 \
- flang-288613-3 \
- flang-288613 \
- flang-288625 \
- flang-303839 \
- flang-cmplx-fib \
- flang-collapseNR \
- lds-prob1 \
- lds-prob2 \
- lds-prob3 \
- reduction_array \
- targc-274983 \
- virtfunc1 \
- clang-282491-2 \
- flang-273760 \
- flang-273959 \
- flang-289039 \
- flang-302472 \
- helloworld%n \
- targc-272328 \
- alloc_cgroup \
- clang-310865 \
- clang-310866 \
- clang-313307_simple_arr \
- clang-313307_simple_spmd \
- clang-323972 \
- clang-gdb1 \
- clang-gfx1030 \
- clang-ifaces \
- clang_udel_saxpy \
- complex-debug \
- complex_reduction \
- const_global_ctor-308039 \
- data-env-scalar-map \
- dominik-AD \
- flang-270386 \
- flang-274775-1 \
- flang-275194 \
- flang-275194-4 \
- flang-288160 \
- flang-288446 \
- flang-303839 \
- flang-307433 \
- flang-307434 \
- flang-308205 \
- flang-312148 \
- flang-312594 \
- flang-313307 \
- flang-313307_simple_arr \
- flang-313307_simple_generic \
- flang-313307_simple_spmd \
- flang-314146 \
- flang-315870 \
- flang-319356 \
- flang-321277 \
- flang-321277-2 \
- flang-321412 \
- flang-321847 \
- flang-322945 \
- flang-325322 \
- flang-ifaces \
- flang-teams1 \
- flang-teams-gdb \
- flang-usm \
- func-ptr \
- leopold-devicePtr \
- loop_order \
- MasterBarrierO0 \
- omp_loop \
- requires_usm \
- stacked-block-size-config \
- targc-generic \
- targc-spmd \
- usm1 \
- usm-globals \
- usm-globals-with-pragma \
- veccopy-ompt-target \
- veccopy-ompt-target-disallow-both \
- veccopy-ompt-target-emi \
- veccopy-ompt-target-emi-map \
- veccopy-ompt-target-emi-tracing \
- veccopy-ompt-target-map \
- veccopy-ompt-target-noinit \
- veccopy-ompt-target-tracing \
- veccopy-ompt-target-wrong-return \
- vmulsum-hsa-stats \
- workgroup_size
-
-
all:
@for test_dir in $(TESTS_DIR); do \
echo; \
diff --git a/test/smoke/Makefile.rules b/test/smoke/Makefile.rules
index 2c4afc1212..c4ed7625de 100644
--- a/test/smoke/Makefile.rules
+++ b/test/smoke/Makefile.rules
@@ -103,6 +103,8 @@ og11run: $(TESTNAME)_og11
$(OG11ENV) ./$(TESTNAME)_og11
gpurun: $(TESTNAME)
$(AOMP)/bin/gpurun $(RUNENV) $(RUNPROF) ./$(TESTNAME) 2>&1 | tee $@.log
+valgrind: $(TESTNAME)
+ $(RUNENV) valgrind $(RUNPROF) ./$(TESTNAME) 2>&1 | tee $@.log
# Just verify output
verify: run
diff --git a/test/smoke/big-jump-loop-1/big_jump_loop_1.c b/test/smoke/big-jump-loop-1/big_jump_loop_1.c
index 443d4e79ec..601f1682d4 100644
--- a/test/smoke/big-jump-loop-1/big_jump_loop_1.c
+++ b/test/smoke/big-jump-loop-1/big_jump_loop_1.c
@@ -36,4 +36,4 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
diff --git a/test/smoke/big-jump-loop-collapse/big_jump_loop_collapse.c b/test/smoke/big-jump-loop-collapse/big_jump_loop_collapse.c
index e2a861e8ca..76f86cbe6b 100644
--- a/test/smoke/big-jump-loop-collapse/big_jump_loop_collapse.c
+++ b/test/smoke/big-jump-loop-collapse/big_jump_loop_collapse.c
@@ -43,4 +43,4 @@ int main(){
}
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7
diff --git a/test/smoke/big-jump-loop-env-vars/big_jump_loop_env_vars.c b/test/smoke/big-jump-loop-env-vars/big_jump_loop_env_vars.c
index 02074b1ef2..bbc94959b3 100644
--- a/test/smoke/big-jump-loop-env-vars/big_jump_loop_env_vars.c
+++ b/test/smoke/big-jump-loop-env-vars/big_jump_loop_env_vars.c
@@ -36,4 +36,4 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args: 6 teamsXthrds:( 50X 100)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args: 6 teamsXthrds:( 50X 100)
diff --git a/test/smoke/big-jump-loop-matmul/big_jump_loop_matmul.c b/test/smoke/big-jump-loop-matmul/big_jump_loop_matmul.c
index 257fc7b378..07735f465d 100644
--- a/test/smoke/big-jump-loop-matmul/big_jump_loop_matmul.c
+++ b/test/smoke/big-jump-loop-matmul/big_jump_loop_matmul.c
@@ -221,11 +221,11 @@ int main(int argc, char **argv) {
return 0;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args:11 teamsXthrds:( 20X 256)
diff --git a/test/smoke/big-jump-loop-split-2/big_jump_loop_split_2.c b/test/smoke/big-jump-loop-split-2/big_jump_loop_split_2.c
index 0b8cbea67a..ce4d5b5eae 100644
--- a/test/smoke/big-jump-loop-split-2/big_jump_loop_split_2.c
+++ b/test/smoke/big-jump-loop-split-2/big_jump_loop_split_2.c
@@ -105,13 +105,13 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:3 ConstWGSize:257 args: 8 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
diff --git a/test/smoke/big-jump-loop-split-3/big_jump_loop_split_3.c b/test/smoke/big-jump-loop-split-3/big_jump_loop_split_3.c
index bbbb901c6f..383d4412c5 100644
--- a/test/smoke/big-jump-loop-split-3/big_jump_loop_split_3.c
+++ b/test/smoke/big-jump-loop-split-3/big_jump_loop_split_3.c
@@ -86,11 +86,11 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:3 ConstWGSize:257 args: 8 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
diff --git a/test/smoke/big-jump-loop-split-4/big_jump_loop_split_4.c b/test/smoke/big-jump-loop-split-4/big_jump_loop_split_4.c
index a847d6d993..d0fd1e3343 100644
--- a/test/smoke/big-jump-loop-split-4/big_jump_loop_split_4.c
+++ b/test/smoke/big-jump-loop-split-4/big_jump_loop_split_4.c
@@ -129,17 +129,17 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 768)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 768)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:3 ConstWGSize:257 args: 8 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:5 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 512)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X1024)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:7 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
diff --git a/test/smoke/c-heatx/Makefile b/test/smoke/c-heatx/Makefile
index b75b8a6f9a..36813ae697 100644
--- a/test/smoke/c-heatx/Makefile
+++ b/test/smoke/c-heatx/Makefile
@@ -13,6 +13,6 @@ CC = $(OMP_BIN) $(VERBOSE)
UNSUPPORTED = ASAN_COMPILE
-export TIMEOUT = 180s
+export TIMEOUT = 240s
include ../Makefile.rules
diff --git a/test/smoke/check_smoke.sh b/test/smoke/check_smoke.sh
index 39f9bfda02..f072e0e13a 100755
--- a/test/smoke/check_smoke.sh
+++ b/test/smoke/check_smoke.sh
@@ -169,6 +169,7 @@ cleanup
if [ "$1" == "-clean" ]; then
for directory in $SMOKE_DIRS; do
+ if [ ! -r $directory/Makefile ]; then continue; fi
pushd $directory > /dev/null
if [ $? -ne 0 ]; then continue; fi
make clean
@@ -246,6 +247,7 @@ if [ "$AOMP_PARALLEL_SMOKE" == 1 ]; then
# Parallel Make
for directory in $SMOKE_DIRS; do
+ if [ ! -r $directory/Makefile ]; then continue; fi
pushd $directory > /dev/null
if [ $? -ne 0 ]; then continue; fi
base=$(basename `pwd`)
@@ -282,6 +284,7 @@ if [ "$AOMP_PARALLEL_SMOKE" == 1 ]; then
while [ $lrun -lt $SMOKE_LRUN ]; do
#---
for directory in $SMOKE_DIRS; do
+ if [ ! -r $directory/Makefile ]; then continue; fi
pushd $directory > /dev/null
if [ $? -ne 0 ]; then continue; fi
base=$(basename `pwd`)
@@ -353,6 +356,11 @@ lrun=0
while [ $lrun -lt $SMOKE_LRUN ]; do
#---
for directory in $SMOKE_DIRS; do
+ if [ ! -r $directory/Makefile ]; then continue; fi
+ if [ "$SKIP_OMPT" == "1" ]; then
+ if [[ $directory =~ "ompt" ]]; then continue; fi
+ if [[ $directory =~ "lib-debug" ]]; then continue; fi
+ fi
pushd $directory > /dev/null
if [ $? -ne 0 ]; then continue; fi
if [ $lrun -eq 0 ]; then
@@ -446,6 +454,7 @@ done
# Print run.log for all tests that need visual inspection
for directory in $SMOKE_DIRS; do
+ if [ ! -r $directory/Makefile ]; then continue; fi
pushd $directory > /dev/null
if [ $? -ne 0 ]; then continue; fi
path=$(pwd)
diff --git a/test/smoke/clang-337336/clang-337336.cpp b/test/smoke/clang-337336/clang-337336.cpp
index 0ef59035a9..ab65c8aed6 100644
--- a/test/smoke/clang-337336/clang-337336.cpp
+++ b/test/smoke/clang-337336/clang-337336.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
#include
diff --git a/test/smoke/clang-392854/Makefile b/test/smoke/clang-392854/Makefile
index e7f5ae2021..02bb983810 100644
--- a/test/smoke/clang-392854/Makefile
+++ b/test/smoke/clang-392854/Makefile
@@ -4,9 +4,10 @@ TESTNAME = clang-392854
TESTSRC_MAIN = clang-392854.cpp
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+RPTH = -Wl,-rpath,$(AOMPHIP)/lib
CLANG = amdclang++
-OMP_FLAGS = -fopenmp -x hip
+OMP_FLAGS = -fopenmp -x hip $(RPTH)
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = HIPCC_VERBOSE=1 $(OMP_BIN) $(VERBOSE)
#-ccc-print-phases
diff --git a/test/smoke/clang-host-targ/Makefile b/test/smoke/clang-host-targ/Makefile
index 3c81ae09ca..d386d81ca6 100644
--- a/test/smoke/clang-host-targ/Makefile
+++ b/test/smoke/clang-host-targ/Makefile
@@ -7,7 +7,7 @@ TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
TARGET = -fopenmp -O3
-TARGET += -fopenmp-targets=x86_64-pc-linux-gnu -Xopenmp-target=x86_64-pc-linux-gnu --march=znver1
+TARGET += -fopenmp-targets=$(CLANG_HOST_TARGET) -Xopenmp-target=$(CLANG_HOST_TARGET) --march=znver1
CLANG ?= clang
OMP_BIN = $(AOMP)/bin/$(CLANG)
diff --git a/test/smoke/clang-host-targ2/Makefile b/test/smoke/clang-host-targ2/Makefile
index 322aefcf82..f69026fbdd 100644
--- a/test/smoke/clang-host-targ2/Makefile
+++ b/test/smoke/clang-host-targ2/Makefile
@@ -11,7 +11,7 @@ $(TESTSRC_AUX): another.c
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
TARGET = -fopenmp -O3
-TARGET += -fopenmp-targets=x86_64-pc-linux-gnu -Xopenmp-target=x86_64-pc-linux-gnu --march=x86
+TARGET += -fopenmp-targets=$(CLANG_HOST_TARGET) -Xopenmp-target=$(CLANG_HOST_TARGET) --march=x86
CLANG ?= clang
OMP_BIN = $(AOMP)/bin/$(CLANG)
diff --git a/test/smoke/clang_udel_saxpy/clang_udel_saxpy.cc b/test/smoke/clang_udel_saxpy/clang_udel_saxpy.cc
index 86b6d161c4..90d4f43d26 100644
--- a/test/smoke/clang_udel_saxpy/clang_udel_saxpy.cc
+++ b/test/smoke/clang_udel_saxpy/clang_udel_saxpy.cc
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
#include
diff --git a/test/smoke/collapse1/collapse1.c b/test/smoke/collapse1/collapse1.c
index eb0846e865..cb454fdd7d 100644
--- a/test/smoke/collapse1/collapse1.c
+++ b/test/smoke/collapse1/collapse1.c
@@ -42,5 +42,5 @@ int main(){
}
}
-/// CHECK: [[DEVID: [0-9]+]] SGN:4
+/// CHECK: [[DEVID: [0-9]+]] SGN:6
diff --git a/test/smoke/double_complex_scalar/Makefile b/test/smoke/double_complex_scalar/Makefile
index 0e09be7ac9..09a0e3f13e 100644
--- a/test/smoke/double_complex_scalar/Makefile
+++ b/test/smoke/double_complex_scalar/Makefile
@@ -6,6 +6,6 @@ TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
CLANG ?= clang++
OMP_BIN = $(AOMP)/bin/$(CLANG)
-CC = $(OMP_BIN) $(VERBOSE) -std=c++11 -latomic
+CC = $(OMP_BIN) $(VERBOSE) -std=c++11
include ../Makefile.rules
diff --git a/test/smoke/double_complex_scalar/double_complex_scalar.cpp b/test/smoke/double_complex_scalar/double_complex_scalar.cpp
index b1ff61bd0c..41a0b9e14e 100644
--- a/test/smoke/double_complex_scalar/double_complex_scalar.cpp
+++ b/test/smoke/double_complex_scalar/double_complex_scalar.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include
diff --git a/test/smoke/flags/Makefile b/test/smoke/flags/Makefile
index 1ee98e0722..b56d4cdbf2 100644
--- a/test/smoke/flags/Makefile
+++ b/test/smoke/flags/Makefile
@@ -15,7 +15,6 @@ all: $(TESTNAME)
$(TESTNAME): $(TESTSRC_ALL)
@./run_options.sh $(AOMP_GPU)
-
compile:
ifdef nvidia_targets
$(CC) $(make_options) $(nvidia_targets) $(march) $(cuda) -o $(TESTNAME)
diff --git a/test/smoke/flags/options.txt b/test/smoke/flags/options.txt
index e5e52487d3..6640093ae0 100644
--- a/test/smoke/flags/options.txt
+++ b/test/smoke/flags/options.txt
@@ -2,7 +2,7 @@ OFFLOAD_DEBUG=1 flags.c -isystem${AOMP}/include -O2 ${AOMP_CPUTARGET} -fopenmp
flags.c -isystem${AOMP}/include -O2 ${AOMP_CPUTARGET} -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=AOMP_GPU_or_auto_detect
flags.c ${AOMP_CPUTARGET} -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=AOMP_GPU_or_auto_detect
flags.c -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -Xopenmp-target=amdgcn-amd-amdhsa -march=AOMP_GPU_or_auto_detect
-flags.c -fopenmp -save-temps ${AOMP_CPUTARGET} -fopenmp-targets=x86_64-pc-linux-gnu
+flags.c -fopenmp -save-temps ${AOMP_CPUTARGET} -fopenmp-targets=HOST_TARGET
flags.c -fopenmp -save-temps ${AOMP_CPUTARGET}
-flags.c -fopenmp -save-temps -fopenmp-targets=x86_64-pc-linux-gnu
+flags.c -fopenmp -save-temps -fopenmp-targets=HOST_TARGET
flags.c -fopenmp -save-temps
diff --git a/test/smoke/flags/run_options.sh b/test/smoke/flags/run_options.sh
index 910dbab2da..ed1726410b 100755
--- a/test/smoke/flags/run_options.sh
+++ b/test/smoke/flags/run_options.sh
@@ -13,6 +13,7 @@ march_regex="(march=AOMP_GPU_or_auto_detect)"
debug_regex="(OFFLOAD_DEBUG=([0-9]))"
# Regex to search for Nvidia cards
target_regex="(-fopenmp-[a-z]*=[a-z,-]*).*(-Xopenmp-[a-z]*=[a-z,-]*)"
+host_target_regex="(fopenmp-targets=HOST_TARGET)"
UNAMEP=`uname -m`
if [[ $UNAMEP == "ppc64le" ]] ; then
@@ -67,11 +68,19 @@ while read -r line; do
echo "$base $test_num: Make Failed" >> ../make-fail.txt
fi
else # Host compilation or run, GPU not detected on input line, no need to pass other variables to make
+ if [[ "$line" =~ $host_target_regex ]]; then
+ march_match=${BASH_REMATCH[1]}
+ # Remove march from command and replace with correct version
+ line=${line/"-$march_match"}
+ CLANG_HOST_TARGET_DIR=$("$AOMP"/bin/clang --version | grep Target: | cut -d" " -f2)
+ host_target_str="-fopenmp-targets=$CLANG_HOST_TARGET_DIR"
+ fi
+
if [[ $1 != "run" ]]; then
- make --no-print-directory make_options="$line" compile
+ make --no-print-directory make_options="$line $host_target_str" compile
fi
if [[ $1 == "run" ]]; then
- make --no-print-directory make_options="$line" test_num=$test_num check
+ make --no-print-directory make_options="$line $host_target_str" test_num=$test_num check
fi
fi
# Host not successfull
diff --git a/test/smoke/hipmalloc-omptarget-multifile/hipMallocOmpTarget1.cpp b/test/smoke/hipmalloc-omptarget-multifile/hipMallocOmpTarget1.cpp
index a85878161a..a70c751bf6 100644
--- a/test/smoke/hipmalloc-omptarget-multifile/hipMallocOmpTarget1.cpp
+++ b/test/smoke/hipmalloc-omptarget-multifile/hipMallocOmpTarget1.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include "hip/hip_runtime.h"
#include "support.h"
diff --git a/test/smoke/hipmalloc-omptarget-multifile/hipMallocOmpTarget2.cpp b/test/smoke/hipmalloc-omptarget-multifile/hipMallocOmpTarget2.cpp
index 062b0d7cde..d8b61c4728 100644
--- a/test/smoke/hipmalloc-omptarget-multifile/hipMallocOmpTarget2.cpp
+++ b/test/smoke/hipmalloc-omptarget-multifile/hipMallocOmpTarget2.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
#include "hip/hip_runtime.h"
#include "support.h"
diff --git a/test/smoke/hipmalloc-omptarget-multifile/main.cpp b/test/smoke/hipmalloc-omptarget-multifile/main.cpp
index 3b7588da19..af9637d1a3 100644
--- a/test/smoke/hipmalloc-omptarget-multifile/main.cpp
+++ b/test/smoke/hipmalloc-omptarget-multifile/main.cpp
@@ -1,3 +1,7 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include
extern int hipMallocOmpTarget1();
diff --git a/test/smoke/hipmalloc-omptarget-multifile/support.cpp b/test/smoke/hipmalloc-omptarget-multifile/support.cpp
index a8e31fd5ce..4128f876fc 100644
--- a/test/smoke/hipmalloc-omptarget-multifile/support.cpp
+++ b/test/smoke/hipmalloc-omptarget-multifile/support.cpp
@@ -1,5 +1,10 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
#include "hip/hip_runtime.h"
#include "support.h"
+#include "stdio.h"
void printHipError(hipError_t error) {
fprintf(stderr,"Hip Error: %s\n", hipGetErrorString(error));
diff --git a/test/smoke/hipmalloc-omptarget-multifile/support.h b/test/smoke/hipmalloc-omptarget-multifile/support.h
index 3e2368e072..a28554c778 100644
--- a/test/smoke/hipmalloc-omptarget-multifile/support.h
+++ b/test/smoke/hipmalloc-omptarget-multifile/support.h
@@ -1,2 +1,6 @@
+// Copyright © Advanced Micro Devices, Inc., or its affiliates.
+//
+// SPDX-License-Identifier: MIT
+
void printHipError(hipError_t error);
bool hipCallSuccessful(hipError_t error);
diff --git a/test/smoke/host_targ/Makefile b/test/smoke/host_targ/Makefile
index 6f661d3c59..14698f3b79 100644
--- a/test/smoke/host_targ/Makefile
+++ b/test/smoke/host_targ/Makefile
@@ -5,7 +5,7 @@ TESTSRC_MAIN = host_targ.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-TARGET = -fopenmp -fopenmp-targets=x86_64-pc-linux-gnu -Xopenmp-target=x86_64-pc-linux-gnu --march=x86 -save-temps
+TARGET = -fopenmp -fopenmp-targets=$(CLANG_HOST_TARGET) -Xopenmp-target=$(CLANG_HOST_TARGET) --march=x86 -save-temps
CLANG ?= clang
OMP_BIN = $(AOMP)/bin/$(CLANG)
diff --git a/test/smoke/issue_002/issue_002.fail b/test/smoke/issue_002/issue_002.fail
index f6a69c407b..12068f48ee 100644
--- a/test/smoke/issue_002/issue_002.fail
+++ b/test/smoke/issue_002/issue_002.fail
@@ -45,7 +45,7 @@ HCC clang version 6.0.0 (based on HCC 0.3-6 )
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /srv/akasauro/git/hcc2/install/llvm/bin
-clang-6.0: note: diagnostic msg: PLEASE open an issue in to https://github.com/ROCm-Developer-Tools/hcc2/ and include the crash backtrace, preprocessed source, and associated run script.
+clang-6.0: note: diagnostic msg: PLEASE open an issue in to https://github.com/ROCm/hcc2/ and include the crash backtrace, preprocessed source, and associated run script.
clang-6.0: note: diagnostic msg: Error generating preprocessed source(s).
../Makefile.rules:9: recipe for target 'issue_002' failed
make: *** [issue_002] Error 254
diff --git a/test/smoke/liba_bundled_cmdline/Makefile b/test/smoke/liba_bundled_cmdline/Makefile
index 0c02945b28..3ddc6ba638 100644
--- a/test/smoke/liba_bundled_cmdline/Makefile
+++ b/test/smoke/liba_bundled_cmdline/Makefile
@@ -13,7 +13,7 @@ EXTRA_OMP_FLAGS =
CC = $(AOMP)/bin/clang
UNAMEP = $(shell uname -m)
-HOST_TARGET = $(UNAMEP)-pc-linux-gnu
+HOST_TARGET = $(CLANG_HOST_TARGET)
EXTRA_CFLAGS = -target $(HOST_TARGET)
ifeq (sm_,$(findstring sm_,$(AOMP_GPU)))
diff --git a/test/smoke/libgomp-292348/Makefile b/test/smoke/libgomp-292348/Makefile
index 0d1e6c8c25..556e51a03e 100644
--- a/test/smoke/libgomp-292348/Makefile
+++ b/test/smoke/libgomp-292348/Makefile
@@ -4,9 +4,10 @@ TESTNAME = libgomp-292348
TESTSRC_MAIN = libgomp-292348.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
+RPTH = -Wl,-rpath,$(AOMPHIP)/lib
CLANG ?= hipcc
-OMP_FLAGS = -lgomp
+OMP_FLAGS = -lgomp $(RPTH)
CFLAGS = -g -O0 -m64 -fopenmp -lgomp -lstdc++
ifeq ($(EPSDB),1)
diff --git a/test/smoke/loop-dir-1/loop_dir_1.c b/test/smoke/loop-dir-1/loop_dir_1.c
index dd12b6919b..26c28c5142 100644
--- a/test/smoke/loop-dir-1/loop_dir_1.c
+++ b/test/smoke/loop-dir-1/loop_dir_1.c
@@ -78,9 +78,9 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
diff --git a/test/smoke/nested_par3/nested_par3.c b/test/smoke/nested_par3/nested_par3.c
index 5a093f0968..e20be089fa 100644
--- a/test/smoke/nested_par3/nested_par3.c
+++ b/test/smoke/nested_par3/nested_par3.c
@@ -17,7 +17,7 @@ int main (void)
for (unsigned int l = 0; l < cmom-1; l++) {
int a = 0;
for (int ii = 0; ii < N+2; ii++) {
- #pragma omp parallel for reduction(+:a)
+ #pragma omp parallel for reduction(+:a)
for (int i = 0; i < N; i++) {
a += i;
}
@@ -34,7 +34,8 @@ int main (void)
return 1;
}
aa = 0;
-#pragma omp target teams distribute num_teams(nxyz) thread_limit(4) map(tofrom:aa)
+#if 0
+ #pragma omp target teams distribute num_teams(nxyz) thread_limit(4) map(tofrom:aa)
for (int gid = 0; gid < nxyz; gid++) {
for (unsigned int g = 0; g < ng; g++) {
for (unsigned int l = 0; l < cmom-1; l++) {
@@ -106,5 +107,6 @@ int main (void)
fprintf(stderr, "Failed %ld\n",aa);
return 1;
}
+ #endif
return 0;
}
diff --git a/test/smoke/no-loop-8/no_loop_8.c b/test/smoke/no-loop-8/no_loop_8.c
index e4e73d1eef..e5abc1ed27 100644
--- a/test/smoke/no-loop-8/no_loop_8.c
+++ b/test/smoke/no-loop-8/no_loop_8.c
@@ -48,6 +48,6 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
diff --git a/test/smoke/no-loop-sched/no_loop_sched.c b/test/smoke/no-loop-sched/no_loop_sched.c
index c169d9fda0..99972c13d4 100644
--- a/test/smoke/no-loop-sched/no_loop_sched.c
+++ b/test/smoke/no-loop-sched/no_loop_sched.c
@@ -72,10 +72,10 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:2
diff --git a/test/smoke/no-loop-split-1/no_loop_split_1.c b/test/smoke/no-loop-split-1/no_loop_split_1.c
index e42df250fa..e3849f1811 100644
--- a/test/smoke/no-loop-split-1/no_loop_split_1.c
+++ b/test/smoke/no-loop-split-1/no_loop_split_1.c
@@ -50,6 +50,6 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
diff --git a/test/smoke/no-loop-split-2/no_loop_split_2.c b/test/smoke/no-loop-split-2/no_loop_split_2.c
index 3719a9b918..5a18cacf73 100644
--- a/test/smoke/no-loop-split-2/no_loop_split_2.c
+++ b/test/smoke/no-loop-split-2/no_loop_split_2.c
@@ -97,13 +97,13 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:100 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 100)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:100 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 100)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:3 ConstWGSize:257 args: 8 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:128 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:64 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:256 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
diff --git a/test/smoke/no-loop-split-3/no_loop_split_3.c b/test/smoke/no-loop-split-3/no_loop_split_3.c
index 7ddfe46902..a759131c1c 100644
--- a/test/smoke/no-loop-split-3/no_loop_split_3.c
+++ b/test/smoke/no-loop-split-3/no_loop_split_3.c
@@ -97,13 +97,13 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 100)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 100)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:3 ConstWGSize:257 args: 8 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 256)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 128)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 64)
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6 ConstWGSize:1024 args: 6 teamsXthrds:([[S:[ ]*]][[NUM_TEAMS:[0-9]+]]X 32)
diff --git a/test/smoke/no-loop-split-with-inner-private-clause/no_loop_split_with_inner_private_clause.c b/test/smoke/no-loop-split-with-inner-private-clause/no_loop_split_with_inner_private_clause.c
index f40b9d12a0..3ed8678215 100644
--- a/test/smoke/no-loop-split-with-inner-private-clause/no_loop_split_with_inner_private_clause.c
+++ b/test/smoke/no-loop-split-with-inner-private-clause/no_loop_split_with_inner_private_clause.c
@@ -30,4 +30,4 @@ float matE[N][N];
return 0;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
diff --git a/test/smoke/no-loop-with-continue/no_loop_with_continue.c b/test/smoke/no-loop-with-continue/no_loop_with_continue.c
index c37e5153d1..ad713ca6cc 100644
--- a/test/smoke/no-loop-with-continue/no_loop_with_continue.c
+++ b/test/smoke/no-loop-with-continue/no_loop_with_continue.c
@@ -48,5 +48,5 @@ int main()
return rc;
}
-/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:4
+/// CHECK: DEVID:[[S:[ ]*]][[DEVID:[0-9]+]] SGN:6
diff --git a/test/smoke/stacked-block-size-config/stacked_block_size_config.c b/test/smoke/stacked-block-size-config/stacked_block_size_config.c
index 934d39c4b1..52f4f6e27a 100644
--- a/test/smoke/stacked-block-size-config/stacked_block_size_config.c
+++ b/test/smoke/stacked-block-size-config/stacked_block_size_config.c
@@ -32,8 +32,8 @@ int main() {
free(x);
free(y);
- /// CHECK: DEVID:{{.*}}SGN:5 ConstWGSize:128 args: 2 teamsXthrds:({{.*}}X 16) {{.*}}tripcount:15000 rpc:0
- /// CHECK: DEVID:{{.*}}SGN:5 ConstWGSize:128 args: 2 teamsXthrds:({{.*}}X 128) {{.*}}tripcount:1000000 rpc:0
+ /// CHECK: DEVID:{{.*}}SGN:7 ConstWGSize:128 args: 2 teamsXthrds:({{.*}}X 16) {{.*}}tripcount:15000 rpc:0
+ /// CHECK: DEVID:{{.*}}SGN:7 ConstWGSize:128 args: 2 teamsXthrds:({{.*}}X 128) {{.*}}tripcount:1000000 rpc:0
/// CHECK: x[3] = 4
/// CHECK: y[500000] = 8
diff --git a/test/smoke/target-shared-variables/README.md b/test/smoke/target-shared-variables/README.md
index 0a5688f8e4..b3df19c310 100644
--- a/test/smoke/target-shared-variables/README.md
+++ b/test/smoke/target-shared-variables/README.md
@@ -8,9 +8,9 @@ When deglobalization is active the calls to `__kmpc_alloc_shared()` are being op
## LDS Reporting
-When enabling `LIBOMPTARGET_KERNEL_TRACE=1` both kernels are reported as no-loop (SGN:4) but the first kernel reports 0B for LDS while the second kernel reports 1540B for LDS. Upon inspecting the device assembly the code emitted for the `__kmpc_alloc_shared()` instruction (in all its locations) looks similar.
+When enabling `LIBOMPTARGET_KERNEL_TRACE=1` both kernels are reported as no-loop (SGN:6) but the first kernel reports 0B for LDS while the second kernel reports 1540B for LDS. Upon inspecting the device assembly the code emitted for the `__kmpc_alloc_shared()` instruction (in all its locations) looks similar.
```
-DEVID: 0 SGN:4 ConstWGSize:256 args: 3 teamsXthrds:( 79X 256) reqd:( 0X 0) lds_usage:0B sgpr_count:9 vgpr_count:14 sgpr_spill_count:0 vgpr_spill_count:0 tripcount:20000 rpc:1 n:__omp_offloading_fd00_26c6a13_main_l56
-DEVID: 0 SGN:4 ConstWGSize:256 args: 3 teamsXthrds:( 79X 256) reqd:( 0X 0) lds_usage:1540B sgpr_count:108 vgpr_count:47 sgpr_spill_count:6 vgpr_spill_count:0 tripcount:20000 rpc:1 n:__omp_offloading_fd00_26c6a13_main_l67
+DEVID: 0 SGN:6 ConstWGSize:256 args: 3 teamsXthrds:( 79X 256) reqd:( 0X 0) lds_usage:0B sgpr_count:9 vgpr_count:14 sgpr_spill_count:0 vgpr_spill_count:0 tripcount:20000 rpc:1 n:__omp_offloading_fd00_26c6a13_main_l56
+DEVID: 0 SGN:6 ConstWGSize:256 args: 3 teamsXthrds:( 79X 256) reqd:( 0X 0) lds_usage:1540B sgpr_count:108 vgpr_count:47 sgpr_spill_count:6 vgpr_spill_count:0 tripcount:20000 rpc:1 n:__omp_offloading_fd00_26c6a13_main_l67
```
\ No newline at end of file
diff --git a/test/smoke/team_prob/team_prob.cpp b/test/smoke/team_prob/team_prob.cpp
index c3d926afb7..ef2a4e04ee 100644
--- a/test/smoke/team_prob/team_prob.cpp
+++ b/test/smoke/team_prob/team_prob.cpp
@@ -4,7 +4,7 @@
/// REQUIRES: amdgpu-registered-target
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host.bc
-// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | $FILECHECK %s
#ifndef HEADER
#define HEADER
diff --git a/test/smoke/usm-globals/Makefile b/test/smoke/usm-globals/Makefile
index ca5ea015cf..1c29441066 100644
--- a/test/smoke/usm-globals/Makefile
+++ b/test/smoke/usm-globals/Makefile
@@ -13,7 +13,7 @@ CLANG = clang++
OMP_BIN = $(AOMP)/bin/$(CLANG)
CC = $(OMP_BIN) $(VERBOSE)
-SUPPORTED = gfx90a,gfx940,gfx941,gfx942
+SUPPORTED = $(SUPPORTS_USM)
#-ccc-print-phases
#"-\#\#\#"
diff --git a/test/smoke/vasp1/.vasp1.cpp.swp b/test/smoke/vasp1/.vasp1.cpp.swp
deleted file mode 100644
index 71ccdb5f37..0000000000
Binary files a/test/smoke/vasp1/.vasp1.cpp.swp and /dev/null differ
diff --git a/test/smoke/veccopy-ompt-target-emi-tracing/Makefile b/test/smoke/veccopy-ompt-target-emi-tracing/Makefile
deleted file mode 100644
index e41ae16f3f..0000000000
--- a/test/smoke/veccopy-ompt-target-emi-tracing/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-include ../../Makefile.defs
-
-TESTNAME = veccopy-ompt-target-emi-tracing
-TESTSRC_MAIN = veccopy-ompt-target-emi-tracing.cpp
-TESTSRC_AUX =
-TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-
-RUNCMD = ./$(TESTNAME) | $(FILECHECK) $(TESTSRC_MAIN)
-
-CLANG ?= clang++
-OMP_BIN = $(AOMP)/bin/$(CLANG)
-CC = $(OMP_BIN) $(VERBOSE)
-#-ccc-print-phases
-#"-\#\#\#"
-
-include ../Makefile.rules
diff --git a/test/smoke/veccopy-ompt-target-emi-tracing/callbacks.h b/test/smoke/veccopy-ompt-target-emi-tracing/callbacks.h
deleted file mode 100644
index d05f05a4a4..0000000000
--- a/test/smoke/veccopy-ompt-target-emi-tracing/callbacks.h
+++ /dev/null
@@ -1,332 +0,0 @@
-#include
-#include
-#include
-
-#define EMI 1
-
-// Tool related code below
-#include
-
-// From openmp/runtime/test/ompt/callback.h
-#define register_ompt_callback_t(name, type) \
- do { \
- type f_##name = &on_##name; \
- if (ompt_set_callback(name, (ompt_callback_t)f_##name) == ompt_set_never) \
- printf("0: Could not register callback '" #name "'\n"); \
- } while (0)
-
-#define register_ompt_callback(name) register_ompt_callback_t(name, name##_t)
-
-#define OMPT_BUFFER_REQUEST_SIZE 256
-
-ompt_id_t next_op_id = 0x8000000000000001;
-
-// OMPT entry point handles
-static ompt_set_callback_t ompt_set_callback = 0;
-static ompt_set_trace_ompt_t ompt_set_trace_ompt = 0;
-static ompt_start_trace_t ompt_start_trace = 0;
-static ompt_flush_trace_t ompt_flush_trace = 0;
-static ompt_stop_trace_t ompt_stop_trace = 0;
-static ompt_get_record_ompt_t ompt_get_record_ompt = 0;
-static ompt_advance_buffer_cursor_t ompt_advance_buffer_cursor = 0;
-
-// Map of devices traced
-typedef std::unordered_set DeviceMap_t;
-typedef std::unique_ptr DeviceMapPtr_t;
-extern DeviceMapPtr_t DeviceMapPtr;
-
-// Utilities
-static void print_record_ompt(ompt_record_ompt_t *rec) {
- if (rec == NULL)
- return;
-
- switch (rec->type) {
- case ompt_callback_target:
- case ompt_callback_target_emi: {
- ompt_record_target_t target_rec = rec->record.target;
- printf("rec=%p type=%d (Target task) time=%lu thread_id=%lu "
- "target_id=0x%lx kind=%d endpoint=%d device=%d task_id=%lu "
- "codeptr=%p\n",
- rec, rec->type, rec->time, rec->thread_id, rec->target_id,
- target_rec.kind, target_rec.endpoint, target_rec.device_num,
- target_rec.task_id, target_rec.codeptr_ra);
- break;
- }
- case ompt_callback_target_data_op:
- case ompt_callback_target_data_op_emi: {
- ompt_record_target_data_op_t target_data_op_rec =
- rec->record.target_data_op;
- printf("rec=%p type=%d (Target data op) time=%lu thread_id=%lu "
- "target_id=0x%lx host_op_id=0x%lx optype=%d "
- "src_addr=%p src_device=%d dest_addr=%p dest_device=%d bytes=%lu "
- "end_time=%lu duration=%lu ns codeptr=%p\n",
- rec, rec->type, rec->time, rec->thread_id, rec->target_id,
- target_data_op_rec.host_op_id, target_data_op_rec.optype,
- target_data_op_rec.src_addr, target_data_op_rec.src_device_num,
- target_data_op_rec.dest_addr, target_data_op_rec.dest_device_num,
- target_data_op_rec.bytes, target_data_op_rec.end_time,
- target_data_op_rec.end_time - rec->time,
- target_data_op_rec.codeptr_ra);
- break;
- }
- case ompt_callback_target_submit:
- case ompt_callback_target_submit_emi: {
- ompt_record_target_kernel_t target_kernel_rec = rec->record.target_kernel;
- printf("rec=%p type=%d (Target kernel) time=%lu thread_id=%lu "
- "target_id=0x%lx host_op_id=0x%lx requested_num_teams=%u "
- "granted_num_teams=%u end_time=%lu duration=%lu ns\n",
- rec, rec->type, rec->time, rec->thread_id, rec->target_id,
- target_kernel_rec.host_op_id, target_kernel_rec.requested_num_teams,
- target_kernel_rec.granted_num_teams, target_kernel_rec.end_time,
- target_kernel_rec.end_time - rec->time);
- break;
- }
- default:
- assert(0);
- break;
- }
-}
-
-static void delete_buffer_ompt(ompt_buffer_t *buffer) {
- free(buffer);
- printf("Deallocated %p\n", buffer);
-}
-
-// OMPT callbacks
-
-// Trace record callbacks
-static void on_ompt_callback_buffer_request(int device_num,
- ompt_buffer_t **buffer,
- size_t *bytes) {
- *bytes = OMPT_BUFFER_REQUEST_SIZE;
- *buffer = malloc(*bytes);
- printf("Allocated %lu bytes at %p in buffer request callback\n", *bytes,
- *buffer);
-}
-
-static void on_ompt_callback_buffer_complete(
- int device_num, ompt_buffer_t *buffer,
- size_t bytes, /* bytes returned in this callback */
- ompt_buffer_cursor_t begin, int buffer_owned) {
- printf("Executing buffer complete callback: %d %p %lu %p %d\n", device_num,
- buffer, bytes, (void *)begin, buffer_owned);
-
- int status = 1;
- ompt_buffer_cursor_t current = begin;
- while (status) {
- ompt_record_ompt_t *rec = ompt_get_record_ompt(buffer, current);
- print_record_ompt(rec);
- status = ompt_advance_buffer_cursor(NULL, /* TODO device */
- buffer, bytes, current, ¤t);
- }
- if (buffer_owned)
- delete_buffer_ompt(buffer);
-}
-
-static ompt_set_result_t set_trace_ompt(ompt_device_t *Device) {
- if (!ompt_set_trace_ompt)
- return ompt_set_error;
-
-#if EMI
- ompt_set_trace_ompt(Device, 1, ompt_callback_target_emi);
- ompt_set_trace_ompt(Device, 1, ompt_callback_target_data_op_emi);
- ompt_set_trace_ompt(Device, 1, ompt_callback_target_submit_emi);
-#else
- ompt_set_trace_ompt(Device, 1, ompt_callback_target);
- ompt_set_trace_ompt(Device, 1, ompt_callback_target_data_op);
- ompt_set_trace_ompt(Device, 1, ompt_callback_target_submit);
-#endif
-
- return ompt_set_always;
-}
-
-static int start_trace(int device_num, ompt_device_t *Device) {
- if (!ompt_start_trace)
- return 0;
-
- // This device will be traced.
- assert(DeviceMapPtr->find(Device) == DeviceMapPtr->end() &&
- "Device already present in the map");
- DeviceMapPtr->insert(Device);
-
- return ompt_start_trace(Device, &on_ompt_callback_buffer_request,
- &on_ompt_callback_buffer_complete);
-}
-
-static int flush_trace(ompt_device_t *Device) {
- if (!ompt_flush_trace)
- return 0;
- return ompt_flush_trace(Device);
-}
-
-static int stop_trace(ompt_device_t *Device) {
- if (!ompt_stop_trace)
- return 0;
- return ompt_stop_trace(Device);
-}
-
-// Synchronous callbacks
-static void on_ompt_callback_device_initialize(int device_num, const char *type,
- ompt_device_t *device,
- ompt_function_lookup_t lookup,
- const char *documentation) {
- printf("Callback Init: device_num=%d type=%s device=%p lookup=%p doc=%p\n",
- device_num, type, device, lookup, documentation);
- if (!lookup) {
- printf("Trace collection disabled on device %d\n", device_num);
- return;
- }
-
- ompt_set_trace_ompt = (ompt_set_trace_ompt_t)lookup("ompt_set_trace_ompt");
- ompt_start_trace = (ompt_start_trace_t)lookup("ompt_start_trace");
- ompt_flush_trace = (ompt_flush_trace_t)lookup("ompt_flush_trace");
- ompt_stop_trace = (ompt_stop_trace_t)lookup("ompt_stop_trace");
- ompt_get_record_ompt = (ompt_get_record_ompt_t)lookup("ompt_get_record_ompt");
- ompt_advance_buffer_cursor =
- (ompt_advance_buffer_cursor_t)lookup("ompt_advance_buffer_cursor");
-
- // DeviceMap must be initialized only once. Ensure this logic does not
- // depend on external data structures because this init function may be
- // called before main.
- static bool IsDeviceMapInitialized = false;
- if (!IsDeviceMapInitialized) {
- DeviceMapPtr = std::make_unique();
- IsDeviceMapInitialized = true;
- }
-
- set_trace_ompt(device);
-
- // In many scenarios, this will be a good place to start the
- // trace. If start_trace is called from the main program before this
- // callback is dispatched, the start_trace handle will be null. This
- // is because this device_init callback is invoked during the first
- // target construct implementation.
-
- start_trace(device_num, device);
-}
-
-static void on_ompt_callback_device_finalize(int device_num) {
- printf("Callback Fini: device_num=%d\n", device_num);
-}
-
-static void on_ompt_callback_device_load(int device_num, const char *filename,
- int64_t offset_in_file,
- void *vma_in_file, size_t bytes,
- void *host_addr, void *device_addr,
- uint64_t module_id) {
- printf("Callback Load: device_num:%d filename:%s host_adddr:%p device_addr:%p"
- " bytes:%lu\n",
- device_num, filename, host_addr, device_addr, bytes);
-}
-
-static void on_ompt_callback_target_data_op(
- ompt_id_t target_id, ompt_id_t host_op_id, ompt_target_data_op_t optype,
- void *src_addr, int src_device_num, void *dest_addr, int dest_device_num,
- size_t bytes, const void *codeptr_ra) {
- printf(" Callback DataOp: host_op_id=%lu optype=%d src=%p src_device_num=%d "
- "dest=%p dest_device_num=%d bytes=%lu code=%p\n",
- host_op_id, optype, src_addr, src_device_num, dest_addr,
- dest_device_num, bytes, codeptr_ra);
-}
-
-static void on_ompt_callback_target_data_op_emi(
- ompt_scope_endpoint_t endpoint, ompt_data_t *target_task_data,
- ompt_data_t *target_data, ompt_id_t *host_op_id,
- ompt_target_data_op_t optype, void *src_addr, int src_device_num,
- void *dest_addr, int dest_device_num, size_t bytes,
- const void *codeptr_ra) {
- if (endpoint == ompt_scope_begin)
- *host_op_id = next_op_id++;
- // target_task_data may be null, avoid dereferencing it
- uint64_t target_task_data_value =
- (target_task_data) ? target_task_data->value : 0;
- printf(" Callback DataOp EMI: endpoint=%d optype=%d target_task_data=%p "
- "(0x%lx) target_data=%p (0x%lx) host_op_id=%p (0x%lx) src=%p "
- "src_device_num=%d dest=%p dest_device_num=%d bytes=%lu code=%p\n",
- endpoint, optype, target_task_data, target_task_data_value,
- target_data, target_data->value, host_op_id, *host_op_id, src_addr,
- src_device_num, dest_addr, dest_device_num, bytes, codeptr_ra);
-}
-
-static void on_ompt_callback_target(ompt_target_t kind,
- ompt_scope_endpoint_t endpoint,
- int device_num, ompt_data_t *task_data,
- ompt_id_t target_id,
- const void *codeptr_ra) {
- printf("Callback Target: kind=%d endpoint=%d device_num=%d target_id=%lu "
- "code=%p\n",
- kind, endpoint, device_num, target_id, codeptr_ra);
-}
-
-static void on_ompt_callback_target_emi(ompt_target_t kind,
- ompt_scope_endpoint_t endpoint,
- int device_num, ompt_data_t *task_data,
- ompt_data_t *target_task_data,
- ompt_data_t *target_data,
- const void *codeptr_ra) {
- if (endpoint == ompt_scope_begin)
- target_data->value = next_op_id++;
- // target_task_data may be null, avoid dereferencing it
- uint64_t target_task_data_value =
- (target_task_data) ? target_task_data->value : 0;
- printf("Callback Target EMI: kind=%d endpoint=%d device_num=%d task_data=%p "
- "(0x%lx) target_task_data=%p (0x%lx) target_data=%p (0x%lx) code=%p\n",
- kind, endpoint, device_num, task_data, task_data->value,
- target_task_data, target_task_data_value, target_data,
- target_data->value, codeptr_ra);
-}
-
-static void on_ompt_callback_target_submit(ompt_id_t target_id,
- ompt_id_t host_op_id,
- unsigned int requested_num_teams) {
- printf(" Callback Submit: target_id=%lu host_op_id=%lu req_num_teams=%d\n",
- target_id, host_op_id, requested_num_teams);
-}
-
-static void on_ompt_callback_target_submit_emi(
- ompt_scope_endpoint_t endpoint, ompt_data_t *target_data,
- ompt_id_t *host_op_id, unsigned int requested_num_teams) {
- printf(" Callback Submit EMI: endpoint=%d req_num_teams=%d target_data=%p "
- "(0x%lx) host_op_id=%p (0x%lx)\n",
- endpoint, requested_num_teams, target_data, target_data->value,
- host_op_id, *host_op_id);
-}
-
-// Init functions
-int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
- ompt_data_t *tool_data) {
- ompt_set_callback = (ompt_set_callback_t)lookup("ompt_set_callback");
-
- if (!ompt_set_callback)
- return 0; // failed
-
- register_ompt_callback(ompt_callback_device_initialize);
- register_ompt_callback(ompt_callback_device_finalize);
- register_ompt_callback(ompt_callback_device_load);
-#if EMI
- register_ompt_callback(ompt_callback_target_data_op_emi);
- register_ompt_callback(ompt_callback_target_emi);
- register_ompt_callback(ompt_callback_target_submit_emi);
-#else
- register_ompt_callback(ompt_callback_target_data_op);
- register_ompt_callback(ompt_callback_target);
- register_ompt_callback(ompt_callback_target_submit);
-#endif
-
- return 1; // success
-}
-
-void ompt_finalize(ompt_data_t *tool_data) {}
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
- const char *runtime_version) {
- static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,
- &ompt_finalize, 0};
- return &ompt_start_tool_result;
-}
-#ifdef __cplusplus
-}
-#endif
diff --git a/test/smoke/veccopy-ompt-target-emi-tracing/veccopy-ompt-target-emi-tracing.cpp b/test/smoke/veccopy-ompt-target-emi-tracing/veccopy-ompt-target-emi-tracing.cpp
deleted file mode 100644
index 4f4255b986..0000000000
--- a/test/smoke/veccopy-ompt-target-emi-tracing/veccopy-ompt-target-emi-tracing.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-#include
-#include
-#include
-
-#include "callbacks.h"
-
-// Map of devices traced
-DeviceMapPtr_t DeviceMapPtr;
-
-int main() {
- int N = 100000;
-
- int a[N];
- int b[N];
-
- int i;
-
- for (i = 0; i < N; i++)
- a[i] = 0;
-
- for (i = 0; i < N; i++)
- b[i] = i;
-
-#pragma omp target parallel for
- {
- for (int j = 0; j < N; j++)
- a[j] = b[j];
- }
-
- for (auto Dev : *DeviceMapPtr)
- flush_trace(Dev);
-
-#pragma omp target teams distribute parallel for
- {
- for (int j = 0; j < N; j++)
- a[j] = b[j];
- }
-
- int rc = 0;
- for (i = 0; i < N; i++)
- if (a[i] != b[i]) {
- rc++;
- printf("Wrong value: a[%d]=%d\n", i, a[i]);
- }
-
- if (!rc)
- printf("Success\n");
-
- return rc;
-}
-
-// clang-format off
-
-/// CHECK-NOT: host_op_id=0x0
-
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_01:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_02:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_03:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_04:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_05:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_06:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_07:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_08:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_09:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_10:0x[0-f]+]] in buffer request callback
-/// CHECK-DAG: Allocated {{[0-9]+}} bytes at [[ADDRX_11:0x[0-f]+]] in buffer request callback
-
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_01]] {{[0-9]+}} [[ADDRX_01]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_02]] {{[0-9]+}} [[ADDRX_02]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_03]] {{[0-9]+}} [[ADDRX_03]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_04]] {{[0-9]+}} [[ADDRX_04]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_05]] {{[0-9]+}} [[ADDRX_05]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_06]] {{[0-9]+}} [[ADDRX_06]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_07]] {{[0-9]+}} [[ADDRX_07]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_08]] {{[0-9]+}} [[ADDRX_08]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_09]] {{[0-9]+}} [[ADDRX_09]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_10]] {{[0-9]+}} [[ADDRX_10]] {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_11]] {{[0-9]+}} [[ADDRX_11]] {{[0-9]+}}
-
-// Note: Split checks for record address and content. That way we do not imply
-// any order. Records 01-06 and 12-17 occur interleaved and belong to the
-// first target region. 07-11 occur interleaved with 18-22 and belong to
-// the second target region.
-/// CHECK-DAG: rec=[[ADDRX_01]]
-/// CHECK-DAG: rec=[[ADDRX_02]]
-/// CHECK-DAG: rec=[[ADDRX_03]]
-/// CHECK-DAG: rec=[[ADDRX_04]]
-/// CHECK-DAG: rec=[[ADDRX_05]]
-/// CHECK-DAG: rec=[[ADDRX_06]]
-/// CHECK-DAG: rec=[[ADDRX_07]]
-/// CHECK-DAG: rec=[[ADDRX_08]]
-/// CHECK-DAG: rec=[[ADDRX_09]]
-/// CHECK-DAG: rec=[[ADDRX_10]]
-/// CHECK-DAG: rec=[[ADDRX_11]]
-
-/// CHECK-DAG: type=8 (Target task) {{.+}} kind=1 endpoint=1
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=1
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=2
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=1
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=2
-/// CHECK-DAG: type=10 (Target kernel) {{.+}} requested_num_teams=1
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=3
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=3
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=4
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=4
-/// CHECK-DAG: type=8 (Target task) {{.+}} kind=1 endpoint=2
-
-// Note: These addresses will only occur once. They are only captured to
-// indicate their existence.
-/// CHECK-DAG: rec=[[ADDRX_12:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_13:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_14:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_15:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_16:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_17:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_18:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_19:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_20:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_21:0x[0-f]+]]
-/// CHECK-DAG: rec=[[ADDRX_22:0x[0-f]+]]
-
-/// CHECK-DAG: type=8 (Target task) {{.+}} kind=1 endpoint=1
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=1
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=2
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=1
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=2
-/// CHECK-DAG: type=10 (Target kernel) {{.+}} requested_num_teams=0
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=3
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=3
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=4
-/// CHECK-DAG: type=9 (Target data op) {{.+}} optype=4
-/// CHECK-DAG: type=8 (Target task) {{.+}} kind=1 endpoint=2
-
-// Note: ADDRX_11 may not trigger a final callback.
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_01]] {{[0-9]+}} (nil) {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_02]] {{[0-9]+}} (nil) {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_03]] {{[0-9]+}} (nil) {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_04]] {{[0-9]+}} (nil) {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_05]] {{[0-9]+}} (nil) {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_06]] {{[0-9]+}} (nil) {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_07]] {{[0-9]+}} (nil) {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_08]] {{[0-9]+}} (nil) {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_09]] {{[0-9]+}} (nil) {{[0-9]+}}
-/// CHECK-DAG: Executing buffer complete callback: {{[0-9]+}} [[ADDRX_10]] {{[0-9]+}} (nil) {{[0-9]+}}
-
-// Note: ADDRX_11 may not be deallocated.
-/// CHECK-DAG: Deallocated [[ADDRX_01]]
-/// CHECK-DAG: Deallocated [[ADDRX_02]]
-/// CHECK-DAG: Deallocated [[ADDRX_03]]
-/// CHECK-DAG: Deallocated [[ADDRX_04]]
-/// CHECK-DAG: Deallocated [[ADDRX_05]]
-/// CHECK-DAG: Deallocated [[ADDRX_06]]
-/// CHECK-DAG: Deallocated [[ADDRX_07]]
-/// CHECK-DAG: Deallocated [[ADDRX_08]]
-/// CHECK-DAG: Deallocated [[ADDRX_09]]
-/// CHECK-DAG: Deallocated [[ADDRX_10]]
-
-/// CHECK-DAG: Success
-
-/// CHECK-NOT: rec=
-/// CHECK-NOT: host_op_id=0x0
diff --git a/test/smoke/xteam-red-cmdline-option1/Makefile b/test/smoke/xteam-red-cmdline-option1/Makefile
index 8498a7231b..3ec91db265 100644
--- a/test/smoke/xteam-red-cmdline-option1/Makefile
+++ b/test/smoke/xteam-red-cmdline-option1/Makefile
@@ -4,7 +4,7 @@ TESTNAME = xteam_red_cmdline_option1
TESTSRC_MAIN = xteam_red_cmdline_option1.c
TESTSRC_AUX =
TESTSRC_ALL = $(TESTSRC_MAIN) $(TESTSRC_AUX)
-RUNENV += LIBOMPTARGET_KERNEL_TRACE=1
+RUNENV += LIBOMPTARGET_KERNEL_TRACE=1 LIBOMPTARGET_AMDGPU_XTEAM_BLOCKSIZE=512
RUNCMD = ./$(TESTNAME) 2>&1 | $(FILECHECK) $(TESTSRC_MAIN)
diff --git a/test/usm/Makefile b/test/usm/Makefile
index 61f4c1aff1..afad58586a 100644
--- a/test/usm/Makefile
+++ b/test/usm/Makefile
@@ -1,8 +1,6 @@
#include ../Makefile.defs
-TESTS_DIR = \
- OmpHipMallocManaged \
- flang-off-arch-xnack
+TESTS_DIR=$(shell find . -maxdepth 1 -name \* -type d -and -not -name .)
all:
@for test_dir in $(TESTS_DIR); do \
diff --git a/trunk/README.md b/trunk/README.md
index c7ebc790ee..f2c72d10f6 100644
--- a/trunk/README.md
+++ b/trunk/README.md
@@ -1,9 +1,9 @@
-# How to Build the _trunk21_ Compiler
+# How to Build the _trunk23_ Compiler
Add the following to your environment in either `.bash_profile` or `.bashrc`:
``` bash
-export TRUNK_REPOS=$HOME/git/trunk21.0
+export TRUNK_REPOS=$HOME/git/trunk23.0
```
Or set `TRUNK_REPOS` to a location with a fast file system. Then log in again
@@ -32,17 +32,17 @@ override.
## TRUNK_REPOS
-See the discussion above for building _trunk21_ on the use of `TRUNK_REPOS`.
+See the discussion above for building _trunk23_ on the use of `TRUNK_REPOS`.
## TRUNK_LINK
The default value for `TRUNK_LINK` is `"$HOME/rocm/trunk"`. The `build_trunk.sh`
-script will install into directory `${TRUNK_LINK}_21.0-0`.
+script will install into directory `${TRUNK_LINK}_23.0-0`.
Furthermore, it creates a symbolic link from `$TRUNK_LINK` to the install dir.
So `$TRUNK_LINK` **MUST NOT** be a physical directory. This symbolic link makes
-it easy to switch between future qualifed releases of _trunk21_. If you are on a
+it easy to switch between future qualifed releases of _trunk23_. If you are on a
system where `$HOME` is in a slow filesystem, set `TRUNK_LINK` to where you want
the install directory to be. For example set the following in your
`.bash_profile` or `.bashrc` then relogin:
@@ -51,7 +51,7 @@ the install directory to be. For example set the following in your
export TRUNK_LINK=/work/$USER/rocm/trunk
```
-Then the install scripts will install into `/work/$USER/rocm/trunk_21.0-0` and
+Then the install scripts will install into `/work/$USER/rocm/trunk_23.0-0` and
a symlink will be created from `$TRUNK_LINK`.
@@ -160,16 +160,16 @@ The default for `BUILD_TYPE` is "Release". This sets the value for
`CMAKE_BUILD_TYPE`. See CMake documentation for different possible values.
-# Releases of _trunk21_
+# Releases of _trunk23_
-At various development check points we will qualify releases of _trunk21_ and
+At various development check points we will qualify releases of _trunk23_ and
increment the development version in `trunk_common_vars`. For example, after the
-release of `trunk_21.0-0`, development will move to `trunk_21.0-1`. The build
-scripts will then install into directory `$HOME/rocm/trunk_21.0-1`. The symbolic
+release of `trunk_23.0-0`, development will move to `trunk_23.0-1`. The build
+scripts will then install into directory `$HOME/rocm/trunk_23.0-1`. The symbolic
link from `$HOME/rocm/trunk` will also change to the new install directory.
-After a _trunk21_ release, a static release branch will be created. such as
-`trunk_21.0-0`. This branch will be created by interactive rebasing all the
+After a _trunk23_ release, a static release branch will be created. such as
+`trunk_23.0-0`. This branch will be created by interactive rebasing all the
local commits in `amd-trunk-dev`. Development will continue in the branch
`amd-trunk-dev`.
@@ -183,7 +183,7 @@ similar to the `clone_aomp.sh` script used for AOMP. For now, simply run
merges from main.
-# Testing _trunk21_
+# Testing _trunk23_
To use the various AOMP testing infrastructure in `$TRUNK_REPOS/aomp/test`:
diff --git a/trunk/build_project.sh b/trunk/build_project.sh
index 0bf82aedad..18589cbf01 100755
--- a/trunk/build_project.sh
+++ b/trunk/build_project.sh
@@ -60,6 +60,11 @@ $_cuda_plugin \
$AOMP_GFXLIST_OPT \
$AOMP_NVPTX_CAPS_OPT \
$ENABLE_DEBUG_OPT \
+$LLVM_FORCE_VC_REVISION_OPT \
+$LLVM_FORCE_VC_REPOSITORY_OPT \
+-DLLVM_RUNTIME_TARGETS='default;amdgcn-amd-amdhsa' \
+-DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES='openmp' \
+-DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
"
# -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath \
@@ -108,8 +113,8 @@ cd $BUILD_TRUNK/build/$LLVMPROJECT
if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
echo
echo " -----Running cmake ---- "
- echo ${AOMP_CMAKE} $_set_ninja_gan $TRUNK_REPOS/$LLVMPROJECT/llvm -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_ENABLE_ASSERTIONS=ON '-DLLVM_LIT_ARGS=-vv --show-unsupported --show-xfail -j 32' $MYCMAKEOPTS
- ${AOMP_CMAKE} $_set_ninja_gan $TRUNK_REPOS/$LLVMPROJECT/llvm -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_ENABLE_ASSERTIONS=ON '-DLLVM_LIT_ARGS=-vv --show-unsupported --show-xfail -j 32' $MYCMAKEOPTS 2>&1
+ echo ${AOMP_CMAKE} $_set_ninja_gan $TRUNK_REPOS/$LLVMPROJECT/llvm -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_ENABLE_ASSERTIONS=ON '-DLLVM_LIT_ARGS=-vv --show-unsupported --show-xfail -j 16' $MYCMAKEOPTS
+ ${AOMP_CMAKE} $_set_ninja_gan $TRUNK_REPOS/$LLVMPROJECT/llvm -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_ENABLE_ASSERTIONS=ON '-DLLVM_LIT_ARGS=-vv --show-unsupported --show-xfail -j 16' $MYCMAKEOPTS 2>&1
if [ $? != 0 ] ; then
echo "ERROR cmake failed. Cmake flags"
echo " $MYCMAKEOPTS"
diff --git a/trunk/trunk_common_vars b/trunk/trunk_common_vars
index 290388de61..6e83ef9199 100644
--- a/trunk/trunk_common_vars
+++ b/trunk/trunk_common_vars
@@ -8,7 +8,7 @@
# set environment variables defined in this file.
#
# Set the TRUNK VERSION STRING and TRUNK_PROJECT_REPO_BRANCH.
-TRUNK_VERSION=${TRUNK_VERSION:-"21.0"}
+TRUNK_VERSION=${TRUNK_VERSION:-"23.0"}
TRUNK_VERSION_MOD=${TRUNK_VERSION_MOD:-"0"}
TRUNK_VERSION_STRING=${TRUNK_VERSION_STRING:-"$TRUNK_VERSION-$TRUNK_VERSION_MOD"}
export TRUNK_VERSION_STRING TRUNK_VERSION TRUNK_VERSION_MOD
@@ -21,6 +21,15 @@ TRUNK_INSTALL_DIR=${TRUNK_LINK}_${TRUNK_VERSION_STRING}
TRUNK_MAJOR_VERSION=${TRUNK_VERSION%.*}
export TRUNK_MAJOR_VERSION
+LLVM_FORCE_VC_REVISION_OPT=""
+LLVM_FORCE_VC_REPOSITORY_OPT=""
+if [ -n "$LLVM_FORCE_VC_REVISION" ] ; then
+ LLVM_FORCE_VC_REVISION_OPT="-DLLVM_FORCE_VC_REVISION=$LLVM_FORCE_VC_REVISION"
+fi
+if [ -n "$LLVM_FORCE_VC_REPOSITORY" ] ; then
+ LLVM_FORCE_VC_REPOSITORY_OPT="-DLLVM_FORCE_VC_REPOSITORY=$LLVM_FORCE_VC_REPOSITORY"
+fi
+
# LLVMPROJECT names of the source directory to enable alternatve builds
# such as a build of pure upstream sources without amd-trunk-dev
LLVMPROJECT=${LLVMPROJECT:-llvm-project}
diff --git a/upstream-buildbots/Ubu22-HIP-TPL/Dockerfile b/upstream-buildbots/Ubu22-HIP-TPL/Dockerfile
new file mode 100644
index 0000000000..3c54d6a52a
--- /dev/null
+++ b/upstream-buildbots/Ubu22-HIP-TPL/Dockerfile
@@ -0,0 +1,47 @@
+# Dockerfile for HIP buildbot container setup
+
+FROM ubuntu:jammy
+
+ARG WORKBASE="/home"
+
+# Install prereqs
+COPY prerequisites /tmp/prerequisites
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && apt-get install -y unzip $(cat /tmp/prerequisites)
+
+# Prepare ROCm installation
+RUN mkdir --parents --mode=0755 /etc/apt/keyrings
+RUN wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | \
+ gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
+RUN apt-get update
+
+COPY rocm.list /etc/apt/sources.list.d/rocm.list
+COPY rocm-pin-600 /etc/apt/preferences.d/rocm-pin-600
+RUN apt-get update
+
+# hsa-rocr-dev brings in the CMake files for libhsa (libxrender required for HIP blender testing)
+RUN apt-get install -y rocm-device-libs rocm-core rocminfo hsa-rocr-dev rocm-hip-runtime \
+ rocm-hip-runtime-dev libxrender1 libxxf86vm1 libxfixes3 libxi6 libsm6 libice6 libgl1 \
+ libxkbcommon0 rocthrust-dev rocblas
+
+# Update the group id inside the container to match host (and get access to GPU)
+RUN groupadd --gid 109 render
+RUN groupmod -g 109 render
+
+# Create buildbot worker user inside the container
+RUN useradd --create-home -G video,render --shell /bin/bash botworker
+
+# Prepare container for HIP buildbot (Kokkos / Ginkgo)
+RUN mkdir -p ${WORKBASE}/botworker/llvm/External/hip
+
+WORKDIR ${WORKBASE}/botworker/llvm/External
+RUN cd hip && ln -s /opt/rocm* .
+
+WORKDIR ${WORKBASE}/botworker/llvm
+# Clone LLVM test suite
+RUN git clone https://github.com/llvm/llvm-test-suite.git
+RUN cd .. && chown -R botworker:botworker llvm
+
+# XXX: When mounting a volume as home, this does not work and needs to be re-done.
+ENV PATH=/home/botworker/.local/bin:$PATH
diff --git a/upstream-buildbots/Ubu22-HIP-TPL/prerequisites b/upstream-buildbots/Ubu22-HIP-TPL/prerequisites
new file mode 100644
index 0000000000..8c097ce841
--- /dev/null
+++ b/upstream-buildbots/Ubu22-HIP-TPL/prerequisites
@@ -0,0 +1,22 @@
+bc
+bison
+ccache
+cmake
+ninja-build
+g++
+gcc
+git
+libffi-dev
+libgtest-dev
+libpython3.10-dev
+python3
+python3-dev
+python3-pip
+python3-setuptools
+vim
+wget
+sudo
+libglib2.0-0
+libsm6
+libxrender1
+libxext6
diff --git a/upstream-buildbots/Ubu22-HIP-TPL/rocm-pin-600 b/upstream-buildbots/Ubu22-HIP-TPL/rocm-pin-600
new file mode 100644
index 0000000000..88348a5c17
--- /dev/null
+++ b/upstream-buildbots/Ubu22-HIP-TPL/rocm-pin-600
@@ -0,0 +1,3 @@
+Package: *
+Pin: release o=repo.radeon.com
+Pin-Priority: 600
diff --git a/upstream-buildbots/Ubu22-HIP-TPL/rocm.list b/upstream-buildbots/Ubu22-HIP-TPL/rocm.list
new file mode 100644
index 0000000000..c750224895
--- /dev/null
+++ b/upstream-buildbots/Ubu22-HIP-TPL/rocm.list
@@ -0,0 +1 @@
+deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.0.2 jammy main
diff --git a/upstream-buildbots/Ubu22/prerequisites b/upstream-buildbots/Ubu22/prerequisites
index aee0e925a8..ca95f08663 100644
--- a/upstream-buildbots/Ubu22/prerequisites
+++ b/upstream-buildbots/Ubu22/prerequisites
@@ -5,13 +5,17 @@ ninja-build
g++
gcc
git
+libc6-dev
+libc6-dev-i386
libffi-dev
libgtest-dev
libpython3.10-dev
python3
python3-dev
python3-pip
+python3-psutil
python3-setuptools
+python3-pyyaml-env-tag
vim
wget
sudo
diff --git a/upstream-buildbots/Ubu22/rocm.list b/upstream-buildbots/Ubu22/rocm.list
index 8c5af0d6f6..c750224895 100644
--- a/upstream-buildbots/Ubu22/rocm.list
+++ b/upstream-buildbots/Ubu22/rocm.list
@@ -1 +1 @@
-deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.3 jammy main
+deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.0.2 jammy main
diff --git a/utils/gpurun b/utils/gpurun
deleted file mode 100755
index a22c4265bc..0000000000
--- a/utils/gpurun
+++ /dev/null
@@ -1,672 +0,0 @@
-#!/bin/bash
-# Copyright(C) 2024 Advanced Micro Devices, Inc. All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-# of the Software, and to permit persons to whom the Software is furnished to do so,
-# subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# gpurun: Process launch utility for GPU applications. This is a wrapper
-# to execute application binaries including OpenMPI GPU applications.
-# See help message below (gpurun -h) for more information.
-#
-# Usage Examples:
-# gpurun true
-# mpirun -np 4 gpurun env | grep ROCR_VISIBLE_DEVICES
-#
-
-# If set to 1, just invoke the rest of the command line without doing anything
-# else.
-GPURUN_BYPASS=${GPURUN_BYPASS:-0}
-
-function execOnError() {
- exec "$@"
-}
-
-if [ "$GPURUN_BYPASS" = "1" ]; then
- execOnError "$@"
-fi
-
-# PROGVERSION string is updated by cmake when component is installed
-PROGVERSION=X.Y-Z
-function version(){
- echo $0 version $PROGVERSION
- exit 0
-}
-function usage(){
-/bin/cat 2>&1 <<"EOF"
-
- gpurun: Application process launch utility for GPUs.
- This utility ensures the process will enable either a single
- GPU or the number specified with -md (multi-device) option.
- It launches the application binary with either the 'taskset'
- or 'numactl' utility so the process only runs on CPU cores
- in the same NUMA domain as the selected GPUs.
- This utility sets environment variable ROCR_VISIBLE_DEVICES
- to selected GPUs ONLY if it was not already set by the
- callers environment AND the number of GPUs is not 1.
- This utility also sets environment variable HSA_CU_MASK
- to control which CUs are available to the process.
- HSA_CU_MASK is set only when more than one OpenMPI process
- (rank) will utilize the same GPU and it is not preset.
- Lastly, it sets env variable OMPX_TARGET_TEAM_PROCS to the
- number of CUs available to the process after masking.
-
- Usage:
- gpurun [ ]
- mpirun -np gpurun [ ]
-
- Options:
- -h Print this help message and exit
- -md Set number of desired devices for multi-device mode, default=1
- -s suppress output, often useful in benchmarking
- -q suppress output, quiet, alias of -s, same as GPURUN_VERBOSE=0
- -v Verbose output, same as GPURUN_VERBOSE=1
- -vv Verbose output, same as GPURUN_VERBOSE=2
- -m use numactl membind to CPUs in same NUMA domain. Note: Allocation
- fails when not enough memory available on these nodes.
- -l use numactl localalloc to CPUs in same NUMA domain. Note: If
- memory cannot be allocated, alloc falls back to other nodes.
- --version Print version of gpurun and exit
-
- Optional Input environment variables:
- GPURUN_VERBOSE
- 0: default for silent operation, no trace printed to stderr
- 1: -v prints trace record including process launch cmd to stderr
- 2: -vv prints trace and other summary diagnostics
- ROCMINFO_BINARY Set location of rocminfo binary
- AOMP: location of AOMP or ROCM
- GPURUN_DEVICE_BIAS: amount to shift device number to avoid dev 0.
- This only works for single device mode.
- GPURUN_VISIBLE_DEVICE_TYPES: useful if machine has different GPU cards
- GPURUN_MASK_POLICY : useful if machine has different GPU cards
- ROCR_VISIBLE_DEVICES: See description above
- OMPI_COMM_WORLD_LOCAL_SIZE Number of ranks on this node set by openmpi
- OMPI_COMM_WORLD_LOCAL_RANK The local rank number 0-(nranks-1) from openmpi
- This also checks for MPI_LOCALNRANKS/MPI_LOCALRANKID
- and MPI_COMM_WORLD_LOCAL_SIZE/MPI_COMM_WORLD_LOCAL_RANK
-
- Generated (output) Environment Variables:
- OMPX_TARGET_TEAM_PROCS - Number of CUs available to process
- ROCR_VISIBLE_DEVICES - list of GPU Uuids for the selected devices if not preset
- HSA_CU_MASK - The CU mask for the device.
- LIBOMPTARGET_NUM_MULTI_DEVICES - the value set by -md argument
- GPU_MAX_HW_QUEUES
- LIBOMPTARGET_AMDGPU_NUM_HSA_QUEUES"
-
- Limitations:
- - Currently, gpurun creates masks that are mutually exclusive of each other.
- That is, the MPI processes will not share CUs. If number of ranks is not
- perfectly divisible by number of CUs or number of GPUs, some resources
- would be unused.
- Set GPURUN_VERBOSE=1 or 2 to see overall cu utilization.
- - Works with AOMP 19.0-0 or ROCM 6.1 or greater
- - cu masking is not available when multiple devices per process are enabled
- with -md option (multi-device) mode.
-
- Notes:
- With MPI, this utility distributes GPUs and their CUs across
- multiple ranks of an MPI job into mutually exclusive sets of CUs.
- It uses OpenMPI environment variables OMPI_COMM_WORLD_LOCAL_SIZE
- and OMPI_COMM_WORLD_LOCAL_RANK to set visible devices and a
- the mutually exclusive CU mask.
-
- An rplace (rank place) is a subset of CUs for a rank.
- gpurun calculates the number of rplaces needed to contain all
- the specified number of ranks for this node. If number of ranks not
- divisible by number of GPUs, then there will be more rplaces than ranks.
- The number of CUs in an rplace is calculated by dividing the number of
- CUs per GPU by the number of rplaces per GPU. This is also the number of
- bits set in the CU mask. This is also the number of physical locations
- available for an OpenMP team to execute. This utility exports that number
- to the environment variable OMPX_TARGET_TEAM_PROCS. This value
- could be used by the application or runtume to adjust the number
- of desired teams in a target region. If no masking occurs, the entire
- GPU is available for the process and OMPX_TARGET_TEAM_PROCS is set to
- the total number of CUs on the GPU.
-
- Copyright (c) 2024 ADVANCED MICRO DEVICES, INC.
-
-EOF
- exit 0
-}
-
-_end_gpurun_opts=0
-_devices_per_mdset=1
-_uses_multi_device=0
-while [ "$_end_gpurun_opts" == "0" ] ; do
- case "$1" in
- -s) GPURUN_VERBOSE=0;;
- -q) GPURUN_VERBOSE=0;;
- --quiet) GPURUN_VERBOSE=0;;
- -h) usage ;;
- -help) usage ;;
- --help) usage ;;
- -version) version ;;
- --version) version ;;
- -v) GPURUN_VERBOSE=1;;
- -vv) GPURUN_VERBOSE=2;;
- -m) _use_numactl_membind=1;;
- -md) shift; _devices_per_mdset=$1; _uses_multi_device=1;;
- -l) _use_numactl_localalloc=1;;
- -nomask) GPURUN_MASK_POLICY="nomask";;
- *) _end_gpurun_opts=1; break;;
- esac
- if [ "$_end_gpurun_opts" == "0" ] ; then
- shift
- fi
-done
-
-# Default: quiet operation
-GPURUN_VERBOSE=${GPURUN_VERBOSE:-0}
-# Default: create mutually exclusive sets of CUs when GPU is oversubscribed
-GPURUN_MASK_POLICY=${GPURUN_MASK_POLICY:-mutex}
-# switch mask policy to preset if HSA_CU_MASK was preset
-[[ ! -z "$HSA_CU_MASK" ]] && GPURUN_MASK_POLICY=preset
-# switch mask policy to nomask for multi-device
-[[ $_uses_multi_device == 1 ]] && GPURUN_MASK_POLICY=nomask
-# Offset selected device to avoid some heavily used GPUs
-GPURUN_DEVICE_BIAS=${GPURUN_DEVICE_BIAS:-0}
-
-# Get environment variables set by OpenMPI
-_num_local_ranks=$OMPI_COMM_WORLD_LOCAL_SIZE
-_local_rank_num=$OMPI_COMM_WORLD_LOCAL_RANK
-# If not OpenMPI, check for Platform MPI, MVAPICH
-if [ -z "$_num_local_ranks" ] ; then
- _num_local_ranks=$MPI_LOCALNRANKS
- _local_rank_num=$MPI_LOCALRANKID
-fi
-# Also try MPI_COMM_WORLD env vars
-if [ -z "$_num_local_ranks" ] ; then
- _num_local_ranks=$MPI_COMM_WORLD_LOCAL_SIZE
- _local_rank_num=$MPI_COMM_WORLD_LOCAL_RANK
-fi
-# Check if SLURM was used
-if [ -z "$_num_local_ranks" ] && [ ! -z $SLURM_CPUS_ON_NODE ] ; then
- _num_local_ranks=$SLURM_CPUS_ON_NODE
- _local_rank_num=$SLURM_LOCALID
-fi
-# If none of the above MPIs, assume gpurun is wrapper for single process on single GPU
-if [ -z "$_num_local_ranks" ] ; then
- _num_local_ranks=1
- _local_rank_num=0
-fi
-
-# Find location of the rocminfo binary
-AOMP=${AOMP:-_AOMP_INSTALL_DIR_}
-if [ ! -d $AOMP ] ; then
- AOMP="_AOMP_INSTALL_DIR_"
-fi
-if [ ! -d $AOMP ] ; then
- AOMP="/opt/rocm/lib/llvm"
-fi
-if [ ! -d $AOMP ] ; then
- AOMP="/opt/rocm/llvm"
-fi
-if [ ! -d $AOMP ] ; then
- realpath=`realpath $0`
- thisdir=`dirname $realpath`
- AOMP=$thisdir/..
-fi
-if [ ! -d $AOMP ] ; then
- >&2 echo "ERROR: AOMP not found at $AOMP"
- >&2 echo " Please install AOMP or correctly set env-var AOMP"
- execOnError "$@"
-fi
-ROCMINFO_BINARY=${ROCMINFO_BINARY:-$AOMP/bin/rocminfo}
-[ ! -f $ROCMINFO_BINARY ] && ROCMINFO_BINARY=$AOMP/../bin/rocminfo
-[ ! -f $ROCMINFO_BINARY ] && ROCMINFO_BINARY=$AOMP/../../bin/rocminfo
-if [ ! -f $ROCMINFO_BINARY ] ; then
- >&2 echo "ERROR: Could not find binary for rocminfo,"
- >&2 echo " Please correct installation of ROCM or AOMP compiler"
- execOnError "$@"
-fi
-
-# Use rocminfo to find number number of CUs and gfxids for each GPU.
-_tfile="/tmp/rinfo_out$$"
-$ROCMINFO_BINARY 2>/dev/null | grep -E " Name:| Compute Unit:| Device Type:| BDFID:| Uuid:" |grep -v generic >$_tfile
-_tfile_lines=`wc -l $_tfile | cut -d" " -f1`
-if [ $_tfile_lines == 0 ] ; then
- >&2 echo "ERROR: $ROCMINFO_BINARY failed to find GPU devices"
- rm $_tfile
- execOnError "$@"
-fi
-# Create 3 _ri_ arrays by parsing rocminfo (ri), one array entry per device
-_ri_all_gfxids=""
-_ri_gfxids=()
-_ri_cucount=()
-_ri_bdfids=()
-_ri_dev_idx=()
-_ri_num_devices=0
-_last_cu_count=0
-_ri_uuid=()
-_last_device_type_was_gpu=0
-_device_type_preset=0
-_ri_num_all_devices=0
-[ ! -z $GPURUN_VISIBLE_DEVICE_TYPES ] && _device_type_preset=1
-while read _linepair ; do
- _fieldvalue=`echo $_linepair | cut -d":" -f2`
- _fieldtype=`echo $_linepair | cut -d":" -f1`
- if [ $_fieldvalue == "CPU" ] ; then
- _last_device_type_was_gpu=0
- elif [ $_fieldvalue == "GPU" ] ; then
- _last_device_type_was_gpu=1
- elif [ "$_fieldtype" == "Uuid" ] ; then
- _this_uuid=$_fieldvalue
- elif [ "$_fieldtype" == "BDFID" ] ; then
- if [[ $_last_device_type_was_gpu == 1 ]] ; then
- # _domain="$(echo "$_fieldvalue / (2^32)" | bc)"
- _bus="$(echo "($_fieldvalue / (2^8)) % (2^8)" | bc)"
- _devfn="$(echo "($_fieldvalue % (2^8))" | bc)"
- _bdfidstr="$(printf "%.2x:%.2x" "$_bus" "$_devfn")"
- fi
- elif [ "$_fieldtype" == "Name" ] ; then
- # The device name field is last in rocminfo output, so we can create new _ri_ array entry
- if [[ $_last_device_type_was_gpu == 1 ]] ; then
- _this_gfxid=`echo $_fieldvalue | cut -d'-' -f5`
- ! [[ ${_ri_all_gfxids} == *"$_this_gfxid"* ]] && _ri_all_gfxids+=" $_this_gfxid"
- _is_type_visible=1
- if [ $_device_type_preset == 1 ] ; then
- _is_type_visible=0
- if [[ ${GPURUN_VISIBLE_DEVICE_TYPES} == *"$_this_gfxid"* ]] ; then
- _is_type_visible=1
- fi
- fi
- if [ $_is_type_visible == 1 ] ; then
- _ri_gfxids+=( $_this_gfxid )
- _ri_cucount+=( $_last_cu_count )
- _ri_bdfids+=( $_bdfidstr )
- _ri_dev_idx+=( $_ri_num_all_devices )
- _ri_uuid+=( $_this_uuid )
- _ri_num_devices=$(( $_ri_num_devices + 1 ))
- fi
- _ri_num_all_devices=$(( $_ri_num_all_devices + 1 ))
- fi
- else
- # else the _fieldvalue was the number of CUs or GCPUs
- if [[ $_last_device_type_was_gpu == 1 ]] ; then
- _last_cu_count=$_fieldvalue
- fi
- fi
-done < $_tfile
-rm $_tfile
-
-if [ $_ri_num_devices == 0 ] ; then
- if [ $_local_rank_num == 0 ] ; then
- if [ $_device_type_preset == 1 ] ; then
- >&2 echo "ERROR: No amdgpu devices found by $ROCMINFO_BINARY of type $GPURUN_VISIBLE_DEVICE_TYPES."
- >&2 echo " Set GPURUN_VISIBLE_DEVICE_TYPES to one of these types: ${_ri_all_gfxids}"
- else
- >&2 echo "ERROR: No amdgpu devices found by $ROCMINFO_BINARY"
- fi
- if [ ! -z $ROCR_VISIBLE_DEVICES ] ; then
- >&2 echo " ROCR_VISIBLE_DEVICES was preset to $ROCR_VISIBLE_DEVICES"
- >&2 echo " Consider unset ROCR_VISIBLE_DEVICES and let gpurun set it correctly."
- fi
- execOnError "$@"
- else
- execOnError "$@"
- fi
-fi
-
-# Scan /sys/bus/pci/devices (_ss_) for amdgpu devices and store info in 6 per
-# device arrays indexed by device num. The arrays are _ss_cpulist _ss_bdfids,
-# _ss_numanode, _ss_uuid, _ss_gfxid, and _ss_cucount. Some information
-# (cucount, gfxid, dev_idx) must be copied from the _ri_ arrays built above
-# by scanning output from rocminfo.
-_sysdevdir="/sys/bus/pci/devices"
-_ss_num_devices=0
-_ss_cpulist=()
-_ss_bdfid=()
-_ss_numanode=()
-_ss_uuid=()
-_ss_gfxid=()
-_ss_cucount=()
-for _devid in `ls $_sysdevdir` ; do
- if [ -f $_sysdevdir/$_devid/device ] ; then
- _driver_name=`cat $_sysdevdir/$_devid/uevent | grep DRIVER | awk '{print $1}'`
- if [ ! -z $_driver_name ] ; then
- if [ $_driver_name == "DRIVER=amdgpu" ] ; then
- _numa_node=`cat $_sysdevdir/$_devid/numa_node`
- [ "$_numa_node" == "-1" ] && _numa_node=0
- _this_uuid=0
- if [ -f $_sysdevdir/$_devid/unique_id ] ; then
- _this_uuid=`cat $_sysdevdir/$_devid/unique_id`
- if [ -z $_this_uuid ] ; then
- _this_uuid=0
- _has_unique_id_file=0
- else
- _this_uuid="GPU-$_this_uuid"
- _has_unique_id_file=1
- fi
- fi
- _this_cpulist=`cat $_sysdevdir/$_devid/local_cpulist`
- _match_uuid_count=0
- for _ri_i in ${!_ri_bdfids[@]} ; do
- _ss_value=$_this_uuid
- _ri_value=${_ri_uuid[$_ri_i]}
- if [ $_ss_value == $_ri_value ] ; then
- _match_uuid_count=$(( $_match_uuid_count + 1 ))
- fi
- done
- # Search _ri_ arrays for matching uuids or matching bdfids.
- for _ri_i in ${!_ri_bdfids[@]} ; do
- if [ "$_has_unique_id_file" == "1" ] ; then
- _ss_value=$_this_uuid
- _ri_value=${_ri_uuid[$_ri_i]}
- elif [ "${_ri_bdfids[$_ri_i]}" == "00:00" ]; then
- # Under Hyper-V, we may see a zero BDFID. Fall back to UUID.
- _ss_value=$_devid
- _ri_value=$_devid
- else
- _ss_value=$_devid
- _ri_value="0000:${_ri_bdfids[$_ri_i]}.0"
- fi
- if [ $_ss_value == $_ri_value ] ; then
- if [ $_this_uuid == 0 ] || [ $_match_uuid_count -gt 1 ] ; then
- # Some GPUs do not have unique_id or TPX mode creates multiple
- # identical uuids, so use device index for RVD
- _ss_uuid+=( ${_ri_dev_idx[$_ri_i]} )
- else
- _ss_uuid+=( $_this_uuid )
- fi
- _ss_gfxid+=( ${_ri_gfxids[$_ri_i]} )
- _ss_cucount+=( ${_ri_cucount[$_ri_i]} )
- _ss_bdfid+=( $_devid )
- _ss_numanode+=( $_numa_node )
- _ss_cpulist+=( $_this_cpulist )
- _ss_num_devices=$(( $_ss_num_devices + 1 ))
- fi
- done
- fi
- fi
- fi
-done
-
-if [[ $_ss_num_devices -lt 1 ]] ; then
- if [ $_device_type_preset == 1 ] ; then
- >&2 echo "ERROR: No amdgpu devices found in $_sysdevdir of type $GPURUN_VISIBLE_DEVICE_TYPES."
- >&2 echo " Set GPURUN_VISIBLE_DEVICE_TYPES to one of these types: ${_ri_all_gfxids}"
- else
- >&2 echo "ERROR: No amdgpu devices found in $_sysdevdir."
- fi
- execOnError "$@"
-fi
-
-# check for taskset or numactl cmd
-if [ "$_use_numactl_membind" == "1" ] || [ "$_use_numactl_localalloc" == "1" ] ; then
- _launch_process_cmd_binary=`which numactl`
- if [ $? != 0 ] ; then
- >&2 echo "ERROR: The -m (membind) or -l (localalloc) require numactl to be installed."
- execOnError "$@"
- fi
-else
- _launch_process_cmd_binary=`which taskset`
- if [ $? != 0 ] ; then
- >&2 echo "ERROR: $0 requires the taskset command to be installed."
- execOnError "$@"
- fi
-fi
-if [ "$_use_numactl_membind" == "1" ] && [ "$_use_numactl_localalloc" == "1" ] ; then
- >&2 echo "GPURUN WARNING: When -l and -m are both set, -m is ignored."
- _use_numactl_membind=0
-fi
-
-_utilized_devices=$_ri_num_devices
-[ $_ri_num_devices -gt $_num_local_ranks ] && _utilized_devices=$_num_local_ranks
-
-# Calculate number of GPUs to use to evenly spread ranks across GPUs.
-# An rplace is a set of CUs that will be used for a rank.
-# The number of rplaces must be at least the number of ranks.
-_uncovered_ranks=$(( $_num_local_ranks % $_utilized_devices ))
-_number_of_rplaces_per_GPU=$(( $_num_local_ranks / $_utilized_devices ))
-if [ $_uncovered_ranks != 0 ] ; then
- # If _num_local_ranks not divisible by number of GPUs,
- # then add an extra rplace per GPU to make room for remainder.
- _number_of_rplaces_per_GPU=$(( $_number_of_rplaces_per_GPU + 1 ))
-fi
-if [ $GPURUN_MASK_POLICY == "mutex" ] ; then
- # For mutex policy, adjacent ranks are assigned to the same device.
- _rplace_num=$(( $_local_rank_num / $_number_of_rplaces_per_GPU ))
- # Some users want to avoid dev 0 etc, by setting GPURUN_DEVICE_BIAS
- _device_num=$(( ( $_rplace_num + $GPURUN_DEVICE_BIAS ) % $_ri_num_devices ))
-else
- # for mask policies nomask or preset, adjacent ranks are assigned to
- # different GPUs and oversubscribed ranks are assigned round robin
- _device_num=$(( ( $_local_rank_num + $GPURUN_DEVICE_BIAS ) % $_ri_num_devices ))
-fi
-
-_node_cus=$(( $_ri_num_devices * ${_ss_cucount[$_device_num]} ))
-if [ $_num_local_ranks -gt $_node_cus ] ; then
- >&2 echo "ERROR: Not enough CUs ($_node_cus) for $_num_local_ranks ranks "
- execOnError "$@"
-fi
-
-if [ $_uses_multi_device == 1 ]; then
- # Enforce some rules on the use of -md option
- # Note -md forces GPURUN_MASK_POLICY=nomask
- if [[ ! -z $ROCR_VISIBLE_DEVICES ]] ; then
- >&2 echo "ERROR: DO NOT PRESET ROCR_VISIBLE_DEVICES in gpurun multi-device (-md) mode"
- execOnError "$@"
- fi
- if [ $_devices_per_mdset -gt $_ri_num_devices ] ; then
- >&2 echo "ERROR: More devices requested ($_devices_per_mdset) than available ($_ri_num_devices)"
- execOnError "$@"
- fi
- _md_total_devices=$(( $_num_local_ranks * $_devices_per_mdset ))
- if [ $_md_total_devices -gt $_ri_num_devices ] && [ $_local_rank_num == 0 ] ; then
- printf "WARNING: processes($_num_local_ranks) * md set size($_devices_per_mdset) = $_md_total_devices > than available devices ($_ri_num_devices)\n Some multi-device sets will overlap.\n" >&2
- fi
- _md_device_set_start=$(( ( $_local_rank_num * $_devices_per_mdset ) % $_ri_num_devices))
- _md_device_set_end=$(( $_md_device_set_start + $_devices_per_mdset - 1 ))
-
- # merge entries for this mdset from per device arrays
- _md_bdfs=""
- _md_cpus=""
- _md_nns=""
- _md_uuids=""
- _md_dev_idxs=""
- _sep=""
- for i in `seq $_md_device_set_start $_md_device_set_end` ; do
- _dev_index=$i
- # handle index wrap around number of devices
- [ $i -ge $_ri_num_devices ] && _dev_index=$(( $i % $_ri_num_devices ))
- _md_bdfs+=$_sep${_ss_bdfid[$_dev_index]}
- _new_nn=${_ss_numanode[$_dev_index]}
- SAVEIFS=$IFS
- IFS=","
- _found=0
- for _existing_nn in $_md_nns ; do
- [ $_existing_nn == $_new_nn ] && _found=1
- done
- IFS=$SAVEIFS
- if [ $_found == 0 ] ; then
- # only add new numa node and cpulist, if not already in the md set
- _md_nns+=$_sep$_new_nn
- _md_cpus+=$_sep${_ss_cpulist[$_dev_index]}
- fi
- _md_uuids+=$_sep${_ss_uuid[$_dev_index]}
- _md_dev_idxs+=$_sep$_dev_index
- _sep=","
- done
- _device_num=$_md_device_set_start
-fi
-
-_available_CUs_per_device=${_ss_cucount[$_device_num]}
-_gfxid=${_ss_gfxid[$_device_num]}
-
-_node_cus=$(( $_ri_num_devices * ${_ss_cucount[$_device_num]} ))
-if [ $_num_local_ranks -gt $_node_cus ] ; then
- >&2 echo "ERROR: Not enough CUs ($_node_cus) for $_num_local_ranks ranks "
- execOnError "$@"
-fi
-
-_utilized_CUs_per_device=$_available_CUs_per_device
-_rem2=$(( $_utilized_CUs_per_device % $_number_of_rplaces_per_GPU ))
-# Lower utilized CUs till divisible by number of rplaces per GPU
-while [ $_rem2 != 0 ] ; do
- _utilized_CUs_per_device=$(( $_utilized_CUs_per_device - 1 ))
- _rem2=$(( $_utilized_CUs_per_device % $_number_of_rplaces_per_GPU ))
-done
-_CUs_per_rplace=$(( $_utilized_CUs_per_device / $_number_of_rplaces_per_GPU ))
-
-# --- THIS BLOCK ONLY FOR VERBOSE DIAGS PRINTED FROM RANK 0
-if [ $_local_rank_num == 0 ] && [[ "$GPURUN_VERBOSE" == "2" ]]; then
- if [ $_uses_multi_device == 0 ] ; then
- _wasted_CUs_on_each_GPU=$(( $_available_CUs_per_device - $_utilized_CUs_per_device ))
- _total_GPU_rplaces=$(( $_number_of_rplaces_per_GPU * $_ri_num_devices ))
- _total_wasted_rplaces=$(( $_total_GPU_rplaces - $_num_local_ranks ))
- _wasted_GPUs=$(( $_total_wasted_rplaces / $_number_of_rplaces_per_GPU ))
- _used_cus=$(( $_num_local_ranks * $_CUs_per_rplace ))
- _utilization=$(( ( $_used_cus * 100 ) / $_node_cus ))
- if ! [ $_ri_num_devices -gt $_num_local_ranks ] ; then
- if [ $_wasted_CUs_on_each_GPU != 0 ] || [ $_total_wasted_rplaces != 0 ] ; then
- _extra_diags=true
- fi
- fi
- >&2 echo "- ROCMINFO LOCATION: $ROCMINFO_BINARY"
- >&2 echo "- PROCESSES: $_num_local_ranks (RANKS)"
- >&2 echo "- AVAILABLE GPUS: $_ri_num_devices"
- [ $_extra_diags ] && \
- >&2 echo "-- USED GPUS: $(( $_ri_num_devices - $_wasted_GPUs ))"
- [ $_extra_diags ] && \
- >&2 echo "-- UNUSED GPUS: $(( $_total_wasted_rplaces / $_number_of_rplaces_per_GPU )) "
- [ $_extra_diags ] && echo
- >&2 echo "- RPLACEs PER NODE: $_total_GPU_rplaces"
- >&2 echo "- RPLACEs PER GPU: $_number_of_rplaces_per_GPU"
- [ $_extra_diags ] && \
- >&2 echo "-- USED RPLACEs: $_num_local_ranks (RANKS)"
- [ $_extra_diags ] && \
- >&2 echo "-- UNUSED RPLACEs: $_total_wasted_rplaces" ; \
- >&2 echo "- gfxids ${_ss_gfxid[@]}"
- >&2 echo "- CUs PER GPU: ${_ss_cucount[@]}"
- [ $_extra_diags ] && \
- >&2 echo "-- USED on CUs RANK0: $_utilized_CUs_per_device"
- [ $_extra_diags ] && \
- >&2 echo "-- UNUSED CUs RANK0 : $_wasted_CUs_on_each_GPU"
- >&2 echo "- CUs per RPLACE RANK0:$_CUs_per_rplace (OMPX_TARGET_TEAM_PROCS)"
- >&2 echo "- FORMULA: OMPX_TARGET_TEAM_PROCS = $_utilized_CUs_per_device / $_number_of_rplaces_per_GPU"
- if [[ ! -z "$ROCR_VISIBLE_DEVICES" ]] ; then
- >&2 echo "- Preset ROCR_VISIBLE_DEVICES: $ROCR_VISIBLE_DEVICES"
- fi
- if [[ ! -z "$HSA_CU_MASK" ]] ; then
- # node utilizatino could be incorrect with preset cumask.
- >&2 echo "- Preset HSA_CU_MASK: $HSA_CU_MASK"
- else
- >&2 echo "- NODE UTILIZATION: $_utilization %"
- fi
- else
- >&2 echo "- ROCMINFO LOCATION: $ROCMINFO_BINARY"
- >&2 echo "- PROCESSES: $_num_local_ranks (RANKS)"
- >&2 echo "- AVAILABLE GPUS: $_ri_num_devices"
- >&2 echo "- DEVS PER RANK: $_devices_per_mdset"
- >&2 echo "- MULTI-DEVICE GPUS: $_md_total_devices (RANKS*DEVS-PER-RANK)"
- _md_utilization=$(( $_md_total_devices * 100 / $_ri_num_devices ))
- >&2 echo "- NODE UTILIZATION: $_md_utilization %"
- fi
-fi
-# --- END OF DIAGNOSTIC BLOCK
-
-if [ $_CUs_per_rplace != $_available_CUs_per_device ] && [ $GPURUN_MASK_POLICY == "mutex" ] ; then
- # Build the CU mask for this rank, bits_to_set = _CUs_per_rplace
- _bits_to_set=$_CUs_per_rplace
- # This formula keeps adjacent ranks on same GPU which should be preferred
- _bits_to_shift=$(( ( $_local_rank_num * $_bits_to_set) - ( _device_num * $_utilized_CUs_per_device) ))
- # use bc because these values can be very large
- _unshifted_bits=`echo "(2 ^ $_bits_to_set) - 1" | bc`
- _mask=`echo "obase=16; $_unshifted_bits * (2 ^ $_bits_to_shift)" | bc`
- # Calculate the number of leading zeros needed for this mask
- _lz=$(( ( $_utilized_CUs_per_device / 4 ) - ${#_mask} + 1 ))
- for i in `seq 1 $_lz` ; do
- _mask="0$_mask"
- done
- _mask="0x$_mask"
-fi
-
-_launch_process_cmd=""
-if [ $_uses_multi_device == 0 ] ; then
- # retrieve scanned info from per device arrays
- _bdfidstrc=${_ss_bdfid[$_device_num]}
- NUMANODE=${_ss_numanode[$_device_num]}
- _list_of_cpu_cores=${_ss_cpulist[$_device_num]}
- _this_uuid=${_ss_uuid[$_device_num]}
-else
- # Use multi-device values
- _bdfidstrc=$_md_bdfs
- NUMANODE=$_md_nns
- _list_of_cpu_cores=$_md_cpus
- _this_uuid=$_md_uuids
- _launch_process_cmd+="env LIBOMPTARGET_NUM_MULTI_DEVICES=$_devices_per_mdset "
-fi
-if [ "$_use_numactl_localalloc" == "1" ] ; then
- _launch_process_cmd+="$_launch_process_cmd_binary --localalloc --cpunodebind=$NUMANODE"
-elif [ "$_use_numactl_membind" == "1" ] ; then
- _launch_process_cmd+="$_launch_process_cmd_binary --membind=$NUMANODE --cpunodebind=$NUMANODE"
-else
- _launch_process_cmd+="$_launch_process_cmd_binary -c $_list_of_cpu_cores"
-fi
-
-# If gpurun was not given command to execute, then dont run _launch_process_cmd
-[ "$*" == "" ] && _launch_process_cmd=""
-
-# only set ROCR_VISIBLE_DEVICES if not already set
-if [[ -z $ROCR_VISIBLE_DEVICES ]] ; then
- export ROCR_VISIBLE_DEVICES=$_this_uuid
- _log_word="RVD"
-else
- _log_word="PRESET-RVD"
-fi
-
-export OMPX_TARGET_TEAM_PROCS=$_CUs_per_rplace
-
-# - Limit HSA queues when multiple ranks per GPU
-if [ $_number_of_rplaces_per_GPU != 1 ] ; then
- # Only set these env controls if not set by caller
- [[ -z "$GPU_MAX_HW_QUEUES" ]] && export GPU_MAX_HW_QUEUES=1
- [[ -z "$LIBOMPTARGET_AMDGPU_NUM_HSA_QUEUES" ]] && export LIBOMPTARGET_AMDGPU_NUM_HSA_QUEUES=1
-fi
-
-[[ ! -z "$HSA_CU_MASK" ]] && [[ "$GPURUN_VERBOSE" != "0" ]] && \
- [[ $_local_rank_num == 0 ]] && >&2 echo "WARNING: preset HSA_CU_MASK:$HSA_CU_MASK"
-
-if [ $_CUs_per_rplace == $_available_CUs_per_device ] || [ "$GPURUN_MASK_POLICY" == "nomask" ] ; then
- # --- HSA_CU_MASK is NOT USED in this code block, This code block covers all multi-device execution.
- if [ "$GPURUN_VERBOSE" != "0" ] ; then
- if [ $_uses_multi_device == 1 ] ; then
- printf "RANK:$_local_rank_num D:$_md_dev_idxs NNs:$_md_nns GPUTYPE:$_gfxid $_log_word:$ROCR_VISIBLE_DEVICES\n CMD:$_launch_process_cmd $*\n" >&2
- else
- printf "RANK:$_local_rank_num D:%d PCI:%5s NN:%d GPUTYPE:$_gfxid $_log_word:%s \n CMD:%s $*\n" $_device_num $_bdfidstrc $NUMANODE $ROCR_VISIBLE_DEVICES "$_launch_process_cmd" >&2
- fi
- fi
- $_launch_process_cmd $*
- # --- end code block
-else
- # --- HSA_CU_MASK is required in this code block, assumes no multi-device
- if [[ -z "$HSA_CU_MASK" ]] ; then
- # Since ROCR_VISIBLE_DEVICES only enables 1 GPU, HSA_CU_MASK starts with 0:
- export HSA_CU_MASK=0:$_mask
- else
- # use preset mask
- _mask=$HSA_CU_MASK
- fi
- if [ "$GPURUN_VERBOSE" != "0" ] ; then
- printf "RANK:$_local_rank_num D:%d PCI:%5s NN:%d $_gfxid CUMASK:$_mask $_log_word:$ROCR_VISIBLE_DEVICES \n CMD:%s $*\n" $_device_num $_bdfidstrc $NUMANODE "$_launch_process_cmd" >&2
- fi
- HSA_CU_MASK=0:$_mask \
- $_launch_process_cmd $*
- # --- end code block
-fi
-exit $?