소스 검색

misc mingw fixes

Samuel Thibault 15 년 전
부모
커밋
22399386c3
6개의 변경된 파일32개의 추가작업 그리고 5개의 파일을 삭제
  1. 3 1
      configure.ac
  2. 3 2
      examples/pi/pi_redux.c
  3. 1 1
      examples/spmv/dw_spmv.h
  4. 23 0
      examples/stencil/stencil-kernels.c
  5. 1 1
      examples/tag_example/tag_restartable.c
  6. 1 0
      include/starpu_config.h.in

+ 3 - 1
configure.ac

@@ -97,9 +97,11 @@ AC_CHECK_FUNCS([memalign], [AC_DEFINE([STARPU_HAVE_MEMALIGN], [1], [Define to 1
 # Some systems don't have drand48
 AC_CHECK_FUNCS([drand48],
   AC_DEFINE([starpu_srand48(seed)],[srand48(seed)],[srand48 equivalent function])
-  AC_DEFINE([starpu_drand48()],[drand48()],[drand48 equivalent function]),
+  AC_DEFINE([starpu_drand48()],[drand48()],[drand48 equivalent function])
+  AC_DEFINE([starpu_erand48(xsubi)],[erand48(xsubi)],[erand48 equivalent function]),
   AC_DEFINE([starpu_srand48(seed)],[srand(seed)],[srand48 equivalent function])
   AC_DEFINE([starpu_drand48()],[((double)(rand()) / RAND_MAX)],[drand48 equivalent function])
+  AC_DEFINE([starpu_erand48(xsubi)],[starpu_drand48()],[erand48 equivalent function])
 )
 
 AC_CHECK_HEADERS([malloc.h], [AC_DEFINE([STARPU_HAVE_MALLOC_H], [1], [Define to 1 if you have the <malloc.h> header file.])])

+ 3 - 2
examples/pi/pi_redux.c

@@ -17,6 +17,7 @@
 #include <starpu.h>
 #include <stdlib.h>
 #include <sys/time.h>
+#include <starpu_config.h>
 
 #define PI	3.14159265358979323846
 
@@ -111,8 +112,8 @@ static void pi_func_cpu(void *descr[], void *cl_arg __attribute__ ((unused)))
 	int i;
 	for (i = 0; i < NSHOT_PER_TASK; i++)
 	{
-		float x = (float)(2.0*erand48(worker_xsub) - 1.0);
-		float y = (float)(2.0*erand48(worker_xsub) - 1.0);
+		float x = (float)(2.0*starpu_erand48(worker_xsub) - 1.0);
+		float y = (float)(2.0*starpu_erand48(worker_xsub) - 1.0);
 
 		float dist = x*x + y*y;
 		if (dist < 1.0)

+ 1 - 1
examples/spmv/dw_spmv.h

@@ -17,11 +17,11 @@
 #ifndef __DW_SPARSE_CG_H__
 #define __DW_SPARSE_CG_H__
 
+#include <sys/types.h>
 #include <semaphore.h>
 #include <string.h>
 #include <stdint.h>
 #include <math.h>
-#include <sys/types.h>
 #include <sys/time.h>
 #include <pthread.h>
 #include <signal.h>

+ 23 - 0
examples/stencil/stencil-kernels.c

@@ -17,6 +17,29 @@
 #include "stencil.h"
 #include <sys/time.h>
 
+#ifndef timersub
+#define	timersub(x, y, res) \
+	do { \
+		(res)->tv_sec = (x)->tv_sec - (y)->tv_sec; \
+		(res)->tv_usec = (x)->tv_usec - (y)->tv_usec; \
+		if ((res)->tv_usec < 0) { \
+			(res)->tv_sec--; \
+			(res)->tv_usec += 1000000; \
+		} \
+	} while (0)
+#endif
+#ifndef timeradd
+#define	timeradd(x, y, res) \
+	do { \
+		(res)->tv_sec = (x)->tv_sec + (y)->tv_sec; \
+		(res)->tv_usec = (x)->tv_usec + (y)->tv_usec; \
+		if ((res)->tv_usec >= 1000000) { \
+			(res)->tv_sec++; \
+			(res)->tv_usec -= 1000000; \
+		} \
+	} while (0)
+#endif
+
 /* Computation Kernels */
 
 /*

+ 1 - 1
examples/tag_example/tag_restartable.c

@@ -14,10 +14,10 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
+#include <sys/types.h>
 #include <semaphore.h>
 #include <string.h>
 #include <math.h>
-#include <sys/types.h>
 #include <pthread.h>
 #include <unistd.h>
 #include <signal.h>

+ 1 - 0
include/starpu_config.h.in

@@ -54,5 +54,6 @@
 
 #undef starpu_drand48
 #undef starpu_srand48
+#undef starpu_erand48
 
 #endif