PULSAR  1.0.0
Parallel Ultra Light Systolic Array Runtime
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
prt_vdp.h File Reference

Virtual Data Processor (VDP) More...

#include "prt.h"
Include dependency graph for prt_vdp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  prt_vdp_s
 Virtual Data Processor (VDP) Is uniquely identified by a tuple. Fires for a predefined number of cycles. Has a fixed number of input and output channels. Has a persistent local store. More...
 

Typedefs

typedef void(* prt_vdp_function_t )(int *, int, struct prt_channel_s **, struct prt_channel_s **, void *, void *)
 VDP's function pointer Defines the type of the pointer to the VDP's function. More...
 
typedef struct prt_vdp_s prt_vdp_t
 Virtual Data Processor (VDP) Is uniquely identified by a tuple. Fires for a predefined number of cycles. Has a fixed number of input and output channels. Has a persistent local store. More...
 

Functions

prt_vdp_tprt_vdp_new (int *tuple, int counter, prt_vdp_function_t function, size_t local_store_size, int num_inputs, int num_outputs, int color)
 VDP constructor. More...
 
void prt_vdp_delete (prt_vdp_t *vdp)
 VDP destructor Used for destruction of local VDPs. Destroy all input channels. Destroy all dangling output channels. Local output channels are destroyed as input channels of other local VDPs. More...
 
void prt_vdp_annihilate (prt_vdp_t *vdp)
 VDP annihilator Used for complete annihilation of VDPs that don't belong. Destroy all input channels. Destroy all output channels. More...
 
void prt_vdp_channel_insert (prt_vdp_t *vdp, struct prt_channel_s *channel, enum prt_channel_direction_e direction, int slot)
 
int prt_vdp_ready (prt_vdp_t *vdp)
 Check if a VDP is ready to fire. Only checks established channels. (NULL channels don't prevent firing.) More...
 

Detailed Description

Virtual Data Processor (VDP)

Author
Jakub Kurzak

PULSAR Runtime http://icl.eecs.utk.edu/pulsar/ Copyright (C) 2012-2013 University of Tennessee.

Definition in file prt_vdp.h.

Typedef Documentation

typedef void(* prt_vdp_function_t)(int *, int, struct prt_channel_s **, struct prt_channel_s **, void *, void *)

VDP's function pointer Defines the type of the pointer to the VDP's function.

Definition at line 28 of file prt_vdp.h.

typedef struct prt_vdp_s prt_vdp_t

Virtual Data Processor (VDP) Is uniquely identified by a tuple. Fires for a predefined number of cycles. Has a fixed number of input and output channels. Has a persistent local store.

Function Documentation

void prt_vdp_annihilate ( prt_vdp_t vdp)

VDP annihilator Used for complete annihilation of VDPs that don't belong. Destroy all input channels. Destroy all output channels.

Parameters
vdp

Definition at line 128 of file prt_vdp.c.

References prt_vdp_s::input, prt_vdp_s::local_store, prt_vdp_s::num_inputs, prt_vdp_s::num_outputs, prt_vdp_s::output, prt_assert, prt_channel_delete(), prt_tuple_delete(), and prt_vdp_s::tuple.

129 {
130  // Check for a NULL VDP.
131  prt_assert(vdp != NULL, "NULL VDP");
132 
133  // Delete the tuple.
134  prt_assert(vdp->tuple != NULL, "NULL tuple");
135  prt_tuple_delete(vdp->tuple);
136 
137  int i;
138  // Delete all input channels.
139  for (i = 0; i < vdp->num_inputs; i++) {
140  prt_channel_t *channel = vdp->input[i];
141  if (channel != NULL)
142  prt_channel_delete(channel);
143  }
144  // Delete all output channels.
145  for (i = 0; i < vdp->num_outputs; i++) {
146  prt_channel_t *channel = vdp->output[i];
147  if (channel != NULL)
148  prt_channel_delete(channel);
149  }
150  // Free array of inputs.
151  if (vdp->num_inputs > 0)
152  free(vdp->input);
153 
154  // Free array of outputs.
155  if (vdp->num_outputs > 0)
156  free(vdp->output);
157 
158  // Free local store.
159  if (vdp->local_store != NULL)
160  free(vdp->local_store);
161 
162  // Free the VDP.
163  free(vdp);
164 }
struct prt_channel_s ** input
Definition: prt_vdp.h:42
void * local_store
Definition: prt_vdp.h:46
void prt_tuple_delete(int *tuple)
tuple destructor
Definition: prt_tuple.c:95
void prt_channel_delete(prt_channel_t *channel)
channel destructor
Definition: prt_channel.c:64
VDP&#39;s data channel Implements a data link between a pair of VDPs. Identifies the source and destinati...
Definition: prt_channel.h:29
int num_inputs
Definition: prt_vdp.h:41
int num_outputs
Definition: prt_vdp.h:43
#define prt_assert(cond, msg)
Definition: prt_assert.h:30
struct prt_channel_s ** output
Definition: prt_vdp.h:44
int * tuple
Definition: prt_vdp.h:39

Here is the call graph for this function:

Here is the caller graph for this function:

void prt_vdp_channel_insert ( prt_vdp_t vdp,
struct prt_channel_s channel,
enum prt_channel_direction_e  direction,
int  slot 
)
void prt_vdp_delete ( prt_vdp_t vdp)

VDP destructor Used for destruction of local VDPs. Destroy all input channels. Destroy all dangling output channels. Local output channels are destroyed as input channels of other local VDPs.

Parameters
vdp

Definition at line 80 of file prt_vdp.c.

References prt_channel_s::dst_node, prt_vdp_s::input, prt_vdp_s::local_store, prt_vsa_s::node_rank, prt_vdp_s::num_inputs, prt_vdp_s::num_outputs, prt_vdp_s::output, prt_assert, prt_channel_delete(), prt_tuple_delete(), prt_vdp_s::thread, prt_vdp_s::tuple, and prt_thread_s::vsa.

81 {
82  // Check for a NULL VDP.
83  prt_assert(vdp != NULL, "NULL VDP");
84 
85  // Delete the tuple.
86  prt_assert(vdp->tuple != NULL, "NULL tuple");
87  prt_tuple_delete(vdp->tuple);
88 
89  int i;
90  // Delete all input channels.
91  for (i = 0; i < vdp->num_inputs; i++) {
92  prt_channel_t *channel = vdp->input[i];
93  if (channel != NULL)
94  prt_channel_delete(channel);
95  }
96  // Delete dangling output channels.
97  for (i = 0; i < vdp->num_outputs; i++) {
98  prt_channel_t *channel = vdp->output[i];
99  if (channel != NULL)
100  if (channel->dst_node != vdp->thread->vsa->node_rank)
101  prt_channel_delete(channel);
102  }
103  // Free array of inputs.
104  if (vdp->num_inputs > 0)
105  free(vdp->input);
106 
107  // Free array of outputs.
108  if (vdp->num_outputs > 0)
109  free(vdp->output);
110 
111  // Free local store.
112  if (vdp->local_store != NULL)
113  free(vdp->local_store);
114 
115  // Free the VDP.
116  free(vdp);
117 }
struct prt_channel_s ** input
Definition: prt_vdp.h:42
struct prt_vsa_s * vsa
Definition: prt_thread.h:28
void * local_store
Definition: prt_vdp.h:46
void prt_tuple_delete(int *tuple)
tuple destructor
Definition: prt_tuple.c:95
void prt_channel_delete(prt_channel_t *channel)
channel destructor
Definition: prt_channel.c:64
VDP&#39;s data channel Implements a data link between a pair of VDPs. Identifies the source and destinati...
Definition: prt_channel.h:29
int num_inputs
Definition: prt_vdp.h:41
int num_outputs
Definition: prt_vdp.h:43
int node_rank
Definition: prt_vsa.h:46
#define prt_assert(cond, msg)
Definition: prt_assert.h:30
struct prt_thread_s * thread
Definition: prt_vdp.h:38
struct prt_channel_s ** output
Definition: prt_vdp.h:44
int * tuple
Definition: prt_vdp.h:39

Here is the call graph for this function:

Here is the caller graph for this function:

int prt_vdp_ready ( prt_vdp_t vdp)

Check if a VDP is ready to fire. Only checks established channels. (NULL channels don't prevent firing.)

Parameters
vdp
Return values
0not ready
1ready

Definition at line 225 of file prt_vdp.c.

References prt_vdp_s::input, prt_vdp_s::num_inputs, prt_assert, and prt_channel_empty().

226 {
227  // Check for a NULL VDP.
228  prt_assert(vdp != NULL, "NULL VDP");
229 
230  int i;
231  // FOR each input channel.
232  for (i = 0; i < vdp->num_inputs; i++)
233  // IF the channel was established.
234  if (vdp->input[i] != NULL)
235  // IF the list of packets is empty.
236  if (prt_channel_empty(vdp->input[i]))
237  // Return "not ready".
238  return 0;
239 
240  // Return "ready".
241  return 1;
242 }
struct prt_channel_s ** input
Definition: prt_vdp.h:42
int prt_channel_empty(prt_channel_t *channel)
Checks if a channel is empty.
Definition: prt_channel.c:153
int num_inputs
Definition: prt_vdp.h:41
#define prt_assert(cond, msg)
Definition: prt_assert.h:30

Here is the call graph for this function:

Here is the caller graph for this function: