Browse Source

vector_scal : skip if there are no devices.

Cyril Roelandt 13 years ago
parent
commit
08a33ef615
1 changed files with 5 additions and 1 deletions
  1. 5 1
      examples/basic_examples/vector_scal.c

+ 5 - 1
examples/basic_examples/vector_scal.c

@@ -93,7 +93,8 @@ int main(int argc, char **argv)
 	FPRINTF(stderr, "BEFORE: Last element was %f\n", vector[NX-1]);
 
 	/* Initialize StarPU with default configuration */
-	starpu_init(NULL);
+	if (starpu_init(NULL) == -ENODEV)
+		goto enodev;
 
 #ifdef STARPU_USE_OPENCL
 	starpu_opencl_load_opencl_from_file("examples/basic_examples/vector_scal_opencl_kernel.cl",
@@ -155,4 +156,7 @@ int main(int argc, char **argv)
 	FPRINTF(stderr, "AFTER: Last element is %f\n", vector[NX-1]);
 
 	return 0;
+
+enodev:
+	return 77;
 }