Browse Source

examples/sched_ctx/sched_ctx_delete.c: skip when no CPU worker

Nathalie Furmento 6 years ago
parent
commit
478a8f2802
1 changed files with 7 additions and 0 deletions
  1. 7 0
      examples/sched_ctx/sched_ctx_delete.c

+ 7 - 0
examples/sched_ctx/sched_ctx_delete.c

@@ -28,6 +28,13 @@ int main(void)
 	if (ret == -ENODEV) return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
+	if (starpu_worker_get_count_by_type(STARPU_CPU_WORKER) == 0)
+	{
+		// Needs at least 1 CPU worker
+		starpu_shutdown();
+		return 77;
+	}
+
 	nprocs = starpu_worker_get_count_by_type(STARPU_ANY_WORKER);
 	starpu_worker_get_ids_by_type(STARPU_ANY_WORKER, procs, nprocs);