This Section explains how to use SC_REX, assuming it has been already configured as explained in Section [Configuration].
The Supervisor can be run in two modes:
In this mode, the Supervisor communicates with the kernel driver to interact with the devices specified by the /etc/screx/architecture.xml file.
The Supervisor can be run with two different goals: one goal tries to reduce the energy consumption, and the other goal tries to maximize the performance.
To run the supervisor with the goal of optimizing power consumption, type
screx --energy
on a console.
Instead, to run the supervisor with the goal of optimizing performance, type
screx --performance
on a console.
In this mode, the Supervisor simulates the kernel driver and uses the dummy files specified by the /etc/screx/architecture-simulation.xml file.
The Supervisor can be run with two different goals: one goal tries to reduce the energy consumption, and the other goal tries to maximize the performance.
To run the supervisor with the goal of optimizing power consumption, type
screx --simulate --energy
on a console.
Instead, to run the supervisor with the goal of optimizing performance, type
screx --simulate --performance
on a console.
To be able of using the supervisor, each application must:
Include the following files:
#include "reconfiguration-api.h
#include "rpc-api.h
Be linked against the screxruntime library:
gcc ... -lscrexruntime
The API provided by the Run-Time Library is similar to the one available for the Cell processor.
The API allows to:
This function runs a task on a reconfigurable processor by providing the type of the reconfigurable processor and the configuration table for the device.
Function:
vproc_t run_task (const char* processor_type,
const char* program_file,
const char* data_file,
const struct task_arg* in,
const struct task_arg* out,
enum queue_t queue,
const char* reconftable_file,
unsigned int priority);
where
struct task_arg {
/// Pointer to data (either on host or on reconf. processor)
void* ptr;
/// Size of data
size_t size;
};
Arguments:
Return values:
Example:
int ret;
struct task_arg in, out;
in.size = 0;
out.ptr = (void*) &ret;
out.size = sizeof(ret);
vproc_t vproc = run_task("mycpu\0", "/absolute/path/program_binary",
"/absolute/path/program_data", &in, &out, NOQUEUE,
"/etc/screx/default_configuration.xml\0", 1);
This function gets the result of a computation performed on a reconfigurable processor.
Function:
int get_result(vproc_t vproc,
enum block_t block,
const struct task_arg* out);
Arguments:
Return values:
Example:
get_result(vproc, BLOCK, &out);
This command allows to run a task and retrieve the result with a single (blocking) function call.
Function:
int exec_task (const char* processor_type,
const char* program_file,
const char* data_file,
const struct task_arg* in,
const struct task_arg* out,
const char* reconftable_file,
unsigned int priority);
Arguments:
Return values:
Example:
int ret;
struct task_arg in, out;
in.size = 0;
out.ptr = (void*) &ret;
out.size = sizeof(ret);
int success = exec_task("mycpu\0", "/absolute/path/program_binary",
"/absolute/path/program_data", &in, &out,
"/etc/screx/default_configuration.xml\0", 1);
This function communicates information about a new phase valid for all reconfigurable processors used by the application.
Function:
START_PHASE (phase_qos_t qos, phase_type_t type)
Arguments:
Return values:
Example:
START_PHASE(PHASE_QOS_HIGH, PHASE_MANY_REFS|PHASE_PARALLEL)
This function starts a new phase specifying the expected duration of the execution, valid for all reconfigurable processors used by the application
Function:
START_PHASE_DURATION (phase_qos_t qos, phase_type_t type, phase_deadline_t deadline_usec)
Arguments:
Return values:
Example:
START_PHASE_DURATION(PHASE_QOS_MEDIUM, PHASE_LOOP, 1000000)
This function explicitly ends a phase for all reconfigurable processors used by the application
Function:
END_PHASE()
Return values:
Note: this can be avoided if a new phase is started
This function starts a new phase for a specific reconfigurable processor
Function:
int start_phase (vproc_t vproc, phase_qos_t qos, phase_type_t type)
Arguments:
Return values:
This function starts a new phase specifying the expected duration of the execution, for a specific reconfigurable processor.
Function:
int start_phase_with_deadline (vproc_t vproc, phase_qos_t qos, phase_type_t type, phase_deadline_t deadline_usec)
Arguments:
Return values:
This function explicitly ends a phase for a specific reconfigurable processor
Function:
int end_phase (vproc_t vproc)
Arguments:
Return values:
Note: this can be avoided if a new phase is started