Преглед на файлове

examples/: check return value for starpu functions

Nathalie Furmento преди 13 години
родител
ревизия
0e898d8fd4
променени са 3 файла, в които са добавени 7 реда и са изтрити 15 реда
  1. 5 2
      examples/basic_examples/vector_scal_c.c
  2. 1 0
      examples/opt/pi/pi.c
  3. 1 13
      examples/opt/pi/pi_redux.c

+ 5 - 2
examples/basic_examples/vector_scal_c.c

@@ -53,13 +53,14 @@ static struct starpu_codelet cl =
 	.model = &vector_scal_model
 };
 
-void compute_(int *F_NX, float *vector)
+int compute_(int *F_NX, float *vector)
 {
         int NX = *F_NX;
 	int ret;
 
 	/* Initialize StarPU with default configuration */
 	ret = starpu_init(NULL);
+	if (ret == -ENODEV) return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	/* Tell StaPU to associate the "vector" vector with the "vector_handle"
@@ -98,7 +99,7 @@ void compute_(int *F_NX, float *vector)
 
 	/* execute the task on any eligible computational ressource */
 	ret = starpu_task_submit(task);
-	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
+	if (ret != -ENODEV) STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 
 	/* StarPU does not need to manipulate the array anymore so we can stop
  	 * monitoring it */
@@ -106,4 +107,6 @@ void compute_(int *F_NX, float *vector)
 
 	/* terminate StarPU, no task can be submitted after */
 	starpu_shutdown();
+
+	return ret;
 }

+ 1 - 0
examples/opt/pi/pi.c

@@ -88,6 +88,7 @@ int main(int argc, char **argv)
 	parse_args(argc, argv);
 
 	ret = starpu_init(NULL);
+	if (ret == -ENODEV) return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	/* Initialize the random number generator */

+ 1 - 13
examples/opt/pi/pi_redux.c

@@ -189,19 +189,6 @@ static void pi_func_cuda(void *descr[], void *cl_arg __attribute__ ((unused)))
 }
 #endif
 
-/* The amount of work does not depend on the data size at all :) */
-static size_t size_base(struct starpu_task *task, unsigned nimpl)
-{
-	return NSHOT_PER_TASK;
-}
-
-static struct starpu_perfmodel model =
-{
-	.type = STARPU_HISTORY_BASED,
-	.size_base = size_base,
-	.symbol = "monte_carlo_pi_redux"
-};
-
 static struct starpu_codelet pi_cl =
 {
 	.where =
@@ -319,6 +306,7 @@ int main(int argc, char **argv)
 	parse_args(argc, argv);
 
 	ret = starpu_init(NULL);
+	if (ret == -ENODEV) return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	/* Launch a Random Number Generator (RNG) on each worker */