Selaa lähdekoodia

Do not use "ANY" to tell StarPU that a task may be executed anywhere if that's
not the case. When submitting a task, also make sure that some worker may
execute it.

Cédric Augonnet 16 vuotta sitten
vanhempi
commit
8d2c70666e

+ 10 - 5
examples/heat/dw_factolu.c

@@ -26,7 +26,7 @@ struct timeval end;
 
 static starpu_codelet cl11 =
 {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.core_func = dw_core_codelet_update_u11,
 #ifdef USE_CUDA
 	.cublas_func = dw_cublas_codelet_update_u11,
@@ -37,7 +37,7 @@ static starpu_codelet cl11 =
 
 static starpu_codelet cl12 =
 {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.core_func = dw_core_codelet_update_u12,
 #ifdef USE_CUDA
 	.cublas_func = dw_cublas_codelet_update_u12,
@@ -48,7 +48,7 @@ static starpu_codelet cl12 =
 
 static starpu_codelet cl21 =
 {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.core_func = dw_core_codelet_update_u21,
 #ifdef USE_CUDA
 	.cublas_func = dw_cublas_codelet_update_u21,
@@ -59,7 +59,7 @@ static starpu_codelet cl21 =
 
 static starpu_codelet cl22 =
 {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.core_func = dw_core_codelet_update_u22,
 #ifdef USE_CUDA
 	.cublas_func = dw_cublas_codelet_update_u22,
@@ -664,7 +664,12 @@ void dw_codelet_facto_v2(starpu_data_handle dataA, unsigned nblocks)
 		task->buffers[0].mode = STARPU_RW;
 
 	/* schedule the codelet */
-	starpu_submit_task(task);
+	int ret = starpu_submit_task(task);
+	if (STARPU_UNLIKELY(ret == -ENODEV))
+	{
+		fprintf(stderr, "No worker may execute this task\n");
+		exit(0);
+	}
 
 	/* stall the application until the end of computations */
 	sem_wait(&sem);

+ 12 - 5
examples/heat/dw_factolu_tag.c

@@ -41,7 +41,7 @@ static struct starpu_task *create_task(starpu_tag_t id)
 }
 
 static starpu_codelet cl11 = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.core_func = dw_core_codelet_update_u11,
 #ifdef USE_CUDA
 	.cublas_func = dw_cublas_codelet_update_u11,
@@ -74,7 +74,7 @@ static struct starpu_task *create_task_11(starpu_data_handle dataA, unsigned k)
 }
 
 static starpu_codelet cl12 = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.core_func = dw_core_codelet_update_u12,
 #ifdef USE_CUDA
 	.cublas_func = dw_cublas_codelet_update_u12,
@@ -113,7 +113,7 @@ static void create_task_12(starpu_data_handle dataA, unsigned k, unsigned i)
 }
 
 static starpu_codelet cl21 = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.core_func = dw_core_codelet_update_u21,
 #ifdef USE_CUDA
 	.cublas_func = dw_cublas_codelet_update_u21,
@@ -150,7 +150,7 @@ static void create_task_21(starpu_data_handle dataA, unsigned k, unsigned j)
 }
 
 static starpu_codelet cl22 = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.core_func = dw_core_codelet_update_u22,
 #ifdef USE_CUDA
 	.cublas_func = dw_cublas_codelet_update_u22,
@@ -233,7 +233,14 @@ static void dw_codelet_facto_v3(starpu_data_handle dataA, unsigned nblocks)
 
 	/* schedule the codelet */
 	gettimeofday(&start, NULL);
-	starpu_submit_task(entry_task);
+	int ret = starpu_submit_task(entry_task);
+	if (STARPU_UNLIKELY(ret == -ENODEV))
+	{
+		fprintf(stderr, "No worker may execute this task\n");
+		exit(-1);
+	}
+
+
 
 	/* stall the application until the end of computations */
 	starpu_tag_wait(TAG11(nblocks-1));

+ 11 - 13
examples/incrementer/incrementer.c

@@ -37,8 +37,8 @@ static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
 
 unsigned size __attribute__ ((aligned (16))) = 4*sizeof(float);
 
-float my_lovely_float[3] __attribute__ ((aligned (16))) = { 0.0f, 0.0f, 0.0f}; 
-float unity[3] __attribute__ ((aligned (16))) = { 1.0f, 0.0f, 1.0f};
+float my_lovely_float[4] __attribute__ ((aligned (16))) = { 0.0f, 0.0f, 0.0f}; 
+float unity[4] __attribute__ ((aligned (16))) = { 1.0f, 0.0f, 1.0f};
 
 void callback_func(void *argcb)
 {
@@ -101,10 +101,10 @@ void initialize_cuda(void)
 void init_data(void)
 {
 	starpu_register_vector_data(&my_float_state, 0 /* home node */,
-			(uintptr_t)&my_lovely_float, 3, sizeof(float));
+			(uintptr_t)&my_lovely_float, 4, sizeof(float));
 
 	starpu_register_vector_data(&unity_state, 0 /* home node */,
-			(uintptr_t)&unity, 3, sizeof(float));
+			(uintptr_t)&unity, 4, sizeof(float));
 }
 
 int main(int argc, char **argv)
@@ -122,17 +122,10 @@ int main(int argc, char **argv)
 	starpu_codelet cl =
 	{
 		.core_func = core_codelet,
-		.where = CORE|CUDA|GORDON,
+		.where = CORE|CUDA,
 #ifdef USE_CUDA
 		.cuda_func = &cuda_codelet,
 #endif
-#ifdef USE_GORDON
-#ifdef SPU_FUNC_ADD
-		.gordon_func = SPU_FUNC_ADD,
-#else
-#warning SPU_FUNC_ADD is not available
-#endif
-#endif
 		.nbuffers = 2
 	};
 
@@ -153,7 +146,12 @@ int main(int argc, char **argv)
 		task->buffers[1].handle = unity_state; 
 		task->buffers[1].mode = STARPU_R;
 
-		starpu_submit_task(task);
+		int ret = starpu_submit_task(task);
+		if (STARPU_UNLIKELY(ret == -ENODEV))
+		{
+			fprintf(stderr, "No worker may execute this task\n");
+			exit(0);
+		}
 	}
 
 	pthread_mutex_lock(&mutex);

+ 5 - 5
examples/strassen/strassen.c

@@ -89,7 +89,7 @@ static void unpartition_matrices(strassen_iter_state_t *iter)
 }
 
 static starpu_codelet cl_add = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_add_sub,
 	.core_func = add_core_codelet,
 #ifdef USE_CUDA
@@ -99,7 +99,7 @@ static starpu_codelet cl_add = {
 };
 
 static starpu_codelet cl_sub = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_add_sub,
 	.core_func = sub_core_codelet,
 #ifdef USE_CUDA
@@ -109,7 +109,7 @@ static starpu_codelet cl_sub = {
 };
 
 static starpu_codelet cl_mult = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_mult,
 	.core_func = mult_core_codelet,
 #ifdef USE_CUDA
@@ -119,7 +119,7 @@ static starpu_codelet cl_mult = {
 };
 
 static starpu_codelet cl_self_add = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_self_add_sub,
 	.core_func = self_add_core_codelet,
 #ifdef USE_CUDA
@@ -129,7 +129,7 @@ static starpu_codelet cl_self_add = {
 };
 
 static starpu_codelet cl_self_sub = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_self_add_sub,
 	.core_func = self_sub_core_codelet,
 #ifdef USE_CUDA

+ 7 - 7
examples/strassen2/strassen2.c

@@ -193,7 +193,7 @@ enum operation {
 };
 
 static starpu_codelet cl_add = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_add,
 	.core_func = add_core_codelet,
 #ifdef USE_CUDA
@@ -203,7 +203,7 @@ static starpu_codelet cl_add = {
 };
 
 static starpu_codelet cl_sub = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_sub,
 	.core_func = sub_core_codelet,
 #ifdef USE_CUDA
@@ -213,7 +213,7 @@ static starpu_codelet cl_sub = {
 };
 
 static starpu_codelet cl_mult = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_mult,
 	.core_func = mult_core_codelet,
 #ifdef USE_CUDA
@@ -259,7 +259,7 @@ struct starpu_task *compute_add_sub_op(starpu_data_handle C, enum operation op,
 }
 
 static starpu_codelet cl_self_add = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_self_add,
 	.core_func = self_add_core_codelet,
 #ifdef USE_CUDA
@@ -269,7 +269,7 @@ static starpu_codelet cl_self_add = {
 };
 
 static starpu_codelet cl_self_sub = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = &strassen_model_self_sub,
 	.core_func = self_sub_core_codelet,
 #ifdef USE_CUDA
@@ -329,7 +329,7 @@ void cleanup_callback(void *_arg)
 }
 
 static starpu_codelet cleanup_codelet = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = NULL,
 	.core_func = null_codelet,
 #ifdef USE_CUDA
@@ -705,7 +705,7 @@ static void dummy_codelet_func(__attribute__((unused))starpu_data_interface_t *d
 }
 
 static starpu_codelet dummy_codelet = {
-	.where = ANY,
+	.where = CORE|CUBLAS,
 	.model = NULL,
 	.core_func = dummy_codelet_func,
 	#ifdef USE_CUDA