32 #include <arpa/inet.h>
42 #define MAIN_THREAD_ID 0
45 #define MAX_RUNTIMES 16
47 #define MAX_THREADS 32
51 #define MAX_ROUTE_ENDPOINTS 256
53 #define MAX_INIT_DATA_LEN 64
55 #define MAX_MSU_NAME_LEN 32
57 #define MAX_MSU_TYPES 32
59 #define MAX_APP_NAME_LENGTH 64
61 #define MAX_MSU_PER_THREAD 8
209 #define ENTRY_VERTEX_TYPE 0x01
211 #define EXIT_VERTEX_TYPE 0x02
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.
int unschedule_dfg_msu(struct dfg_msu *msu)
Removes the given MSU from its runtime and thread.
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.
int n_routes
The routes that an MSU can send to.
MSUs which must be present for another MSU to be cloned.
int n_msus
The number of MSUs in dedos_dfg::msus.
enum thread_mode mode
Pinned/unpinned mode for the thread.
uint32_t ip
IP of the node on which the runtime is running.
enum blocking_mode str_to_blocking_mode(char *mode_str)
Converts a string of blocking/non-blocking to the correct enumerator.
struct dfg_msu_type * type
The MSU type which must be present.
thread_mode
Identifies if a thread is pinned to a core or able to be scheduled on any core.
#define MAX_MSU_TYPES
The maximum number of different MSU types that may be present in the DFG.
struct dfg_msu_type * get_dfg_msu_type(unsigned int id)
Returns the MSU type with the given ID.
int global_ctl_port
Port of the global controller.
int n_msus
Number of MSUs placed on the thread.
struct dfg_scheduling scheduling
Information about where an MSU is scheduled.
struct dfg_route * routes[64]
Routes located on this runtime.
int get_dfg_n_runtimes()
Returns the number of registered runtime.
#define MAX_THREADS
The maximum number of threads that may be present on a runtime.
struct dfg_msu * instances[512]
Each instance of this MSU type.
uint32_t global_ctl_ip
IP address of the global controller.
int n_cores
Number of cores on the runtime node.
int msu_has_route(struct dfg_msu *msu, struct dfg_route *route)
Returns 1 if the given MSU has the route as an endpoint.
uint8_t vertex_type
Whether the MSU is #ENTRY, #EXIT, or possible #ENTRY | #EXIT.
struct dfg_msu * msus[8]
MSUs placed on that thread.
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. ...
int n_msu_types
The number of elements in dedos_dfg::msu_types.
msu_locality
Whether an MSU is located on the same runtime or a remote runtime.
Default – threads should not have this mode.
char name[32]
A name describing the function of the MSU.
int id
Unique identifier for the runtime.
#define MAX_ROUTES
The total maximum number of routes that may be present in the DFG.
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.
struct dfg_msu * get_dfg_msu(unsigned int id)
Returns the MSU with the given ID.
#define MAX_MSU_NAME_LEN
The maximum length of the name for an MSU type.
struct dfg_msu_type * type
The type of the MSU and meta-routing information.
char application_name[64]
Description of the whole application.
#define MAX_MSU_PER_THREAD
The maximum number of MSUs which can be placed on a single thread.
Representation of a runtime in the DFG.
struct dfg_dependency * dependencies[32]
These MSU types must be present in order for this MSU type to be cloned.
struct dfg_route_endpoint * endpoints[256]
The endpoints of the route.
struct db_info * get_db_info()
Returns DB info.
uint8_t str_to_vertex_type(char *type_str)
Converts a string containing exit and/or entry to the correct bitmask.
int n_endpoints
The number of endpoints in dfg_route::endpoints.
struct dfg_runtime * runtime
The runtime on which an MSU is running.
int n_runtimes
The number of elements in dedos_dfg::runtimes.
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.
struct dfg_msu * msu
The MSU at this endpoint to which a message would be delivered.
#define MAX_INIT_DATA_LEN
The maximum length of the initial data that may be passed to an MSU.
int delete_dfg_route(struct dfg_route *route)
Deletes the provided route from the DFG.
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.
struct dfg_msu_type * msu_types[32]
MSU types which may be present in the application.
struct dfg_thread * get_dfg_thread(struct dfg_runtime *rt, unsigned int id)
Returns the thread on the given runtime with the specified ID.
int id
A unique identifier for the MSU.
blocking_mode
Whether an MSU is blocking or non-blocking.
int cloneable
If cloneable == N, this MSU can be cloned on runtimes numbered up to and including N...
Data with which an MSU is initialized, and the payload for messages of type CTRL_CREATE_MSU.
int n_unpinned_threads
Number of the above-threads which are unpinned.
struct dfg_thread * thread
The thread on which an MSU is running.
struct db_info db
DB information.
int id
Unique identifier for the thread.
Representation of a single MSU in the dfg.
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.
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.
#define MAX_MSU
The maximum number of MSUs which can be present in the system at a time.
struct dfg_runtime * runtime
The runtime on which the route is located.
int n_pinned_threads
Number of the above-threads which are pinned.
int id
A unique identifier for the MSU type.
int id
A unique identifier for the route.
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.
enum msu_locality locality
Whether it must be present on the same machine.
struct dfg_route * routes[32]
Top-level structure holding the data-flow graph.
A route through which MSU messages can be passed.
static struct dedos_dfg * dfg
Static local copy of the DFG, so each call doesn't have to pass a copy.
struct msu_init_data init_data
Initial data passed to the MSU.
enum thread_mode str_to_thread_mode(char *mode)
Converts a string of pinned/unpinned to the corresponding enumerator.
struct dfg_runtime * get_dfg_runtime(unsigned int id)
Returns the runtime with the given ID.
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.
Info to connect and use database.
struct dfg_runtime * runtimes[16]
The runtimes present in the application.
A single endpoint for an MSU route.
void free_dfg(struct dedos_dfg *dfg)
Frees the entirety of the DFG structure.
struct dfg_thread * threads[32]
Threads located on the runtime.
uint32_t key
The key associated with this endpoint.
struct dfg_route * get_dfg_route(unsigned int id)
Returns the route with the given ID.
Structure representing the scheduling of an MSU on a runtime.
Representation of a thread on a runtime in the DFG.
int n_routes
Number of routes above.
static int runtime_id(int runtime_fd)
int n_instances
The number of instances of this MSU type.
int n_dependencies
The number of elements in dfg_msu_type::dependencies.
struct dfg_msu * copy_dfg_msu(struct dfg_msu *input)
Allocates a new MSU with the same fields as the input MSU (though unscheduled)
int port
Port on which the runtime is listening for controller/inter-runtime.
struct dfg_meta_routing meta_routing
Which types of msus route to/from this MSU.
int free_dfg_msu(struct dfg_msu *input)
Frees an MSU structure.
Default value – not to be used.
#define MAX_ROUTE_ENDPOINTS
The maximum number of endpoints that a single route may have as destinations.
#define MAX_RUNTIMES
The maximum number of runtimes that may be present in the DFG.
Default value – used when unset, should never be specified.
enum blocking_mode blocking_mode
Whether the MSU is blocking or not.
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.
struct dfg_msu_type * msu_type
The type of MSU to which this route delivers.
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.
struct dfg_msu * msus[512]
The MSUs present in the application.
int del_dfg_route_endpoint(struct dfg_route *route, struct dfg_route_endpoint *ep)
Removes an MSU as a route endpoint.