From d641d8ba08add9fd20cdc4ab4abcfe61a66dd7a9 Mon Sep 17 00:00:00 2001 From: Simeon Ehrig Date: Wed, 14 Aug 2024 19:18:31 +0200 Subject: [PATCH] Add some color output to CI install scripts (#2359) Provides a better overview which software is used from the container and which software is installed on the fly. --- script/install_boost.sh | 3 +++ script/install_clang.sh | 5 ++++- script/install_cmake.sh | 2 ++ script/install_cuda.sh | 2 ++ script/install_gcc.sh | 6 +++++- script/install_hip.sh | 3 +++ script/install_oneapi.sh | 6 +++++- script/install_tbb.sh | 6 +++++- script/setup_utilities/travis_retry.sh | 7 ++----- 9 files changed, 31 insertions(+), 9 deletions(-) diff --git a/script/install_boost.sh b/script/install_boost.sh index 87b7a47ff30..45816cba28b 100755 --- a/script/install_boost.sh +++ b/script/install_boost.sh @@ -34,12 +34,15 @@ fi if [ "${CXX}" != "icpc" ] && [ "${ALPAKA_CI_STDLIB}" != "libc++" ] then if agc-manager -e boost@${ALPAKA_BOOST_VERSION} ; then + echo_green "" export BOOST_ROOT=$(agc-manager -b boost@${ALPAKA_BOOST_VERSION}) export ALPAKA_CI_BOOST_LIB_DIR=${BOOST_ROOT} return fi fi +echo_yellow "" + ALPAKA_CI_BOOST_BRANCH="boost-${ALPAKA_BOOST_VERSION}" if [ "$ALPAKA_CI_OS_NAME" = "Linux" ] diff --git a/script/install_clang.sh b/script/install_clang.sh index 9b36ec5929b..e65bdefa034 100755 --- a/script/install_clang.sh +++ b/script/install_clang.sh @@ -20,8 +20,11 @@ then sudo rm /etc/apt/sources.list.d/llvm.list fi -if ! agc-manager -e clang@${ALPAKA_CI_CLANG_VER} +if agc-manager -e clang@${ALPAKA_CI_CLANG_VER} then + echo_green "" +else + echo_yellow "" # Install from LLVM repository (if available); otherwise install LLVM from official Ubuntu repositories ALPAKA_CI_UBUNTU_NAME=`lsb_release -c | awk '{print $2}'` wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - diff --git a/script/install_cmake.sh b/script/install_cmake.sh index 6911e61507c..21d5454b506 100755 --- a/script/install_cmake.sh +++ b/script/install_cmake.sh @@ -16,8 +16,10 @@ echo_green "" if [ "$ALPAKA_CI_OS_NAME" = "Linux" ] || [ "$ALPAKA_CI_OS_NAME" = "Windows" ] then if agc-manager -e cmake@${ALPAKA_CI_CMAKE_VER} ; then + echo_green "" export ALPAKA_CI_CMAKE_DIR=$(agc-manager -b cmake@${ALPAKA_CI_CMAKE_VER}) else + echo_yellow "" if [ "$ALPAKA_CI_OS_NAME" = "Linux" ] then # Download the selected version. diff --git a/script/install_cuda.sh b/script/install_cuda.sh index 11e267fa5d0..125db025b70 100755 --- a/script/install_cuda.sh +++ b/script/install_cuda.sh @@ -24,10 +24,12 @@ fi if agc-manager -e cuda@${ALPAKA_CI_CUDA_VERSION} then + echo_green "" ALPAKA_CI_CUDA_PATH=$(agc-manager -b cuda@${ALPAKA_CI_CUDA_VERSION}) export PATH=${ALPAKA_CI_CUDA_PATH}/bin:${PATH} export LD_LIBRARY_PATH=${ALPAKA_CI_CUDA_PATH}/lib64:${LD_LIBRARY_PATH} else + echo_yellow "" if [ "$ALPAKA_CI_OS_NAME" = "Linux" ] then : "${ALPAKA_CI_CUDA_DIR?'ALPAKA_CI_CUDA_DIR must be specified'}" diff --git a/script/install_gcc.sh b/script/install_gcc.sh index 4dd0f934b9a..c86255df6c4 100755 --- a/script/install_gcc.sh +++ b/script/install_gcc.sh @@ -14,8 +14,12 @@ echo_green "" : "${ALPAKA_CI_SANITIZERS?'ALPAKA_CI_SANITIZERS must be specified'}" : "${CXX?'CXX must be specified'}" -if ! agc-manager -e gcc@${ALPAKA_CI_GCC_VER} +if agc-manager -e gcc@${ALPAKA_CI_GCC_VER} then + echo_green "" +else + echo_yellow "" + travis_retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/ppa # Contains gcc 10.4 (Ubuntu 20.04) travis_retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # Contains gcc 11 (Ubuntu 20.04) travis_retry sudo apt-get -y --quiet update diff --git a/script/install_hip.sh b/script/install_hip.sh index a5e23790a24..993ef94832f 100755 --- a/script/install_hip.sh +++ b/script/install_hip.sh @@ -16,8 +16,11 @@ echo_green "" function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } if agc-manager -e rocm@${ALPAKA_CI_HIP_VERSION} ; then + echo_green "" export ROCM_PATH=$(agc-manager -b rocm@${ALPAKA_CI_HIP_VERSION}) else + echo_yellow "" + travis_retry apt-get -y --quiet update travis_retry apt-get -y --quiet install wget gnupg2 # AMD container keys are outdated and must be updated diff --git a/script/install_oneapi.sh b/script/install_oneapi.sh index 1c475767d01..2b21ab2c064 100755 --- a/script/install_oneapi.sh +++ b/script/install_oneapi.sh @@ -12,8 +12,12 @@ echo_green "" : "${CXX?'CXX must be specified'}" -if ! agc-manager -e oneapi +if agc-manager -e oneapi then + echo_green "" +else + echo_yellow "" + # Ref.: https://github.com/rscohn2/oneapi-ci # intel-basekit intel-hpckit are too large in size diff --git a/script/install_tbb.sh b/script/install_tbb.sh index b21e0e7d5b7..64d8b10cfb1 100755 --- a/script/install_tbb.sh +++ b/script/install_tbb.sh @@ -12,8 +12,12 @@ echo_green "" : "${ALPAKA_CI_TBB_VERSION?'ALPAKA_CI_TBB_VERSION must be specified'}" -if ! agc-manager -e tbb@${ALPAKA_CI_TBB_VERSION} +if agc-manager -e tbb@${ALPAKA_CI_TBB_VERSION} then + echo_green "" +else + echo_yellow "" + # Install TBB if [ "$ALPAKA_CI_OS_NAME" = "Linux" ] then diff --git a/script/setup_utilities/travis_retry.sh b/script/setup_utilities/travis_retry.sh index 9e483788487..6bb5b594c73 100755 --- a/script/setup_utilities/travis_retry.sh +++ b/script/setup_utilities/travis_retry.sh @@ -21,9 +21,6 @@ # 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. -ANSI_RED="\033[31m" -ANSI_RESET="\033[0m" - travis_retry() { # apply `set +euo pipefail` in a local scope so that the following script is not affected and # e.g. exit on failure is not deactivated @@ -34,7 +31,7 @@ travis_retry() { local max=666 while [ $count -le $max ]; do [ $result -ne 0 ] && { - echo -e "\n${ANSI_RED}The command \"$*\" failed. Retrying, $count of $max.${ANSI_RESET}\n" >&2 + echo_red "\nThe command \"$*\" failed. Retrying, $count of $max.\n" >&2 } "$@" result=$? @@ -43,7 +40,7 @@ travis_retry() { sleep 1 done [ $count -gt $max ] && { - echo -e "\n${ANSI_RED}The command \"$*\" failed $max times.${ANSI_RESET}\n" >&2 + echo_red "\nThe command \"$*\" failed $max times.\n" >&2 } return $result )