memory_nodes.h 1.6 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 "coherency.h"
  19. #include "memalloc.h"
  20. #ifdef USE_CUDA
  21. #include <cublas.h>
  22. #endif
  23. typedef enum {
  24. UNUSED,
  25. SPU_LS,
  26. RAM,
  27. CUDA_RAM
  28. } node_kind;
  29. typedef struct {
  30. unsigned nnodes;
  31. node_kind nodes[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 mem_node_descr
  35. pthread_spinlock_t attached_queues_mutex;
  36. struct jobq_s *attached_queues_per_node[MAXNODES][32];
  37. struct jobq_s *attached_queues_all[MAXNODES*32];
  38. /* the number of queues attached to each node */
  39. unsigned total_queues_count;
  40. unsigned queues_count[MAXNODES];
  41. } mem_node_descr;
  42. struct starpu_data_state_t;
  43. void init_memory_nodes(void);
  44. void deinit_memory_nodes(void);
  45. void set_local_memory_node_key(unsigned *node);
  46. unsigned get_local_memory_node(void);
  47. unsigned register_memory_node(node_kind kind);
  48. void memory_node_attach_queue(struct jobq_s *q, unsigned nodeid);
  49. node_kind get_node_kind(uint32_t node);
  50. #endif // __MEMORY_NODES_H__