Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

create location of sources in the installation and set source maps #815

Open
wants to merge 2 commits into
base: aomp-dev
Choose a base branch
from
Open
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
67 changes: 64 additions & 3 deletions bin/build_hipamd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
LD_FLAGS="-fuse-ld=lld $ASAN_FLAGS"
fi

_install_src_dir_hipamd="$AOMP_INSTALL_DIR/share/gdb/python/ompd/src/hipamd"

if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then

if [ -d "$BUILD_DIR/build/hipamd" ] ; then
Expand All @@ -90,7 +92,7 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
fi

export ROCM_RPATH="$AOMP_ORIGIN_RPATH_LIST"
MYCMAKEOPTS="$AOMP_ORIGIN_RPATH -DCMAKE_BUILD_TYPE=$BUILDTYPE \
MYCMAKEOPTS="$AOMP_ORIGIN_RPATH \
-DCMAKE_PREFIX_PATH=$AOMP_INSTALL_DIR \
-DCMAKE_INSTALL_PREFIX=$AOMP_INSTALL_DIR \
-DHIP_COMMON_DIR=$HIP_DIR \
Expand All @@ -103,10 +105,14 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then

if [ "$AOMP_BUILD_SANITIZER" == 1 ]; then
ASAN_FLAGS="$ASAN_FLAGS -I$SANITIZER_COMGR_INCLUDE_PATH -Wno-error=deprecated-declarations"
ASAN_CMAKE_OPTS="$MYCMAKEOPTS -DCMAKE_INSTALL_LIBDIR=lib/asan -DCMAKE_C_COMPILER=$AOMP/bin/clang -DCMAKE_CXX_COMPILER=$AOMP/bin/clang++"
ASAN_CMAKE_OPTS="$MYCMAKEOPTS -DCMAKE_BUILD_TYPE=$BUILDTYPE -DCMAKE_INSTALL_LIBDIR=lib/asan -DCMAKE_C_COMPILER=$AOMP/bin/clang -DCMAKE_CXX_COMPILER=$AOMP/bin/clang++"
fi

if [ "$AOMP_BUILD_DEBUG" == 1 ]; then
HIPAMD_DEBUG_CMAKE_OPTS="$MYCMAKEOPTS -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_LIBDIR=lib-debug -DCMAKE_C_COMPILER=$AOMP/bin/clang -DCMAKE_CXX_COMPILER=$AOMP/bin/clang++"
fi

MYCMAKEOPTS="$MYCMAKEOPTS -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_CXX_FLAGS=-I$AOMP_include/amd_comgr -DCMAKE_CXX_FLAGS=-Wno-error=deprecated-declarations -DCMAKE_C_FLAGS=-Wno-error=deprecated-declarations"
MYCMAKEOPTS="$MYCMAKEOPTS -DCMAKE_BUILD_TYPE=$BUILDTYPE -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_CXX_FLAGS=-I$AOMP_include/amd_comgr -DCMAKE_CXX_FLAGS=-Wno-error=deprecated-declarations -DCMAKE_C_FLAGS=-Wno-error=deprecated-declarations"

# If this machine does not have an actvie amd GPU, tell hipamd
# to use first in GFXLIST or gfx90a if no GFXLIST
Expand Down Expand Up @@ -151,6 +157,24 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
exit 1
fi
fi

if [ "$AOMP_BUILD_DEBUG" == 1 ]; then
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
echo " -----Running hipamd-debug cmake -----"
echo ${AOMP_CMAKE} $HIPAMD_DEBUG_CMAKE_OPTS -DOFFLOAD_ARCH_STR="$amdgpu" -DCMAKE_CXX_FLAGS="'-g -fdebug-prefix-map=$HIPAMD_DIR/hipamd/src=$_install_src_dir_hipamd/src'" -DCMAKE_C_FLAGS="'-g -fdebug-prefix-map=$HIPAMD_DIR/hipamd/src=$_install_src_dir_hipamd/src'" $HIPAMD_DIR
${AOMP_CMAKE} $HIPAMD_DEBUG_CMAKE_OPTS -DOFFLOAD_ARCH_STR="$amdgpu" -DCMAKE_CXX_FLAGS="'-g -fdebug-prefix-map=$HIPAMD_DIR/hipamd/src=$_install_src_dir_hipamd/src'" -DCMAKE_C_FLAGS="'-g -fdebug-prefix-map=$HIPAMD_DIR/hipamd/src=$_install_src_dir_hipamd/src'" $HIPAMD_DIR

if [ $? != 0 ] ; then
echo "ERROR hipamd-debug cmake failed. Cmake flags"
echo " $HIPAMD_DEBUG_CMAKE_OPTS"
exit 1
fi
fi

fi

cd $BUILD_DIR/build/hipamd
Expand Down Expand Up @@ -196,6 +220,28 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
fi
fi

if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
cd $BUILD_DIR/build/hipamd_debug
echo
echo " -----Running make for hipamd-debug ----- "
make -j $AOMP_JOB_THREADS amdhip64
if [ $? != 0 ] ; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
echo " cd restart:"
echo " make "
exit 1
else
if [ "$1" != "install" ] ; then
echo
echo " BUILD COMPLETE! To install hipamd-debug component run this command:"
echo " $0 install"
echo
fi
fi
fi


function edit_installed_hip_file(){
if [ -f $installed_hip_file_to_edit ] ; then
Expand Down Expand Up @@ -228,6 +274,21 @@ if [ "$1" == "install" ] ; then
exit 1
fi
fi

if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
cd $BUILD_DIR/build/hipamd_debug
echo
echo " -----Installing to $AOMP_INSTALL_DIR/lib-debug"
$SUDO make install
if [ $? != 0 ] ; then
echo "ERROR make install failed "
exit 1
fi
$SUDO mkdir -p $_install_src_dir_hipamd/src
echo $SUDO cp -r $HIPAMD_DIR/hipamd/src $_install_src_dir_hipamd
$SUDO cp -r $HIPAMD_DIR/hipamd/src $_install_src_dir_hipamd
fi

removepatch $AOMP_REPOS/hipamd

# The hip perl scripts have /opt/rocm hardcoded, so fix them after then are installed
Expand Down
26 changes: 13 additions & 13 deletions bin/build_openmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ fi
# This is how we tell the hsa plugin where to find hsa
export HSA_RUNTIME_PATH=$ROCM_DIR

_ompd_dir="$AOMP_INSTALL_DIR/share/gdb/python/ompd"

#breaks build as it cant find rocm-path
#export HIP_DEVICE_LIB_PATH=$ROCM_DIR/lib

Expand Down Expand Up @@ -181,9 +183,6 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
fi

if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
_ompd_dir="$AOMP_INSTALL_DIR/lib-debug/ompd"
# This is the new locationof the ompd directory
[[ ! -d $_ompd_dir ]] && _ompd_dir="$AOMP_INSTALL_DIR/share/gdb/python/ompd"
echo rm -rf $BUILD_DIR/build/openmp_debug
rm -rf $BUILD_DIR/build/openmp_debug

Expand All @@ -199,7 +198,7 @@ $AOMP_ORIGIN_RPATH \
-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_dir/src/openmp"\"" "
-DOPENMP_SOURCE_DEBUG_MAP=-fdebug-prefix-map=$AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp=$_ompd_dir/src/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.
Expand Down Expand Up @@ -379,9 +378,6 @@ if [ "$1" == "install" ] ; then

if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
cd $BUILD_DIR/build/openmp_debug
_ompd_dir="$AOMP_INSTALL_DIR/lib-debug/ompd"
# This is the new locationof the ompd directory
[[ ! -d $_ompd_dir ]] && _ompd_dir="$AOMP_INSTALL_DIR/share/gdb/python/ompd"
echo
echo " -----Installing to $INSTALL_OPENMP/lib-debug ---- "
$SUDO $AOMP_NINJA_BIN -j $AOMP_JOB_THREADS install
Expand All @@ -405,7 +401,6 @@ if [ "$1" == "install" ] ; then
fi

# Remove ompdModule.cpython...so , contains absolute runpath
_ompd_dir="$AOMP_INSTALL_DIR/lib-debug/ompd"
OMF=`find $_ompd_dir -name ompdModule.cpython\*`
echo found ompdModule $OMF
if [ -f "$OMF" ]; then
Expand All @@ -423,12 +418,17 @@ if [ "$1" == "install" ] ; then
# Copy selected debugable runtime sources into the installation $ompd_dir/src directory
# to satisfy the above -fdebug-prefix-map.
$SUDO mkdir -p $_ompd_dir/src/openmp/runtime/src
echo cp -rp $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/runtime/src $_ompd_dir/src/openmp/runtime
$SUDO cp -rp $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/runtime/src $_ompd_dir/src/openmp/runtime
echo cp -r $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/runtime/src $_ompd_dir/src/openmp/runtime
$SUDO cp -r $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/runtime/src $_ompd_dir/src/openmp/runtime
$SUDO mkdir -p $_ompd_dir/src/openmp/libomptarget/src
echo cp -rp $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libomptarget/src $_ompd_dir/src/openmp/libomptarget
$SUDO cp -rp $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libomptarget/src $_ompd_dir/src/openmp/libomptarget
echo cp -r $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libomptarget/src $_ompd_dir/src/openmp/libomptarget
$SUDO cp -r $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libomptarget/src $_ompd_dir/src/openmp/libomptarget

$SUDO cp -r $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libomptarget/plugins-nextgen $_ompd_dir/src/openmp/libomptarget
$SUDO mkdir -p $_ompd_dir/src/openmp/libomptarget/hostexec/services
$SUDO cp -r $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libomptarget/hostexec/services $_ompd_dir/src/openmp/libomptarget/hostexec

$SUDO mkdir -p $_ompd_dir/src/openmp/libompd/src
$SUDO cp -rp $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libompd/src $_ompd_dir/src/openmp/libompd
$SUDO cp -r $AOMP_REPOS/$AOMP_PROJECT_REPO_NAME/openmp/libompd/src $_ompd_dir/src/openmp/libompd
fi
fi
54 changes: 54 additions & 0 deletions bin/build_rocr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
LDFLAGS="-fuse-ld=lld $ASAN_FLAGS"
fi

_install_src_dir_rocr="$AOMP_INSTALL_DIR/share/gdb/python/ompd/src/rocr"
if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
ROCR_DEBUG_FLAGS="-g -DOPENMP_SOURCE_DEBUG_MAP=-fdebug-prefix-map=$AOMP_REPOS/$AOMP_ROCR_REPO_NAME/src=$_install_src_dir_rocr/src"
fi

if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then

echo " "
Expand Down Expand Up @@ -95,6 +100,22 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
fi
fi

if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
echo rm -rf $BUILD_DIR/build/rocr_debug
[ -d $BUILD_DIR/build/rocr_debug ] && rm -rf $BUILD_DIR/build/rocr_debug
ROCR_CMAKE_OPTS="-DCMAKE_C_COMPILER=$AOMP_CLANG_COMPILER -DCMAKE_CXX_COMPILER=$AOMP_CLANGXX_COMPILER -DCMAKE_INSTALL_PREFIX=$INSTALL_ROCM -DCMAKE_BUILD_TYPE=$BUILDTYPE $AOMP_ORIGIN_RPATH -DCMAKE_INSTALL_LIBDIR=$AOMP_INSTALL_DIR/lib-debug"
echo " -----Running rocr_debug cmake -----"
mkdir -p $BUILD_AOMP/build/rocr_debug
cd $BUILD_AOMP/build/rocr_debug
echo ${AOMP_CMAKE} $ROCR_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ROCR_DEBUG_FLAGS'" -DCMAKE_CXX_FLAGS="'$ROCR_DEBUG_FLAGS'" $AOMP_REPOS/$AOMP_ROCR_REPO_NAME/src
${AOMP_CMAKE} $ROCR_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ROCR_DEBUG_FLAGS'" -DCMAKE_CXX_FLAGS="'$ROCR_DEBUG_FLAGS'" $AOMP_REPOS/$AOMP_ROCR_REPO_NAME/src
if [ $? != 0 ] ; then
echo "ERROR rocr_debug cmake failed.cmake flags"
echo " $ROCR_CMAKE_OPTS"
exit 1
fi
fi

fi

cd $BUILD_AOMP/build/rocr
Expand Down Expand Up @@ -127,6 +148,20 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
fi
fi

if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
cd $BUILD_AOMP/build/rocr_debug
echo
echo " ----- Running make for rocr_debug ----- "
make -j $AOMP_JOB_THREADS
if [ $? != 0 ] ; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
echo " cd $BUILD_AOMP/build/rocr_debug"
echo " make"
exit 1
fi
fi

# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
Expand All @@ -149,6 +184,25 @@ if [ "$1" == "install" ] ; then
exit 1
fi
fi

if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
cd $BUILD_AOMP/build/rocr_debug
echo " -----Installing to $INSTALL_ROCM/lib-debug ----- "
$SUDO make install
if [ $? != 0 ] ; then
echo "ERROR make install for rocr failed "
exit 1
fi
$SUDO mkdir -p $_install_src_dir_rocr
echo $SUDO cp -r $AOMP_REPOS/$AOMP_ROCR_REPO_NAME/src $_install_src_dir_rocr
$SUDO cp -r $AOMP_REPOS/$AOMP_ROCR_REPO_NAME/src $_install_src_dir_rocr
# remove non-source files to save space
find $_install_src_dir_rocr/src -type f | grep -v "\.cpp$\|\.h$\|\.hpp$" | xargs rm
rm -rf $_install_src_dir_rocr/src/RPM
rm -rf $_install_src_dir_rocr/src/DEBIAN
rm -rf $_install_src_dir_rocr/src/cmake_modules
fi

if [ "$AOMP_NEW" == 1 ] ; then
removepatch $AOMP_REPOS/hsa-runtime
else
Expand Down
49 changes: 49 additions & 0 deletions bin/build_roct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
LDFLAGS="-fuse-ld=lld $ASAN_FLAGS"
fi

_install_src_dir_roct="$AOMP_INSTALL_DIR/share/gdb/python/ompd/src/roct"
if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
ROCT_DEBUG_FLAGS="-g -DOPENMP_SOURCE_DEBUG_MAP=-fdebug-prefix-map=$AOMP_REPOS/$AOMP_ROCT_REPO_NAME/src=$_install_src_dir_roct/src"
fi

if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then

echo " "
Expand Down Expand Up @@ -87,6 +92,21 @@ if [ "$1" != "nocmake" ] && [ "$1" != "install" ] ; then
exit 1
fi
fi
if [ "$AOMP_BUILD_DEBUG" == "1" ] ; then
echo rm -rf $BUILD_DIR/build/roct_debug
[ -d $BUILD_DIR/build/roct_debug ] && rm -rf $BUILD_DIR/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=$BUILDTYPE $AOMP_ORIGIN_RPATH -DCMAKE_INSTALL_LIBDIR=$AOMP_INSTALL_DIR/lib-debug"
echo " -----Running roct_debug cmake -----"
mkdir -p $BUILD_AOMP/build/roct_debug
cd $BUILD_AOMP/build/roct_debug
echo ${AOMP_CMAKE} $ROCT_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ROCT_DEBUG_FLAGS'" -DCMAKE_CXX_FLAGS="'$ROCT_DEBUG_FLAGS'" $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
${AOMP_CMAKE} $ROCT_CMAKE_OPTS -DCMAKE_C_FLAGS="'$ROCT_DEBUG_FLAGS'" -DCMAKE_CXX_FLAGS="'$ROCT_DEBUG_FLAGS'" $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
if [ $? != 0 ] ; then
echo "ERROR roct_debug cmake failed.cmake flags"
echo " $ROCT_CMAKE_OPTS"
exit 1
fi
fi
fi

cd $BUILD_AOMP/build/roct
Expand Down Expand Up @@ -116,6 +136,21 @@ if [ "$AOMP_BUILD_SANITIZER" == 1 ] ; then
fi
fi

if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
cd $BUILD_AOMP/build/roct_debug
echo
echo " ----- Running make for roct_debug ----- "
make -j $AOMP_JOB_THREADS
if [ $? != 0 ] ; then
echo " "
echo "ERROR: make -j $AOMP_JOB_THREADS FAILED"
echo "To restart:"
echo " cd $BUILD_AOMP/build/roct_debug"
echo " make"
exit 1
fi
fi

# ----------- Install only if asked ----------------------------
if [ "$1" == "install" ] ; then
cd $BUILD_AOMP/build/roct
Expand All @@ -135,5 +170,19 @@ if [ "$1" == "install" ] ; then
exit 1
fi
fi

if [ "$AOMP_BUILD_DEBUG" == 1 ] ; then
cd $BUILD_AOMP/build/roct_debug
echo " -----Installing to $INSTALL_ROCT/lib-debug ----- "
$SUDO make install
if [ $? != 0 ] ; then
echo "ERROR make install for roct failed "
exit 1
fi
$SUDO mkdir -p $_install_src_dir_roct
echo $SUDO cp -r $AOMP_REPOS/$AOMP_ROCT_REPO_NAME/src $_install_src_dir_roct
$SUDO cp -r $AOMP_REPOS/$AOMP_ROCT_REPO_NAME/src $_install_src_dir_roct
fi

removepatch $AOMP_REPOS/$AOMP_ROCT_REPO_NAME
fi