[cig-commits] [commit] devel: updates configuration and m4/ scripts (4865c1e)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Sep 25 03:49:48 PDT 2014


Repository : https://github.com/geodynamics/specfem3d

On branch  : devel
Link       : https://github.com/geodynamics/specfem3d/compare/69d1a6fe5d756c2d8d122dd4521d96ddd99b5671...63b33a6cfd79d58ef4ebcf2ca10eb8317b416a7d

>---------------------------------------------------------------

commit 4865c1e3781fc8a957ce4fd1d1051e25abed5953
Author: daniel peter <peterda at ethz.ch>
Date:   Mon Sep 22 11:43:31 2014 +0200

    updates configuration and m4/ scripts


>---------------------------------------------------------------

4865c1e3781fc8a957ce4fd1d1051e25abed5953
 configure    | 198 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 configure.ac |   6 +-
 m4           |   2 +-
 3 files changed, 177 insertions(+), 29 deletions(-)

diff --git a/configure b/configure
index 42298d5..b374d40 100755
--- a/configure
+++ b/configure
@@ -626,10 +626,11 @@ LIBOBJS
 CUDA_LIBS
 CUDA_LDFLAGS
 CUDA_CPPFLAGS
-NVCC
+NVCC_PROG
 CUDA_LIB
 CUDA_INC
 CUDA_FLAGS
+NVCC
 ADIOS_LIBS
 ADIOS_FCFLAGS
 ADIOS_CONFIG
@@ -779,6 +780,7 @@ CXXFLAGS
 CCC
 CXXCPP
 ADIOS_CONFIG
+NVCC
 CUDA_FLAGS
 CUDA_INC
 CUDA_LIB'
@@ -1453,7 +1455,8 @@ Some influential environment variables:
   ADIOS_CONFIG
               Path to adios_config program that indicates how to compile with
               it.
-  CUDA_FLAGS  Cuda compiler flags
+  NVCC        NVIDIA CUDA compiler command
+  CUDA_FLAGS  CUDA compiler flags
   CUDA_INC    Location of CUDA include files
   CUDA_LIB    Location of CUDA library libcudart
 
@@ -2797,6 +2800,10 @@ fi
 if test x"$MPIFC" = x && test x"$MPIF90" != x; then
     MPIFC="$MPIF90"
 fi
+# note: if not set, default FCFLAGS (and CFLAGS) will be set by autoconf/configure script (mostly -g -O2)
+if test x"$FCFLAGS" = x && test x"$FLAGS_CHECK" != x ; then
+    FCFLAGS=""
+fi
 
 ac_ext=${ac_fc_srcext-f}
 ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
@@ -3249,6 +3256,7 @@ FFLAGS="$FCFLAGS"
 
 
 
+
 flags_guess="$SHELL $srcdir/flags.guess"
 { $as_echo "$as_me:${as_lineno-$LINENO}: running $flags_guess" >&5
 $as_echo "$as_me: running $flags_guess" >&6;}
@@ -7217,19 +7225,31 @@ if test "$want_cuda" != no; then
 ## ---- ##"
 
 
+  # influential environment variables
+
+
+
 
 
+  # tests NVCC variable
+  if test x"$NVCC" = x; then :
 
-    # Extract the first word of "nvcc", so it can be a program name with args.
-set dummy nvcc; ac_word=$2
+    NVCC=nvcc
+
+fi
+
+  # Check for compiler
+  # checks if program in path
+  # Extract the first word of "$NVCC", so it can be a program name with args.
+set dummy $NVCC; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_NVCC+:} false; then :
+if ${ac_cv_path_NVCC_PROG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $NVCC in
+  case $NVCC_PROG in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_NVCC="$NVCC" # Let the user override the test with a path.
+  ac_cv_path_NVCC_PROG="$NVCC_PROG" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -7239,7 +7259,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_NVCC="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_path_NVCC_PROG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -7250,20 +7270,21 @@ IFS=$as_save_IFS
   ;;
 esac
 fi
-NVCC=$ac_cv_path_NVCC
-if test -n "$NVCC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NVCC" >&5
-$as_echo "$NVCC" >&6; }
+NVCC_PROG=$ac_cv_path_NVCC_PROG
+if test -n "$NVCC_PROG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NVCC_PROG" >&5
+$as_echo "$NVCC_PROG" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-  if test -z "$NVCC" ; then
-    as_fn_error $? "cannot find 'nvcc' program." "$LINENO" 5
+  if test -z "$NVCC_PROG" ; then
+    as_fn_error $? "cannot find '$NVCC' program, please check your PATH." "$LINENO" 5
   fi
 
+  # Checks for compiling and linking
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -7271,35 +7292,76 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-  CPPFLAGS_save="$CPPFLAGS"
+  CFLAGS_save="$CFLAGS"
   LDFLAGS_save="$LDFLAGS"
   LIBS_save="$LIBS"
 
-    if test "x$CUDA_INC" != "x"; then
+  # uses nvcc compiler
+  CFLAGS="$CUDA_FLAGS"
+  if test "x$CUDA_INC" != "x"; then
     CUDA_CPPFLAGS="-I$CUDA_INC"
-    CPPFLAGS="$CUDA_CPPFLAGS $CPPFLAGS"
+    CFLAGS="$CFLAGS $CUDA_CPPFLAGS"
   fi
-  ac_fn_c_check_header_mongrel "$LINENO" "cuda_runtime.h" "ac_cv_header_cuda_runtime_h" "$ac_includes_default"
-if test "x$ac_cv_header_cuda_runtime_h" = xyes; then :
+
+  # Check for CUDA headers
+  # runs test with nvcc
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cuda_runtime.h" >&5
+$as_echo_n "checking for cuda_runtime.h... " >&6; }
+  ac_compile='$NVCC -c $CFLAGS conftest.$ac_ext >&5'
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+#include <cuda.h>
+#include <cuda_runtime.h>
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+void* ptr = 0;
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 else
 
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
     as_fn_error $? "CUDA runtime header not found; try setting CUDA_INC." "$LINENO" 5
 
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-
-
+  # Check fo CUDA library
   if test "x$CUDA_LIB" != "x"; then
     CUDA_LDFLAGS="-L$CUDA_LIB"
     LDFLAGS="$CUDA_LDFLAGS $LDFLAGS"
   fi
   CUDA_LIBS="-lcudart"
   LIBS="$CUDA_LIBS $LIBS"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cudaMalloc in -lcudart" >&5
-$as_echo_n "checking for cudaMalloc in -lcudart... " >&6; }
+
+  # runs compilation test with nvcc
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking nvcc compilation with cudaMalloc in -lcudart" >&5
+$as_echo_n "checking nvcc compilation with cudaMalloc in -lcudart... " >&6; }
+  ac_compile='$NVCC -c $CFLAGS conftest.$ac_ext >&5'
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+
+
+#include <cuda.h>
 #include <cuda_runtime.h>
 #ifdef FC_DUMMY_MAIN
 #ifndef FC_DUMMY_MAIN_EQ_F77
@@ -7312,8 +7374,48 @@ $as_echo_n "checking for cudaMalloc in -lcudart... " >&6; }
 int
 main ()
 {
-void* ptr = 0;
-  	             cudaMalloc(&ptr, 1);
+void* ptr = 0;cudaMalloc(&ptr, 1);
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    as_fn_error $? "CUDA library function with nvcc compilation failed; try setting CUDA_INC." "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+  # runs linking test with nvcc
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking nvcc linking with cudaMalloc in -lcudart" >&5
+$as_echo_n "checking nvcc linking with cudaMalloc in -lcudart... " >&6; }
+  ac_link='$NVCC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#include <cuda.h>
+#include <cuda_runtime.h>
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+void* ptr = 0;cudaMalloc(&ptr, 1);
   ;
   return 0;
 }
@@ -7324,13 +7426,54 @@ $as_echo "yes" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-     as_fn_error $? "CUDA library not found; try setting CUDA_LIB." "$LINENO" 5
+     as_fn_error $? "CUDA library linking with nvcc failed; try setting CUDA_LIB." "$LINENO" 5
 
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-  CPPFLAGS="$CPPFLAGS_save"
+  # runs linking test with standard compiler
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking linking with cudaMalloc in -lcudart" >&5
+$as_echo_n "checking linking with cudaMalloc in -lcudart... " >&6; }
+  # C compiler linking
+  #ac_link='$NVCC -c $CFLAGS conftest.$ac_ext >&5; $CC -o conftest$ac_exeext $LDFLAGS conftest.$ac_objext $LIBS >&5'
+  # Fortran compiler linking
+  ac_link='$NVCC -c $CFLAGS conftest.$ac_ext >&5; $FC -o conftest$ac_exeext $LDFLAGS conftest.$ac_objext $LIBS >&5'
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#include <cuda.h>
+#include <cuda_runtime.h>
+#ifdef FC_DUMMY_MAIN
+#ifndef FC_DUMMY_MAIN_EQ_F77
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int FC_DUMMY_MAIN() { return 1; }
+#endif
+#endif
+int
+main ()
+{
+void* ptr = 0;cudaMalloc(&ptr, 1);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+     as_fn_error $? "CUDA library linking failed; try setting CUDA_LIB." "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+  CFLAGS="$CFLAGS_save"
   LDFLAGS="$LDFLAGS_save"
   LIBS="$LIBS_save"
   ac_ext=${ac_fc_srcext-f}
@@ -7343,6 +7486,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 
 
 
+
 fi
 
 
diff --git a/configure.ac b/configure.ac
index 7e9d279..86ff72d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,12 +100,17 @@ fi
 if test x"$MPIFC" = x && test x"$MPIF90" != x; then
     MPIFC="$MPIF90"
 fi
+# note: if not set, default FCFLAGS (and CFLAGS) will be set by autoconf/configure script (mostly -g -O2)
+if test x"$FCFLAGS" = x && test x"$FLAGS_CHECK" != x ; then
+    FCFLAGS=""
+fi
 
 AC_PROG_FC
 export FC
 export MPIFC
 F77="$FC"
 FFLAGS="$FCFLAGS"
+
 AC_PROVIDE([AC_PROG_F77])
 AC_SUBST([FCENV])
 AC_SUBST(srcdir)
@@ -310,7 +315,6 @@ fi
 
 if test "$want_cuda" != no; then
     AS_BOX([CUDA])
-    AC_ARG_VAR(CUDA_FLAGS, [Cuda compiler flags])
     CIT_CUDA_CONFIG
 fi
 
diff --git a/m4 b/m4
index c851339..ba14abf 160000
--- a/m4
+++ b/m4
@@ -1 +1 @@
-Subproject commit c851339a3cece6a757b1f1daaab45ac0a348c47d
+Subproject commit ba14abf73197b78e13d1a155a8f84ceb1d7be3e4



More information about the CIG-COMMITS mailing list