My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Classes | Macros | Enumerations | Functions
dfg.h File Reference

Interfaces for the creation and modification of the data-flow-graph and and general description of the application running within DeDOS. More...

#include <stdio.h>
#include <pthread.h>
#include <arpa/inet.h>

Go to the source code of this file.

Classes

struct  msu_init_data
 Data with which an MSU is initialized, and the payload for messages of type CTRL_CREATE_MSU. More...
 
struct  dfg_runtime
 Representation of a runtime in the DFG. More...
 
struct  dfg_thread
 Representation of a thread on a runtime in the DFG. More...
 
struct  dfg_scheduling
 Structure representing the scheduling of an MSU on a runtime. More...
 
struct  dfg_meta_routing
 Describes which MSU types a given MSU type should route to if it is cloned. More...
 
struct  dfg_route_endpoint
 A single endpoint for an MSU route. More...
 
struct  dfg_route
 A route through which MSU messages can be passed. More...
 
struct  dfg_msu_type
 A type of MSU. More...
 
struct  dfg_dependency
 MSUs which must be present for another MSU to be cloned. More...
 
struct  dfg_msu
 Representation of a single MSU in the dfg. More...
 
struct  db_info
 Info to connect and use database. More...
 
struct  dedos_dfg
 Top-level structure holding the data-flow graph. More...
 

Macros

#define MAX_MSU   512
 The maximum number of MSUs which can be present in the system at a time. More...
 
#define MAIN_THREAD_ID   0
 The ID to which messages should be addressed when delivered to the main runtime thread. More...
 
#define MAX_RUNTIMES   16
 The maximum number of runtimes that may be present in the DFG. More...
 
#define MAX_THREADS   32
 The maximum number of threads that may be present on a runtime. More...
 
#define MAX_ROUTES   64
 The total maximum number of routes that may be present in the DFG. More...
 
#define MAX_ROUTE_ENDPOINTS   256
 The maximum number of endpoints that a single route may have as destinations. More...
 
#define MAX_INIT_DATA_LEN   64
 The maximum length of the initial data that may be passed to an MSU. More...
 
#define MAX_MSU_NAME_LEN   32
 The maximum length of the name for an MSU type. More...
 
#define MAX_MSU_TYPES   32
 The maximum number of different MSU types that may be present in the DFG. More...
 
#define MAX_APP_NAME_LENGTH   64
 The maximum length for the name of the application. More...
 
#define MAX_MSU_PER_THREAD   8
 The maximum number of MSUs which can be placed on a single thread. More...
 
#define ENTRY_VERTEX_TYPE   0x01
 Bitmask representing an MSU through which messages enter DeDOS. More...
 
#define EXIT_VERTEX_TYPE   0x02
 Bitmask representing an MSU through which messages exit DeDOS. More...
 

Enumerations

enum  thread_mode { UNSPECIFIED_THREAD_MODE = 0, PINNED_THREAD = 1, UNPINNED_THREAD = 2 }
 Identifies if a thread is pinned to a core or able to be scheduled on any core. More...
 
enum  blocking_mode { UNKNOWN_BLOCKING_MODE = 0, BLOCKING_MSU = 1, NONBLOCK_MSU = 2 }
 Whether an MSU is blocking or non-blocking. More...
 
enum  msu_locality { UNDEFINED_LOCALITY = 0, MSU_IS_LOCAL = 1, MSU_IS_REMOTE = 2 }
 Whether an MSU is located on the same runtime or a remote runtime. More...
 

Functions

enum thread_mode str_to_thread_mode (char *mode)
 Converts a string of pinned/unpinned to the corresponding enumerator. More...
 
enum blocking_mode str_to_blocking_mode (char *mode_str)
 Converts a string of blocking/non-blocking to the correct enumerator. More...
 
uint8_t str_to_vertex_type (char *type_str)
 Converts a string containing exit and/or entry to the correct bitmask. More...
 
void set_dfg (struct dedos_dfg *dfg)
 Sets the local copy of the DFG, so it doesn't have to be passed in for each call. More...
 
struct db_infoget_db_info ()
 Returns DB info. More...
 
int get_dfg_n_runtimes ()
 Returns the number of registered runtime. More...
 
struct dfg_runtimeget_dfg_runtime (unsigned int id)
 Returns the runtime with the given ID. More...
 
struct dfg_msu_typeget_dfg_msu_type (unsigned int id)
 Returns the MSU type with the given ID. More...
 
struct dfg_routeget_dfg_route (unsigned int id)
 Returns the route with the given ID. More...
 
struct dfg_routeget_dfg_rt_route_by_type (struct dfg_runtime *rt, struct dfg_msu_type *route_type)
 Returns the route on the given runtime with the specified MSU type. More...
 
struct dfg_routeget_dfg_msu_route_by_type (struct dfg_msu *msu, struct dfg_msu_type *route_type)
 Returns the route which the given MSU sends to of the specified MSU type. More...
 
struct dfg_msuget_dfg_msu (unsigned int id)
 Returns the MSU with the given ID. More...
 
struct dfg_threadget_dfg_thread (struct dfg_runtime *rt, unsigned int id)
 Returns the thread on the given runtime with the specified ID. More...
 
struct dfg_route_endpointget_dfg_route_endpoint (struct dfg_route *route, unsigned int msu_id)
 Returns the endpoint within the given route which has the specified MSU ID. More...
 
int msu_has_route (struct dfg_msu *msu, struct dfg_route *route)
 Returns 1 if the given MSU has the route as an endpoint. More...
 
struct dfg_msumsu_type_on_runtime (struct dfg_runtime *rt, struct dfg_msu_type *type)
 Returns 1 if the given MSU type is present on the provided runtime. More...
 
struct dfg_msucopy_dfg_msu (struct dfg_msu *input)
 Allocates a new MSU with the same fields as the input MSU (though unscheduled) More...
 
struct dfg_msuinit_dfg_msu (unsigned int id, struct dfg_msu_type *type, uint8_t vertex_type, enum blocking_mode mode, struct msu_init_data *init_data)
 Allocates a new MSU with the given parameters. More...
 
int free_dfg_msu (struct dfg_msu *input)
 Frees an MSU structure. More...
 
int schedule_dfg_msu (struct dfg_msu *msu, unsigned int runtime_id, unsigned int thread_id)
 Places the given MSU on the correct runtime and thread. More...
 
int unschedule_dfg_msu (struct dfg_msu *msu)
 Removes the given MSU from its runtime and thread. More...
 
struct dfg_routecreate_dfg_route (unsigned int id, struct dfg_msu_type *type, unsigned int runtime_id)
 Creates a route with the specified parameters. More...
 
int delete_dfg_route (struct dfg_route *route)
 Deletes the provided route from the DFG. More...
 
int add_dfg_route_to_msu (struct dfg_route *route, struct dfg_msu *msu)
 Subscribes an MSU to a route, so it can send to the route's endpoints. More...
 
struct dfg_route_endpointadd_dfg_route_endpoint (struct dfg_msu *msu, uint32_t key, struct dfg_route *route)
 Adds an MSU as an endpoint to a route. More...
 
int del_dfg_route_endpoint (struct dfg_route *route, struct dfg_route_endpoint *ep)
 Removes an MSU as a route endpoint. More...
 
int mod_dfg_route_endpoint (struct dfg_route *route, struct dfg_route_endpoint *ep, uint32_t new_key)
 Modifies the key associated with an MSU endpoint. More...
 
struct dfg_threadcreate_dfg_thread (struct dfg_runtime *rt, int thread_id, enum thread_mode mode)
 Creates a new thread on the given runtime. More...
 
void free_dfg (struct dedos_dfg *dfg)
 Frees the entirety of the DFG structure. More...
 

Detailed Description

Interfaces for the creation and modification of the data-flow-graph and and general description of the application running within DeDOS.

Definition in file dfg.h.

Macro Definition Documentation

#define ENTRY_VERTEX_TYPE   0x01

Bitmask representing an MSU through which messages enter DeDOS.

Definition at line 209 of file dfg.h.

#define EXIT_VERTEX_TYPE   0x02

Bitmask representing an MSU through which messages exit DeDOS.

Definition at line 211 of file dfg.h.

#define MAIN_THREAD_ID   0

The ID to which messages should be addressed when delivered to the main runtime thread.

Definition at line 42 of file dfg.h.

#define MAX_APP_NAME_LENGTH   64

The maximum length for the name of the application.

Definition at line 59 of file dfg.h.

#define MAX_INIT_DATA_LEN   64

The maximum length of the initial data that may be passed to an MSU.

Definition at line 53 of file dfg.h.

#define MAX_MSU   512

The maximum number of MSUs which can be present in the system at a time.

Definition at line 39 of file dfg.h.

#define MAX_MSU_NAME_LEN   32

The maximum length of the name for an MSU type.

Definition at line 55 of file dfg.h.

#define MAX_MSU_PER_THREAD   8

The maximum number of MSUs which can be placed on a single thread.

Definition at line 61 of file dfg.h.

#define MAX_MSU_TYPES   32

The maximum number of different MSU types that may be present in the DFG.

Definition at line 57 of file dfg.h.

#define MAX_ROUTE_ENDPOINTS   256

The maximum number of endpoints that a single route may have as destinations.

Definition at line 51 of file dfg.h.

#define MAX_ROUTES   64

The total maximum number of routes that may be present in the DFG.

Definition at line 49 of file dfg.h.

#define MAX_RUNTIMES   16

The maximum number of runtimes that may be present in the DFG.

Definition at line 45 of file dfg.h.

#define MAX_THREADS   32

The maximum number of threads that may be present on a runtime.

Definition at line 47 of file dfg.h.

Enumeration Type Documentation

Whether an MSU is blocking or non-blocking.

Enumerator
UNKNOWN_BLOCKING_MODE 

Default value – used when unset, should never be specified.

BLOCKING_MSU 
NONBLOCK_MSU 

Definition at line 161 of file dfg.h.

Whether an MSU is located on the same runtime or a remote runtime.

Enumerator
UNDEFINED_LOCALITY 

Default value – not to be used.

MSU_IS_LOCAL 
MSU_IS_REMOTE 

Definition at line 196 of file dfg.h.

Identifies if a thread is pinned to a core or able to be scheduled on any core.

Enumerator
UNSPECIFIED_THREAD_MODE 

Default – threads should not have this mode.

PINNED_THREAD 
UNPINNED_THREAD 

Definition at line 91 of file dfg.h.

Function Documentation

struct dfg_route_endpoint* add_dfg_route_endpoint ( struct dfg_msu msu,
uint32_t  key,
struct dfg_route route 
)

Adds an MSU as an endpoint to a route.

Definition at line 455 of file dfg.c.

int add_dfg_route_to_msu ( struct dfg_route route,
struct dfg_msu msu 
)

Subscribes an MSU to a route, so it can send to the route's endpoints.

Definition at line 428 of file dfg.c.

struct dfg_msu* copy_dfg_msu ( struct dfg_msu input)

Allocates a new MSU with the same fields as the input MSU (though unscheduled)

Definition at line 190 of file dfg.c.

struct dfg_route* create_dfg_route ( unsigned int  id,
struct dfg_msu_type type,
unsigned int  runtime_id 
)

Creates a route with the specified parameters.

Definition at line 366 of file dfg.c.

struct dfg_thread* create_dfg_thread ( struct dfg_runtime rt,
int  thread_id,
enum thread_mode  mode 
)

Creates a new thread on the given runtime.

Definition at line 539 of file dfg.c.

int del_dfg_route_endpoint ( struct dfg_route route,
struct dfg_route_endpoint ep 
)

Removes an MSU as a route endpoint.

Definition at line 487 of file dfg.c.

int delete_dfg_route ( struct dfg_route route)

Deletes the provided route from the DFG.

Definition at line 399 of file dfg.c.

void free_dfg ( struct dedos_dfg dfg)

Frees the entirety of the DFG structure.

Definition at line 596 of file dfg.c.

int free_dfg_msu ( struct dfg_msu input)

Frees an MSU structure.

Definition at line 225 of file dfg.c.

struct db_info* get_db_info ( )

Returns DB info.

Definition at line 56 of file dfg.c.

struct dfg_msu* get_dfg_msu ( unsigned int  id)

Returns the MSU with the given ID.

Definition at line 86 of file dfg.c.

struct dfg_route* get_dfg_msu_route_by_type ( struct dfg_msu msu,
struct dfg_msu_type route_type 
)

Returns the route which the given MSU sends to of the specified MSU type.

Definition at line 99 of file dfg.c.

struct dfg_msu_type* get_dfg_msu_type ( unsigned int  id)

Returns the MSU type with the given ID.

Definition at line 68 of file dfg.c.

int get_dfg_n_runtimes ( )

Returns the number of registered runtime.

Definition at line 60 of file dfg.c.

struct dfg_route* get_dfg_route ( unsigned int  id)

Returns the route with the given ID.

Definition at line 76 of file dfg.c.

struct dfg_route_endpoint* get_dfg_route_endpoint ( struct dfg_route route,
unsigned int  msu_id 
)

Returns the endpoint within the given route which has the specified MSU ID.

Definition at line 112 of file dfg.c.

struct dfg_route* get_dfg_rt_route_by_type ( struct dfg_runtime rt,
struct dfg_msu_type route_type 
)

Returns the route on the given runtime with the specified MSU type.

Definition at line 90 of file dfg.c.

struct dfg_runtime* get_dfg_runtime ( unsigned int  id)

Returns the runtime with the given ID.

Definition at line 64 of file dfg.c.

struct dfg_thread* get_dfg_thread ( struct dfg_runtime rt,
unsigned int  id 
)

Returns the thread on the given runtime with the specified ID.

Definition at line 108 of file dfg.c.

struct dfg_msu* init_dfg_msu ( unsigned int  id,
struct dfg_msu_type type,
uint8_t  vertex_type,
enum blocking_mode  mode,
struct msu_init_data init_data 
)

Allocates a new MSU with the given parameters.

Definition at line 200 of file dfg.c.

int mod_dfg_route_endpoint ( struct dfg_route route,
struct dfg_route_endpoint ep,
uint32_t  new_key 
)

Modifies the key associated with an MSU endpoint.

Definition at line 505 of file dfg.c.

int msu_has_route ( struct dfg_msu msu,
struct dfg_route route 
)

Returns 1 if the given MSU has the route as an endpoint.

Definition at line 121 of file dfg.c.

struct dfg_msu* msu_type_on_runtime ( struct dfg_runtime rt,
struct dfg_msu_type type 
)

Returns 1 if the given MSU type is present on the provided runtime.

Definition at line 130 of file dfg.c.

int schedule_dfg_msu ( struct dfg_msu msu,
unsigned int  runtime_id,
unsigned int  thread_id 
)

Places the given MSU on the correct runtime and thread.

Definition at line 261 of file dfg.c.

void set_dfg ( struct dedos_dfg dfg)

Sets the local copy of the DFG, so it doesn't have to be passed in for each call.

Parameters
dfgThe copy of the DFG to set statically

Definition at line 34 of file dfg.c.

enum blocking_mode str_to_blocking_mode ( char *  mode_str)

Converts a string of blocking/non-blocking to the correct enumerator.

String should be "blocking" or "non-blocking" (or "nonblocking") (case insensitive).

Definition at line 150 of file dfg.c.

enum thread_mode str_to_thread_mode ( char *  mode)

Converts a string of pinned/unpinned to the corresponding enumerator.

String should be "pinned" or "unpinned" (case insensitive).

Definition at line 139 of file dfg.c.

uint8_t str_to_vertex_type ( char *  type_str)

Converts a string containing exit and/or entry to the correct bitmask.

Definition at line 162 of file dfg.c.

int unschedule_dfg_msu ( struct dfg_msu msu)

Removes the given MSU from its runtime and thread.

Definition at line 339 of file dfg.c.