starpu_driver.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2013 Université de Bordeaux 1
  4. * Copyright (C) 2010-2013 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_DRIVER_H__
  18. #define __STARPU_DRIVER_H__
  19. #include <starpu_config.h>
  20. #if defined(STARPU_USE_OPENCL) && !defined(__CUDACC__)
  21. #include <starpu_opencl.h>
  22. #endif
  23. #ifdef __cplusplus
  24. extern "C"
  25. {
  26. #endif
  27. struct starpu_driver
  28. {
  29. enum starpu_archtype type;
  30. union
  31. {
  32. unsigned cpu_id;
  33. unsigned cuda_id;
  34. #if defined(STARPU_USE_OPENCL) && !defined(__CUDACC__)
  35. cl_device_id opencl_id;
  36. #elif defined(STARPU_SIMGRID)
  37. unsigned opencl_id;
  38. #endif
  39. /*
  40. * HOWTO: add a new kind of device to the starpu_driver structure.
  41. * 1) Add a member to this union.
  42. * 2) Edit _starpu_launch_drivers() to make sure the driver is
  43. * not always launched.
  44. * 3) Edit starpu_driver_run() so that it can handle another
  45. * kind of architecture.
  46. * 4) Write _starpu_run_foobar() in the corresponding driver.
  47. * 5) Test the whole thing :)
  48. */
  49. } id;
  50. };
  51. int starpu_driver_run(struct starpu_driver *d);
  52. void starpu_drivers_request_termination(void);
  53. int starpu_driver_init(struct starpu_driver *d);
  54. int starpu_driver_run_once(struct starpu_driver *d);
  55. int starpu_driver_deinit(struct starpu_driver *d);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* __STARPU_DRIVER_H__ */