Skip to content

Commit

Permalink
Restructure configure and configure.in to avoid errors: cuda.h no suc…
Browse files Browse the repository at this point in the history
…h file and integer expression expected on Power 9 and Power 10.
  • Loading branch information
Treece Burgess committed Jan 10, 2025
1 parent a81cb4c commit 4e3718e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
19 changes: 15 additions & 4 deletions src/configure
Original file line number Diff line number Diff line change
Expand Up @@ -4818,11 +4818,22 @@ else
CPU="x86"
elif test "$family" = "ppc64" || test "$family" = "ppc64le"; then
cuda_version=`grep -r '#define CUDA_VERSION [0-9]' $PAPI_CUDA_ROOT/include/cuda.h | awk '{print $3}'`
if (test "$family" = "ppc64le" && test "$CC_COMMON_NAME" = "gcc" && test "$major" -ge 8 \
&& test "$major" -lt 9 && test "$cuda_version" -ge 10000 && test "$cuda_version" -lt 11000); then
NVPPC64LEFLAGS="-Xcompiler -mno-float128"
if (test "$family" = "ppc64le" && test "$CC_COMMON_NAME" = "gcc"); then
# set cuda_version to be 0, such that we avoid "integer expression expected"
cuda_version=0
if (test ! -z "$PAPI_CUDA_ROOT"); then
cuda_version=`grep -r '#define CUDA_VERSION [0-9]' $PAPI_CUDA_ROOT/include/cuda.h | awk '{print $3}'`
fi
# get gcc major number
gcc_major=`gcc -v 2>&1 | tail -n 1 | awk '{printf $3}' | sed 's/\([^.][^.]*\).*/\1/'`
# set variable if the gcc and cuda versions match conditions
if (test "$cuda_version" -ge 10000 && test "$cuda_version" -lt 11000 \
&& test "$gcc_major" -ge 8 && test "$gcc_major" -lt 9); then
NVPPC64LEFLAGS="-Xcompiler -mno-float128"
fi
fi
CPU_info="`cat /proc/cpuinfo | grep cpu | cut -d: -f2 | cut -d' ' -f2 | sed '2,$d' | tr -d ","`"
case "$CPU_info" in
PPC970*) CPU="PPC970";;
Expand Down
21 changes: 16 additions & 5 deletions src/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,22 @@ AC_ARG_WITH(CPU,
CPU="x86"

elif test "$family" = "ppc64" || test "$family" = "ppc64le"; then
cuda_version=`grep -r '#define CUDA_VERSION [0-9]' $PAPI_CUDA_ROOT/include/cuda.h | awk '{print $3}'`
if (test "$family" = "ppc64le" && test "$CC_COMMON_NAME" = "gcc" && test "$major" -ge 8 \
&& test "$major" -lt 9 && test "$cuda_version" -ge 10000 && test "$cuda_version" -lt 11000); then
NVPPC64LEFLAGS="-Xcompiler -mno-float128"
fi

if (test "$family" = "ppc64le" && test "$CC_COMMON_NAME" = "gcc"); then
# set cuda_version to be 0, such that we avoid "integer expression expected"
cuda_version=0
if (test ! -z "$PAPI_CUDA_ROOT"); then
cuda_version=`grep -r '#define CUDA_VERSION [0-9]' $PAPI_CUDA_ROOT/include/cuda.h | awk '{print $3}'`
fi
# get gcc major number
gcc_major=`gcc -v 2>&1 | tail -n 1 | awk '{printf $3}' | sed 's/\([[^.]][[^.]]*\).*/\1/'`
# set variable if the gcc and cuda versions match conditions
if (test "$cuda_version" -ge 10000 && test "$cuda_version" -lt 11000 \
&& test "$gcc_major" -ge 8 && test "$gcc_major" -lt 9); then
NVPPC64LEFLAGS="-Xcompiler -mno-float128"
fi
fi

CPU_info="`cat /proc/cpuinfo | grep cpu | cut -d: -f2 | cut -d' ' -f2 | sed '2,$d' | tr -d ","`"
case "$CPU_info" in
PPC970*) CPU="PPC970";;
Expand Down

0 comments on commit 4e3718e

Please sign in to comment.