[cig-commits] [commit] devel, master: updates configuration to take new m4/ cuda checks (65bcff0)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Nov 6 08:31:37 PST 2014


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

On branches: devel,master
Link       : https://github.com/geodynamics/specfem3d_globe/compare/bc58e579b3b0838a0968725a076f5904845437ca...be63f20cbb6f462104e949894dbe205d2398cd7f

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

commit 65bcff0851f78f3a19a5f81c3abaf3cdb83e7e8d
Author: daniel peter <peterda at ethz.ch>
Date:   Fri Sep 19 21:58:34 2014 +0200

    updates configuration to take new m4/ cuda checks


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

65bcff0851f78f3a19a5f81c3abaf3cdb83e7e8d
 configure    | 192 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 configure.ac |  11 +++-
 flags.guess  |   4 +-
 m4           |   2 +-
 4 files changed, 179 insertions(+), 30 deletions(-)

diff --git a/configure b/configure
index 8f7ecf4..346ba51 100755
--- a/configure
+++ b/configure
@@ -644,9 +644,10 @@ OCL_CPU_FLAGS
 CUDA_LIBS
 CUDA_LDFLAGS
 CUDA_CPPFLAGS
-NVCC
+NVCC_PROG
 CUDA_LIB
 CUDA_INC
+NVCC
 CUDA_FLAGS
 CONFIGURE_FLAGS
 ADIOS_LIBS
@@ -776,6 +777,7 @@ LOCAL_PATH_IS_ALSO_GLOBAL
 CPP
 ADIOS_CONFIG
 CUDA_FLAGS
+NVCC
 CUDA_INC
 CUDA_LIB
 OCL_CPU_FLAGS
@@ -1442,6 +1444,7 @@ Some influential environment variables:
               Path to adios_config program that indicates how to compile with
               it.
   CUDA_FLAGS  Cuda compiler flags
+  NVCC        NVIDIA CUDA compiler command
   CUDA_INC    Location of CUDA include files
   CUDA_LIB    Location of CUDA library libcudart
   OCL_CPU_FLAGS
@@ -6292,18 +6295,31 @@ if test x"$want_cuda" != xno; then :
 
 
 
+  # influential environment variables
+
+
+
+
+
+  # tests NVCC variable
+  if test x"$NVCC" = x; then :
 
+    NVCC=nvcc
 
-    # Extract the first word of "nvcc", so it can be a program name with args.
-set dummy nvcc; ac_word=$2
+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
@@ -6313,7 +6329,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
@@ -6324,20 +6340,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'
@@ -6345,35 +6362,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
@@ -6386,8 +6444,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;
 }
@@ -6398,13 +6496,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}
@@ -6418,6 +6557,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu
 
 
 
+
 fi
 
 if test x"$want_opencl" != xno; then :
diff --git a/configure.ac b/configure.ac
index 8b3a182..487b549 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,6 +140,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_PROG_FC
 export FC
@@ -233,7 +237,6 @@ AC_SUBST([CONFIGURE_FLAGS])
 
 AS_IF([test x"$want_cuda" != xno], [
     AS_BOX([CUDA])
-    AC_ARG_VAR(CUDA_FLAGS, [Cuda compiler flags])
     CIT_CUDA_CONFIG
 ])
 
@@ -268,7 +271,13 @@ AS_IF([test x"$want_vtk" != xno], [
     VTK_LIBS="-lvtkRendering -lvtkGraphics $VTK_LIBS"
 ])
 
+###
+### MPI
+###
+
 AS_IF([test x"$want_cuda" != xno -o x"$want_vtk" != xno], [
+    AS_BOX([MPI])
+    # checks MPI include directory
     CIT_MPI_INCDIR([$MPIFC])
 ])
 
diff --git a/flags.guess b/flags.guess
index e74e1f2..34b08f0 100644
--- a/flags.guess
+++ b/flags.guess
@@ -112,7 +112,7 @@ case $my_FC in
         #
         DEF_FFLAGS="-std=gnu -fimplicit-none -frange-check -fmax-errors=10 -pedantic -pedantic-errors -Waliasing -Wampersand -Wcharacter-truncation -Wline-truncation -Wsurprising -Wno-tabs -Wunderflow -ffpe-trap=invalid,zero,overflow" # -mcmodel=medium
         OPT_FFLAGS="-O2"
-        DEBUG_FFLAGS="-ggdb -fbacktrace -fbounds-check"
+        DEBUG_FFLAGS="-g -O0 -ggdb -fbacktrace -fbounds-check"
         # useful to track loss of accuracy because of automatic double to single precision conversion:  -Wconversion  (this may generate many warnings...)
         ;;
     g95|*/g95)
@@ -121,7 +121,7 @@ case $my_FC in
         #
         DEF_FFLAGS="-fimplicit-none"
         OPT_FFLAGS="-O"
-        DEBUG_FFLAGS="-fbounds-check -ftrace"
+        DEBUG_FFLAGS="-g -O0 -fbounds-check -ftrace"
         ;;
     f90|*/f90)
         case $host_os in
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