PULSAR  2.0.0
Parallel Ultra-Light Systolic Array Runtime
 All Data Structures Files Functions Typedefs Enumerations Macros Groups
prt_vsa.h
Go to the documentation of this file.
1 
11 #ifndef PRT_VSA_H
12 #define PRT_VSA_H
13 
14 #include "prt.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 struct prt_vdp_s;
21 struct prt_proxy_s;
22 struct prt_config_s;
23 struct prt_thread_s;
24 struct prt_device_s;
25 struct gpu_malloc_s;
26 struct prt_mapping_s;
29 enum prt_location_e;
30 
36 #define PRT_VSA_MAX_VDPS_PER_NODE 10003
37 
42 #define PRT_VSA_GPU_ALLOC_UNIT_SIZE 131072
43 
47 typedef struct prt_mapping_s (*prt_vdp_mapping_t)(int*, void*, int, int);
48 
55 typedef struct prt_vsa_s {
56  int node_rank; // Node ID.
57  int num_nodes; // Total number of nodes.
58  int num_threads; // Number of local threads.
59  int num_cores; // Total number of worker cores.
60  int concurrency; // Threads+1 if proxy is present.
61  pthread_attr_t thread_attr; // Attributes of worker threads.
62  struct prt_thread_s **thread; // Array of worker threads.
63  pthread_barrier_t barrier; // Thread barrier for synchronization.
64  void *global_store; // VSA's global store accessible by VDPs.
65  prt_vdp_mapping_t vdp_mapping; // VDPs' thread and device mapping function.
66  icl_hash_t *vdps_hash; // VDPs lookup by tuple.
67  struct prt_config_s *config; // VSA's configuration parameters.
68  struct prt_proxy_s *proxy; // VSA's communication proxy.
69  icl_list_t **channel_lists; // List of channels to each node.
70  void (*thread_warmup_func)(); // Thread warmup function.
71  int num_devices; // Number of local devices.
72  int num_accelerators; // Total number of accelerators.
73  struct prt_device_s **device; // Array of accelerator devices.
74  void (*device_warmup_func)(); // Device warmup function.
75  struct gpu_malloc_s **devmem; // Array of device memory allocators.
76 } prt_vsa_t;
77 
79  int num_threads, int num_devices, void *global_store,
80  struct prt_mapping_s (*vdp_mapping)(int*, void*, int, int));
81 void prt_vsa_delete(prt_vsa_t *vsa);
82 void prt_vsa_vdp_insert(prt_vsa_t *vsa, struct prt_vdp_s *vdp);
83 void prt_vsa_vdp_merge_channels(prt_vsa_t *vsa, struct prt_vdp_s *vdp);
84 void prt_vsa_vdp_track_tags(prt_vsa_t *vsa, struct prt_vdp_s *vdp);
87 double prt_vsa_run(prt_vsa_t *vsa);
89  prt_vsa_t *vsa, enum prt_config_param_e param, enum prt_config_value_e value);
90 void prt_vsa_thread_warmup_func_set(prt_vsa_t *vsa, void (*func)());
91 void prt_vsa_device_warmup_func_set(prt_vsa_t *vsa, void (*func)());
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* PRT_VSA_H */