starpu_init_noworker.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009, 2010 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011 Centre National de la Recherche Scientifique
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #include <stdio.h>
  18. #include <unistd.h>
  19. #include <errno.h>
  20. #include <starpu.h>
  21. #include <stdlib.h>
  22. static void unset_env_variables(void)
  23. {
  24. (void) unsetenv("STARPU_NCPUS");
  25. (void) unsetenv("STARPU_NCUDA");
  26. (void) unsetenv("STARPU_NNOPENCL");
  27. }
  28. int main(int argc, char **argv)
  29. {
  30. int ret;
  31. unset_env_variables();
  32. /* We try to initialize StarPU without any worker */
  33. struct starpu_conf conf =
  34. {
  35. .sched_policy_name = NULL, /* default */
  36. .ncpus = 0,
  37. .ncuda = 0,
  38. .nopencl = 0,
  39. .nspus = 0,
  40. .use_explicit_workers_bindid = 0,
  41. .use_explicit_workers_cuda_gpuid = 0,
  42. .use_explicit_workers_opencl_gpuid = 0,
  43. .calibrate = 0
  44. };
  45. /* starpu_init should return -ENODEV */
  46. ret = starpu_init(&conf);
  47. if (ret != -ENODEV)
  48. return EXIT_FAILURE;
  49. return EXIT_SUCCESS;
  50. }