task.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012,2017 CNRS
  4. * Copyright (C) 2010-2013,2016 Université de Bordeaux
  5. * Copyright (C) 2011,2012 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 SOCL_TASK_H
  19. #define SOCL_TASK_H
  20. #include "socl.h"
  21. starpu_task task_create() STARPU_ATTRIBUTE_MALLOC;
  22. void task_dependency_add(starpu_task task, cl_uint num_events, cl_event *events);
  23. void command_completed(cl_command cmd);
  24. void command_completed_task_callback(void *);
  25. /* Execute callback(arg) in a CPU task (with no buffer)
  26. * Associate this task to the command cmd (i.e. when this task completes, the command is completed)
  27. * Additional dependencies can be specified (num_events, events).
  28. * The codelet is used to give a fixed name to the task without allocating a
  29. * new codelet structure each time. This function will fill the other fields
  30. * as appropriate */
  31. void cpu_task_submit_ex(cl_command cmd, void (*callback)(void*), void *arg, int free_arg, int release_cmd, struct starpu_codelet *, unsigned num_events, cl_event * events);
  32. #define cpu_task_submit(cmd, args...) cpu_task_submit_ex((cl_command)cmd, args)
  33. /**
  34. * Associate a StarPU task to a command and submit it
  35. *
  36. * When the task terminates, the command is set as terminated too
  37. */
  38. cl_int task_submit_ex(starpu_task task, cl_command cmd);
  39. #define task_submit(task,cmd) task_submit_ex(task, (cl_command)cmd)
  40. /**
  41. * Add task dependencies
  42. */
  43. void task_depends_on(starpu_task task, cl_uint num_events, cl_event *events);
  44. #endif /* SOCL_TASK_H */