starpu_task_util.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2012 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012 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. #ifndef __STARPU_TASK_UTIL_H__
  18. #define __STARPU_TASK_UTIL_H__
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <assert.h>
  23. #include <starpu.h>
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. /* This creates (and submits) an empty task that unlocks a tag once all its
  29. * dependencies are fulfilled. */
  30. void starpu_create_sync_task(starpu_tag_t sync_tag, unsigned ndeps, starpu_tag_t *deps,
  31. void (*callback)(void *), void *callback_arg);
  32. /* Constants used by the starpu_insert_task helper to determine the different types of argument */
  33. #define STARPU_VALUE (1<<4) /* Pointer to a constant value */
  34. #define STARPU_CALLBACK (1<<5) /* Callback function */
  35. #define STARPU_CALLBACK_WITH_ARG (1<<6) /* Callback function */
  36. #define STARPU_CALLBACK_ARG (1<<7) /* Argument of the callback function (of type void *) */
  37. #define STARPU_PRIORITY (1<<8) /* Priority associated to the task */
  38. #define STARPU_EXECUTE_ON_NODE (1<<9) /* Used by MPI to define which task is going to execute the codelet */
  39. #define STARPU_EXECUTE_ON_DATA (1<<10) /* Used by MPI to define which task is going to execute the codelet */
  40. #define STARPU_HYPERVISOR_TAG (1<<11) /* Used to tag a task after whose execution we'll execute a code */
  41. #define STARPU_HYPERVISOR_FLOPS (1<<12) /* Used to specify the number of flops needed to be executed by a task */
  42. #define STARPU_DATA_ARRAY (1<<13) /* Array of data handles */
  43. /* Wrapper to create a task. */
  44. int starpu_insert_task(struct starpu_codelet *cl, ...);
  45. /* Retrieve the arguments of type STARPU_VALUE associated to a task
  46. * automatically created using starpu_insert_task. */
  47. void starpu_codelet_unpack_args(void *cl_arg, ...);
  48. /* Pack arguments of type STARPU_VALUE into a buffer which can be
  49. * given to a codelet and later unpacked with starpu_codelet_unpack_args */
  50. void starpu_codelet_pack_args(char **arg_buffer, size_t *arg_buffer_size, ...);
  51. #ifdef __cplusplus
  52. }
  53. #endif
  54. #endif /* __STARPU_TASK_UTIL_H__ */