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

Ensure that cuBLAS is not linked, when it is not detected

parent 2a3db3e6
No related branches found
No related tags found
No related merge requests found
......@@ -26,15 +26,15 @@ OFFLOADFLAGS=""
# Function declarations
function guess_cxx {
# Guess the name of the C++ compiler
result=$(which mpicxx)
result=$(which mpicxx 2>/dev/null)
if [ "x$result" = "x" ]; then
result=$(which g++)
result=$(which g++ 2>/dev/null)
fi
if [ "x$result" = "x" ]; then
result=$(which clang)
result=$(which clang 2>/dev/null)
fi
if [ "x$result" = "x" ]; then
result=$(which icpx)
result=$(which icpx 2>/dev/null)
fi
if [ "x$result" = "x" ]; then
result="none"
......@@ -44,21 +44,21 @@ function guess_cxx {
function guess_fc {
# Guess the name of the FORTRAN compiler
result=$(which mpif90)
result=$(which mpif90 2>/dev/null)
if [ "x$result" = "x" ]; then
result=$(which gfortran)
result=$(which gfortran 2>/dev/null)
fi
if [ "x$result" = "x" ]; then
result=$(which f77)
result=$(which f77 2>/dev/null)
fi
if [ "x$result" = "x" ]; then
result=$(which flang)
result=$(which flang 2>/dev/null)
fi
if [ "x$result" = "x" ]; then
result=$(which flang-new)
result=$(which flang-new 2>/dev/null)
fi
if [ "x$result" = "x" ]; then
result=$(which ifx)
result=$(which ifx 2>/dev/null)
fi
if [ "x$result" = "x" ]; then
result="none"
......@@ -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)
CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
else
# CUBLAS not detected
CUBLAS="no"
CUDAFLAGS=""
CUDALDFLAGS=""
fi # end of CUBLAS runtime decision tree
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
......@@ -639,13 +644,17 @@ if [ "x$CUBLAS" != "xno" ]; then
echo $CUDALDFLAGS | grep cublas > /dev/null
cudart_check=$?
if [ "x${cudart_check}" != "x0" ]; then
if [ "x${CUBLAS}" != "xno" ]; then
CUDALDFLAGS="$CUDALDFLAGS -lcublas"
fi
fi
echo $CUDALDFLAGS | grep cudart > /dev/null
cudart_check=$?
if [ "x${cudart_check}" != "x0" ]; then
if [ "x${CUBLAS}" != "xno" ]; then
CUDALDFLAGS="$CUDALDFLAGS -lcudart"
fi
fi
else
# pkg-config is not available
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