memory_nodes.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 2008-2009 (see AUTHORS file)
  4. *
  5. * This program 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. * This program 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 __MEMORY_NODES_H__
  17. #define __MEMORY_NODES_H__
  18. #include <starpu.h>
  19. #include <common/config.h>
  20. #include <datawizard/coherency.h>
  21. #include <datawizard/memalloc.h>
  22. typedef enum {
  23. STARPU_UNUSED,
  24. STARPU_SPU_LS,
  25. STARPU_RAM,
  26. STARPU_CUDA_RAM,
  27. STARPU_OPENCL_RAM,
  28. } starpu_node_kind;
  29. typedef struct {
  30. unsigned nnodes;
  31. starpu_node_kind nodes[STARPU_MAXNODES];
  32. /* the list of queues that are attached to a given node */
  33. // XXX 32 is set randomly !
  34. // TODO move this 2 lists outside starpu_mem_node_descr
  35. pthread_rwlock_t attached_queues_rwlock;
  36. struct starpu_jobq_s *attached_queues_per_node[STARPU_MAXNODES][32];
  37. struct starpu_jobq_s *attached_queues_all[STARPU_MAXNODES*32];
  38. /* the number of queues attached to each node */
  39. unsigned total_queues_count;
  40. unsigned queues_count[STARPU_MAXNODES];
  41. } starpu_mem_node_descr;
  42. void _starpu_init_memory_nodes(void);
  43. void _starpu_deinit_memory_nodes(void);
  44. void _starpu_set_local_memory_node_key(unsigned *node);
  45. unsigned _starpu_get_local_memory_node(void);
  46. unsigned _starpu_register_memory_node(starpu_node_kind kind);
  47. void _starpu_memory_node_attach_queue(struct starpu_jobq_s *q, unsigned nodeid);
  48. starpu_node_kind _starpu_get_node_kind(uint32_t node);
  49. unsigned _starpu_get_memory_nodes_count(void);
  50. inline starpu_mem_node_descr *_starpu_get_memory_node_description(void);
  51. #endif // __MEMORY_NODES_H__