sched_ctx_delete.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2018 CNRS
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #include <starpu.h>
  17. #include <stdlib.h>
  18. int main(void)
  19. {
  20. int ret;
  21. int nprocs = 0;
  22. int procs[STARPU_NMAXWORKERS];
  23. unsigned sched_ctx1, sched_ctx2;
  24. ret = starpu_init(NULL);
  25. if (ret == -ENODEV) return 77;
  26. STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
  27. nprocs = starpu_worker_get_count_by_type(STARPU_ANY_WORKER);
  28. starpu_worker_get_ids_by_type(STARPU_ANY_WORKER, procs, nprocs);
  29. sched_ctx1 = starpu_sched_ctx_create(procs, nprocs, "ctx1", 0);
  30. sched_ctx2 = starpu_sched_ctx_create(procs, nprocs, "ctx2", 0);
  31. starpu_sched_ctx_set_inheritor(sched_ctx2, sched_ctx1);
  32. starpu_sched_ctx_delete(sched_ctx1);
  33. starpu_sched_ctx_delete(sched_ctx2);
  34. starpu_shutdown();
  35. return 0;
  36. }