Skip to content

Commit

Permalink
Add some color output to CI install scripts (#2359)
Browse files Browse the repository at this point in the history
Provides a better overview which software is used from the container and which software is installed on the fly.
  • Loading branch information
SimeonEhrig authored Aug 14, 2024
1 parent 2ed0f24 commit d641d8b
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 9 deletions.
3 changes: 3 additions & 0 deletions script/install_boost.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ fi
if [ "${CXX}" != "icpc" ] && [ "${ALPAKA_CI_STDLIB}" != "libc++" ]
then
if agc-manager -e boost@${ALPAKA_BOOST_VERSION} ; then
echo_green "<USE: preinstalled BOOST ${ALPAKA_BOOST_VERSION}>"
export BOOST_ROOT=$(agc-manager -b boost@${ALPAKA_BOOST_VERSION})
export ALPAKA_CI_BOOST_LIB_DIR=${BOOST_ROOT}
return
fi
fi

echo_yellow "<INSTALL: BOOST ${ALPAKA_BOOST_VERSION}>"

ALPAKA_CI_BOOST_BRANCH="boost-${ALPAKA_BOOST_VERSION}"

if [ "$ALPAKA_CI_OS_NAME" = "Linux" ]
Expand Down
5 changes: 4 additions & 1 deletion script/install_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<USE preinstalled Clang ${ALPAKA_CI_CLANG_VER}>"
else
echo_yellow "<INSTALL: Clang ${ALPAKA_CI_CLANG_VER}>"
# 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 -
Expand Down
2 changes: 2 additions & 0 deletions script/install_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ echo_green "<SCRIPT: install_cmake>"
if [ "$ALPAKA_CI_OS_NAME" = "Linux" ] || [ "$ALPAKA_CI_OS_NAME" = "Windows" ]
then
if agc-manager -e cmake@${ALPAKA_CI_CMAKE_VER} ; then
echo_green "<USE: preinstalled CMake ${ALPAKA_CI_CMAKE_VER}>"
export ALPAKA_CI_CMAKE_DIR=$(agc-manager -b cmake@${ALPAKA_CI_CMAKE_VER})
else
echo_yellow "<INSTALL: CMake ${ALPAKA_CI_CMAKE_VER}>"
if [ "$ALPAKA_CI_OS_NAME" = "Linux" ]
then
# Download the selected version.
Expand Down
2 changes: 2 additions & 0 deletions script/install_cuda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ fi

if agc-manager -e cuda@${ALPAKA_CI_CUDA_VERSION}
then
echo_green "<USE: preinstalled CUDA ${ALPAKA_CI_CUDA_VERSION}>"
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 "<INSTALL: CUDA ${ALPAKA_CI_CUDA_VERSION}>"
if [ "$ALPAKA_CI_OS_NAME" = "Linux" ]
then
: "${ALPAKA_CI_CUDA_DIR?'ALPAKA_CI_CUDA_DIR must be specified'}"
Expand Down
6 changes: 5 additions & 1 deletion script/install_gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ echo_green "<SCRIPT: install_gcc>"
: "${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 "<USE: preinstalled GCC ${ALPAKA_CI_GCC_VER}>"
else
echo_yellow "<INSTALL: GCC ${ALPAKA_CI_GCC_VER}>"

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
Expand Down
3 changes: 3 additions & 0 deletions script/install_hip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ echo_green "<SCRIPT: install_hip>"
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 "<USE: preinstalled ROCm ${ALPAKA_CI_HIP_VERSION}>"
export ROCM_PATH=$(agc-manager -b rocm@${ALPAKA_CI_HIP_VERSION})
else
echo_yellow "<INSTALL: ROCm ${ALPAKA_CI_HIP_VERSION}>"

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
Expand Down
6 changes: 5 additions & 1 deletion script/install_oneapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ echo_green "<SCRIPT: install_oneapi>"
: "${CXX?'CXX must be specified'}"


if ! agc-manager -e oneapi
if agc-manager -e oneapi
then
echo_green "<USE: preinstalled OneAPI ${ALPAKA_CI_ONEAPI_VERSION}>"
else
echo_yellow "<INSTALL: Intel OneAPI ${ALPAKA_CI_ONEAPI_VERSION}>"

# Ref.: https://github.com/rscohn2/oneapi-ci
# intel-basekit intel-hpckit are too large in size

Expand Down
6 changes: 5 additions & 1 deletion script/install_tbb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ echo_green "<SCRIPT: install_tbb>"

: "${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 "<USE: preinstalled Intel TBB ${ALPAKA_CI_TBB_VERSION}>"
else
echo_yellow "<INSTALL: Intel TBB ${ALPAKA_CI_TBB_VERSION}>"

# Install TBB
if [ "$ALPAKA_CI_OS_NAME" = "Linux" ]
then
Expand Down
7 changes: 2 additions & 5 deletions script/setup_utilities/travis_retry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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=$?
Expand All @@ -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
)
Expand Down

0 comments on commit d641d8b

Please sign in to comment.