浏览代码

mic (perfmodels): merge trunk

Thibaud Lambert 11 年之前
父节点
当前提交
e2dd19c39c

+ 4 - 1
ChangeLog

@@ -47,6 +47,9 @@ New features:
     _STARPU_PERFMODEL_VERSION should be updated. It is then possible
     _STARPU_PERFMODEL_VERSION should be updated. It is then possible
     to switch easily between differents versions of StarPU having
     to switch easily between differents versions of StarPU having
     different performance model formats.
     different performance model formats.
+  * Tasks can now define a optional prologue callback which is executed
+    on the host when the task becomes ready for execution, before getting
+    scheduled.
 
 
 Small features:
 Small features:
   * Add cl_arg_free field to enable automatic free(cl_arg) on task
   * Add cl_arg_free field to enable automatic free(cl_arg) on task
@@ -60,7 +63,7 @@ Small features:
     storing performance models. Available through the new option -d of
     storing performance models. Available through the new option -d of
     the tool starpu_perfmodel_display
     the tool starpu_perfmodel_display
   * New batch files to execute StarPU applications under Microsoft
   * New batch files to execute StarPU applications under Microsoft
-    Visual Studio (They are installed in path_to_starpu/bin/msvc)/
+    Visual Studio (They are installed in path_to_starpu/bin/mvsc)/
 
 
 Changes:
 Changes:
   * Fix of the livelock issue discovered while executing applications
   * Fix of the livelock issue discovered while executing applications

+ 4 - 4
INSTALL

@@ -220,14 +220,14 @@ Running StarPU Applications on Microsoft Visual C
 -------------------------------------------------
 -------------------------------------------------
 
 
 Batch files are provided to run StarPU applications under Microsoft
 Batch files are provided to run StarPU applications under Microsoft
-Visual C. They are installed in path_to_starpu/bin/msvc.
+Visual C. They are installed in path_to_starpu/bin/mvsc.
 
 
 To execute a StarPU application, you first need to set the environment
 To execute a StarPU application, you first need to set the environment
 variable STARPUPATH.
 variable STARPUPATH.
 
 
 c:\....> cd c:\cygwin\home\ci\starpu\
 c:\....> cd c:\cygwin\home\ci\starpu\
 c:\....> set STARPUPATH=c:\cygwin\home\ci\starpu\
 c:\....> set STARPUPATH=c:\cygwin\home\ci\starpu\
-c:\....> cd bin\msvc
+c:\....> cd bin\mvsc
 c:\....> starpu_open.bat starpu_simple.c
 c:\....> starpu_open.bat starpu_simple.c
 
 
 The batch script will run Microsoft Visual C with a basic project file
 The batch script will run Microsoft Visual C with a basic project file
@@ -241,10 +241,10 @@ StarPU application from the command prompt.
 
 
 c:\....> cd c:\cygwin\home\ci\starpu\
 c:\....> cd c:\cygwin\home\ci\starpu\
 c:\....> set STARPUPATH=c:\cygwin\home\ci\starpu\
 c:\....> set STARPUPATH=c:\cygwin\home\ci\starpu\
-c:\....> cd bin\msvc
+c:\....> cd bin\mvsc
 c:\....> starpu_exec.bat ..\..\..\..\examples\basic_examples\hello_world.c
 c:\....> starpu_exec.bat ..\..\..\..\examples\basic_examples\hello_world.c
 
 
-MSVS StarPU Execution
+MVSC StarPU Execution
 ...
 ...
 /out:hello_world.exe
 /out:hello_world.exe
 ...
 ...

+ 2 - 5
Makefile.am

@@ -19,10 +19,7 @@ CLEANFILES = *.gcno *.gcda *.linkinfo
 
 
 SUBDIRS = src
 SUBDIRS = src
 SUBDIRS += tools tests
 SUBDIRS += tools tests
-
-if BUILD_DOC
-SUBDIRS += doc/doxygen
-endif
+SUBDIRS += doc
 
 
 if USE_MPI
 if USE_MPI
 SUBDIRS += mpi
 SUBDIRS += mpi
@@ -49,7 +46,7 @@ SUBDIRS += sc_hypervisor
 endif
 endif
 
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libstarpu.pc starpu-1.0.pc starpu-1.1.pc
+pkgconfig_DATA = libstarpu.pc starpu-1.0.pc starpu-1.1.pc starpu-1.2.pc
 
 
 versincludedir = $(includedir)/starpu/$(STARPU_EFFECTIVE_VERSION)
 versincludedir = $(includedir)/starpu/$(STARPU_EFFECTIVE_VERSION)
 versinclude_HEADERS = 				\
 versinclude_HEADERS = 				\

+ 5 - 0
configure.ac

@@ -2356,13 +2356,16 @@ AC_OUTPUT([
 	libstarpu.pc
 	libstarpu.pc
 	starpu-1.0.pc
 	starpu-1.0.pc
 	starpu-1.1.pc
 	starpu-1.1.pc
+	starpu-1.2.pc
 	mpi/libstarpumpi.pc
 	mpi/libstarpumpi.pc
 	mpi/starpumpi-1.0.pc
 	mpi/starpumpi-1.0.pc
 	mpi/starpumpi-1.1.pc
 	mpi/starpumpi-1.1.pc
+	mpi/starpumpi-1.2.pc
 	starpufft/Makefile
 	starpufft/Makefile
 	starpufft/libstarpufft.pc
 	starpufft/libstarpufft.pc
 	starpufft/starpufft-1.0.pc
 	starpufft/starpufft-1.0.pc
 	starpufft/starpufft-1.1.pc
 	starpufft/starpufft-1.1.pc
+	starpufft/starpufft-1.2.pc
 	examples/Makefile
 	examples/Makefile
 	examples/stencil/Makefile
 	examples/stencil/Makefile
 	tests/Makefile
 	tests/Makefile
@@ -2382,9 +2385,11 @@ AC_OUTPUT([
 	sc_hypervisor/Makefile
 	sc_hypervisor/Makefile
 	sc_hypervisor/src/Makefile
 	sc_hypervisor/src/Makefile
 	sc_hypervisor/examples/Makefile
 	sc_hypervisor/examples/Makefile
+	doc/Makefile
 	doc/doxygen/Makefile
 	doc/doxygen/Makefile
 	doc/doxygen/doxygen-config.cfg
 	doc/doxygen/doxygen-config.cfg
 	doc/doxygen/doxygen_filter.sh
 	doc/doxygen/doxygen_filter.sh
+	tools/mvsc/starpu_var.bat
 ])
 ])
 
 
 AC_MSG_NOTICE([
 AC_MSG_NOTICE([

+ 30 - 0
doc/Makefile.am

@@ -0,0 +1,30 @@
+# StarPU --- Runtime system for heterogeneous multicore architectures.
+#
+# Copyright (C) 2013  Centre National de la Recherche Scientifique
+#
+# Permission is granted to copy, distribute and/or modify this document
+# under the terms of the GNU Free Documentation License, Version 1.3
+# or any later version published by the Free Software Foundation;
+# with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+#
+# See the GNU Free Documentation License in COPYING.GFDL for more details.
+
+if BUILD_DOC
+SUBDIRS = doxygen
+endif
+
+EXTRA_DIST =    tutorial/hello_world.c \
+		tutorial/hello_world_plugin.c \
+		tutorial/hello_world_mvsc.c \
+		tutorial/Makefile \
+		tutorial/README \
+		tutorial/vector_scal.c \
+		tutorial/vector_scal_cpu.c \
+		tutorial/vector_scal_cuda.cu \
+		tutorial/vector_scal_opencl.c \
+		tutorial/vector_scal_opencl_kernel.cl \
+		tutorial/vector_scal_plugin.c \
+		tutorial/vector_scal_plugin_cuda.cu
+
+txtdir = ${docdir}/tutorial
+txt_DATA = $(EXTRA_DIST)

+ 15 - 0
doc/doxygen/chapters/api/codelet_and_tasks.doxy

@@ -406,6 +406,21 @@ Optional field, the default value is <c>NULL</c>. This is the pointer
 passed to the callback function. This field is ignored if the field
 passed to the callback function. This field is ignored if the field
 starpu_task::callback_func is set to <c>NULL</c>.
 starpu_task::callback_func is set to <c>NULL</c>.
 
 
+\var starpu_task::prologue_func
+Optional field, the default value is <c>NULL</c>. This is a function
+pointer of prototype <c>void (*f)(void *)</c> which specifies a
+possible callback. 
+If this pointer is non-null, the callback function
+is executed on the host when the task becomes ready for execution,
+before getting scheduled. The callback is passed the
+value contained in the starpu_task::prologue_arg field. No callback is
+executed if the field is set to NULL.
+
+\var starpu_task::prologue_arg (optional) (default: NULL)
+Optional field, the default value is <c>NULL</c>. This is the pointer
+passed to the prologue function. This field is ignored if the field
+starpu_task::prologue_func is set to <c>NULL</c>.
+
 \var starpu_task::use_tag
 \var starpu_task::use_tag
 Optional field, the default value is 0. If set, this flag indicates
 Optional field, the default value is 0. If set, this flag indicates
 that the task should be associated with the tag contained in the
 that the task should be associated with the tag contained in the

+ 77 - 0
doc/tutorial/hello_world_mvsc.c

@@ -0,0 +1,77 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
+ * Copyright (C) 2010-2011, 2013  Centre National de la Recherche Scientifique
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <starpu.h>
+
+struct params
+{
+	int i;
+	float f;
+};
+
+void cpu_func(void *buffers[], void *cl_arg)
+{
+	struct params *params = cl_arg;
+
+	printf("Hello world (params = {%i, %f} )\n", params->i, params->f);
+}
+
+void callback_func(void *callback_arg)
+{
+	printf("Callback function (arg %x)\n", callback_arg);
+}
+
+int main(int argc, char **argv)
+{
+	int ret;
+	struct starpu_codelet cl;
+	struct starpu_task *task;
+	struct params params;
+
+	starpu_codelet_init(&cl);
+	cl.cpu_funcs[0] = cpu_func;
+	cl.cpu_funcs[1] = NULL;
+	cl.nbuffers = 0;
+
+	/* initialize StarPU */
+	ret = starpu_init(NULL);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+
+	task = starpu_task_create();
+
+	task->cl = &cl; /* Pointer to the codelet defined above */
+
+	params.i = 1;
+	params.f = 2.0f;
+	task->cl_arg = &params;
+	task->cl_arg_size = sizeof(params);
+
+	task->callback_func = callback_func;
+	task->callback_arg = (void*) (uintptr_t) 0x42;
+
+	/* starpu_task_submit will be a blocking call */
+	task->synchronous = 1;
+
+	/* submit the task to StarPU */
+	ret = starpu_task_submit(task);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+
+	/* terminate StarPU */
+	starpu_shutdown();
+
+	return 0;
+}

+ 2 - 0
examples/Makefile.am

@@ -182,6 +182,7 @@ examplebin_PROGRAMS +=				\
 	spmd/vector_scal_spmd			\
 	spmd/vector_scal_spmd			\
 	spmv/spmv				\
 	spmv/spmv				\
 	callback/callback			\
 	callback/callback			\
+	callback/prologue			\
 	incrementer/incrementer			\
 	incrementer/incrementer			\
 	binary/binary				\
 	binary/binary				\
 	interface/complex			\
 	interface/complex			\
@@ -256,6 +257,7 @@ STARPU_EXAMPLES +=				\
 	spmd/vector_scal_spmd			\
 	spmd/vector_scal_spmd			\
 	spmv/spmv				\
 	spmv/spmv				\
 	callback/callback			\
 	callback/callback			\
+	callback/prologue			\
 	incrementer/incrementer			\
 	incrementer/incrementer			\
 	binary/binary				\
 	binary/binary				\
 	interface/complex			\
 	interface/complex			\

+ 102 - 0
examples/callback/prologue.c

@@ -0,0 +1,102 @@
+/* StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2009, 2010, 2013  Université de Bordeaux 1
+ * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+
+#include <starpu.h>
+#include <sys/time.h>
+
+#define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
+
+starpu_data_handle_t handle;
+
+void cpu_codelet(void *descr[], STARPU_ATTRIBUTE_UNUSED void *_args)
+{
+	int *val = (int *)STARPU_VARIABLE_GET_PTR(descr[0]);
+
+	*val += 1;
+}
+
+struct starpu_codelet cl =
+{
+	.modes = { STARPU_RW },
+	.cpu_funcs = {cpu_codelet, NULL},
+	.nbuffers = 1,
+	.name = "callback"
+};
+
+void callback_func(void *callback_arg)
+{
+	int ret;
+
+	struct starpu_task *task = starpu_task_create();
+	task->cl = &cl;
+	task->handles[0] = handle;
+
+	ret = starpu_task_submit(task);
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+}
+
+void prologue_callback_func(void *callback_arg)
+{
+	int *x = (int*)callback_arg;
+	printf("x = %d\n", *x);
+}
+
+
+int main(int argc, char **argv)
+{
+	int v=40;
+	int ret;
+
+	ret = starpu_init(NULL);
+	if (ret == -ENODEV)
+		return 77;
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+
+	starpu_variable_data_register(&handle, STARPU_MAIN_RAM, (uintptr_t)&v, sizeof(int));
+
+	struct starpu_task *task = starpu_task_create();
+	task->cl = &cl;
+	task->prologue_callback_func = callback_func;
+	task->prologue_callback_arg = NULL;
+	task->handles[0] = handle;
+
+	ret = starpu_task_submit(task);
+	if (ret == -ENODEV) goto enodev;
+	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+
+	int *x = (int*)malloc(sizeof(int));
+	*x = -999;
+	int ret2 = starpu_insert_task(&cl,
+				      STARPU_RW, handle,
+				      STARPU_PROLOGUE_CALLBACK, prologue_callback_func,
+				      STARPU_PROLOGUE_CALLBACK_ARG, x,
+				      0);
+
+
+	starpu_task_wait_for_all();
+	starpu_data_unregister(handle);
+
+	FPRINTF(stderr, "v -> %d\n", v);
+
+	starpu_shutdown();
+
+	return 0;
+
+enodev:
+	starpu_shutdown();
+	return 77;
+}

+ 2 - 0
include/starpu_disk.h

@@ -18,6 +18,8 @@
 #ifndef __STARPU_DISK_H__
 #ifndef __STARPU_DISK_H__
 #define __STARPU_DISK_H__
 #define __STARPU_DISK_H__
 
 
+#include <sys/types.h>
+
 /* list of functions to use on disk */
 /* list of functions to use on disk */
 struct starpu_disk_ops {
 struct starpu_disk_ops {
  	 void *  (*alloc)  (void *base, size_t size);
  	 void *  (*alloc)  (void *base, size_t size);

+ 3 - 0
include/starpu_task.h

@@ -126,6 +126,9 @@ struct starpu_task
 	void (*callback_func)(void *);
 	void (*callback_func)(void *);
 	void *callback_arg;
 	void *callback_arg;
 
 
+	void (*prologue_callback_func)(void *);
+	void *prologue_callback_arg;
+
 	unsigned use_tag;
 	unsigned use_tag;
 	starpu_tag_t tag_id;
 	starpu_tag_t tag_id;
 
 

+ 2 - 0
include/starpu_task_util.h

@@ -43,6 +43,8 @@ void starpu_create_sync_task(starpu_tag_t sync_tag, unsigned ndeps, starpu_tag_t
 #define STARPU_HYPERVISOR_TAG	 (1<<28)
 #define STARPU_HYPERVISOR_TAG	 (1<<28)
 #define STARPU_FLOPS	         (1<<29)
 #define STARPU_FLOPS	         (1<<29)
 #define STARPU_SCHED_CTX	 (1<<30)
 #define STARPU_SCHED_CTX	 (1<<30)
+#define STARPU_PROLOGUE_CALLBACK   (1<<31)
+#define STARPU_PROLOGUE_CALLBACK_ARG (1ULL<<32)
 
 
 int starpu_insert_task(struct starpu_codelet *cl, ...);
 int starpu_insert_task(struct starpu_codelet *cl, ...);
 
 

+ 0 - 5
include/starpu_worker.h

@@ -21,11 +21,6 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <starpu_config.h>
 #include <starpu_config.h>
 
 
-#ifdef STARPU_HAVE_HWLOC
-#include <hwloc.h>
-#endif
-
-
 #ifdef __cplusplus
 #ifdef __cplusplus
 extern "C"
 extern "C"
 {
 {

+ 2 - 2
mpi/Makefile.am

@@ -1,7 +1,7 @@
 # StarPU --- Runtime system for heterogeneous multicore architectures.
 # StarPU --- Runtime system for heterogeneous multicore architectures.
 #
 #
 # Copyright (C) 2009-2013  Université de Bordeaux 1
 # Copyright (C) 2009-2013  Université de Bordeaux 1
-# Copyright (C) 2010, 2011, 2012  Centre National de la Recherche Scientifique
+# Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
 #
 #
 # StarPU is free software; you can redistribute it and/or modify
 # StarPU is free software; you can redistribute it and/or modify
 # it under the terms of the GNU Lesser General Public License as published by
 # it under the terms of the GNU Lesser General Public License as published by
@@ -17,7 +17,7 @@
 SUBDIRS=src tests examples
 SUBDIRS=src tests examples
 
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libstarpumpi.pc starpumpi-1.0.pc starpumpi-1.1.pc
+pkgconfig_DATA = libstarpumpi.pc starpumpi-1.0.pc starpumpi-1.1.pc starpumpi-1.2.pc
 
 
 versincludedir = $(includedir)/starpu/$(STARPU_EFFECTIVE_VERSION)
 versincludedir = $(includedir)/starpu/$(STARPU_EFFECTIVE_VERSION)
 versinclude_HEADERS = 					\
 versinclude_HEADERS = 					\

+ 1 - 2
mpi/examples/mpi_lu/plu_implicit_example.c

@@ -74,8 +74,7 @@ static void parse_args(int argc, char **argv)
 #ifdef STARPU_HAVE_LIBNUMA
 #ifdef STARPU_HAVE_LIBNUMA
 			numa = 1;
 			numa = 1;
 #else
 #else
-			if (rank == 0)
-				fprintf(stderr, "Warning: libnuma is not available\n");
+			fprintf(stderr, "Warning: libnuma is not available\n");
 #endif
 #endif
 		}
 		}
 
 

+ 1 - 2
mpi/examples/mpi_lu/plu_outofcore_example.c

@@ -76,8 +76,7 @@ static void parse_args(int argc, char **argv)
 #ifdef STARPU_HAVE_LIBNUMA
 #ifdef STARPU_HAVE_LIBNUMA
 			numa = 1;
 			numa = 1;
 #else
 #else
-			if (rank == 0)
-				fprintf(stderr, "Warning: libnuma is not available\n");
+			fprintf(stderr, "Warning: libnuma is not available\n");
 #endif
 #endif
 		}
 		}
 
 

+ 3 - 0
sc_hypervisor/include/sc_hypervisor_monitoring.h

@@ -112,6 +112,9 @@ struct sc_hypervisor_wrapper
 
 
 	/* the number of ready tasks submitted to a ctx */
 	/* the number of ready tasks submitted to a ctx */
 	int nready_tasks;
 	int nready_tasks;
+
+	/* boolean indicating that a context is being sized */
+	unsigned to_be_sized;
 };
 };
 
 
 /* return the wrapper of context that saves its monitoring information */
 /* return the wrapper of context that saves its monitoring information */

+ 13 - 2
sc_hypervisor/src/hypervisor_policies/feft_lp_policy.c

@@ -19,11 +19,13 @@
 #include <starpu_config.h>
 #include <starpu_config.h>
 #include <sys/time.h>
 #include <sys/time.h>
 
 
+int resize_no = 0;
 #ifdef STARPU_HAVE_GLPK_H
 #ifdef STARPU_HAVE_GLPK_H
 static void _try_resizing(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
 static void _try_resizing(unsigned *sched_ctxs, int nsched_ctxs, int *workers, int nworkers)
 {
 {
 	/* for vite */
 	/* for vite */
-	starpu_trace_user_event(2);
+	printf("resize_no = %d\n", resize_no);
+	starpu_trace_user_event(resize_no++);
 	int ns = sched_ctxs == NULL ? sc_hypervisor_get_nsched_ctxs() : nsched_ctxs;
 	int ns = sched_ctxs == NULL ? sc_hypervisor_get_nsched_ctxs() : nsched_ctxs;
 	unsigned *curr_sched_ctxs = sched_ctxs == NULL ? sc_hypervisor_get_sched_ctxs() : sched_ctxs;
 	unsigned *curr_sched_ctxs = sched_ctxs == NULL ? sc_hypervisor_get_sched_ctxs() : sched_ctxs;
 	unsigned curr_nworkers = nworkers == -1 ? starpu_worker_get_count() : (unsigned)nworkers;
 	unsigned curr_nworkers = nworkers == -1 ? starpu_worker_get_count() : (unsigned)nworkers;
@@ -90,6 +92,14 @@ static void feft_lp_size_ctxs(unsigned *sched_ctxs, int nsched_ctxs, int *worker
 	
 	
 
 
 	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
+	struct sc_hypervisor_wrapper* sc_w  = NULL;
+	int s = 0;
+	for(s = 0; s < nsched_ctxs; s++)
+	{
+		sc_w = sc_hypervisor_get_wrapper(sched_ctxs[s]);
+		sc_w->to_be_sized = 1;
+	}
+
 	double vmax = sc_hypervisor_lp_get_nworkers_per_ctx(ns, nw, nworkers_per_type, total_nw, tw);
 	double vmax = sc_hypervisor_lp_get_nworkers_per_ctx(ns, nw, nworkers_per_type, total_nw, tw);
 	if(vmax != 0.0)
 	if(vmax != 0.0)
 	{
 	{
@@ -127,11 +137,13 @@ static void feft_lp_size_ctxs(unsigned *sched_ctxs, int nsched_ctxs, int *worker
 				break;
 				break;
 			}
 			}
 		}
 		}
+
 		if(has_workers)
 		if(has_workers)
 			sc_hypervisor_lp_redistribute_resources_in_ctxs(ns, nw, nworkers_per_type_rounded, nworkers_per_type, curr_sched_ctxs, tw);
 			sc_hypervisor_lp_redistribute_resources_in_ctxs(ns, nw, nworkers_per_type_rounded, nworkers_per_type, curr_sched_ctxs, tw);
 		else
 		else
 			sc_hypervisor_lp_distribute_resources_in_ctxs(sched_ctxs, ns, nw, nworkers_per_type_rounded, nworkers_per_type, workers, curr_nworkers, tw);
 			sc_hypervisor_lp_distribute_resources_in_ctxs(sched_ctxs, ns, nw, nworkers_per_type_rounded, nworkers_per_type, workers, curr_nworkers, tw);
 	}
 	}
+	printf("finished size ctxs\n");
 	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 }
 }
 
 
@@ -168,7 +180,6 @@ static void feft_lp_resize_ctxs(unsigned *sched_ctxs, int nsched_ctxs ,
 				 return;
 				 return;
 			 }
 			 }
 		}
 		}
-
 		_try_resizing(sched_ctxs, nsched_ctxs, workers, nworkers);
 		_try_resizing(sched_ctxs, nsched_ctxs, workers, nworkers);
 		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 		starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	}
 	}

+ 17 - 16
sc_hypervisor/src/policies_utils/lp_tools.c

@@ -39,17 +39,24 @@ double sc_hypervisor_lp_get_nworkers_per_ctx(int nsched_ctxs, int ntypes_of_work
 		for(w = 0; w < nw; w++)
 		for(w = 0; w < nw; w++)
 			v[i][w] = sc_hypervisor_get_speed(sc_w, sc_hypervisor_get_arch_for_index(w, tw)); 
 			v[i][w] = sc_hypervisor_get_speed(sc_w, sc_hypervisor_get_arch_for_index(w, tw)); 
 		
 		
-//		flops[i] = sc_w->ready_flops/1000000000.0; /* in gflops*/
-		if(sc_w->remaining_flops < 0.0)
-			flops[i] = sc_w->ready_flops/1000000000.0; /* in gflops*/
+		if(sc_w->to_be_sized)
+		{
+			flops[i] = sc_w->remaining_flops/1000000000.0; /* in gflops*/
+			sc_w->to_be_sized = 0;
+		}
 		else
 		else
 		{
 		{
-			if((sc_w->ready_flops/1000000000.0) < 0.5)
-				flops[i] = 0.0;
+			if(sc_w->remaining_flops < 0.0)
+				flops[i] = sc_w->ready_flops/1000000000.0; /* in gflops*/
 			else
 			else
-				flops[i] = sc_w->remaining_flops/1000000000.0; /* in gflops*/
+			{
+				if((sc_w->ready_flops/1000000000.0) <= 0.000002)
+					flops[i] = 0.0;
+				else
+					flops[i] = sc_w->remaining_flops/1000000000.0; /* in gflops*/
+			}
 		}
 		}
-/* 		printf("%d: flops %lf remaining flops %lf ready flops %lf nready_tasks %d\n",  */
+/* 		printf("%d: flops %lf remaining flops %lf ready flops %lf nready_tasks %d\n", */
 /* 		       sched_ctxs[i], flops[i], sc_w->remaining_flops/1000000000, sc_w->ready_flops/1000000000, sc_w->nready_tasks); */
 /* 		       sched_ctxs[i], flops[i], sc_w->remaining_flops/1000000000, sc_w->ready_flops/1000000000, sc_w->nready_tasks); */
 	}
 	}
 
 
@@ -78,7 +85,7 @@ has some last flops or a ready task that does not even have any flops
 we give a worker (in shared mode) to the context in order to leave him
 we give a worker (in shared mode) to the context in order to leave him
 finish its work = we give -1.0 value instead of 0.0 and further on in
 finish its work = we give -1.0 value instead of 0.0 and further on in
 the distribution function we take this into account and revert the variable
 the distribution function we take this into account and revert the variable
-to its 0.0 value */
+to its 0.0 value */ 
 		if(no_workers && (flops[i] != 0.0 || sc_w->nready_tasks > 0))
 		if(no_workers && (flops[i] != 0.0 || sc_w->nready_tasks > 0))
 		{
 		{
 			for(w = 0; w < nw; w++)
 			for(w = 0; w < nw; w++)
@@ -515,17 +522,11 @@ void sc_hypervisor_lp_distribute_resources_in_ctxs(unsigned* sched_ctxs, int ns,
 				}
 				}
 			}
 			}
 		}
 		}
-		if(nw_add > 0)
-		{
-			sc_hypervisor_add_workers_to_sched_ctx(workers_add, nw_add, sched_ctxs[s]);
-		}
+//		sc_hypervisor_start_resize(sched_ctxs[s]);
+		sc_hypervisor_add_workers_to_sched_ctx(workers_add, nw_add, sched_ctxs[s]);
 		int workers_remove[STARPU_NMAXWORKERS];
 		int workers_remove[STARPU_NMAXWORKERS];
 		int nw_remove = _lp_get_unwanted_workers(workers_add, nw_add, sched_ctxs[s], workers_remove);
 		int nw_remove = _lp_get_unwanted_workers(workers_add, nw_add, sched_ctxs[s], workers_remove);
 		sc_hypervisor_remove_workers_from_sched_ctx(workers_remove, nw_remove, sched_ctxs[s], !(_sc_hypervisor_use_lazy_resize()));
 		sc_hypervisor_remove_workers_from_sched_ctx(workers_remove, nw_remove, sched_ctxs[s], !(_sc_hypervisor_use_lazy_resize()));
-		sc_hypervisor_start_resize(sched_ctxs[s]);
-
-
-//		sc_hypervisor_stop_resize(current_sched_ctxs[s]);
 	}
 	}
 }
 }
 
 

+ 2 - 2
sc_hypervisor/src/policies_utils/speed.c

@@ -45,7 +45,7 @@ double sc_hypervisor_get_ctx_speed(struct sc_hypervisor_wrapper* sc_w)
 		int n_all_cuda = starpu_cuda_worker_get_count();
 		int n_all_cuda = starpu_cuda_worker_get_count();
 		double th_speed = SC_HYPERVISOR_DEFAULT_CPU_SPEED * n_all_cpus + SC_HYPERVISOR_DEFAULT_CUDA_SPEED * n_all_cuda;
 		double th_speed = SC_HYPERVISOR_DEFAULT_CPU_SPEED * n_all_cpus + SC_HYPERVISOR_DEFAULT_CUDA_SPEED * n_all_cuda;
 		double time_sample = 0.1 * ((total_flops/1000000000.0) / th_speed);
 		double time_sample = 0.1 * ((total_flops/1000000000.0) / th_speed);
-		can_compute_speed = elapsed_time >= time_sample;
+		can_compute_speed = elapsed_time > 1.0;//time_sample;
 	}
 	}
 	else
 	else
 		can_compute_speed = elapsed_flops >= redim_sample;
 		can_compute_speed = elapsed_flops >= redim_sample;
@@ -127,7 +127,7 @@ double sc_hypervisor_get_speed_per_worker_type(struct sc_hypervisor_wrapper* sc_
 		double th_speed = SC_HYPERVISOR_DEFAULT_CPU_SPEED * n_all_cpus + SC_HYPERVISOR_DEFAULT_CUDA_SPEED * n_all_cuda;
 		double th_speed = SC_HYPERVISOR_DEFAULT_CPU_SPEED * n_all_cpus + SC_HYPERVISOR_DEFAULT_CUDA_SPEED * n_all_cuda;
 		double total_flops = sc_w->total_flops;
 		double total_flops = sc_w->total_flops;
 		double time_sample = 0.1 * ((total_flops/1000000000.0) / th_speed);
 		double time_sample = 0.1 * ((total_flops/1000000000.0) / th_speed);
-		can_compute_speed = elapsed_time >= time_sample;
+		can_compute_speed = elapsed_time > 1.0;
 	}
 	}
 	else
 	else
 		can_compute_speed = ctx_elapsed_flops > ctx_sample;
 		can_compute_speed = ctx_elapsed_flops > ctx_sample;

+ 4 - 3
sc_hypervisor/src/sc_hypervisor.c

@@ -193,7 +193,7 @@ void* sc_hypervisor_init(struct sc_hypervisor_policy *hypervisor_policy)
 		hypervisor.sched_ctx_w[i].ready_flops = 0.0;
 		hypervisor.sched_ctx_w[i].ready_flops = 0.0;
 		hypervisor.sched_ctx_w[i].total_flops_available = 0;
 		hypervisor.sched_ctx_w[i].total_flops_available = 0;
 		hypervisor.sched_ctx_w[i].nready_tasks = 0;
 		hypervisor.sched_ctx_w[i].nready_tasks = 0;
-
+		hypervisor.sched_ctx_w[i].to_be_sized = 0;
 		int j;
 		int j;
 		for(j = 0; j < STARPU_NMAXWORKERS; j++)
 		for(j = 0; j < STARPU_NMAXWORKERS; j++)
 		{
 		{
@@ -313,8 +313,7 @@ void sc_hypervisor_register_ctx(unsigned sched_ctx, double total_flops)
 
 
 	hypervisor.sched_ctx_w[sched_ctx].total_flops = total_flops;
 	hypervisor.sched_ctx_w[sched_ctx].total_flops = total_flops;
 	hypervisor.sched_ctx_w[sched_ctx].remaining_flops = total_flops;
 	hypervisor.sched_ctx_w[sched_ctx].remaining_flops = total_flops;
-	if(strcmp(hypervisor.policy.name, "app_driven") == 0)
-		hypervisor.resize[sched_ctx] = 1;
+	hypervisor.resize[sched_ctx] = 1;
 	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 }
 }
 
 
@@ -848,7 +847,9 @@ static void notify_poped_task(unsigned sched_ctx, int worker, struct starpu_task
 		if(hypervisor.policy.handle_poped_task)
 		if(hypervisor.policy.handle_poped_task)
 			hypervisor.policy.handle_poped_task(sched_ctx, worker, task, footprint);
 			hypervisor.policy.handle_poped_task(sched_ctx, worker, task, footprint);
 	}
 	}
+	starpu_pthread_mutex_lock(&act_hypervisor_mutex);
 	_ack_resize_completed(sched_ctx, worker);
 	_ack_resize_completed(sched_ctx, worker);
+	starpu_pthread_mutex_unlock(&act_hypervisor_mutex);
 	if(hypervisor.sched_ctx_w[sched_ctx].poped_tasks[worker] % 200 == 0)
 	if(hypervisor.sched_ctx_w[sched_ctx].poped_tasks[worker] % 200 == 0)
 		_print_current_time();
 		_print_current_time();
 }
 }

+ 12 - 8
src/core/disk_ops/unistd/disk_unistd_global.c

@@ -37,7 +37,12 @@
 #endif
 #endif
 
 
 #define NITER	64
 #define NITER	64
-#define SIZE_BENCH (4*getpagesize())
+
+#ifdef O_DIRECT
+#  define MEM_SIZE getpagesize()
+#else
+#  define MEM_SIZE 1
+#endif
 
 
 /* ------------------- use UNISTD to write on disk -------------------  */
 /* ------------------- use UNISTD to write on disk -------------------  */
 
 
@@ -315,11 +320,11 @@ get_unistd_global_bandwidth_between_disk_and_main_ram(unsigned node)
 
 
 	srand (time (NULL)); 
 	srand (time (NULL)); 
 	char * buf;
 	char * buf;
-	starpu_malloc((void *) &buf, SIZE_BENCH*sizeof(char));
+	starpu_malloc((void *) &buf, SIZE_DISK_MIN*sizeof(char));
 	STARPU_ASSERT(buf != NULL);
 	STARPU_ASSERT(buf != NULL);
 	
 	
 	/* allocate memory */
 	/* allocate memory */
-	void * mem = _starpu_disk_alloc(node, SIZE_BENCH);
+	void * mem = _starpu_disk_alloc(node, SIZE_DISK_MIN);
 	/* fail to alloc */
 	/* fail to alloc */
 	if (mem == NULL)
 	if (mem == NULL)
 		return 0;
 		return 0;
@@ -330,7 +335,7 @@ get_unistd_global_bandwidth_between_disk_and_main_ram(unsigned node)
 	gettimeofday(&start, NULL);
 	gettimeofday(&start, NULL);
 	for (iter = 0; iter < NITER; ++iter)
 	for (iter = 0; iter < NITER; ++iter)
 	{
 	{
-		_starpu_disk_write(STARPU_MAIN_RAM, node, mem, buf, 0, SIZE_BENCH, NULL);
+		_starpu_disk_write(STARPU_MAIN_RAM, node, mem, buf, 0, SIZE_DISK_MIN, NULL);
 
 
 #ifdef STARPU_HAVE_WINDOWS
 #ifdef STARPU_HAVE_WINDOWS
 		res = _commit(tmp->descriptor);
 		res = _commit(tmp->descriptor);
@@ -347,15 +352,14 @@ get_unistd_global_bandwidth_between_disk_and_main_ram(unsigned node)
 	/* free memory */
 	/* free memory */
 	starpu_free(buf);
 	starpu_free(buf);
 
 
-	
-	starpu_malloc((void *) &buf, getpagesize()*sizeof(char));
+	starpu_malloc((void *) &buf, MEM_SIZE*sizeof(char));
 	STARPU_ASSERT(buf != NULL);
 	STARPU_ASSERT(buf != NULL);
 
 
 	/* Measure latency */
 	/* Measure latency */
 	gettimeofday(&start, NULL);
 	gettimeofday(&start, NULL);
 	for (iter = 0; iter < NITER; ++iter)
 	for (iter = 0; iter < NITER; ++iter)
 	{
 	{
-		_starpu_disk_write(STARPU_MAIN_RAM, node, mem, buf, rand() % (SIZE_BENCH -1) , getpagesize(), NULL);
+		_starpu_disk_write(STARPU_MAIN_RAM, node, mem, buf, rand() % (SIZE_DISK_MIN -1) , MEM_SIZE, NULL);
 
 
 #ifdef STARPU_HAVE_WINDOWS
 #ifdef STARPU_HAVE_WINDOWS
 		res = _commit(tmp->descriptor);
 		res = _commit(tmp->descriptor);
@@ -368,7 +372,7 @@ get_unistd_global_bandwidth_between_disk_and_main_ram(unsigned node)
 	gettimeofday(&end, NULL);
 	gettimeofday(&end, NULL);
 	timing_latency = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 	timing_latency = (double)((end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec));
 
 
-	_starpu_disk_free(node, mem, SIZE_BENCH);
+	_starpu_disk_free(node, mem, SIZE_DISK_MIN);
 	starpu_free(buf);
 	starpu_free(buf);
 
 
 	_starpu_save_bandwidth_and_latency_disk((NITER/timing_slowness)*1000000, (NITER/timing_slowness)*1000000,
 	_starpu_save_bandwidth_and_latency_disk((NITER/timing_slowness)*1000000, (NITER/timing_slowness)*1000000,

+ 1 - 1
src/core/perfmodel/perfmodel_bus.c

@@ -1146,7 +1146,7 @@ static void write_bus_latency_file_content(void)
 
 
 			if (dst)
 			if (dst)
 				fputc('\t', f);
 				fputc('\t', f);
-			fprintf(f, "%f", latency);
+			fprintf(f, "%lf", latency);
 		}
 		}
 
 
 		fprintf(f, "\n");
 		fprintf(f, "\n");

+ 4 - 0
src/core/sched_policy.c

@@ -313,6 +313,10 @@ static int _starpu_nworkers_able_to_execute_task(struct starpu_task *task, struc
 
 
 int _starpu_push_task(struct _starpu_job *j)
 int _starpu_push_task(struct _starpu_job *j)
 {
 {
+
+	if(j->task->prologue_callback_func)
+		j->task->prologue_callback_func(j->task->prologue_callback_arg);
+
 	struct starpu_task *task = j->task;
 	struct starpu_task *task = j->task;
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(task->sched_ctx);
 	struct _starpu_sched_ctx *sched_ctx = _starpu_get_sched_ctx_struct(task->sched_ctx);
 	unsigned nworkers = 0;
 	unsigned nworkers = 0;

+ 16 - 58
src/datawizard/memalloc.c

@@ -21,13 +21,6 @@
 #include <core/disk.h>
 #include <core/disk.h>
 #include <starpu.h>
 #include <starpu.h>
 
 
-/* This per-node spinlock protect lru_list */
-static struct _starpu_spinlock lru_rwlock[STARPU_MAXNODES];
-
-/* Last Recently used memory chunkgs */
-static struct _starpu_mem_chunk_lru_list *starpu_lru_list[STARPU_MAXNODES];
-
-
 /* This per-node RW-locks protect mc_list and memchunk_cache entries */
 /* This per-node RW-locks protect mc_list and memchunk_cache entries */
 /* Note: handle header lock is always taken before this */
 /* Note: handle header lock is always taken before this */
 static starpu_pthread_rwlock_t mc_rwlock[STARPU_MAXNODES];
 static starpu_pthread_rwlock_t mc_rwlock[STARPU_MAXNODES];
@@ -42,7 +35,6 @@ static struct _starpu_mem_chunk_list *memchunk_cache[STARPU_MAXNODES];
 /* When reclaiming memory to allocate, we reclaim MAX(what_is_to_reclaim_on_device, data_size_coefficient*data_size) */
 /* When reclaiming memory to allocate, we reclaim MAX(what_is_to_reclaim_on_device, data_size_coefficient*data_size) */
 const unsigned starpu_memstrategy_data_size_coefficient=2;
 const unsigned starpu_memstrategy_data_size_coefficient=2;
 
 
-static void starpu_lru(unsigned node);
 static int get_better_disk_can_accept_size(starpu_data_handle_t handle, unsigned node);
 static int get_better_disk_can_accept_size(starpu_data_handle_t handle, unsigned node);
 static unsigned choose_target(starpu_data_handle_t handle, unsigned node);
 static unsigned choose_target(starpu_data_handle_t handle, unsigned node);
 
 
@@ -52,9 +44,7 @@ void _starpu_init_mem_chunk_lists(void)
 	for (i = 0; i < STARPU_MAXNODES; i++)
 	for (i = 0; i < STARPU_MAXNODES; i++)
 	{
 	{
 		STARPU_PTHREAD_RWLOCK_INIT(&mc_rwlock[i], NULL);
 		STARPU_PTHREAD_RWLOCK_INIT(&mc_rwlock[i], NULL);
-		_starpu_spin_init(&lru_rwlock[i]);
 		mc_list[i] = _starpu_mem_chunk_list_new();
 		mc_list[i] = _starpu_mem_chunk_list_new();
-		starpu_lru_list[i] = _starpu_mem_chunk_lru_list_new();
 		memchunk_cache[i] = _starpu_mem_chunk_list_new();
 		memchunk_cache[i] = _starpu_mem_chunk_list_new();
 	}
 	}
 }
 }
@@ -66,8 +56,6 @@ void _starpu_deinit_mem_chunk_lists(void)
 	{
 	{
 		_starpu_mem_chunk_list_delete(mc_list[i]);
 		_starpu_mem_chunk_list_delete(mc_list[i]);
 		_starpu_mem_chunk_list_delete(memchunk_cache[i]);
 		_starpu_mem_chunk_list_delete(memchunk_cache[i]);
-		_starpu_mem_chunk_lru_list_delete(starpu_lru_list[i]);
-		_starpu_spin_destroy(&lru_rwlock[i]);
 		STARPU_PTHREAD_RWLOCK_DESTROY(&mc_rwlock[i]);
 		STARPU_PTHREAD_RWLOCK_DESTROY(&mc_rwlock[i]);
 	}
 	}
 }
 }
@@ -434,7 +422,7 @@ static void reuse_mem_chunk(unsigned node, struct _starpu_data_replicate *new_re
 	/* reinsert the mem chunk in the list of active memory chunks */
 	/* reinsert the mem chunk in the list of active memory chunks */
 	if (!is_already_in_mc_list)
 	if (!is_already_in_mc_list)
 	{
 	{
-		_starpu_mem_chunk_list_push_front(mc_list[node], mc);
+		_starpu_mem_chunk_list_push_back(mc_list[node], mc);
 	}
 	}
 }
 }
 
 
@@ -662,7 +650,14 @@ size_t _starpu_memory_reclaim_generic(unsigned node, unsigned force, size_t recl
 {
 {
 	size_t freed = 0;
 	size_t freed = 0;
 
 
-	starpu_lru(node);
+	if (reclaim && !force)
+	{
+		static int warned;
+		if (!warned) {
+			_STARPU_DISP("Not enough memory left on node %u. Trying to purge %lu bytes out\n", node, (unsigned long) reclaim);
+			warned = 1;
+		}
+	}
 
 
 	/* remove all buffers for which there was a removal request */
 	/* remove all buffers for which there was a removal request */
 	freed += flush_memchunk_cache(node, reclaim);
 	freed += flush_memchunk_cache(node, reclaim);
@@ -932,53 +927,16 @@ unsigned starpu_data_test_if_allocated_on_node(starpu_data_handle_t handle, unsi
 	return handle->per_node[memory_node].allocated;
 	return handle->per_node[memory_node].allocated;
 }
 }
 
 
-/* Record that this memchunk has been recently used */
+/* This memchunk has been recently used, put it last on the mc_list, so we will
+ * try to evict it as late as possible */
 void _starpu_memchunk_recently_used(struct _starpu_mem_chunk *mc, unsigned node)
 void _starpu_memchunk_recently_used(struct _starpu_mem_chunk *mc, unsigned node)
 {
 {
-	_starpu_spin_lock(&lru_rwlock[node]);
-	struct _starpu_mem_chunk_lru *mc_lru=_starpu_mem_chunk_lru_new();
-	mc_lru->mc=mc;
-	_starpu_mem_chunk_lru_list_push_front(starpu_lru_list[node],mc_lru);
-	_starpu_spin_unlock(&lru_rwlock[node]);
-}
-
-/* Push the given memchunk, recently used, at the end of the chunks to be evicted */
-/* The mc_rwlock[node] rw-lock should be taken prior to calling this function.*/
-static void _starpu_memchunk_recently_used_move(struct _starpu_mem_chunk *mc, unsigned node)
-{
-	/* Note: Sometimes the memchunk is not in the list... */
-	struct _starpu_mem_chunk *mc_iter;
-	for (mc_iter = _starpu_mem_chunk_list_begin(mc_list[node]);
-	     mc_iter != _starpu_mem_chunk_list_end(mc_list[node]);
-	     mc_iter = _starpu_mem_chunk_list_next(mc_iter) )
-	{
-		if (mc_iter==mc)
-		{
-			_starpu_mem_chunk_list_erase(mc_list[node], mc);
-			_starpu_mem_chunk_list_push_back(mc_list[node], mc);
-			return;
-		}
-
-	}
-}
-
-/* Put the recently used memchunks at the end of the mc_list, in the same order
- * as the LRU list, so that the most recently used memchunk eventually comes
- * last in the mc_list */
-static void starpu_lru(unsigned node)
-{
+	if (!mc)
+		/* user-allocated memory */
+		return;
 	STARPU_PTHREAD_RWLOCK_WRLOCK(&mc_rwlock[node]);
 	STARPU_PTHREAD_RWLOCK_WRLOCK(&mc_rwlock[node]);
-
-	_starpu_spin_lock(&lru_rwlock[node]);
-	while (!_starpu_mem_chunk_lru_list_empty(starpu_lru_list[node]))
-	{
-		struct _starpu_mem_chunk_lru *mc_lru=_starpu_mem_chunk_lru_list_front(starpu_lru_list[node]);
-		_starpu_memchunk_recently_used_move(mc_lru->mc, node);
-		_starpu_mem_chunk_lru_list_erase(starpu_lru_list[node], mc_lru);
-		_starpu_mem_chunk_lru_delete(mc_lru);
-	}
-	_starpu_spin_unlock(&lru_rwlock[node]);
-
+	_starpu_mem_chunk_list_erase(mc_list[node], mc);
+	_starpu_mem_chunk_list_push_back(mc_list[node], mc);
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&mc_rwlock[node]);
 	STARPU_PTHREAD_RWLOCK_UNLOCK(&mc_rwlock[node]);
 }
 }
 
 

+ 2 - 2
src/drivers/driver_common/driver_common.c

@@ -29,8 +29,8 @@
 #include <core/debug.h>
 #include <core/debug.h>
 
 
 
 
-#define BACKOFF_MAX 4 //8192  /* TODO : calibrate MAX & MIN */
-#define BACKOFF_MIN 4
+#define BACKOFF_MAX 32  /* TODO : use parameter to define them */
+#define BACKOFF_MIN 1
 
 
 void _starpu_driver_start_job(struct _starpu_worker *args, struct _starpu_job *j, struct timespec *codelet_start, int rank, int profiling)
 void _starpu_driver_start_job(struct _starpu_worker *args, struct _starpu_job *j, struct timespec *codelet_start, int rank, int profiling)
 {
 {

+ 17 - 12
src/drivers/opencl/driver_opencl.c

@@ -66,26 +66,30 @@ static void _starpu_opencl_limit_gpu_mem_if_needed(unsigned devid)
 	size_t STARPU_ATTRIBUTE_UNUSED to_waste = 0;
 	size_t STARPU_ATTRIBUTE_UNUSED to_waste = 0;
 	char name[30];
 	char name[30];
 
 
+#ifdef STARPU_USE_OPENCL
+	/* Request the size of the current device's memory */
+	cl_int err;
+	err = clGetDeviceInfo(devices[devid], CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(totalGlobalMem), &totalGlobalMem, NULL);
+	if (STARPU_UNLIKELY(err != CL_SUCCESS))
+		STARPU_OPENCL_REPORT_ERROR(err);
+#endif
+
 	limit = starpu_get_env_number("STARPU_LIMIT_OPENCL_MEM");
 	limit = starpu_get_env_number("STARPU_LIMIT_OPENCL_MEM");
 	if (limit == -1)
 	if (limit == -1)
 	{
 	{
-	     sprintf(name, "STARPU_LIMIT_OPENCL_%u_MEM", devid);
-	     limit = starpu_get_env_number(name);
+		sprintf(name, "STARPU_LIMIT_OPENCL_%u_MEM", devid);
+		limit = starpu_get_env_number(name);
 	}
 	}
 	if (limit == -1)
 	if (limit == -1)
 	{
 	{
-		return;
+		global_mem[devid] = totalGlobalMem;
+	}
+	else
+	{
+		global_mem[devid] = limit * 1024*1024;
 	}
 	}
-
-	global_mem[devid] = limit * 1024*1024;
 
 
 #ifdef STARPU_USE_OPENCL
 #ifdef STARPU_USE_OPENCL
-	/* Request the size of the current device's memory */
-	cl_int err;
-	err = clGetDeviceInfo(devices[devid], CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(totalGlobalMem), &totalGlobalMem, NULL);
-	if (STARPU_UNLIKELY(err != CL_SUCCESS))
-		STARPU_OPENCL_REPORT_ERROR(err);
-
 	/* How much memory to waste ? */
 	/* How much memory to waste ? */
 	to_waste = totalGlobalMem - global_mem[devid];
 	to_waste = totalGlobalMem - global_mem[devid];
 #endif
 #endif
@@ -608,6 +612,7 @@ int _starpu_opencl_driver_init(struct starpu_driver *d)
 	_starpu_memory_manager_set_global_memory_size(args->memory_node, _starpu_opencl_get_global_mem_size(devid));
 	_starpu_memory_manager_set_global_memory_size(args->memory_node, _starpu_opencl_get_global_mem_size(devid));
 
 
 	args->status = STATUS_UNKNOWN;
 	args->status = STATUS_UNKNOWN;
+	float size = (float) global_mem[devid] / (1<<30);
 
 
 #ifdef STARPU_SIMGRID
 #ifdef STARPU_SIMGRID
 	const char *devname = "Simgrid";
 	const char *devname = "Simgrid";
@@ -616,7 +621,7 @@ int _starpu_opencl_driver_init(struct starpu_driver *d)
 	char devname[128];
 	char devname[128];
 	_starpu_opencl_get_device_name(devid, devname, 128);
 	_starpu_opencl_get_device_name(devid, devname, 128);
 #endif
 #endif
-	snprintf(args->name, sizeof(args->name), "OpenCL %u (%s)", devid, devname);
+	snprintf(args->name, sizeof(args->name), "OpenCL %u (%s %.1f GiB)", devid, devname, size);
 	snprintf(args->short_name, sizeof(args->short_name), "OpenCL %u", devid);
 	snprintf(args->short_name, sizeof(args->short_name), "OpenCL %u", devid);
 
 
 	_STARPU_DEBUG("OpenCL (%s) dev id %d thread is ready to run on CPU %d !\n", devname, devid, args->bindid);
 	_STARPU_DEBUG("OpenCL (%s) dev id %d thread is ready to run on CPU %d !\n", devname, devid, args->bindid);

+ 2 - 1
src/top/starpu_top_connection.c

@@ -15,11 +15,12 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
  */
 
 
+#define WINVER WindowsXP
+
 #include <starpu_config.h>
 #include <starpu_config.h>
 
 
 #ifdef STARPU_HAVE_WINDOWS
 #ifdef STARPU_HAVE_WINDOWS
 #  include <w32api.h>
 #  include <w32api.h>
-#  define WINVER WindowsXP
 #  include <ws2tcpip.h>
 #  include <ws2tcpip.h>
 #else
 #else
 #  include <sys/socket.h>
 #  include <sys/socket.h>

+ 41 - 0
src/util/starpu_insert_task_utils.c

@@ -80,6 +80,15 @@ size_t _starpu_insert_task_get_arg_size(va_list varg_list)
 			va_arg(varg_list, _starpu_callback_func_t);
 			va_arg(varg_list, _starpu_callback_func_t);
 			va_arg(varg_list, void *);
 			va_arg(varg_list, void *);
 		}
 		}
+		else if (arg_type==STARPU_PROLOGUE_CALLBACK)
+		{
+			(void)va_arg(varg_list, _starpu_callback_func_t);
+		}
+		else if (arg_type==STARPU_PROLOGUE_CALLBACK_ARG)
+		{
+			(void)va_arg(varg_list, void *);
+		}
+
 		else if (arg_type==STARPU_CALLBACK_ARG)
 		else if (arg_type==STARPU_CALLBACK_ARG)
 		{
 		{
 			(void)va_arg(varg_list, void *);
 			(void)va_arg(varg_list, void *);
@@ -172,6 +181,15 @@ int _starpu_codelet_pack_args(void **arg_buffer, size_t arg_buffer_size, va_list
 		{
 		{
 			(void)va_arg(varg_list, void *);
 			(void)va_arg(varg_list, void *);
 		}
 		}
+		else if (arg_type==STARPU_PROLOGUE_CALLBACK)
+		{
+			va_arg(varg_list, _starpu_callback_func_t);
+			va_arg(varg_list, void *);
+		}
+		else if (arg_type==STARPU_PROLOGUE_CALLBACK_ARG)
+		{
+			(void)va_arg(varg_list, void *);
+		}
 		else if (arg_type==STARPU_PRIORITY)
 		else if (arg_type==STARPU_PRIORITY)
 		{
 		{
 			(void)va_arg(varg_list, int);
 			(void)va_arg(varg_list, int);
@@ -228,6 +246,11 @@ int _starpu_insert_task_create_and_submit(void *arg_buffer, size_t arg_buffer_si
 
 
 	cl_arg_wrapper->callback_func = NULL;
 	cl_arg_wrapper->callback_func = NULL;
 
 
+	struct insert_task_cb_wrapper *prologue_cl_arg_wrapper = (struct insert_task_cb_wrapper *) malloc(sizeof(struct insert_task_cb_wrapper));
+	STARPU_ASSERT(prologue_cl_arg_wrapper);
+
+	prologue_cl_arg_wrapper->callback_func = NULL;
+
 	while((arg_type = va_arg(varg_list, int)) != 0)
 	while((arg_type = va_arg(varg_list, int)) != 0)
 	{
 	{
 		if (arg_type & STARPU_R || arg_type & STARPU_W || arg_type & STARPU_SCRATCH || arg_type & STARPU_REDUX)
 		if (arg_type & STARPU_R || arg_type & STARPU_W || arg_type & STARPU_SCRATCH || arg_type & STARPU_REDUX)
@@ -296,6 +319,20 @@ int _starpu_insert_task_create_and_submit(void *arg_buffer, size_t arg_buffer_si
 			void *callback_arg = va_arg(varg_list, void *);
 			void *callback_arg = va_arg(varg_list, void *);
 			cl_arg_wrapper->callback_arg = callback_arg;
 			cl_arg_wrapper->callback_arg = callback_arg;
 		}
 		}
+		else if (arg_type==STARPU_PROLOGUE_CALLBACK)
+		{
+			void (*callback_func)(void *);
+			void *callback_arg;
+			callback_func = va_arg(varg_list, _starpu_callback_func_t);
+			callback_arg = va_arg(varg_list, void *);
+			prologue_cl_arg_wrapper->callback_func = callback_func;
+			prologue_cl_arg_wrapper->callback_arg = callback_arg;
+		}
+		else if (arg_type==STARPU_PROLOGUE_CALLBACK_ARG)
+		{
+			void *callback_arg = va_arg(varg_list, void *);
+			prologue_cl_arg_wrapper->callback_arg = callback_arg;
+		}
 		else if (arg_type==STARPU_PRIORITY)
 		else if (arg_type==STARPU_PRIORITY)
 		{
 		{
 			/* Followed by a priority level */
 			/* Followed by a priority level */
@@ -346,6 +383,9 @@ int _starpu_insert_task_create_and_submit(void *arg_buffer, size_t arg_buffer_si
 	(*task)->callback_func = starpu_task_insert_callback_wrapper;
 	(*task)->callback_func = starpu_task_insert_callback_wrapper;
 	(*task)->callback_arg = cl_arg_wrapper;
 	(*task)->callback_arg = cl_arg_wrapper;
 
 
+	(*task)->prologue_callback_func = starpu_task_insert_callback_wrapper;
+	(*task)->prologue_callback_arg = prologue_cl_arg_wrapper;
+
 	int ret = starpu_task_submit(*task);
 	int ret = starpu_task_submit(*task);
 
 
 	if (STARPU_UNLIKELY(ret == -ENODEV))
 	if (STARPU_UNLIKELY(ret == -ENODEV))
@@ -356,6 +396,7 @@ int _starpu_insert_task_create_and_submit(void *arg_buffer, size_t arg_buffer_si
 			(*task)->cl->name ? (*task)->cl->name :
 			(*task)->cl->name ? (*task)->cl->name :
 			((*task)->cl->model && (*task)->cl->model->symbol)?(*task)->cl->model->symbol:"none");
 			((*task)->cl->model && (*task)->cl->model->symbol)?(*task)->cl->model->symbol:"none");
 		free(cl_arg_wrapper);
 		free(cl_arg_wrapper);
+		free(prologue_cl_arg_wrapper);
 	}
 	}
 
 
 	return ret;
 	return ret;

+ 1 - 1
starpufft/Makefile.am

@@ -40,7 +40,7 @@ versinclude_HEADERS = 				\
 	starpufft.h
 	starpufft.h
 
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libstarpufft.pc starpufft-1.0.pc starpufft-1.1.pc
+pkgconfig_DATA = libstarpufft.pc starpufft-1.0.pc starpufft-1.1.pc starpufft-1.2.pc
 
 
 libstarpufft_@STARPU_EFFECTIVE_VERSION@_la_SOURCES = starpufft.c starpufftf.c starpufft_common.c
 libstarpufft_@STARPU_EFFECTIVE_VERSION@_la_SOURCES = starpufft.c starpufftf.c starpufft_common.c
 libstarpufft_@STARPU_EFFECTIVE_VERSION@_la_LIBADD = $(top_builddir)/src/libstarpu-@STARPU_EFFECTIVE_VERSION@.la $(FFTW_LIBS) $(FFTWF_LIBS) $(STARPU_OPENCL_LDFLAGS) $(STARPU_CUDA_LDFLAGS) $(STARPU_CUFFT_LDFLAGS)
 libstarpufft_@STARPU_EFFECTIVE_VERSION@_la_LIBADD = $(top_builddir)/src/libstarpu-@STARPU_EFFECTIVE_VERSION@.la $(FFTW_LIBS) $(FFTWF_LIBS) $(STARPU_OPENCL_LDFLAGS) $(STARPU_CUDA_LDFLAGS) $(STARPU_CUFFT_LDFLAGS)

+ 14 - 12
tools/Makefile.am

@@ -29,11 +29,12 @@ dist_pkgdata_DATA = gdbinit
 EXTRA_DIST =				\
 EXTRA_DIST =				\
 	dev/rename.sed			\
 	dev/rename.sed			\
 	dev/rename.sh			\
 	dev/rename.sh			\
-	msvc/starpu_clean.bat		\
-	msvc/starpu_open.bat		\
-	msvc/starpu_exec.bat		\
-	msvc/starpu.sln			\
-	msvc/starpu/starpu.vcxproj
+	mvsc/starpu_clean.bat		\
+	mvsc/starpu_open.bat		\
+	mvsc/starpu_exec.bat		\
+	mvsc/starpu_var.bat		\
+	mvsc/starpu.sln			\
+	mvsc/starpu/starpu.vcxproj
 
 
 CLEANFILES = *.gcno *.gcda *.linkinfo
 CLEANFILES = *.gcno *.gcda *.linkinfo
 
 
@@ -124,13 +125,14 @@ dist_bin_SCRIPTS +=			\
 	starpu_codelet_profile
 	starpu_codelet_profile
 
 
 if STARPU_HAVE_WINDOWS
 if STARPU_HAVE_WINDOWS
-STARPU_MSVC_dir		 =	$(bindir)
-nobase_STARPU_MSVC__DATA =		\
-	msvc/starpu_clean.bat		\
-	msvc/starpu_open.bat		\
-	msvc/starpu_exec.bat		\
-	msvc/starpu.sln			\
-	msvc/starpu/starpu.vcxproj
+STARPU_MVSC_dir		 =	$(bindir)
+nobase_STARPU_MVSC__DATA =		\
+	mvsc/starpu_clean.bat		\
+	mvsc/starpu_open.bat		\
+	mvsc/starpu_exec.bat		\
+	mvsc/starpu_var.bat		\
+	mvsc/starpu.sln			\
+	mvsc/starpu/starpu.vcxproj
 endif
 endif
 
 
 if STARPU_HAVE_HELP2MAN
 if STARPU_HAVE_HELP2MAN

tools/msvc/starpu.sln → tools/mvsc/starpu.sln


+ 5 - 5
tools/msvc/starpu/starpu.vcxproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
     <ProjectConfiguration Include="Debug|Win32">
@@ -49,13 +49,13 @@
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>$(STARPUPATH)\include\starpu\1.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(STARPU_PATH)\include\starpu\1.2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <SubSystem>Console</SubSystem>
       <SubSystem>Console</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalLibraryDirectories>$(STARPUPATH)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <AdditionalDependencies>libstarpu-1.0.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>$(STARPU_PATH)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>libstarpu-1.2.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -80,4 +80,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
   </ImportGroup>
-</Project>
+</Project>

+ 2 - 2
tools/msvc/starpu_clean.bat

@@ -15,9 +15,9 @@ REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 REM
 REM
 REM See the GNU Lesser General Public License in COPYING.LGPL for more details.
 REM See the GNU Lesser General Public License in COPYING.LGPL for more details.
 
 
-TITLE MSVC StarPU Cleaning
+TITLE MVSC StarPU Cleaning
 ECHO.
 ECHO.
-ECHO MSVC StarPU Cleaning
+ECHO MVSC StarPU Cleaning
 ECHO.
 ECHO.
 
 
 FOR %%d in (debug starpu\debug ipch) DO IF EXIST %%d RMDIR /S /Q %%d
 FOR %%d in (debug starpu\debug ipch) DO IF EXIST %%d RMDIR /S /Q %%d

+ 11 - 20
tools/msvc/starpu_exec.bat

@@ -15,42 +15,33 @@ REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 REM
 REM
 REM See the GNU Lesser General Public License in COPYING.LGPL for more details.
 REM See the GNU Lesser General Public License in COPYING.LGPL for more details.
 
 
-TITLE MSVC StarPU Execution
+TITLE MVSC StarPU Execution
 ECHO.
 ECHO.
-ECHO MSVC StarPU Execution
-ECHO.
-ECHO Using StarPU in %STARPUPATH%
+ECHO MVSC StarPU Execution
 
 
 IF "%1" == "" GOTO invalidparam
 IF "%1" == "" GOTO invalidparam
 IF NOT EXIST %1 GOTO invalidparam
 IF NOT EXIST %1 GOTO invalidparam
-IF NOT EXIST %STARPUPATH%\AUTHORS GOTO starpunotfound
+
+call .\starpu_var.bat
 
 
 mkdir starpu
 mkdir starpu
-FOR %%F IN (%STARPUPATH%\bin\*dll) DO COPY %%F starpu\%%~nF
-FOR %%F IN (%STARPUPATH%\bin\*dll) DO COPY %%F starpu
-COPY c:\MinGW\bin\pthreadGC2.dll starpu
-COPY %STARPUPATH%\lib\libstarpu-1.0.lib starpu
+FOR %%F IN (%STARPU_PATH%\bin\*dll) DO COPY %%F starpu\%%~nF
+FOR %%F IN (%HWLOC%\bin\*dll) DO COPY %%F starpu
 
 
-set OLDPATH=%PATH%
+set STARPU_OLDPATH=%PATH%
 call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
 call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
-echo cd starpu
-echo dir %STARPUPATH%\include\starpu\1.0
-cl %1 /I%STARPUPATH%\include\starpu\1.0 /link starpu\libstarpu-1.0.lib
+cl %1 %STARPU_CFLAGS% %STARPU_LDFLAGS%
 
 
-set PATH=starpu;%PATH%
+set PATH=starpu;c:\MinGW\bin;%PATH%
 .\%~n1.exe
 .\%~n1.exe
 
 
-set PATH=%OLDPATH%
+set PATH=%STARPU_OLDPATH%
 GOTO end
 GOTO end
 
 
 :invalidparam
 :invalidparam
   ECHO.
   ECHO.
   ECHO Syntax error. You need to give the name of a StarPU application
   ECHO Syntax error. You need to give the name of a StarPU application
-  GOTO end
-
-:starpunotfound
-  ECHO.
-  ECHO You need to set the variable STARPUPATH to a valid StarPU installation directory
+  EXIT /B 2
   GOTO end
   GOTO end
 
 
 :end
 :end

+ 9 - 7
tools/msvc/starpu_open.bat

@@ -15,19 +15,21 @@ REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 REM
 REM
 REM See the GNU Lesser General Public License in COPYING.LGPL for more details.
 REM See the GNU Lesser General Public License in COPYING.LGPL for more details.
 
 
-TITLE MSVC StarPU Execution
+TITLE MVSC StarPU Execution
 ECHO.
 ECHO.
-ECHO MSVC StarPU Execution
+ECHO MVSC StarPU Execution
+
+IF NOT EXIST %STARPU_PATH%\AUTHORS GOTO starpunotfound
+
 ECHO.
 ECHO.
-ECHO %STARPUPATH%
+ECHO %STARPU_PATH%
 
 
 IF "%1" == "" GOTO invalidparam
 IF "%1" == "" GOTO invalidparam
 IF NOT EXIST %1 GOTO invalidparam
 IF NOT EXIST %1 GOTO invalidparam
-IF NOT EXIST %STARPUPATH%\AUTHORS GOTO starpunotfound
 
 
 COPY %1 starpu\starpu_appli.c
 COPY %1 starpu\starpu_appli.c
-FOR %%F IN (%STARPUPATH%\bin\*dll) DO COPY %%F starpu\%%~nF
-FOR %%F IN (%STARPUPATH%\bin\*dll) DO COPY %%F starpu
+FOR %%F IN (%STARPU_PATH%\bin\*dll) DO COPY %%F starpu\%%~nF
+FOR %%F IN (%STARPU_PATH%\bin\*dll) DO COPY %%F starpu
 COPY c:\MinGW\bin\pthreadGC2.dll starpu
 COPY c:\MinGW\bin\pthreadGC2.dll starpu
 IF EXIST Debug RMDIR /S /Q Debug
 IF EXIST Debug RMDIR /S /Q Debug
 IF EXIST starpu\Debug RMDIR /S /Q starpu\Debug
 IF EXIST starpu\Debug RMDIR /S /Q starpu\Debug
@@ -43,7 +45,7 @@ GOTO end
 
 
 :starpunotfound
 :starpunotfound
   ECHO.
   ECHO.
-  ECHO You need to set the variable STARPUPATH to a valid StarPU installation directory
+  ECHO You need to set the variable STARPU_PATH to a valid StarPU installation directory
   GOTO end
   GOTO end
 
 
 :end
 :end

+ 40 - 0
tools/mvsc/starpu_var.bat.in

@@ -0,0 +1,40 @@
+@ECHO OFF
+
+REM StarPU --- Runtime system for heterogeneous multicore architectures.
+REM
+REM Copyright (C) 2013  Centre National de la Recherche Scientifique
+REM
+REM StarPU is free software; you can redistribute it and/or modify
+REM it under the terms of the GNU Lesser General Public License as published by
+REM the Free Software Foundation; either version 2.1 of the License, or (at
+REM your option) any later version.
+REM
+REM StarPU is distributed in the hope that it will be useful, but
+REM WITHOUT ANY WARRANTY; without even the implied warranty of
+REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+REM
+REM See the GNU Lesser General Public License in COPYING.LGPL for more details.
+
+TITLE MVSC StarPU Environment
+ECHO.
+ECHO MVSC StarPU Environment
+
+IF NOT EXIST %STARPU_PATH%\AUTHORS GOTO starpunotfound
+
+ECHO.
+ECHO Setting environment from %STARPU_PATH%
+
+set STARPU_LIBDIR=%STARPU_PATH%/lib
+set STARPU_INCLUDEDIR=%STARPU_PATH%/include
+set STARPU_CFLAGS=/I%STARPU_INCLUDEDIR%\starpu\@STARPU_EFFECTIVE_VERSION@ @STARPU_CUDA_CPPFLAGS@
+set STARPU_LDFLAGS=/link %STARPU_PATH%\lib\libstarpu-@STARPU_EFFECTIVE_VERSION@.lib
+
+GOTO end
+
+:starpunotfound
+  ECHO.
+  ECHO You need to set the variable STARPU_PATH to a valid StarPU installation directory
+  exit /B 1
+  GOTO end
+
+:end