Bladeren bron

examples: minor fixes

Nathalie Furmento 6 jaren geleden
bovenliggende
commit
ad36401715
2 gewijzigde bestanden met toevoegingen van 10 en 8 verwijderingen
  1. 7 5
      examples/binary/binary.c
  2. 3 3
      examples/sched_ctx/sched_ctx_delete.c

+ 7 - 5
examples/binary/binary.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2017                                CNRS
+ * Copyright (C) 2010-2017, 2019                                CNRS
  * Copyright (C) 2013,2017                                Inria
  * Copyright (C) 2009-2011,2013-2015                      Université de Bordeaux
  *
@@ -124,11 +124,7 @@ int main(void)
 	struct starpu_conf conf;
 
 	starpu_conf_init(&conf);
-	conf.ncpus = 0;
 	conf.ncuda = 0;
-	conf.nmic = 0;
-	conf.nscc = 0;
-	conf.nmpi_ms = 0;
 
         ret = starpu_init(&conf);
 	if (STARPU_UNLIKELY(ret == -ENODEV))
@@ -137,6 +133,12 @@ int main(void)
 		return 77;
 	}
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
+	if (starpu_opencl_worker_get_count() == 0)
+	{
+                FPRINTF(stderr, "This application requires an OpenCL worker.\n");
+		starpu_shutdown();
+		return 77;
+	}
 
 	ret = compute("examples/incrementer/incrementer_kernels_opencl_kernel.cl", 1, -1);
 	if (ret == 0)

+ 3 - 3
examples/sched_ctx/sched_ctx_delete.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2018                                     CNRS
+ * Copyright (C) 2018, 2019                               CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -35,8 +35,8 @@ int main(void)
 		return 77;
 	}
 
-	nprocs = starpu_worker_get_count_by_type(STARPU_ANY_WORKER);
-	starpu_worker_get_ids_by_type(STARPU_ANY_WORKER, procs, nprocs);
+	nprocs = starpu_worker_get_count_by_type(STARPU_CPU_WORKER);
+	starpu_worker_get_ids_by_type(STARPU_CPU_WORKER, procs, nprocs);
 
 	sched_ctx1 = starpu_sched_ctx_create(procs, nprocs, "ctx1", 0);
 	sched_ctx2 = starpu_sched_ctx_create(procs, nprocs, "ctx2", 0);