|
Pakman
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include <mpi.h>

Go to the source code of this file.
Macros | |
| #define | PAKMAN_EXIT_SUCCESS 0 |
| #define | PAKMAN_EXIT_FAILURE 1 |
Functions | |
| int | pakman_run_mpi_worker (int argc, char *argv[], int(*simulator)(int argc, char *argv[], const char *input_string, char **p_output_string)) |
Since MPI simulators cannot be forked directly when using MPIMaster, the MPI function MPI_Comm_spawn is used instead to spawn MPI Workers. As a consequence, the communication between Pakman and MPI Workers does not happen through system pipes, but through the MPI intercommunicator obtained with MPI_Comm_get_parent.
Most importantly, the MPI simulator can no longer be considered a black box at the systems-level. Instead, the simulator must be implemented as a function in C (see PakmanMPIWorker.hpp for C++). Its function pointer is then passed to the pakman_run_mpi_worker(), which will then communicate with Pakman and execute the given simulator function to perform the received simulation tasks.
Note that MPI_Init() should be called before calling pakman_run_mpi_worker(). Also, after pakman_run_mpi_worker() returns, MPI_Finalize() should be called.
For more information, see Implementing an MPI simulator.
Definition in file pakman_mpi_worker.h.
| #define PAKMAN_EXIT_FAILURE 1 |
Exit code indicating Worker encountered an error.
Definition at line 37 of file pakman_mpi_worker.h.
| #define PAKMAN_EXIT_SUCCESS 0 |
Exit code indicating Worker ran successfully.
Definition at line 34 of file pakman_mpi_worker.h.
| int pakman_run_mpi_worker | ( | int | argc, |
| char * | argv[], | ||
| int(*)(int argc, char *argv[], const char *input_string, char **p_output_string) | simulator | ||
| ) |
Run the Pakman MPI Worker with the given simulator function.
The simulator function must accept four arguments;
The returned *p_output_string must have been allocated using malloc(). After sending the contents of *p_output_string to Pakman, the MPI Worker will call free() on *p_output_string.
In addition, the simulator function must return an error code.
| argc | number of command-line arguments. |
| argv | array of command-line arguments. |
| simulator | function pointer to simulator function. |
Definition at line 143 of file pakman_mpi_worker.h.