task.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2013 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2013 Centre National de la Recherche Scientifique
  5. * Copyright (C) 2011 INRIA
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef __CORE_TASK_H__
  19. #define __CORE_TASK_H__
  20. #include <starpu.h>
  21. #include <common/config.h>
  22. #include <core/jobs.h>
  23. /* Internal version of starpu_task_destroy: don't check task->destroy flag */
  24. void _starpu_task_destroy(struct starpu_task *task);
  25. /* In order to implement starpu_task_wait_for_all, we keep track of the number of
  26. * task currently submitted */
  27. void _starpu_decrement_nsubmitted_tasks(void);
  28. /* In order to implement starpu_task_wait_for_no_ready, we keep track of the number of
  29. * task currently ready */
  30. void _starpu_increment_nready_tasks(void);
  31. void _starpu_decrement_nready_tasks(void);
  32. /* A pthread key is used to store the task currently executed on the thread.
  33. * _starpu_initialize_current_task_key initializes this pthread key and
  34. * _starpu_set_current_task updates its current value. */
  35. void _starpu_initialize_current_task_key(void);
  36. void _starpu_set_current_task(struct starpu_task *task);
  37. /* NB the second argument makes it possible to count regenerable tasks only
  38. * once. */
  39. int _starpu_submit_job(struct _starpu_job *j);
  40. int _starpu_task_submit_nodeps(struct starpu_task *task);
  41. void _starpu_task_declare_deps_array(struct starpu_task *task, unsigned ndeps, struct starpu_task *task_array[], int check);
  42. /* Returns the job structure (which is the internal data structure associated
  43. * to a task). */
  44. struct _starpu_job *_starpu_get_job_associated_to_task(struct starpu_task *task);
  45. /* Submits starpu internal tasks to the initial context */
  46. int _starpu_task_submit_internally(struct starpu_task *task);
  47. int _starpu_handle_needs_conversion_task(starpu_data_handle_t handle,
  48. unsigned int node);
  49. int
  50. _starpu_handle_needs_conversion_task_for_arch(starpu_data_handle_t handle,
  51. enum starpu_node_kind node_kind);
  52. int _starpu_task_uses_multiformat_handles(struct starpu_task *task);
  53. int _starpu_task_submit_conversion_task(struct starpu_task *task,
  54. unsigned int workerid);
  55. void _starpu_task_check_deprecated_fields(struct starpu_task *task);
  56. void _starpu_codelet_check_deprecated_fields(struct starpu_codelet *cl);
  57. starpu_cpu_func_t _starpu_task_get_cpu_nth_implementation(struct starpu_codelet *cl, unsigned nimpl);
  58. starpu_cuda_func_t _starpu_task_get_cuda_nth_implementation(struct starpu_codelet *cl, unsigned nimpl);
  59. starpu_opencl_func_t _starpu_task_get_opencl_nth_implementation(struct starpu_codelet *cl, unsigned nimpl);
  60. starpu_mic_func_t _starpu_task_get_mic_nth_implementation(struct starpu_codelet *cl, unsigned nimpl);
  61. starpu_scc_func_t _starpu_task_get_scc_nth_implementation(struct starpu_codelet *cl, unsigned nimpl);
  62. char *_starpu_task_get_cpu_name_nth_implementation(struct starpu_codelet *cl, unsigned nimpl);
  63. #define _STARPU_TASK_SET_INTERFACE(task, interface, i) do { if (task->dyn_handles) task->dyn_interfaces[i] = interface; else task->interfaces[i] = interface;} while(0)
  64. #define _STARPU_TASK_GET_INTERFACES(task) ((task->dyn_handles) ? task->dyn_interfaces : task->interfaces)
  65. #endif // __CORE_TASK_H__