CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
164 lines
4.3 KiB
Bash
Executable File
164 lines
4.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
# #################################################
|
|
# helper functions
|
|
# #################################################
|
|
function display_help()
|
|
{
|
|
echo "rocThust build & installation helper script"
|
|
echo "./install [-h|--help] "
|
|
echo " [-h|--help] prints this help message"
|
|
echo " [-i|--install] install after build"
|
|
echo " [-p|--package] build package"
|
|
echo " [-r]--relocatable] create a package to support relocatable ROCm"
|
|
#Not implemented yet
|
|
# echo " [-d|--dependencies] install build dependencies"
|
|
echo " [-c|--clients] build library clients too (combines with -i & -d)"
|
|
echo " [-g|--debug] -DCMAKE_BUILD_TYPE=Debug (default is =Release)"
|
|
echo " [--hip-clang] build library for amdgpu backend using hip-clang"
|
|
echo " [--address-sanitizer] build with address sanitizer enabled"
|
|
}
|
|
|
|
|
|
# #################################################
|
|
# global variables
|
|
# #################################################
|
|
install_package=false
|
|
build_package=false
|
|
build_clients=false
|
|
build_release=true
|
|
build_type=Release
|
|
build_hip_clang=false
|
|
run_tests=false
|
|
rocm_path=/opt/rocm
|
|
build_relocatable=false
|
|
build_address_sanitizer=false
|
|
|
|
# #################################################
|
|
# Parameter parsing
|
|
# #################################################
|
|
|
|
# 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}" --longoptions help,install,clients,debug,hip-clang,test,package,relocatable,address-sanitizer,rm-legacy-include-dir --options hicdtprg -- "$@")
|
|
else
|
|
echo "Need a new version of getopt"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
echo "getopt invocation failed; could not parse the command line";
|
|
exit 1
|
|
fi
|
|
|
|
eval set -- "${GETOPT_PARSE}"
|
|
|
|
check_exit_code( )
|
|
{
|
|
if (( $1 != 0 )); then
|
|
exit $1
|
|
fi
|
|
}
|
|
|
|
|
|
while true; do
|
|
case "${1}" in
|
|
-h|--help)
|
|
display_help
|
|
exit 0
|
|
;;
|
|
-i|--install)
|
|
install_package=true
|
|
shift ;;
|
|
-p|--package)
|
|
build_package=true
|
|
shift ;;
|
|
-c|--clients)
|
|
build_clients=true
|
|
shift ;;
|
|
-r|--relocatable)
|
|
build_relocatable=true
|
|
shift ;;
|
|
-g|--debug)
|
|
build_type=Debug
|
|
build_release=false
|
|
shift ;;
|
|
-t|--test)
|
|
run_tests=true
|
|
shift ;;
|
|
--hip-clang)
|
|
build_hip_clang=true
|
|
shift ;;
|
|
--address-sanitizer)
|
|
build_address_sanitizer=true
|
|
shift ;;
|
|
--) shift ; break ;;
|
|
*) echo "Unexpected command line parameter received; aborting";
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ "${build_relocatable}" == true ]]; then
|
|
if ! [ -z ${ROCM_PATH+x} ]; then
|
|
rocm_path=${ROCM_PATH}
|
|
fi
|
|
fi
|
|
|
|
# Create and go to the build directory.
|
|
mkdir -p build; cd build
|
|
|
|
if ($build_release); then
|
|
mkdir -p release; cd release
|
|
else
|
|
mkdir -p debug; cd debug
|
|
fi
|
|
|
|
# Configure rocThrust, setup options for your system.
|
|
# See README.md under "Build And Install" for options and defaults.
|
|
|
|
cmake_executable="cmake"
|
|
cmake_common_options="--toolchain=toolchain-linux.cmake"
|
|
|
|
if [[ "${build_clients}" == true ]]; then
|
|
build_test="-DBUILD_TEST=ON"
|
|
fi
|
|
|
|
if [[ "${build_address_sanitizer}" == true ]]; then
|
|
cmake_common_options="$cmake_common_options -DBUILD_ADDRESS_SANITIZER=ON"
|
|
fi
|
|
|
|
if [[ "${build_relocatable}" == true ]]; then
|
|
${cmake_executable} ${cmake_common_options} \
|
|
-DCMAKE_INSTALL_PREFIX=${rocm_path} \
|
|
-DCMAKE_PREFIX_PATH="${rocm_path} ${rocm_path}/hip" \
|
|
-DCMAKE_MODULE_PATH="${rocm_path}/lib/cmake/hip ${rocm_path}/hip/cmake" \
|
|
-DROCPRIM_ROOT=${rocm_path}/rocprim ${build_test}\
|
|
../../. # or cmake-gui ../.
|
|
else
|
|
${cmake_executable} ${build_test} ${cmake_common_options} \
|
|
-DCMAKE_BUILD_TYPE=${build_type} ../../. # or cmake-gui ../.
|
|
fi
|
|
check_exit_code "$?"
|
|
|
|
# Build
|
|
make -j$(nproc)
|
|
check_exit_code "$?"
|
|
|
|
if ($run_tests); then
|
|
# Optionally, run tests if they're enabled.
|
|
ctest --output-on-failure
|
|
fi
|
|
|
|
if ($install_package); then
|
|
make install
|
|
check_exit_code "$?"
|
|
fi
|
|
|
|
if ($build_package); then
|
|
make package -j$(nproc)
|
|
check_exit_code "$?"
|
|
fi
|