瀏覽代碼

fix use of ANNOTATE_HAPPENS_BEFORE: it must be before the synchronization event

Samuel Thibault 9 年之前
父節點
當前提交
659c91c258

+ 1 - 1
examples/heat/dw_factolu.c

@@ -541,8 +541,8 @@ void dw_callback_codelet_update_u22(void *argcb)
 {
 	int ret;
 	cl_args *args = argcb;	
-	unsigned remaining = STARPU_ATOMIC_ADD(args->remaining, (-1));
 	ANNOTATE_HAPPENS_BEFORE(args->remaining);
+	unsigned remaining = STARPU_ATOMIC_ADD(args->remaining, (-1));
 
 	if (remaining == 0)
 	{

+ 1 - 1
examples/mandelbrot/mandelbrot.c

@@ -345,8 +345,8 @@ static void compute_block_spmd(void *descr[], void *cl_arg)
 
 	while (1)
 	{
-		local_iy = STARPU_ATOMIC_ADD((unsigned int *)pcnt, 1) - 1;
 		ANNOTATE_HAPPENS_BEFORE(pcnt);
+		local_iy = STARPU_ATOMIC_ADD((unsigned int *)pcnt, 1) - 1;
 		if (local_iy >= block_size)
 		{
 			ANNOTATE_HAPPENS_AFTER(pcnt);

+ 1 - 1
examples/spmv/dw_block_spmv.c

@@ -104,8 +104,8 @@ void init_problem_callback(void *arg)
 {
 	unsigned *remaining = arg;
 
-	unsigned val = STARPU_ATOMIC_ADD(remaining, -1);
 	ANNOTATE_HAPPENS_BEFORE(&remaining);
+	unsigned val = STARPU_ATOMIC_ADD(remaining, -1);
 
 /*	if (val < 10)
 		printf("callback %d remaining \n", val); */

+ 1 - 1
examples/tag_example/tag_example.c

@@ -161,8 +161,8 @@ static int create_task_grid(unsigned piter)
 
 void callback_cpu(void *argcb STARPU_ATTRIBUTE_UNUSED)
 {
-	unsigned newcnt = STARPU_ATOMIC_ADD(&callback_cnt, -1);	
 	ANNOTATE_HAPPENS_BEFORE(&callback_cnt);
+	unsigned newcnt = STARPU_ATOMIC_ADD(&callback_cnt, -1);	
 
 	if (newcnt == 0)
 	{

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

@@ -98,8 +98,8 @@ int _starpu_add_successor_to_cg_list(struct _starpu_cg_list *successors, struct
 void _starpu_notify_cg(struct _starpu_cg *cg)
 {
 	STARPU_ASSERT(cg);
-	unsigned remaining = STARPU_ATOMIC_ADD(&cg->remaining, -1);
 	ANNOTATE_HAPPENS_BEFORE(&cg->remaining);
+	unsigned remaining = STARPU_ATOMIC_ADD(&cg->remaining, -1);
 
 	if (remaining == 0)
 	{

+ 1 - 1
src/drivers/cpu/driver_cpu.c

@@ -120,8 +120,8 @@ static int execute_job_on_cpu(struct _starpu_job *j, struct starpu_task *worker_
 	if (is_parallel_task)
 	{
 		STARPU_PTHREAD_BARRIER_WAIT(&j->after_work_barrier);
-		(void) STARPU_ATOMIC_ADD(&j->after_work_busy_barrier, -1);
 		ANNOTATE_HAPPENS_BEFORE(&j->after_work_busy_barrier);
+		(void) STARPU_ATOMIC_ADD(&j->after_work_busy_barrier, -1);
 		if (rank == 0)
 		{
 			/* Wait with a busy barrier for other workers to have

+ 1 - 1
tests/datawizard/dsm_stress.c

@@ -44,8 +44,8 @@ static unsigned *v2;
 
 static void callback(void *arg)
 {
-	unsigned res = STARPU_ATOMIC_ADD(&cnt, -1);
 	ANNOTATE_HAPPENS_BEFORE(&cnt);
+	unsigned res = STARPU_ATOMIC_ADD(&cnt, -1);
 
 	if (res == 0)
 	{

+ 1 - 1
tests/main/execute_on_a_specific_worker.c

@@ -43,8 +43,8 @@ static unsigned *v;
 
 static void callback(void *arg)
 {
-	unsigned res = STARPU_ATOMIC_ADD(&cnt, -1);
 	ANNOTATE_HAPPENS_BEFORE(&cnt);
+	unsigned res = STARPU_ATOMIC_ADD(&cnt, -1);
 
 	if (res == 0)
 	{

+ 1 - 1
tests/main/regenerate_pipeline.c

@@ -41,8 +41,8 @@ void callback(void *arg)
 	unsigned *cnt = arg;
 	unsigned res;
 
-	res = STARPU_ATOMIC_ADD(cnt, 1);
 	ANNOTATE_HAPPENS_BEFORE(&cnt);
+	res = STARPU_ATOMIC_ADD(cnt, 1);
 
 	if (res == ntasks)
 	{

+ 1 - 1
tests/overlap/overlap.c

@@ -43,8 +43,8 @@ static unsigned cnt = NTASKS;
 
 static void callback(void *arg)
 {
-	unsigned res = STARPU_ATOMIC_ADD(&cnt, -1);
 	ANNOTATE_HAPPENS_BEFORE(&cnt);
+	unsigned res = STARPU_ATOMIC_ADD(&cnt, -1);
 
 	if (res == 0)
 	{