Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions bin/build_supp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,30 @@ function getrocmpackage(){

function buildhdf5(){
_cname="hdf5"
_version=1.14.0
_release=hdf5-1.14
_version=2.2.0
_release=hdf5-2.2.0
_installdir=$AOMP_SUPP_INSTALL/hdf5-$_version
_linkfrom=$AOMP_SUPP/hdf5
_builddir=$AOMP_SUPP_BUILD/hdf5
SKIPBUILD="FALSE"
BUILD_TYPE=${BUILD_TYPE:-Release}
declare -a MYCMAKEOPTS
MYCMAKEOPTS=(-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
-DCMAKE_INSTALL_PREFIX="$_installdir"
-DCMAKE_CXX_COMPILER="$AOMP/bin/clang++"
-DCMAKE_C_COMPILER="$AOMP/bin/clang"
-DCMAKE_Fortran_COMPILER="$AOMP/bin/flang"
-DHDF5_BUILD_FORTRAN=ON
-DHDF5_BUILD_HL_LIB=ON
-DHDF5_BUILD_TOOLS=ON
-DBUILD_SHARED_LIBS=ON
-DBUILD_STATIC_LIBS=ON
-DHDF5_ENABLE_ZLIB_SUPPORT=ON
-DHDF5_ENABLE_SZIP_SUPPORT=OFF
-DHDF5_ENABLE_THREADSAFE=OFF
-DBUILD_TESTING=OFF
-DHDF5_INSTALL_MOD_FORTRAN=STATIC)

checkversion
if [ "$SKIPBUILD" == "TRUE" ] ; then
return
Expand All @@ -595,15 +613,27 @@ function buildhdf5(){
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 " wget https://support.hdfgroup.org/ftp/HDF5/releases/$_release/hdf5-$_version/src/hdf5-$_version.tar.bz2"
runcmd " wget https://github.com/HDFGroup/hdf5/releases/download/$_version/hdf5-$_version.tar.gz"
runcmd "tar -xzf hdf5-$_version.tar.gz"
runcmd "cd hdf5-$_version"
if [ -d "$_installdir" ] ; then
runcmd "rm -rf $_installdir"
fi
runcmd "mkdir -p $_installdir"
runcmd "./configure --enable-fortran --prefix=$_installdir"
runcmd "mkdir -p build"
runcmd "cd build"
#runcmd "./configure --enable-fortran --prefix=$_installdir"
echo
echo " -----Running cmake ---- "
echo "${AOMP_CMAKE}" "$(shquot "${MYCMAKEOPTS[@]}")" \
"$AOMP_REPOS/$AOMP_FLANG_REPO_NAME"

if ! ${AOMP_CMAKE} "${MYCMAKEOPTS[@]}" ../; then
echo "ERROR cmake failed. Cmake flags"
echo " $(shquot "${MYCMAKEOPTS[@]}")"
exit 1
fi
runcmd "make -j${AOMP_JOB_THREADS}"
runcmd "make install"
if [ -L "$_linkfrom" ] ; then
Expand Down
57 changes: 31 additions & 26 deletions bin/run_genasis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
#

# --- 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
# shellcheck disable=SC1091
. "$thisdir"/aomp_common_vars
# --- end standard header ----

# Setup AOMP variables
AOMP=${AOMP:-$HOME/rocm/aomp/llvm}
AOMPHIP=${AOMPHIP:-$(realpath -m $(realpath -m $AOMP)/../..)}
AOMPHIP=${AOMPHIP:-$(realpath -m "$(realpath -m "$AOMP")/../..")}
# for ROCm utilities (e.g. rocm_agent_enumerator)
ROCM=${ROCM:-$(realpath -m $(realpath -m $AOMP)/../..)}
ROCM=${ROCM:-$(realpath -m "$(realpath -m "$AOMP")/../..")}
FLANG=${FLANG:-flang}

echo "AOMP = $AOMP"
Expand All @@ -31,16 +32,16 @@ SRC_DIR=${SRC_DIR:-GenASis} # old source

REPO_DIR=$AOMP_REPOS_TEST/$SRC_DIR
if [ -d "$REPO_DIR" ] ; then
echo $REPO_DIR " exists."
echo "$REPO_DIR exists."
else
echo "$REPO_DIR does not exist. Please run ./clone_test.sh and re-run this script."
exit
fi

# Copy Makefile_ROCm to GenASis repository
cp Makefile_ROCm $REPO_DIR/Build/Machines/
cp Makefile_ROCm "$REPO_DIR"/Build/Machines/

cd $REPO_DIR
cd "$REPO_DIR" || exit 1

AOMP_SUPP=${AOMP_SUPP:-$HOME/local}
export OPENMPI_DIR="$AOMP_SUPP/openmpi"
Expand All @@ -49,13 +50,14 @@ export HDF5_DIR="$AOMP_SUPP/hdf5"
export GENASIS_MACHINE=ROCm

if [ -d "$AOMP" ] ; then
echo $AOMP " exists."
echo "$AOMP exists."
else
echo "Install latest AOMP and try again!"
exit
fi

export GPU_ID=$($ROCM/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
GPU_ID=$("$ROCM"/bin/rocm_agent_enumerator | grep -m 1 -E 'gfx[^0]{1}.{2}')
export GPU_ID
currdir=$(pwd)
if [ -d "$SILO_DIR" ] ; then
echo "SILO 4.11.1 exists."
Expand All @@ -64,11 +66,11 @@ else
exit
fi
if [ -d "$HDF5_DIR" ] ; then
echo "HDF5-1.14.0 exists."
echo "HDF5-2.2.0 exists."
export INCLUDE_HDF5="-I$HDF5_DIR/include"
export LIBRARY_HDF5="-L$HDF5_DIR/lib -lhdf5_fortran -lhdf5"
else
echo "HDF5-1.14.0 does not exist. Please run ./build_supp.sh hdf5 in $thisdir"
echo "HDF5-2.2.0 does not exist. Please run ./build_supp.sh hdf5 in $thisdir"
exit
fi
if [ -d "$OPENMPI_DIR" ] ; then
Expand All @@ -87,9 +89,9 @@ export FORTRAN_LINK="$AOMP/bin/clang $OTHER_LIBS"
export DEVICE_COMPILE="$AOMPHIP/bin/hipcc -D__HIP_PLATFORM_HCC__"
export HIP_DIR=$ROCM
export HIP_CLANG_PATH=$AOMP/bin
cd $currdir
cd "$currdir" || exit 1
if [ "$1" != "runonly" ] ; then
cd $REPO_DIR/Programs/UnitTests/Basics/Runtime/Executables
cd "$REPO_DIR"/Programs/UnitTests/Basics/Runtime/Executables || exit 1
echo "================= STARTING 1st MAKE in $PWD ========"
make clean
make PURPOSE=OPTIMIZE all
Expand All @@ -99,7 +101,7 @@ if [ "$1" != "runonly" ] ; then
exit
fi
echo
cd $REPO_DIR/Programs/Examples/Basics/FluidDynamics/Executables
cd "$REPO_DIR"/Programs/Examples/Basics/FluidDynamics/Executables || exit 1
echo "================= STARTING 2nd MAKE in $PWD ========"
make clean
make PURPOSE=OPTIMIZE all
Expand All @@ -109,7 +111,7 @@ if [ "$1" != "runonly" ] ; then
exit
fi
echo
cd $REPO_DIR/Programs/UnitTests/Basics/Devices/Executables
cd "$REPO_DIR"/Programs/UnitTests/Basics/Devices/Executables || exit 1
echo "================= STARTING 3rd MAKE in $PWD ========"
make clean
make PURPOSE=OPTIMIZE all
Expand All @@ -125,29 +127,32 @@ if [ "$1" != "buildonly" ] ; then
export LIBOMPTARGET_KERNEL_TRACE=1
export LIBOMPTARGET_INFO=1
export OMP_TARGET_OFFLOAD=MANDATORY
cd $REPO_DIR/Programs/UnitTests/Basics/Runtime/Executables
cd "$REPO_DIR"/Programs/UnitTests/Basics/Runtime/Executables || exit 1
echo ./PROGRAM_HEADER_Singleton_Test_$GENASIS_MACHINE
./PROGRAM_HEADER_Singleton_Test_$GENASIS_MACHINE
echo
cd $REPO_DIR/Programs/Examples/Basics/FluidDynamics/Executables
cd "$REPO_DIR"/Programs/Examples/Basics/FluidDynamics/Executables || exit 1
echo
echo "================= 2D RiemannProblem ========"
_cmd="./RiemannProblem_$GENASIS_MACHINE Verbosity=INFO_2 nCells=256,256 \ Dimensionality=2D FinishTime=0.25 nWrite=10"
echo $_cmd
time $_cmd
echo "Done: $_cmd"
_cmd=(./RiemannProblem_"$GENASIS_MACHINE" Verbosity=INFO_2 "nCells=256,256"
Dimensionality=2D FinishTime=0.25 nWrite=10)
echo "${_cmd[@]}"
time "${_cmd[@]}"
echo "Done: ${_cmd[*]}"
echo
echo "================= attempting mpirun ========"
echo
#echo ldd ./SineWaveAdvection_$GENASIS_MACHINE
#ldd ./SineWaveAdvection_$GENASIS_MACHINE
echo
_cmd="$OPENMPI_DIR/bin/mpirun -np 1 $AOMP/bin/gpurun $REPO_DIR/Programs/Examples/Basics/FluidDynamics/Executables/SineWaveAdvection_$GENASIS_MACHINE nCells=128,128,128"
echo $_cmd
time $_cmd
_cmd=("$OPENMPI_DIR"/bin/mpirun -np 1 "$AOMP"/bin/gpurun
"$REPO_DIR"/Programs/Examples/Basics/FluidDynamics/Executables/SineWaveAdvection_"$GENASIS_MACHINE"
"nCells=128,128,128")
echo "${_cmd[@]}"
time "${_cmd[@]}"
echo "================= end mpirun ========"
echo "================= Now running Unitests related to offloading ========"
cd $REPO_DIR/Programs/UnitTests/Basics/Devices/Executables
cd "$REPO_DIR"/Programs/UnitTests/Basics/Devices/Executables || exit 1
./AllocateDevice_Command_Test_$GENASIS_MACHINE
echo "AllocateDevice_Command_Test_$GENASIS_MACHINE done!"
./AllocateHost_Command_Test_$GENASIS_MACHINE
Expand Down
70 changes: 38 additions & 32 deletions bin/run_genasis_flang_new.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@
# AOMP=<path-to-compiler-install>/llvm ./run_genasis_flang_new.sh
#
# --- 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
# shellcheck disable=SC1091
. "$thisdir"/aomp_common_vars
# --- end standard header ----

# Setup AOMP variables
AOMP=${AOMP:-$HOME/rocm/aomp/llvm}
AOMPHIP=${AOMPHIP:-$(realpath -m $(realpath -m $AOMP)/../..)}
AOMPHIP=${AOMPHIP:-$(realpath -m "$(realpath -m "$AOMP")/../..")}
# for ROCm utilities (e.g. rocm_agent_enumerator)
ROCM=${ROCM:-$(realpath -m $(realpath -m $AOMP)/../..)}
ROCM=${ROCM:-$(realpath -m "$(realpath -m "$AOMP")/../..")}
FLANG=${FLANG:-flang}

echo "AOMP = $AOMP"
Expand All @@ -50,19 +51,19 @@ SRC_DIR=${SRC_DIR:-GenASis} # old source

REPO_DIR=$AOMP_REPOS_TEST/$SRC_DIR
if [ -d "$REPO_DIR" ] ; then
echo $REPO_DIR " exists."
echo "$REPO_DIR exists."
else
echo "$REPO_DIR does not exist. Please run ./clone_test.sh and re-run this script."
exit
fi

# Copy Makefile_ROCm to GenASis repository
cp Makefile_ROCmFlangNew $REPO_DIR/Build/Machines/
cp Makefile_ROCmFlangNew "$REPO_DIR"/Build/Machines/

patchrepo $AOMP_REPOS_TEST/$SRC_DIR
trap "removepatch $AOMP_REPOS_TEST/$SRC_DIR" EXIT
patchrepo "$AOMP_REPOS_TEST/$SRC_DIR"
trap 'removepatch "$AOMP_REPOS_TEST/$SRC_DIR"' EXIT

cd $REPO_DIR
cd "$REPO_DIR" || exit 1

AOMP_SUPP=${AOMP_SUPP:-$HOME/local}
export OPENMPI_DIR="$AOMP_SUPP/openmpi"
Expand All @@ -71,13 +72,14 @@ export HDF5_DIR="$AOMP_SUPP/hdf5"
export GENASIS_MACHINE=ROCmFlangNew

if [ -d "$AOMP" ] ; then
echo $AOMP " exists."
echo "$AOMP exists."
else
echo "Install latest AOMP and try again!"
exit
fi

export GPU_ID=$($ROCM/bin/rocm_agent_enumerator | grep -m 1 -E gfx[^0]{1}.{2})
GPU_ID=$("$ROCM"/bin/rocm_agent_enumerator | grep -m 1 -E 'gfx[^0]{1}.{2}')
export GPU_ID
currdir=$(pwd)
if [ -d "$SILO_DIR" ] ; then
echo "SILO 4.11.1 exists."
Expand All @@ -86,11 +88,11 @@ else
exit
fi
if [ -d "$HDF5_DIR" ] ; then
echo "HDF5-1.14.0 exists."
echo "HDF5-2.2.0 exists."
export INCLUDE_HDF5="-I$HDF5_DIR/include"
export LIBRARY_HDF5="-L$HDF5_DIR/lib -lhdf5_fortran -lhdf5"
else
echo "HDF5-1.14.0 does not exist. Please run ./build_supp.sh hdf5 in $thisdir"
echo "HDF5-2.2.0 does not exist. Please run ./build_supp.sh hdf5 in $thisdir"
exit
fi
if [ -d "$OPENMPI_DIR" ] ; then
Expand Down Expand Up @@ -127,7 +129,7 @@ export FORTRAN_LINK="$AOMP/bin/clang $OTHER_LIBS"
export DEVICE_COMPILE="$AOMPHIP/bin/hipcc -D__HIP_PLATFORM_HCC__"
export HIP_DIR=$ROCM
export HIP_CLANG_PATH=$AOMP/bin
cd $currdir
cd "$currdir" || exit 1

echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH"
echo "FORTRAN_COMPILE = $FORTRAN_COMPILE"
Expand All @@ -140,7 +142,7 @@ echo "HIP_DIR = $HIP_DIR"
echo "HIP_CLANG_PATH = $HIP_CLANG_PATH"

if [ "$1" != "runonly" ] ; then
cd $REPO_DIR/Programs/UnitTests/Basics/Runtime/Executables
cd "$REPO_DIR"/Programs/UnitTests/Basics/Runtime/Executables || exit 1
echo "================= STARTING 1st MAKE in $PWD ========"
make clean
make PURPOSE=OPTIMIZE all
Expand All @@ -150,7 +152,7 @@ if [ "$1" != "runonly" ] ; then
exit
fi
echo
cd $REPO_DIR/Programs/Examples/Basics/FluidDynamics/Executables
cd "$REPO_DIR"/Programs/Examples/Basics/FluidDynamics/Executables || exit 1
echo "================= STARTING 2nd MAKE in $PWD ========"
make clean
make PURPOSE=OPTIMIZE all
Expand All @@ -160,7 +162,7 @@ if [ "$1" != "runonly" ] ; then
exit
fi
echo
cd $REPO_DIR/Programs/UnitTests/Basics/Devices/Executables
cd "$REPO_DIR"/Programs/UnitTests/Basics/Devices/Executables || exit 1
echo "================= STARTING 3rd MAKE in $PWD ========"
make clean
make PURPOSE=OPTIMIZE all
Expand All @@ -177,12 +179,12 @@ if [ "$1" != "buildonly" ] ; then
# export LIBOMPTARGET_INFO=1
export OMP_TARGET_OFFLOAD=MANDATORY
ulimit -s unlimited
cd $REPO_DIR/Programs/UnitTests/Basics/Runtime/Executables
cd "$REPO_DIR"/Programs/UnitTests/Basics/Runtime/Executables || exit 1
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
cd "$REPO_DIR"/Programs/UnitTests/Basics/Devices/Executables || exit 1
./AllocateDevice_Command_Test_$GENASIS_MACHINE
echo "AllocateDevice_Command_Test_$GENASIS_MACHINE done!"
./AllocateHost_Command_Test_$GENASIS_MACHINE
Expand All @@ -199,27 +201,31 @@ if [ "$1" != "buildonly" ] ; then
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
cd "$REPO_DIR"/Programs/Examples/Basics/FluidDynamics/Executables || exit 1
echo
echo "================= 2D RiemannProblem ========"
_cmd="./RiemannProblem_$GENASIS_MACHINE Verbosity=INFO_2 nCells=256,256 \ Dimensionality=2D FinishTime=0.25 nWrite=10"
echo $_cmd
time $_cmd
echo "Done: $_cmd"
_cmd=(./RiemannProblem_"$GENASIS_MACHINE" Verbosity=INFO_2 "nCells=256,256"
Dimensionality=2D FinishTime=0.25 nWrite=10)
echo "${_cmd[@]}"
time "${_cmd[@]}"
echo "Done: ${_cmd[*]}"
echo
echo "================= 3D RiemannProblem ========"
_cmd="./RiemannProblem_${GENASIS_MACHINE} Verbosity=INFO_2 nCells=256,256,256 Dimensionality=3D NoWrite=T FinishCycle=10"
echo $_cmd
time $_cmd
echo "Done: $_cmd"
_cmd=(./RiemannProblem_"${GENASIS_MACHINE}" Verbosity=INFO_2 "nCells=256,256,256"
Dimensionality=3D NoWrite=T FinishCycle=10)
echo "${_cmd[@]}"
time "${_cmd[@]}"
echo "Done: ${_cmd[*]}"
echo
echo "================= attempting mpirun ========"
echo
#echo ldd ./SineWaveAdvection_$GENASIS_MACHINE
#ldd ./SineWaveAdvection_$GENASIS_MACHINE
echo
_cmd="$OPENMPI_DIR/bin/mpirun -np 1 $AOMP/bin/gpurun $REPO_DIR/Programs/Examples/Basics/FluidDynamics/Executables/SineWaveAdvection_$GENASIS_MACHINE nCells=128,128,128 Verbosity=INFO_5"
echo $_cmd
time $_cmd
_cmd=("$OPENMPI_DIR"/bin/mpirun -np 1 "$AOMP"/bin/gpurun
"$REPO_DIR"/Programs/Examples/Basics/FluidDynamics/Executables/SineWaveAdvection_"$GENASIS_MACHINE"
"nCells=128,128,128" Verbosity=INFO_5)
echo "${_cmd[@]}"
time "${_cmd[@]}"
echo "================= end mpirun ========"
fi
Loading