diff --git a/bin/build_hipamd.sh b/bin/build_hipamd.sh index 96caa14c3..62cc5ba3d 100755 --- a/bin/build_hipamd.sh +++ b/bin/build_hipamd.sh @@ -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 @@ -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 \ @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/bin/build_openmp.sh b/bin/build_openmp.sh index 6ba482cde..103e823de 100755 --- a/bin/build_openmp.sh +++ b/bin/build_openmp.sh @@ -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 @@ -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 @@ -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. @@ -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 @@ -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 @@ -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 diff --git a/bin/build_rocr.sh b/bin/build_rocr.sh index 0b9351970..b77f7ea27 100755 --- a/bin/build_rocr.sh +++ b/bin/build_rocr.sh @@ -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 " " @@ -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 @@ -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 @@ -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 diff --git a/bin/build_roct.sh b/bin/build_roct.sh index bd3ac061d..efe12200d 100755 --- a/bin/build_roct.sh +++ b/bin/build_roct.sh @@ -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 " " @@ -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 @@ -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 @@ -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