Fix shared-libraries build for HIP (#478)

This PR by @pbauman #477 fixes shared library build with HIP.
Co-authored-by: Paul T. Bauman <ptbauman@gmail.com>
This commit is contained in:
Ruipeng Li 2021-09-17 09:07:43 -07:00 committed by GitHub
parent 001d4fe2c7
commit 5971f0b979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -1903,7 +1903,7 @@ dnl BUILD_F77_SHARED="${F77} ${SHARED_BUILD_FLAG}"
BUILD_CC_SHARED="\${CC} ${SHARED_BUILD_FLAG}"
fi
BUILD_CXX_SHARED="\${CXX} ${SHARED_BUILD_FLAG}"
if test "$hypre_using_cuda" = "yes"
if test "$hypre_using_cuda" == "yes" || test "$hypre_using_hip" == "yes"
then
dnl BUILD_CC_SHARED="\${CUCC} ${SHARED_BUILD_FLAG}"
BUILD_CC_SHARED="\${CXX} ${SHARED_BUILD_FLAG}"
@ -2202,6 +2202,15 @@ AS_IF([test x"$hypre_using_hip" == x"yes"],
[HIPCXXFLAGS="-O0 -Wall -g -ggdb ${HIPCXXFLAGS}"],
[HIPCXXFLAGS="-O2 ${HIPCXXFLAGS}"],)
dnl If we're doing a shared build, we need the compile flag for it
dnl Note we're not just using CXXFLAGS here because that can suck other
dnl things that don't play nice, like openmp.
if test "$hypre_using_shared" = "yes"
then
HIPCXXFLAGS="${SHARED_COMPILE_FLAG} ${HIPCXXFLAGS}"
fi
dnl (Ab)Use CUFLAGS to capture HIP compilation flags
dnl Put HIPCXXFLAGS at the end so the user can override the optimization level.
if test "$hypre_user_chose_cuflags" = "no"

8
src/configure vendored
View File

@ -8489,7 +8489,7 @@ then
BUILD_CC_SHARED="\${CC} ${SHARED_BUILD_FLAG}"
fi
BUILD_CXX_SHARED="\${CXX} ${SHARED_BUILD_FLAG}"
if test "$hypre_using_cuda" = "yes"
if test "$hypre_using_cuda" == "yes" || test "$hypre_using_hip" == "yes"
then
BUILD_CC_SHARED="\${CXX} ${SHARED_BUILD_FLAG}"
fi
@ -8947,6 +8947,12 @@ elif HIPCXXFLAGS="-O2 ${HIPCXXFLAGS}"; then :
fi
if test "$hypre_using_shared" = "yes"
then
HIPCXXFLAGS="${SHARED_COMPILE_FLAG} ${HIPCXXFLAGS}"
fi
if test "$hypre_user_chose_cuflags" = "no"
then
CUFLAGS="${HIPCPPFLAGS} ${HIPCXXFLAGS}"