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

Merge branch 'script_devel' into 'master'

Implement fall-back search for cudart

See merge request giacomo.mulas/np_tmcode!57
parents f0f6d979 56cda368
No related branches found
No related tags found
No related merge requests found
...@@ -25366,33 +25366,40 @@ then : ...@@ -25366,33 +25366,40 @@ then :
fi # end of 64-bit decision tree fi # end of 64-bit decision tree
pkg-config --version > /dev/null pkg-config --version > /dev/null
use_pkg_config=$? use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then if test "x${CUDAFLAGS}${CUDALDFLAGS}" = "x"; then
# pkg-config is available if test "x$use_pkg_config" = "x0"; then
declare -a pkg_array=$(pkg-config --list-all | grep cudart) # pkg-config is available
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null declare -a pkg_array=$(pkg-config --list-all | grep cudart)
result=$? for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null
if test "x$result" = "x0"; then result=$?
# CUDA runtime detected if test "x$result" = "x0"; then
cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart) # CUDA runtime detected
CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg}) cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart)
CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg}) CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
fi # end of CUDA runtime decision tree CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
else fi # end of CUDA runtime decision tree
# pkg-config is not available echo $CUDALDFLAGS | grep cudart > /dev/null
if test -f /usr/local/cuda/include/cuda.h; then cudart_check=$?
CUDAFLAGS="-I/usr/local/cuda/include" if test "x${cudart_check}" != "x0"; then
CUDALDFLAGS="-L/usr/local/cuda/lib64 -lcudart" CUDALDFLAGS="$CUDALDFLAGS -lcudart"
elif test -f /usr/include/cuda.h; then fi
CUDAFLAGS="-I/usr/include" else
CUDALDFLAGS="-lcudart" # pkg-config is not available
elif test "x$CUDA_HOME" != "x"; then if test -f /usr/local/cuda/include/cuda.h; then
CUDAFLAGS="-I${CUDA_HOME}/include" CUDAFLAGS="-I/usr/local/cuda/include"
CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart" CUDALDFLAGS="-L/usr/local/cuda/lib64 -lcudart"
fi elif test -f /usr/include/cuda.h; then
fi # end of pkg-config decision tree CUDAFLAGS="-I/usr/include"
CUDALDFLAGS="-lcudart"
elif test "x$CUDA_HOME" != "x"; then
CUDAFLAGS="-I${CUDA_HOME}/include"
CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart"
fi
fi # end of pkg-config decision tree
fi # end of CUDAFLAGS user override protection
if test "x${MAGMA_ROOT}${MAGMA_HOME}${MAGMA_DIR}" = "x"; then if test "x${MAGMA_ROOT}${MAGMA_HOME}${MAGMA_DIR}" = "x"; then
# MAGMA environment is not defined # MAGMA environment is not defined
if "x$use_pkg_config" = "x0"; then if test "x$use_pkg_config" = "x0"; then
# use pkg-config to search for MAGMA # use pkg-config to search for MAGMA
declare -a pkg_array=$(pkg-config --list-all | grep magma) declare -a pkg_array=$(pkg-config --list-all | grep magma)
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma > /dev/null for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma > /dev/null
...@@ -25401,7 +25408,7 @@ then : ...@@ -25401,7 +25408,7 @@ then :
# MAGMA was found # MAGMA was found
magma_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma) magma_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma)
MAGMA_INCLUDE=$(pkg-config --cflags-only-I ${magma_pkg}) MAGMA_INCLUDE=$(pkg-config --cflags-only-I ${magma_pkg})
MAGMA_LIBS_DIR=$(pkg-config --cflags-only-L ${magma_pkg}) MAGMA_LIBS_DIR=$(pkg-config --libs-only-L ${magma_pkg})
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS ${MAGMA_INCLUDE}" export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS ${MAGMA_INCLUDE}"
export MAGMALDFLAGS="$CUDALDFLAGS ${MAGMA_LIBS_DIR} -lmagma" export MAGMALDFLAGS="$CUDALDFLAGS ${MAGMA_LIBS_DIR} -lmagma"
fi # end of MAGMA decision tree fi # end of MAGMA decision tree
...@@ -25459,33 +25466,40 @@ else case e in #( ...@@ -25459,33 +25466,40 @@ else case e in #(
fi # end of 64-bit decision tree fi # end of 64-bit decision tree
pkg-config --version > /dev/null pkg-config --version > /dev/null
use_pkg_config=$? use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then if test "x${CUDAFLAGS}${CUDALDFLAGS}" = "x"; then
# pkg-config is available if test "x$use_pkg_config" = "x0"; then
declare -a pkg_array=$(pkg-config --list-all | grep cudart) # pkg-config is available
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null declare -a pkg_array=$(pkg-config --list-all | grep cudart)
result=$? for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null
if test "x$result" = "x0"; then result=$?
# CUDA runtime detected if test "x$result" = "x0"; then
cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart) # CUDA runtime detected
CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg}) cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart)
CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg}) CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
fi # end of CUDA runtime decision tree CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
else fi # end of CUDA runtime decision tree
# pkg-config is not available echo $CUDALDFLAGS | grep cudart > /dev/null
if test -f /usr/local/cuda/include/cuda.h; then cudart_check=$?
CUDAFLAGS="-I/usr/local/cuda/include" if test "x${cudart_check}" != "x0"; then
CUDALDFLAGS="-L/usr/local/cuda/lib64 -lcudart" CUDALDFLAGS="$CUDALDFLAGS -lcudart"
elif test -f /usr/include/cuda.h; then fi
CUDAFLAGS="-I/usr/include" else
CUDALDFLAGS="-lcudart" # pkg-config is not available
elif test "x$CUDA_HOME" != "x"; then if test -f /usr/local/cuda/include/cuda.h; then
CUDAFLAGS="-I${CUDA_HOME}/include" CUDAFLAGS="-I/usr/local/cuda/include"
CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart" CUDALDFLAGS="-L/usr/local/cuda/lib64 -lcudart"
fi elif test -f /usr/include/cuda.h; then
fi # end of pkg-config decision tree CUDAFLAGS="-I/usr/include"
CUDALDFLAGS="-lcudart"
elif test "x$CUDA_HOME" != "x"; then
CUDAFLAGS="-I${CUDA_HOME}/include"
CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart"
fi
fi # end of pkg-config decision tree
fi # end of CUDAFLAGS user override protection
if test "x${MAGMA_ROOT}${MAGMA_HOME}${MAGMA_DIR}" = "x"; then if test "x${MAGMA_ROOT}${MAGMA_HOME}${MAGMA_DIR}" = "x"; then
# MAGMA environment is not defined # MAGMA environment is not defined
if "x$use_pkg_config" = "x0"; then if test "x$use_pkg_config" = "x0"; then
# use pkg-config to search for MAGMA # use pkg-config to search for MAGMA
declare -a pkg_array=$(pkg-config --list-all | grep magma) declare -a pkg_array=$(pkg-config --list-all | grep magma)
for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma > /dev/null for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma > /dev/null
...@@ -25494,7 +25508,7 @@ else case e in #( ...@@ -25494,7 +25508,7 @@ else case e in #(
# MAGMA was found # MAGMA was found
magma_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma) magma_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma)
MAGMA_INCLUDE=$(pkg-config --cflags-only-I ${magma_pkg}) MAGMA_INCLUDE=$(pkg-config --cflags-only-I ${magma_pkg})
MAGMA_LIBS_DIR=$(pkg-config --cflags-only-L ${magma_pkg}) MAGMA_LIBS_DIR=$(pkg-config --libs-only-L ${magma_pkg})
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS ${MAGMA_INCLUDE}" export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS ${MAGMA_INCLUDE}"
export MAGMALDFLAGS="$CUDALDFLAGS ${MAGMA_LIBS_DIR} -lmagma" export MAGMALDFLAGS="$CUDALDFLAGS ${MAGMA_LIBS_DIR} -lmagma"
fi # end of MAGMA decision tree fi # end of MAGMA decision tree
......
...@@ -160,33 +160,40 @@ m4_define( ...@@ -160,33 +160,40 @@ m4_define(
fi # end of 64-bit decision tree fi # end of 64-bit decision tree
pkg-config --version > /dev/null pkg-config --version > /dev/null
use_pkg_config=$? use_pkg_config=$?
if test "x$use_pkg_config" = "x0"; then if test "x${CUDAFLAGS}${CUDALDFLAGS}" = "x"; then
# pkg-config is available if test "x$use_pkg_config" = "x0"; then
declare -a pkg_array=$(pkg-config --list-all | grep cudart) # pkg-config is available
for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null declare -a pkg_array=$(pkg-config --list-all | grep cudart)
result=$? for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null
if test "x$result" = "x0"; then result=$?
# CUDA runtime detected if test "x$result" = "x0"; then
cuda_pkg=$(for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart) # CUDA runtime detected
CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg}) cuda_pkg=$(for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart)
CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg}) CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
fi # end of CUDA runtime decision tree CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
else fi # end of CUDA runtime decision tree
# pkg-config is not available echo $CUDALDFLAGS | grep cudart > /dev/null
if test -f /usr/local/cuda/include/cuda.h; then cudart_check=$?
CUDAFLAGS="-I/usr/local/cuda/include" if test "x${cudart_check}" != "x0"; then
CUDALDFLAGS="-L/usr/local/cuda/lib64 -lcudart" CUDALDFLAGS="$CUDALDFLAGS -lcudart"
elif test -f /usr/include/cuda.h; then fi
CUDAFLAGS="-I/usr/include" else
CUDALDFLAGS="-lcudart" # pkg-config is not available
elif test "x$CUDA_HOME" != "x"; then if test -f /usr/local/cuda/include/cuda.h; then
CUDAFLAGS="-I${CUDA_HOME}/include" CUDAFLAGS="-I/usr/local/cuda/include"
CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart" CUDALDFLAGS="-L/usr/local/cuda/lib64 -lcudart"
fi elif test -f /usr/include/cuda.h; then
fi # end of pkg-config decision tree CUDAFLAGS="-I/usr/include"
CUDALDFLAGS="-lcudart"
elif test "x$CUDA_HOME" != "x"; then
CUDAFLAGS="-I${CUDA_HOME}/include"
CUDALDFLAGS="-L${CUDA_HOME}/lib64 -lcudart"
fi
fi # end of pkg-config decision tree
fi # end of CUDAFLAGS user override protection
if test "x${MAGMA_ROOT}${MAGMA_HOME}${MAGMA_DIR}" = "x"; then if test "x${MAGMA_ROOT}${MAGMA_HOME}${MAGMA_DIR}" = "x"; then
# MAGMA environment is not defined # MAGMA environment is not defined
if "x$use_pkg_config" = "x0"; then if test "x$use_pkg_config" = "x0"; then
# use pkg-config to search for MAGMA # use pkg-config to search for MAGMA
declare -a pkg_array=$(pkg-config --list-all | grep magma) declare -a pkg_array=$(pkg-config --list-all | grep magma)
for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma > /dev/null for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma > /dev/null
...@@ -195,7 +202,7 @@ m4_define( ...@@ -195,7 +202,7 @@ m4_define(
# MAGMA was found # MAGMA was found
magma_pkg=$(for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma) magma_pkg=$(for i in "${pkg_array[[@]]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep magma)
MAGMA_INCLUDE=$(pkg-config --cflags-only-I ${magma_pkg}) MAGMA_INCLUDE=$(pkg-config --cflags-only-I ${magma_pkg})
MAGMA_LIBS_DIR=$(pkg-config --cflags-only-L ${magma_pkg}) MAGMA_LIBS_DIR=$(pkg-config --libs-only-L ${magma_pkg})
export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS ${MAGMA_INCLUDE}" export MAGMAFLAGS="-DUSE_MAGMA ${MAGMA_ILP64_FLAG} $CUDAFLAGS ${MAGMA_INCLUDE}"
export MAGMALDFLAGS="$CUDALDFLAGS ${MAGMA_LIBS_DIR} -lmagma" export MAGMALDFLAGS="$CUDALDFLAGS ${MAGMA_LIBS_DIR} -lmagma"
fi # end of MAGMA decision tree fi # end of MAGMA decision tree
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment