浏览代码

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

Nathalie Furmento 6 年之前
父节点
当前提交
478a8f2802
共有 1 个文件被更改,包括 7 次插入0 次删除
  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);