[CIG-SEISMO] patch for SCOTCH in SPECFEM3D for OS X

Brad Aagaard baagaard at usgs.gov
Fri Jul 12 08:37:38 PDT 2013


Attached is a patch to fix the missing clock_gettime issue in 
src/decompose_mesh/scotch_5.1.12b/src/libscotch/common.c for OS X.

I also had to remove -lrt from LDFLAGS in the 
src/decompose_mesh/scotch_5.1.12b/src/Makefile.inc file. It doesn't look 
like you are using configure to test for libraries, etc so it is not 
clear to me how to supply a patch to fix this missing library issue. In 
the long run, the proper approach would be to test for headers and 
libraries in configure and adjust the Makefiles accordingly.

Regards,
Brad
-------------- next part --------------
Index: src/decompose_mesh/scotch_5.1.12b/src/libscotch/common.c
===================================================================
--- src/decompose_mesh/scotch_5.1.12b/src/libscotch/common.c	(revision 22563)
+++ src/decompose_mesh/scotch_5.1.12b/src/libscotch/common.c	(working copy)
@@ -104,7 +104,14 @@
 #else /* COMMON_TIMING_OLD */
   struct timespec     tp;
 
-  clock_gettime (CLOCK_REALTIME, &tp);            /* Elapsed time */
+#if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0
+    clock_gettime(CLOCK_REALTIME, &tp);
+#else
+    struct timeval tv;
+    gettimeofday(&tv, NULL);
+    tp.tv_sec = tv.tv_sec;
+    tp.tv_nsec = tv.tv_usec * 1000;
+#endif
 
   return ((double) tp.tv_sec + (double) tp.tv_nsec * 1.0e-9L);
 #endif /* COMMON_TIMING_OLD */


More information about the CIG-SEISMO mailing list