浏览代码

record ghost tasks for bound computation too. Fix implicit ghost dependency into using the pre_sync tasks

Samuel Thibault 14 年之前
父节点
当前提交
3ef7d1d4d6
共有 7 个文件被更改,包括 161 次插入85 次删除
  1. 1 0
      src/common/fxt.h
  2. 74 43
      src/core/dependencies/implicit_data_deps.c
  3. 5 3
      src/core/jobs.c
  4. 1 1
      src/core/jobs.h
  5. 0 2
      src/datawizard/coherency.h
  6. 74 36
      src/profiling/bound.c
  7. 6 0
      src/profiling/bound.h

+ 1 - 0
src/common/fxt.h

@@ -310,6 +310,7 @@ do {										\
 #define STARPU_TRACE_TAG(tag, job)	do {} while(0);
 #define STARPU_TRACE_TAG_DEPS(a, b)	do {} while(0);
 #define STARPU_TRACE_TASK_DEPS(a, b)		do {} while(0);
+#define STARPU_TRACE_GHOST_TASK_DEPS(a, b)	do {} while(0);
 #define STARPU_TRACE_TASK_DONE(a)		do {} while(0);
 #define STARPU_TRACE_TAG_DONE(a)		do {} while(0);
 #define STARPU_TRACE_DATA_COPY(a, b, c)		do {} while(0);

+ 74 - 43
src/core/dependencies/implicit_data_deps.c

@@ -18,6 +18,7 @@
 #include <common/config.h>
 #include <core/task.h>
 #include <datawizard/datawizard.h>
+#include <profiling/bound.h>
 
 #if 0
 # define _STARPU_DEP_DEBUG(fmt, args ...) fprintf(stderr, fmt, ##args);
@@ -40,17 +41,21 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 
 	if (handle->sequential_consistency)
 	{
-#ifdef STARPU_USE_FXT
+		_STARPU_DEP_DEBUG("Tasks %p %p\n", pre_sync_task, post_sync_task);
 		/* In case we are generating the DAG, we add an implicit
 		 * dependency between the pre and the post sync tasks in case
 		 * they are not the same. */
-		if (pre_sync_task != post_sync_task)
+		if (pre_sync_task != post_sync_task
+#ifndef STARPU_USE_FXT
+			&& _starpu_bound_recording
+#endif
+		)
 		{
 			starpu_job_t pre_sync_job = _starpu_get_job_associated_to_task(pre_sync_task);
 			starpu_job_t post_sync_job = _starpu_get_job_associated_to_task(post_sync_task);
 			STARPU_TRACE_GHOST_TASK_DEPS(pre_sync_job->job_id, post_sync_job->job_id);
+			_starpu_bound_task_dep(pre_sync_job, post_sync_job);
 		}
-#endif
 
 		starpu_access_mode previous_mode = handle->last_submitted_mode;
 	
@@ -66,19 +71,27 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 				{
 					struct starpu_task *task_array[1] = {handle->last_submitted_writer};
 					starpu_task_declare_deps_array(pre_sync_task, 1, task_array);
-				}
+					_STARPU_DEP_DEBUG("dep %p -> %p\n", handle->last_submitted_writer, pre_sync_task);
+				} else
+					_STARPU_DEP_DEBUG("No dep\n");
 
-#ifdef STARPU_USE_FXT
 				/* If there is a ghost writer instead, we
 				 * should declare a ghost dependency here, and
 				 * invalidate the ghost value. */
-				if (handle->last_submitted_ghost_writer_id_is_valid)
+#ifndef STARPU_USE_FXT
+				if (_starpu_bound_recording)
+#endif
 				{
-					starpu_job_t post_sync_job = _starpu_get_job_associated_to_task(post_sync_task);
-					STARPU_TRACE_GHOST_TASK_DEPS(handle->last_submitted_ghost_writer_id, post_sync_job->job_id);
-					handle->last_submitted_ghost_writer_id_is_valid = 0;
+					if (handle->last_submitted_ghost_writer_id_is_valid)
+					{
+						starpu_job_t pre_sync_job = _starpu_get_job_associated_to_task(pre_sync_task);
+						STARPU_TRACE_GHOST_TASK_DEPS(handle->last_submitted_ghost_writer_id, pre_sync_job->job_id);
+						_starpu_bound_job_id_dep(handle->last_submitted_ghost_writer_id, pre_sync_job);
+						_STARPU_DEP_DEBUG("dep ID%lu -> %p\n", handle->last_submitted_ghost_writer_id, pre_sync_task);
+						handle->last_submitted_ghost_writer_id_is_valid = 0;
+					} else
+						_STARPU_DEP_DEBUG("No dep ID\n");
 				}
-#endif
 	
 				handle->last_submitted_writer = post_sync_task;
 			}
@@ -107,27 +120,33 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 				{
 					STARPU_ASSERT(l->task);
 					task_array[i++] = l->task;
+					_STARPU_DEP_DEBUG("dep %p -> %p\n", l->task, pre_sync_task);
 
 					struct starpu_task_wrapper_list *prev = l;
 					l = l->next;
 					free(prev);
 				}
-#ifdef STARPU_USE_FXT
-				/* Declare all dependencies with ghost readers */
-				starpu_job_t post_sync_job = _starpu_get_job_associated_to_task(post_sync_task);
-
-				struct starpu_jobid_list *ghost_readers_id = handle->last_submitted_ghost_readers_id;
-				while (ghost_readers_id)
+#ifndef STARPU_USE_FXT
+				if (_starpu_bound_recording)
 				{
-					unsigned long id = ghost_readers_id->id;
-					STARPU_TRACE_GHOST_TASK_DEPS(id, post_sync_job->job_id);
-
-					struct starpu_jobid_list *prev = ghost_readers_id;
-					ghost_readers_id = ghost_readers_id->next;
-					free(prev);
-				}
-				handle->last_submitted_ghost_readers_id = NULL;
 #endif
+					/* Declare all dependencies with ghost readers */
+					starpu_job_t pre_sync_job = _starpu_get_job_associated_to_task(pre_sync_task);
+
+					struct starpu_jobid_list *ghost_readers_id = handle->last_submitted_ghost_readers_id;
+					while (ghost_readers_id)
+					{
+						unsigned long id = ghost_readers_id->id;
+						STARPU_TRACE_GHOST_TASK_DEPS(id, pre_sync_job->job_id);
+						_starpu_bound_job_id_dep(id, pre_sync_job);
+						_STARPU_DEP_DEBUG("dep ID%lu -> %p\n", id, pre_sync_task);
+
+						struct starpu_jobid_list *prev = ghost_readers_id;
+						ghost_readers_id = ghost_readers_id->next;
+						free(prev);
+					}
+					handle->last_submitted_ghost_readers_id = NULL;
+				}
 
 				handle->last_submitted_readers = NULL;
 				handle->last_submitted_writer = post_sync_task;
@@ -153,19 +172,25 @@ void _starpu_detect_implicit_data_deps_with_handle(struct starpu_task *pre_sync_
 			{
 				_STARPU_DEP_DEBUG("RAW %p\n", handle);
 				struct starpu_task *task_array[1] = {handle->last_submitted_writer};
+				_STARPU_DEP_DEBUG("dep %p -> %p\n", handle->last_submitted_writer, pre_sync_task);
 				starpu_task_declare_deps_array(pre_sync_task, 1, task_array);
-			}
+			} else
+				_STARPU_DEP_DEBUG("No dep\n");
 
-#ifdef STARPU_USE_FXT
 			/* There was perhaps no last submitted writer but a
 			 * ghost one, we should report that here, and keep the
 			 * ghost writer valid */
-			if (handle->last_submitted_ghost_writer_id_is_valid)
+			if (
+#ifndef STARPU_USE_FXT
+				_starpu_bound_recording &&
+#endif
+				handle->last_submitted_ghost_writer_id_is_valid)
 			{
-				starpu_job_t post_sync_job = _starpu_get_job_associated_to_task(post_sync_task);
-				STARPU_TRACE_GHOST_TASK_DEPS(handle->last_submitted_ghost_writer_id, post_sync_job->job_id);
+				starpu_job_t pre_sync_job = _starpu_get_job_associated_to_task(pre_sync_task);
+				STARPU_TRACE_GHOST_TASK_DEPS(handle->last_submitted_ghost_writer_id, pre_sync_job->job_id);
+				_starpu_bound_job_id_dep(handle->last_submitted_ghost_writer_id, pre_sync_job);
+				_STARPU_DEP_DEBUG("dep ID%lu -> %p\n", handle->last_submitted_ghost_writer_id, pre_sync_task);
 			}
-#endif
 		}
 	
 		handle->last_submitted_mode = mode;
@@ -216,12 +241,15 @@ void _starpu_release_data_enforce_sequential_consistency(struct starpu_task *tas
 		{
 			handle->last_submitted_writer = NULL;
 			
-#ifdef STARPU_USE_FXT
-			/* Save the previous writer as the ghost last writer */
-			handle->last_submitted_ghost_writer_id_is_valid = 1;
-			starpu_job_t ghost_job = _starpu_get_job_associated_to_task(task);
-			handle->last_submitted_ghost_writer_id = ghost_job->job_id;
+#ifndef STARPU_USE_FXT
+			if (_starpu_bound_recording)
 #endif
+			{
+				/* Save the previous writer as the ghost last writer */
+				handle->last_submitted_ghost_writer_id_is_valid = 1;
+				starpu_job_t ghost_job = _starpu_get_job_associated_to_task(task);
+				handle->last_submitted_ghost_writer_id = ghost_job->job_id;
+			}
 			
 		}
 		
@@ -244,15 +272,18 @@ void _starpu_release_data_enforce_sequential_consistency(struct starpu_task *tas
 				/* If we found the task in the reader list */
 				free(l);
 
-#ifdef STARPU_USE_FXT
-				/* Save the job id of the reader task in the ghost reader linked list list */
-				starpu_job_t ghost_reader_job = _starpu_get_job_associated_to_task(task);
-				struct starpu_jobid_list *link = malloc(sizeof(struct starpu_jobid_list));
-				STARPU_ASSERT(link);
-				link->next = handle->last_submitted_ghost_readers_id;
-				link->id = ghost_reader_job->job_id; 
-				handle->last_submitted_ghost_readers_id = link;
+#ifndef STARPU_USE_FXT
+				if (_starpu_bound_recording)
 #endif
+				{
+					/* Save the job id of the reader task in the ghost reader linked list list */
+					starpu_job_t ghost_reader_job = _starpu_get_job_associated_to_task(task);
+					struct starpu_jobid_list *link = malloc(sizeof(struct starpu_jobid_list));
+					STARPU_ASSERT(link);
+					link->next = handle->last_submitted_ghost_readers_id;
+					link->id = ghost_reader_job->job_id; 
+					handle->last_submitted_ghost_readers_id = link;
+				}
 
 				if (prev)
 				{

+ 5 - 3
src/core/jobs.c

@@ -21,6 +21,7 @@
 #include <core/dependencies/data_concurrency.h>
 #include <common/config.h>
 #include <common/utils.h>
+#include <profiling/bound.h>
 
 size_t _starpu_job_get_data_size(starpu_job_t j)
 {
@@ -40,10 +41,8 @@ size_t _starpu_job_get_data_size(starpu_job_t j)
 	return size;
 }
 
-#ifdef STARPU_USE_FXT
 /* we need to identify each task to generate the DAG. */
 static unsigned long job_cnt = 0;
-#endif
 
 void _starpu_exclude_task_from_dag(struct starpu_task *task)
 {
@@ -65,8 +64,11 @@ starpu_job_t __attribute__((malloc)) _starpu_job_create(struct starpu_task *task
 	job->submitted = 0;
 	job->terminated = 0;
 
+#ifndef STARPU_USE_FXT
+	if (_starpu_bound_recording)
+#endif
+		job->job_id = STARPU_ATOMIC_ADD(&job_cnt, 1);
 #ifdef STARPU_USE_FXT
-	job->job_id = STARPU_ATOMIC_ADD(&job_cnt, 1);
 	/* display all tasks by default */
         job->model_name = NULL;
 #endif

+ 1 - 1
src/core/jobs.h

@@ -73,8 +73,8 @@ LIST_TYPE(starpu_job,
 
         unsigned exclude_from_dag;
 
-#ifdef STARPU_USE_FXT
 	unsigned long job_id;
+#ifdef STARPU_USE_FXT
         const char *model_name;
 #endif
 	struct bound_task *bound_task;

+ 0 - 2
src/datawizard/coherency.h

@@ -135,7 +135,6 @@ struct starpu_data_state_t {
 	struct starpu_task *last_submitted_writer;
 	struct starpu_task_wrapper_list *last_submitted_readers;
 
-#ifdef STARPU_USE_FXT
 	/* If FxT is enabled, we keep track of "ghost dependencies": that is to
 	 * say the dependencies that are not needed anymore, but that should
 	 * appear in the post-mortem DAG. For instance if we have the sequence
@@ -145,7 +144,6 @@ struct starpu_data_state_t {
 	unsigned last_submitted_ghost_writer_id_is_valid;
 	unsigned long last_submitted_ghost_writer_id;
 	struct starpu_jobid_list *last_submitted_ghost_readers_id;
-#endif
 	
 	struct starpu_task_wrapper_list *post_sync_tasks;
 	unsigned post_sync_tasks_cnt;

+ 74 - 36
src/profiling/bound.c

@@ -77,7 +77,7 @@ struct bound_task_pool {
  * is not taken into account, only tags associated with a task are. */
 struct bound_task {
 	/* Unique ID */
-	int id;
+	unsigned long id;
 	/* Tag ID, if any */
 	starpu_tag_t tag_id;
 	int use_tag;
@@ -107,7 +107,7 @@ struct bound_tag_dep {
 static struct bound_task_pool *task_pools, *last;
 static struct bound_task *tasks;
 static struct bound_tag_dep *tag_deps;
-static int recording;
+int _starpu_bound_recording;
 static int recorddeps;
 static int recordprio;
 
@@ -131,7 +131,7 @@ void starpu_bound_start(int deps, int prio)
 	td = tag_deps;
 	tag_deps = NULL;
 
-	recording = 1;
+	_starpu_bound_recording = 1;
 	recorddeps = deps;
 	recordprio = prio;
 
@@ -166,7 +166,6 @@ static int good_job(starpu_job_t j)
 static void new_task(starpu_job_t j)
 {
 	struct bound_task *t;
-	static int task_ids;
 
 	if (j->bound_task)
 		return;
@@ -176,7 +175,7 @@ static void new_task(starpu_job_t j)
 
 	t = malloc(sizeof(*t));
 	memset(t, 0, sizeof(*t));
-	t->id = task_ids++;
+	t->id = j->job_id;
 	t->tag_id = j->task->tag_id;
 	t->use_tag = j->task->use_tag;
 	t->cl = j->task->cl;
@@ -191,7 +190,7 @@ static void new_task(starpu_job_t j)
 
 void _starpu_bound_record(starpu_job_t j)
 {
-	if (!recording)
+	if (!_starpu_bound_recording)
 		return;
 
 	if (!good_job(j))
@@ -199,7 +198,7 @@ void _starpu_bound_record(starpu_job_t j)
 
 	PTHREAD_MUTEX_LOCK(&mutex);
 	/* Re-check, this time with mutex held */
-	if (!recording) {
+	if (!_starpu_bound_recording) {
 		PTHREAD_MUTEX_UNLOCK(&mutex);
 		return;
 	}
@@ -239,12 +238,12 @@ void _starpu_bound_tag_dep(starpu_tag_t id, starpu_tag_t dep_id)
 {
 	struct bound_tag_dep *td;
 
-	if (!recording || !recorddeps)
+	if (!_starpu_bound_recording || !recorddeps)
 		return;
 
 	PTHREAD_MUTEX_LOCK(&mutex);
 	/* Re-check, this time with mutex held */
-	if (!recording || !recorddeps) {
+	if (!_starpu_bound_recording || !recorddeps) {
 		PTHREAD_MUTEX_UNLOCK(&mutex);
 		return;
 	}
@@ -261,7 +260,7 @@ void _starpu_bound_task_dep(starpu_job_t j, starpu_job_t dep_j)
 {
 	struct bound_task *t;
 
-	if (!recording || !recorddeps)
+	if (!_starpu_bound_recording || !recorddeps)
 		return;
 
 	if (!good_job(j) || !good_job(dep_j))
@@ -269,7 +268,7 @@ void _starpu_bound_task_dep(starpu_job_t j, starpu_job_t dep_j)
 
 	PTHREAD_MUTEX_LOCK(&mutex);
 	/* Re-check, this time with mutex held */
-	if (!recording || !recorddeps) {
+	if (!_starpu_bound_recording || !recorddeps) {
 		PTHREAD_MUTEX_UNLOCK(&mutex);
 		return;
 	}
@@ -282,10 +281,49 @@ void _starpu_bound_task_dep(starpu_job_t j, starpu_job_t dep_j)
 	PTHREAD_MUTEX_UNLOCK(&mutex);
 }
 
+static struct bound_task *find_job(unsigned long id)
+{
+	struct bound_task *t;
+
+	for (t = tasks; t; t = t->next)
+		if (t->id == id)
+			return t;
+	return NULL;
+}
+
+void _starpu_bound_job_id_dep(unsigned long id, starpu_job_t dep_j)
+{
+	struct bound_task *t;
+
+	if (!_starpu_bound_recording || !recorddeps)
+		return;
+
+	if (!good_job(dep_j))
+		return;
+
+	PTHREAD_MUTEX_LOCK(&mutex);
+	/* Re-check, this time with mutex held */
+	if (!_starpu_bound_recording || !recorddeps) {
+		PTHREAD_MUTEX_UNLOCK(&mutex);
+		return;
+	}
+
+	new_task(dep_j);
+	t = find_job(id);
+	if (!t) {
+		fprintf(stderr,"dependency %lu not found !\n", id);
+		PTHREAD_MUTEX_UNLOCK(&mutex);
+		return;
+	}
+	t->deps = realloc(t->deps, ++t->depsn * sizeof(t->deps[0]));
+	t->deps[t->depsn-1] = dep_j->bound_task;
+	PTHREAD_MUTEX_UNLOCK(&mutex);
+}
+
 void starpu_bound_stop(void)
 {
 	PTHREAD_MUTEX_LOCK(&mutex);
-	recording = 0;
+	_starpu_bound_recording = 0;
 	PTHREAD_MUTEX_UNLOCK(&mutex);
 }
 
@@ -362,14 +400,14 @@ void starpu_bound_print_lp(FILE *output)
 
 		fprintf(output, "/* Which is the maximum of all task completion times (ms) */\n");
 		for (t = tasks; t; t = t->next)
-			fprintf(output, "c%u <= tmax;\n", t->id);
+			fprintf(output, "c%lu <= tmax;\n", t->id);
 
 		fprintf(output, "\n/* We have tasks executing on workers, exactly one worker executes each task */\n");
 		for (t = tasks; t; t = t->next) {
 			for (w = 0; w < nw; w++) {
 				enum starpu_perf_archtype arch = starpu_worker_get_perf_archtype(w);
 				if (t->duration[arch] != -1.0)
-					fprintf(output, " +t%uw%u", t->id, w);
+					fprintf(output, " +t%luw%u", t->id, w);
 			}
 			fprintf(output, " = 1;\n");
 		}
@@ -377,11 +415,11 @@ void starpu_bound_print_lp(FILE *output)
 		fprintf(output, "\n/* Completion time is start time plus computation time */\n");
 		fprintf(output, "/* According to where the task is indeed executed */\n");
 		for (t = tasks; t; t = t->next) {
-			fprintf(output, "/* %s %x */\tc%u = s%u", t->cl->model->symbol, (unsigned) t->footprint, t->id, t->id);
+			fprintf(output, "/* %s %x */\tc%lu = s%lu", t->cl->model->symbol, (unsigned) t->footprint, t->id, t->id);
 			for (w = 0; w < nw; w++) {
 				enum starpu_perf_archtype arch = starpu_worker_get_perf_archtype(w);
 				if (t->duration[arch] != -1.0)
-					fprintf(output, " + %f t%uw%u", t->duration[arch], t->id, w);
+					fprintf(output, " + %f t%luw%u", t->duration[arch], t->id, w);
 			}
 			fprintf(output, ";\n");
 		}
@@ -390,13 +428,13 @@ void starpu_bound_print_lp(FILE *output)
 		fprintf(output, "/* Note that the dependency finish time depends on the worker where it's working */\n");
 		for (t = tasks; t; t = t->next)
 			for (i = 0; i < t->depsn; i++)
-				fprintf(output, "s%u >= c%u;\n", t->id, t->deps[i]->id);
+				fprintf(output, "s%lu >= c%lu;\n", t->id, t->deps[i]->id);
 
 		fprintf(output, "\n/* Each tag finishes when its corresponding task finishes */");
 		for (t = tasks; t; t = t->next)
 			if (t->use_tag) {
 				for (w = 0; w < nw; w++)
-					fprintf(output, "c%u = tag%lu;\n", t->id, (unsigned long) t->tag_id);
+					fprintf(output, "c%lu = tag%lu;\n", t->id, (unsigned long) t->tag_id);
 			}
 
 		fprintf(output, "\n/* tags start after all their tag dependencies finish. */\n");
@@ -413,9 +451,9 @@ void starpu_bound_print_lp(FILE *output)
 					for (w = 0; w < nw; w++) {
 						enum starpu_perf_archtype arch = starpu_worker_get_perf_archtype(w);
 						if (t->duration[arch] != -1.0) {
-							fprintf(output, "s%u - c%u >= -3e5 + 1e5 t%uw%u + 1e5 t%uw%u + 1e5 t%uafter%u;\n",
+							fprintf(output, "s%lu - c%lu >= -3e5 + 1e5 t%luw%u + 1e5 t%luw%u + 1e5 t%luafter%lu;\n",
 									t->id, t2->id, t->id, w, t2->id, w, t->id, t2->id);
-							fprintf(output, "s%u - c%u >= -2e5 + 1e5 t%uw%u + 1e5 t%uw%u - 1e5 t%uafter%u;\n",
+							fprintf(output, "s%lu - c%lu >= -2e5 + 1e5 t%luw%u + 1e5 t%luw%u - 1e5 t%luafter%lu;\n",
 									t2->id, t->id, t->id, w, t2->id, w, t->id, t2->id);
 						}
 					}
@@ -429,8 +467,8 @@ void starpu_bound_print_lp(FILE *output)
 			for (t2 = t->next; t2; t2 = t2->next)
 				if (!ancestor(t, t2) && !ancestor(t2, t))
 				{
-					fprintf(output, "s%u - s%u >= -1e5 + 1e5 t%uafter%u;\n", t->id, t2->id, t->id, t2->id);
-					fprintf(output, "s%u - s%u >= -1e5 t%uafter%u;\n", t2->id, t->id, t->id, t2->id);
+					fprintf(output, "s%lu - s%lu >= -1e5 + 1e5 t%luafter%lu;\n", t->id, t2->id, t->id, t2->id);
+					fprintf(output, "s%lu - s%lu >= -1e5 t%luafter%lu;\n", t2->id, t->id, t->id, t2->id);
 				}
 #endif
 
@@ -449,24 +487,24 @@ void starpu_bound_print_lp(FILE *output)
 							/* One of the t deps to give the maximum start time for t2 */
 							if (t->depsn > 1) {
 								for (i = 0; i < t->depsn; i++)
-									fprintf(output, " + t%ut%ud%u", t2->id, t->id, i);
+									fprintf(output, " + t%lut%lud%u", t2->id, t->id, i);
 								fprintf(output, " = 1;\n");
 							}
 
 							for (i = 0; i < t->depsn; i++) {
-								fprintf(output, "c%u - s%u >= ", t->deps[i]->id, t2->id);
+								fprintf(output, "c%lu - s%lu >= ", t->deps[i]->id, t2->id);
 								if (t->depsn > 1)
 									/* Only checks this when it's this dependency that is chosen */
-									fprintf(output, "-2e5 + 1e5 t%ut%ud%u", t2->id, t->id, i);
+									fprintf(output, "-2e5 + 1e5 t%lut%lud%u", t2->id, t->id, i);
 								else
 									fprintf(output, "-1e5");
 								/* Only check this if t is after t2 */
-								fprintf(output, " + 1e5 t%uafter%u", t->id, t2->id);
+								fprintf(output, " + 1e5 t%luafter%lu", t->id, t2->id);
 								fprintf(output, ";\n");
 							}
 
 							/* Or t2 is scheduled after t is.  */
-							fprintf(output, "s%u - s%u >= -1e5 t%uafter%u;\n", t2->id, t->id, t->id, t2->id);
+							fprintf(output, "s%lu - s%lu >= -1e5 t%luafter%lu;\n", t2->id, t->id, t->id, t2->id);
 						} else {
 							/* Either t is scheduled before t2, but then it
 							   needs to be scheduled before some t2 dep finishes */
@@ -474,21 +512,21 @@ void starpu_bound_print_lp(FILE *output)
 							/* One of the t2 deps to give the maximum start time for t */
 							if (t2->depsn > 1) {
 								for (i = 0; i < t2->depsn; i++)
-									fprintf(output, " + t%ut%ud%u", t->id, t2->id, i);
+									fprintf(output, " + t%lut%lud%u", t->id, t2->id, i);
 								fprintf(output, " = 1;\n");
 							}
 
 							for (i = 0; i < t2->depsn; i++) {
-								fprintf(output, "c%u - s%u >= ", t2->deps[i]->id, t->id);
+								fprintf(output, "c%lu - s%lu >= ", t2->deps[i]->id, t->id);
 								if (t2->depsn > 1)
 									/* Only checks this when it's this dependency that is chosen */
-									fprintf(output, "-1e5 + 1e5 t%ut%ud%u", t->id, t2->id, i);
+									fprintf(output, "-1e5 + 1e5 t%lut%lud%u", t->id, t2->id, i);
 								/* Only check this if t2 is after t */
-								fprintf(output, " - 1e5 t%uafter%u;\n", t->id, t2->id);
+								fprintf(output, " - 1e5 t%luafter%lu;\n", t->id, t2->id);
 							}
 
 							/* Or t is scheduled after t2 is.  */
-							fprintf(output, "s%u - s%u >= -1e5 + 1e5 t%uafter%u;\n", t->id, t2->id, t->id, t2->id);
+							fprintf(output, "s%lu - s%lu >= -1e5 + 1e5 t%luafter%lu;\n", t->id, t2->id, t->id, t2->id);
 						}
 					}
 				}
@@ -499,23 +537,23 @@ void starpu_bound_print_lp(FILE *output)
 		for (t = tasks; t; t = t->next)
 			for (t2 = t->next; t2; t2 = t2->next)
 				if (!ancestor(t, t2) && !ancestor(t2, t)) {
-					fprintf(output, "bin t%uafter%u;\n", t->id, t2->id);
+					fprintf(output, "bin t%luafter%lu;\n", t->id, t2->id);
 					if (recordprio && t->priority != t2->priority) {
 						if (t->priority > t2->priority) {
 							if (t->depsn > 1)
 								for (i = 0; i < t->depsn; i++)
-									fprintf(output, "bin t%ut%ud%u;\n", t2->id, t->id, i);
+									fprintf(output, "bin t%lut%lud%u;\n", t2->id, t->id, i);
 						} else {
 							if (t2->depsn > 1)
 								for (i = 0; i < t2->depsn; i++)
-									fprintf(output, "bin t%ut%ud%u;\n", t->id, t2->id, i);
+									fprintf(output, "bin t%lut%lud%u;\n", t->id, t2->id, i);
 						}
 					}
 				}
 
 		for (t = tasks; t; t = t->next)
 			for (w = 0; w < nw; w++)
-				fprintf(output, "bin t%uw%u;\n", t->id, w);
+				fprintf(output, "bin t%luw%u;\n", t->id, w);
 	} else {
 		struct bound_task_pool *tp;
 		nt = 0;

+ 6 - 0
src/profiling/bound.h

@@ -21,6 +21,9 @@
 #include <starpu_bound.h>
 #include <core/jobs.h>
 
+/* Are we recording? */
+extern int _starpu_bound_recording;
+
 /* Record task for bound computation */
 extern void _starpu_bound_record(starpu_job_t j);
 
@@ -30,4 +33,7 @@ extern void _starpu_bound_tag_dep(starpu_tag_t id, starpu_tag_t dep_id);
 /* Record task dependency */
 extern void _starpu_bound_task_dep(starpu_job_t j, starpu_job_t dep_j);
 
+/* Record job id dependency */
+extern void _starpu_bound_job_id_dep(unsigned long job_id, starpu_job_t dep_j);
+
 #endif // __BOUND_H__