Commit 40f03f30 authored by iker_martin's avatar iker_martin
Browse files

WIP 1/2. Adding option for spawn to allow wrappers for Valgrind and Extrae to...

WIP 1/2. Adding option for spawn to allow wrappers for Valgrind and Extrae to use it by target processes
parent b6b1da35
......@@ -62,6 +62,8 @@ int main(int argc, char *argv[]) {
init_group_struct(argv, argc, myId, numP);
im_child = MAM_Init(ROOT, &comm, argv[0], user_redistribution, NULL);
//MAM_Use_valgrind(1);
if(im_child) {
update_targets();
......
......@@ -151,6 +151,33 @@ int MAM_Set_target_number(unsigned int numC){
return MAM_I_set_target_number(numC);
}
/*
* //TODO
* Tiene que ser llamado fuera de reconfig
*/
void MAM_Use_valgrind(int flag) {
if(state > MAM_I_NOT_STARTED) return;
mall_conf->external_usage = flag ? MAM_USE_VALGRIND: 0;
#if MAM_DEBUG
if(mall->myId == mall->root && flag) DEBUG_FUNC("Settled Valgrind Wrapper", mall->myId, mall->numP); fflush(stdout);
#endif
}
/*
* //TODO
* Tiene que ser llamado fuera de reconfig
*/
void MAM_Use_extrae(int flag) {
if(state > MAM_I_NOT_STARTED) return;
mall_conf->external_usage = flag ? MAM_USE_EXTRAE: 0;
#if MAM_DEBUG
if(mall->myId == mall->root && flag) DEBUG_FUNC("Settled Extrae Wrapper", mall->myId, mall->numP); fflush(stdout);
#endif
}
//======================================================||
//===============MAM_INIT FUNCTIONS=====================||
//======================================================||
......@@ -167,6 +194,7 @@ void MAM_Init_configuration() {
mall_conf->spawn_strategies = MAM_STRAT_CLEAR_VALUE;
mall_conf->red_method = MAM_STRAT_CLEAR_VALUE;
mall_conf->red_strategies = MAM_STRAT_CLEAR_VALUE;
mall_conf->external_usage = 0;
configSettings[MAM_SPAWN_METHOD].value = &mall_conf->spawn_method;
configSettings[MAM_SPAWN_STRATEGIES].value = &mall_conf->spawn_strategies;
......
......@@ -21,4 +21,6 @@ void MAM_Set_configuration(int spawn_method, int spawn_strategies, int spawn_dis
void MAM_Set_key_configuration(int key, int required, int *provided);
int MAM_Set_target_number(unsigned int numC);
void MAM_Use_valgrind(int flag);
void MAM_Use_extrae(int flag);
#endif
......@@ -26,8 +26,6 @@ enum mam_key_values{MAM_SPAWN_METHOD=0, MAM_SPAWN_STRATEGIES, MAM_PHYSICAL_DISTR
#define MAM_RED_STRATS_ENV "MAM_RED_STRATS"
#define MAM_NUM_TARGETS_ENV "MAM_NUM_TARGETS"
#define MAM_ROOT 0
#define MAM_CHECK_COMPLETION 0
#define MAM_WAIT_COMPLETION 1
......
......@@ -12,11 +12,18 @@
#define DEBUG_FUNC(debug_string, rank, numP) printf("MaM [P%d/%d]: %s -- %s:%s:%d\n", rank, numP, debug_string, __FILE__, __func__, __LINE__)
/* --- MAM REAL STATES --- */
/* --- MAM INNER CONSTANTS --- */
#define MAM_ROOT 0
enum mam_inner_states{MAM_I_UNRESERVED, MAM_I_NOT_STARTED, MAM_I_RMS_COMPLETED, MAM_I_SPAWN_PENDING, MAM_I_SPAWN_SINGLE_PENDING,
MAM_I_SPAWN_SINGLE_COMPLETED, MAM_I_SPAWN_ADAPT_POSTPONE, MAM_I_SPAWN_COMPLETED, MAM_I_DIST_PENDING, MAM_I_DIST_COMPLETED,
MAM_I_SPAWN_ADAPT_PENDING, MAM_I_USER_START, MAM_I_USER_PENDING, MAM_I_USER_COMPLETED, MAM_I_SPAWN_ADAPTED, MAM_I_COMPLETED};
#define MAM_USE_VALGRIND 1
#define MAM_USE_EXTRAE 2
#define MAM_VALGRIND_SCRIPT "./worker_valgrind.sh"
#define MAM_EXTRAE_SCRIPT "./worker_extrae.sh"
/* --- TIME CAPTURE STRUCTURE --- */
typedef struct {
// Spawn, Sync and Async time
......@@ -37,6 +44,8 @@ typedef struct {
unsigned int red_method;
unsigned int red_strategies;
int external_usage; // Whether a different application should be called by Spawn and which
malleability_times_t *times;
} malleability_config_t;
......
......@@ -86,7 +86,7 @@ int baseline_spawn(Spawn_set spawn_set, MPI_Comm comm, MPI_Comm *child) {
int rootBcast = MPI_PROC_NULL;
if(mall->myId == mall->root) rootBcast = MPI_ROOT;
int spawn_err = MPI_Comm_spawn(mall->name_exec, MPI_ARGV_NULL, spawn_set.spawn_qty, spawn_set.mapping, mall->root, comm, child, MPI_ERRCODES_IGNORE);
int spawn_err = MPI_Comm_spawn(spawn_set.cmd, MPI_ARGV_NULL, spawn_set.spawn_qty, spawn_set.mapping, mall->root, comm, child, MPI_ERRCODES_IGNORE);
if(spawn_err != MPI_SUCCESS) {
printf("Error creating new set of %d procs.\n", spawn_set.spawn_qty);
......
......@@ -14,6 +14,7 @@
void node_dist(Spawn_data spawn_data, int **qty, int *used_nodes, int *total_spawns);
void spread_dist(Spawn_data spawn_data, int *used_nodes, int *procs);
void compact_dist(Spawn_data spawn_data, int *used_nodes, int *procs);
void set_spawn_cmd(size_t nodes, Spawn_data *spawn_data);
void generate_info_string(char *nodelist, int *procs_array, size_t nodes, Spawn_data *spawn_data);
void generate_multiple_info_string(char *nodelist, int *procs_array, size_t nodes, Spawn_data *spawn_data);
......@@ -55,7 +56,6 @@ void processes_dist(Spawn_data *spawn_data) {
#if MAM_USE_SLURM
switch(spawn_data->mapping_fill_method) {
case MAM_PHY_TYPE_STRING:
// if(MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, NULL) ) {
if(spawn_data->spawn_is_multiple) {
generate_multiple_info_string_slurm(mall->nodelist, procs_array, used_nodes, spawn_data);
} else {
......@@ -67,13 +67,13 @@ void processes_dist(Spawn_data *spawn_data) {
break;
}
#else
// if(MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, NULL) ) {
if(spawn_data->spawn_is_multiple) {
generate_multiple_info_string(mall->nodelist, procs_array, used_nodes, spawn_data);
} else {
generate_info_string(mall->nodelist, procs_array, used_nodes, spawn_data);
}
#endif
set_spawn_cmd(used_nodes, spawn_data);
free(procs_array);
}
......@@ -192,6 +192,34 @@ void compact_dist(Spawn_data spawn_data, int *used_nodes, int *procs) {
if(*used_nodes > mall->num_nodes) *used_nodes = mall->num_nodes; //FIXME Si ocurre esto no es un error?
}
//--------------PRIVATE FUNCTIONS---------------//
//-------------------CMD SET--------------------//
/*
* Comprueba que comando hay que llamar al realizar
* el spawn. Todos los sets tienen que hacer el mismo
* comando.
*
*/
void set_spawn_cmd(size_t nodes, Spawn_data *spawn_data) {
size_t index = 0;
char *cmd_aux;
switch(mall_conf->external_usage) {
case MAM_USE_VALGRIND:
cmd_aux = MAM_VALGRIND_SCRIPT;
break;
case MAM_USE_EXTRAE:
cmd_aux = MAM_EXTRAE_SCRIPT;
break;
default:
cmd_aux = mall->name_exec;
break;
}
for(; index<nodes; index++) {
spawn_data->sets[index].cmd = cmd_aux;
}
}
//--------------PRIVATE FUNCTIONS---------------//
//-------------------INFO SET-------------------//
......
......@@ -7,6 +7,7 @@
typedef struct {
int spawn_qty;
char *cmd;
MPI_Info mapping;
} Spawn_set;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment