I am currently writing a runtime system software for distributed systems and then I intend to evaluate some parallel management stuff. I relied my runtime systems on the task programming model as in the OpenMP3.0 standard, but for another category of machines with MPI.
To do that, I create some MPI processes (one per machine) and launch several threads on it. There is one master process which is responsible to create new tasks for other processes, and it needs to send some work to do. Each tasks contains a function pointer (work to do), and a set of arguments passed to this function. Something like this:
class Task
{
public:
typdef struct
{
// ... Storing and packing arguments
} args_t;
Task();
~Task();
void exec()
{
// Executing the function pointed by "func_ptr"
// with the specified arguments in "args"
func_ptr( args );
}
private:
void (*func_ptr)(args_t);
args_t args;
};
For passing arguments, I will intend to use MPI_Type_create_struct functions. However, my problem is now: how to send the function to another MPI process ? If I send the pointer function, it will be no longer valid in the address space of the MPI process receiver. As I can not know the number of different type of tasks I will have, it adds another difficulty because I cannot create a corresponding map and just send a unique id to MPI process. Do you have any idea to fix my problem ?
Thank you !
MPI_Comm_spawn
andMPI_Comm_spawn_multiple
, if this is what you meant by starting a 'sub-program' – ggulguliadlsym()
to find its address. – Gilles Gouaillardetdlopen()
anddlsym()
to retrieve the function name. – Gilles Gouaillardet