Browse Source

import work from Brice & Damien to adapt tests to MIC and SCC

Samuel Thibault 12 years ago
parent
commit
c05e9e394f
95 changed files with 930 additions and 249 deletions
  1. 1 1
      tests/datawizard/acquire_cb.c
  2. 3 1
      tests/datawizard/acquire_cb_insert.c
  3. 2 1
      tests/datawizard/acquire_release.c
  4. 2 1
      tests/datawizard/acquire_release2.c
  5. 7 4
      tests/datawizard/copy.c
  6. 34 19
      tests/datawizard/data_implicit_deps.c
  7. 5 3
      tests/datawizard/data_invalidation.c
  8. 3 2
      tests/datawizard/data_lookup.c
  9. 3 2
      tests/datawizard/dining_philosophers.c
  10. 11 2
      tests/datawizard/double_parameter.c
  11. 11 2
      tests/datawizard/dsm_stress.c
  12. 1 1
      tests/datawizard/gpu_register.c
  13. 3 2
      tests/datawizard/handle_to_pointer.c
  14. 1 1
      tests/datawizard/in_place_partition.c
  15. 7 4
      tests/datawizard/increment_redux.c
  16. 7 4
      tests/datawizard/increment_redux_lazy.c
  17. 9 5
      tests/datawizard/increment_redux_v2.c
  18. 8 4
      tests/datawizard/interfaces/bcsr/bcsr_interface.c
  19. 8 4
      tests/datawizard/interfaces/block/block_interface.c
  20. 1 1
      tests/datawizard/interfaces/copy_interfaces.c
  21. 8 4
      tests/datawizard/interfaces/csr/csr_interface.c
  22. 8 4
      tests/datawizard/interfaces/matrix/matrix_interface.c
  23. 74 0
      tests/datawizard/interfaces/multiformat/advanced/generic.c
  24. 12 0
      tests/datawizard/interfaces/multiformat/advanced/generic.h
  25. 26 3
      tests/datawizard/interfaces/multiformat/advanced/multiformat_data_release.c
  26. 81 4
      tests/datawizard/interfaces/multiformat/advanced/multiformat_handle_conversion.c
  27. 36 5
      tests/datawizard/interfaces/multiformat/advanced/multiformat_worker.c
  28. 21 4
      tests/datawizard/interfaces/multiformat/advanced/same_handle.c
  29. 48 0
      tests/datawizard/interfaces/multiformat/multiformat_conversion_codelets.c
  30. 40 2
      tests/datawizard/interfaces/multiformat/multiformat_interface.c
  31. 132 3
      tests/datawizard/interfaces/test_interfaces.c
  32. 1 0
      tests/datawizard/interfaces/test_interfaces.h
  33. 9 5
      tests/datawizard/interfaces/variable/variable_interface.c
  34. 8 4
      tests/datawizard/interfaces/vector/test_vector_interface.c
  35. 7 3
      tests/datawizard/interfaces/void/void_interface.c
  36. 5 3
      tests/datawizard/lazy_allocation.c
  37. 1 1
      tests/datawizard/manual_reduction.c
  38. 4 2
      tests/datawizard/mpi_like.c
  39. 3 2
      tests/datawizard/mpi_like_async.c
  40. 2 1
      tests/datawizard/partition_lazy.c
  41. 4 2
      tests/datawizard/readers_and_writers.c
  42. 14 5
      tests/datawizard/reclaim.c
  43. 1 0
      tests/datawizard/scal.c
  44. 3 2
      tests/datawizard/scratch.c
  45. 3 1
      tests/datawizard/sync_and_notify_data.c
  46. 3 1
      tests/datawizard/sync_and_notify_data_implicit.c
  47. 3 2
      tests/datawizard/sync_with_data_with_mem.c
  48. 3 2
      tests/datawizard/sync_with_data_with_mem_non_blocking.c
  49. 3 2
      tests/datawizard/sync_with_data_with_mem_non_blocking_implicit.c
  50. 3 2
      tests/datawizard/unpartition.c
  51. 1 1
      tests/datawizard/user_interaction_implicit.c
  52. 5 3
      tests/datawizard/write_only_tmp_buffer.c
  53. 11 4
      tests/errorcheck/invalid_blocking_calls.c
  54. 5 1
      tests/errorcheck/starpu_init_noworker.c
  55. 1 1
      tests/helper/cublas_init.c
  56. 1 1
      tests/helper/execute_on_all.c
  57. 1 1
      tests/helper/pinned_memory.c
  58. 3 2
      tests/helper/starpu_create_sync_task.c
  59. 13 7
      tests/helper/starpu_data_cpy.c
  60. 3 2
      tests/main/declare_deps_after_submission.c
  61. 3 2
      tests/main/declare_deps_after_submission_synchronous.c
  62. 3 2
      tests/main/declare_deps_in_callback.c
  63. 15 6
      tests/main/deprecated_buffer.c
  64. 1 1
      tests/main/empty_task.c
  65. 1 1
      tests/main/empty_task_chain.c
  66. 3 2
      tests/main/empty_task_sync_point.c
  67. 3 2
      tests/main/empty_task_sync_point_tasks.c
  68. 5 2
      tests/main/execute_on_a_specific_worker.c
  69. 4 6
      tests/main/get_current_task.c
  70. 16 9
      tests/main/insert_task.c
  71. 3 2
      tests/main/multithreaded.c
  72. 7 1
      tests/main/multithreaded_init.c
  73. 3 2
      tests/main/regenerate.c
  74. 1 1
      tests/main/restart.c
  75. 9 5
      tests/main/starpu_task_bundle.c
  76. 3 2
      tests/main/starpu_task_wait.c
  77. 3 2
      tests/main/starpu_task_wait_for_all.c
  78. 4 3
      tests/main/starpu_worker_exists.c
  79. 3 2
      tests/main/static_restartable.c
  80. 3 2
      tests/main/static_restartable_tag.c
  81. 3 2
      tests/main/static_restartable_using_initializer.c
  82. 30 6
      tests/main/subgraph_repeat.c
  83. 29 6
      tests/main/subgraph_repeat_regenerate.c
  84. 3 2
      tests/main/tag_wait_api.c
  85. 3 2
      tests/main/task_wait_api.c
  86. 3 2
      tests/main/wait_all_regenerable_tasks.c
  87. 3 2
      tests/microbenchs/async_tasks_overhead.c
  88. 1 1
      tests/microbenchs/local_pingpong.c
  89. 5 2
      tests/microbenchs/prefetch_data_on_node.c
  90. 3 2
      tests/microbenchs/redundant_buffer.c
  91. 3 2
      tests/microbenchs/sync_tasks_overhead.c
  92. 4 3
      tests/microbenchs/tasks_overhead.c
  93. 3 2
      tests/overlap/overlap.c
  94. 3 2
      tests/perfmodels/non_linear_regression_based.c
  95. 4 2
      tests/perfmodels/regression_based.c

+ 1 - 1
tests/datawizard/acquire_cb.c

@@ -30,7 +30,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-        ret = starpu_init(NULL);
+        ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 1
tests/datawizard/acquire_cb_insert.c

@@ -35,6 +35,7 @@ void which_index_cpu(void *descr[], void *_args)
 struct starpu_codelet which_index =
 {
 	.cpu_funcs = {which_index_cpu, NULL},
+	.cpu_funcs_name = {"which_index_cpu", NULL},
         .nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -53,6 +54,7 @@ void work_cpu(void *descr[], void *_args)
 struct starpu_codelet work =
 {
 	.cpu_funcs = {work_cpu, NULL},
+	.cpu_funcs_name = {"work_cpu", NULL},
         .nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -71,7 +73,7 @@ int main(int argc, char **argv)
         int i, ret;
 	float *f;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 2 - 1
tests/datawizard/acquire_release.c

@@ -50,6 +50,7 @@ static struct starpu_codelet increment_cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {increment_opencl, NULL},
 #endif
+	.cpu_funcs_name = {"increment_cpu", NULL},
 	.nbuffers = 1
 };
 
@@ -80,7 +81,7 @@ int main(int argc, char **argv)
 	unsigned i;
 	int ret;
 
-        ret = starpu_init(NULL);
+        ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 2 - 1
tests/datawizard/acquire_release2.c

@@ -50,6 +50,7 @@ static struct starpu_codelet increment_cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {increment_opencl, NULL},
 #endif
+	.cpu_funcs_name = {"increment_cpu", NULL},
 	.nbuffers = 1
 };
 
@@ -82,7 +83,7 @@ int main(int argc, char **argv)
 	unsigned i;
 	int ret;
 
-        ret = starpu_init(NULL);
+        ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 7 - 4
tests/datawizard/copy.c

@@ -24,13 +24,14 @@ static unsigned nloops = 10;
 static unsigned nloops = 1000;
 #endif
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
 static struct starpu_codelet cpu_codelet =
 {
         .cpu_funcs = {dummy_func, NULL},
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 1,
 	.modes = {STARPU_RW}
@@ -40,6 +41,7 @@ static struct starpu_codelet gpu_codelet =
 {
         .cuda_funcs = {dummy_func, NULL},
         .opencl_funcs = {dummy_func, NULL},
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 1,
 	.modes = {STARPU_RW}
@@ -53,13 +55,14 @@ int main(int argc, char **argv)
         unsigned i;
 	int ret;
 
-        ret = starpu_init(NULL);
+        ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
-	if (starpu_worker_get_count_by_type(STARPU_CUDA_WORKER) == 0 && starpu_worker_get_count_by_type(STARPU_OPENCL_WORKER) == 0)
+	if (starpu_worker_get_count_by_type(STARPU_CUDA_WORKER) == 0 && starpu_worker_get_count_by_type(STARPU_OPENCL_WORKER) == 0 &&
+		starpu_worker_get_count_by_type(STARPU_MIC_WORKER) == 0)
 	{
-		FPRINTF(stderr, "This application requires a CUDA or OpenCL Worker\n");
+		FPRINTF(stderr, "This application requires a CUDA , OpenCL or MIC Worker\n");
 		starpu_shutdown();
 		return STARPU_TEST_SKIPPED;
 	}

+ 34 - 19
tests/datawizard/data_implicit_deps.c

@@ -29,8 +29,9 @@ static unsigned *A, *B, *C, *D;
 starpu_data_handle_t A_handle, B_handle, C_handle, D_handle;
 
 static unsigned var = 0;
+starpu_data_handle_t var_handle;
 
-static void f(void *descr[], __attribute__ ((unused)) void *_args)
+void f(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -39,52 +40,59 @@ static void f(void *descr[], __attribute__ ((unused)) void *_args)
 
 static struct starpu_codelet cl_f =
 {
-	.modes = { STARPU_R, STARPU_RW },
+	.modes = { STARPU_RW, STARPU_R, STARPU_RW },
 	.cpu_funcs = {f, NULL},
 	.cuda_funcs = {f, NULL},
 	.opencl_funcs = {f, NULL},
-	.nbuffers = 2
+	.cpu_funcs_name = {"f", NULL},
+	.nbuffers = 3,
 };
 
-static void g(void *descr[], __attribute__ ((unused)) void *_args)
+void g(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
+	unsigned *val = (unsigned *) STARPU_VARIABLE_GET_PTR(descr[0]);
+
 	usleep(100000);
-	var = 42;
+	*val = 42;
 }
 
 static struct starpu_codelet cl_g =
 {
-	.modes = { STARPU_R, STARPU_RW },
+	.modes = { STARPU_RW, STARPU_R, STARPU_RW },
 	.cpu_funcs = {g, NULL},
 	.cuda_funcs = {g, NULL},
 	.opencl_funcs = {g, NULL},
-	.nbuffers = 2
+	.cpu_funcs_name = {"g", NULL},
+	.nbuffers = 3,
 };
 
-static void h(void *descr[], __attribute__ ((unused)) void *_args)
+void h(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
-	FPRINTF(stderr, "VAR %u (should be 42)\n", var);
-	STARPU_ASSERT(var == 42);
+	unsigned *val = (unsigned *) STARPU_VARIABLE_GET_PTR(descr[0]);
+
+	FPRINTF(stderr, "VAR %u (should be 42)\n", *val);
+	STARPU_ASSERT(*val == 42);
 }
 
 static struct starpu_codelet cl_h =
 {
-	.modes = { STARPU_R, STARPU_RW },
+	.modes = { STARPU_RW, STARPU_R, STARPU_RW },
 	.cpu_funcs = {h, NULL},
 	.cuda_funcs = {h, NULL},
 	.opencl_funcs = {h, NULL},
-	.nbuffers = 2
+	.cpu_funcs_name = {"h", NULL},
+	.nbuffers = 3
 };
 
 int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
@@ -98,6 +106,8 @@ int main(int argc, char **argv)
 	starpu_vector_data_register(&C_handle, 0, (uintptr_t)C, VECTORSIZE, sizeof(unsigned));
 	starpu_vector_data_register(&D_handle, 0, (uintptr_t)D, VECTORSIZE, sizeof(unsigned));
 
+	starpu_variable_data_register(&var_handle, 0, (uintptr_t)(&var), sizeof(var));
+
 #if 0
 	starpu_data_set_sequential_consistency_flag(A_handle, 0);
 	starpu_data_set_sequential_consistency_flag(B_handle, 0);
@@ -111,24 +121,27 @@ int main(int argc, char **argv)
 	 */
 	struct starpu_task *task_f = starpu_task_create();
 	task_f->cl = &cl_f;
-	task_f->handles[0] = A_handle;
-	task_f->handles[1] = B_handle;
+	task_f->handles[0] = var_handle;
+	task_f->handles[1] = A_handle;
+	task_f->handles[2] = B_handle;
 	ret = starpu_task_submit(task_f);
 	if (ret == -ENODEV) goto enodev;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 	struct starpu_task *task_g = starpu_task_create();
 	task_g->cl = &cl_g;
-	task_g->handles[0] = B_handle;
-	task_g->handles[1] = C_handle;
+	task_g->handles[0] = var_handle;
+	task_g->handles[1] = B_handle;
+	task_g->handles[2] = C_handle;
 	ret = starpu_task_submit(task_g);
 	if (ret == -ENODEV) goto enodev;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 	struct starpu_task *task_h = starpu_task_create();
 	task_h->cl = &cl_h;
-	task_h->handles[0] = C_handle;
-	task_h->handles[1] = D_handle;
+	task_h->handles[0] = var_handle;
+	task_h->handles[1] = C_handle;
+	task_h->handles[2] = D_handle;
 	ret = starpu_task_submit(task_h);
 	if (ret == -ENODEV) goto enodev;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
@@ -141,6 +154,8 @@ int main(int argc, char **argv)
 	starpu_data_unregister(C_handle);
 	starpu_data_unregister(D_handle);
 
+	starpu_data_unregister(var_handle);
+
 	free(A);
 	free(B);
 	free(C);

+ 5 - 3
tests/datawizard/data_invalidation.c

@@ -78,7 +78,7 @@ static void opencl_memset_codelet(void *buffers[], void *args)
 }
 #endif /* !STARPU_USE_OPENCL */
 
-static void cpu_memset_codelet(void *descr[], __attribute__ ((unused)) void *_args)
+void cpu_memset_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -97,6 +97,7 @@ static struct starpu_codelet memset_cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {opencl_memset_codelet, NULL},
 #endif
+	.cpu_funcs_name = {"cpu_memset_codelet", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -105,7 +106,7 @@ static struct starpu_codelet memset_cl =
  *	Check content
  */
 
-static void cpu_check_content_codelet(void *descr[], __attribute__ ((unused)) void *_args)
+void cpu_check_content_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -126,6 +127,7 @@ static void cpu_check_content_codelet(void *descr[], __attribute__ ((unused)) vo
 static struct starpu_codelet check_content_cl =
 {
 	.cpu_funcs = {cpu_check_content_codelet, NULL},
+	.cpu_funcs_name = {"cpu_check_content_codelet", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_R}
 };
@@ -135,7 +137,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/datawizard/data_lookup.c

@@ -22,7 +22,7 @@
 #include <sys/types.h>
 #include "../helper.h"
 
-static void task(void **buffers, void *args)
+void task(void **buffers, void *args)
 {
 	float *numbers;
 	size_t size, i;
@@ -38,6 +38,7 @@ static void task(void **buffers, void *args)
 static struct starpu_codelet cl =
 {
 	.cpu_funcs = {task, NULL},
+	.cpu_funcs_name = {"task", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -152,7 +153,7 @@ int main(int argc, char *argv[])
 	starpu_data_handle_t vector_handles[VECTOR_COUNT];
 	starpu_data_handle_t variable_handles[VARIABLE_COUNT];
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/datawizard/dining_philosophers.c

@@ -24,7 +24,7 @@
 starpu_data_handle_t fork_handles[N];
 unsigned forks[N];
 
-static void eat_kernel(void *descr[], void *arg)
+void eat_kernel(void *descr[], void *arg)
 {
 }
 
@@ -34,6 +34,7 @@ static struct starpu_codelet eating_cl =
 	.cuda_funcs = {eat_kernel, NULL},
 	.cpu_funcs = {eat_kernel, NULL},
         .opencl_funcs = {eat_kernel, NULL},
+	.cpu_funcs_name = {"eat_kernel", NULL},
 	.nbuffers = 2
 };
 
@@ -57,7 +58,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 11 - 2
tests/datawizard/double_parameter.c

@@ -18,13 +18,14 @@
 #include <starpu.h>
 #include "../helper.h"
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
 static struct starpu_codelet codelet_R_R =
 {
         .cpu_funcs = { dummy_func, NULL },
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 2,
 	.modes = {STARPU_R, STARPU_R}
@@ -33,6 +34,7 @@ static struct starpu_codelet codelet_R_R =
 static struct starpu_codelet codelet_R_W =
 {
         .cpu_funcs = { dummy_func, NULL },
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 2,
 	.modes = {STARPU_R, STARPU_W}
@@ -41,6 +43,7 @@ static struct starpu_codelet codelet_R_W =
 static struct starpu_codelet codelet_R_RW =
 {
         .cpu_funcs = { dummy_func, NULL },
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 2,
 	.modes = {STARPU_R, STARPU_RW}
@@ -49,6 +52,7 @@ static struct starpu_codelet codelet_R_RW =
 static struct starpu_codelet codelet_W_R =
 {
         .cpu_funcs = { dummy_func, NULL },
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 2,
 	.modes = {STARPU_W, STARPU_R}
@@ -57,6 +61,7 @@ static struct starpu_codelet codelet_W_R =
 static struct starpu_codelet codelet_W_W =
 {
         .cpu_funcs = { dummy_func, NULL },
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 2,
 	.modes = {STARPU_W, STARPU_W}
@@ -65,6 +70,7 @@ static struct starpu_codelet codelet_W_W =
 static struct starpu_codelet codelet_W_RW =
 {
         .cpu_funcs = { dummy_func, NULL },
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 2,
 	.modes = {STARPU_W, STARPU_RW}
@@ -73,6 +79,7 @@ static struct starpu_codelet codelet_W_RW =
 static struct starpu_codelet codelet_RW_R =
 {
         .cpu_funcs = { dummy_func, NULL },
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 2,
 	.modes = {STARPU_RW, STARPU_R}
@@ -81,6 +88,7 @@ static struct starpu_codelet codelet_RW_R =
 static struct starpu_codelet codelet_RW_W =
 {
         .cpu_funcs = { dummy_func, NULL },
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 2,
 	.modes = {STARPU_RW, STARPU_W}
@@ -89,6 +97,7 @@ static struct starpu_codelet codelet_RW_W =
 static struct starpu_codelet codelet_RW_RW =
 {
         .cpu_funcs = { dummy_func, NULL },
+		.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
         .nbuffers = 2,
 	.modes = {STARPU_RW, STARPU_RW}
@@ -101,7 +110,7 @@ int main(int argc, char **argv)
 	int ret;
 	struct starpu_task *task;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 11 - 2
tests/datawizard/dsm_stress.c

@@ -65,7 +65,7 @@ static void opencl_codelet_null(void *descr[], __attribute__ ((unused)) void *_a
 {
 }
 
-static void cpu_codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
+void cpu_codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
 {
 }
 
@@ -90,6 +90,7 @@ static struct starpu_codelet cl_r_r =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
         .opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_R, STARPU_R}
 };
@@ -99,6 +100,7 @@ static struct starpu_codelet cl_r_w =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
         .opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_R, STARPU_W}
 };
@@ -108,6 +110,7 @@ static struct starpu_codelet cl_r_rw =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
         .opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_R, STARPU_RW}
 };
@@ -117,6 +120,7 @@ static struct starpu_codelet cl_w_r =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
         .opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_W, STARPU_R}
 };
@@ -126,6 +130,7 @@ static struct starpu_codelet cl_w_w =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
         .opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_W, STARPU_W}
 };
@@ -135,6 +140,7 @@ static struct starpu_codelet cl_w_rw =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
         .opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_W, STARPU_RW}
 };
@@ -144,6 +150,7 @@ static struct starpu_codelet cl_rw_r =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
         .opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_RW, STARPU_R}
 };
@@ -153,6 +160,7 @@ static struct starpu_codelet cl_rw_w =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
         .opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_RW, STARPU_W}
 };
@@ -162,6 +170,7 @@ static struct starpu_codelet cl_rw_rw =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
         .opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_RW, STARPU_RW}
 };
@@ -171,7 +180,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 1 - 1
tests/datawizard/gpu_register.c

@@ -258,7 +258,7 @@ int main(int argc, char **argv)
 {
 	int skipped_cuda = 1, skipped_opencl = 1;
 	int ret;
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV)
 		return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");

+ 3 - 2
tests/datawizard/handle_to_pointer.c

@@ -21,7 +21,7 @@
 #include <stdlib.h>
 #include "../helper.h"
 
-static void cpu_task(void **buffers, void *args)
+void cpu_task(void **buffers, void *args)
 {
 	int *numbers;
 	int i;
@@ -91,6 +91,7 @@ static struct starpu_codelet cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {opencl_task, NULL},
 #endif
+	.cpu_funcs_name = {"cpu_task", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -103,7 +104,7 @@ int main(int argc, char *argv[])
 	starpu_data_handle_t handle;
 	static const int count = 123;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 
 	err = starpu_malloc((void **)&pointer, count * sizeof(int));

+ 1 - 1
tests/datawizard/in_place_partition.c

@@ -25,7 +25,7 @@ int main(int argc, char **argv)
 	int ret;
 	unsigned n, i, size;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 7 - 4
tests/datawizard/increment_redux.c

@@ -100,7 +100,7 @@ static void neutral_opencl_kernel(void *descr[], void *arg)
 
 
 
-static void redux_cpu_kernel(void *descr[], void *arg)
+void redux_cpu_kernel(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -109,7 +109,7 @@ static void redux_cpu_kernel(void *descr[], void *arg)
 	*dst = *dst + *src;
 }
 
-static void neutral_cpu_kernel(void *descr[], void *arg)
+void neutral_cpu_kernel(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -126,6 +126,7 @@ static struct starpu_codelet redux_cl =
 	.opencl_funcs = {redux_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {redux_cpu_kernel, NULL},
+	.cpu_funcs_name = {"redux_cpu_kernel", NULL},
 	.modes = {STARPU_RW, STARPU_R},
 	.nbuffers = 2
 };
@@ -139,6 +140,7 @@ static struct starpu_codelet neutral_cl =
 	.opencl_funcs = {neutral_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {neutral_cpu_kernel, NULL},
+	.cpu_funcs_name = {"neutral_cpu_kernel", NULL},
 	.modes = {STARPU_W},
 	.nbuffers = 1
 };
@@ -186,7 +188,7 @@ static void increment_cuda_kernel(void *descr[], void *arg)
 }
 #endif
 
-static void increment_cpu_kernel(void *descr[], void *arg)
+void increment_cpu_kernel(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -203,6 +205,7 @@ static struct starpu_codelet increment_cl =
 	.opencl_funcs = {increment_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {increment_cpu_kernel, NULL},
+	.cpu_funcs_name = {"increment_cpu_kernel", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_REDUX}
 };
@@ -211,7 +214,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 7 - 4
tests/datawizard/increment_redux_lazy.c

@@ -90,14 +90,14 @@ static void neutral_opencl_kernel(void *descr[], void *arg)
 
 
 
-static void redux_cpu_kernel(void *descr[], void *arg)
+void redux_cpu_kernel(void *descr[], void *arg)
 {
 	unsigned *dst = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[0]);
 	unsigned *src = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[1]);
 	*dst = *dst + *src;
 }
 
-static void neutral_cpu_kernel(void *descr[], void *arg)
+void neutral_cpu_kernel(void *descr[], void *arg)
 {
 	unsigned *dst = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[0]);
 	*dst = 0;
@@ -112,6 +112,7 @@ static struct starpu_codelet redux_cl =
 	.opencl_funcs = {redux_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {redux_cpu_kernel, NULL},
+	.cpu_funcs_name = {"redux_cpu_kernel", NULL},
 	.modes = {STARPU_RW, STARPU_R},
 	.nbuffers = 2
 };
@@ -125,6 +126,7 @@ static struct starpu_codelet neutral_cl =
 	.opencl_funcs = {neutral_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {neutral_cpu_kernel, NULL},
+	.cpu_funcs_name = {"neutral_cpu_kernel", NULL},
 	.modes = {STARPU_W},
 	.nbuffers = 1
 };
@@ -168,7 +170,7 @@ static void increment_cuda_kernel(void *descr[], void *arg)
 }
 #endif
 
-static void increment_cpu_kernel(void *descr[], void *arg)
+void increment_cpu_kernel(void *descr[], void *arg)
 {
 	unsigned *tokenptr = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[0]);
 	*tokenptr = *tokenptr + 1;
@@ -183,6 +185,7 @@ static struct starpu_codelet increment_cl =
 	.opencl_funcs = {increment_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {increment_cpu_kernel, NULL},
+	.cpu_funcs_name = {"increment_cpu_kernel", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_REDUX}
 };
@@ -192,7 +195,7 @@ int main(int argc, char **argv)
 	int ret;
 	unsigned *var;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 9 - 5
tests/datawizard/increment_redux_v2.c

@@ -99,7 +99,7 @@ static void neutral_opencl_kernel(void *descr[], void *arg)
 
 
 
-static void redux_cpu_kernel(void *descr[], void *arg)
+void redux_cpu_kernel(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -108,7 +108,7 @@ static void redux_cpu_kernel(void *descr[], void *arg)
 	*dst = *dst + *src;
 }
 
-static void neutral_cpu_kernel(void *descr[], void *arg)
+void neutral_cpu_kernel(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -125,6 +125,7 @@ static struct starpu_codelet redux_cl =
 	.opencl_funcs = {redux_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {redux_cpu_kernel, NULL},
+	.cpu_funcs_name = {"redux_cpu_kernel", NULL},
 	.modes = {STARPU_RW, STARPU_R},
 	.nbuffers = 2
 };
@@ -138,6 +139,7 @@ static struct starpu_codelet neutral_cl =
 	.opencl_funcs = {neutral_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {neutral_cpu_kernel, NULL},
+	.cpu_funcs_name = {"neutral_cpu_kernel", NULL},
 	.modes = {STARPU_W},
 	.nbuffers = 1
 };
@@ -185,7 +187,7 @@ static void increment_cuda_kernel(void *descr[], void *arg)
 }
 #endif
 
-static void increment_cpu_kernel(void *descr[], void *arg)
+void increment_cpu_kernel(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -202,11 +204,12 @@ static struct starpu_codelet increment_cl =
 	.opencl_funcs = {increment_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {increment_cpu_kernel, NULL},
+	.cpu_funcs_name = {"increment_cpu_kernel", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_RW}
 };
 
-static struct starpu_codelet increment_cl_redux =
+struct starpu_codelet increment_cl_redux =
 {
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = {increment_cuda_kernel, NULL},
@@ -215,6 +218,7 @@ static struct starpu_codelet increment_cl_redux =
 	.opencl_funcs = {increment_opencl_kernel, NULL},
 #endif
 	.cpu_funcs = {increment_cpu_kernel, NULL},
+	.cpu_funcs_name = {"increment_cpu_kernel", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_REDUX}
 };
@@ -223,7 +227,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 8 - 4
tests/datawizard/interfaces/bcsr/bcsr_interface.c

@@ -43,7 +43,7 @@
 #define NZVAL_SIZE     (R*C*NNZ_BLOCKS)
 
 #ifdef STARPU_USE_CPU
-static void test_bcsr_cpu_func(void *buffers[], void *args);
+void test_bcsr_cpu_func(void *buffers[], void *args);
 #endif /* !STARPU_USE_CPU */
 #ifdef STARPU_USE_CUDA
 extern void test_bcsr_cuda_func(void *buffers[], void *_args);
@@ -81,6 +81,9 @@ struct test_config bcsr_config =
 #ifdef STARPU_USE_OPENCL
 	.opencl_func   = test_bcsr_opencl_func,
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	.cpu_func_name = "test_bcsr_cpu_func",
+#endif
 	.handle        = &bcsr_handle,
 	.dummy_handle  = &bcsr2_handle,
 	.copy_failed   = SUCCESS,
@@ -122,7 +125,7 @@ unregister_data(void)
 	starpu_data_unregister(bcsr2_handle);
 }
 
-static void
+void
 test_bcsr_cpu_func(void *buffers[], void *args)
 {
 	STARPU_SKIP_IF_VALGRIND;
@@ -171,7 +174,7 @@ test_bcsr_cpu_func(void *buffers[], void *args)
 }
 
 int
-main(void)
+main(int argc, char **argv)
 {
 	data_interface_test_summary *summary;
 	struct starpu_conf conf;
@@ -179,8 +182,9 @@ main(void)
 
 	conf.ncuda = 2;
 	conf.nopencl = 1;
+	conf.nmic = -1;
 
-	if (starpu_init(&conf) == -ENODEV || starpu_cpu_worker_get_count() == 0)
+	if (starpu_initialize(&conf, &argc, &argv) == -ENODEV || starpu_cpu_worker_get_count() == 0)
 		return STARPU_TEST_SKIPPED;
 
 	register_data();

+ 8 - 4
tests/datawizard/interfaces/block/block_interface.c

@@ -25,7 +25,7 @@
 /* Prototypes */
 static void register_data(void);
 static void unregister_data(void);
-static void test_block_cpu_func(void *buffers[], void *args);
+void test_block_cpu_func(void *buffers[], void *args);
 #ifdef STARPU_USE_CUDA
 extern void test_block_cuda_func(void *buffers[], void *_args);
 #endif
@@ -46,6 +46,9 @@ struct test_config block_config =
 #ifdef STARPU_USE_OPENCL
 	.opencl_func   = test_block_opencl_func,
 #endif
+#ifdef STARPU_USE_MIC
+	.cpu_func_name = "test_block_cpu_func",
+#endif
 	.handle        = &_block_handle,
 	.dummy_handle  = &_block2_handle,
 	.copy_failed   = SUCCESS,
@@ -94,7 +97,7 @@ unregister_data(void)
 	starpu_data_unregister(_block2_handle);
 }
 
-static void test_block_cpu_func(void *buffers[], void *args)
+void test_block_cpu_func(void *buffers[], void *args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -130,15 +133,16 @@ static void test_block_cpu_func(void *buffers[], void *args)
 }
 
 int
-main(void)
+main(int argc, char **argv)
 {
 	data_interface_test_summary *summary;
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
 	conf.ncuda = 2;
 	conf.nopencl = 1;
+	conf.nmic = -1;
 
-	if (starpu_init(&conf) == -ENODEV || starpu_cpu_worker_get_count() == 0)
+	if (starpu_initialize(&conf, &argc, &argv || starpu_cpu_worker_get_count() == 0) == -ENODEV)
 		goto enodev;
 
 	register_data();

+ 1 - 1
tests/datawizard/interfaces/copy_interfaces.c

@@ -51,7 +51,7 @@ int main(int argc, char **argv)
 	int ret;
 	starpu_data_handle_t handle;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 8 - 4
tests/datawizard/interfaces/csr/csr_interface.c

@@ -24,7 +24,7 @@
 #define NNZ    (SIZE-1)
 
 #ifdef STARPU_USE_CPU
-static void test_csr_cpu_func(void *buffers[], void *args);
+void test_csr_cpu_func(void *buffers[], void *args);
 #endif /* !STARPU_USE_CPU */
 #ifdef STARPU_USE_CUDA
 extern void test_csr_cuda_func(void *buffers[], void *_args);
@@ -57,6 +57,9 @@ struct test_config csr_config =
 #ifdef STARPU_USE_OPENCL
 	.opencl_func   = test_csr_opencl_func,
 #endif
+#ifdef STARPU_USE_MIC
+	.cpu_func_name = "test_csr_cpu_func", 
+#endif
 	.handle        = &csr_handle,
 	.dummy_handle  = &csr2_handle,
 	.copy_failed   = SUCCESS,
@@ -113,7 +116,7 @@ unregister_data(void)
 	starpu_data_unregister(csr2_handle);
 }
 
-static void
+void
 test_csr_cpu_func(void *buffers[], void *args)
 {
 	STARPU_SKIP_IF_VALGRIND;
@@ -138,7 +141,7 @@ test_csr_cpu_func(void *buffers[], void *args)
 }
 
 int
-main(void)
+main(int argc, char **argv)
 {
 	data_interface_test_summary *summary;
 	struct starpu_conf conf;
@@ -146,8 +149,9 @@ main(void)
 
 	conf.ncuda = 2;
 	conf.nopencl = 1;
+	conf.nmic = -1;
 
-	if (starpu_init(&conf) == -ENODEV || starpu_cpu_worker_get_count() == 0)
+	if (starpu_initialize(&conf, &argc, &argv) == -ENODEV || starpu_cpu_worker_get_count() == 0)
 		goto enodev;
 
 	register_data();

+ 8 - 4
tests/datawizard/interfaces/matrix/matrix_interface.c

@@ -22,7 +22,7 @@
 #define HEIGHT 16
 
 #ifdef STARPU_USE_CPU
-static void test_matrix_cpu_func(void *buffers[], void *args);
+void test_matrix_cpu_func(void *buffers[], void *args);
 #endif /* !STARPU_USE_CPU */
 #ifdef STARPU_USE_CUDA
 extern void test_matrix_cuda_func(void *buffers[], void *_args);
@@ -46,6 +46,9 @@ struct test_config matrix_config =
 #ifdef STARPU_USE_OPENCL
 	.opencl_func   = test_matrix_opencl_func,
 #endif
+#ifdef STARPU_USE_MIC
+	.cpu_func_name = "test_matrix_cpu_func", 
+#endif
 	.handle        = &matrix_handle,
 	.dummy_handle  = &matrix2_handle,
 	.copy_failed   = SUCCESS,
@@ -86,7 +89,7 @@ unregister_data(void)
 	starpu_data_unregister(matrix2_handle);
 }
 
-static void
+void
 test_matrix_cpu_func(void *buffers[], void *args)
 {
 	STARPU_SKIP_IF_VALGRIND;
@@ -113,15 +116,16 @@ test_matrix_cpu_func(void *buffers[], void *args)
 }
 
 int
-main(void)
+main(int argc, char **argv)
 {
 	data_interface_test_summary *summary;
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
 	conf.ncuda = 2;
 	conf.nopencl = 1;
+	conf.nmic = -1;
 
-	if (starpu_init(&conf) == -ENODEV || starpu_cpu_worker_get_count() == 0)
+	if (starpu_initialize(&conf, &argc, &argv) == -ENODEV || starpu_cpu_worker_get_count() == 0)
 		goto enodev;
 
 	register_data();

+ 74 - 0
tests/datawizard/interfaces/multiformat/advanced/generic.c

@@ -100,6 +100,57 @@ struct starpu_codelet opencl_to_cpu_cl =
 };
 #endif /* !STARPU_USE_OPENCL */
 
+#ifdef STARPU_USE_MIC
+void mic_dummy_kernel(void *buffers[], void *cl_arg)
+{
+}
+
+starpu_mic_kernel_t mic_get_kernel()
+{
+	static starpu_mic_func_symbol_t mic_symbol = NULL;
+	if (mic_symbol == NULL)
+		starpu_mic_register_kernel(&mic_symbol, "mic_dummy_kernel");
+
+	return starpu_mic_get_kernel(mic_symbol);
+}
+
+starpu_mic_kernel_t mic_func()
+{
+	STARPU_SKIP_IF_VALGRIND;
+
+	global_stats.mic++;
+
+	return mic_get_kernel();
+}
+
+starpu_mic_kernel_t cpu_to_mic_func()
+{
+	STARPU_SKIP_IF_VALGRIND;
+
+	global_stats.cpu_to_mic++;
+
+	return mic_get_kernel();
+}
+
+void mic_to_cpu_func(void *buffers[], void *args)
+{
+	STARPU_SKIP_IF_VALGRIND;
+
+	global_stats.mic_to_cpu++;
+}
+
+struct starpu_codelet cpu_to_mic_cl =
+{
+	.mic_funcs = {cpu_to_mic_func, NULL},
+	.nbuffers = 1
+};
+
+struct starpu_codelet mic_to_cpu_cl =
+{
+	.cpu_funcs = {mic_to_cpu_func, NULL},
+	.nbuffers = 1
+};
+#endif // STARPU_USE_MIC
 
 struct starpu_multiformat_data_interface_ops ops =
 {
@@ -113,6 +164,11 @@ struct starpu_multiformat_data_interface_ops ops =
 	.cpu_to_opencl_cl = &cpu_to_opencl_cl,
 	.opencl_to_cpu_cl = &opencl_to_cpu_cl,
 #endif
+#ifdef STARPU_USE_MIC
+	.mic_elemsize = sizeof(int),
+	.cpu_to_mic_cl = &cpu_to_mic_cl,
+	.mic_to_cpu_cl = &mic_to_cpu_cl,
+#endif
 	.cpu_elemsize = sizeof(int)
 };
 
@@ -138,6 +194,14 @@ print_stats(struct stats *s)
 			s->cpu_to_opencl,
 			s->opencl_to_cpu);
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	FPRINTF(stderr, "mic	: %d\n"
+			"cpu->mic : %d\n"
+			"mic->cpu : %d\n",
+			s->mic,
+			s->cpu_to_mic,
+			s->mic_to_cpu);
+#endif
 }
 
 void reset_stats(struct stats *s)
@@ -155,6 +219,11 @@ void reset_stats(struct stats *s)
 	s->cpu_to_opencl = 0;
 	s->opencl_to_cpu = 0;
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	s->mic = 0;
+	s->cpu_to_mic = 0;
+	s->mic_to_cpu = 0;
+#endif
 }
 
 int
@@ -174,6 +243,11 @@ compare_stats(struct stats *s1, struct stats *s2)
 	    s1->cpu_to_opencl == s2->cpu_to_opencl &&
 	    s1->opencl_to_cpu == s2->opencl_to_cpu &&
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+		s1->mic == s2->mic &&
+		s1->cpu_to_mic == s2->cpu_to_mic &&
+		s1->mic_to_cpu == s2->mic_to_cpu &&
+#endif
 	    1 /* Just so the build does not fail if we disable EVERYTHING */
 	)
 		return 0;

+ 12 - 0
tests/datawizard/interfaces/multiformat/advanced/generic.h

@@ -16,6 +16,8 @@
 #ifndef MULTIFORMAT_GENERIC_H
 #define MULTIFORMAT_GENERIC_H
 
+#include <starpu_mic.h>
+
 #define NX 16
 
 #ifdef STARPU_USE_CPU
@@ -29,6 +31,11 @@ void cuda_func(void *buffers[], void *args);
 #ifdef STARPU_USE_OPENCL
 void opencl_func(void *buffers[], void *args);
 #endif /* !STARPU_USE_OPENCL */
+
+#ifdef STARPU_USE_MIC
+starpu_mic_kernel_t mic_func();
+#endif
+
 extern struct starpu_multiformat_data_interface_ops ops;
 /* Counting the calls to the codelets */
 struct stats
@@ -46,6 +53,11 @@ struct stats
 	unsigned int cpu_to_opencl;
 	unsigned int opencl_to_cpu;
 #endif
+#ifdef STARPU_USE_MIC
+	unsigned int mic;
+	unsigned int cpu_to_mic;
+	unsigned int mic_to_cpu;
+#endif
 };
 
 void print_stats(struct stats *);

+ 26 - 3
tests/datawizard/interfaces/multiformat/advanced/multiformat_data_release.c

@@ -43,7 +43,7 @@ unregister_handle(void)
 	starpu_data_unregister(handle);
 }
 
-#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
+#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL) || defined(STARPU_USE_MIC)
 static void
 create_and_submit(int where)
 {
@@ -56,6 +56,9 @@ create_and_submit(int where)
 #ifdef STARPU_USE_OPENCL
 		.opencl_funcs = {opencl_func, NULL},
 #endif
+#ifdef STARPU_USE_MIC
+		.mic_funcs = {mic_func, NULL},
+#endif
 		.nbuffers    = 1
 	};
 	cl.where = where;
@@ -115,11 +118,30 @@ test(void)
 	}
 #endif /* !STARPU_USE_OPENCL */
 
+#ifdef STARPU_USE_MIC
+	create_and_submit(STARPU_MIC);
+	starpu_data_acquire(handle, STARPU_RW);
+
+	expected_stats.mic = 1;
+	expected_stats.cpu_to_mic = 1;
+	expected_stats.mic_to_cpu = 1;
+
+	starpu_data_release(handle);
+	if (compare_stats(&global_stats, &expected_stats) != 0)
+	{
+		FPRINTF(stderr, "MIC failed\n");
+		print_stats(&global_stats);
+		FPRINTF(stderr ,"\n");
+		print_stats(&expected_stats);
+		return -ENODEV;
+	}
+#endif /* !STARPU_USE_CUDA */
+
 	return 0;
 }
 
 int
-main(void)
+main(int argc, char **argv)
 {
 #ifdef STARPU_USE_CPU
 	int ret;
@@ -128,8 +150,9 @@ main(void)
 
 	conf.ncuda = 1;
 	conf.nopencl = 1;
+	conf.nmic = 1;
 	memset(&global_stats, 0, sizeof(global_stats));
-	ret = starpu_init(&conf);
+	ret = starpu_initialize(&conf, &argc, &argv);
 	if (ret == -ENODEV || starpu_cpu_worker_get_count() == 0) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 81 - 4
tests/datawizard/interfaces/multiformat/advanced/multiformat_handle_conversion.c

@@ -32,7 +32,7 @@
 
 extern struct stats global_stats;
 
-#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
+#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL) || defined(STARPU_USE_MIC)
 static void
 create_and_submit_tasks(int where, starpu_data_handle_t handles[])
 {
@@ -52,6 +52,10 @@ create_and_submit_tasks(int where, starpu_data_handle_t handles[])
 	if (where & STARPU_OPENCL)
 		cl.opencl_funcs[0] = opencl_func;
 #endif
+#ifdef STARPU_USE_MIC
+	if (where & STARPU_MIC)
+		cl.mic_funcs[0] = mic_func;
+#endif
 
 	struct starpu_task *task = starpu_task_create();
 	task->synchronous = SYNCHRONOUS;
@@ -92,6 +96,10 @@ create_and_submit_tasks(int where, starpu_data_handle_t handles[])
 	if (where & STARPU_OPENCL)
 		cl3.opencl_funcs[0] = opencl_func;
 #endif
+#ifdef STARPU_USE_MIC
+	if (where & STARPU_MIC)
+		cl3.mic_funcs[0] = mic_func;
+#endif
 
 	struct starpu_task *task3 = starpu_task_create();
 	task3->synchronous = SYNCHRONOUS;
@@ -145,6 +153,11 @@ test_cuda(void)
 	expected_stats.cpu_to_opencl = 0;
 	expected_stats.opencl_to_cpu = 0;
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	expected_stats.mic = 0;
+	expected_stats.cpu_to_mic = 0;
+	expected_stats.mic_to_cpu = 0;
+#endif
 	expected_stats.cuda = 2;
 	expected_stats.cpu_to_cuda = 2;
 	expected_stats.cuda_to_cpu = 2;
@@ -190,6 +203,11 @@ test_opencl(void)
 	expected_stats.cpu_to_cuda = 0;
 	expected_stats.cuda_to_cpu = 0;
 #endif /* !STARPU_USE_CUDA */
+#ifdef STARPU_USE_MIC
+	expected_stats.mic = 0;
+	expected_stats.cpu_to_mic = 0;
+	expected_stats.mic_to_cpu = 0;
+#endif
 	expected_stats.opencl = 2;
 	expected_stats.cpu_to_opencl = 2;
 	expected_stats.opencl_to_cpu = 2;
@@ -198,8 +216,58 @@ test_opencl(void)
 }
 #endif /* !STARPU_USE_OPENCL */
 
+#ifdef STARPU_USE_MIC
+static int
+test_mic(void)
+{
+	int i;
+	int vector1[NX];
+	int vector2[NX];
+	starpu_data_handle_t handles[2];
+
+	for (i = 0; i < NX; i++)
+	{
+		vector1[i] = i;
+		vector2[i] = i;
+	}
+
+	starpu_multiformat_data_register(&handles[0], 0, vector1, NX, &ops);
+	starpu_multiformat_data_register(&handles[1], 0, vector2, NX, &ops);
+
+	memset(&global_stats, 0, sizeof(global_stats));
+	create_and_submit_tasks(STARPU_MIC, handles);
+
+	starpu_data_unregister(handles[0]);
+	starpu_data_unregister(handles[1]);
+
+#if DEBUG
+	print_stats(&global_stats);
+#endif
+
+	struct stats expected_stats;
+#ifdef STARPU_USE_CPU
+	expected_stats.cpu = 1;
+#endif /* !STARPU_USE_CPU */
+#ifdef STARPU_USE_OPENCL
+	expected_stats.opencl = 0;
+	expected_stats.cpu_to_opencl = 0;
+	expected_stats.opencl_to_cpu = 0;
+#endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_CUDA
+	expected_stats.cuda = 0;
+	expected_stats.cpu_to_cuda = 0;
+	expected_stats.cuda_to_cpu = 0;
+#endif
+	expected_stats.mic = 2;
+	expected_stats.cpu_to_mic = 2;
+	expected_stats.mic_to_cpu = 2;
+
+	return compare_stats(&expected_stats, &global_stats);
+}
+#endif /* !STARPU_USE_CUDA */
+
 int
-main(void)
+main(int argc, char **argv)
 {
 #ifdef STARPU_USE_CPU
 	int ret;
@@ -208,8 +276,9 @@ main(void)
 
 	conf.ncuda = 2;
 	conf.nopencl = 1;
+	conf.nmic = 1;
 
-	ret = starpu_init(&conf);
+	ret = starpu_initialize(&conf, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
@@ -221,6 +290,7 @@ main(void)
 	}
 	unsigned int ncuda = starpu_cuda_worker_get_count();
 	unsigned int nopencl = starpu_opencl_worker_get_count();
+	unsigned int nmic = starpu_mic_worker_get_count();
 
 #ifdef STARPU_USE_OPENCL
 	if (nopencl > 0 && test_opencl() != 0)
@@ -236,10 +306,17 @@ main(void)
 		return EXIT_FAILURE;
 	}
 #endif
+#ifdef STARPU_USE_MIC
+	if (nmic > 0 && test_mic() != 0)
+	{
+		FPRINTF(stderr, "MIC FAILED \n");
+		return EXIT_FAILURE;
+	}
+#endif
 
 	starpu_shutdown();
 
-	if (ncuda == 0 && nopencl == 0)
+	if (ncuda == 0 && nopencl == 0 && nmic == 0)
 		return STARPU_TEST_SKIPPED;
 	else
 		return EXIT_SUCCESS;

+ 36 - 5
tests/datawizard/interfaces/multiformat/advanced/multiformat_worker.c

@@ -18,7 +18,7 @@
 #include "generic.h"
 #include "../../../../helper.h"
 
-#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
+#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL) || defined(STARPU_USE_MIC)
 extern struct stats global_stats;
 static int vector[NX]; static starpu_data_handle_t handle;
 #endif
@@ -31,8 +31,12 @@ static int cuda_worker;
 static int nopencl;
 static int opencl_worker;
 #endif
+#ifdef STARPU_USE_MIC
+static int nmic;
+static int mic_worker;
+#endif
 
-#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
+#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL) || defined(STARPU_USE_MIC)
 static struct starpu_codelet cl =
 {
 	.modes = { STARPU_RW },
@@ -42,6 +46,9 @@ static struct starpu_codelet cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = { opencl_func, NULL },
 #endif
+#ifdef STARPU_MIC
+	.mic_funcs = {mic_func, NULL},
+#endif
 	.nbuffers = 1,
 };
 
@@ -84,6 +91,13 @@ create_and_submit_tasks(void)
 	}
 	else
 #endif
+#ifdef STARPU_USE_MIC
+	if (nmic > 0)
+	{
+		task->workerid = mic_worker;
+	}
+	else
+#endif
 	{
 		return -ENODEV;
 	}
@@ -93,11 +107,11 @@ create_and_submit_tasks(void)
 #endif
 
 int
-main(void)
+main(int argc, char **argv)
 {
-#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
+#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL) || defined(STARPU_USE_MIC)
 	int err;
-	err = starpu_init(NULL);
+	err = starpu_initialize(NULL, &argc, &argv);
 	if (err == -ENODEV)
 		goto enodev;
 
@@ -113,6 +127,13 @@ main(void)
 	if (nopencl < 0)
 		nopencl = 1;
 #endif
+#ifdef STARPU_USE_MIC
+	nmic = starpu_worker_get_ids_by_type(STARPU_MIC_WORKER,
+						&mic_worker, 1);
+
+	if(nmic < 0)
+		nmic = 1;
+#endif
 
 	reset_stats(&global_stats);
 	register_handle();
@@ -144,6 +165,16 @@ main(void)
 
 	}
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	if (global_stats.mic == 1)
+	{
+		if (global_stats.cpu_to_mic == 1 &&
+			global_stats.mic_to_cpu == 1)
+			return EXIT_SUCCESS;
+		else
+			return EXIT_FAILURE;
+	}
+#endif
 
 	/* We should not get here */
 	return EXIT_FAILURE;

+ 21 - 4
tests/datawizard/interfaces/multiformat/advanced/same_handle.c

@@ -22,7 +22,7 @@
  * A single handle can be given twice to a given kernel. In this case, it
  * should only be converted once.
  */
-#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
+#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL) || defined(STARPU_USE_MIC)
 extern struct stats global_stats;
 static int vector[NX]; static starpu_data_handle_t handle;
 
@@ -35,6 +35,9 @@ static struct starpu_codelet cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = { opencl_func, NULL },
 #endif
+#ifdef STARPU_USE_MIC
+	.mic_funcs = {mic_func, NULL},
+#endif
 	.nbuffers = 2,
 };
 
@@ -66,6 +69,9 @@ create_and_submit_tasks(void)
 #ifdef STARPU_USE_OPENCL
 	cl.where |= STARPU_OPENCL;
 #endif
+#ifdef STARPU_USE_MIC
+	cl.where |= STARPU_MIC;
+#endif
 
 	task = starpu_task_create();
 	task->cl = &cl;
@@ -81,11 +87,11 @@ create_and_submit_tasks(void)
 #endif
 
 int
-main(void)
+main(int argc, char **argv)
 {
-#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL)
+#if defined(STARPU_USE_CUDA) || defined(STARPU_USE_OPENCL) || defined(STARPU_USE_MIC)
 	int err;
-	err = starpu_init(NULL);
+	err = starpu_initialize(NULL, &argc, &argv);
 	if (err == -ENODEV)
 		goto enodev;
 
@@ -121,6 +127,17 @@ main(void)
 	}
 	else
 #endif
+#if defined(STARPU_USE_MIC)
+	if (global_stats.mic == 1)
+	{
+		if (global_stats.cpu_to_mic == 1 &&
+			global_stats.mic_to_cpu == 1)
+			return EXIT_SUCCESS;
+		else
+			return EXIT_FAILURE;
+	}
+	else
+#endif
 	{
 		/* We should not get here */
 		return EXIT_FAILURE;

+ 48 - 0
tests/datawizard/interfaces/multiformat/multiformat_conversion_codelets.c

@@ -77,3 +77,51 @@ struct starpu_codelet opencl_to_cpu_cl =
 	.nbuffers = 1
 };
 #endif
+#ifdef STARPU_USE_MIC
+void mic_to_cpu(void *buffers[], void *arg)
+{
+	STARPU_SKIP_IF_VALGRIND;
+
+	FPRINTF(stderr, "Entering %s\n", __func__);
+	struct struct_of_arrays *src = STARPU_MULTIFORMAT_GET_MIC_PTR(buffers[0]);
+	struct point *dst = STARPU_MULTIFORMAT_GET_CPU_PTR(buffers[0]);
+	int n = STARPU_MULTIFORMAT_GET_NX(buffers[0]);
+	int i;
+	for (i = 0; i < n; i++)
+	{
+		dst[i].x = src->x[i];
+		dst[i].y = src->y[i];
+	}
+}
+
+void cpu_to_mic(void *buffers[], void *args)
+{
+	STARPU_SKIP_IF_VALGRIND;
+
+	FPRINTF(stderr, "Entering %s\n", __func__);
+	struct point *src = STARPU_MULTIFORMAT_GET_CPU_PTR(buffers[0]);
+	struct struct_of_arrays *dst = STARPU_MULTIFORMAT_GET_MIC_PTR(buffers[0]);
+	int n = STARPU_MULTIFORMAT_GET_NX(buffers[0]);
+	int i;
+	for (i = 0; i < n; i++)
+	{
+		dst->x[i] = src[i].x;
+		dst->y[i] = src[i].y;
+	}
+}
+
+struct starpu_codelet cpu_to_mic_cl =
+{
+	.where = STARPU_MIC,
+	.cpu_funcs_name = {"cpu_to_mic", NULL},
+	.nbuffers = 1
+};
+
+struct starpu_codelet mic_to_cpu_cl =
+{
+	.where = STARPU_CPU,
+	.cpu_funcs = {mic_to_cpu, NULL},
+	.nbuffers = 1
+};
+#endif
+

+ 40 - 2
tests/datawizard/interfaces/multiformat/multiformat_interface.c

@@ -26,6 +26,7 @@ extern void test_multiformat_cuda_func(void *buffers[], void *args);
 #ifdef STARPU_USE_OPENCL
 extern void test_multiformat_opencl_func(void *buffers[], void *args);
 #endif
+void test_multiformat_mic_func(void *buffers[], void *args);
 
 static struct point array_of_structs[N_ELEMENTS];
 static struct point array_of_structs_dummy[N_ELEMENTS];
@@ -42,6 +43,7 @@ struct test_config multiformat_config =
 #ifdef STARPU_USE_OPENCL
 	.opencl_func   = test_multiformat_opencl_func,
 #endif
+	.cpu_func_name = "test_multiformat_mic_func",
 	.handle        = &multiformat_handle,
 	.dummy_handle  = &multiformat_dummy_handle,
 	.copy_failed   = SUCCESS,
@@ -74,7 +76,32 @@ test_multiformat_cpu_func(void *buffers[], void *args)
 	FPRINTF(stderr, "\n");
 }
 
+void test_multiformat_mic_func(void *buffers[], void *args)
+{
+	STARPU_SKIP_IF_VALGRIND;
+
+	printf("MIC\n");
+
+	struct struct_of_arrays *soa;
+	unsigned int n, i;
+	int factor;
 
+	soa = (struct struct_of_arrays *) STARPU_MULTIFORMAT_GET_MIC_PTR(buffers[0]);
+	n = STARPU_MULTIFORMAT_GET_NX(buffers[0]);
+	factor = *(int *) args;
+
+	for (i = 0; i < n; i++)
+	{
+			FPRINTF(stderr, "(%d %d) [%d]", soa->x[i], soa->y[i], factor);
+		if (soa->x[i] != i * factor || soa->y[i] != i * factor)
+		{
+			multiformat_config.copy_failed = 1;
+		}
+		soa->x[i] = -soa->x[i];
+		soa->y[i] = -soa->y[i];
+	}
+	FPRINTF(stderr, "\n");
+}
 
 #ifdef STARPU_USE_CUDA
 extern struct starpu_codelet cpu_to_cuda_cl;
@@ -86,6 +113,11 @@ extern struct starpu_codelet cpu_to_opencl_cl;
 extern struct starpu_codelet opencl_to_cpu_cl;
 #endif
 
+#ifdef STARPU_USE_MIC
+extern struct starpu_codelet cpu_to_mic_cl;
+extern struct starpu_codelet mic_to_cpu_cl;
+#endif
+
 struct starpu_multiformat_data_interface_ops format_ops =
 {
 #ifdef STARPU_USE_CUDA
@@ -98,6 +130,11 @@ struct starpu_multiformat_data_interface_ops format_ops =
 	.cpu_to_opencl_cl = &cpu_to_opencl_cl,
 	.opencl_to_cpu_cl = &opencl_to_cpu_cl,
 #endif
+#ifdef STARPU_USE_MIC
+	.mic_elemsize = 2 * sizeof(float),
+	.cpu_to_mic_cl = &cpu_to_mic_cl,
+	.mic_to_cpu_cl = &mic_to_cpu_cl,
+#endif
 	.cpu_elemsize = sizeof(struct point),
 };
 
@@ -131,7 +168,7 @@ unregister_data(void)
 }
 
 int
-main(void)
+main(int argc, char **argv)
 {
 #ifdef STARPU_USE_CPU
 	int ret;
@@ -140,8 +177,9 @@ main(void)
 	starpu_conf_init(&conf);
 	conf.ncuda = 2;
 	conf.nopencl = 1;
+	conf.nmic = -1;
 
-	ret = starpu_init(&conf);
+	ret = starpu_initialize(&conf, &argc, &argv);
 	if (ret == -ENODEV || starpu_cpu_worker_get_count() == 0)
 		return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");

+ 132 - 3
tests/datawizard/interfaces/test_interfaces.c

@@ -26,7 +26,7 @@
 #include "../../helper.h"
 
 /*
- * This is definitely note thrad-safe.
+ * This is definitely note thread-safe.
  */
 static struct test_config *current_config;
 
@@ -76,6 +76,12 @@ struct data_interface_test_summary
 	int cpu_to_opencl_async;
 	int opencl_to_cpu_async;
 #endif
+#ifdef STARPU_USE_MIC
+	int cpu_to_mic;
+	int mic_to_cpu;
+	int cpu_to_mic_async;
+	int mic_to_cpu_async;
+#endif
 
 	/* Other stuff */
 	int compare;
@@ -107,6 +113,12 @@ void data_interface_test_summary_print(FILE *f,
 	FPRINTF(f, "\tOpenCl -> CPU    : %s\n",
 		enum_to_string(s->opencl_to_cpu_async));
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	FPRINTF(f, "\tCPU	-> MIC : %s\n",
+		enum_to_string(s->cpu_to_mic_async));
+	FPRINTF(f, "\tMIC	-> CPU : %s\n",
+		enum_to_string(s->mic_to_cpu_async));
+#endif
 
 	FPRINTF(f, "Synchronous :\n");
 #ifdef STARPU_USE_CUDA
@@ -123,6 +135,12 @@ void data_interface_test_summary_print(FILE *f,
 	FPRINTF(f, "\tOpenCl -> CPU    : %s\n",
 		enum_to_string(s->opencl_to_cpu));
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	FPRINTF(f, "\tCPU	-> MIC : %s\n",
+		enum_to_string(s->cpu_to_mic));
+	FPRINTF(f, "\tMIC	-> CPU : %s\n",
+		enum_to_string(s->mic_to_cpu));
+#endif
 #ifdef STARPU_USE_CPU
 	FPRINTF(f, "CPU    -> CPU    : %s\n",
 		enum_to_string(s->cpu_to_cpu));
@@ -151,8 +169,13 @@ enum operation
 #ifdef STARPU_USE_OPENCL
 	,
 	CPU_TO_OPENCL,
-	OPENCL_TO_CPU
+	OPENCL_TO_CPU,
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	,
+	CPU_TO_MIC,
+	MIC_TO_CPU,
+#endif
 };
 
 static int*
@@ -178,6 +201,12 @@ get_field(struct data_interface_test_summary *s, int async, enum operation op)
 	case OPENCL_TO_CPU:
 		return async?&s->opencl_to_cpu_async:&s->opencl_to_cpu;
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	case CPU_TO_MIC:
+		return async?&s->cpu_to_mic_async:&s->cpu_to_mic;
+	case MIC_TO_CPU:
+		return async?&s->mic_to_cpu_async:&s->mic_to_cpu;
+#endif
 	default:
 		STARPU_ABORT();
 	}
@@ -233,13 +262,18 @@ static struct data_interface_test_summary summary =
 	.cpu_to_opencl_async   = UNTESTED,
 	.opencl_to_cpu_async   = UNTESTED,
 #endif
+#ifdef STARPU_USE_MIC
+	.cpu_to_mic            = UNTESTED,
+	.mic_to_cpu            = UNTESTED,
+	.cpu_to_mic_async      = UNTESTED,
+	.mic_to_cpu_async      = UNTESTED,
+#endif
 #ifdef STARPU_USE_CPU
 	.handle_to_pointer     = UNTESTED,
 #endif
 	.success               = SUCCESS
 };
 
-
 /*
  * This variable has to be either -1 or 1.
  * The kernels should check that the ith value stored in the data interface is
@@ -271,6 +305,9 @@ create_task(struct starpu_task **taskp, enum starpu_worker_archtype type, int id
 #ifdef STARPU_USE_OPENCL
 	static int opencl_workers[STARPU_MAXOPENCLDEVS];
 #endif
+#ifdef STARPU_USE_MIC
+	static int mic_workers[STARPU_MAXMICDEVS];
+#endif
 
 	static int n_cpus = -1;
 #ifdef STARPU_USE_CUDA
@@ -279,6 +316,9 @@ create_task(struct starpu_task **taskp, enum starpu_worker_archtype type, int id
 #ifdef STARPU_USE_OPENCL
 	static int n_opencls = -1;
 #endif
+#ifdef STARPU_USE_MIC
+	static int n_mics = -1;
+#endif
 
 	if (n_cpus == -1) /* First time here */
 	{
@@ -299,6 +339,11 @@ create_task(struct starpu_task **taskp, enum starpu_worker_archtype type, int id
 							opencl_workers,
 							STARPU_MAXOPENCLDEVS);
 #endif
+#ifdef STARPU_USE_MIC
+		n_mics = starpu_worker_get_ids_by_type(STARPU_MIC_WORKER,
+							mic_workers,
+							STARPU_MAXMICDEVS);
+#endif
 	}
 
 	int workerid=0;
@@ -351,6 +396,21 @@ create_task(struct starpu_task **taskp, enum starpu_worker_archtype type, int id
 			cl.opencl_funcs[0] = current_config->opencl_func;
 			break;
 #endif /* ! STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+		case STARPU_MIC_WORKER:
+		if (id != -1)
+		{
+			if (id >= n_mics)
+			{
+				FPRINTF(stderr, "Not enough MIC workers\n");
+				return -ENODEV;
+			}
+			workerid = mic_workers[id];
+		}
+		cl.where = STARPU_MIC;
+		cl.cpu_funcs_name[0] = current_config->cpu_func_name;
+		break;
+#endif
 		default:
 			return -ENODEV;
 	}
@@ -476,6 +536,44 @@ opencl_to_ram(void)
 	return current_config->copy_failed;
 }
 #endif /* !STARPU_USE_OPENCL */
+
+#ifdef STARPU_USE_MIC
+static enum exit_code
+ram_to_mic()
+{
+	int err;
+	struct starpu_task *task;
+
+	err = create_task(&task, STARPU_MIC_WORKER, 0);
+	if (err != 0)
+		return TASK_CREATION_FAILURE;
+
+	err = starpu_task_submit(task);
+	if (err != 0)
+		return TASK_SUBMISSION_FAILURE;
+
+	FPRINTF(stderr, "[%s] : %d\n", __func__, current_config->copy_failed);
+	return current_config->copy_failed;
+}
+
+static enum exit_code
+mic_to_ram()
+{
+	int err;
+	struct starpu_task *task;
+
+	err = create_task(&task, STARPU_CPU_WORKER, -1);
+	if (err != 0)
+		return TASK_CREATION_FAILURE;
+	
+	err = starpu_task_submit(task);
+	if (err != 0)
+		return TASK_SUBMISSION_FAILURE;
+
+	FPRINTF(stderr, "[%s] : %d\n", __func__, current_config->copy_failed);
+	return current_config->copy_failed;
+}
+#endif
 /* End of the <device1>_to_<device2> functions. */
 
 #ifdef STARPU_USE_CUDA
@@ -534,6 +632,24 @@ run_opencl(int async)
 }
 #endif /* !STARPU_USE_OPENCL */
 
+#ifdef STARPU_USE_MIC
+static void
+run_mic(int async)
+{
+	int err;
+
+	err = ram_to_mic();
+	set_field(&summary, async, CPU_TO_MIC, err);
+	if (err != SUCCESS)
+		return;
+
+#ifdef STARPU_USE_CPU
+	err = mic_to_ram();
+	set_field(&summary, async, MIC_TO_CPU, err);
+#endif
+}
+#endif /* STARPU_USE_PIC */
+
 #ifdef STARPU_USE_CPU
 /* Valid data should be in RAM before calling this function */
 static void
@@ -592,6 +708,9 @@ run_async(void)
 #ifdef STARPU_USE_OPENCL
 	run_opencl(1);
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	run_mic(1);
+#endif
 }
 
 static void
@@ -616,6 +735,10 @@ run_sync(void)
 	new_copy_methods.ram_to_opencl_async = NULL;
 	new_copy_methods.opencl_to_ram_async = NULL;
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	new_copy_methods.ram_to_mic_async = NULL;
+	new_copy_methods.mic_to_ram_async = NULL;
+#endif
 
 	handle->ops->copy_methods = &new_copy_methods;
 
@@ -625,6 +748,9 @@ run_sync(void)
 #ifdef STARPU_USE_OPENCL
 	run_opencl(0);
 #endif /* !STARPU_USE_OPENCL */
+#ifdef STARPU_USE_MIC
+	run_mic(0);
+#endif
 
 	handle->ops->copy_methods = old_copy_methods;
 }
@@ -700,6 +826,9 @@ load_conf(struct test_config *config)
 #ifdef STARPU_USE_OPENCL
 	    !config->opencl_func ||
 #endif
+#ifdef STARPU_USE_MIC
+		!config->cpu_func_name ||
+#endif
 	    !config->handle)
 	{
 		return 1;

+ 1 - 0
tests/datawizard/interfaces/test_interfaces.h

@@ -54,6 +54,7 @@ struct test_config
 #ifdef STARPU_USE_OPENCL
 	starpu_opencl_func_t opencl_func;
 #endif
+	char *cpu_func_name;
 
 	/* The previous codelets must update this field at the end of their
 	 * execution. copy_failed must be FAILURE if the copy failed, SUCCESS otherwise. */

+ 9 - 5
tests/datawizard/interfaces/variable/variable_interface.c

@@ -23,8 +23,8 @@ static starpu_data_handle_t variable_handle;
 static starpu_data_handle_t variable2_handle;
 
 /* Codelets */
-#ifdef STARPU_USE_CPU
-static void test_variable_cpu_func(void *buffers[], void *args);
+#if defined(STARPU_USE_CPU) || defined(STARPU_USE_MIC)
+void test_variable_cpu_func(void *buffers[], void *args);
 #endif
 #ifdef STARPU_USE_CUDA
 extern void test_variable_cuda_func(void *buffers[], void *args);
@@ -44,13 +44,16 @@ struct test_config variable_config =
 #ifdef STARPU_USE_OPENCL
 	.opencl_func  = test_variable_opencl_func,
 #endif
+#ifdef STARPU_USE_MIC
+	.cpu_func_name = "test_variable_cpu_func",
+#endif
 	.handle       = &variable_handle,
 	.dummy_handle = &variable2_handle,
 	.copy_failed  = SUCCESS,
 	.name         = "variable_interface"
 };
 
-static void
+void
 test_variable_cpu_func(void *buffers[], void *args)
 {
 	STARPU_SKIP_IF_VALGRIND;
@@ -88,7 +91,7 @@ void unregister_data(void)
 }
 
 int
-main(void)
+main(int argc, char **argv)
 {
 	int ret;
 	data_interface_test_summary *summary;
@@ -98,8 +101,9 @@ main(void)
 
 	conf.ncuda = 2;
 	conf.nopencl = 1;
+	conf.nmic = -1;
 
-	ret = starpu_init(&conf);
+	ret = starpu_initialize(&conf, &argc, &argv);
 	if (ret == -ENODEV || starpu_cpu_worker_get_count() == 0)
 		return STARPU_TEST_SKIPPED;
 

+ 8 - 4
tests/datawizard/interfaces/vector/test_vector_interface.c

@@ -21,7 +21,7 @@
 /* Prototypes */
 static void register_data(void);
 static void unregister_data(void);
-static void test_vector_cpu_func(void *buffers[], void *args);
+void test_vector_cpu_func(void *buffers[], void *args);
 #ifdef STARPU_USE_CUDA
 extern void test_vector_cuda_func(void *buffers[], void *_args);
 #endif
@@ -42,6 +42,9 @@ struct test_config vector_config =
 #ifdef STARPU_USE_OPENCL
 	.opencl_func   = test_vector_opencl_func,
 #endif
+#ifdef STARPU_USE_MIC
+	.cpu_func_name = "test_vector_cpu_func",
+#endif
 	.handle        = &vector_handle,
 	.dummy_handle  = &vector2_handle,
 	.copy_failed   = SUCCESS,
@@ -80,7 +83,7 @@ unregister_data(void)
 	starpu_data_unregister(vector2_handle);
 }
 
-static void test_vector_cpu_func(void *buffers[], void *args)
+void test_vector_cpu_func(void *buffers[], void *args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -100,15 +103,16 @@ static void test_vector_cpu_func(void *buffers[], void *args)
 }
 
 int
-main(void)
+main(int argc, char **argv)
 {
 	data_interface_test_summary *summary;
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
 	conf.ncuda = 2;
 	conf.nopencl = 1;
+	conf.nmic = -1;
 
-	if (starpu_init(&conf) == -ENODEV || starpu_cpu_worker_get_count() == 0)
+	if (starpu_initialize(&conf, &argc, &argv || starpu_cpu_worker_get_count() == 0) == -ENODEV)
 		goto enodev;
 
 	register_data();

+ 7 - 3
tests/datawizard/interfaces/void/void_interface.c

@@ -17,7 +17,7 @@
 #include "../test_interfaces.h"
 #include "../../../helper.h"
 
-static void fake_func(void *buffers[], void *arg)
+void fake_func(void *buffers[], void *arg)
 {
 	(void) buffers;
 	(void) arg;
@@ -35,6 +35,9 @@ struct test_config void_config =
 #ifdef STARPU_USE_OPENCL
 	.opencl_func   = fake_func,
 #endif
+#ifdef STARPU_USE_MIC
+	.cpu_func_name = "fake_func",
+#endif
 	.handle        = &void_handle,
 	.dummy_handle  = &void2_handle,
 	.copy_failed   = SUCCESS,
@@ -56,15 +59,16 @@ unregister_data(void)
 }
 
 int
-main(void)
+main(int argc, char **argv)
 {
 	data_interface_test_summary *summary;
 	struct starpu_conf conf;
 	starpu_conf_init(&conf);
 	conf.ncuda = 2;
 	conf.nopencl = 1;
+	conf.nmic = -1;
 
-	if (starpu_init(&conf) == -ENODEV || starpu_cpu_worker_get_count() == 0)
+	if (starpu_initialize(&conf, &argc, &argv) == -ENODEV || starpu_cpu_worker_get_count() == 0)
 		goto enodev;
 
 	register_data();

+ 5 - 3
tests/datawizard/lazy_allocation.c

@@ -73,7 +73,7 @@ static void opencl_memset_codelet(void *buffers[], void *args)
 }
 #endif
 
-static void cpu_memset_codelet(void *descr[], __attribute__ ((unused)) void *_args)
+void cpu_memset_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -92,6 +92,7 @@ static struct starpu_codelet memset_cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {opencl_memset_codelet, NULL},
 #endif
+	.cpu_funcs_name = {"cpu_memset_codelet", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -100,7 +101,7 @@ static struct starpu_codelet memset_cl =
  *	Check content
  */
 
-static void cpu_check_content_codelet(void *descr[], __attribute__ ((unused)) void *_args)
+void cpu_check_content_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -185,6 +186,7 @@ static struct starpu_codelet check_content_cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {opencl_check_content_codelet, NULL},
 #endif
+	.cpu_funcs_name = {"cpu_check_content_codelet", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_R}
 };
@@ -194,7 +196,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 1 - 1
tests/datawizard/manual_reduction.c

@@ -167,7 +167,7 @@ int main(int argc, char **argv)
 
 	variable = INIT_VALUE;
 
-        ret = starpu_init(NULL);
+        ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 4 - 2
tests/datawizard/mpi_like.c

@@ -53,7 +53,7 @@ void cuda_codelet_unsigned_inc(void *descr[], __attribute__ ((unused)) void *cl_
 void opencl_codelet_unsigned_inc(void *buffers[], void *args);
 #endif
 
-static void increment_handle_cpu_kernel(void *descr[], void *cl_arg __attribute__((unused)))
+void increment_handle_cpu_kernel(void *descr[], void *cl_arg __attribute__((unused)))
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -71,6 +71,7 @@ static struct starpu_codelet increment_handle_cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {opencl_codelet_unsigned_inc, NULL},
 #endif
+	.cpu_funcs_name = {"increment_handle_cpu_kernel", NULL},
 	.nbuffers = 1
 };
 
@@ -82,6 +83,7 @@ static void increment_handle(struct thread_data *thread_data)
 	task->handles[0] = thread_data->handle;
 
 	task->cl_arg = thread_data;
+	task->cl_arg_size = sizeof(thread_data);
 
 	task->destroy = 1;
 	task->detach = 0;
@@ -176,7 +178,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/datawizard/mpi_like_async.c

@@ -74,7 +74,7 @@ void cuda_codelet_unsigned_inc(void *descr[], __attribute__ ((unused)) void *cl_
 void opencl_codelet_unsigned_inc(void *buffers[], void *args);
 #endif
 
-static void increment_handle_cpu_kernel(void *descr[], void *cl_arg __attribute__((unused)))
+void increment_handle_cpu_kernel(void *descr[], void *cl_arg __attribute__((unused)))
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -94,6 +94,7 @@ static struct starpu_codelet increment_handle_cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = { opencl_codelet_unsigned_inc, NULL},
 #endif
+	.cpu_funcs_name = {"increment_handle_cpu_kernel", NULL},
 	.nbuffers = 1
 };
 
@@ -319,7 +320,7 @@ int main(int argc, char **argv)
 	nthreads /= 4;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 2 - 1
tests/datawizard/partition_lazy.c

@@ -27,6 +27,7 @@ struct starpu_codelet mycodelet =
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = { scal_func_cuda, NULL },
 #endif
+	.cpu_funcs_name = {"scal_func_cpu", NULL},
 	.modes = { STARPU_W },
         .model = NULL,
         .nbuffers = 1
@@ -40,7 +41,7 @@ int main(int argc, char **argv)
 	int n, size;
 	unsigned i;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 4 - 2
tests/datawizard/readers_and_writers.c

@@ -21,7 +21,7 @@
 static unsigned book = 0;
 static starpu_data_handle_t book_handle;
 
-static void dummy_kernel(void *descr[], void *arg)
+void dummy_kernel(void *descr[], void *arg)
 {
 }
 
@@ -30,6 +30,7 @@ static struct starpu_codelet r_cl =
 	.cuda_funcs = {dummy_kernel, NULL},
 	.cpu_funcs = {dummy_kernel, NULL},
 	.opencl_funcs = {dummy_kernel, NULL},
+	.cpu_funcs_name = {"dummy_kernel", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_R}
 };
@@ -39,6 +40,7 @@ static struct starpu_codelet w_cl =
 	.cuda_funcs = {dummy_kernel, NULL},
 	.cpu_funcs = {dummy_kernel, NULL},
 	.opencl_funcs = {dummy_kernel, NULL},
+	.cpu_funcs_name = {"dummy_kernel", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -47,7 +49,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 14 - 5
tests/datawizard/reclaim.c

@@ -49,15 +49,22 @@ static uint64_t get_total_memory_size(void)
 }
 #endif
 
-static void dummy_func(void *descr[], __attribute__ ((unused)) void *_args)
+void dummy_func(void *descr[], __attribute__ ((unused)) void *_args)
 {
 }
 
+static unsigned int i = 0;
+void f(void *arg)
+{
+	printf("%d\n", ++i);
+}
+
 static struct starpu_codelet dummy_cl =
 {
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.nbuffers = 3,
 	.modes = {STARPU_RW, STARPU_R, STARPU_R}
 };
@@ -70,6 +77,10 @@ int main(int argc, char **argv)
 	int i, ret;
 	int taskid;
 
+        ret = starpu_initialize(NULL, &argc, &argv);
+	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+
 #ifdef STARPU_HAVE_HWLOC
 	/* We allocate 50% of the memory */
 	uint64_t total_size = get_total_memory_size();
@@ -95,10 +106,6 @@ int main(int argc, char **argv)
 
 	FPRINTF(stderr, "Allocate %d buffers and create %u tasks\n", mb, ntasks);
 
-        ret = starpu_init(NULL);
-	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
-
 	float **host_ptr_array;
 	starpu_data_handle_t *handle_array;
 
@@ -126,6 +133,8 @@ int main(int argc, char **argv)
 		task->handles[0] = handle_array[taskid%mb];
 		task->handles[1] = handle_array[(taskid+1)%mb];
 		task->handles[2] = handle_array[(taskid+2)%mb];
+		task->callback_func = f;
+		task->callback_arg = NULL;
 
 		ret = starpu_task_submit(task);
 		if (ret == -ENODEV) goto enodev;

+ 1 - 0
tests/datawizard/scal.c

@@ -96,6 +96,7 @@ struct starpu_codelet scal_codelet =
 #ifdef STARPU_USE_CUDA
 	.cuda_funcs = { scal_func_cuda, NULL },
 #endif
+	.cpu_funcs_name = {"scal_func_cpu", NULL},
 	.modes = { STARPU_RW },
         .model = NULL,
         .nbuffers = 1

+ 3 - 2
tests/datawizard/scratch.c

@@ -43,7 +43,7 @@ extern void cuda_f(void *descr[], __attribute__ ((unused)) void *_args);
 extern void opencl_f(void *buffers[], void *args);
 #endif
 
-static void cpu_f(void *descr[], __attribute__ ((unused)) void *_args)
+void cpu_f(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -71,6 +71,7 @@ static struct starpu_codelet cl_f =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {opencl_f, NULL},
 #endif
+	.cpu_funcs_name = {"cpu_f", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_RW, STARPU_SCRATCH}
 };
@@ -83,7 +84,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 1
tests/datawizard/sync_and_notify_data.c

@@ -86,7 +86,7 @@ int main(int argc, char **argv)
 	k /= 16;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
@@ -149,6 +149,8 @@ int main(int argc, char **argv)
 #ifdef STARPU_USE_OPENCL
 				.opencl_funcs = {opencl_codelet_incC, NULL},
 #endif
+				.cpu_funcs_name = {"cpu_codelet_incA", NULL},
+				.cpu_funcs_name = {"cpu_codelet_incC", NULL},
 				.nbuffers = 1,
 				.modes = {STARPU_RW}
 

+ 3 - 1
tests/datawizard/sync_and_notify_data_implicit.c

@@ -100,6 +100,8 @@ struct starpu_codelet cl_inc_c =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {opencl_codelet_incC, NULL},
 #endif
+	.cpu_funcs_name = {"cpu_codelet_incA", NULL},
+	.cpu_funcs_name = {"cpu_codelet_incC", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_RW}
 };
@@ -113,7 +115,7 @@ int main(int argc, char **argv)
 	k /= 8;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/datawizard/sync_with_data_with_mem.c

@@ -34,7 +34,7 @@ float *buffer[NBUFFERS_DEF];
 
 starpu_data_handle_t v_handle[NBUFFERS_DEF];
 
-static void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
+void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 {
 }
 
@@ -48,6 +48,7 @@ static struct starpu_codelet cl =
 #ifdef STARPU_USE_OPENCL
         .opencl_funcs = {dummy_codelet, NULL},
 #endif
+	.cpu_funcs_name = {"dummy_codelet", NULL},
 	.nbuffers = 1
 };
 
@@ -74,7 +75,7 @@ int main(int argc, char **argv)
 	vectorsize /= 8;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/datawizard/sync_with_data_with_mem_non_blocking.c

@@ -35,7 +35,7 @@ float *buffer[NBUFFERS_DEF];
 
 starpu_data_handle_t v_handle[NBUFFERS_DEF];
 
-static void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
+void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 {
 }
 
@@ -49,6 +49,7 @@ static struct starpu_codelet cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {dummy_codelet, NULL},
 #endif
+	.cpu_funcs_name = {"dummy_codelet", NULL},
 	.nbuffers = 1
 };
 
@@ -91,7 +92,7 @@ int main(int argc, char **argv)
 	vectorsize /= 8;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/datawizard/sync_with_data_with_mem_non_blocking_implicit.c

@@ -35,7 +35,7 @@ float *buffer[NBUFFERS_DEF];
 
 starpu_data_handle_t v_handle[NBUFFERS_DEF];
 
-static void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
+void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 {
 }
 
@@ -49,6 +49,7 @@ static struct starpu_codelet cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {dummy_codelet, NULL},
 #endif
+	.cpu_funcs_name = {"dummy_codelet", NULL},
 	.nbuffers = 1
 };
 
@@ -91,7 +92,7 @@ int main(int argc, char **argv)
 	vectorsize /= 8;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/datawizard/unpartition.c

@@ -34,7 +34,7 @@ float *buffer;
 
 starpu_data_handle_t v_handle;
 
-static void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
+void dummy_codelet(void *descr[], __attribute__ ((unused)) void *_args)
 {
 }
 
@@ -48,6 +48,7 @@ static struct starpu_codelet cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {dummy_codelet, NULL},
 #endif
+	.cpu_funcs_name = {"dummy_codelet", NULL},
 	.nbuffers = 1
 };
 
@@ -67,7 +68,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 1 - 1
tests/datawizard/user_interaction_implicit.c

@@ -52,7 +52,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 5 - 3
tests/datawizard/write_only_tmp_buffer.c

@@ -56,7 +56,7 @@ static void cuda_codelet_null(void *descr[], __attribute__ ((unused)) void *_arg
 }
 #endif
 
-static void cpu_codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
+void cpu_codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -65,7 +65,7 @@ static void cpu_codelet_null(void *descr[], __attribute__ ((unused)) void *_args
 	*buf = 42;
 }
 
-static void display_var(void *descr[], __attribute__ ((unused)) void *_args)
+void display_var(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -86,6 +86,7 @@ static struct starpu_codelet cl =
 #ifdef STARPU_USE_OPENCL
 	.opencl_funcs = {opencl_codelet_null, NULL},
 #endif
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -93,6 +94,7 @@ static struct starpu_codelet cl =
 static struct starpu_codelet display_cl =
 {
 	.cpu_funcs = {display_var, NULL},
+	.cpu_funcs_name = {"display_var", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_R}
 };
@@ -102,7 +104,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 11 - 4
tests/errorcheck/invalid_blocking_calls.c

@@ -22,9 +22,9 @@
 #define TAG	0x42
 
 static starpu_data_handle_t handle;
-static unsigned data = 42;
+static unsigned *data;
 
-static void wrong_func(void *descr[], void *arg)
+void wrong_func(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -47,6 +47,7 @@ static struct starpu_codelet wrong_codelet =
 	.cpu_funcs = {wrong_func, NULL},
 	.cuda_funcs = {wrong_func, NULL},
         .opencl_funcs = {wrong_func, NULL},
+	.cpu_funcs_name = {"wrong_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -68,12 +69,15 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
+	starpu_malloc((void**)&data, sizeof(*data));
+	*data = 42;
+
 	/* register a piece of data */
-	starpu_vector_data_register(&handle, 0, (uintptr_t)&data,
+	starpu_vector_data_register(&handle, 0, (uintptr_t)data,
 						1, sizeof(unsigned));
 
 	struct starpu_task *task = starpu_task_create();
@@ -105,6 +109,9 @@ int main(int argc, char **argv)
 	ret = starpu_task_wait(task);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_wait");
 	starpu_data_unregister(handle);
+
+	starpu_free(data);
+
 	starpu_shutdown();
 
 	return EXIT_SUCCESS;

+ 5 - 1
tests/errorcheck/starpu_init_noworker.c

@@ -34,6 +34,8 @@ static void unset_env_variables(void)
 	(void) unsetenv("STARPU_NCPUS");
 	(void) unsetenv("STARPU_NCUDA");
 	(void) unsetenv("STARPU_NOPENCL");
+	(void) unsetenv("STARPU_NMIC");
+	(void) unsetenv("STARPU_NSCC");
 }
 
 int main(int argc, char **argv)
@@ -48,9 +50,11 @@ int main(int argc, char **argv)
 	conf.ncpus = 0;
 	conf.ncuda = 0;
 	conf.nopencl = 0;
+	conf.nmic = 0;
+	conf.nscc = 0;
 
 	/* starpu_init should return -ENODEV */
-	ret = starpu_init(&conf);
+	ret = starpu_initialize(&conf, &argc, &argv);
 	if (ret == -ENODEV)
 	     return EXIT_SUCCESS;
 	else

+ 1 - 1
tests/helper/cublas_init.c

@@ -32,7 +32,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 1 - 1
tests/helper/execute_on_all.c

@@ -32,7 +32,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 1 - 1
tests/helper/pinned_memory.c

@@ -28,7 +28,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/helper/starpu_create_sync_task.c

@@ -21,7 +21,7 @@
 
 #define NITER	10
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -30,6 +30,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
         .opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.nbuffers = 0
 };
 
@@ -49,7 +50,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 13 - 7
tests/helper/starpu_data_cpy.c

@@ -20,25 +20,27 @@
 int main(int argc, char **argv)
 {
 	int ret;
-	int var1, var2;
+	int *var1, *var2;
 	starpu_data_handle_t var1_handle, var2_handle;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
-	var1 = 42;
-	var2 = 12;
+	starpu_malloc((void**)&var1, sizeof(*var1));
+	starpu_malloc((void**)&var2, sizeof(*var2));
+	*var1 = 42;
+	*var2 = 12;
 
-	starpu_variable_data_register(&var1_handle, 0, (uintptr_t)&var1, sizeof(var1));
-	starpu_variable_data_register(&var2_handle, 0, (uintptr_t)&var2, sizeof(var2));
+	starpu_variable_data_register(&var1_handle, 0, (uintptr_t)var1, sizeof(*var1));
+	starpu_variable_data_register(&var2_handle, 0, (uintptr_t)var2, sizeof(*var2));
 
 	ret = starpu_data_cpy(var2_handle, var1_handle, 0, NULL, NULL);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_data_cpy");
 
 	starpu_data_acquire(var2_handle, STARPU_R);
 	ret = EXIT_SUCCESS;
-	if (var2 != var1)
+	if (*var2 != *var1)
 	{
 	     FPRINTF(stderr, "var2 is %d but it should be %d\n", var2, var1);
 	     ret = EXIT_FAILURE;
@@ -47,6 +49,10 @@ int main(int argc, char **argv)
 
 	starpu_data_unregister(var1_handle);
 	starpu_data_unregister(var2_handle);
+
+	starpu_free(var1);
+	starpu_free(var2);
+
 	starpu_shutdown();
 
 	STARPU_RETURN(ret);

+ 3 - 2
tests/main/declare_deps_after_submission.c

@@ -27,7 +27,7 @@
   #define NLOOPS	128
 #endif
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -36,6 +36,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -55,7 +56,7 @@ int main(int argc, char **argv)
 	int ret;
 	unsigned loop, nloops = NLOOPS;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/main/declare_deps_after_submission_synchronous.c

@@ -27,7 +27,7 @@
   #define NLOOPS	128
 #endif
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -36,6 +36,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -55,7 +56,7 @@ int main(int argc, char **argv)
 	int ret;
 	unsigned loop, nloops=NLOOPS;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/main/declare_deps_in_callback.c

@@ -41,7 +41,7 @@ static void callback(void *arg)
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 }
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -50,6 +50,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -69,7 +70,7 @@ int main(int argc, char **argv)
 	int ret;
 	unsigned loop;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 15 - 6
tests/main/deprecated_buffer.c

@@ -32,6 +32,7 @@ struct starpu_codelet cl_with_mode =
 {
 	.name = "with_mode",
 	.cpu_funcs = {cpu_codelet, NULL},
+	.cpu_funcs_name = {"cpu_codelet", NULL},
 	.nbuffers = 2,
 	.modes = {STARPU_R, STARPU_W},
 };
@@ -40,6 +41,7 @@ struct starpu_codelet cl_without_mode =
 {
 	.name = "without_mode",
 	.cpu_funcs = {cpu_codelet, NULL},
+	.cpu_funcs_name = {"cpu_codelet", NULL},
 	.nbuffers = 2
 };
 
@@ -104,12 +106,16 @@ struct submit_task_func
 
 int submit_codelet(struct starpu_codelet cl, struct submit_task_func func)
 {
-	int x=42, y=14;
+	int *x, *y;
+	starpu_malloc((void**)&x, sizeof(*x));
+	starpu_malloc((void**)&y, sizeof(*y));
+	*x = 42;
+	*y = 14;
 	starpu_data_handle_t handles[2];
 	int ret;
 
-	starpu_variable_data_register(&handles[0], 0, (uintptr_t)&x, sizeof(x));
-	starpu_variable_data_register(&handles[1], 0, (uintptr_t)&y, sizeof(y));
+	starpu_variable_data_register(&handles[0], 0, (uintptr_t)x, sizeof(*x));
+	starpu_variable_data_register(&handles[1], 0, (uintptr_t)y, sizeof(*y));
 
 	ret = func.func(cl, handles[0], handles[1]);
 	starpu_data_unregister(handles[0]);
@@ -117,8 +123,11 @@ int submit_codelet(struct starpu_codelet cl, struct submit_task_func func)
 
 	if (ret == -ENODEV) return ret;
 
-	FPRINTF(stderr, "%s when executing codelet <%s> with func <%s>\n", x==y?"success":"error", cl.name, func.name);
-	return (x != y);
+	FPRINTF(stderr, "%s when executing codelet <%s> with func <%s>\n", *x==*y?"success":"error", cl.name, func.name);
+	return (*x != *y);
+
+	starpu_free(x);
+	starpu_free(y);
 }
 
 int main(int argc, char **argv)
@@ -128,7 +137,7 @@ int main(int argc, char **argv)
 	struct submit_task_func with_buffers = { .func = submit_codelet_with_buffers, .name = "with_buffers" };
 	struct submit_task_func with_handles = { .func = submit_codelet_with_handles, .name = "with_handles" };
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 1 - 1
tests/main/empty_task.c

@@ -58,7 +58,7 @@ int main(int argc, char **argv)
 
 	parse_args(argc, argv);
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 1 - 1
tests/main/empty_task_chain.c

@@ -24,7 +24,7 @@ int main(int argc, char **argv)
 {
 	int i, ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/main/empty_task_sync_point.c

@@ -29,7 +29,7 @@ static starpu_tag_t tagD = 0x3042;
 static starpu_tag_t tagE = 0x4042;
 static starpu_tag_t tagF = 0x5042;
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -38,6 +38,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -46,7 +47,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/main/empty_task_sync_point_tasks.c

@@ -18,7 +18,7 @@
 #include <starpu.h>
 #include "../helper.h"
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -27,6 +27,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -35,7 +36,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 5 - 2
tests/main/execute_on_a_specific_worker.c

@@ -56,7 +56,7 @@ static void callback(void *arg)
 
 
 
-static void codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
+void codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
 {
 //	int id = starpu_worker_get_id();
 //	FPRINTF(stderr, "worker #%d\n", id);
@@ -67,6 +67,7 @@ static struct starpu_codelet cl_r =
 	.cpu_funcs = {codelet_null, NULL},
 	.cuda_funcs = {codelet_null, NULL},
         .opencl_funcs = {codelet_null, NULL},
+	.cpu_funcs_name = {"codelet_null", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_R}
 };
@@ -76,6 +77,7 @@ static struct starpu_codelet cl_w =
 	.cpu_funcs = {codelet_null, NULL},
 	.cuda_funcs = {codelet_null, NULL},
         .opencl_funcs = {codelet_null, NULL},
+	.cpu_funcs_name = {"codelet_null", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -85,6 +87,7 @@ static struct starpu_codelet cl_rw =
 	.cpu_funcs = {codelet_null, NULL},
 	.cuda_funcs = {codelet_null, NULL},
         .opencl_funcs = {codelet_null, NULL},
+	.cpu_funcs_name = {"codelet_null", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_RW}
 };
@@ -109,7 +112,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 4 - 6
tests/main/get_current_task.c

@@ -28,13 +28,9 @@ static unsigned ntasks = 64;
 static unsigned ntasks = 65536;
 #endif
 
-static void check_task_func(void *descr[], void *arg)
+void check_task_func(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
-
-	/* We check that the returned task is valid from the codelet */
-	struct starpu_task *task = (struct starpu_task *) arg;
-	STARPU_ASSERT(task == starpu_task_get_current());
 }
 
 static void check_task_callback(void *arg)
@@ -49,6 +45,7 @@ static struct starpu_codelet dummy_cl =
 	.cuda_funcs = {check_task_func, NULL},
 	.cpu_funcs = {check_task_func, NULL},
 	.opencl_funcs = {check_task_func, NULL},
+	.cpu_funcs_name = {"check_task_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -57,7 +54,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
@@ -72,6 +69,7 @@ int main(int argc, char **argv)
 		 * the callback */
 		task->cl = &dummy_cl;
 		task->cl_arg = task;
+		task->cl_arg_size = sizeof(task);
 
 		task->callback_func = check_task_callback;
 		task->callback_arg = task;

+ 16 - 9
tests/main/insert_task.c

@@ -44,27 +44,31 @@ struct starpu_codelet mycodelet =
 {
 	.modes = { STARPU_RW, STARPU_RW },
 	.cpu_funcs = {func_cpu, NULL},
+	.cpu_funcs_name = {"func_cpu", NULL},
         .nbuffers = 2
 };
 
 int main(int argc, char **argv)
 {
-        int x; float f;
+        int *x; float *f;
         int i, ret;
 	int ifactor=12;
 	float ffactor=10.0;
         starpu_data_handle_t data_handles[2];
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
-	x = 1;
-	starpu_variable_data_register(&data_handles[0], 0, (uintptr_t)&x, sizeof(x));
-	f = 2.0;
-	starpu_variable_data_register(&data_handles[1], 0, (uintptr_t)&f, sizeof(f));
+	starpu_malloc((void**)&x, sizeof(*x));
+	*x = 1;
+	starpu_variable_data_register(&data_handles[0], 0, (uintptr_t)x, sizeof(*x));
 
-        FPRINTF(stderr, "VALUES: %d (%d) %f (%f)\n", x, ifactor, f, ffactor);
+	starpu_malloc((void**)&f, sizeof(*f));
+	*f = 2.0;
+	starpu_variable_data_register(&data_handles[1], 0, (uintptr_t)f, sizeof(*f));
+
+        FPRINTF(stderr, "VALUES: %d (%d) %f (%f)\n", *x, ifactor, *f, ffactor);
 
         ret = starpu_insert_task(&mycodelet,
 				 STARPU_VALUE, &ifactor, sizeof(ifactor),
@@ -82,7 +86,7 @@ int main(int argc, char **argv)
                 ret = starpu_data_acquire(data_handles[i], STARPU_R);
 		STARPU_CHECK_RETURN_VALUE(ret, "starpu_data_acquire");
         }
-        FPRINTF(stderr, "VALUES: %d %f\n", x, f);
+	FPRINTF(stderr, "VALUES: %d %f\n", *x, *f);
 
         for(i=0 ; i<2 ; i++)
 	{
@@ -110,7 +114,7 @@ int main(int argc, char **argv)
                 ret = starpu_data_acquire(data_handles[i], STARPU_R);
 		STARPU_CHECK_RETURN_VALUE(ret, "starpu_data_acquire");
         }
-        FPRINTF(stderr, "VALUES: %d %f\n", x, f);
+	FPRINTF(stderr, "VALUES: %d %f\n", *x, *f);
 
         for(i=0 ; i<2 ; i++)
 	{
@@ -118,6 +122,9 @@ int main(int argc, char **argv)
 		starpu_data_unregister(data_handles[i]);
         }
 
+	starpu_free(x);
+	starpu_free(f);
+
 	starpu_shutdown();
 
 	return EXIT_SUCCESS;

+ 3 - 2
tests/main/multithreaded.c

@@ -32,7 +32,7 @@ static unsigned ntasks = 65536;
 #endif
 static unsigned nthreads = 2;
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -41,6 +41,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -103,7 +104,7 @@ int main(int argc, char **argv)
 
 	parse_args(argc, argv);
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 7 - 1
tests/main/multithreaded_init.c

@@ -21,11 +21,14 @@
 
 #define NUM_THREADS 5
 
+int *glob_argc;
+char ***glob_argv;
+
 void *launch_starpu(void *unused)
 {
 	int ret;
 	(void) unused;
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, glob_argc, glob_argv);
 	if (ret == -ENODEV)
 		exit(STARPU_TEST_SKIPPED);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
@@ -46,6 +49,9 @@ int main(int argc, char **argv)
 	struct timeval start;
 	struct timeval end;
 
+	glob_argc = &argc;
+	glob_argv = &argv;
+
 	starpu_pthread_t threads[NUM_THREADS];
 
 	gettimeofday(&start, NULL);

+ 3 - 2
tests/main/regenerate.c

@@ -51,7 +51,7 @@ static void callback(void *arg __attribute__ ((unused)))
 	}
 }
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -60,6 +60,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -86,7 +87,7 @@ int main(int argc, char **argv)
 
 	parse_args(argc, argv);
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 1 - 1
tests/main/restart.c

@@ -45,7 +45,7 @@ int main(int argc, char **argv)
 	{
 		gettimeofday(&start, NULL);
 		/* Initialize StarPU */
-		ret = starpu_init(NULL);
+		ret = starpu_initialize(NULL, &argc, &argv);
 		gettimeofday(&end, NULL);
 		if (ret == -ENODEV)
 			goto enodev;

+ 9 - 5
tests/main/starpu_task_bundle.c

@@ -36,6 +36,7 @@ struct starpu_codelet codelet =
 {
 	.modes = {STARPU_RW},
 	.cpu_funcs = {func_cpu, NULL},
+	.cpu_funcs_name = {"func_cpu", NULL},
         .nbuffers = 1
 };
 
@@ -43,7 +44,12 @@ int main(int argc, char **argv)
 {
         int i, j, ret;
 
-	float data[NB_BUNDLE];
+	ret = starpu_initialize(NULL, &argc, &argv);
+	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_initialize");
+
+	float *data;
+	starpu_malloc((void**)&data, sizeof(*data) * NB_BUNDLE);
 	float factors[NB_BUNDLE];
         starpu_data_handle_t handles[NB_BUNDLE];
 
@@ -57,10 +63,6 @@ int main(int argc, char **argv)
 		factors[i] = NB_BUNDLE - i;
 	}
 
-	ret = starpu_init(NULL);
-	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
-
 	for (i = 0; i < NB_BUNDLE; i++)
 		starpu_variable_data_register(&handles[i], 0, (uintptr_t)&data[i], sizeof(float));
 
@@ -121,6 +123,8 @@ int main(int argc, char **argv)
 		starpu_data_unregister(handles[i]);
 	}
 
+		starpu_free(data);
+
 	starpu_shutdown();
 
 	return EXIT_SUCCESS;

+ 3 - 2
tests/main/starpu_task_wait.c

@@ -28,7 +28,7 @@ static unsigned ntasks = 64;
 static unsigned ntasks = 65536;
 #endif
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -37,6 +37,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -75,7 +76,7 @@ int main(int argc, char **argv)
 	if(RUNNING_ON_VALGRIND) ntasks = 5;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/main/starpu_task_wait_for_all.c

@@ -27,7 +27,7 @@ static unsigned ntasks = 64;
 static unsigned ntasks = 65536;
 #endif
 
-static void dummy_func(void *descr[], void *arg)
+void dummy_func(void *descr[], void *arg)
 {
 }
 
@@ -36,6 +36,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -90,7 +91,7 @@ int main(int argc, char **argv)
 
 	parse_args(argc, argv, &conf);
 
-	ret = starpu_init(&conf);
+	ret = starpu_initialize(&conf, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 4 - 3
tests/main/starpu_worker_exists.c

@@ -40,7 +40,7 @@ static int can_never_execute(unsigned workerid,
 	return 0;
 }
 
-static void fake(void *buffers[], void *args)
+void fake(void *buffers[], void *args)
 {
 	(void) buffers;
 	(void) args;
@@ -51,16 +51,17 @@ static struct starpu_codelet cl =
 	.cpu_funcs    = { fake, NULL},
 	.cuda_funcs   = { fake, NULL},
 	.opencl_funcs = { fake, NULL},
+	.cpu_funcs_name = { "fake", NULL},
 	.nbuffers     = 0
 };
 
 int
-main(void)
+main(int argc, char **argv)
 {
 	int ret;
 	struct starpu_task *task;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 
 	task = starpu_task_create();

+ 3 - 2
tests/main/static_restartable.c

@@ -28,7 +28,7 @@ static unsigned ntasks = 64;
 static unsigned ntasks = 65536;
 #endif
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -37,6 +37,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
 	.nbuffers = 0
 };
@@ -70,7 +71,7 @@ int main(int argc, char **argv)
 	if(RUNNING_ON_VALGRIND) ntasks = 5;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/main/static_restartable_tag.c

@@ -30,7 +30,7 @@ static unsigned ntasks = 65536;
 #endif
 static starpu_tag_t tag = 0x32;
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -39,6 +39,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -72,7 +73,7 @@ int main(int argc, char **argv)
 	if(RUNNING_ON_VALGRIND) ntasks = 5;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/main/static_restartable_using_initializer.c

@@ -31,7 +31,7 @@ static unsigned ntasks = 64;
 static unsigned ntasks = 65536;
 #endif
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -40,6 +40,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -71,7 +72,7 @@ int main(int argc, char **argv)
 	if(RUNNING_ON_VALGRIND) ntasks = 5;
 #endif
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 30 - 6
tests/main/subgraph_repeat.c

@@ -45,13 +45,14 @@ static unsigned niter = 16384;
 static struct starpu_task taskA, taskB, taskC, taskD;
 
 static unsigned loop_cnt = 0;
-static unsigned check_cnt = 0;
+static unsigned *check_cnt;
 static starpu_pthread_cond_t cond = STARPU_PTHREAD_COND_INITIALIZER;
 static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[], void *arg __attribute__ ((unused)))
 {
-	(void) STARPU_ATOMIC_ADD(&check_cnt, 1);
+	unsigned *tmp = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[0]);
+	(*tmp)++;
 }
 
 static struct starpu_codelet dummy_codelet =
@@ -59,8 +60,10 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
-	.nbuffers = 0
+	.modes = { STARPU_RW },
+	.nbuffers = 1
 };
 
 static void callback_task_D(void *arg __attribute__((unused)))
@@ -94,26 +97,42 @@ int main(int argc, char **argv)
 //	struct timeval end;
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
+	starpu_data_set_default_sequential_consistency_flag(0);
+
+	starpu_malloc((void**)&check_cnt, sizeof(*check_cnt));
+	*check_cnt = 0;
+
+	starpu_data_handle_t check_data;
+	starpu_variable_data_register(&check_data, 0, (uintptr_t)check_cnt, sizeof(*check_cnt));
+
 	starpu_task_init(&taskA);
 	taskA.cl = &dummy_codelet;
 	taskA.cl_arg = &taskA;
+	taskA.cl_arg_size = sizeof(&taskA);
+	taskA.handles[0] = check_data;
 
 	starpu_task_init(&taskB);
 	taskB.cl = &dummy_codelet;
 	taskB.cl_arg = &taskB;
+	taskB.cl_arg_size = sizeof(&taskB);
+	taskB.handles[0] = check_data;
 
 	starpu_task_init(&taskC);
 	taskC.cl = &dummy_codelet;
 	taskC.cl_arg = &taskC;
+	taskC.cl_arg_size = sizeof(&taskC);
+	taskC.handles[0] = check_data;
 
 	starpu_task_init(&taskD);
 	taskD.cl = &dummy_codelet;
 	taskD.cl_arg = &taskD;
+	taskD.cl_arg_size = sizeof(&taskD);
 	taskD.callback_func = callback_task_D;
+	taskD.handles[0] = check_data;
 
 	struct starpu_task *depsBC_array[1] = {&taskA};
 	starpu_task_declare_deps_array(&taskB, 1, depsBC_array);
@@ -133,7 +152,12 @@ int main(int argc, char **argv)
 		STARPU_PTHREAD_COND_WAIT(&cond, &mutex);
 	STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
 
-	STARPU_ASSERT(check_cnt == (4*loop_cnt));
+	starpu_data_acquire(check_data, STARPU_R);
+	starpu_data_release(check_data);
+
+	STARPU_ASSERT(*check_cnt == (4*loop_cnt));
+
+	starpu_free(check_cnt);
 
 	starpu_shutdown();
 

+ 29 - 6
tests/main/subgraph_repeat_regenerate.c

@@ -45,13 +45,14 @@ static unsigned niter = 16384;
 static struct starpu_task taskA, taskB, taskC, taskD;
 
 static unsigned loop_cnt = 0;
-static unsigned check_cnt = 0;
+static unsigned *check_cnt;
 static starpu_pthread_cond_t cond = STARPU_PTHREAD_COND_INITIALIZER;
 static starpu_pthread_mutex_t mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
-	(void) STARPU_ATOMIC_ADD(&check_cnt, 1);
+	unsigned *tmp = (unsigned *)STARPU_VARIABLE_GET_PTR(descr[0]);
+	(*tmp)++;
 }
 
 static struct starpu_codelet dummy_codelet =
@@ -59,8 +60,10 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
-	.nbuffers = 0
+	.modes = { STARPU_RW },
+	.nbuffers = 1
 };
 
 static void callback_task_D(void *arg __attribute__((unused)))
@@ -93,33 +96,47 @@ int main(int argc, char **argv)
 //	struct timeval end;
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	/* Implicit data dependencies and regeneratable tasks are not compatible */
 	starpu_data_set_default_sequential_consistency_flag(0);
 
+	starpu_malloc((void**)&check_cnt, sizeof(*check_cnt));
+	*check_cnt = 0;
+
+	starpu_data_handle_t check_data;
+	starpu_variable_data_register(&check_data, 0, (uintptr_t)check_cnt, sizeof(*check_cnt));
+
 	starpu_task_init(&taskA);
 	taskA.cl = &dummy_codelet;
 	taskA.cl_arg = &taskA;
+	taskA.cl_arg_size = sizeof(&taskA);
 	taskA.regenerate = 0; /* this task will be explicitely resubmitted if needed */
+	taskA.handles[0] = check_data;
 
 	starpu_task_init(&taskB);
 	taskB.cl = &dummy_codelet;
 	taskB.cl_arg = &taskB;
+	taskB.cl_arg_size = sizeof(&taskB);
 	taskB.regenerate = 1;
+	taskB.handles[0] = check_data;
 
 	starpu_task_init(&taskC);
 	taskC.cl = &dummy_codelet;
 	taskC.cl_arg = &taskC;
+	taskC.cl_arg_size = sizeof(&taskC);
 	taskC.regenerate = 1;
+	taskC.handles[0] = check_data;
 
 	starpu_task_init(&taskD);
 	taskD.cl = &dummy_codelet;
 	taskD.cl_arg = &taskD;
+	taskD.cl_arg_size = sizeof(&taskD);
 	taskD.callback_func = callback_task_D;
 	taskD.regenerate = 1;
+	taskD.handles[0] = check_data;
 
 	struct starpu_task *depsBC_array[1] = {&taskA};
 	starpu_task_declare_deps_array(&taskB, 1, depsBC_array);
@@ -139,7 +156,13 @@ int main(int argc, char **argv)
 		STARPU_PTHREAD_COND_WAIT(&cond, &mutex);
 	STARPU_PTHREAD_MUTEX_UNLOCK(&mutex);
 
-	STARPU_ASSERT(check_cnt == (4*loop_cnt));
+	starpu_data_acquire(check_data, STARPU_R);
+	starpu_data_release(check_data);
+
+	printf("%d\n", *check_cnt);
+	STARPU_ASSERT(*check_cnt == (4*loop_cnt));
+
+	starpu_free(check_cnt);
 
 	starpu_shutdown();
 

+ 3 - 2
tests/main/tag_wait_api.c

@@ -21,7 +21,7 @@
 #include <starpu.h>
 #include "../helper.h"
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -30,6 +30,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -75,7 +76,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/main/task_wait_api.c

@@ -21,7 +21,7 @@
 #include <starpu.h>
 #include "../helper.h"
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -30,6 +30,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
         .model = NULL,
 	.nbuffers = 0
 };
@@ -49,7 +50,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/main/wait_all_regenerable_tasks.c

@@ -39,7 +39,7 @@ static void callback(void *arg)
 		task->regenerate = 0;
 }
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -48,6 +48,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -75,7 +76,7 @@ int main(int argc, char **argv)
 
 	parse_args(argc, argv);
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/microbenchs/async_tasks_overhead.c

@@ -29,7 +29,7 @@ static double cumulated = 0.0;
 static double cumulated_push = 0.0;
 static double cumulated_pop = 0.0;
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -38,6 +38,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
         .opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -91,7 +92,7 @@ int main(int argc, char **argv)
 
 	parse_args(argc, argv, &conf);
 
-	ret = starpu_init(&conf);
+	ret = starpu_initialize(&conf, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 1 - 1
tests/microbenchs/local_pingpong.c

@@ -46,7 +46,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 5 - 2
tests/microbenchs/prefetch_data_on_node.c

@@ -40,7 +40,7 @@ static void callback(void *arg)
 	starpu_data_prefetch_on_node(v_handle, node, 1);
 }
 
-static void codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
+void codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
 {
 //	fprintf(stderr, "pif\n");
 //	fflush(stderr);
@@ -51,6 +51,7 @@ static struct starpu_codelet cl_r =
 	.cpu_funcs = {codelet_null, NULL},
 	.cuda_funcs = {codelet_null, NULL},
 	.opencl_funcs = {codelet_null, NULL},
+	.cpu_funcs_name = {"codelet_null", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_R}
 };
@@ -60,6 +61,7 @@ static struct starpu_codelet cl_w =
 	.cpu_funcs = {codelet_null, NULL},
 	.cuda_funcs = {codelet_null, NULL},
 	.opencl_funcs = {codelet_null, NULL},
+	.cpu_funcs_name = {"codelet_null", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_W}
 };
@@ -69,6 +71,7 @@ static struct starpu_codelet cl_rw =
 	.cpu_funcs = {codelet_null, NULL},
 	.cuda_funcs = {codelet_null, NULL},
 	.opencl_funcs = {codelet_null, NULL},
+	.cpu_funcs_name = {"codelet_null", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_RW}
 };
@@ -93,7 +96,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/microbenchs/redundant_buffer.c

@@ -37,7 +37,7 @@ static void cuda_codelet_null(void *descr[], __attribute__ ((unused)) void *_arg
 {
 }
 
-static void cpu_codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
+void cpu_codelet_null(void *descr[], __attribute__ ((unused)) void *_args)
 {
 }
 
@@ -46,6 +46,7 @@ static struct starpu_codelet cl =
 	.cpu_funcs = {cpu_codelet_null, NULL},
 	.cuda_funcs = {cuda_codelet_null, NULL},
 	.opencl_funcs = {opencl_codelet_null, NULL},
+	.cpu_funcs_name = {"cpu_codelet_null", NULL},
         .nbuffers = 2,
 	.modes = {STARPU_R, STARPU_R}
 };
@@ -55,7 +56,7 @@ int main(int argc, char **argv)
 {
 	int ret;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/microbenchs/sync_tasks_overhead.c

@@ -24,7 +24,7 @@
 
 static unsigned ntasks = 65536;
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -33,6 +33,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
         .opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0
 };
@@ -80,7 +81,7 @@ int main(int argc, char **argv)
 
 	parse_args(argc, argv);
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 4 - 3
tests/microbenchs/tasks_overhead.c

@@ -34,7 +34,7 @@ static unsigned nbuffers = 0;
 
 struct starpu_task *tasks;
 
-static void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
+void dummy_func(void *descr[] __attribute__ ((unused)), void *arg __attribute__ ((unused)))
 {
 }
 
@@ -43,6 +43,7 @@ static struct starpu_codelet dummy_codelet =
 	.cpu_funcs = {dummy_func, NULL},
 	.cuda_funcs = {dummy_func, NULL},
 	.opencl_funcs = {dummy_func, NULL},
+	.cpu_funcs_name = {"dummy_func", NULL},
 	.model = NULL,
 	.nbuffers = 0,
 	.modes = {STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW, STARPU_RW}
@@ -96,14 +97,14 @@ int main(int argc, char **argv)
 
 	parse_args(argc, argv);
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	unsigned buffer;
 	for (buffer = 0; buffer < nbuffers; buffer++)
 	{
-		buffers[buffer] = (float *) malloc(16*sizeof(float));
+		starpu_malloc((void**)&buffers[buffer], 16*sizeof(float));
 		starpu_vector_data_register(&data_handles[buffer], 0, (uintptr_t)buffers[buffer], 16, sizeof(float));
 	}
 

+ 3 - 2
tests/overlap/overlap.c

@@ -54,7 +54,7 @@ static void callback(void *arg)
 	}
 }
 
-static void codelet_sleep(void *descr[], __attribute__ ((unused)) void *_args)
+void codelet_sleep(void *descr[], __attribute__ ((unused)) void *_args)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -72,6 +72,7 @@ static struct starpu_codelet cl =
 	.cpu_funcs = {codelet_sleep, NULL},
 	.cuda_funcs = {codelet_sleep, NULL},
         .opencl_funcs = {codelet_sleep, NULL},
+	.cpu_funcs_name = {"codelet_sleep", NULL},
 	.nbuffers = 1,
 	.modes = {STARPU_R},
 	.model =  &model
@@ -85,7 +86,7 @@ int main(int argc, char **argv)
 	starpu_data_handle_t handle;
 	float *buffer;
 
-	ret = starpu_init(NULL);
+	ret = starpu_initialize(NULL, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 3 - 2
tests/perfmodels/non_linear_regression_based.c

@@ -33,7 +33,7 @@ static void memset_cuda(void *descr[], void *arg)
 }
 #endif
 
-static void memset_cpu(void *descr[], void *arg)
+void memset_cpu(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -62,6 +62,7 @@ static struct starpu_codelet memset_cl =
 	.opencl_funcs = {memset_opencl, NULL},
 #endif
 	.cpu_funcs = {memset_cpu, NULL},
+	.cpu_funcs_name = {"memset_cpu", NULL},
 	.model = &model,
 	.nbuffers = 1,
 	.modes = {STARPU_W}
@@ -105,7 +106,7 @@ int main(int argc, char **argv)
 	conf.sched_policy_name = "eager";
 	conf.calibrate = 2;
 
-	ret = starpu_init(&conf);
+	ret = starpu_initialize(&conf, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 

+ 4 - 2
tests/perfmodels/regression_based.c

@@ -38,7 +38,7 @@ static void memset_cuda(void *descr[], void *arg)
 extern void memset_opencl(void *buffers[], void *args);
 #endif
 
-static void memset_cpu(void *descr[], void *arg)
+void memset_cpu(void *descr[], void *arg)
 {
 	STARPU_SKIP_IF_VALGRIND;
 
@@ -69,6 +69,7 @@ static struct starpu_codelet memset_cl =
 	.opencl_funcs = {memset_opencl, NULL},
 #endif
 	.cpu_funcs = {memset_cpu, NULL},
+	.cpu_funcs_name = {"memset_cpu", NULL},
 	.model = &model,
 	.nbuffers = 1,
 	.modes = {STARPU_W}
@@ -83,6 +84,7 @@ static struct starpu_codelet nl_memset_cl =
 	.opencl_funcs = {memset_opencl, NULL},
 #endif
 	.cpu_funcs = {memset_cpu, NULL},
+	.cpu_funcs_name = {"memset_cpu", NULL},
 	.model = &nl_model,
 	.nbuffers = 1,
 	.modes = {STARPU_W}
@@ -143,7 +145,7 @@ int main(int argc, char **argv)
 	conf.sched_policy_name = "eager";
 	conf.calibrate = 2;
 
-	ret = starpu_init(&conf);
+	ret = starpu_initialize(&conf, &argc, &argv);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");