28 int num_threads,
void *global_store,
int (*vdp_to_core)(
int*,
void*,
int))
35 MPI_Comm_rank(MPI_COMM_WORLD, &vsa->
node_rank);
36 MPI_Comm_size(MPI_COMM_WORLD, &vsa->
num_nodes);
49 pthread_attr_setscope(&vsa->
thread_attr, PTHREAD_SCOPE_SYSTEM);
105 prt_assert(status == 0,
"icl_list_destroy failed");
153 prt_assert(entry != NULL,
"icl_hash_insert failed");
158 prt_assert(node != NULL,
"icl_list_append failed");
174 if (channel != NULL) {
180 if (src_vdp != NULL) {
184 prt_assert(retval == 1,
"VDP channel tuple mismatch");
195 if (channel != NULL) {
201 if (dst_vdp != NULL) {
205 prt_assert(retval == 1,
"VDP channel tuple mismatch");
222 if (channel != NULL) {
251 prt_assert(entry != NULL,
"icl_hash_insert failed");
258 if (channel != NULL) {
287 prt_assert(entry != NULL,
"icl_hash_insert failed");
304 if (channel != NULL) {
336 if (channel != NULL) {
387 prt_assert(status == 0,
"pthread_create failed");
392 MPI_Barrier(MPI_COMM_WORLD);
400 int status = pthread_join(vsa->
thread[i]->
id, NULL);
401 prt_assert(status == 0,
"pthread_join failed");
457 for (rank = 0; rank < vsa->
num_nodes; rank++)
463 for (thread_rank = 0; thread_rank < vsa->
num_threads; thread_rank++)
465 printf(
" THREAD:%3d\n", thread_rank);
478 if (channel != NULL) {
480 if (channel->
tag == -1)
481 printf(
" slot%3d, channel tag: \n", channel->
src_slot);
483 printf(
" slot%3d, channel tag:%3d\n", channel->
src_slot, channel->
tag);
486 printf(
" input NULL\n");
494 if (channel != NULL) {
496 if (channel->
tag == -1)
497 printf(
" slot%3d, channel tag: \n", channel->
dst_slot);
499 printf(
" slot%3d, channel tag:%3d\n", channel->
dst_slot, channel->
tag);
502 printf(
" output NULL\n");
508 MPI_Barrier(MPI_COMM_WORLD);
513 for (rank = 0; rank < vsa->
num_nodes; rank++)
525 printf(
" %d %d: ", pk[0], pk[1]);
532 MPI_Barrier(MPI_COMM_WORLD);
void prt_tuple_print(int *tuple)
tuple print
icl_list_t * icl_list_search(icl_list_t *head, void *data, int(*compare)(void *, void *))
Finds a data item in the specified linked list.
void prt_vsa_config_set(prt_vsa_t *vsa, prt_config_param_t param, prt_config_value_t value)
Set VSA configuration parameter.
enum prt_config_param_e prt_config_param_t
PRT configuration parameters.
int icl_hash_destroy(icl_hash_t *ht, void(*free_key)(void *), void(*free_data)(void *))
Free hash table structures. Key and data are freed using functions.
icl_list_t * icl_list_new()
Create new linked list.
struct prt_channel_s ** input
#define icl_hash_foreach(ht, tmpint, tmpent, kp, dp)
void prt_vsa_delete(prt_vsa_t *vsa)
VSA destructor.
int icl_list_destroy(icl_list_t *head, void(*free_function)(void *))
Frees the resources associated with this linked list.
void prt_vsa_dump(prt_vsa_t *vsa)
Dump the VSA structure.
prt_vdp_map_func_t vdp_to_core
void prt_vsa_vdp_merge_channels(prt_vsa_t *vsa, prt_vdp_t *vdp)
struct prt_config_s * config
struct prt_thread_s ** thread
icl_list_t * icl_list_append(icl_list_t *head, void *data)
Insert a node at the end of this list.
void prt_vsa_vdp_insert(prt_vsa_t *vsa, prt_vdp_t *vdp)
Inserts a new VDP into a VSA. Puts the VDP in the list of VDPs of the owner thread. Connects corresponding input and output channels of connected VDPs.
void svg_trace_init(int num_cores)
Initialize tracing.
icl_entry_t * icl_hash_insert(icl_hash_t *ht, void *key, void *data)
Insert an item into the hash table.
void prt_vsa_vdp_track_tags_local(prt_vsa_t *vsa, prt_vdp_t *vdp, int core, int node_rank)
void prt_proxy_delete(prt_proxy_t *proxy)
communication proxy destructor Checking if all the lists are empty at the time of destruction...
icl_list_t * icl_list_first(icl_list_t *head)
Get the first item in this linked list.
Virtual Systolic Array (VSA) VSA contains global informationa about the system, a local communication...
unsigned int prt_tuple_hash(void *tuple)
tuple hash Required by the VSA's tuples hash table. Computes the lenght in characters and calls a str...
void prt_vsa_vdp_insert_local(prt_vsa_t *vsa, prt_vdp_t *vdp, int core, int node_rank)
prt_proxy_t * prt_proxy_new(int num_threads)
communication proxy constructor
void * prt_thread_run(void *thrd)
thread's production cycle Cycle through VDPs. Fire the ones that are ready. Remove the ones which bur...
void prt_config_delete(prt_config_t *config)
config object destructor
void prt_proxy_max_packet_size(prt_proxy_t *proxy, prt_channel_t *channel)
Look for maximum channel/packet size.
void prt_thread_delete(prt_thread_t *thread)
thread object destructor
void svg_trace_start(int thread_rank)
Start tracing an event.
#define prt_tuple_new2(a, b)
void prt_channel_delete(prt_channel_t *channel)
channel destructor
VDP's data channel Implements a data link between a pair of VDPs. Identifies the source and destinati...
void prt_vsa_vdp_track_tags_remote(prt_vsa_t *vsa, prt_vdp_t *vdp, int node_rank)
pthread_attr_t thread_attr
prt_thread_t * prt_thread_new(int rank, int core)
thread object constructor
int prt_channel_compare(void *channel1, void *channel2)
Compare two channels. Channels are equal if they have the same source and destination tuples and slot...
#define prt_assert(cond, msg)
Virtual Data Processor (VDP) Is uniquely identified by a tuple. Fires for a predefined number of cycl...
void svg_trace_finish()
Finish tracing. Collect traces from all nodes. Write the combined trace to an SVG file...
VSA's worker thread Owns a number of VDPs. Knows the communication proxy.
void * icl_hash_find(icl_hash_t *ht, void *key)
Search for an entry in a hash table.
icl_list_t ** channel_lists
enum prt_config_value_e prt_config_value_t
values of PRT configuration parameters
void svg_trace_stop(int thread_rank, int color)
Stop tracing an event.
int prt_tuple_equal(void *tuple_a, void *tuple_b)
tuple equality check Check if tuples are identical in length and content.
void prt_proxy_run(prt_proxy_t *proxy)
communication proxy production cycle Serves communication requests of local worker threads until shut...
icl_hash_t * icl_hash_create(int nbuckets, unsigned int(*hash_function)(void *), int(*hash_key_compare)(void *, void *))
Create a new hash table.
#define PRT_VSA_MAX_VDPS_PER_NODE
maximum VDPs per node She size of the VSA's hash table of VDPs. Should be a prime number ...
struct prt_thread_s * thread
prt_config_t * prt_config_new()
config object constructor
struct prt_proxy_s * proxy
struct prt_channel_s ** output
void prt_vsa_run(prt_vsa_t *vsa)
VSA's production cycle Launches worker threads. Sends the master thread in the communication proxy pr...
Virtual Systolic Array (VSA)
prt_vsa_t * prt_vsa_new(int num_threads, void *global_store, int(*vdp_to_core)(int *, void *, int))
VSA constructor.
icl_list_t * icl_list_next(icl_list_t *head, icl_list_t *pos)
Get the node following the specified node.