Marc Sergent 12 роки тому
батько
коміт
51837ba50c
100 змінених файлів з 590 додано та 392 видалено
  1. 5 0
      ChangeLog
  2. 14 2
      INSTALL
  3. 2 1
      Makefile.am
  4. 5 0
      doc/chapters/advanced-api.texi
  5. 4 5
      examples/audio/starpu_audio_processing.c
  6. 4 3
      examples/axpy/axpy.c
  7. 3 3
      examples/basic_examples/block.c
  8. 2 2
      examples/basic_examples/hello_world.c
  9. 1 2
      examples/basic_examples/mult.c
  10. 1 1
      examples/basic_examples/multiformat_conversion_codelets.c
  11. 1 1
      examples/basic_examples/multiformat_cuda.cu
  12. 1 1
      examples/basic_examples/multiformat_types.h
  13. 3 3
      examples/basic_examples/variable.c
  14. 2 2
      examples/basic_examples/vector_scal.c
  15. 2 3
      examples/binary/binary.c
  16. 5 5
      examples/callback/callback.c
  17. 1 1
      examples/cg/cg.c
  18. 2 2
      examples/cholesky/cholesky.h
  19. 4 3
      examples/cpp/incrementer_cpp.cpp
  20. 1 5
      examples/filters/custom_mf/custom_types.h
  21. 5 4
      examples/filters/fblock.c
  22. 3 2
      examples/filters/fmatrix.c
  23. 3 2
      examples/filters/fvector.c
  24. 1 1
      examples/filters/shadow.c
  25. 1 1
      examples/filters/shadow2d.c
  26. 1 1
      examples/filters/shadow3d.c
  27. 2 2
      examples/heat/dw_factolu.h
  28. 1 1
      examples/heat/dw_sparse_cg.c
  29. 0 1
      examples/heat/dw_sparse_cg.h
  30. 2 2
      examples/heat/heat.h
  31. 5 5
      examples/incrementer/incrementer.c
  32. 1 1
      examples/interface/complex.c
  33. 2 2
      examples/lu/lu_example.c
  34. 2 2
      examples/lu/xlu.h
  35. 2 3
      examples/matvecmult/matvecmult.c
  36. 2 2
      examples/mult/xgemm.c
  37. 2 2
      examples/openmp/vector_scal.c
  38. 2 2
      examples/pi/pi.c
  39. 1 1
      examples/pi/pi_redux.c
  40. 1 1
      examples/pipeline/pipeline.c
  41. 1 2
      examples/ppm_downscaler/yuv_downscaler.c
  42. 4 3
      examples/profiling/profiling.c
  43. 7 4
      examples/reductions/dot_product.c
  44. 7 4
      examples/reductions/minmax_reduction.c
  45. 6 6
      examples/sched_ctx/sched_ctx.c
  46. 16 16
      examples/sched_ctx_utils/sched_ctx_utils.c
  47. 25 24
      examples/scheduler/dummy_sched.c
  48. 1 1
      examples/spmd/vector_scal_spmd.c
  49. 2 2
      examples/spmv/dw_block_spmv.c
  50. 1 2
      examples/spmv/dw_block_spmv.h
  51. 3 2
      examples/spmv/spmv.c
  52. 2 3
      examples/spmv/spmv.h
  53. 3 3
      examples/tag_example/tag_example.c
  54. 3 3
      examples/tag_example/tag_example2.c
  55. 3 3
      examples/tag_example/tag_example3.c
  56. 5 4
      examples/tag_example/tag_example4.c
  57. 2 2
      examples/tag_example/tag_restartable.c
  58. 33 33
      include/pthread_win32/pthread.h
  59. 4 4
      include/pthread_win32/semaphore.h
  60. 2 0
      include/starpu.h
  61. 10 1
      include/starpu_config.h.in
  62. 2 2
      include/starpu_data_interfaces.h
  63. 1 1
      include/starpu_opencl.h
  64. 1 9
      include/starpu_perfmodel.h
  65. 11 11
      include/starpu_profiling.h
  66. 1 3
      include/starpu_sched_ctx.h
  67. 4 7
      include/starpu_scheduler.h
  68. 1 1
      include/starpu_stdlib.h
  69. 176 0
      include/starpu_thread.h
  70. 7 7
      include/starpu_util.h
  71. 8 7
      mpi/src/starpu_mpi.c
  72. 6 8
      mpi/src/starpu_mpi_private.h
  73. 2 2
      mpi/tests/helper.h
  74. 3 3
      mpi/tests/mpi_irecv_detached.c
  75. 4 4
      mpi/tests/mpi_isend_detached.c
  76. 3 3
      mpi/tests/mpi_probe.c
  77. 2 2
      mpi/tests/mpi_reduction_kernels.c
  78. 5 7
      sched_ctx_hypervisor/examples/app_driven_test/app_driven_test.c
  79. 17 17
      sched_ctx_hypervisor/examples/sched_ctx_utils/sched_ctx_utils.c
  80. 2 3
      sched_ctx_hypervisor/include/sched_ctx_hypervisor.h
  81. 2 2
      sched_ctx_hypervisor/src/hypervisor_policies/debit_lp_policy.c
  82. 3 3
      sched_ctx_hypervisor/src/hypervisor_policies/gflops_rate_policy.c
  83. 2 2
      sched_ctx_hypervisor/src/hypervisor_policies/ispeed_lp_policy.c
  84. 2 2
      sched_ctx_hypervisor/src/hypervisor_policies/ispeed_policy.c
  85. 14 14
      sched_ctx_hypervisor/src/hypervisor_policies/lp2_policy.c
  86. 4 4
      sched_ctx_hypervisor/src/hypervisor_policies/lp_policy.c
  87. 3 4
      sched_ctx_hypervisor/src/hypervisor_policies/policy_tools.c
  88. 0 1
      sched_ctx_hypervisor/src/hypervisor_policies/policy_tools.h
  89. 6 7
      sched_ctx_hypervisor/src/hypervisor_policies/simple_policy.c
  90. 2 2
      sched_ctx_hypervisor/src/sched_ctx_config.c
  91. 34 34
      sched_ctx_hypervisor/src/sched_ctx_hypervisor.c
  92. 2 2
      sched_ctx_hypervisor/src/sched_ctx_hypervisor_intern.h
  93. 2 2
      socl/src/debug.h
  94. 2 2
      socl/src/gc.h
  95. 2 0
      src/Makefile.am
  96. 2 1
      src/common/barrier.c
  97. 5 6
      src/common/barrier.h
  98. 1 0
      src/common/barrier_counter.c
  99. 4 2
      src/common/barrier_counter.h
  100. 0 0
      src/common/starpu_spinlock.c

+ 5 - 0
ChangeLog

@@ -109,6 +109,11 @@ New features:
   * starpu_malloc calls starpu_malloc_flags with a value of flag set
     to STARPU_MALLOC_PINNED
   * Define new function starpu_free_flags similarly to starpu_malloc_flags
+  * Define new public API starpu_pthread which is similar to the
+    pthread API. It is provided with 2 implementations: a pthread one
+    and a Simgrid one. Applications using StarPU and wishing to use
+    the Simgrid StarPU features should use it.
+
 
 Small features:
   * Add starpu_worker_get_by_type and starpu_worker_get_by_devid

+ 14 - 2
INSTALL

@@ -1,7 +1,7 @@
 # StarPU --- Runtime system for heterogeneous multicore architectures.
 #
 # Copyright (C) 2009-2012  Université de Bordeaux 1
-# Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+# Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
 #
 # StarPU is free software; you can redistribute it and/or modify
 # it under the terms of the GNU Lesser General Public License as published by
@@ -53,7 +53,7 @@ Make sure the following packages are available:
 
 2. Install mingw
 
-http://sourceforge.net/projects/mingw/
+http://www.mingw.org/
 
 3. Install hwloc (not mandatory, but strongly recommended)
 
@@ -176,9 +176,21 @@ autogen.sh part.
         --with-cuda-dir=<CUDA installation directory> \
         --with-cuda-lib-dir=<CUDA installation directory>/lib/Win32 \
 	--with-opencl-dir=<CUDA installation directory>
+        --disable-build-doc
+	--disable-build-examples --enable-quick-check
    make
+   make check   # not necessary but well advised
    make install
 
+   The option --disable-build-doc is necessary if you do not have a
+   working TeX binary installed as it is needed by texi2dvi to build
+   the documentation.
+
+   To fasten the compilation process, the option
+   --disable-build-examples may also be used to disable the
+   compilation of the applications in the examples directory. Only the
+   applications in the test directory will be build.
+
    Also convert a couple of files to CRLF:
 
    sed -e 's/$/'$'\015'/ < README > $prefix/README.txt

+ 2 - 1
Makefile.am

@@ -78,7 +78,8 @@ versinclude_HEADERS = 				\
 	include/starpu_rand.h			\
 	include/starpu_cublas.h			\
 	include/starpu_driver.h			\
-	include/starpu_stdlib.h
+	include/starpu_stdlib.h			\
+	include/starpu_thread.h
 
 nodist_versinclude_HEADERS = 			\
 	include/starpu_config.h

+ 5 - 0
doc/chapters/advanced-api.texi

@@ -1031,6 +1031,11 @@ where the worker will pop tasks first. Setting @var{back} to 0 therefore ensures
 a FIFO ordering.
 @end deftypefun
 
+@deftypefun int starpu_push_task_end ({struct starpu_task} *@var{task})
+This function must be called by a scheduler to notify that the given
+task has just been pushed.
+@end deftypefun
+
 @deftypefun int starpu_worker_can_execute_task (unsigned @var{workerid}, {struct starpu_task *}@var{task}, unsigned {nimpl})
 Check if the worker specified by workerid can execute the codelet. Schedulers need to call it before assigning a task to a worker, otherwise the task may fail to execute.
 @end deftypefun

+ 4 - 5
examples/audio/starpu_audio_processing.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2012  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -20,7 +20,6 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
-#include <pthread.h>
 #include <sys/types.h>
 #include <sys/time.h>
 
@@ -216,7 +215,7 @@ static void band_filter_kernel_gpu(void *descr[], __attribute__((unused)) void *
 }
 #endif
 
-static pthread_mutex_t fftw_mutex = PTHREAD_MUTEX_INITIALIZER;
+static starpu_pthread_mutex_t fftw_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static void band_filter_kernel_cpu(void *descr[], __attribute__((unused)) void *arg)
 {
@@ -231,7 +230,7 @@ static void band_filter_kernel_cpu(void *descr[], __attribute__((unused)) void *
 		plans[workerid].Acopy = malloc(nsamples*sizeof(float));
 
 		/* create plans, only "fftwf_execute" is thread safe in FFTW ... */
-		pthread_mutex_lock(&fftw_mutex);
+		starpu_pthread_mutex_lock(&fftw_mutex);
 		plans[workerid].plan_cpu = fftwf_plan_dft_r2c_1d(nsamples,
 					plans[workerid].Acopy,
 					plans[workerid].localout_cpu,
@@ -240,7 +239,7 @@ static void band_filter_kernel_cpu(void *descr[], __attribute__((unused)) void *
 					plans[workerid].localout_cpu,
 					plans[workerid].Acopy,
 					FFTW_ESTIMATE);
-		pthread_mutex_unlock(&fftw_mutex);
+		starpu_pthread_mutex_unlock(&fftw_mutex);
 
 		plans[workerid].is_initialized = 1;
 	}

+ 4 - 3
examples/axpy/axpy.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2012  Université de Bordeaux 1
+ * Copyright (C) 2009-2013  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
@@ -38,7 +38,7 @@
 
 #define NBLOCKS	8
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #define EPSILON 1e-6
 
@@ -89,7 +89,8 @@ static struct starpu_codelet axpy_cl =
 	.opencl_funcs = {axpy_opencl, NULL},
 #endif
 	.nbuffers = 2,
-	.modes = {STARPU_R, STARPU_RW}
+	.modes = {STARPU_R, STARPU_RW},
+	.name = "axpy"
 };
 
 static int

+ 3 - 3
examples/basic_examples/block.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -16,10 +16,9 @@
  */
 
 #include <starpu.h>
-#include <pthread.h>
 #include <math.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 extern void cpu_codelet(void *descr[], void *_args);
 #ifdef STARPU_USE_CUDA
@@ -48,6 +47,7 @@ int execute_on(uint32_t where, device_func func, float *block, int pnx, int pny,
         cl.nbuffers = 1;
 	cl.modes[0] = STARPU_RW,
         cl.model = NULL;
+	cl.name = "block_scale";
 
         struct starpu_task *task = starpu_task_create();
         task->cl = &cl;

+ 2 - 2
examples/basic_examples/hello_world.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -31,7 +31,7 @@
 #include <stdint.h>
 #include <starpu.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 /* When the task is done, task->callback_func(task->callback_arg) is called. Any
  * callback function must have the prototype void (*)(void *).

+ 1 - 2
examples/basic_examples/mult.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -35,7 +35,6 @@
 #include <math.h>
 #include <sys/types.h>
 #include <sys/time.h>
-#include <pthread.h>
 #include <signal.h>
 
 #include <starpu.h>

+ 1 - 1
examples/basic_examples/multiformat_conversion_codelets.c

@@ -50,7 +50,7 @@ struct starpu_codelet cuda_to_cpu_cl =
 #ifdef STARPU_USE_OPENCL
 void opencl_to_cpu(void *buffers[], void *arg)
 {
-	FPRINTF(stderr, "User Entering %s\n", __func__);
+	FPRINTF(stderr, "User Entering %s\n", __starpu_func__);
 	struct struct_of_arrays *src = STARPU_MULTIFORMAT_GET_OPENCL_PTR(buffers[0]);
 	struct point *dst = STARPU_MULTIFORMAT_GET_CPU_PTR(buffers[0]);
 	int n = STARPU_MULTIFORMAT_GET_NX(buffers[0]);

+ 1 - 1
examples/basic_examples/multiformat_cuda.cu

@@ -29,7 +29,7 @@ extern "C" void multiformat_scal_cuda_func(void *buffers[], void *_args)
 {
 	(void) _args;
 
-	FPRINTF(stderr, "Running the cuda kernel (%s)\n", __func__);
+	FPRINTF(stderr, "Running the cuda kernel (%s)\n", __starpu_func__);
 	unsigned int n = STARPU_MULTIFORMAT_GET_NX(buffers[0]);
 	struct struct_of_arrays *soa;
 

+ 1 - 1
examples/basic_examples/multiformat_types.h

@@ -28,6 +28,6 @@ struct point
 	float x, y;
 };
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #endif

+ 3 - 3
examples/basic_examples/variable.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -16,9 +16,8 @@
  */
 
 #include <starpu.h>
-#include <pthread.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 static unsigned niter = 50000;
 
@@ -70,6 +69,7 @@ int main(int argc, char **argv)
         cl.nbuffers = 1;
 	cl.modes[0] = STARPU_RW;
         cl.model = NULL;
+	cl.name = "variable_inc";
 
 	for (i = 0; i < niter; i++)
 	{

+ 2 - 2
examples/basic_examples/vector_scal.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2010-2012  Université de Bordeaux 1
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@
 #include <math.h>
 
 #define	NX	204800
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 extern void scal_cpu_func(void *buffers[], void *_args);
 extern void scal_cpu_func_icc(void *buffers[], void *_args);

+ 2 - 3
examples/binary/binary.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -16,10 +16,9 @@
  */
 
 #include <starpu.h>
-#include <pthread.h>
 #include <sys/time.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #ifdef STARPU_USE_OPENCL
 extern void opencl_codelet(void *descr[], __attribute__ ((unused)) void *_args);

+ 5 - 5
examples/callback/callback.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2009, 2010, 2013  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -16,10 +16,9 @@
  */
 
 #include <starpu.h>
-#include <pthread.h>
 #include <sys/time.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 starpu_data_handle_t handle;
 
@@ -34,7 +33,8 @@ struct starpu_codelet cl =
 {
 	.modes = { STARPU_RW },
 	.cpu_funcs = {cpu_codelet, NULL},
-	.nbuffers = 1
+	.nbuffers = 1,
+	.name = "callback"
 };
 
 void callback_func(void *callback_arg)

+ 1 - 1
examples/cg/cg.c

@@ -25,7 +25,7 @@
 #include <cublas.h>
 #endif
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 /*
  *	Conjugate Gradient

+ 2 - 2
examples/cholesky/cholesky.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-2013  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -31,7 +31,7 @@
 #include <common/blas.h>
 #include <starpu.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 #define NMAXBLOCKS	32
 
 #define TAG11(k)	((starpu_tag_t)( (1ULL<<60) | (unsigned long long)(k)))

+ 4 - 3
examples/cpp/incrementer_cpp.cpp

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2009, 2010-2011, 2013  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2012 inria
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -18,7 +18,7 @@
 
 #include <starpu.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #ifdef STARPU_USE_CUDA
 extern "C" void cuda_codelet(void *descr[], __attribute__ ((unused)) void *_args);
@@ -67,6 +67,7 @@ int main(int argc, char **argv)
 #endif
         cl.nbuffers = 1;
         cl.modes[0] = STARPU_RW;
+	cl.name = "incrementer";
 
 	for (i = 0; i < niter; i++)
 	{

+ 1 - 5
examples/filters/custom_mf/custom_types.h

@@ -27,10 +27,6 @@ struct point
 	float x, y;
 };
 
-#define FPRINTF(ofile, fmt, args ...) \
-do {                                  \
-if (!getenv("STARPU_SSILENT"))        \
-	fprintf(ofile, fmt, ##args);  \
-} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #endif

+ 5 - 4
examples/filters/fblock.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010-2011, 2013  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -22,7 +22,7 @@
 #define NZ    3
 #define PARTS 2
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 extern void cpu_func(void *buffers[], void *cl_arg);
 
@@ -99,7 +99,8 @@ int main(int argc, char **argv)
                 .opencl_funcs = {opencl_func, NULL},
 #endif
 		.nbuffers = 1,
-                .modes = {STARPU_RW}
+                .modes = {STARPU_RW},
+		.name = "block_scal"
 	};
 
         ret = starpu_init(NULL);

+ 3 - 2
examples/filters/fmatrix.c

@@ -20,7 +20,7 @@
 #define NY    4
 #define PARTS 2
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 void cpu_func(void *buffers[], void *cl_arg)
 {
@@ -64,7 +64,8 @@ int main(int argc, char **argv)
 	{
                 .cpu_funcs = {cpu_func, NULL},
                 .nbuffers = 1,
-		.modes = {STARPU_RW}
+		.modes = {STARPU_RW},
+		.name = "matrix_scal"
         };
 
         ret = starpu_init(NULL);

+ 3 - 2
examples/filters/fvector.c

@@ -19,7 +19,7 @@
 #define NX    21
 #define PARTS 3
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 void cpu_func(void *buffers[], void *cl_arg)
 {
@@ -47,7 +47,8 @@ int main(int argc, char **argv)
 	{
                 .cpu_funcs = {cpu_func, NULL},
                 .nbuffers = 1,
-		.modes = {STARPU_RW}
+		.modes = {STARPU_RW},
+		.name = "vector_scal"
         };
 
         for(i=0 ; i<NX ; i++) vector[i] = i;

+ 1 - 1
examples/filters/shadow.c

@@ -47,7 +47,7 @@
 #define NX    30
 #define PARTS 3
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 void cpu_func(void *buffers[], void *cl_arg)
 {

+ 1 - 1
examples/filters/shadow2d.c

@@ -90,7 +90,7 @@
 #define PARTSX 2
 #define PARTSY 3
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 void cpu_func(void *buffers[], void *cl_arg)
 {

+ 1 - 1
examples/filters/shadow3d.c

@@ -38,7 +38,7 @@
 #define PARTSY 3
 #define PARTSZ 2
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 void cpu_func(void *buffers[], void *cl_arg)
 {

+ 2 - 2
examples/heat/dw_factolu.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -33,7 +33,7 @@
 
 #include "lu_kernels_model.h"
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #define BLAS3_FLOP(n1,n2,n3)    \
         (2*((uint64_t)n1)*((uint64_t)n2)*((uint64_t)n3))

+ 1 - 1
examples/heat/dw_sparse_cg.c

@@ -20,7 +20,7 @@
  */
 
 #include "dw_sparse_cg.h"
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 static struct starpu_task *create_task(starpu_tag_t id)
 {

+ 0 - 1
examples/heat/dw_sparse_cg.h

@@ -25,7 +25,6 @@
 #include <stdint.h>
 #include <math.h>
 #include <sys/types.h>
-#include <pthread.h>
 #include <signal.h>
 
 #include <starpu.h>

+ 2 - 2
examples/heat/heat.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2011-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -35,7 +35,7 @@
 #include <GL/glut.h>
 #endif
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #define X	0
 #define Y	1

+ 5 - 5
examples/incrementer/incrementer.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2009, 2010-2011, 2013  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -16,11 +16,10 @@
  */
 
 #include <starpu.h>
-#include <pthread.h>
 #include <sys/time.h>
 
 static unsigned niter = 50000;
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #ifdef STARPU_USE_CUDA
 extern void cuda_codelet(void *descr[], __attribute__ ((unused)) void *_args);
@@ -74,7 +73,8 @@ int main(int argc, char **argv)
 		.opencl_funcs = {opencl_codelet, NULL},
 #endif
 		.nbuffers = 1,
-		.modes = {STARPU_RW}
+		.modes = {STARPU_RW},
+		.name = "increment"
 	};
 
 	struct timeval start;

+ 1 - 1
examples/interface/complex.c

@@ -18,7 +18,7 @@
 #include "complex_interface.h"
 #include "complex_codelet.h"
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 static int can_execute(unsigned workerid, struct starpu_task *task, unsigned nimpl)
 {

+ 2 - 2
examples/lu/lu_example.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -34,7 +34,7 @@ static unsigned bound = 0;
 static unsigned bounddeps = 0;
 static unsigned boundprio = 0;
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 TYPE *A, *A_saved;
 

+ 2 - 2
examples/lu/xlu.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -22,7 +22,7 @@
 #include <starpu.h>
 #include <common/blas.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #define BLAS3_FLOP(n1,n2,n3)    \
         (2*((uint64_t)n1)*((uint64_t)n2)*((uint64_t)n3))

+ 2 - 3
examples/matvecmult/matvecmult.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2011-2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -16,10 +16,9 @@
  */
 
 #include <starpu.h>
-#include <pthread.h>
 #include <math.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #ifdef STARPU_USE_OPENCL
 struct starpu_opencl_program opencl_code;

+ 2 - 2
examples/mult/xgemm.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009-2012  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -47,7 +47,7 @@ static unsigned check = 0;
 static TYPE *A, *B, *C;
 static starpu_data_handle_t A_handle, B_handle, C_handle;
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 static void check_output(void)
 {

+ 2 - 2
examples/openmp/vector_scal.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  * Copyright (C) 2010-2012  Université de Bordeaux 1
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
 #include <limits.h>
 
 #define	NX	2048000
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 void scal_cpu_func(void *buffers[], void *_args)
 {

+ 2 - 2
examples/pi/pi.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -25,7 +25,7 @@
 void cuda_kernel(void **descr, void *cl_arg);
 #endif
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 /* default value */
 static unsigned ntasks = 1024;

+ 1 - 1
examples/pi/pi_redux.c

@@ -18,7 +18,7 @@
 #include <stdlib.h>
 #include <sys/time.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 #define PI	3.14159265358979323846
 
 #if defined(STARPU_USE_CUDA) && !defined(STARPU_HAVE_CURAND)

+ 1 - 1
examples/pipeline/pipeline.c

@@ -38,7 +38,7 @@
 #include <cublas.h>
 #endif
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 /* Vector size */
 #ifdef STARPU_QUICK_CHECK

+ 1 - 2
examples/ppm_downscaler/yuv_downscaler.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include <assert.h>
 #include <stdio.h>
-#include <pthread.h>
 
 #include "yuv_downscaler.h"
 

+ 4 - 3
examples/profiling/profiling.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2012  Université de Bordeaux 1
+ * Copyright (C) 2010-2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include <unistd.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 static unsigned niter = 500;
 
@@ -53,7 +53,8 @@ int main(int argc, char **argv)
 		.cpu_funcs = {sleep_codelet, NULL},
 		.cuda_funcs = {sleep_codelet, NULL},
 		.opencl_funcs = {sleep_codelet, NULL},
-		.nbuffers = 0
+		.nbuffers = 0,
+		.name = "sleep"
 	};
 
 	struct starpu_task **tasks = (struct starpu_task **) malloc(niter*sizeof(struct starpu_task *));

+ 7 - 4
examples/reductions/dot_product.c

@@ -26,7 +26,7 @@
 #include <cublas.h>
 #endif
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 static float *_x;
 static float *_y;
@@ -115,7 +115,8 @@ static struct starpu_codelet init_codelet =
 	.opencl_funcs = {init_opencl_func, NULL},
 #endif
 	.modes = {STARPU_W},
-	.nbuffers = 1
+	.nbuffers = 1,
+	.name = "init",
 };
 
 /*
@@ -196,7 +197,8 @@ static struct starpu_codelet redux_codelet =
 	.opencl_funcs = {redux_opencl_func, NULL},
 #endif
 	.modes = {STARPU_RW, STARPU_R},
-	.nbuffers = 2
+	.nbuffers = 2,
+	.name = "redux"
 };
 
 /*
@@ -313,7 +315,8 @@ static struct starpu_codelet dot_codelet =
 	.opencl_funcs = {dot_opencl_func, NULL},
 #endif
 	.nbuffers = 3,
-	.modes = {STARPU_R, STARPU_R, STARPU_REDUX}
+	.modes = {STARPU_R, STARPU_R, STARPU_REDUX},
+	.name = "dot"
 };
 
 /*

+ 7 - 4
examples/reductions/minmax_reduction.c

@@ -27,7 +27,7 @@ static unsigned _nblocks = 8192;
 static unsigned _entries_per_bock = 1024;
 #endif
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #define TYPE		double
 #define TYPE_MAX	DBL_MAX
@@ -59,7 +59,8 @@ static struct starpu_codelet minmax_init_codelet =
 {
 	.cpu_funcs = {minmax_neutral_cpu_func, NULL},
 	.modes = {STARPU_W},
-	.nbuffers = 1
+	.nbuffers = 1,
+	.name = "init"
 };
 
 /*
@@ -86,7 +87,8 @@ static struct starpu_codelet minmax_redux_codelet =
 {
 	.cpu_funcs = {minmax_redux_cpu_func, NULL},
 	.modes = {STARPU_RW, STARPU_R},
-	.nbuffers = 2
+	.nbuffers = 2,
+	.name = "redux"
 };
 
 /*
@@ -121,7 +123,8 @@ static struct starpu_codelet minmax_codelet =
 {
 	.cpu_funcs = {minmax_cpu_func, NULL},
 	.nbuffers = 2,
-	.modes = {STARPU_R, STARPU_REDUX}
+	.modes = {STARPU_R, STARPU_REDUX},
+	.name = "minmax"
 };
 
 /*

+ 6 - 6
examples/sched_ctx/sched_ctx.c

@@ -16,7 +16,6 @@
  */
 
 #include <starpu.h>
-#include <pthread.h>
 
 #ifdef STARPU_QUICK_CHECK
 #define NTASKS 64
@@ -25,13 +24,13 @@
 #endif
 
 int tasks_executed = 0;
-pthread_mutex_t mut;
+starpu_pthread_mutex_t mut;
 
 static void sched_ctx_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
-	pthread_mutex_lock(&mut);
+	starpu_pthread_mutex_lock(&mut);
 	tasks_executed++;
-	pthread_mutex_unlock(&mut);
+	starpu_pthread_mutex_unlock(&mut);
 }
 
 static struct starpu_codelet sched_ctx_codelet =
@@ -40,7 +39,8 @@ static struct starpu_codelet sched_ctx_codelet =
 	.cuda_funcs = {sched_ctx_func, NULL},
 	.opencl_funcs = {sched_ctx_func, NULL},
 	.model = NULL,
-	.nbuffers = 0
+	.nbuffers = 0,
+	.name = "sched_ctx"
 };
 
 
@@ -54,7 +54,7 @@ int main(int argc, char **argv)
 		return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
-	pthread_mutex_init(&mut, NULL);
+	starpu_pthread_mutex_init(&mut, NULL);
 	int nprocs1 = 1;
 	int nprocs2 = 1;
 	int procs1[20], procs2[20];

+ 16 - 16
examples/sched_ctx_utils/sched_ctx_utils.c

@@ -47,11 +47,11 @@ struct retvals
 
 #define NSAMPLES 1
 int first = 1;
-pthread_mutex_t mut;
+starpu_pthread_mutex_t mut;
 struct retvals rv[2];
 struct params p1, p2;
 
-pthread_key_t key;
+starpu_pthread_key_t key;
 
 void init()
 {
@@ -75,12 +75,12 @@ void init()
 
 	p1.id = 0;
 	p2.id = 1;
-	pthread_key_create(&key, NULL);
+	starpu_pthread_key_create(&key, NULL);
 }
 
 void update_sched_ctx_timing_results(double flops, double avg_timing)
 {
-	unsigned *id = pthread_getspecific(key);
+	unsigned *id = starpu_pthread_getspecific(key);
 	rv[*id].flops += flops;
 	rv[*id].avg_timing += avg_timing;
 }
@@ -90,7 +90,7 @@ void* start_bench(void *val)
 	struct params *p = (struct params*)val;
 	int i;
 
-	pthread_setspecific(key, &p->id);
+	starpu_pthread_setspecific(key, &p->id);
 
 	if(p->ctx != 0)
 		starpu_sched_ctx_set_context(&p->ctx);
@@ -100,14 +100,14 @@ void* start_bench(void *val)
 
 	if(p->ctx != 0)
 	{
-		pthread_mutex_lock(&mut);
+		starpu_pthread_mutex_lock(&mut);
 		if(first)
 		{
 			starpu_sched_ctx_delete(p->ctx);
 		}
 
 		first = 0;
-		pthread_mutex_unlock(&mut);
+		starpu_pthread_mutex_unlock(&mut);
 	}
 
 	rv[p->id].flops /= NSAMPLES;
@@ -128,23 +128,23 @@ void start_2benchs(void (*bench)(unsigned, unsigned))
 	printf("size %d\n", size2);
 	p2.nblocks = nblocks2;
 
-	pthread_t tid[2];
-	pthread_mutex_init(&mut, NULL);
+	starpu_pthread_t tid[2];
+	starpu_pthread_mutex_init(&mut, NULL);
 
 	struct timeval start;
 	struct timeval end;
 
 	gettimeofday(&start, NULL);
 
-	pthread_create(&tid[0], NULL, (void*)start_bench, (void*)&p1);
-	pthread_create(&tid[1], NULL, (void*)start_bench, (void*)&p2);
+	starpu_pthread_create(&tid[0], NULL, (void*)start_bench, (void*)&p1);
+	starpu_pthread_create(&tid[1], NULL, (void*)start_bench, (void*)&p2);
 
-	pthread_join(tid[0], NULL);
-	pthread_join(tid[1], NULL);
+	starpu_pthread_join(tid[0], NULL);
+	starpu_pthread_join(tid[1], NULL);
 
 	gettimeofday(&end, NULL);
 
-	pthread_mutex_destroy(&mut);
+	starpu_pthread_mutex_destroy(&mut);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 	timing /= 1000000;
@@ -169,7 +169,7 @@ void start_1stbench(void (*bench)(unsigned, unsigned))
 
 	gettimeofday(&end, NULL);
 
-	pthread_mutex_destroy(&mut);
+	starpu_pthread_mutex_destroy(&mut);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 	timing /= 1000000;
@@ -193,7 +193,7 @@ void start_2ndbench(void (*bench)(unsigned, unsigned))
 
 	gettimeofday(&end, NULL);
 
-	pthread_mutex_destroy(&mut);
+	starpu_pthread_mutex_destroy(&mut);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 	timing /= 1000000;

+ 25 - 24
examples/scheduler/dummy_sched.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2012  Université de Bordeaux 1
+ * Copyright (C) 2010-2013  Université de Bordeaux 1
  * Copyright (C) 2010-2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -15,30 +15,30 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <pthread.h>
 #include <starpu.h>
 
 #define NTASKS	32000
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
-typedef struct dummy_sched_data {
+struct dummy_sched_data
+{
 	struct starpu_task_list sched_list;
-	pthread_mutex_t policy_mutex;
-} dummy_sched_data;
+     	starpu_pthread_mutex_t policy_mutex;
+};
 
 static void init_dummy_sched(unsigned sched_ctx_id)
 {
 	starpu_sched_ctx_create_worker_collection(sched_ctx_id, STARPU_WORKER_LIST);
 
 	struct dummy_sched_data *data = (struct dummy_sched_data*)malloc(sizeof(struct dummy_sched_data));
-	
+
 
 	/* Create a linked-list of tasks and a condition variable to protect it */
 	starpu_task_list_init(&data->sched_list);
 
-	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)data);		
+	starpu_sched_ctx_set_policy_data(sched_ctx_id, (void*)data);
 
-	pthread_mutex_init(&data->policy_mutex, NULL);
+	starpu_pthread_mutex_init(&data->policy_mutex, NULL);
 	FPRINTF(stderr, "Initialising Dummy scheduler\n");
 }
 
@@ -50,10 +50,10 @@ static void deinit_dummy_sched(unsigned sched_ctx_id)
 
 	starpu_sched_ctx_delete_worker_collection(sched_ctx_id);
 
-	pthread_mutex_destroy(&data->policy_mutex);
+	starpu_pthread_mutex_destroy(&data->policy_mutex);
 
 	free(data);
-	
+
 	FPRINTF(stderr, "Destroying Dummy scheduler\n");
 }
 
@@ -68,12 +68,12 @@ static int push_task_dummy(struct starpu_task *task)
 
 	/* lock all workers when pushing tasks on a list where all
 	   of them would pop for tasks */
-        pthread_mutex_lock(&data->policy_mutex);
+        starpu_pthread_mutex_lock(&data->policy_mutex);
 
 	starpu_task_list_push_front(&data->sched_list, task);
 
-	_starpu_push_task_end(task);
-	pthread_mutex_unlock(&data->policy_mutex);
+	starpu_push_task_end(task);
+	starpu_pthread_mutex_unlock(&data->policy_mutex);
 
 
         /*if there are no tasks block */
@@ -88,12 +88,12 @@ static int push_task_dummy(struct starpu_task *task)
 	while(workers->has_next(workers, &it))
         {
                 worker = workers->get_next(workers, &it);
-		pthread_mutex_t *sched_mutex;
-                pthread_cond_t *sched_cond;
+		starpu_pthread_mutex_t *sched_mutex;
+                starpu_pthread_cond_t *sched_cond;
                 starpu_worker_get_sched_condition(worker, &sched_mutex, &sched_cond);
-		pthread_mutex_lock(sched_mutex);
-                pthread_cond_signal(sched_cond);
-                pthread_mutex_unlock(sched_mutex);
+		starpu_pthread_mutex_lock(sched_mutex);
+                starpu_pthread_cond_signal(sched_cond);
+                starpu_pthread_mutex_unlock(sched_mutex);
         }
 
 	return 0;
@@ -108,9 +108,9 @@ static struct starpu_task *pop_task_dummy(unsigned sched_ctx_id)
 	 * the calling worker. So we just take the head of the list and give it
 	 * to the worker. */
 	struct dummy_sched_data *data = (struct dummy_sched_data*)starpu_sched_ctx_get_policy_data(sched_ctx_id);
-	pthread_mutex_lock(&data->policy_mutex);
+	starpu_pthread_mutex_lock(&data->policy_mutex);
 	struct starpu_task *task = starpu_task_list_pop_back(&data->sched_list);
-	pthread_mutex_unlock(&data->policy_mutex);
+	starpu_pthread_mutex_unlock(&data->policy_mutex);
 	return task;
 }
 
@@ -138,7 +138,8 @@ static struct starpu_codelet dummy_codelet =
 	.cuda_funcs = {dummy_func, NULL},
         .opencl_funcs = {dummy_func, NULL},
 	.model = NULL,
-	.nbuffers = 0
+	.nbuffers = 0,
+	.name = "dummy",
 };
 
 
@@ -163,10 +164,10 @@ int main(int argc, char **argv)
 	for (i = 0; i < ntasks; i++)
 	{
 		struct starpu_task *task = starpu_task_create();
-	
+
 		task->cl = &dummy_codelet;
 		task->cl_arg = NULL;
-	
+
 		ret = starpu_task_submit(task);
 		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 	}

+ 1 - 1
examples/spmd/vector_scal_spmd.c

@@ -28,7 +28,7 @@
 #define MIN(a,b)        ((a)<(b)?(a):(b))
 
 #define	NX	204800
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 static int get_first_element_rank(int nel, int rank, int nb_workers)
 {

+ 2 - 2
examples/spmv/dw_block_spmv.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009-2012  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -19,7 +19,7 @@
 #include <sys/time.h>
 #include "dw_block_spmv.h"
 #include "matrix_market/mm_to_bcsr.h"
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 struct timeval start;
 struct timeval end;

+ 1 - 2
examples/spmv/dw_block_spmv.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2011  Université de Bordeaux 1
- * Copyright (C) 2010  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -23,7 +23,6 @@
 #include <stdint.h>
 #include <math.h>
 #include <sys/types.h>
-#include <pthread.h>
 #include <signal.h>
 #include <cblas.h>
 

+ 3 - 2
examples/spmv/spmv.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010, 2011  Université de Bordeaux 1
+ * Copyright (C) 2009, 2010, 2011, 2013  Université de Bordeaux 1
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
  *
@@ -104,7 +104,8 @@ static struct starpu_codelet spmv_cl =
 #endif
 	.nbuffers = 3,
 	.modes = {STARPU_R, STARPU_R, STARPU_W},
-	.model = NULL
+	.model = NULL,
+	.name = "spmv"
 };
 
 int main(int argc, char **argv)

+ 2 - 3
examples/spmv/spmv.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010  Université de Bordeaux 1
- * Copyright (C) 2010, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -23,12 +23,11 @@
 #include <stdint.h>
 #include <math.h>
 #include <sys/time.h>
-#include <pthread.h>
 #include <signal.h>
 
 #include <starpu.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 
 #ifdef STARPU_USE_CUDA
 void spmv_kernel_cuda(void *descr[], void *args);

+ 3 - 3
examples/tag_example/tag_example.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2010, 2012  Université de Bordeaux 1
+ * Copyright (C) 2009-2010, 2012-2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -29,12 +29,11 @@
 #include <string.h>
 #include <math.h>
 #include <sys/types.h>
-#include <pthread.h>
 #include <signal.h>
 
 #include <starpu.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 #define TAG(i, j, iter)	((starpu_tag_t) ( ((uint64_t)(iter)<<48) |  ((uint64_t)(j)<<24) | (i)) )
 
 struct starpu_codelet cl;
@@ -224,6 +223,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 	cl.cuda_funcs[0] = cpu_codelet;
 	cl.opencl_funcs[0] = cpu_codelet;
 	cl.nbuffers = 0;
+	cl.name = "dummy";
 
 	ret = create_task_grid(0);
 	if (ret == 0)

+ 3 - 3
examples/tag_example/tag_example2.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010, 2012  Université de Bordeaux 1
+ * Copyright (C) 2009, 2010, 2012-2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -25,12 +25,11 @@
 #include <string.h>
 #include <math.h>
 #include <sys/types.h>
-#include <pthread.h>
 #include <signal.h>
 
 #include <starpu.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 #define TAG(i, iter)	((starpu_tag_t)  (((uint64_t)iter)<<32 | (i)) )
 
 struct starpu_codelet cl;
@@ -128,6 +127,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 	cl.cuda_funcs[0] = cpu_codelet;
 	cl.opencl_funcs[0] = cpu_codelet;
 	cl.nbuffers = 0;
+	cl.name = "dummy";
 
 	FPRINTF(stderr, "ITER : %u\n", nk);
 

+ 3 - 3
examples/tag_example/tag_example3.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010, 2012  Université de Bordeaux 1
+ * Copyright (C) 2009, 2010, 2012-2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -27,12 +27,11 @@
 #include <string.h>
 #include <math.h>
 #include <sys/types.h>
-#include <pthread.h>
 #include <signal.h>
 
 #include <starpu.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 #define TAG(i, iter)	((starpu_tag_t)  (((uint64_t)iter)<<32 | (i)) )
 
 struct starpu_codelet cl;
@@ -130,6 +129,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 	cl.cuda_funcs[0] = cpu_codelet;
 	cl.opencl_funcs[0] = cpu_codelet;
 	cl.nbuffers = 0;
+	cl.name = "dummy";
 
 	FPRINTF(stderr, "ITER : %u\n", nk);
 

+ 5 - 4
examples/tag_example/tag_example4.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010, 2012  Université de Bordeaux 1
- * Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2009, 2010, 2012-2013  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -26,12 +26,11 @@
 #include <string.h>
 #include <math.h>
 #include <sys/types.h>
-#include <pthread.h>
 #include <signal.h>
 
 #include <starpu.h>
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 #define TAG(i, iter)	((starpu_tag_t)  (((uint64_t)i)<<32 | (iter)) )
 
 void cpu_codelet_A(void *descr[], void *_args)
@@ -54,6 +53,7 @@ struct starpu_codelet cl_A = {
 	.cuda_funcs = { cpu_codelet_A, NULL},
 	.opencl_funcs = { cpu_codelet_A, NULL},
 	.nbuffers = 0,
+	.name = "dummyA"
 };
 
 struct starpu_codelet cl_B = {
@@ -61,6 +61,7 @@ struct starpu_codelet cl_B = {
 	.cuda_funcs = { cpu_codelet_B, NULL},
 	.opencl_funcs = { cpu_codelet_B, NULL},
 	.nbuffers = 0,
+	.name = "dummyB"
 };
 
 #define Ni	64

+ 2 - 2
examples/tag_example/tag_restartable.c

@@ -19,7 +19,6 @@
 #include <semaphore.h>
 #include <string.h>
 #include <math.h>
-#include <pthread.h>
 #include <unistd.h>
 #include <signal.h>
 
@@ -28,7 +27,7 @@
 #define Nrolls	4
 #define SLEEP 1
 
-#define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
 #define TAG(i, iter)	((starpu_tag_t)  (((uint64_t)((iter)%Nrolls))<<32 | (i)) )
 
 struct starpu_codelet cl;
@@ -137,6 +136,7 @@ int main(int argc __attribute__((unused)) , char **argv __attribute__((unused)))
 	cl.cuda_funcs[0] = cpu_codelet;
 	cl.opencl_funcs[0] = cpu_codelet;
 	cl.nbuffers = 0;
+	cl.name = "dummy";
 
 	FPRINTF(stderr, "ITER : %u\n", nk);
 

+ 33 - 33
include/pthread_win32/pthread.h

@@ -62,35 +62,35 @@ extern "C" {
 typedef DWORD pthread_attr_t;
 typedef HANDLE pthread_t;
 
-static inline pthread_t pthread_self(void) {
+static __inline pthread_t pthread_self(void) {
   return GetCurrentThread();
 }
 
-static inline int pthread_equal(pthread_t t1, pthread_t t2) {
+static __inline int pthread_equal(pthread_t t1, pthread_t t2) {
   return t1 == t2;
 }
 
-static inline int pthread_attr_init (pthread_attr_t *attr) {
+static __inline int pthread_attr_init (pthread_attr_t *attr) {
   *attr = 0;
   return 0;
 }
 
 #define PTHREAD_CREATE_DETACHED 1
-static inline int pthread_attr_setdetachstate (pthread_attr_t *attr, int yes) {
+static __inline int pthread_attr_setdetachstate (pthread_attr_t *attr, int yes) {
   (void)attr;
   (void)yes;
   /* not supported, ignore */
   return 0;
 }
 
-static inline int pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) {
+static __inline int pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) {
   (void)attr;
   (void)stacksize;
   /* not supported, ignore */
   return 0;
 }
 
-static inline int pthread_attr_destroy (pthread_attr_t *attr) {
+static __inline int pthread_attr_destroy (pthread_attr_t *attr) {
   (void)attr;
   return 0;
 }
@@ -110,7 +110,7 @@ void pthread_cleanup_pop (int execute);
   if (execute) __cleanup_handler.routine(__cleanup_handler.arg); \
 } while (0);
 
-static inline int pthread_create (
+static __inline int pthread_create (
   pthread_t *thread, const pthread_attr_t *attr,
   void * (*fun) (void *), void *arg
 ) {
@@ -120,24 +120,24 @@ static inline int pthread_create (
   return 0;
 }
 
-static inline int pthread_setcancelstate (int state, int *oldstate) {
+static __inline int pthread_setcancelstate (int state, int *oldstate) {
   (void)state;
   (void)oldstate;
   /* not yet implemented :( */
   return 0;
 }
 
-static inline int pthread_cancel (pthread_t thread) {
+static __inline int pthread_cancel (pthread_t thread) {
   /* This is quite harsh :( */
   winPthreadAssertWindows(TerminateThread(thread, 0));
   return 0;
 }
 
-static inline void pthread_exit (void *res) {
+static __inline void pthread_exit (void *res) {
   ExitThread((DWORD) (DWORD_PTR) res);
 }
 
-static inline int pthread_join (pthread_t thread, void **res) {
+static __inline int pthread_join (pthread_t thread, void **res) {
 again:
   switch (WaitForSingleObject(thread, INFINITE)) {
     default:
@@ -167,32 +167,32 @@ typedef HANDLE pthread_mutex_t;
 #define PTHREAD_MUTEX_ERRORCHECK 2
 typedef int pthread_mutexattr_t;
 
-static inline int pthread_mutexattr_init(pthread_mutexattr_t *attr) {
+static __inline int pthread_mutexattr_init(pthread_mutexattr_t *attr) {
   *attr = PTHREAD_MUTEX_RECURSIVE;
   return 0;
 }
 
-static inline int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) {
+static __inline int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) {
   if (type != PTHREAD_MUTEX_RECURSIVE && type != PTHREAD_MUTEX_ERRORCHECK)
     return EINVAL;
   *attr = type;
   return 0;
 }
 
-static inline int pthread_mutex_init (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) {
+static __inline int pthread_mutex_init (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) {
   if (attr && *attr!=PTHREAD_MUTEX_RECURSIVE)
     return EINVAL;
   winPthreadAssertWindows(*mutex = CreateMutex(NULL, FALSE, NULL));
   return 0;
 }
 
-static inline int pthread_mutex_unlock (pthread_mutex_t *mutex) {
+static __inline int pthread_mutex_unlock (pthread_mutex_t *mutex) {
   winPthreadAssertWindows(ReleaseMutex(*mutex));
   return 0;
 }
 
-static inline int pthread_mutex_lock (pthread_mutex_t *mutex);
-static inline int __pthread_mutex_alloc_concurrently (pthread_mutex_t *mutex) {
+static __inline int pthread_mutex_lock (pthread_mutex_t *mutex);
+static __inline int __pthread_mutex_alloc_concurrently (pthread_mutex_t *mutex) {
   HANDLE mutex_init_mutex;
   /* Get access to one global named mutex to serialize mutex initialization */
   winPthreadAssertWindows((mutex_init_mutex = CreateMutex(NULL, FALSE, "StarPU mutex init")));
@@ -205,7 +205,7 @@ static inline int __pthread_mutex_alloc_concurrently (pthread_mutex_t *mutex) {
   return 0;
 }
 
-static inline int pthread_mutex_lock (pthread_mutex_t *mutex) {
+static __inline int pthread_mutex_lock (pthread_mutex_t *mutex) {
   if (!*mutex)
     __pthread_mutex_alloc_concurrently (mutex);
 again:
@@ -221,7 +221,7 @@ again:
   }
 }
 
-static inline int pthread_mutex_trylock (pthread_mutex_t *mutex) {
+static __inline int pthread_mutex_trylock (pthread_mutex_t *mutex) {
   if (!*mutex)
     __pthread_mutex_alloc_concurrently (mutex);
   switch (WaitForSingleObject(*mutex, 0)) {
@@ -236,7 +236,7 @@ static inline int pthread_mutex_trylock (pthread_mutex_t *mutex) {
   }
 }
 
-static inline int pthread_mutex_destroy (pthread_mutex_t *mutex) {
+static __inline int pthread_mutex_destroy (pthread_mutex_t *mutex) {
   winPthreadAssertWindows(CloseHandle(*mutex));
   *mutex = INVALID_HANDLE_VALUE;
   return 0;
@@ -251,6 +251,7 @@ static inline int pthread_mutex_destroy (pthread_mutex_t *mutex) {
 
 #define PTHREAD_RWLOCK_INITIALIZER NULL
 typedef pthread_mutex_t pthread_rwlock_t;
+typedef int pthread_rwlockattr_t;
 #define pthread_rwlock_init(lock, attr) pthread_mutex_init(lock, NULL)
 #define pthread_rwlock_wrlock(lock) pthread_mutex_lock(lock)
 #define pthread_rwlock_rdlock(lock) pthread_mutex_lock(lock)
@@ -279,7 +280,7 @@ struct timespec {
 
 typedef unsigned pthread_condattr_t;
 
-static inline int pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *attr) {
+static __inline int pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *attr) {
   if (attr)
     return EINVAL;
   winPthreadAssertWindows(cond->sem = CreateSemaphore(NULL, 0, MAXLONG, NULL));
@@ -287,7 +288,7 @@ static inline int pthread_cond_init (pthread_cond_t *cond, const pthread_condatt
   return 0;
 }
 
-static inline int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *time) {
+static __inline int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *time) {
   if (!cond->sem)
     winPthreadAssertPthread(pthread_cond_init(cond,NULL));
   cond->nbwait++;
@@ -312,7 +313,7 @@ again:
   return 0;
 }
 
-static inline int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) {
+static __inline int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) {
   if (!cond->sem)
     winPthreadAssertPthread(pthread_cond_init(cond,NULL));
   cond->nbwait++;
@@ -337,7 +338,7 @@ again:
   return 0;
 }
 
-static inline int pthread_cond_signal (pthread_cond_t *cond) {
+static __inline int pthread_cond_signal (pthread_cond_t *cond) {
   if (!cond->sem)
     winPthreadAssertPthread(pthread_cond_init(cond,NULL));
   if (cond->nbwait)
@@ -345,14 +346,14 @@ static inline int pthread_cond_signal (pthread_cond_t *cond) {
   return 0;
 }
 
-static inline int pthread_cond_broadcast (pthread_cond_t *cond) {
+static __inline int pthread_cond_broadcast (pthread_cond_t *cond) {
   if (!cond->sem)
     winPthreadAssertPthread(pthread_cond_init(cond,NULL));
   ReleaseSemaphore(cond->sem, cond->nbwait, NULL);
   return 0;
 }
 
-static inline int pthread_cond_destroy (pthread_cond_t *cond) {
+static __inline int pthread_cond_destroy (pthread_cond_t *cond) {
   if (cond->sem) {
     winPthreadAssertWindows(CloseHandle(cond->sem));
     cond->sem = NULL;
@@ -371,7 +372,7 @@ typedef struct {
   unsigned done;
 } pthread_once_t;
 
-static inline int pthread_once (pthread_once_t *once, void (*oncefun)(void)) {
+static __inline int pthread_once (pthread_once_t *once, void (*oncefun)(void)) {
   winPthreadAssertPthread(pthread_mutex_lock(&once->mutex));
   if (!once->done) {
     oncefun();
@@ -381,24 +382,23 @@ static inline int pthread_once (pthread_once_t *once, void (*oncefun)(void)) {
   return 0;
 }
 
-static inline int pthread_key_create (pthread_key_t *key, void (*freefun)(void *)) {
-  (void)freefun;
-  DWORD res;
+static __inline int pthread_key_create (pthread_key_t *key, void (*freefun)(void *)) {
+  pthread_key_t res;
   winPthreadAssertWindows((res = TlsAlloc()) != 0xFFFFFFFF);
   *key = res;
   return 0;
 }
 
-static inline int pthread_key_delete (pthread_key_t key) {
+static __inline int pthread_key_delete (pthread_key_t key) {
   winPthreadAssertWindows(TlsFree(key));
   return 0;
 }
 
-static inline void *pthread_getspecific (pthread_key_t key) {
+static __inline void *pthread_getspecific (pthread_key_t key) {
   return TlsGetValue(key);
 }
 
-static inline int pthread_setspecific (pthread_key_t key, const void *data) {
+static __inline int pthread_setspecific (pthread_key_t key, const void *data) {
   winPthreadAssertWindows(TlsSetValue(key, (LPVOID) data));
   return 0;
 }

+ 4 - 4
include/pthread_win32/semaphore.h

@@ -30,13 +30,13 @@
 
 typedef HANDLE sem_t;
 
-static inline int sem_init(sem_t *sem, int pshared, unsigned int value) {
+static __inline int sem_init(sem_t *sem, int pshared, unsigned int value) {
   (void)pshared;
   winPthreadAssertWindows(*sem = CreateSemaphore(NULL, value, MAXLONG, NULL));
   return 0;
 }
 
-static inline int do_sem_wait(sem_t *sem, DWORD timeout) {
+static __inline int do_sem_wait(sem_t *sem, DWORD timeout) {
   switch (WaitForSingleObject(*sem, timeout)) {
     default:
     case WAIT_FAILED:
@@ -54,12 +54,12 @@ static inline int do_sem_wait(sem_t *sem, DWORD timeout) {
 #define sem_wait(sem) do_sem_wait(sem, INFINITE)
 #define sem_trywait(sem) do_sem_wait(sem, 0)
 
-static inline int sem_post(sem_t *sem) {
+static __inline int sem_post(sem_t *sem) {
   winPthreadAssertWindows(ReleaseSemaphore(*sem, 1, NULL));
   return 0;
 }
 
-static inline int sem_destroy(sem_t *sem) {
+static __inline int sem_destroy(sem_t *sem) {
   winPthreadAssertWindows(CloseHandle(*sem));
   return 0;
 }

+ 2 - 0
include/starpu.h

@@ -27,6 +27,7 @@ typedef unsigned char uint8_t;
 typedef unsigned short uint16_t;
 typedef unsigned long uint32_t;
 typedef unsigned long long uint64_t;
+typedef unsigned long int uintptr_t;
 #endif
 
 #include <starpu_config.h>
@@ -39,6 +40,7 @@ typedef unsigned long long uint64_t;
 #include <starpu_opencl.h>
 #endif
 
+#include <starpu_thread.h>
 #include <starpu_util.h>
 #include <starpu_data.h>
 #include <starpu_data_interfaces.h>

+ 10 - 1
include/starpu_config.h.in

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009-2012  Université de Bordeaux 1
+ * Copyright (C) 2009-2013  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -89,6 +89,15 @@ typedef ssize_t starpu_ssize_t;
 #define __starpu_func__ __func__
 #endif
 
+#if defined(c_plusplus) || defined(__cplusplus)
+/* inline is part of C++ */
+#  define __starpu_inline inline
+#elif defined(_MSC_VER) || defined(__HP_cc)
+#  define __starpu_inline __inline
+#else
+#  define __starpu_inline __inline__
+#endif
+
 #undef STARPU_QUICK_CHECK
 #undef STARPU_USE_DRAND48
 #undef STARPU_USE_ERAND48_R

+ 2 - 2
include/starpu_data_interfaces.h

@@ -128,7 +128,7 @@ struct starpu_data_interface_ops
 	struct starpu_multiformat_data_interface_ops* (*get_mf_ops)(void *data_interface);
 
 	/* Pack the data handle into a contiguous buffer at the address ptr and store the size of the buffer in count */
-	int (*pack_data)(starpu_data_handle_t handle, unsigned node, void **ptr, ssize_t *count);
+	int (*pack_data)(starpu_data_handle_t handle, unsigned node, void **ptr, starpu_ssize_t *count);
 	/* Unpack the data handle from the contiguous buffer at the address ptr */
 	int (*unpack_data)(starpu_data_handle_t handle, unsigned node, void *ptr, size_t count);
 };
@@ -426,7 +426,7 @@ void starpu_multiformat_data_register(starpu_data_handle_t *handle, unsigned hom
 
 enum starpu_data_interface_id starpu_handle_get_interface_id(starpu_data_handle_t handle);
 
-int starpu_handle_pack_data(starpu_data_handle_t handle, void **ptr, ssize_t *count);
+int starpu_handle_pack_data(starpu_data_handle_t handle, void **ptr, starpu_ssize_t *count);
 int starpu_handle_unpack_data(starpu_data_handle_t handle, void *ptr, size_t count);
 size_t starpu_handle_get_size(starpu_data_handle_t handle);
 

+ 1 - 1
include/starpu_opencl.h

@@ -37,7 +37,7 @@ void starpu_opencl_display_error(const char *func, const char *file, int line, c
 #define STARPU_OPENCL_DISPLAY_ERROR(status) \
 	starpu_opencl_display_error(__starpu_func__, __FILE__, __LINE__, NULL, status)
 
-static inline void starpu_opencl_report_error(const char *func, const char *file, int line, const char *msg, cl_int status)
+static __starpu_inline void starpu_opencl_report_error(const char *func, const char *file, int line, const char *msg, cl_int status)
 {
 	starpu_opencl_display_error(func, file, line, msg, status);
 	assert(0);

+ 1 - 9
include/starpu_perfmodel.h

@@ -24,10 +24,6 @@
 
 #include <starpu_util.h>
 
-#if ! defined(_MSC_VER)
-#  include <pthread.h>
-#endif
-
 #ifdef __cplusplus
 extern "C"
 {
@@ -189,11 +185,7 @@ struct starpu_perfmodel
 	unsigned is_loaded;
 	unsigned benchmarking;
 
-#if defined(_MSC_VER) || defined(STARPU_SIMGRID)
-	void *model_rwlock;
-#else
-	pthread_rwlock_t model_rwlock;
-#endif
+	starpu_pthread_rwlock_t model_rwlock;
 };
 
 enum starpu_perf_archtype starpu_worker_get_perf_archtype(int workerid);

+ 11 - 11
include/starpu_profiling.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2013  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -20,7 +20,7 @@
 
 #include <starpu.h>
 #include <errno.h>
-#include <sys/time.h>
+#include <time.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -125,16 +125,16 @@ int starpu_bus_get_profiling_info(int busid, struct starpu_bus_profiling_info *b
 
 /* Some helper functions to manipulate profiling API output */
 /* Reset timespec */
-static inline void starpu_timespec_clear(struct timespec *tsp)
+static __starpu_inline void starpu_timespec_clear(struct timespec *tsp)
 {
 	tsp->tv_sec = 0;
 	tsp->tv_nsec = 0;
 }
 
 /* Computes result = a + b */
-static inline void starpu_timespec_add(struct timespec *a,
-					struct timespec *b,
-					struct timespec *result)
+static __starpu_inline void starpu_timespec_add(struct timespec *a,
+						struct timespec *b,
+						struct timespec *result)
 {
 	result->tv_sec = a->tv_sec + b->tv_sec;
 	result->tv_nsec = a->tv_nsec + b->tv_nsec;
@@ -147,8 +147,8 @@ static inline void starpu_timespec_add(struct timespec *a,
 }
 
 /* Computes res += b */
-static inline void starpu_timespec_accumulate(struct timespec *result,
-						struct timespec *a)
+static __starpu_inline void starpu_timespec_accumulate(struct timespec *result,
+						       struct timespec *a)
 {
 	result->tv_sec += a->tv_sec;
 	result->tv_nsec += a->tv_nsec;
@@ -161,9 +161,9 @@ static inline void starpu_timespec_accumulate(struct timespec *result,
 }
 
 /* Computes result = a - b */
-static inline void starpu_timespec_sub(const struct timespec *a,
-					const struct timespec *b,
-					struct timespec *result)
+static __starpu_inline void starpu_timespec_sub(const struct timespec *a,
+						const struct timespec *b,
+						struct timespec *result)
 {
 	result->tv_sec = a->tv_sec - b->tv_sec;
 	result->tv_nsec = a->tv_nsec - b->tv_nsec;

+ 1 - 3
include/starpu_sched_ctx.h

@@ -62,9 +62,7 @@ void starpu_sched_ctx_delete_worker_collection(unsigned sched_ctx_id);
 
 struct starpu_worker_collection* starpu_sched_ctx_get_worker_collection(unsigned sched_ctx_id);
 
-#if !defined(_MSC_VER) && !defined(STARPU_SIMGRID)
-pthread_mutex_t* starpu_sched_ctx_get_changing_ctx_mutex(unsigned sched_ctx_id);
-#endif
+starpu_pthread_mutex_t* starpu_sched_ctx_get_changing_ctx_mutex(unsigned sched_ctx_id);
 
 void starpu_sched_ctx_set_context(unsigned *sched_ctx_id);
 

+ 4 - 7
include/starpu_scheduler.h

@@ -20,10 +20,6 @@
 
 #include <starpu.h>
 
-#if ! defined(_MSC_VER)
-#  include <pthread.h>
-#endif
-
 #ifdef STARPU_HAVE_HWLOC
 #include <hwloc.h>
 #endif
@@ -125,9 +121,7 @@ associated mutex) should be used to block (and to wake up) a worker. Note that
 multiple workers may use the same condition variable. For instance, in the case
 of a scheduling strategy with a single task queue, the same condition variable
 would be used to block and wake up all workers.   */
-#if !defined(_MSC_VER) && !defined(STARPU_SIMGRID)
-void starpu_worker_get_sched_condition(int workerid, pthread_mutex_t **sched_mutex, pthread_cond_t **sched_cond);
-#endif
+void starpu_worker_get_sched_condition(int workerid, starpu_pthread_mutex_t **sched_mutex, starpu_pthread_cond_t **sched_cond);
 
 /* Check if the worker specified by workerid can execute the codelet. */
 int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task, unsigned nimpl);
@@ -139,6 +133,9 @@ int starpu_worker_can_execute_task(unsigned workerid, struct starpu_task *task,
  * a FIFO ordering. */
 int starpu_push_local_task(int workerid, struct starpu_task *task, int back);
 
+/* Called by scheduler to notify that the task has just been pushed */
+int starpu_push_task_end(struct starpu_task *task);
+
 /*
  *	Priorities
  */

+ 1 - 1
include/starpu_stdlib.h

@@ -36,7 +36,7 @@ int starpu_free(void *A);
 int starpu_malloc_flags(void **A, size_t dim, int flags);
 int starpu_free_flags(void *A, size_t dim, int flags);
 
-ssize_t starpu_memory_get_available(unsigned node);
+starpu_ssize_t starpu_memory_get_available(unsigned node);
 
 #ifdef __cplusplus
 }

+ 176 - 0
include/starpu_thread.h

@@ -0,0 +1,176 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2010, 2012-2013  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#ifndef __STARPU_THREAD_H__
+#define __STARPU_THREAD_H__
+
+#ifdef STARPU_SIMGRID
+#include <xbt/synchro_core.h>
+#include <msg/msg.h>
+#else
+#include <pthread.h>
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*
+ * Encapsulation of the pthread_create function.
+ */
+
+#ifdef STARPU_SIMGRID
+
+typedef int starpu_pthread_t;
+typedef int starpu_pthread_attr_t;
+
+int starpu_pthread_create(starpu_pthread_t *thread, const starpu_pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
+int starpu_pthread_join(starpu_pthread_t thread, void **retval);
+int starpu_pthread_attr_init(starpu_pthread_attr_t *attr);
+int starpu_pthread_attr_destroy(starpu_pthread_attr_t *attr);
+int starpu_pthread_attr_setdetachstate(starpu_pthread_attr_t *attr, int detachstate);
+
+#else /* STARPU_SIMGRID */
+
+typedef pthread_t starpu_pthread_t;
+typedef pthread_attr_t starpu_pthread_attr_t;
+
+#define starpu_pthread_create pthread_create
+#define starpu_pthread_join pthread_join
+#define starpu_pthread_attr_init pthread_attr_init
+#define starpu_pthread_attr_destroy pthread_attr_destroy
+#define starpu_pthread_attr_setdetachstate pthread_attr_setdetachstate
+
+#endif /* STARPU_SIMGRID */
+/*
+ * Encapsulation of the pthread_mutex_* functions.
+ */
+
+#ifdef STARPU_SIMGRID
+typedef xbt_mutex_t starpu_pthread_mutex_t;
+typedef int starpu_pthread_mutexattr_t;
+
+#define STARPU_PTHREAD_MUTEX_INITIALIZER NULL
+
+int starpu_pthread_mutex_init(starpu_pthread_mutex_t *mutex, const starpu_pthread_mutexattr_t *mutexattr);
+int starpu_pthread_mutex_destroy(starpu_pthread_mutex_t *mutex);
+int starpu_pthread_mutex_lock(starpu_pthread_mutex_t *mutex);
+int starpu_pthread_mutex_unlock(starpu_pthread_mutex_t *mutex);
+int starpu_pthread_mutex_trylock(starpu_pthread_mutex_t *mutex);
+
+#else /* !STARPU_SIMGRID */
+
+typedef pthread_mutex_t starpu_pthread_mutex_t;
+typedef pthread_mutexattr_t starpu_pthread_mutexattr_t;
+
+#define starpu_pthread_mutex_init pthread_mutex_init
+#define starpu_pthread_mutex_destroy pthread_mutex_destroy
+#define starpu_pthread_mutex_lock pthread_mutex_lock
+#define starpu_pthread_mutex_unlock pthread_mutex_unlock
+#define starpu_pthread_mutex_trylock pthread_mutex_trylock
+
+#define STARPU_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
+#endif /* STARPU_SIMGRID */
+
+/*
+ * Encapsulation of the pthread_key_* functions.
+ */
+#ifdef STARPU_SIMGRID
+
+typedef int starpu_pthread_key_t;
+int starpu_pthread_key_create(starpu_pthread_key_t *key, void (*destr_function) (void *));
+int starpu_pthread_key_delete(starpu_pthread_key_t key);
+int starpu_pthread_setspecific(starpu_pthread_key_t key, const void *pointer);
+void *starpu_pthread_getspecific(starpu_pthread_key_t key);
+
+#else /* STARPU_SIMGRID */
+
+typedef pthread_key_t starpu_pthread_key_t;
+
+#define starpu_pthread_key_create pthread_key_create
+#define starpu_pthread_key_delete pthread_key_delete
+#define starpu_pthread_setspecific pthread_setspecific
+#define starpu_pthread_getspecific pthread_getspecific
+
+#endif /* STARPU_SIMGRID */
+
+/*
+ * Encapsulation of the pthread_cond_* functions.
+ */
+
+#ifdef STARPU_SIMGRID
+typedef xbt_cond_t starpu_pthread_cond_t;
+typedef int starpu_pthread_condattr_t;
+#define STARPU_PTHREAD_COND_INITIALIZER NULL
+
+int starpu_pthread_cond_init(starpu_pthread_cond_t *cond, starpu_pthread_condattr_t *cond_attr);
+int starpu_pthread_cond_signal(starpu_pthread_cond_t *cond);
+int starpu_pthread_cond_broadcast(starpu_pthread_cond_t *cond);
+int starpu_pthread_cond_wait(starpu_pthread_cond_t *cond, starpu_pthread_mutex_t *mutex);
+int starpu_pthread_cond_timedwait(starpu_pthread_cond_t *cond, starpu_pthread_mutex_t *mutex, const struct timespec *abstime);
+int starpu_pthread_cond_destroy(starpu_pthread_cond_t *cond);
+
+#else /* STARPU_SIMGRID */
+typedef pthread_cond_t starpu_pthread_cond_t;
+typedef pthread_condattr_t starpu_pthread_condattr_t;
+#define STARPU_PTHREAD_COND_INITIALIZER PTHREAD_COND_INITIALIZER
+
+#define starpu_pthread_cond_init pthread_cond_init
+#define starpu_pthread_cond_signal pthread_cond_signal
+#define starpu_pthread_cond_broadcast pthread_cond_broadcast
+#define starpu_pthread_cond_wait pthread_cond_wait
+#define starpu_pthread_cond_timedwait pthread_cond_timedwait
+#define starpu_pthread_cond_destroy pthread_cond_destroy
+
+#endif /* STARPU_SIMGRID */
+
+
+/*
+ * Encapsulation of the pthread_rwlock_* functions.
+ */
+
+#ifdef STARPU_SIMGRID
+typedef xbt_mutex_t starpu_pthread_rwlock_t;
+typedef int starpu_pthread_rwlockattr_t;
+
+int starpu_pthread_rwlock_init(starpu_pthread_rwlock_t *rwlock, const starpu_pthread_rwlockattr_t *attr);
+int starpu_pthread_rwlock_destroy(starpu_pthread_rwlock_t *rwlock);
+int starpu_pthread_rwlock_rdlock(starpu_pthread_rwlock_t *rwlock);
+int starpu_pthread_rwlock_wrlock(starpu_pthread_rwlock_t *rwlock);
+int starpu_pthread_rwlock_unlock(starpu_pthread_rwlock_t *rwlock);
+
+#else /* STARPU_SIMGRID */
+
+typedef pthread_rwlock_t starpu_pthread_rwlock_t;
+typedef pthread_rwlockattr_t starpu_pthread_rwlockattr_t;
+
+#define starpu_pthread_rwlock_init pthread_rwlock_init
+#define starpu_pthread_rwlock_destroy pthread_rwlock_destroy
+#define starpu_pthread_rwlock_rdlock pthread_rwlock_rdlock
+#define starpu_pthread_rwlock_wrlock pthread_rwlock_wrlock
+#define starpu_pthread_rwlock_unlock pthread_rwlock_unlock
+
+#endif /* STARPU_SIMGRID */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STARPU_THREAD_H__ */
+
+

+ 7 - 7
include/starpu_util.h

@@ -73,16 +73,16 @@ extern "C"
 #else
 #  if defined(__CUDACC__) && defined(STARPU_HAVE_WINDOWS)
 #    define STARPU_ASSERT(x)		do { if (STARPU_UNLIKELY(!(x))) *(int*)NULL = 0; } while(0)
-#    define STARPU_ASSERT_MSG(x, msg, ...)	do { if (STARPU_UNLIKELY(!(x))) { fprintf(stderr, "[starpu][%s][assert failure] " msg "\n", __func__, ## __VA_ARGS__); *(int*)NULL = 0; }} while(0)
+#    define STARPU_ASSERT_MSG(x, msg, ...)	do { if (STARPU_UNLIKELY(!(x))) { fprintf(stderr, "[starpu][%s][assert failure] " msg "\n", __starpu_func__, ## __VA_ARGS__); *(int*)NULL = 0; }} while(0)
 #  else
 #    define STARPU_ASSERT(x)		assert(x)
-#    define STARPU_ASSERT_MSG(x, msg, ...)	do { if (STARPU_UNLIKELY(!(x))) { fprintf(stderr, "[starpu][%s][assert failure] " msg "\n", __func__, ## __VA_ARGS__); } ; assert(x); } while(0)
+#    define STARPU_ASSERT_MSG(x, msg, ...)	do { if (STARPU_UNLIKELY(!(x))) { fprintf(stderr, "[starpu][%s][assert failure] " msg "\n", __starpu_func__, ## __VA_ARGS__); } ; assert(x); } while(0)
 
 #  endif
 #endif
 
 #define STARPU_ABORT() do {                                          \
-	fprintf(stderr, "[starpu][abort] %s:%d %s\n", __FILE__, __LINE__, __func__); \
+	fprintf(stderr, "[starpu][abort] %s:%d %s\n", __FILE__, __LINE__, __starpu_func__); \
 	abort();                                                     \
 } while(0)
 
@@ -106,12 +106,12 @@ extern "C"
 
 #if defined(__i386__) || defined(__x86_64__)
 
-static __inline unsigned starpu_cmpxchg(unsigned *ptr, unsigned old, unsigned next)
+static __starpu_inline unsigned starpu_cmpxchg(unsigned *ptr, unsigned old, unsigned next)
 {
 	__asm__ __volatile__("lock cmpxchgl %2,%1": "+a" (old), "+m" (*ptr) : "q" (next) : "memory");
 	return old;
 }
-static __inline unsigned starpu_xchg(unsigned *ptr, unsigned next)
+static __starpu_inline unsigned starpu_xchg(unsigned *ptr, unsigned next)
 {
 	/* Note: xchg is always locked already */
 	__asm__ __volatile__("xchgl %1,%0": "+m" (*ptr), "+q" (next) : : "memory");
@@ -121,7 +121,7 @@ static __inline unsigned starpu_xchg(unsigned *ptr, unsigned next)
 #endif
 
 #define STARPU_ATOMIC_SOMETHING(name,expr) \
-static __inline unsigned starpu_atomic_##name(unsigned *ptr, unsigned value) \
+static __starpu_inline unsigned starpu_atomic_##name(unsigned *ptr, unsigned value) \
 { \
 	unsigned old, next; \
 	while (1) \
@@ -207,7 +207,7 @@ extern "C"
 {
 #endif
 
-static __inline int starpu_get_env_number(const char *str)
+static __starpu_inline int starpu_get_env_number(const char *str)
 {
 	char *strval;
 

+ 8 - 7
mpi/src/starpu_mpi.c

@@ -23,6 +23,7 @@
 #include <starpu_mpi_stats.h>
 #include <starpu_mpi_insert_task.h>
 #include <common/config.h>
+#include <common/thread.h>
 
 static void _starpu_mpi_submit_new_mpi_request(void *arg);
 static void _starpu_mpi_handle_request_termination(struct _starpu_mpi_req *req);
@@ -40,18 +41,18 @@ static struct _starpu_mpi_req_list *new_requests;
 
 /* The list of detached requests that have already been submitted to MPI */
 static struct _starpu_mpi_req_list *detached_requests;
-static _starpu_pthread_mutex_t detached_requests_mutex;
+static starpu_pthread_mutex_t detached_requests_mutex;
 
 /* Condition to wake up progression thread */
-static _starpu_pthread_cond_t cond_progression;
+static starpu_pthread_cond_t cond_progression;
 /* Condition to wake up waiting for all current MPI requests to finish */
-static _starpu_pthread_cond_t cond_finished;
-static _starpu_pthread_mutex_t mutex;
-static pthread_t progress_thread;
+static starpu_pthread_cond_t cond_finished;
+static starpu_pthread_mutex_t mutex;
+static starpu_pthread_t progress_thread;
 static int running = 0;
 
 /* Count requests posted by the application and not yet submitted to MPI, i.e pushed into the new_requests list */
-static _starpu_pthread_mutex_t mutex_posted_requests;
+static starpu_pthread_mutex_t mutex_posted_requests;
 static int posted_requests = 0, newer_requests, barrier_running = 0;
 
 #define _STARPU_MPI_INC_POSTED_REQUESTS(value) { _STARPU_PTHREAD_MUTEX_LOCK(&mutex_posted_requests); posted_requests += value; _STARPU_PTHREAD_MUTEX_UNLOCK(&mutex_posted_requests); }
@@ -1068,7 +1069,7 @@ int starpu_mpi_shutdown(void)
 	_STARPU_PTHREAD_COND_BROADCAST(&cond_progression);
 	_STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
 
-	pthread_join(progress_thread, &value);
+	starpu_pthread_join(progress_thread, &value);
 
 #ifdef STARPU_MPI_ACTIVITY
 	starpu_progression_hook_deregister(hookid);

+ 6 - 8
mpi/src/starpu_mpi_private.h

@@ -23,8 +23,6 @@
 #include "starpu_mpi.h"
 #include "starpu_mpi_fxt.h"
 #include <common/list.h>
-#include <common/utils.h>
-#include <pthread.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -43,7 +41,7 @@ void _starpu_mpi_set_debug_level(int level);
 		if (!getenv("STARPU_SILENT") && level <= _debug_level)	\
 		{							\
 			if (_debug_rank == -1) MPI_Comm_rank(MPI_COMM_WORLD, &_debug_rank); \
-			fprintf(stderr, "%*s[%d][starpu_mpi][%s] " fmt , (_debug_rank+1)*4, "", _debug_rank, __func__ ,##args); \
+			fprintf(stderr, "%*s[%d][starpu_mpi][%s] " fmt , (_debug_rank+1)*4, "", _debug_rank, __starpu_func__ ,##args); \
 			fflush(stderr); \
 		}			\
 	} while(0);
@@ -53,17 +51,17 @@ void _starpu_mpi_set_debug_level(int level);
 
 #define _STARPU_MPI_DISP(fmt, args ...) do { if (!getenv("STARPU_SILENT")) { \
 	       				     if (_debug_rank == -1) MPI_Comm_rank(MPI_COMM_WORLD, &_debug_rank); \
-                                             fprintf(stderr, "%*s[%d][starpu_mpi][%s] " fmt , (_debug_rank+1)*4, "", _debug_rank, __func__ ,##args); \
+                                             fprintf(stderr, "%*s[%d][starpu_mpi][%s] " fmt , (_debug_rank+1)*4, "", _debug_rank, __starpu_func__ ,##args); \
                                              fflush(stderr); }} while(0);
 
 #ifdef STARPU_VERBOSE0
 #  define _STARPU_MPI_LOG_IN()             do { if (!getenv("STARPU_SILENT")) { \
                                                if (_debug_rank == -1) MPI_Comm_rank(MPI_COMM_WORLD, &_debug_rank);                        \
-                                               fprintf(stderr, "%*s[%d][starpu_mpi][%s] -->\n", (_debug_rank+1)*4, "", _debug_rank, __func__ ); \
+                                               fprintf(stderr, "%*s[%d][starpu_mpi][%s] -->\n", (_debug_rank+1)*4, "", _debug_rank, __starpu_func__ ); \
                                                fflush(stderr); }} while(0)
 #  define _STARPU_MPI_LOG_OUT()            do { if (!getenv("STARPU_SILENT")) { \
                                                if (_debug_rank == -1) MPI_Comm_rank(MPI_COMM_WORLD, &_debug_rank);                        \
-                                               fprintf(stderr, "%*s[%d][starpu_mpi][%s] <--\n", (_debug_rank+1)*4, "", _debug_rank, __func__ ); \
+                                               fprintf(stderr, "%*s[%d][starpu_mpi][%s] <--\n", (_debug_rank+1)*4, "", _debug_rank, __starpu_func__ ); \
                                                fflush(stderr); }} while(0)
 #else
 #  define _STARPU_MPI_LOG_IN()
@@ -102,8 +100,8 @@ LIST_TYPE(_starpu_mpi_req,
 	int *flag;
 
 	int ret;
-	_starpu_pthread_mutex_t req_mutex;
-	_starpu_pthread_cond_t req_cond;
+	starpu_pthread_mutex_t req_mutex;
+	starpu_pthread_cond_t req_cond;
 
 	enum _starpu_mpi_request_type request_type; /* 0 send, 1 recv */
 

+ 2 - 2
mpi/tests/helper.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2011, 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2011, 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -21,6 +21,6 @@
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 #define FPRINTF_MPI(fmt, args ...) do { if (!getenv("STARPU_SILENT")) { \
     						int _disp_rank; MPI_Comm_rank(MPI_COMM_WORLD, &_disp_rank);       \
-                                                fprintf(stderr, "[%d][starpu_mpi][%s] " fmt , _disp_rank, __func__ ,##args); \
+                                                fprintf(stderr, "[%d][starpu_mpi][%s] " fmt , _disp_rank, __starpu_func__ ,##args); \
                                                 fflush(stderr); }} while(0);
 

+ 3 - 3
mpi/tests/mpi_irecv_detached.c

@@ -16,7 +16,7 @@
  */
 
 #include <starpu_mpi.h>
-#include <common/utils.h>
+#include <common/thread.h>
 #include "helper.h"
 
 #ifdef STARPU_QUICK_CHECK
@@ -29,8 +29,8 @@
 float *tab;
 starpu_data_handle_t tab_handle;
 
-static _starpu_pthread_mutex_t mutex = _STARPU_PTHREAD_MUTEX_INITIALIZER;
-static _starpu_pthread_cond_t cond = _STARPU_PTHREAD_COND_INITIALIZER;
+static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
+static starpu_pthread_cond_t cond = STARPU_PTHREAD_COND_INITIALIZER;
 
 void callback(void *arg __attribute__((unused)))
 {

+ 4 - 4
mpi/tests/mpi_isend_detached.c

@@ -16,8 +16,8 @@
  */
 
 #include <starpu_mpi.h>
-#include <common/utils.h>
-#include <pthread.h>
+#include <common/thread.h>
+
 #include "helper.h"
 
 #ifdef STARPU_QUICK_CHECK
@@ -27,8 +27,8 @@
 #endif
 #define SIZE	16
 
-static _starpu_pthread_mutex_t mutex = _STARPU_PTHREAD_MUTEX_INITIALIZER;
-static _starpu_pthread_cond_t cond = _STARPU_PTHREAD_COND_INITIALIZER;
+static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
+static starpu_pthread_cond_t cond = STARPU_PTHREAD_COND_INITIALIZER;
 
 void callback(void *arg)
 {

+ 3 - 3
mpi/tests/mpi_probe.c

@@ -16,7 +16,7 @@
  */
 
 #include <starpu_mpi.h>
-#include <common/utils.h>
+#include <common/thread.h>
 #include "helper.h"
 
 #ifdef STARPU_QUICK_CHECK
@@ -29,8 +29,8 @@
 float *tab;
 starpu_data_handle_t tab_handle;
 
-static _starpu_pthread_mutex_t mutex = _STARPU_PTHREAD_MUTEX_INITIALIZER;
-static _starpu_pthread_cond_t cond = _STARPU_PTHREAD_COND_INITIALIZER;
+static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
+static starpu_pthread_cond_t cond = STARPU_PTHREAD_COND_INITIALIZER;
 
 void callback(void *arg __attribute__((unused)))
 {

+ 2 - 2
mpi/tests/mpi_reduction_kernels.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012  Centre National de la Recherche Scientifique
+ * Copyright (C) 2012, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -19,7 +19,7 @@
 
 #define _DISPLAY(fmt, args ...) do { \
 		int _display_rank; MPI_Comm_rank(MPI_COMM_WORLD, &_display_rank);	\
-		fprintf(stderr, "[%d][%s] " fmt , _display_rank, __func__ ,##args); 	\
+		fprintf(stderr, "[%d][%s] " fmt , _display_rank, __starpu_func__ ,##args); 	\
 		fflush(stderr); } while(0)
 
 /*

+ 5 - 7
sched_ctx_hypervisor/examples/app_driven_test/app_driven_test.c

@@ -19,8 +19,6 @@
 #include <starpu.h>
 #include <sched_ctx_hypervisor.h>
 
-#include <pthread.h>
-
 #define FPRINTF(ofile, fmt, args ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ##args); }} while(0)
 
 /* Every implementation of a codelet must have this prototype, the first                                                                                                                                             * argument (buffers) describes the buffers/streams that are managed by the
@@ -119,13 +117,13 @@ int main()
 	sched_ctx_hypervisor_register_ctx(sched_ctx1, 0.0);
 	sched_ctx_hypervisor_register_ctx(sched_ctx2, 0.0);
 
-	pthread_t tid[2];
+	starpu_pthread_t tid[2];
 
-	pthread_create(&tid[0], NULL, start_thread, (void*)&sched_ctx1);
-	pthread_create(&tid[1], NULL, start_thread, (void*)&sched_ctx2);
+	starpu_pthread_create(&tid[0], NULL, start_thread, (void*)&sched_ctx1);
+	starpu_pthread_create(&tid[1], NULL, start_thread, (void*)&sched_ctx2);
 
-	pthread_join(tid[0], NULL);
-	pthread_join(tid[1], NULL);
+	starpu_pthread_join(tid[0], NULL);
+	starpu_pthread_join(tid[1], NULL);
 
 	starpu_shutdown();
 	sched_ctx_hypervisor_shutdown();

+ 17 - 17
sched_ctx_hypervisor/examples/sched_ctx_utils/sched_ctx_utils.c

@@ -49,13 +49,13 @@ typedef struct
 } retvals;
 
 int first = 1;
-pthread_mutex_t mut;
+starpu_pthread_mutex_t mut;
 retvals rv[2];
 params p1, p2;
 int it = 0;
 int it2 = 0;
 
-pthread_key_t key;
+starpu_pthread_key_t key;
 
 void init()
 {
@@ -79,12 +79,12 @@ void init()
 
 	p1.id = 0;
 	p2.id = 1;
-	pthread_key_create(&key, NULL);
+	starpu_pthread_key_create(&key, NULL);
 }
 
 void update_sched_ctx_timing_results(double flops, double avg_timing)
 {
-	unsigned *id = pthread_getspecific(key);
+	unsigned *id = starpu_pthread_getspecific(key);
 	rv[*id].flops += flops;
 	rv[*id].avg_timing += avg_timing;
 }
@@ -94,7 +94,7 @@ void* start_bench(void *val)
 	params *p = (params*)val;
 	int i;
 
-	pthread_setspecific(key, &p->id);
+	starpu_pthread_setspecific(key, &p->id);
 
 	if(p->ctx != 0)
 		starpu_sched_ctx_set_context(&p->ctx);
@@ -104,14 +104,14 @@ void* start_bench(void *val)
 
 	/* if(p->ctx != 0) */
 	/* { */
-	/* 	pthread_mutex_lock(&mut); */
+	/* 	starpu_pthread_mutex_lock(&mut); */
 	/* 	if(first){ */
 	/* 		sched_ctx_hypervisor_unregiser_ctx(p->ctx); */
 	/* 		starpu_sched_ctx_delete(p->ctx, p->the_other_ctx); */
 	/* 	} */
 
 	/* 	first = 0; */
-	/* 	pthread_mutex_unlock(&mut); */
+	/* 	starpu_pthread_mutex_unlock(&mut); */
 	/* } */
 	sched_ctx_hypervisor_stop_resize(p->the_other_ctx);
 	rv[p->id].flops /= NSAMPLES;
@@ -151,23 +151,23 @@ void start_2benchs(void (*bench)(float*, unsigned, unsigned))
 		p2.mat[i] = construct_matrix(p2.size);
 	}
 
-	pthread_t tid[2];
-	pthread_mutex_init(&mut, NULL);
+	starpu_pthread_t tid[2];
+	starpu_pthread_mutex_init(&mut, NULL);
 
 	struct timeval start;
 	struct timeval end;
 
 	gettimeofday(&start, NULL);
 
-	pthread_create(&tid[0], NULL, (void*)start_bench, (void*)&p1);
-	pthread_create(&tid[1], NULL, (void*)start_bench, (void*)&p2);
+	starpu_pthread_create(&tid[0], NULL, (void*)start_bench, (void*)&p1);
+	starpu_pthread_create(&tid[1], NULL, (void*)start_bench, (void*)&p2);
 
-	pthread_join(tid[0], NULL);
-	pthread_join(tid[1], NULL);
+	starpu_pthread_join(tid[0], NULL);
+	starpu_pthread_join(tid[1], NULL);
 
 	gettimeofday(&end, NULL);
 
-	pthread_mutex_destroy(&mut);
+	starpu_pthread_mutex_destroy(&mut);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 	timing /= 1000000;
@@ -198,7 +198,7 @@ void start_1stbench(void (*bench)(float*, unsigned, unsigned))
 
 	gettimeofday(&end, NULL);
 
-	pthread_mutex_destroy(&mut);
+	starpu_pthread_mutex_destroy(&mut);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 	timing /= 1000000;
@@ -227,7 +227,7 @@ void start_2ndbench(void (*bench)(float*, unsigned, unsigned))
 
 	gettimeofday(&end, NULL);
 
-	pthread_mutex_destroy(&mut);
+	starpu_pthread_mutex_destroy(&mut);
 
 	double timing = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 	timing /= 1000000;
@@ -330,7 +330,7 @@ void construct_contexts(void (*bench)(float*, unsigned, unsigned))
 
 void set_hypervisor_conf(int event, int task_tag)
 {
-/* 	unsigned *id = pthread_getspecific(key); */
+/* 	unsigned *id = starpu_pthread_getspecific(key); */
 /* 	if(*id == 0) */
 /* 	{ */
 /* 		if(event == END_BENCH) */

+ 2 - 3
sched_ctx_hypervisor/include/sched_ctx_hypervisor.h

@@ -18,7 +18,6 @@
 #define SCHED_CTX_HYPERVISOR_H
 
 #include <starpu.h>
-#include <pthread.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -45,7 +44,7 @@ extern "C"
 #define	HYPERVISOR_ISPEED_W_SAMPLE -13
 #define HYPERVISOR_ISPEED_CTX_SAMPLE -14
 
-pthread_mutex_t act_hypervisor_mutex;
+starpu_pthread_mutex_t act_hypervisor_mutex;
 
 #define MAX_IDLE_TIME 5000000000
 #define MIN_WORKING_TIME 500
@@ -153,7 +152,7 @@ struct sched_ctx_hypervisor_wrapper
 	struct sched_ctx_hypervisor_resize_ack resize_ack;
 
 	/* mutex to protect the ack of workers */
-	pthread_mutex_t mutex;
+	starpu_pthread_mutex_t mutex;
 };
 
 /* Forward declaration of an internal data structure

+ 2 - 2
sched_ctx_hypervisor/src/hypervisor_policies/debit_lp_policy.c

@@ -227,7 +227,7 @@ static void debit_lp_handle_poped_task(unsigned sched_ctx, int worker, struct st
 {
 	struct sched_ctx_hypervisor_wrapper* sc_w = sched_ctx_hypervisor_get_wrapper(sched_ctx);
 	_get_velocity_per_worker(sc_w, worker);
-	int ret = pthread_mutex_trylock(&act_hypervisor_mutex);
+	int ret = starpu_pthread_mutex_trylock(&act_hypervisor_mutex);
 	if(ret != EBUSY)
 	{
 		if(_velocity_gap_btw_ctxs())
@@ -280,7 +280,7 @@ static void debit_lp_handle_poped_task(unsigned sched_ctx, int worker, struct st
 
 			}
 		}
-		pthread_mutex_unlock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	}
 }
 

+ 3 - 3
sched_ctx_hypervisor/src/hypervisor_policies/gflops_rate_policy.c

@@ -138,9 +138,9 @@ static unsigned _gflops_rate_resize(unsigned sender_sched_ctx, unsigned receiver
 {
         int ret = 1;
         if(force_resize)
-                pthread_mutex_lock(&act_hypervisor_mutex);
+                starpu_pthread_mutex_lock(&act_hypervisor_mutex);
         else
-                ret = pthread_mutex_trylock(&act_hypervisor_mutex);
+                ret = starpu_pthread_mutex_trylock(&act_hypervisor_mutex);
         if(ret != EBUSY)
         {
                 int nworkers_to_move = 0;
@@ -156,7 +156,7 @@ static unsigned _gflops_rate_resize(unsigned sender_sched_ctx, unsigned receiver
 
                         free(workers_to_move);
                 }
-                pthread_mutex_unlock(&act_hypervisor_mutex);
+                starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
                 return 1;
         }
         return 0;

+ 2 - 2
sched_ctx_hypervisor/src/hypervisor_policies/ispeed_lp_policy.c

@@ -356,7 +356,7 @@ static void ispeed_lp_handle_poped_task(unsigned sched_ctx, int worker, struct s
 {
 	struct sched_ctx_hypervisor_wrapper* sc_w = sched_ctx_hypervisor_get_wrapper(sched_ctx);
 	_get_velocity_per_worker(sc_w, worker);
-	int ret = pthread_mutex_trylock(&act_hypervisor_mutex);
+	int ret = starpu_pthread_mutex_trylock(&act_hypervisor_mutex);
 	if(ret != EBUSY)
 	{
 		if(_velocity_gap_btw_ctxs())
@@ -411,7 +411,7 @@ static void ispeed_lp_handle_poped_task(unsigned sched_ctx, int worker, struct s
 
 			}
 		}
-		pthread_mutex_unlock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	}
 }
 

+ 2 - 2
sched_ctx_hypervisor/src/hypervisor_policies/ispeed_policy.c

@@ -143,7 +143,7 @@ static int* _get_slowest_workers(unsigned sched_ctx, int *nworkers, enum starpu_
 
 static void ispeed_handle_poped_task(unsigned sched_ctx, int worker, struct starpu_task *task, uint32_t footprint)
 {
-	int ret = pthread_mutex_trylock(&act_hypervisor_mutex);
+	int ret = starpu_pthread_mutex_trylock(&act_hypervisor_mutex);
 	if(ret != EBUSY)
 	{
 		if(_velocity_gap_btw_ctxs())
@@ -177,7 +177,7 @@ static void ispeed_handle_poped_task(unsigned sched_ctx, int worker, struct star
 
 			}
 		}
-		pthread_mutex_unlock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	}
 }
 

+ 14 - 14
sched_ctx_hypervisor/src/hypervisor_policies/lp2_policy.c

@@ -20,7 +20,7 @@
 
 static struct bound_task_pool *task_pools = NULL;
 
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
 static double _glp_resolve(int ns, int nw, int nt, double tasks[nw][nt], double tmax, double w_in_s[ns][nw], int *in_sched_ctxs, int *workers, unsigned interger,
 			   struct bound_task_pool *tmp_task_pools, unsigned size_ctxs);
 static unsigned _compute_task_distribution_over_ctxs(int ns, int nw, int nt, double w_in_s[ns][nw], double tasks[nw][nt], 
@@ -125,7 +125,7 @@ static void _size_ctxs(int *sched_ctxs, int nsched_ctxs , int *workers, int nwor
 	int ns = sched_ctxs == NULL ? sched_ctx_hypervisor_get_nsched_ctxs() : nsched_ctxs;
 	int nw = workers == NULL ? (int)starpu_worker_get_count() : nworkers; /* Number of different workers */
 	int nt = 0; /* Number of different kinds of tasks */
-	pthread_mutex_lock(&mutex);
+	starpu_pthread_mutex_lock(&mutex);
 	struct bound_task_pool * tp;
 	for (tp = task_pools; tp; tp = tp->next)
 		nt++;
@@ -133,7 +133,7 @@ static void _size_ctxs(int *sched_ctxs, int nsched_ctxs , int *workers, int nwor
 	double w_in_s[ns][nw];
 	double tasks[nw][nt];
 	unsigned found_sol = _compute_task_distribution_over_ctxs(ns, nw, nt, w_in_s, tasks, sched_ctxs, workers, task_pools, 1);
-	pthread_mutex_unlock(&mutex);
+	starpu_pthread_mutex_unlock(&mutex);
 	/* if we did find at least one solution redistribute the resources */
 	if(found_sol)
 		_lp_place_resources_in_ctx(ns, nw, w_in_s, sched_ctxs, workers, 1);
@@ -150,7 +150,7 @@ static void size_if_required()
 		struct sched_ctx_hypervisor_wrapper* sc_w = NULL;
 		unsigned ready_to_size = 1;
 		int s;
-		pthread_mutex_lock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 		for(s = 0; s < nsched_ctxs; s++)
 		{
 			sc_w = sched_ctx_hypervisor_get_wrapper(sched_ctxs[s]);
@@ -160,14 +160,14 @@ static void size_if_required()
 
 		if(ready_to_size)
 			_size_ctxs(sched_ctxs, nsched_ctxs, workers, nworkers);
-		pthread_mutex_unlock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	}
 }
 
 static void lp2_handle_submitted_job(struct starpu_task *task, uint32_t footprint)
 {
 	/* count the tasks of the same type */
-	pthread_mutex_lock(&mutex);
+	starpu_pthread_mutex_lock(&mutex);
 	struct bound_task_pool *tp = NULL;
 
 	for (tp = task_pools; tp; tp = tp->next)
@@ -189,7 +189,7 @@ static void lp2_handle_submitted_job(struct starpu_task *task, uint32_t footprin
 
 	/* One more task of this kind */
 	tp->n++;
-	pthread_mutex_unlock(&mutex);
+	starpu_pthread_mutex_unlock(&mutex);
 
 	size_if_required();
 }
@@ -529,12 +529,12 @@ static void lp2_handle_poped_task(unsigned sched_ctx, int worker, struct starpu_
 {
 	struct sched_ctx_hypervisor_wrapper* sc_w = sched_ctx_hypervisor_get_wrapper(sched_ctx);
 
-	int ret = pthread_mutex_trylock(&act_hypervisor_mutex);
+	int ret = starpu_pthread_mutex_trylock(&act_hypervisor_mutex);
 	if(ret != EBUSY)
 	{
 		if(sc_w->submitted_flops < sc_w->total_flops)
 		{
-			pthread_mutex_unlock(&act_hypervisor_mutex);
+			starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 			return;
 		}
 
@@ -544,7 +544,7 @@ static void lp2_handle_poped_task(unsigned sched_ctx, int worker, struct starpu_
 			int nw = starpu_worker_get_count(); /* Number of different workers */
 			int nt = 0; /* Number of different kinds of tasks */
 
-//			pthread_mutex_lock(&mutex);
+//			starpu_pthread_mutex_lock(&mutex);
 
 			/* we don't take the mutex bc a correct value of the number of tasks is
 			   not required but we do a copy in order to be sure
@@ -562,7 +562,7 @@ static void lp2_handle_poped_task(unsigned sched_ctx, int worker, struct starpu_
 			double tasks_per_worker[nw][nt];
 
 			unsigned found_sol = _compute_task_distribution_over_ctxs(ns, nw, nt, w_in_s, tasks_per_worker, NULL, NULL, tmp_task_pools, 0);
-//			pthread_mutex_unlock(&mutex);
+//			starpu_pthread_mutex_unlock(&mutex);
 
 			/* if we did find at least one solution redistribute the resources */
 			if(found_sol)
@@ -580,12 +580,12 @@ static void lp2_handle_poped_task(unsigned sched_ctx, int worker, struct starpu_
 			
 
 		}
-		pthread_mutex_unlock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	}
 	/* too expensive to take this mutex and correct value of the number of tasks is not compulsory */
-//	pthread_mutex_lock(&mutex);
+//	starpu_pthread_mutex_lock(&mutex);
 	_remove_task_from_pool(task, footprint);
-//	pthread_mutex_unlock(&mutex);
+//	starpu_pthread_mutex_unlock(&mutex);
 
 }
 

+ 4 - 4
sched_ctx_hypervisor/src/hypervisor_policies/lp_policy.c

@@ -27,7 +27,7 @@ static void lp_handle_poped_task(unsigned sched_ctx, int worker, struct starpu_t
 
 		double nworkers[nsched_ctxs][2];
 
-		int ret = pthread_mutex_trylock(&act_hypervisor_mutex);
+		int ret = starpu_pthread_mutex_trylock(&act_hypervisor_mutex);
 		if(ret != EBUSY)
 		{
 			int total_nw[2];
@@ -52,7 +52,7 @@ static void lp_handle_poped_task(unsigned sched_ctx, int worker, struct starpu_t
 				_lp_round_double_to_int(nsched_ctxs, 2, nworkers, nworkers_rounded);
 				_lp_redistribute_resources_in_ctxs(nsched_ctxs, 2, nworkers_rounded, nworkers);
 			}
-			pthread_mutex_unlock(&act_hypervisor_mutex);
+			starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 		}
 	}
 }
@@ -63,7 +63,7 @@ static void lp_size_ctxs(int *sched_ctxs, int ns, int *workers, int nworkers)
 	int total_nw[2];
 	_get_total_nw(workers, nworkers, 2, total_nw);
 
-	pthread_mutex_lock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	double vmax = _lp_get_nworkers_per_ctx(nsched_ctxs, 2, nworkers_per_type, total_nw);
 	if(vmax != 0.0)
 	{
@@ -101,7 +101,7 @@ static void lp_size_ctxs(int *sched_ctxs, int ns, int *workers, int nworkers)
 		else
 			_lp_distribute_resources_in_ctxs(sched_ctxs, nsched_ctxs, 2, nworkers_per_type_rounded, nworkers_per_type, workers, nworkers);
 	}
-	pthread_mutex_unlock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 }
 
 struct sched_ctx_hypervisor_policy lp_policy = {

+ 3 - 4
sched_ctx_hypervisor/src/hypervisor_policies/policy_tools.c

@@ -15,7 +15,6 @@
  */
 
 /* #include <sched_ctx_hypervisor.h> */
-/* #include <pthread.h> */
 
 #include "policy_tools.h"
 
@@ -253,9 +252,9 @@ unsigned _resize(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, unsigne
 {
 	int ret = 1;
 	if(force_resize)
-		pthread_mutex_lock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	else
-		ret = pthread_mutex_trylock(&act_hypervisor_mutex);
+		ret = starpu_pthread_mutex_trylock(&act_hypervisor_mutex);
 	if(ret != EBUSY)
 	{
 		int nworkers_to_move = _get_nworkers_to_move(sender_sched_ctx);
@@ -289,7 +288,7 @@ unsigned _resize(unsigned sender_sched_ctx, unsigned receiver_sched_ctx, unsigne
 				free(workers_to_move);
 			}
 		}
-		pthread_mutex_unlock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 		return 1;
 	}
 	return 0;

+ 0 - 1
sched_ctx_hypervisor/src/hypervisor_policies/policy_tools.h

@@ -15,7 +15,6 @@
  */
 
 #include <sched_ctx_hypervisor.h>
-#include <pthread.h>
 
 #define HYPERVISOR_REDIM_SAMPLE 0.02
 #define HYPERVISOR_START_REDIM_SAMPLE 0.1

+ 6 - 7
sched_ctx_hypervisor/src/hypervisor_policies/simple_policy.c

@@ -15,7 +15,6 @@
  */
 
 #include <sched_ctx_hypervisor.h>
-#include <pthread.h>
 
 static int _compute_priority(unsigned sched_ctx)
 {
@@ -216,9 +215,9 @@ static unsigned _simple_resize(unsigned sender_sched_ctx, unsigned receiver_sche
 {
 	int ret = 1;
 	if(force_resize)
-		pthread_mutex_lock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	else
-		ret = pthread_mutex_trylock(&act_hypervisor_mutex);
+		ret = starpu_pthread_mutex_trylock(&act_hypervisor_mutex);
 	if(ret != EBUSY)
 	{
 		unsigned nworkers_to_move = _get_nworkers_to_move(sender_sched_ctx);
@@ -253,7 +252,7 @@ static unsigned _simple_resize(unsigned sender_sched_ctx, unsigned receiver_sche
 				free(workers_to_move);
 			}
 		}
-		pthread_mutex_unlock(&act_hypervisor_mutex);
+		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 		return 1;
 	}
 	return 0;
@@ -337,9 +336,9 @@ static unsigned _simple_resize2(unsigned sender_sched_ctx, unsigned receiver_sch
 {
         int ret = 1;
         if(force_resize)
-                pthread_mutex_lock(&act_hypervisor_mutex);
+                starpu_pthread_mutex_lock(&act_hypervisor_mutex);
         else
-                ret = pthread_mutex_trylock(&act_hypervisor_mutex);
+                ret = starpu_pthread_mutex_trylock(&act_hypervisor_mutex);
         if(ret != EBUSY)
         {
                 int nworkers_to_move = 0;
@@ -355,7 +354,7 @@ static unsigned _simple_resize2(unsigned sender_sched_ctx, unsigned receiver_sch
 
                         free(workers_to_move);
                 }
-                pthread_mutex_unlock(&act_hypervisor_mutex);
+                starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
                 return 1;
         }
         return 0;

+ 2 - 2
sched_ctx_hypervisor/src/sched_ctx_config.c

@@ -257,9 +257,9 @@ void sched_ctx_hypervisor_ioctl(unsigned sched_ctx, ...)
 		entry->task_tag = task_tag;
 		entry->configuration = config;
 
-		pthread_mutex_lock(&hypervisor.conf_mut[sched_ctx]);
+		starpu_pthread_mutex_lock(&hypervisor.conf_mut[sched_ctx]);
 		HASH_ADD_INT(hypervisor.configurations[sched_ctx], task_tag, entry);
-		pthread_mutex_unlock(&hypervisor.conf_mut[sched_ctx]);
+		starpu_pthread_mutex_unlock(&hypervisor.conf_mut[sched_ctx]);
 	}
 
 	return;

+ 34 - 34
sched_ctx_hypervisor/src/sched_ctx_hypervisor.c

@@ -132,7 +132,7 @@ struct starpu_sched_ctx_performance_counters* sched_ctx_hypervisor_init(struct s
 {
 	hypervisor.min_tasks = 0;
 	hypervisor.nsched_ctxs = 0;
-	pthread_mutex_init(&act_hypervisor_mutex, NULL);
+	starpu_pthread_mutex_init(&act_hypervisor_mutex, NULL);
 	hypervisor.start_executing_time = starpu_timing_now();
 	int i;
 	for(i = 0; i < STARPU_NMAX_SCHED_CTXS; i++)
@@ -154,7 +154,7 @@ struct starpu_sched_ctx_performance_counters* sched_ctx_hypervisor_init(struct s
 		hypervisor.sched_ctx_w[i].resize_ack.moved_workers = NULL;
 		hypervisor.sched_ctx_w[i].resize_ack.nmoved_workers = 0;
 		hypervisor.sched_ctx_w[i].resize_ack.acked_workers = NULL;
-		pthread_mutex_init(&hypervisor.sched_ctx_w[i].mutex, NULL);
+		starpu_pthread_mutex_init(&hypervisor.sched_ctx_w[i].mutex, NULL);
 
 		int j;
 		for(j = 0; j < STARPU_NMAXWORKERS; j++)
@@ -239,7 +239,7 @@ void sched_ctx_hypervisor_shutdown(void)
 		{
 			sched_ctx_hypervisor_stop_resize(hypervisor.sched_ctxs[i]);
 			sched_ctx_hypervisor_unregister_ctx(hypervisor.sched_ctxs[i]);
-			pthread_mutex_destroy(&hypervisor.sched_ctx_w[i].mutex);
+			starpu_pthread_mutex_destroy(&hypervisor.sched_ctx_w[i].mutex);
 		}
 	}
 	perf_counters->notify_idle_cycle = NULL;
@@ -252,17 +252,17 @@ void sched_ctx_hypervisor_shutdown(void)
 	free(perf_counters);
 	perf_counters = NULL;
 
-	pthread_mutex_destroy(&act_hypervisor_mutex);
+	starpu_pthread_mutex_destroy(&act_hypervisor_mutex);
 }
 
 /* the hypervisor is in charge only of the contexts registered to it*/
 void sched_ctx_hypervisor_register_ctx(unsigned sched_ctx, double total_flops)
 {
-	pthread_mutex_lock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	hypervisor.configurations[sched_ctx] = NULL;
 	hypervisor.resize_requests[sched_ctx] = NULL;
-	pthread_mutex_init(&hypervisor.conf_mut[sched_ctx], NULL);
-	pthread_mutex_init(&hypervisor.resize_mut[sched_ctx], NULL);
+	starpu_pthread_mutex_init(&hypervisor.conf_mut[sched_ctx], NULL);
+	starpu_pthread_mutex_init(&hypervisor.resize_mut[sched_ctx], NULL);
 
 	_add_config(sched_ctx);
 	hypervisor.sched_ctx_w[sched_ctx].sched_ctx = sched_ctx;
@@ -272,7 +272,7 @@ void sched_ctx_hypervisor_register_ctx(unsigned sched_ctx, double total_flops)
 	hypervisor.sched_ctx_w[sched_ctx].remaining_flops = total_flops;
 	if(strcmp(hypervisor.policy.name, "app_driven") == 0)
 		hypervisor.resize[sched_ctx] = 1;
-	pthread_mutex_unlock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 }
 
 static int _get_first_free_sched_ctx(int *sched_ctxs, int nsched_ctxs)
@@ -312,7 +312,7 @@ void sched_ctx_hypervisor_unregister_ctx(unsigned sched_ctx)
 {
 	if(hypervisor.policy.end_ctx)
 		hypervisor.policy.end_ctx(sched_ctx);
-	pthread_mutex_lock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	unsigned i;
 	for(i = 0; i < hypervisor.nsched_ctxs; i++)
 	{
@@ -330,12 +330,12 @@ void sched_ctx_hypervisor_unregister_ctx(unsigned sched_ctx)
 
 /* 	free(hypervisor.configurations[sched_ctx]); */
 /* 	free(hypervisor.resize_requests[sched_ctx]); */
-	pthread_mutex_destroy(&hypervisor.conf_mut[sched_ctx]);
-	pthread_mutex_destroy(&hypervisor.resize_mut[sched_ctx]);
+	starpu_pthread_mutex_destroy(&hypervisor.conf_mut[sched_ctx]);
+	starpu_pthread_mutex_destroy(&hypervisor.resize_mut[sched_ctx]);
 	if(hypervisor.nsched_ctxs == 1)
 		sched_ctx_hypervisor_stop_resize(hypervisor.sched_ctxs[0]);
 
-	pthread_mutex_unlock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 }
 
 static double _get_best_total_elapsed_flops(struct sched_ctx_hypervisor_wrapper* sc_w, int *npus, enum starpu_archtype req_arch)
@@ -535,7 +535,7 @@ void sched_ctx_hypervisor_move_workers(unsigned sender_sched_ctx, unsigned recei
 		}
 		else
 		{
-			int ret = pthread_mutex_trylock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
+			int ret = starpu_pthread_mutex_trylock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
 			if(ret != EBUSY)
 			{
 				hypervisor.sched_ctx_w[sender_sched_ctx].resize_ack.receiver_sched_ctx = receiver_sched_ctx;
@@ -555,7 +555,7 @@ void sched_ctx_hypervisor_move_workers(unsigned sender_sched_ctx, unsigned recei
 				hypervisor.resize[sender_sched_ctx] = 0;
 //				hypervisor.resize[receiver_sched_ctx] = 0;
 
-				pthread_mutex_unlock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
+				starpu_pthread_mutex_unlock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
 			}
 		}
 		struct sched_ctx_hypervisor_policy_config *new_config = sched_ctx_hypervisor_get_config(receiver_sched_ctx);
@@ -618,7 +618,7 @@ void sched_ctx_hypervisor_remove_workers_from_sched_ctx(int* workers_to_remove,
 				printf(" %d", workers_to_remove[j]);
 			printf("\n");
 
-			int ret = pthread_mutex_trylock(&hypervisor.sched_ctx_w[sched_ctx].mutex);
+			int ret = starpu_pthread_mutex_trylock(&hypervisor.sched_ctx_w[sched_ctx].mutex);
 			if(ret != EBUSY)
 			{
 
@@ -641,7 +641,7 @@ void sched_ctx_hypervisor_remove_workers_from_sched_ctx(int* workers_to_remove,
 				}
 
 				hypervisor.resize[sched_ctx] = 0;
-				pthread_mutex_unlock(&hypervisor.sched_ctx_w[sched_ctx].mutex);
+				starpu_pthread_mutex_unlock(&hypervisor.sched_ctx_w[sched_ctx].mutex);
 			}
 		}
  	}
@@ -662,7 +662,7 @@ static unsigned _ack_resize_completed(unsigned sched_ctx, int worker)
 		if(hypervisor.sched_ctxs[i] != STARPU_NMAX_SCHED_CTXS)
 		{
 			struct sched_ctx_hypervisor_wrapper *sc_w = &hypervisor.sched_ctx_w[hypervisor.sched_ctxs[i]];
-			pthread_mutex_lock(&sc_w->mutex);
+			starpu_pthread_mutex_lock(&sc_w->mutex);
 			unsigned only_remove = 0;
 			if(sc_w->resize_ack.receiver_sched_ctx == -1 && hypervisor.sched_ctxs[i] != (int)sched_ctx &&
 			   sc_w->resize_ack.nmoved_workers > 0 && starpu_sched_ctx_contains_worker(worker, hypervisor.sched_ctxs[i]))
@@ -680,10 +680,10 @@ static unsigned _ack_resize_completed(unsigned sched_ctx, int worker)
 			{
 				resize_ack = &sc_w->resize_ack;
 				sender_sched_ctx = hypervisor.sched_ctxs[i];
-				pthread_mutex_unlock(&sc_w->mutex);
+				starpu_pthread_mutex_unlock(&sc_w->mutex);
 				break;
 			}
-			pthread_mutex_unlock(&sc_w->mutex);
+			starpu_pthread_mutex_unlock(&sc_w->mutex);
 		}
 	}
 
@@ -691,7 +691,7 @@ static unsigned _ack_resize_completed(unsigned sched_ctx, int worker)
 	if(resize_ack == NULL)
 		return 1;
 
-	int ret = pthread_mutex_trylock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
+	int ret = starpu_pthread_mutex_trylock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
 	if(ret != EBUSY)
 	{
 		int *moved_workers = resize_ack->moved_workers;
@@ -746,10 +746,10 @@ static unsigned _ack_resize_completed(unsigned sched_ctx, int worker)
 				free(resize_ack->acked_workers);
 
 			}
-			pthread_mutex_unlock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
+			starpu_pthread_mutex_unlock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
 			return resize_completed;
 		}
-		pthread_mutex_unlock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
+		starpu_pthread_mutex_unlock(&hypervisor.sched_ctx_w[sender_sched_ctx].mutex);
 	}
 	return 0;
 }
@@ -766,9 +766,9 @@ void sched_ctx_hypervisor_resize(unsigned sched_ctx, int task_tag)
 	entry->sched_ctx = sched_ctx;
 	entry->task_tag = task_tag;
 
-	pthread_mutex_lock(&hypervisor.resize_mut[sched_ctx]);
+	starpu_pthread_mutex_lock(&hypervisor.resize_mut[sched_ctx]);
 	HASH_ADD_INT(hypervisor.resize_requests[sched_ctx], task_tag, entry);
-	pthread_mutex_unlock(&hypervisor.resize_mut[sched_ctx]);
+	starpu_pthread_mutex_unlock(&hypervisor.resize_mut[sched_ctx]);
 }
 
 /* notifies the hypervisor that the worker is no longer idle and a new task was pushed on its queue */
@@ -847,16 +847,16 @@ static void notify_post_exec_hook(unsigned sched_ctx, int task_tag)
 
 	unsigned conf_sched_ctx;
 	unsigned i;
-	pthread_mutex_lock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	unsigned ns = hypervisor.nsched_ctxs;
-	pthread_mutex_unlock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 
 	for(i = 0; i < ns; i++)
 	{
 		struct configuration_entry *entry;
 
 		conf_sched_ctx = hypervisor.sched_ctxs[i];
-		pthread_mutex_lock(&hypervisor.conf_mut[conf_sched_ctx]);
+		starpu_pthread_mutex_lock(&hypervisor.conf_mut[conf_sched_ctx]);
 
 		HASH_FIND_INT(hypervisor.configurations[conf_sched_ctx], &task_tag, entry);
 
@@ -868,12 +868,12 @@ static void notify_post_exec_hook(unsigned sched_ctx, int task_tag)
 			HASH_DEL(hypervisor.configurations[conf_sched_ctx], entry);
 			free(config);
 		}
-		pthread_mutex_unlock(&hypervisor.conf_mut[conf_sched_ctx]);
+		starpu_pthread_mutex_unlock(&hypervisor.conf_mut[conf_sched_ctx]);
 	}
 
 	if(hypervisor.resize[sched_ctx])
 	{
-		pthread_mutex_lock(&hypervisor.resize_mut[sched_ctx]);
+		starpu_pthread_mutex_lock(&hypervisor.resize_mut[sched_ctx]);
 
 		if(hypervisor.policy.handle_post_exec_hook)
 		{
@@ -889,16 +889,16 @@ static void notify_post_exec_hook(unsigned sched_ctx, int task_tag)
 			}
 
 		}
-		pthread_mutex_unlock(&hypervisor.resize_mut[sched_ctx]);
+		starpu_pthread_mutex_unlock(&hypervisor.resize_mut[sched_ctx]);
 	}
 	return;
 }
 
 static void notify_submitted_job(struct starpu_task *task, uint32_t footprint)
 {
-	pthread_mutex_lock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	hypervisor.sched_ctx_w[task->sched_ctx].submitted_flops += task->flops;
-	pthread_mutex_unlock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 
 	if(hypervisor.policy.handle_submitted_job)
 		hypervisor.policy.handle_submitted_job(task, footprint);
@@ -912,10 +912,10 @@ static void notify_delete_context(unsigned sched_ctx)
 
 void sched_ctx_hypervisor_size_ctxs(int *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
 {
-	pthread_mutex_lock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	unsigned curr_nsched_ctxs = sched_ctxs == NULL ? hypervisor.nsched_ctxs : nsched_ctxs;
 	int *curr_sched_ctxs = sched_ctxs == NULL ? hypervisor.sched_ctxs : sched_ctxs;
-	pthread_mutex_unlock(&act_hypervisor_mutex);
+	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	unsigned s;
 	for(s = 0; s < curr_nsched_ctxs; s++)
 		hypervisor.resize[curr_sched_ctxs[s]] = 1;

+ 2 - 2
sched_ctx_hypervisor/src/sched_ctx_hypervisor_intern.h

@@ -67,8 +67,8 @@ struct sched_ctx_hypervisor
 	/* Set of pending resize requests for any context/tag pair.  */
 	struct resize_request_entry *resize_requests[STARPU_NMAX_SCHED_CTXS];
 
-	pthread_mutex_t conf_mut[STARPU_NMAX_SCHED_CTXS];
-	pthread_mutex_t resize_mut[STARPU_NMAX_SCHED_CTXS];
+	starpu_pthread_mutex_t conf_mut[STARPU_NMAX_SCHED_CTXS];
+	starpu_pthread_mutex_t resize_mut[STARPU_NMAX_SCHED_CTXS];
 	struct size_request *sr;
 	int check_min_tasks[STARPU_NMAX_SCHED_CTXS];
 

+ 2 - 2
socl/src/debug.h

@@ -22,7 +22,7 @@
 #ifdef STARPU_VERBOSE
 #define DEBUG
 #include <stdio.h>
-  #define DEBUG_MSG(...) do { if (!getenv("STARPU_SILENT")) { fprintf(stderr, "[SOCL] [%s] ", __func__); fprintf(stderr, __VA_ARGS__);}} while (0);
+  #define DEBUG_MSG(...) do { if (!getenv("STARPU_SILENT")) { fprintf(stderr, "[SOCL] [%s] ", __starpu_func__); fprintf(stderr, __VA_ARGS__);}} while (0);
   #define DEBUG_MSG_NOHEAD(...) do { if (!getenv("STARPU_SILENT")) { fprintf(stderr, __VA_ARGS__);}} while (0);
   #define DEBUG_ERROR(...) do { if (!getenv("STARPU_SILENT")) { fprintf(stderr, "[SOCL] ERROR: "__VA_ARGS__); } exit(1); } while (0);
 #else
@@ -32,7 +32,7 @@
 #endif
 
 
-#define ERROR_MSG(...) do { fprintf(stderr, "[SOCL] [%s] ERROR: ", __func__); fprintf(stderr, __VA_ARGS__); } while (0);
+#define ERROR_MSG(...) do { fprintf(stderr, "[SOCL] [%s] ERROR: ", __starpu_func__); fprintf(stderr, __VA_ARGS__); } while (0);
 #define ERROR_MSG_NOHEAD(...) fprintf(stderr, __VA_ARGS__)
 #define ERROR_STOP(...) do { ERROR_MSG(__VA_ARGS__); exit(1); } while(0);
 

+ 2 - 2
socl/src/gc.h

@@ -27,7 +27,7 @@ void gc_entity_init(void *arg, void (*release_callback)(void*), char*name);
 void * gc_entity_alloc(unsigned int size, void (*release_callback)(void*), char * name);
 
 void gc_entity_retain_ex(void *arg, const char *);
-#define gc_entity_retain(arg) gc_entity_retain_ex(arg, __func__)
+#define gc_entity_retain(arg) gc_entity_retain_ex(arg, __starpu_func__)
 
 /** Decrement reference counter and release entity if applicable */
 int gc_entity_release_ex(entity e, const char*);
@@ -35,7 +35,7 @@ int gc_entity_release_ex(entity e, const char*);
 int gc_active_entity_count(void);
 void gc_print_remaining_entities(void);
 
-#define gc_entity_release(a) gc_entity_release_ex(&(a)->_entity, __func__)
+#define gc_entity_release(a) gc_entity_release_ex(&(a)->_entity, __starpu_func__)
 
 #define gc_entity_store(dest,e) \
   do {\

+ 2 - 0
src/Makefile.am

@@ -101,6 +101,7 @@ noinst_HEADERS = 						\
 	common/starpu_spinlock.h				\
 	common/fxt.h						\
 	common/utils.h						\
+	common/thread.h						\
 	common/barrier.h					\
 	common/uthash.h						\
 	common/barrier_counter.h				\
@@ -130,6 +131,7 @@ libstarpu_@STARPU_EFFECTIVE_VERSION@_la_SOURCES = 						\
 	common/timing.c						\
 	common/fxt.c						\
 	common/utils.c						\
+	common/thread.c						\
 	core/jobs.c						\
 	core/task.c						\
 	core/task_bundle.c					\

+ 2 - 1
src/common/barrier.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010,2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010,2011,2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -16,6 +16,7 @@
 
 #include <common/barrier.h>
 #include <common/utils.h>
+#include <common/thread.h>
 
 int _starpu_barrier_init(struct _starpu_barrier *barrier, int count)
 {

+ 5 - 6
src/common/barrier.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -22,17 +22,16 @@
 #undef PTHREAD_BARRIER_SERIAL_THREAD
 #endif
 
-#include <pthread.h>
-#include <common/utils.h>
+#include <starpu_thread.h>
 
 struct _starpu_barrier
 {
 	int count;
 	int reached_start;
 	int reached_exit;
-	_starpu_pthread_mutex_t mutex;
-	_starpu_pthread_mutex_t mutex_exit;
-	_starpu_pthread_cond_t cond;
+	starpu_pthread_mutex_t mutex;
+	starpu_pthread_mutex_t mutex_exit;
+	starpu_pthread_cond_t cond;
 };
 
 int _starpu_barrier_init(struct _starpu_barrier *barrier, int count);

+ 1 - 0
src/common/barrier_counter.c

@@ -15,6 +15,7 @@
  */
 
 #include <common/barrier_counter.h>
+#include <common/thread.h>
 
 int _starpu_barrier_counter_init(struct _starpu_barrier_counter *barrier_c, int count)
 {

+ 4 - 2
src/common/barrier_counter.h

@@ -13,12 +13,14 @@
  *
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
+
 #include <common/utils.h>
 #include <common/barrier.h>
 
-struct _starpu_barrier_counter {
+struct _starpu_barrier_counter
+{
 	struct _starpu_barrier barrier;
-	_starpu_pthread_cond_t cond2;
+	starpu_pthread_cond_t cond2;
 };
 
 int _starpu_barrier_counter_init(struct _starpu_barrier_counter *barrier_c, int count);

+ 0 - 0
src/common/starpu_spinlock.c


Деякі файли не було показано, через те що забагато файлів було змінено