errorcheck.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  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. #ifndef __ERRORCHECK_H__
  17. #define __ERRORCHECK_H__
  18. /** @file */
  19. #include <starpu.h>
  20. /** This type describes in which state a worker may be. */
  21. enum _starpu_worker_status
  22. {
  23. /** invalid status (for instance if we request the status of some thread
  24. * that is not controlled by StarPU */
  25. STATUS_INVALID,
  26. /** everything that does not fit the other status */
  27. STATUS_UNKNOWN,
  28. /** during the initialization */
  29. STATUS_INITIALIZING,
  30. /** during the execution of a codelet */
  31. STATUS_EXECUTING,
  32. /** during the execution of the callback */
  33. STATUS_CALLBACK,
  34. /** while executing the scheduler code */
  35. STATUS_SCHEDULING,
  36. /** while waiting for a data transfer */
  37. STATUS_WAITING,
  38. /** while sleeping because there is nothing to do, but looking for tasks to do */
  39. STATUS_SLEEPING_SCHEDULING,
  40. /** while sleeping because there is nothing to do, and not even scheduling */
  41. STATUS_SLEEPING
  42. };
  43. struct _starpu_worker;
  44. /** Specify what the local worker is currently doing (eg. executing a callback).
  45. * This permits to detect if this is legal to do a blocking call for instance.
  46. * */
  47. void _starpu_set_worker_status(struct _starpu_worker *worker, enum _starpu_worker_status st);
  48. void _starpu_set_local_worker_status(enum _starpu_worker_status st);
  49. /** Indicate what type of operation the worker is currently doing. */
  50. enum _starpu_worker_status _starpu_get_local_worker_status(void);
  51. /** It is forbidden to do blocking calls during some operations such as callback
  52. * or during the execution of a task. This function indicates whether it is
  53. * legal to call a blocking operation in the current context. */
  54. unsigned _starpu_worker_may_perform_blocking_calls(void);
  55. #endif // __ERRORCHECK_H__