36 for (
int i=0; i<n_endpoints; i++) {
44 log_error(
"Error instantiating MSU %d endpoint for route %d",
45 dest->
msu->
id, route_id);
50 log_error(
"Error adding endpoint %d to route %d",
51 dest->
msu->
id, route_id);
55 log(LOG_DFG_INSTANTIATION,
"Added %d endpoints to route %d",
56 n_endpoints, route_id);
64 for (
int i=0; i<n_routes; i++) {
67 log_error(
"Could not instantiate route %d (type: %d)",
72 log(LOG_DFG_INSTANTIATION,
"Spawned %d routes", n_routes);
80 for (
int i=0; i<n_routes; i++) {
96 for (
int i=0; i<n_routes; i++) {
99 log_error(
"Error adding route %d to msu %d", route->
id, msu->
id);
103 log(LOG_DFG_INSTANTIATION,
"Added %d routes to msu %d",
112 for (
int i=0; i<n_msus; i++) {
124 log(LOG_DFG_INSTANTIATION,
"Initialized MSU %d from dfg", dfg_msu->
id);
127 log_error(
"Error adding routes to MSU %d", msu->
id);
131 log(LOG_DFG_INSTANTIATION,
"Initialized %d MSUs", n_msus);
139 for (
int i=0; i<n_threads; i++) {
143 log_error(
"Error instantiating thread %d! Can not continue!", dfg_thread->
id);
146 log(LOG_DFG_INSTANTIATION,
"Created worker thread %d, mode = %s",
150 log_error(
"Error instantiating thread %d MSUs", dfg_thread->
id);
153 log(LOG_DFG_INSTANTIATION,
"Spawned %d MSUs on thread %d",
154 dfg_thread->
n_msus, dfg_thread->
id);
156 log(LOG_DFG_INSTANTIATION,
"Initialized %d threads", n_threads);
161 for (
int i=0; i<n_msu_types; i++) {
164 log_error(
"Could not instantiate required type %d", type->
id);
167 log(LOG_DFG_INSTANTIATION,
"Initialized MSU Type %d from dfg",
170 log(LOG_DFG_INSTANTIATION,
"Initialized %d MSU types", n_msu_types);
176 log_error(
"Error spawning routes for runtime DFG instantiation");
180 log_error(
"Error spawning threads for runtime DFG instantiation");
184 log_error(
"Error adding endpoints to routes");
static int spawn_dfg_msus(struct worker_thread *thread, struct dfg_msu **msus, int n_msus)
Creates all of the MSUs on the provided worker thread.
int init_msu_endpoint(int msu_id, int runtime_id, struct msu_endpoint *endpoint)
Initializes an endpoint structure to point to the relevant msu.
static int add_all_dfg_route_endpoints(struct dfg_route **routes, int n_routes)
Adds all of the endpoints for the provided routes to the provided routes.
int n_routes
The routes that an MSU can send to.
int add_route_endpoint(int route_id, struct msu_endpoint endpoint, uint32_t key)
Adds an endpoint to the route with the given ID.
int init_route(int route_id, int type_id)
Initializes a new route with the given route_id and type_id.
enum thread_mode mode
Pinned/unpinned mode for the thread.
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.
static int add_dfg_route_endpoints(int route_id, struct dfg_route_endpoint **endpoints, int n_endpoints)
Adds the provided endpoints to the route with the provided route_id
Representation of a thread that holds MSUs, messages, and waits on a semaphore.
struct dfg_msu * msus[8]
MSUs placed on that thread.
int id
Unique identifier for the runtime.
struct msu_type * get_msu_type(int id)
Gets the MSU type with the provided ID.
Logging of status messages to the terminal.
unsigned int id
Unique ID for a local MSU.
struct dfg_msu_type * type
The type of the MSU and meta-routing information.
Representation of a runtime in the DFG.
struct dfg_route_endpoint * endpoints[256]
The endpoints of the route.
struct route_set routes
Routing table set, containing all destination MSUs (see routing.h for details)
int n_endpoints
The number of endpoints in dfg_route::endpoints.
struct dfg_runtime * runtime
The runtime on which an MSU is running.
#define log_error(fmt,...)
Declares the structures and functions applicable to MSUs on the local machine.
struct local_msu * init_msu(unsigned int id, struct msu_type *type, struct worker_thread *thread, struct msu_init_data *data)
Allocates and creates a new MSU of the specified type and ID on the given thread. ...
struct dfg_msu * msu
The MSU at this endpoint to which a message would be delivered.
int id
A unique identifier for the MSU.
The structure that represents an MSU located on the local machine.
int n_unpinned_threads
Number of the above-threads which are unpinned.
int add_route_to_set(struct route_set *set, int route_id)
Adds a route to a set of routes.
int id
Unique identifier for the thread.
Representation of a single MSU in the dfg.
Functions for routing MSU messages between MSUs.
int init_msu_type_id(unsigned int type_id)
Initializes the MSU type with the given ID, calling the custom constructor if appropriate.
int n_pinned_threads
Number of the above-threads which are pinned.
int id
A unique identifier for the MSU type.
static int spawn_dfg_routes(struct dfg_route **routes, int n_routes)
Creates the given routes on the runtime.
int id
A unique identifier for the route.
struct worker_thread * get_worker_thread(int id)
struct dfg_route * routes[32]
A route through which MSU messages can be passed.
struct msu_init_data init_data
Initial data passed to the MSU.
Interfaces for the creation and modification of the data-flow-graph and and general description of th...
A single endpoint for an MSU route.
struct dfg_thread * threads[32]
Threads located on the runtime.
uint32_t key
The key associated with this endpoint.
int instantiate_dfg_runtime(struct dfg_runtime *rt)
Instantiates the MSUs, routes, and threads on the specified runtime.
Structure representing the scheduling of an MSU on a runtime.
struct dedos_thread * thread
The underlying dedos_thread.
int init_dfg_msu_types(struct dfg_msu_type **msu_types, int n_msu_types)
Runs the runtime initilization function for the given MSU types.
Representation of a thread on a runtime in the DFG.
int n_routes
Number of routes above.
static int add_dfg_routes_to_msu(struct local_msu *msu, struct dfg_route **routes, int n_routes)
Subscribes the MSU to the provided routes.
#define log(level, fmt,...)
Log at a custom level.
int create_worker_thread(unsigned int thread_id, enum blocking_mode mode)
Starts a new worker thread with the given thread ID and pinned/unpinned status.
static int spawn_dfg_threads(struct dfg_thread **threads, int n_threads)
Creates all of the provided threads (including MSUs) on the current runtime.
An endpoint to which an msu_msg can be delivered.
static struct msu_type * msu_types[1000]
Pointers to MSU Types, indexed by ID.
struct dfg_msu_type * msu_type
The type of MSU to which this route delivers.