fix AVX support detection on non-x86
This commit is contained in:
parent
9c552d83db
commit
8ffdea2196
@ -1,57 +1,61 @@
|
||||
diff -up mpich/configure.ac.avx mpich/configure.ac
|
||||
--- mpich/configure.ac.avx 2015-08-06 15:03:47.104647048 +0200
|
||||
+++ mpich/configure.ac 2015-08-06 15:09:33.474371411 +0200
|
||||
@@ -211,6 +211,21 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
[can_compile_avx=yes],
|
||||
[can_compile_avx=no]
|
||||
--- mpich/configure.ac.avx 2015-08-06 17:31:47.819635434 +0200
|
||||
+++ mpich/configure.ac 2015-08-07 12:42:07.817171493 +0200
|
||||
@@ -198,8 +198,12 @@ AC_MSG_RESULT([${can_compile_sse}])
|
||||
|
||||
dnl check whether one can compile with avx - gcc intrinsics
|
||||
|
||||
+save_CFLAGS="$CFLAGS"
|
||||
+save_CXXFLAGS="$CXXFLAGS"
|
||||
+
|
||||
dnl first pass: try with specified CFLAGS and CXXFLAGS
|
||||
AC_MSG_CHECKING([whether we can compile AVX intrinsics in C])
|
||||
+CFLAGS="$CFLAGS -mavx"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
#include <x86intrin.h>
|
||||
int main(int argc, char **argv){
|
||||
@@ -213,6 +217,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
)
|
||||
+dnl first test failed: try again after updating CFLAGS and CXXFLAGS with -mavx
|
||||
+if test x"${can_compile_avx}" = x"no"; then
|
||||
+ CFLAGS="$CFLAGS -mavx"
|
||||
+ CXXFLAGS="$CXXFLAGS -mavx"
|
||||
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
+ #include <x86intrin.h>
|
||||
+ int main(int argc, char **argv){
|
||||
+ double* q;
|
||||
+ __m256d a1_1 = _mm256_load_pd(q);
|
||||
+ }
|
||||
+ ])],
|
||||
+ [can_compile_avx=yes],
|
||||
+ [can_compile_avx=no]
|
||||
+ )
|
||||
+fi
|
||||
AC_MSG_RESULT([${can_compile_avx}])
|
||||
if test "${can_compile_avx}" = "yes" ; then
|
||||
+ AVXCFLAGS="-mavx"
|
||||
+ CXXFLAGS="$CXXFLAGS -mavx"
|
||||
AC_MSG_CHECKING([whether we can compile AVX intrinsics in C++])
|
||||
@@ -230,7 +245,11 @@ if test "${can_compile_avx}" = "yes" ; t
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
@@ -230,9 +236,14 @@ if test "${can_compile_avx}" = "yes" ; t
|
||||
AC_MSG_RESULT([${can_compile_avx}])
|
||||
if test "${can_compile_avx}" = "no" ; then
|
||||
AC_MSG_WARN([Cannot compile C++ with AVX: disabling AVX alltogether])
|
||||
+ else
|
||||
+ AVXCFLAGS="-mavx"
|
||||
+ AVXCXXFLAGS="-mavx"
|
||||
fi
|
||||
+ CFLAGS=$save_CFLAGS
|
||||
+ CXXFLAGS=$save_CXXFLAGS
|
||||
fi
|
||||
|
||||
+CFLAGS=$save_CFLAGS
|
||||
+CXXFLAGS=$save_CXXFLAGS
|
||||
+
|
||||
if test "${can_compile_avx}" = "yes" ; then
|
||||
@@ -634,6 +653,7 @@ AC_SUBST([OPENMP_CFLAGS])
|
||||
install_real_avx_block2=yes
|
||||
install_real_avx_block4=yes
|
||||
@@ -634,6 +645,8 @@ AC_SUBST([OPENMP_CFLAGS])
|
||||
AC_SUBST([OPENMP_FCFLAGS])
|
||||
AC_SUBST([OPENMP_LDFLAGS])
|
||||
#AC_SUBST(OPT_FCFLAGS)
|
||||
+AC_SUBST([AVXCFLAGS])
|
||||
+AC_SUBST([AVXCXXFLAGS])
|
||||
|
||||
rm -rf modules/ .fortran_dependencies/
|
||||
mkdir modules
|
||||
diff -up mpich/Makefile.am.avx mpich/Makefile.am
|
||||
--- mpich/Makefile.am.avx 2015-04-20 10:46:16.000000000 +0200
|
||||
+++ mpich/Makefile.am 2015-08-06 15:03:47.106647058 +0200
|
||||
+++ mpich/Makefile.am 2015-08-06 17:31:47.820635439 +0200
|
||||
@@ -8,6 +8,8 @@ AM_LDFLAGS = $(SCALAPACK_LDFLAGS)
|
||||
# libelpa
|
||||
lib_LTLIBRARIES = libelpa@SUFFIX@.la
|
||||
libelpa@SUFFIX@_la_LINK = $(FCLINK) $(AM_LDFLAGS) -version-info $(ELPA_SO_VERSION) -lstdc++
|
||||
+libelpa@SUFFIX@_la_CFLAGS = $(AVXCFLAGS) $(AM_CFLAGS)
|
||||
+libelpa@SUFFIX@_la_CXXFLAGS = $(AVXCFLAGS) $(AM_CXXFLAGS)
|
||||
+libelpa@SUFFIX@_la_CXXFLAGS = $(AVXCXXFLAGS) $(AM_CFLAGS)
|
||||
|
||||
libelpa@SUFFIX@_la_SOURCES = src/elpa_utilities.F90 \
|
||||
src/elpa1.F90 \
|
||||
|
Loading…
Reference in New Issue
Block a user