Skip to content
Snippets Groups Projects
Commit 11abd220 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Make undected compiler messages silent and ensure CUBLAS is not invoked, if not found

parent 77735cdd
Branches
Tags
No related merge requests found
...@@ -26,15 +26,15 @@ OFFLOADFLAGS="" ...@@ -26,15 +26,15 @@ OFFLOADFLAGS=""
# Function declarations # Function declarations
function guess_cxx { function guess_cxx {
# Guess the name of the C++ compiler # Guess the name of the C++ compiler
result=$(which mpicxx) result=$(which mpicxx 2>/dev/null)
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result=$(which g++) result=$(which g++ 2>/dev/null)
fi fi
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result=$(which clang) result=$(which clang 2>/dev/null)
fi fi
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result=$(which icpx) result=$(which icpx 2>/dev/null)
fi fi
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result="none" result="none"
...@@ -44,21 +44,21 @@ function guess_cxx { ...@@ -44,21 +44,21 @@ function guess_cxx {
function guess_fc { function guess_fc {
# Guess the name of the FORTRAN compiler # Guess the name of the FORTRAN compiler
result=$(which mpif90) result=$(which mpif90 2>/dev/null)
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result=$(which gfortran) result=$(which gfortran 2>/dev/null)
fi fi
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result=$(which f77) result=$(which f77 2>/dev/null)
fi fi
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result=$(which flang) result=$(which flang 2>/dev/null)
fi fi
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result=$(which flang-new) result=$(which flang-new 2>/dev/null)
fi fi
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result=$(which ifx) result=$(which ifx 2>/dev/null)
fi fi
if [ "x$result" = "x" ]; then if [ "x$result" = "x" ]; then
result="none" result="none"
...@@ -626,6 +626,11 @@ if [ "x$CUBLAS" != "xno" ]; then ...@@ -626,6 +626,11 @@ if [ "x$CUBLAS" != "xno" ]; then
cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cublas) cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cublas)
CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg}) CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg}) CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
else
# CUBLAS not detected
CUBLAS="no"
CUDAFLAGS=""
CUDALDFLAGS=""
fi # end of CUBLAS runtime decision tree fi # end of CUBLAS runtime decision tree
declare -a pkg_array=$(pkg-config --list-all | grep cudart) declare -a pkg_array=$(pkg-config --list-all | grep cudart)
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null
...@@ -639,13 +644,17 @@ if [ "x$CUBLAS" != "xno" ]; then ...@@ -639,13 +644,17 @@ if [ "x$CUBLAS" != "xno" ]; then
echo $CUDALDFLAGS | grep cublas > /dev/null echo $CUDALDFLAGS | grep cublas > /dev/null
cudart_check=$? cudart_check=$?
if [ "x${cudart_check}" != "x0" ]; then if [ "x${cudart_check}" != "x0" ]; then
if [ "x${CUBLAS}" != "xno" ]; then
CUDALDFLAGS="$CUDALDFLAGS -lcublas" CUDALDFLAGS="$CUDALDFLAGS -lcublas"
fi fi
fi
echo $CUDALDFLAGS | grep cudart > /dev/null echo $CUDALDFLAGS | grep cudart > /dev/null
cudart_check=$? cudart_check=$?
if [ "x${cudart_check}" != "x0" ]; then if [ "x${cudart_check}" != "x0" ]; then
if [ "x${CUBLAS}" != "xno" ]; then
CUDALDFLAGS="$CUDALDFLAGS -lcudart" CUDALDFLAGS="$CUDALDFLAGS -lcudart"
fi fi
fi
else else
# pkg-config is not available # pkg-config is not available
if [ -f /usr/local/cuda/include/cuda.h ]; then if [ -f /usr/local/cuda/include/cuda.h ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment