浏览代码

Prefixing of src/core/dependencies/cg.h

find . -type f -not -name "*svn*"|xargs sed -i s/"\bDYNAMIC_DEPS_SIZE\b"/STARPU_DYNAMIC_DEPS_SIZE/g
find . -type f -not -name "*svn*"|xargs sed -i s/"\bNMAXDEPS\b"/STARPU_NMAXDEPS/g
find . -type f -not -name "*svn*"|xargs sed -i s/"\bcg_list_s\b"/starpu_cg_list_s/g
find . -type f -not -name "*svn*"|xargs sed -i s/"\bCG_APPS\b"/STARPU_CG_APPS/g
find . -type f -not -name "*svn*"|xargs sed -i s/"\bCG_TAG\b"/STARPU_CG_TAG/g
find . -type f -not -name "*svn*"|xargs sed -i s/"\bCG_TASK\b"/STARPU_CG_TASK/g
find . -type f -not -name "*svn*"|xargs sed -i s/"\bcg_s\b"/starpu_cg_s/g
find . -type f -not -name "*svn*"|xargs sed -i s/"\bcg_t\b"/starpu_cg_t/g
Nathalie Furmento 15 年之前
父节点
当前提交
b2db899e9c

+ 17 - 17
src/core/dependencies/cg.c

@@ -20,26 +20,26 @@
 #include <core/dependencies/cg.h>
 #include <core/dependencies/tags.h>
 
-void _starpu_cg_list_init(struct cg_list_s *list)
+void _starpu_cg_list_init(struct starpu_cg_list_s *list)
 {
 	list->nsuccs = 0;
 	list->ndeps = 0;
 	list->ndeps_completed = 0;
 
-#ifdef DYNAMIC_DEPS_SIZE
+#ifdef STARPU_DYNAMIC_DEPS_SIZE
 	/* this is a small initial default value ... may be changed */
 	list->succ_list_size = 0;
 	list->succ =
-		realloc(NULL, list->succ_list_size*sizeof(struct cg_s *));
+		realloc(NULL, list->succ_list_size*sizeof(struct starpu_cg_s *));
 #endif
 }
 
-void _starpu_add_successor_to_cg_list(struct cg_list_s *successors, cg_t *cg)
+void _starpu_add_successor_to_cg_list(struct starpu_cg_list_s *successors, starpu_cg_t *cg)
 {
 	/* where should that cg should be put in the array ? */
 	unsigned index = STARPU_ATOMIC_ADD(&successors->nsuccs, 1) - 1;
 
-#ifdef DYNAMIC_DEPS_SIZE
+#ifdef STARPU_DYNAMIC_DEPS_SIZE
 	if (index >= successors->succ_list_size)
 	{
 		/* the successor list is too small */
@@ -50,15 +50,15 @@ void _starpu_add_successor_to_cg_list(struct cg_list_s *successors, cg_t *cg)
 
 		/* NB: this is thread safe as the tag->lock is taken */
 		successors->succ = realloc(successors->succ, 
-			successors->succ_list_size*sizeof(struct cg_s *));
+			successors->succ_list_size*sizeof(struct starpu_cg_s *));
 	}
 #else
-	STARPU_ASSERT(index < NMAXDEPS);
+	STARPU_ASSERT(index < STARPU_NMAXDEPS);
 #endif
 	successors->succ[index] = cg;
 }
 
-void _starpu_notify_cg(cg_t *cg)
+void _starpu_notify_cg(starpu_cg_t *cg)
 {
 	STARPU_ASSERT(cg);
 	unsigned remaining = STARPU_ATOMIC_ADD(&cg->remaining, -1);
@@ -66,12 +66,12 @@ void _starpu_notify_cg(cg_t *cg)
 		cg->remaining = cg->ntags;
 
 		struct tag_s *tag;
-		struct cg_list_s *tag_successors, *job_successors;
+		struct starpu_cg_list_s *tag_successors, *job_successors;
 		starpu_job_t j;
 
 		/* the group is now completed */
 		switch (cg->cg_type) {
-			case CG_APPS:
+			case STARPU_CG_APPS:
 				/* this is a cg for an application waiting on a set of
 	 			 * tags, wake the thread */
 				pthread_mutex_lock(&cg->succ.succ_apps.cg_mutex);
@@ -80,7 +80,7 @@ void _starpu_notify_cg(cg_t *cg)
 				pthread_mutex_unlock(&cg->succ.succ_apps.cg_mutex);
 				break;
 
-			case CG_TAG:
+			case STARPU_CG_TAG:
 				tag = cg->succ.tag;
 				tag_successors = &tag->tag_successors;
 	
@@ -94,7 +94,7 @@ void _starpu_notify_cg(cg_t *cg)
 				}
 				break;
 
-			case CG_TASK:
+			case STARPU_CG_TASK:
 				/* TODO */
 				j = cg->succ.job;
 
@@ -118,7 +118,7 @@ void _starpu_notify_cg(cg_t *cg)
 	}
 }
 
-void _starpu_notify_cg_list(struct cg_list_s *successors)
+void _starpu_notify_cg_list(struct starpu_cg_list_s *successors)
 {
 	unsigned nsuccs;
 	unsigned succ;
@@ -127,16 +127,16 @@ void _starpu_notify_cg_list(struct cg_list_s *successors)
 
 	for (succ = 0; succ < nsuccs; succ++)
 	{
-		struct cg_s *cg = successors->succ[succ];
+		struct starpu_cg_s *cg = successors->succ[succ];
 		struct tag_s *cgtag = cg->succ.tag;
 
 		unsigned cg_type = cg->cg_type;
 
-		if (cg_type == CG_TAG)
+		if (cg_type == STARPU_CG_TAG)
 			starpu_spin_lock(&cgtag->lock);
 
 		_starpu_notify_cg(cg);
-		if (cg_type == CG_APPS) {
+		if (cg_type == STARPU_CG_APPS) {
 			/* Remove the temporary ref to the cg */
 			memmove(&successors->succ[succ], &successors->succ[succ+1], (nsuccs-(succ+1)) * sizeof(successors->succ[succ]));
 			succ--;
@@ -144,7 +144,7 @@ void _starpu_notify_cg_list(struct cg_list_s *successors)
 			successors->nsuccs--;
 		}
 
-		if (cg_type == CG_TAG)
+		if (cg_type == STARPU_CG_TAG)
 			starpu_spin_unlock(&cgtag->lock);
 	}
 }

+ 20 - 20
src/core/dependencies/cg.h

@@ -23,45 +23,45 @@
 /* we do not necessarily want to allocate room for 256 dependencies, but we
    want to handle the few situation where there are a lot of dependencies as
    well */
-#define DYNAMIC_DEPS_SIZE	1
+#define STARPU_DYNAMIC_DEPS_SIZE	1
 
 /* randomly choosen ! */
-#ifndef DYNAMIC_DEPS_SIZE
-#define NMAXDEPS	256
+#ifndef STARPU_DYNAMIC_DEPS_SIZE
+#define STARPU_NMAXDEPS	256
 #endif
 
 /* Completion Group list */
-struct cg_list_s {
+struct starpu_cg_list_s {
 	unsigned nsuccs; /* how many successors ? */
 	unsigned ndeps; /* how many deps ? */
 	unsigned ndeps_completed; /* how many deps are done ? */
-#ifdef DYNAMIC_DEPS_SIZE
+#ifdef STARPU_DYNAMIC_DEPS_SIZE
 	unsigned succ_list_size;
-	struct cg_s **succ;
+	struct starpu_cg_s **succ;
 #else
-	struct cg_s *succ[NMAXDEPS];
+	struct starpu_cg_s *succ[STARPU_NMAXDEPS];
 #endif
 };
 
-#define CG_APPS	(1<<0)
-#define CG_TAG	(1<<1)
-#define CG_TASK	(1<<2)
+#define STARPU_CG_APPS	(1<<0)
+#define STARPU_CG_TAG	(1<<1)
+#define STARPU_CG_TASK	(1<<2)
 
 /* Completion Group */
-typedef struct cg_s {
+typedef struct starpu_cg_s {
 	unsigned ntags; /* number of tags depended on */
 	unsigned remaining; /* number of remaining tags */
 
-	unsigned cg_type; /* CG_APPS or CG_TAG or CG_TASK */
+	unsigned cg_type; /* STARPU_CG_APPS or STARPU_CG_TAG or STARPU_CG_TASK */
 
 	union {
-		/* CG_TAG */
+		/* STARPU_CG_TAG */
 		struct tag_s *tag;
 
-		/* CG_TASK */
+		/* STARPU_CG_TASK */
 		struct starpu_job_s *job;
 
-		/* CG_APPS */
+		/* STARPU_CG_APPS */
 		/* in case this completion group is related to an application,
 		 * we have to explicitely wake the waiting thread instead of
 		 * reschedule the corresponding task */
@@ -71,12 +71,12 @@ typedef struct cg_s {
 			pthread_cond_t cg_cond;
 		} succ_apps;
 	} succ;
-} cg_t;
+} starpu_cg_t;
 
-void _starpu_cg_list_init(struct cg_list_s *list);
-void _starpu_add_successor_to_cg_list(struct cg_list_s *successors, cg_t *cg);
-void _starpu_notify_cg(cg_t *cg);
-void _starpu_notify_cg_list(struct cg_list_s *successors);
+void _starpu_cg_list_init(struct starpu_cg_list_s *list);
+void _starpu_add_successor_to_cg_list(struct starpu_cg_list_s *successors, starpu_cg_t *cg);
+void _starpu_notify_cg(starpu_cg_t *cg);
+void _starpu_notify_cg_list(struct starpu_cg_list_s *successors);
 void _starpu_notify_task_dependencies(struct starpu_job_s *j);
 
 #endif // __CG_H__

+ 13 - 13
src/core/dependencies/tags.c

@@ -25,14 +25,14 @@
 static htbl_node_t *tag_htbl = NULL;
 static pthread_rwlock_t tag_global_rwlock = PTHREAD_RWLOCK_INITIALIZER;
 
-static cg_t *create_cg_apps(unsigned ntags)
+static starpu_cg_t *create_cg_apps(unsigned ntags)
 {
-	cg_t *cg = malloc(sizeof(cg_t));
+	starpu_cg_t *cg = malloc(sizeof(starpu_cg_t));
 	STARPU_ASSERT(cg);
 
 	cg->ntags = ntags;
 	cg->remaining = ntags;
-	cg->cg_type = CG_APPS;
+	cg->cg_type = STARPU_CG_APPS;
 
 	cg->succ.succ_apps.completed = 0;
 	pthread_mutex_init(&cg->succ.succ_apps.cg_mutex, NULL);
@@ -42,14 +42,14 @@ static cg_t *create_cg_apps(unsigned ntags)
 }
 
 
-static cg_t *create_cg_tag(unsigned ntags, struct tag_s *tag)
+static starpu_cg_t *create_cg_tag(unsigned ntags, struct tag_s *tag)
 {
-	cg_t *cg = malloc(sizeof(cg_t));
+	starpu_cg_t *cg = malloc(sizeof(starpu_cg_t));
 	STARPU_ASSERT(cg);
 
 	cg->ntags = ntags;
 	cg->remaining = ntags;
-	cg->cg_type = CG_TAG;
+	cg->cg_type = STARPU_CG_TAG;
 
 	cg->succ.tag = tag;
 	tag->tag_successors.ndeps++;
@@ -95,17 +95,17 @@ void starpu_tag_remove(starpu_tag_t id)
 
 		for (succ = 0; succ < nsuccs; succ++)
 		{
-			struct cg_s *cg = tag->tag_successors.succ[succ];
+			struct starpu_cg_s *cg = tag->tag_successors.succ[succ];
 
 			unsigned ntags = STARPU_ATOMIC_ADD(&cg->ntags, -1);
 			unsigned remaining __attribute__ ((unused)) = STARPU_ATOMIC_ADD(&cg->remaining, -1);
 
-			if (!ntags && (cg->cg_type == CG_TAG))
+			if (!ntags && (cg->cg_type == STARPU_CG_TAG))
 				/* Last tag this cg depends on, cg becomes unreferenced */
 				free(cg);
 		}
 
-#ifdef DYNAMIC_DEPS_SIZE
+#ifdef STARPU_DYNAMIC_DEPS_SIZE
 		free(tag->tag_successors.succ);
 #endif
 
@@ -159,7 +159,7 @@ void _starpu_tag_set_ready(struct tag_s *tag)
 }
 
 /* the lock must be taken ! */
-static void _starpu_tag_add_succ(struct tag_s *tag, cg_t *cg)
+static void _starpu_tag_add_succ(struct tag_s *tag, starpu_cg_t *cg)
 {
 	STARPU_ASSERT(tag);
 
@@ -229,7 +229,7 @@ void starpu_tag_declare_deps_array(starpu_tag_t id, unsigned ndeps, starpu_tag_t
 
 	starpu_spin_lock(&tag_child->lock);
 
-	cg_t *cg = create_cg_tag(ndeps, tag_child);
+	starpu_cg_t *cg = create_cg_tag(ndeps, tag_child);
 
 	STARPU_ASSERT(ndeps != 0);
 	
@@ -258,7 +258,7 @@ void starpu_tag_declare_deps(starpu_tag_t id, unsigned ndeps, ...)
 
 	starpu_spin_lock(&tag_child->lock);
 
-	cg_t *cg = create_cg_tag(ndeps, tag_child);
+	starpu_cg_t *cg = create_cg_tag(ndeps, tag_child);
 
 	STARPU_ASSERT(ndeps != 0);
 	
@@ -320,7 +320,7 @@ int starpu_tag_wait_array(unsigned ntags, starpu_tag_t *id)
 	}
 	
 	/* there is at least one task that is not finished */
-	cg_t *cg = create_cg_apps(current);
+	starpu_cg_t *cg = create_cg_apps(current);
 
 	for (i = 0; i < current; i++)
 	{

+ 1 - 1
src/core/dependencies/tags.h

@@ -48,7 +48,7 @@ struct tag_s {
 	starpu_tag_t id; /* an identifier for the task */
 	tag_state state;
 
-	struct cg_list_s tag_successors;
+	struct starpu_cg_list_s tag_successors;
 
 	struct starpu_job_s *job; /* which job is associated to the tag if any ? */
 

+ 5 - 5
src/core/dependencies/task-deps.c

@@ -23,14 +23,14 @@
 #include <core/policies/sched_policy.h>
 #include <core/dependencies/data-concurrency.h>
 
-static cg_t *create_cg_task(unsigned ntags, starpu_job_t j)
+static starpu_cg_t *create_cg_task(unsigned ntags, starpu_job_t j)
 {
-	cg_t *cg = malloc(sizeof(cg_t));
+	starpu_cg_t *cg = malloc(sizeof(starpu_cg_t));
 	STARPU_ASSERT(cg);
 
 	cg->ntags = ntags;
 	cg->remaining = ntags;
-	cg->cg_type = CG_TASK;
+	cg->cg_type = STARPU_CG_TASK;
 
 	cg->succ.job = j;
 	j->job_successors.ndeps++;
@@ -39,7 +39,7 @@ static cg_t *create_cg_task(unsigned ntags, starpu_job_t j)
 }
 
 /* the job lock must be taken */
-static void _starpu_task_add_succ(starpu_job_t j, cg_t *cg)
+static void _starpu_task_add_succ(starpu_job_t j, starpu_cg_t *cg)
 {
 	STARPU_ASSERT(j);
 
@@ -64,7 +64,7 @@ void starpu_task_declare_deps_array(struct starpu_task *task, unsigned ndeps, st
 	starpu_job_t job;
 
 	job = _starpu_get_job_associated_to_task(task);
-	cg_t *cg = create_cg_task(ndeps, job);
+	starpu_cg_t *cg = create_cg_task(ndeps, job);
 
 	STARPU_ASSERT(ndeps != 0);
 	

+ 2 - 2
src/core/jobs.c

@@ -160,7 +160,7 @@ static unsigned _starpu_not_all_tag_deps_are_fulfilled(starpu_job_t j)
 
 	struct tag_s *tag = j->tag;
 
-	struct cg_list_s *tag_successors = &tag->tag_successors;
+	struct starpu_cg_list_s *tag_successors = &tag->tag_successors;
 
 	starpu_spin_lock(&tag->lock);
 
@@ -185,7 +185,7 @@ static unsigned _starpu_not_all_task_deps_are_fulfilled(starpu_job_t j)
 {
 	unsigned ret;
 
-	struct cg_list_s *job_successors = &j->job_successors;
+	struct starpu_cg_list_s *job_successors = &j->job_successors;
 
 #warning TODO use locks !
 	if (job_successors->ndeps != job_successors->ndeps_completed)

+ 1 - 1
src/core/jobs.h

@@ -58,7 +58,7 @@ LIST_TYPE(starpu_job,
 	pthread_cond_t sync_cond;
 
 	struct tag_s *tag;
-	struct cg_list_s job_successors;
+	struct starpu_cg_list_s job_successors;
 
 	double predicted;
 	double penality;