Commit 33fb8b86 authored by Iker Martín Álvarez's avatar Iker Martín Álvarez
Browse files

WIP. Modifying constants so all of them start with MAM

parent 60dedf0d
...@@ -74,9 +74,9 @@ static int handler(void* user, const char* section, const char* name, ...@@ -74,9 +74,9 @@ static int handler(void* user, const char* section, const char* name,
} else if (MATCH(resize_name, "FactorS") && LAST(pconfig->actual_group, pconfig->n_groups)) { } else if (MATCH(resize_name, "FactorS") && LAST(pconfig->actual_group, pconfig->n_groups)) {
pconfig->groups[pconfig->actual_group].factor =(float) atof(value); pconfig->groups[pconfig->actual_group].factor =(float) atof(value);
} else if (MATCH(resize_name, "Dist") && LAST(pconfig->actual_group, pconfig->n_groups)) { } else if (MATCH(resize_name, "Dist") && LAST(pconfig->actual_group, pconfig->n_groups)) {
int aux_value = MALL_DIST_COMPACT; int aux_value = MAM_PHY_DIST_COMPACT;
if (strcmp(value, "spread") == 0) { if (strcmp(value, "spread") == 0) {
aux_value = MALL_DIST_SPREAD; aux_value = MAM_PHY_DIST_SPREAD;
} }
pconfig->groups[pconfig->actual_group].phy_dist = aux_value; pconfig->groups[pconfig->actual_group].phy_dist = aux_value;
} else if (MATCH(resize_name, "Redistribution_Method") && LAST(pconfig->actual_group, pconfig->n_groups)) { } else if (MATCH(resize_name, "Redistribution_Method") && LAST(pconfig->actual_group, pconfig->n_groups)) {
......
...@@ -25,10 +25,10 @@ int MAM_I_add_strat(unsigned int *comm_strategies, unsigned int strategy); ...@@ -25,10 +25,10 @@ int MAM_I_add_strat(unsigned int *comm_strategies, unsigned int strategy);
int MAM_I_remove_strat(unsigned int *comm_strategies, unsigned int strategy); int MAM_I_remove_strat(unsigned int *comm_strategies, unsigned int strategy);
mam_config_setting_t configSettings[] = { mam_config_setting_t configSettings[] = {
{NULL, MALL_SPAWN_MERGE, MAM_METHODS_SPAWN_LEN, {.set_config_simple = MAM_I_set_method }, MAM_SPAWN_METHOD_ENV}, {NULL, MAM_SPAWN_MERGE, MAM_METHODS_SPAWN_LEN, {.set_config_simple = MAM_I_set_method }, MAM_SPAWN_METHOD_ENV},
{NULL, MAM_STRAT_SPAWN_CLEAR, MAM_STRATS_SPAWN_LEN, {.set_config_simple = MAM_I_set_spawn_strat }, MAM_SPAWN_STRATS_ENV}, {NULL, MAM_STRAT_SPAWN_CLEAR, MAM_STRATS_SPAWN_LEN, {.set_config_simple = MAM_I_set_spawn_strat }, MAM_SPAWN_STRATS_ENV},
{NULL, MALL_DIST_COMPACT, MAM_METHODS_PHYSICAL_DISTRIBUTION_LEN, {.set_config_simple = MAM_I_set_method }, MAM_PHYSICAL_DISTRIBUTION_METHOD_ENV}, {NULL, MAM_PHY_DIST_COMPACT, MAM_METHODS_PHYSICAL_DISTRIBUTION_LEN, {.set_config_simple = MAM_I_set_method }, MAM_PHYSICAL_DISTRIBUTION_METHOD_ENV},
{NULL, MALL_RED_BASELINE, MAM_METHODS_RED_LEN, {.set_config_simple = MAM_I_set_method }, MAM_RED_METHOD_ENV}, {NULL, MAM_RED_BASELINE, MAM_METHODS_RED_LEN, {.set_config_simple = MAM_I_set_method }, MAM_RED_METHOD_ENV},
{NULL, MAM_STRAT_RED_CLEAR, MAM_STRATS_RED_LEN, {.set_config_simple = MAM_I_set_red_strat }, MAM_RED_STRATS_ENV}, {NULL, MAM_STRAT_RED_CLEAR, MAM_STRATS_RED_LEN, {.set_config_simple = MAM_I_set_red_strat }, MAM_RED_STRATS_ENV},
{NULL, 1, INT_MAX, {.set_config_complex = MAM_I_set_target_number }, MAM_NUM_TARGETS_ENV} {NULL, 1, INT_MAX, {.set_config_complex = MAM_I_set_target_number }, MAM_NUM_TARGETS_ENV}
...@@ -53,7 +53,7 @@ unsigned int masks_red[] = {MAM_STRAT_CLEAR_VALUE, MAM_MASK_PTHREAD, MAM_MASK_RE ...@@ -53,7 +53,7 @@ unsigned int masks_red[] = {MAM_STRAT_CLEAR_VALUE, MAM_MASK_PTHREAD, MAM_MASK_RE
void MAM_Set_configuration(int spawn_method, int spawn_strategies, int spawn_dist, int red_method, int red_strategies) { void MAM_Set_configuration(int spawn_method, int spawn_strategies, int spawn_dist, int red_method, int red_strategies) {
int i, aux; int i, aux;
int aux_array[] = {spawn_method, spawn_strategies, spawn_dist, red_method, red_strategies}; int aux_array[] = {spawn_method, spawn_strategies, spawn_dist, red_method, red_strategies};
if(state > MALL_NOT_STARTED) return; if(state > MAM_I_NOT_STARTED) return;
mam_config_setting_t *config = NULL; mam_config_setting_t *config = NULL;
for (i = 0; i < MAM_KEY_COUNT-1; i++) { //FIXME Numero magico para no cambiar num_targets for (i = 0; i < MAM_KEY_COUNT-1; i++) { //FIXME Numero magico para no cambiar num_targets
...@@ -88,8 +88,8 @@ void MAM_Set_key_configuration(int key, int required, int *provided) { ...@@ -88,8 +88,8 @@ void MAM_Set_key_configuration(int key, int required, int *provided) {
int i, aux; int i, aux;
if(provided == NULL) provided = &aux; if(provided == NULL) provided = &aux;
*provided = MALL_DENIED; *provided = MAM_DENIED;
if(required < 0 || state > MALL_NOT_STARTED) return; if(required < 0 || state > MAM_I_NOT_STARTED) return;
mam_config_setting_t *config = NULL; mam_config_setting_t *config = NULL;
for (i = 0; i < MAM_KEY_COUNT; i++) { for (i = 0; i < MAM_KEY_COUNT; i++) {
...@@ -129,7 +129,7 @@ int MAM_Contains_strat(int key, unsigned int strategy, int *result) { ...@@ -129,7 +129,7 @@ int MAM_Contains_strat(int key, unsigned int strategy, int *result) {
len = MAM_STRATS_RED_LEN; len = MAM_STRATS_RED_LEN;
break; break;
default: default:
aux = MALL_DENIED; aux = MAM_DENIED;
break; break;
} }
...@@ -196,16 +196,16 @@ void MAM_Set_initial_configuration() { ...@@ -196,16 +196,16 @@ void MAM_Set_initial_configuration() {
void MAM_Check_configuration() { void MAM_Check_configuration() {
int global_internodes; int global_internodes;
if(mall->numC == mall->numP) { // Migrate if(mall->numC == mall->numP) { // Migrate
MAM_Set_key_configuration(MAM_SPAWN_METHOD, MALL_SPAWN_BASELINE, NULL); MAM_Set_key_configuration(MAM_SPAWN_METHOD, MAM_SPAWN_BASELINE, NULL);
} }
MPI_Allreduce(&mall->internode_group, &global_internodes, 1, MPI_INT, MPI_MAX, mall->comm); MPI_Allreduce(&mall->internode_group, &global_internodes, 1, MPI_INT, MPI_MAX, mall->comm);
if(MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, NULL) if(MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, NULL)
&& global_internodes) { // Remove internode MPI_COMM_WORLDs && global_internodes) { // Remove internode MPI_COMM_WORLDs
MAM_Set_key_configuration(MAM_SPAWN_METHOD, MALL_SPAWN_BASELINE, NULL); MAM_Set_key_configuration(MAM_SPAWN_METHOD, MAM_SPAWN_BASELINE, NULL);
} }
if(mall_conf->spawn_method == MALL_SPAWN_MERGE) { if(mall_conf->spawn_method == MAM_SPAWN_MERGE) {
if(MAM_I_contains_strat(mall_conf->spawn_strategies, MAM_MASK_SPAWN_INTERCOMM)) { if(MAM_I_contains_strat(mall_conf->spawn_strategies, MAM_MASK_SPAWN_INTERCOMM)) {
MAM_I_remove_strat(&mall_conf->spawn_strategies, MAM_MASK_SPAWN_INTERCOMM); MAM_I_remove_strat(&mall_conf->spawn_strategies, MAM_MASK_SPAWN_INTERCOMM);
} }
...@@ -213,7 +213,7 @@ void MAM_Check_configuration() { ...@@ -213,7 +213,7 @@ void MAM_Check_configuration() {
MAM_I_remove_strat(&mall_conf->spawn_strategies, MAM_MASK_SPAWN_SINGLE); MAM_I_remove_strat(&mall_conf->spawn_strategies, MAM_MASK_SPAWN_SINGLE);
} }
} }
if(mall_conf->red_method == MALL_RED_RMA_LOCK || mall_conf->red_method == MALL_RED_RMA_LOCKALL) { if(mall_conf->red_method == MAM_RED_RMA_LOCK || mall_conf->red_method == MAM_RED_RMA_LOCKALL) {
if(MAM_I_contains_strat(mall_conf->spawn_strategies, MAM_MASK_SPAWN_INTERCOMM)) { if(MAM_I_contains_strat(mall_conf->spawn_strategies, MAM_MASK_SPAWN_INTERCOMM)) {
MAM_I_remove_strat(&mall_conf->spawn_strategies, MAM_MASK_SPAWN_INTERCOMM); MAM_I_remove_strat(&mall_conf->spawn_strategies, MAM_MASK_SPAWN_INTERCOMM);
} }
...@@ -287,7 +287,7 @@ int MAM_I_set_spawn_strat(unsigned int strategy, unsigned int *strategies) { ...@@ -287,7 +287,7 @@ int MAM_I_set_spawn_strat(unsigned int strategy, unsigned int *strategies) {
break; break;
default: default:
//Unkown strategy //Unkown strategy
result = MALL_DENIED; result = MAM_DENIED;
break; break;
} }
...@@ -329,7 +329,7 @@ int MAM_I_set_red_strat(unsigned int strategy, unsigned int *strategies) { ...@@ -329,7 +329,7 @@ int MAM_I_set_red_strat(unsigned int strategy, unsigned int *strategies) {
break; break;
default: default:
//Unkown strategy //Unkown strategy
result = MALL_DENIED; result = MAM_DENIED;
break; break;
} }
...@@ -340,7 +340,7 @@ int MAM_I_set_red_strat(unsigned int strategy, unsigned int *strategies) { ...@@ -340,7 +340,7 @@ int MAM_I_set_red_strat(unsigned int strategy, unsigned int *strategies) {
} }
int MAM_I_set_target_number(unsigned int new_numC) { int MAM_I_set_target_number(unsigned int new_numC) {
if(state > MALL_NOT_STARTED || new_numC == 0) return MALL_DENIED; if(state > MAM_I_NOT_STARTED || new_numC == 0) return MAM_DENIED;
mall->numC = (int) new_numC; mall->numC = (int) new_numC;
return new_numC; return new_numC;
......
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
#define MAM_CONSTANTS_H #define MAM_CONSTANTS_H
//States //States
#define MALL_DENIED -1 #define MAM_DENIED -1
#define MAM_OK 0 #define MAM_OK 0
enum mam_states{MAM_UNRESERVED, MAM_NOT_STARTED, MAM_PENDING, MAM_USER_PENDING, MAM_COMPLETED}; enum mam_states{MAM_UNRESERVED, MAM_NOT_STARTED, MAM_PENDING, MAM_USER_PENDING, MAM_COMPLETED};
enum mam_proc_states{MAM_PROC_CONTINUE, MAM_PROC_NEW_RANK, MAM_PROC_ZOMBIE}; enum mam_proc_states{MAM_PROC_CONTINUE, MAM_PROC_NEW_RANK, MAM_PROC_ZOMBIE};
enum mall_spawn_methods{MALL_SPAWN_BASELINE, MALL_SPAWN_MERGE, MAM_METHODS_SPAWN_LEN}; enum mam_spawn_methods{MAM_SPAWN_BASELINE, MAM_SPAWN_MERGE, MAM_METHODS_SPAWN_LEN};
enum mam_spawn_strategies{MAM_STRAT_SPAWN_CLEAR, MAM_STRAT_SPAWN_PTHREAD, MAM_STRAT_SPAWN_SINGLE, MAM_STRAT_SPAWN_INTERCOMM, MAM_STRAT_SPAWN_MULTIPLE, MAM_STRATS_SPAWN_LEN}; enum mam_spawn_strategies{MAM_STRAT_SPAWN_CLEAR, MAM_STRAT_SPAWN_PTHREAD, MAM_STRAT_SPAWN_SINGLE, MAM_STRAT_SPAWN_INTERCOMM, MAM_STRAT_SPAWN_MULTIPLE, MAM_STRATS_SPAWN_LEN};
enum mam_phy_dist_methods{MALL_DIST_SPREAD = 1, MALL_DIST_COMPACT, MAM_METHODS_PHYSICAL_DISTRIBUTION_LEN}; //FIXME Cambiar nombres a PHY_DIST? enum mam_phy_dist_methods{MAM_PHY_DIST_SPREAD = 1, MAM_PHY_DIST_COMPACT, MAM_METHODS_PHYSICAL_DISTRIBUTION_LEN};
enum mam_phy_info_methods{MALL_DIST_STRING = 1, MALL_DIST_HOSTFILE}; //FIXME Cambiar nombres a PHY_DIST? enum mam_phy_info_methods{MAM_PHY_TYPE_STRING = 1, MAM_PHY_TYPE_HOSTFILE};
enum mall_redistribution_methods{MALL_RED_BASELINE, MALL_RED_POINT, MALL_RED_RMA_LOCK, MALL_RED_RMA_LOCKALL, MAM_METHODS_RED_LEN}; enum mam_redistribution_methods{MAM_RED_BASELINE, MAM_RED_POINT, MAM_RED_RMA_LOCK, MAM_RED_RMA_LOCKALL, MAM_METHODS_RED_LEN};
enum mam_red_strategies{MAM_STRAT_RED_CLEAR, MAM_STRAT_RED_PTHREAD, MAM_STRAT_RED_WAIT_SOURCES, MAM_STRAT_RED_WAIT_TARGETS, MAM_STRATS_RED_LEN}; enum mam_red_strategies{MAM_STRAT_RED_CLEAR, MAM_STRAT_RED_PTHREAD, MAM_STRAT_RED_WAIT_SOURCES, MAM_STRAT_RED_WAIT_TARGETS, MAM_STRATS_RED_LEN};
/* KEYS & VALUES for config*/ /* KEYS & VALUES for config*/
...@@ -28,9 +28,6 @@ enum mam_key_values{MAM_SPAWN_METHOD=0, MAM_SPAWN_STRATEGIES, MAM_PHYSICAL_DISTR ...@@ -28,9 +28,6 @@ enum mam_key_values{MAM_SPAWN_METHOD=0, MAM_SPAWN_STRATEGIES, MAM_PHYSICAL_DISTR
#define MAM_ROOT 0 #define MAM_ROOT 0
#define MAL_APP_EXECUTING 0
#define MAL_APP_ENDED 1
#define MAM_CHECK_COMPLETION 0 #define MAM_CHECK_COMPLETION 0
#define MAM_WAIT_COMPLETION 1 #define MAM_WAIT_COMPLETION 1
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
malleability_config_t *mall_conf = NULL; malleability_config_t *mall_conf = NULL;
malleability_t *mall = NULL; malleability_t *mall = NULL;
int state = MALL_UNRESERVED; int state = MAM_I_UNRESERVED;
/* /*
* Crea un tipo derivado para mandar las dos estructuras principales * Crea un tipo derivado para mandar las dos estructuras principales
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#define DEBUG_FUNC(debug_string, rank, numP) printf("MaM [P%d/%d]: %s -- %s:%s:%d\n", rank, numP, debug_string, __FILE__, __func__, __LINE__) #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 REAL STATES --- */
enum mam_inner_states{MALL_UNRESERVED, MALL_NOT_STARTED, MALL_RMS_COMPLETED, MALL_SPAWN_PENDING, MALL_SPAWN_SINGLE_PENDING, enum mam_inner_states{MAM_I_UNRESERVED, MAM_I_NOT_STARTED, MAM_I_RMS_COMPLETED, MAM_I_SPAWN_PENDING, MAM_I_SPAWN_SINGLE_PENDING,
MALL_SPAWN_SINGLE_COMPLETED, MALL_SPAWN_ADAPT_POSTPONE, MALL_SPAWN_COMPLETED, MALL_DIST_PENDING, MALL_DIST_COMPLETED, MAM_I_SPAWN_SINGLE_COMPLETED, MAM_I_SPAWN_ADAPT_POSTPONE, MAM_I_SPAWN_COMPLETED, MAM_I_DIST_PENDING, MAM_I_DIST_COMPLETED,
MALL_SPAWN_ADAPT_PENDING, MALL_USER_START, MALL_USER_PENDING, MALL_USER_COMPLETED, MALL_SPAWN_ADAPTED, MALL_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};
/* --- TIME CAPTURE STRUCTURE --- */ /* --- TIME CAPTURE STRUCTURE --- */
typedef struct { typedef struct {
......
...@@ -109,7 +109,7 @@ int MAM_Init(int root, MPI_Comm *comm, char *name_exec, void (*user_function)(vo ...@@ -109,7 +109,7 @@ int MAM_Init(int root, MPI_Comm *comm, char *name_exec, void (*user_function)(vo
dist_s_data->entries = 0; dist_s_data->entries = 0;
dist_a_data->entries = 0; dist_a_data->entries = 0;
state = MALL_NOT_STARTED; state = MAM_I_NOT_STARTED;
MAM_Init_configuration(); MAM_Init_configuration();
MAM_Zombies_service_init(); MAM_Zombies_service_init();
...@@ -169,7 +169,7 @@ int MAM_Finalize() { ...@@ -169,7 +169,7 @@ int MAM_Finalize() {
free(mall_conf); free(mall_conf);
free(user_reconf); free(user_reconf);
state = MALL_UNRESERVED; state = MAM_I_UNRESERVED;
return request_abort; return request_abort;
} }
...@@ -189,54 +189,54 @@ int MAM_Checkpoint(int *mam_state, int wait_completed, void (*user_function)(voi ...@@ -189,54 +189,54 @@ int MAM_Checkpoint(int *mam_state, int wait_completed, void (*user_function)(voi
//TODO This could be changed to an array with the functions to call in each case //TODO This could be changed to an array with the functions to call in each case
switch(state) { switch(state) {
case MALL_UNRESERVED: case MAM_I_UNRESERVED:
*mam_state = MAM_UNRESERVED; *mam_state = MAM_UNRESERVED;
break; break;
case MALL_NOT_STARTED: case MAM_I_NOT_STARTED:
call_checkpoint = MAM_St_rms(mam_state); call_checkpoint = MAM_St_rms(mam_state);
break; break;
case MALL_RMS_COMPLETED: case MAM_I_RMS_COMPLETED:
call_checkpoint = MAM_St_spawn_start(); call_checkpoint = MAM_St_spawn_start();
break; break;
case MALL_SPAWN_PENDING: // Comprueba si el spawn ha terminado case MAM_I_SPAWN_PENDING: // Comprueba si el spawn ha terminado
case MALL_SPAWN_SINGLE_PENDING: case MAM_I_SPAWN_SINGLE_PENDING:
call_checkpoint = MAM_St_spawn_pending(wait_completed); call_checkpoint = MAM_St_spawn_pending(wait_completed);
break; break;
case MALL_SPAWN_ADAPT_POSTPONE: case MAM_I_SPAWN_ADAPT_POSTPONE:
case MALL_SPAWN_COMPLETED: case MAM_I_SPAWN_COMPLETED:
call_checkpoint = MAM_St_red_start(); call_checkpoint = MAM_St_red_start();
break; break;
case MALL_DIST_PENDING: case MAM_I_DIST_PENDING:
call_checkpoint = MAM_St_red_pending(wait_completed); call_checkpoint = MAM_St_red_pending(wait_completed);
break; break;
case MALL_USER_START: case MAM_I_USER_START:
call_checkpoint = MAM_St_user_start(mam_state); call_checkpoint = MAM_St_user_start(mam_state);
break; break;
case MALL_USER_PENDING: case MAM_I_USER_PENDING:
call_checkpoint = MAM_St_user_pending(mam_state, wait_completed, user_function, user_args); call_checkpoint = MAM_St_user_pending(mam_state, wait_completed, user_function, user_args);
break; break;
case MALL_USER_COMPLETED: case MAM_I_USER_COMPLETED:
call_checkpoint = MAM_St_user_completed(); call_checkpoint = MAM_St_user_completed();
break; break;
case MALL_SPAWN_ADAPT_PENDING: case MAM_I_SPAWN_ADAPT_PENDING:
call_checkpoint = MAM_St_spawn_adapt_pending(wait_completed); call_checkpoint = MAM_St_spawn_adapt_pending(wait_completed);
break; break;
case MALL_SPAWN_ADAPTED: case MAM_I_SPAWN_ADAPTED:
case MALL_DIST_COMPLETED: case MAM_I_DIST_COMPLETED:
call_checkpoint = MAM_St_completed(mam_state); call_checkpoint = MAM_St_completed(mam_state);
break; break;
} }
if(call_checkpoint) { MAM_Checkpoint(mam_state, wait_completed, user_function, user_args); } if(call_checkpoint) { MAM_Checkpoint(mam_state, wait_completed, user_function, user_args); }
if(state > MALL_NOT_STARTED && state < MALL_COMPLETED) *mam_state = MAM_PENDING; if(state > MAM_I_NOT_STARTED && state < MAM_I_COMPLETED) *mam_state = MAM_PENDING;
return state; return state;
} }
...@@ -244,7 +244,7 @@ int MAM_Checkpoint(int *mam_state, int wait_completed, void (*user_function)(voi ...@@ -244,7 +244,7 @@ int MAM_Checkpoint(int *mam_state, int wait_completed, void (*user_function)(voi
* TODO * TODO
*/ */
void MAM_Resume_redistribution(int *mam_state) { void MAM_Resume_redistribution(int *mam_state) {
state = MALL_USER_COMPLETED; state = MAM_I_USER_COMPLETED;
if(mam_state != NULL) *mam_state = MAM_PENDING; if(mam_state != NULL) *mam_state = MAM_PENDING;
} }
...@@ -258,7 +258,7 @@ void MAM_Commit(int *mam_state) { ...@@ -258,7 +258,7 @@ void MAM_Commit(int *mam_state) {
#endif #endif
// Get times before commiting // Get times before commiting
if(mall_conf->spawn_method == MALL_SPAWN_BASELINE) { if(mall_conf->spawn_method == MAM_SPAWN_BASELINE) {
// This communication is only needed when the root process will become a zombie // This communication is only needed when the root process will become a zombie
malleability_times_broadcast(mall->root_collectives); malleability_times_broadcast(mall->root_collectives);
} }
...@@ -280,20 +280,20 @@ void MAM_Commit(int *mam_state) { ...@@ -280,20 +280,20 @@ void MAM_Commit(int *mam_state) {
} }
// Reset/Free communicators // Reset/Free communicators
if(mall_conf->spawn_method == MALL_SPAWN_MERGE) { MAM_comms_update(mall->intercomm); } if(mall_conf->spawn_method == MAM_SPAWN_MERGE) { MAM_comms_update(mall->intercomm); }
if(mall->intercomm != MPI_COMM_NULL && mall->intercomm != MPI_COMM_WORLD) { MPI_Comm_disconnect(&(mall->intercomm)); } //FIXME Error en OpenMPI + Merge if(mall->intercomm != MPI_COMM_NULL && mall->intercomm != MPI_COMM_WORLD) { MPI_Comm_disconnect(&(mall->intercomm)); } //FIXME Error en OpenMPI + Merge
MPI_Comm_rank(mall->comm, &mall->myId); MPI_Comm_rank(mall->comm, &mall->myId);
MPI_Comm_size(mall->comm, &mall->numP); MPI_Comm_size(mall->comm, &mall->numP);
mall->root = mall_conf->spawn_method == MALL_SPAWN_BASELINE ? mall->root : mall->root_parents; mall->root = mall_conf->spawn_method == MAM_SPAWN_BASELINE ? mall->root : mall->root_parents;
mall->root_parents = mall->root; mall->root_parents = mall->root;
state = MALL_NOT_STARTED; state = MAM_I_NOT_STARTED;
if(mam_state != NULL) *mam_state = MAM_COMPLETED; if(mam_state != NULL) *mam_state = MAM_COMPLETED;
// Set new communicator // Set new communicator
MPI_Comm_dup(mall->comm, mall->user_comm); MPI_Comm_dup(mall->comm, mall->user_comm);
//if(mall_conf->spawn_method == MALL_SPAWN_BASELINE) { *(mall->user_comm) = MPI_COMM_WORLD; } //if(mall_conf->spawn_method == MAM_SPAWN_BASELINE) { *(mall->user_comm) = MPI_COMM_WORLD; }
//else if(mall_conf->spawn_method == MALL_SPAWN_MERGE) { MPI_Comm_dup(mall->comm, mall->user_comm); } //else if(mall_conf->spawn_method == MAM_SPAWN_MERGE) { MPI_Comm_dup(mall->comm, mall->user_comm); }
#if USE_MAL_DEBUG #if USE_MAL_DEBUG
if(mall->myId == mall->root) DEBUG_FUNC("Reconfiguration has been commited", mall->myId, mall->numP); fflush(stdout); if(mall->myId == mall->root) DEBUG_FUNC("Reconfiguration has been commited", mall->myId, mall->numP); fflush(stdout);
#endif #endif
...@@ -324,9 +324,9 @@ void MAM_Data_add(void *data, size_t *index, size_t total_qty, MPI_Datatype type ...@@ -324,9 +324,9 @@ void MAM_Data_add(void *data, size_t *index, size_t total_qty, MPI_Datatype type
add_data(data, total_qty, type, total_reqs, rep_a_data); add_data(data, total_qty, type, total_reqs, rep_a_data);
returned_index = rep_a_data->entries-1; returned_index = rep_a_data->entries-1;
} else { } else {
if(mall_conf->red_method == MALL_RED_BASELINE) { if(mall_conf->red_method == MAM_RED_BASELINE) {
total_reqs = 1; total_reqs = 1;
} else if(mall_conf->red_method == MALL_RED_POINT || mall_conf->red_method == MALL_RED_RMA_LOCK || mall_conf->red_method == MALL_RED_RMA_LOCKALL) { } else if(mall_conf->red_method == MAM_RED_POINT || mall_conf->red_method == MAM_RED_RMA_LOCK || mall_conf->red_method == MAM_RED_RMA_LOCKALL) {
total_reqs = mall->numC; total_reqs = mall->numC;
} }
...@@ -364,9 +364,9 @@ void MAM_Data_modify(void *data, size_t index, size_t total_qty, MPI_Datatype ty ...@@ -364,9 +364,9 @@ void MAM_Data_modify(void *data, size_t index, size_t total_qty, MPI_Datatype ty
total_reqs = 1; total_reqs = 1;
modify_data(data, index, total_qty, type, total_reqs, rep_a_data); //FIXME total_reqs==0 ??? modify_data(data, index, total_qty, type, total_reqs, rep_a_data); //FIXME total_reqs==0 ???
} else { } else {
if(mall_conf->red_method == MALL_RED_BASELINE) { if(mall_conf->red_method == MAM_RED_BASELINE) {
total_reqs = 1; total_reqs = 1;
} else if(mall_conf->red_method == MALL_RED_POINT || mall_conf->red_method == MALL_RED_RMA_LOCK || mall_conf->red_method == MALL_RED_RMA_LOCKALL) { } else if(mall_conf->red_method == MAM_RED_POINT || mall_conf->red_method == MAM_RED_RMA_LOCK || mall_conf->red_method == MAM_RED_RMA_LOCKALL) {
total_reqs = mall->numC; total_reqs = mall->numC;
} }
...@@ -441,7 +441,7 @@ void MAM_Data_get_pointer(void **data, size_t index, size_t *total_qty, MPI_Data ...@@ -441,7 +441,7 @@ void MAM_Data_get_pointer(void **data, size_t index, size_t *total_qty, MPI_Data
/* /*
* @brief Returns a structure to perform data redistribution during a reconfiguration. * @brief Returns a structure to perform data redistribution during a reconfiguration.
* *
* This function is intended to be called when the state of MaM is MALL_USER_PENDING only. * This function is intended to be called when the state of MaM is MAM_I_USER_PENDING only.
* It is designed to provide the necessary information for the user to perform data redistribution. * It is designed to provide the necessary information for the user to perform data redistribution.
* *
* Parameters: * Parameters:
...@@ -449,10 +449,10 @@ void MAM_Data_get_pointer(void **data, size_t index, size_t *total_qty, MPI_Data ...@@ -449,10 +449,10 @@ void MAM_Data_get_pointer(void **data, size_t index, size_t *total_qty, MPI_Data
* *
* Return Value: * Return Value:
* - MAM_OK: If the function successfully retrieves the reconfiguration information. * - MAM_OK: If the function successfully retrieves the reconfiguration information.
* - MALL_DENIED: If the function is called when the state of the MaM is not MALL_USER_PENDING. * - MAM_DENIED: If the function is called when the state of the MaM is not MAM_I_USER_PENDING.
*/ */
int MAM_Get_Reconf_Info(mam_user_reconf_t *reconf_info) { int MAM_Get_Reconf_Info(mam_user_reconf_t *reconf_info) {
if(state != MALL_USER_PENDING) return MALL_DENIED; if(state != MAM_I_USER_PENDING) return MAM_DENIED;
*reconf_info = *user_reconf; *reconf_info = *user_reconf;
return MAM_OK; return MAM_OK;
...@@ -553,10 +553,10 @@ int MAM_St_rms(int *mam_state) { ...@@ -553,10 +553,10 @@ int MAM_St_rms(int *mam_state) {
MAM_Check_configuration(); MAM_Check_configuration();
*mam_state = MAM_NOT_STARTED; *mam_state = MAM_NOT_STARTED;
state = MALL_RMS_COMPLETED; state = MAM_I_RMS_COMPLETED;
mall->wait_targets_posted = 0; mall->wait_targets_posted = 0;
//if(CHECK_RMS()) {return MALL_DENIED;} //if(CHECK_RMS()) {return MAM_DENIED;}
return 1; return 1;
} }
...@@ -564,10 +564,10 @@ int MAM_St_spawn_start() { ...@@ -564,10 +564,10 @@ int MAM_St_spawn_start() {
mall->num_parents = mall->numP; mall->num_parents = mall->numP;
state = spawn_step(); state = spawn_step();
//FIXME Esto es necesario pero feo //FIXME Esto es necesario pero feo
if(mall_conf->spawn_method == MALL_SPAWN_MERGE && mall->myId >= mall->numC){ mall->zombie = 1; } if(mall_conf->spawn_method == MAM_SPAWN_MERGE && mall->myId >= mall->numC){ mall->zombie = 1; }
else if(mall_conf->spawn_method == MALL_SPAWN_BASELINE){ mall->zombie = 1; } else if(mall_conf->spawn_method == MAM_SPAWN_BASELINE){ mall->zombie = 1; }
if (state == MALL_SPAWN_COMPLETED || state == MALL_SPAWN_ADAPT_POSTPONE){ if (state == MAM_I_SPAWN_COMPLETED || state == MAM_I_SPAWN_ADAPT_POSTPONE){
return 1; return 1;
} }
return 0; return 0;
...@@ -575,7 +575,7 @@ int MAM_St_spawn_start() { ...@@ -575,7 +575,7 @@ int MAM_St_spawn_start() {
int MAM_St_spawn_pending(int wait_completed) { int MAM_St_spawn_pending(int wait_completed) {
state = check_spawn_state(&(mall->intercomm), mall->comm, wait_completed); state = check_spawn_state(&(mall->intercomm), mall->comm, wait_completed);
if (state == MALL_SPAWN_COMPLETED || state == MALL_SPAWN_ADAPTED) { if (state == MAM_I_SPAWN_COMPLETED || state == MAM_I_SPAWN_ADAPTED) {
#if USE_MAL_BARRIERS #if USE_MAL_BARRIERS
MPI_Barrier(mall->comm); MPI_Barrier(mall->comm);
#endif #endif
...@@ -603,8 +603,8 @@ int MAM_St_red_pending(int wait_completed) { ...@@ -603,8 +603,8 @@ int MAM_St_red_pending(int wait_completed) {
state = check_redistribution(wait_completed); state = check_redistribution(wait_completed);
} }
if(state != MALL_DIST_PENDING) { if(state != MAM_I_DIST_PENDING) {
state = MALL_USER_START; state = MAM_I_USER_START;
return 1; return 1;
} }
return 0; return 0;
...@@ -621,7 +621,7 @@ int MAM_St_user_start(int *mam_state) { ...@@ -621,7 +621,7 @@ int MAM_St_user_start(int *mam_state) {
MPI_Comm_dup(mall->intercomm, &mall->tmp_comm); MPI_Comm_dup(mall->intercomm, &mall->tmp_comm);
} }
MPI_Comm_set_name(mall->tmp_comm, "MAM_USER_TMP"); MPI_Comm_set_name(mall->tmp_comm, "MAM_USER_TMP");
state = MALL_USER_PENDING; state = MAM_I_USER_PENDING;
*mam_state = MAM_USER_PENDING; *mam_state = MAM_USER_PENDING;
return 1; return 1;
} }
...@@ -634,16 +634,16 @@ int MAM_St_user_pending(int *mam_state, int wait_completed, void (*user_function ...@@ -634,16 +634,16 @@ int MAM_St_user_pending(int *mam_state, int wait_completed, void (*user_function
MAM_I_create_user_struct(MAM_SOURCES); MAM_I_create_user_struct(MAM_SOURCES);
do { do {
user_function(user_args); user_function(user_args);
} while(wait_completed && state == MALL_USER_PENDING); } while(wait_completed && state == MAM_I_USER_PENDING);
} else { } else {
MAM_Resume_redistribution(mam_state); MAM_Resume_redistribution(mam_state);
} }
if(state != MALL_USER_PENDING) { if(state != MAM_I_USER_PENDING) {
#if USE_MAL_BARRIERS #if USE_MAL_BARRIERS
MPI_Barrier(mall->intercomm); MPI_Barrier(mall->intercomm);
#endif #endif
if(mall_conf->spawn_method == MALL_SPAWN_MERGE) mall_conf->times->user_end = MPI_Wtime(); // Obtener timestamp de cuando termina user redist if(mall_conf->spawn_method == MAM_SPAWN_MERGE) mall_conf->times->user_end = MPI_Wtime(); // Obtener timestamp de cuando termina user redist
#if USE_MAL_DEBUG #if USE_MAL_DEBUG
if(mall->myId == mall->root) DEBUG_FUNC("Ended USER redistribution", mall->myId, mall->numP); fflush(stdout); if(mall->myId == mall->root) DEBUG_FUNC("Ended USER redistribution", mall->myId, mall->numP); fflush(stdout);
#endif #endif
...@@ -714,7 +714,7 @@ void Children_init(void (*user_function)(void *), void *user_args) { ...@@ -714,7 +714,7 @@ void Children_init(void (*user_function)(void *), void *user_args) {
#endif #endif
malleability_connect_children(&(mall->intercomm)); malleability_connect_children(&(mall->intercomm));
if(mall_conf->spawn_method == MALL_SPAWN_MERGE) { // For Merge Method, these processes will be added if(mall_conf->spawn_method == MAM_SPAWN_MERGE) { // For Merge Method, these processes will be added
MPI_Comm_rank(mall->intercomm, &mall->myId); MPI_Comm_rank(mall->intercomm, &mall->myId);
MPI_Comm_size(mall->intercomm, &mall->numP); MPI_Comm_size(mall->intercomm, &mall->numP);
} }
...@@ -796,7 +796,7 @@ void Children_init(void (*user_function)(void *), void *user_args) { ...@@ -796,7 +796,7 @@ void Children_init(void (*user_function)(void *), void *user_args) {
} }
MPI_Comm_set_name(mall->tmp_comm, "MAM_USER_TMP"); MPI_Comm_set_name(mall->tmp_comm, "MAM_USER_TMP");
if(user_function != NULL) { if(user_function != NULL) {
state = MALL_USER_PENDING; state = MAM_I_USER_PENDING;
MAM_I_create_user_struct(MAM_TARGETS); MAM_I_create_user_struct(MAM_TARGETS);
user_function(user_args); user_function(user_args);
} }
...@@ -902,10 +902,10 @@ int start_redistribution() { ...@@ -902,10 +902,10 @@ int start_redistribution() {
MPI_Ibarrier(mall->intercomm, &mall->wait_targets); MPI_Ibarrier(mall->intercomm, &mall->wait_targets);
mall->wait_targets_posted = 1; mall->wait_targets_posted = 1;
} }
return MALL_DIST_PENDING; return MAM_I_DIST_PENDING;
} }
} }
return MALL_USER_START; return MAM_I_USER_START;
} }
...@@ -978,7 +978,7 @@ int check_redistribution(int wait_completed) { ...@@ -978,7 +978,7 @@ int check_redistribution(int wait_completed) {
#endif #endif
MPI_Allreduce(&local_completed, &all_completed, 1, MPI_INT, MPI_MIN, mall->comm); MPI_Allreduce(&local_completed, &all_completed, 1, MPI_INT, MPI_MIN, mall->comm);
if(!all_completed) return MALL_DIST_PENDING; // Continue only if asynchronous send has ended if(!all_completed) return MAM_I_DIST_PENDING; // Continue only if asynchronous send has ended
} }
#if USE_MAL_DEBUG >= 2 #if USE_MAL_DEBUG >= 2
...@@ -1001,8 +1001,8 @@ int check_redistribution(int wait_completed) { ...@@ -1001,8 +1001,8 @@ int check_redistribution(int wait_completed) {
#if USE_MAL_BARRIERS #if USE_MAL_BARRIERS
MPI_Barrier(mall->intercomm); MPI_Barrier(mall->intercomm);
#endif #endif
if(mall_conf->spawn_method == MALL_SPAWN_MERGE) mall_conf->times->async_end = MPI_Wtime(); // Merge method only if(mall_conf->spawn_method == MAM_SPAWN_MERGE) mall_conf->times->async_end = MPI_Wtime(); // Merge method only
return MALL_USER_START; return MAM_I_USER_START;
} }
/* /*
...@@ -1032,12 +1032,12 @@ int end_redistribution() { ...@@ -1032,12 +1032,12 @@ int end_redistribution() {
#if USE_MAL_BARRIERS #if USE_MAL_BARRIERS
MPI_Barrier(mall->intercomm); MPI_Barrier(mall->intercomm);
#endif #endif
if(mall_conf->spawn_method == MALL_SPAWN_MERGE) mall_conf->times->sync_end = MPI_Wtime(); // Merge method only if(mall_conf->spawn_method == MAM_SPAWN_MERGE) mall_conf->times->sync_end = MPI_Wtime(); // Merge method only
} }
local_state = MALL_DIST_COMPLETED; local_state = MAM_I_DIST_COMPLETED;
if(mall_conf->spawn_method == MALL_SPAWN_MERGE && mall->numP > mall->numC) { // Merge Shrink if(mall_conf->spawn_method == MAM_SPAWN_MERGE && mall->numP > mall->numC) { // Merge Shrink
local_state = MALL_SPAWN_ADAPT_PENDING; local_state = MAM_I_SPAWN_ADAPT_PENDING;
} }
return local_state; return local_state;
...@@ -1056,7 +1056,7 @@ int comm_state; //FIXME Usar un handler ...@@ -1056,7 +1056,7 @@ int comm_state; //FIXME Usar un handler
* Crea una hebra para ejecutar una comunicación en segundo plano. * Crea una hebra para ejecutar una comunicación en segundo plano.
*/ */
int thread_creation() { int thread_creation() {
comm_state = MALL_DIST_PENDING; comm_state = MAM_I_DIST_PENDING;
if(pthread_create(&(mall->async_thread), NULL, thread_async_work, NULL)) { if(pthread_create(&(mall->async_thread), NULL, thread_async_work, NULL)) {
printf("Error al crear el hilo\n"); printf("Error al crear el hilo\n");
MPI_Abort(MPI_COMM_WORLD, -1); MPI_Abort(MPI_COMM_WORLD, -1);
...@@ -1074,7 +1074,7 @@ int thread_creation() { ...@@ -1074,7 +1074,7 @@ int thread_creation() {
int thread_check(int wait_completed) { int thread_check(int wait_completed) {
int all_completed = 0; int all_completed = 0;
if(wait_completed && comm_state == MALL_DIST_PENDING) { if(wait_completed && comm_state == MAM_I_DIST_PENDING) {
if(pthread_join(mall->async_thread, NULL)) { if(pthread_join(mall->async_thread, NULL)) {
printf("Error al esperar al hilo\n"); printf("Error al esperar al hilo\n");
MPI_Abort(MPI_COMM_WORLD, -1); MPI_Abort(MPI_COMM_WORLD, -1);
...@@ -1084,7 +1084,7 @@ int thread_check(int wait_completed) { ...@@ -1084,7 +1084,7 @@ int thread_check(int wait_completed) {
// Comprueba que todos los hilos han terminado la distribucion (Mismo valor en commAsync) // Comprueba que todos los hilos han terminado la distribucion (Mismo valor en commAsync)
MPI_Allreduce(&comm_state, &all_completed, 1, MPI_INT, MPI_MAX, mall->comm); MPI_Allreduce(&comm_state, &all_completed, 1, MPI_INT, MPI_MAX, mall->comm);
if(all_completed != MALL_DIST_COMPLETED) return MALL_DIST_PENDING; // Continue only if asynchronous send has ended if(all_completed != MAM_I_DIST_COMPLETED) return MAM_I_DIST_PENDING; // Continue only if asynchronous send has ended
if(pthread_join(mall->async_thread, NULL)) { if(pthread_join(mall->async_thread, NULL)) {
printf("Error al esperar al hilo\n"); printf("Error al esperar al hilo\n");
...@@ -1095,8 +1095,8 @@ int thread_check(int wait_completed) { ...@@ -1095,8 +1095,8 @@ int thread_check(int wait_completed) {
#if USE_MAL_BARRIERS #if USE_MAL_BARRIERS
MPI_Barrier(mall->intercomm); MPI_Barrier(mall->intercomm);
#endif #endif
if(mall_conf->spawn_method == MALL_SPAWN_MERGE) mall_conf->times->async_end = MPI_Wtime(); // Merge method only if(mall_conf->spawn_method == MAM_SPAWN_MERGE) mall_conf->times->async_end = MPI_Wtime(); // Merge method only
return MALL_USER_START; return MAM_I_USER_START;
} }
...@@ -1115,7 +1115,7 @@ void* thread_async_work() { ...@@ -1115,7 +1115,7 @@ void* thread_async_work() {
for(i=0; i<rep_a_data->entries; i++) { for(i=0; i<rep_a_data->entries; i++) {
MPI_Bcast(rep_a_data->arrays[i], rep_a_data->qty[i], rep_a_data->types[i], mall->root_collectives, mall->intercomm); MPI_Bcast(rep_a_data->arrays[i], rep_a_data->qty[i], rep_a_data->types[i], mall->root_collectives, mall->intercomm);
} }
comm_state = MALL_DIST_COMPLETED; comm_state = MAM_I_DIST_COMPLETED;
pthread_exit(NULL); pthread_exit(NULL);
} }
......
...@@ -77,8 +77,8 @@ void sync_communication(void *send, void **recv, int qty, MPI_Datatype datatype, ...@@ -77,8 +77,8 @@ void sync_communication(void *send, void **recv, int qty, MPI_Datatype datatype,
/* PERFORM COMMUNICATION */ /* PERFORM COMMUNICATION */
switch(mall_conf->red_method) { switch(mall_conf->red_method) {
case MALL_RED_RMA_LOCKALL: case MAM_RED_RMA_LOCKALL:
case MALL_RED_RMA_LOCK: case MAM_RED_RMA_LOCK:
if(is_children_group) { if(is_children_group) {
dist_data.tamBl = 0; dist_data.tamBl = 0;
} else { } else {
...@@ -87,10 +87,10 @@ void sync_communication(void *send, void **recv, int qty, MPI_Datatype datatype, ...@@ -87,10 +87,10 @@ void sync_communication(void *send, void **recv, int qty, MPI_Datatype datatype,
sync_rma(send, *recv, datatype, r_counts, dist_data.tamBl, comm); sync_rma(send, *recv, datatype, r_counts, dist_data.tamBl, comm);
break; break;
case MALL_RED_POINT: case MAM_RED_POINT:
sync_point2point(send, *recv, datatype, s_counts, r_counts, comm); sync_point2point(send, *recv, datatype, s_counts, r_counts, comm);
break; break;
case MALL_RED_BASELINE: case MAM_RED_BASELINE:
default: default:
MPI_Alltoallv(send, s_counts.counts, s_counts.displs, datatype, *recv, r_counts.counts, r_counts.displs, datatype, comm); MPI_Alltoallv(send, s_counts.counts, s_counts.displs, datatype, *recv, r_counts.counts, r_counts.displs, datatype, comm);
break; break;
...@@ -122,7 +122,7 @@ void sync_point2point(void *send, void *recv, MPI_Datatype datatype, struct Coun ...@@ -122,7 +122,7 @@ void sync_point2point(void *send, void *recv, MPI_Datatype datatype, struct Coun
MPI_Type_size(datatype, &datasize); MPI_Type_size(datatype, &datasize);
init = s_counts.idI; init = s_counts.idI;
end = s_counts.idE; end = s_counts.idE;
if(mall_conf->spawn_method == MALL_SPAWN_MERGE && (s_counts.idI == mall->myId || s_counts.idE == mall->myId + 1)) { if(mall_conf->spawn_method == MAM_SPAWN_MERGE && (s_counts.idI == mall->myId || s_counts.idE == mall->myId + 1)) {
offset = s_counts.displs[mall->myId] * datasize; offset = s_counts.displs[mall->myId] * datasize;
offset2 = r_counts.displs[mall->myId] * datasize; offset2 = r_counts.displs[mall->myId] * datasize;
memcpy(recv+offset2, send+offset, s_counts.counts[mall->myId]); memcpy(recv+offset2, send+offset, s_counts.counts[mall->myId]);
...@@ -145,7 +145,7 @@ void sync_point2point(void *send, void *recv, MPI_Datatype datatype, struct Coun ...@@ -145,7 +145,7 @@ void sync_point2point(void *send, void *recv, MPI_Datatype datatype, struct Coun
init = r_counts.idI; init = r_counts.idI;
end = r_counts.idE; end = r_counts.idE;
if(mall_conf->spawn_method == MALL_SPAWN_MERGE) { if(mall_conf->spawn_method == MAM_SPAWN_MERGE) {
if(r_counts.idI == mall->myId) init = r_counts.idI+1; if(r_counts.idI == mall->myId) init = r_counts.idI+1;
else if(r_counts.idE == mall->myId + 1) end = r_counts.idE-1; else if(r_counts.idE == mall->myId + 1) end = r_counts.idE-1;
} }
...@@ -190,10 +190,10 @@ void sync_rma(void *send, void *recv, MPI_Datatype datatype, struct Counts r_cou ...@@ -190,10 +190,10 @@ void sync_rma(void *send, void *recv, MPI_Datatype datatype, struct Counts r_cou
DEBUG_FUNC("Created Window for synchronous RMA communication", mall->myId, mall->numP); fflush(stdout); MPI_Barrier(comm); DEBUG_FUNC("Created Window for synchronous RMA communication", mall->myId, mall->numP); fflush(stdout); MPI_Barrier(comm);
#endif #endif
switch(mall_conf->red_method) { switch(mall_conf->red_method) {
case MALL_RED_RMA_LOCKALL: case MAM_RED_RMA_LOCKALL:
sync_rma_lockall(recv, datatype, r_counts, win); sync_rma_lockall(recv, datatype, r_counts, win);
break; break;
case MALL_RED_RMA_LOCK: case MAM_RED_RMA_LOCK:
sync_rma_lock(recv, datatype, r_counts, win); sync_rma_lock(recv, datatype, r_counts, win);
break; break;
} }
...@@ -293,8 +293,8 @@ void async_communication_start(void *send, void **recv, int qty, MPI_Datatype da ...@@ -293,8 +293,8 @@ void async_communication_start(void *send, void **recv, int qty, MPI_Datatype da
/* PERFORM COMMUNICATION */ /* PERFORM COMMUNICATION */
switch(mall_conf->red_method) { switch(mall_conf->red_method) {
case MALL_RED_RMA_LOCKALL: case MAM_RED_RMA_LOCKALL:
case MALL_RED_RMA_LOCK: case MAM_RED_RMA_LOCK:
if(is_children_group) { if(is_children_group) {
dist_data.tamBl = 0; dist_data.tamBl = 0;
} else { } else {
...@@ -302,10 +302,10 @@ void async_communication_start(void *send, void **recv, int qty, MPI_Datatype da ...@@ -302,10 +302,10 @@ void async_communication_start(void *send, void **recv, int qty, MPI_Datatype da
} }
async_rma(send, *recv, datatype, r_counts, dist_data.tamBl, comm, *requests, win); async_rma(send, *recv, datatype, r_counts, dist_data.tamBl, comm, *requests, win);
break; break;
case MALL_RED_POINT: case MAM_RED_POINT:
async_point2point(send, *recv, datatype, s_counts, r_counts, comm, *requests); async_point2point(send, *recv, datatype, s_counts, r_counts, comm, *requests);
break; break;
case MALL_RED_BASELINE: case MAM_RED_BASELINE:
default: default:
MPI_Ialltoallv(send, s_counts.counts, s_counts.displs, datatype, *recv, r_counts.counts, r_counts.displs, datatype, comm, &((*requests)[0])); MPI_Ialltoallv(send, s_counts.counts, s_counts.displs, datatype, *recv, r_counts.counts, r_counts.displs, datatype, comm, &((*requests)[0]));
break; break;
...@@ -376,7 +376,7 @@ void async_communication_end(MPI_Request *requests, size_t request_qty, MPI_Win ...@@ -376,7 +376,7 @@ void async_communication_end(MPI_Request *requests, size_t request_qty, MPI_Win
//ha terminado, aunque solo se pueda llegar a este punto cuando ha terminado //ha terminado, aunque solo se pueda llegar a este punto cuando ha terminado
if(MAM_Contains_strat(MAM_RED_STRATEGIES, MAM_STRAT_RED_WAIT_TARGETS, NULL)) { MPI_Waitall(request_qty, requests, MPI_STATUSES_IGNORE); } if(MAM_Contains_strat(MAM_RED_STRATEGIES, MAM_STRAT_RED_WAIT_TARGETS, NULL)) { MPI_Waitall(request_qty, requests, MPI_STATUSES_IGNORE); }
if((mall_conf->red_method == MALL_RED_RMA_LOCKALL || mall_conf->red_method == MALL_RED_RMA_LOCK) if((mall_conf->red_method == MAM_RED_RMA_LOCKALL || mall_conf->red_method == MAM_RED_RMA_LOCK)
&& *win != MPI_WIN_NULL) { MPI_Win_free(win); } && *win != MPI_WIN_NULL) { MPI_Win_free(win); }
} }
...@@ -434,10 +434,10 @@ void async_rma(void *send, void *recv, MPI_Datatype datatype, struct Counts r_co ...@@ -434,10 +434,10 @@ void async_rma(void *send, void *recv, MPI_Datatype datatype, struct Counts r_co
MPI_Type_size(datatype, &datasize); MPI_Type_size(datatype, &datasize);
MPI_Win_create(send, (MPI_Aint)tamBl * datasize, datasize, MPI_INFO_NULL, comm, win); MPI_Win_create(send, (MPI_Aint)tamBl * datasize, datasize, MPI_INFO_NULL, comm, win);
switch(mall_conf->red_method) { switch(mall_conf->red_method) {
case MALL_RED_RMA_LOCKALL: case MAM_RED_RMA_LOCKALL:
async_rma_lockall(recv, datatype, r_counts, *win, requests); async_rma_lockall(recv, datatype, r_counts, *win, requests);
break; break;
case MALL_RED_RMA_LOCK: case MAM_RED_RMA_LOCK:
async_rma_lock(recv, datatype, r_counts, *win, requests); async_rma_lock(recv, datatype, r_counts, *win, requests);
break; break;
} }
...@@ -526,7 +526,7 @@ void prepare_redistribution(int qty, MPI_Datatype datatype, int numP, int numO, ...@@ -526,7 +526,7 @@ void prepare_redistribution(int qty, MPI_Datatype datatype, int numP, int numO,
int datasize; int datasize;
struct Dist_data dist_data; struct Dist_data dist_data;
if(mall_conf->spawn_method == MALL_SPAWN_BASELINE) { if(mall_conf->spawn_method == MAM_SPAWN_BASELINE) {
offset_ids = MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_INTERCOMM, NULL) ? offset_ids = MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_INTERCOMM, NULL) ?
0 : numP; 0 : numP;
} else { } else {
...@@ -555,7 +555,7 @@ void prepare_redistribution(int qty, MPI_Datatype datatype, int numP, int numO, ...@@ -555,7 +555,7 @@ void prepare_redistribution(int qty, MPI_Datatype datatype, int numP, int numO,
#endif #endif
prepare_comm_alltoall(mall->myId, numP, numO, qty, offset_ids, s_counts); prepare_comm_alltoall(mall->myId, numP, numO, qty, offset_ids, s_counts);
if(mall_conf->spawn_method == MALL_SPAWN_MERGE && mall->myId < numO) { if(mall_conf->spawn_method == MAM_SPAWN_MERGE && mall->myId < numO) {
prepare_comm_alltoall(mall->myId, numO, numP, qty, offset_ids, r_counts); prepare_comm_alltoall(mall->myId, numO, numP, qty, offset_ids, r_counts);
// Obtener distribución para este hijo y reservar vector de recibo // Obtener distribución para este hijo y reservar vector de recibo
get_block_dist(qty, mall->myId, numO, &dist_data); get_block_dist(qty, mall->myId, numO, &dist_data);
...@@ -587,10 +587,10 @@ void check_requests(struct Counts s_counts, struct Counts r_counts, MPI_Request ...@@ -587,10 +587,10 @@ void check_requests(struct Counts s_counts, struct Counts r_counts, MPI_Request
MPI_Request *aux; MPI_Request *aux;
switch(mall_conf->red_method) { switch(mall_conf->red_method) {
case MALL_RED_BASELINE: case MAM_RED_BASELINE:
sum = 1; sum = 1;
break; break;
case MALL_RED_POINT: case MAM_RED_POINT:
default: default:
sum = (size_t) s_counts.idE - s_counts.idI; sum = (size_t) s_counts.idE - s_counts.idI;
sum += (size_t) r_counts.idE - r_counts.idI; sum += (size_t) r_counts.idE - r_counts.idI;
......
...@@ -36,7 +36,7 @@ int baseline(Spawn_data spawn_data, MPI_Comm *child) { //TODO Tratamiento de err ...@@ -36,7 +36,7 @@ int baseline(Spawn_data spawn_data, MPI_Comm *child) { //TODO Tratamiento de err
if(spawn_data.spawn_is_single) { single_strat_children(child); } if(spawn_data.spawn_is_single) { single_strat_children(child); }
} }
return MALL_SPAWN_COMPLETED; return MAM_I_SPAWN_COMPLETED;
} }
//--------------PRIVATE FUNCTIONS---------------// //--------------PRIVATE FUNCTIONS---------------//
...@@ -198,7 +198,7 @@ void single_strat_parents(Spawn_data spawn_data, MPI_Comm *child) { ...@@ -198,7 +198,7 @@ void single_strat_parents(Spawn_data spawn_data, MPI_Comm *child) {
port_name = (char *) malloc(MPI_MAX_PORT_NAME * sizeof(char)); port_name = (char *) malloc(MPI_MAX_PORT_NAME * sizeof(char));
MPI_Recv(port_name, MPI_MAX_PORT_NAME, MPI_CHAR, MPI_ANY_SOURCE, MAM_TAG_STRAT_SINGLE, *child, MPI_STATUS_IGNORE); MPI_Recv(port_name, MPI_MAX_PORT_NAME, MPI_CHAR, MPI_ANY_SOURCE, MAM_TAG_STRAT_SINGLE, *child, MPI_STATUS_IGNORE);
set_spawn_state(MALL_SPAWN_SINGLE_COMPLETED, spawn_data.spawn_is_async); // Indicate other processes to join root to end spawn procedure set_spawn_state(MAM_I_SPAWN_SINGLE_COMPLETED, spawn_data.spawn_is_async); // Indicate other processes to join root to end spawn procedure
wakeup_completion(); wakeup_completion();
} else { } else {
port_name = malloc(1); port_name = malloc(1);
......
...@@ -50,7 +50,7 @@ void* thread_work(void *args); ...@@ -50,7 +50,7 @@ void* thread_work(void *args);
* Si se pide en segundo plano, llamar a "check_spawn_state()" comprobara si la configuracion para * Si se pide en segundo plano, llamar a "check_spawn_state()" comprobara si la configuracion para
* crearlos esta lista, y si es asi, los crea. * crearlos esta lista, y si es asi, los crea.
* *
* Devuelve el estado de el procedimiento. Si no devuelve "MALL_SPAWN_COMPLETED", es necesario llamar a * Devuelve el estado de el procedimiento. Si no devuelve "MAM_I_SPAWN_COMPLETED", es necesario llamar a
* "check_spawn_state()". * "check_spawn_state()".
*/ */
int init_spawn(MPI_Comm comm, MPI_Comm *child) { int init_spawn(MPI_Comm comm, MPI_Comm *child) {
...@@ -58,16 +58,16 @@ int init_spawn(MPI_Comm comm, MPI_Comm *child) { ...@@ -58,16 +58,16 @@ int init_spawn(MPI_Comm comm, MPI_Comm *child) {
set_spawn_configuration(comm); set_spawn_configuration(comm);
if(!spawn_data->spawn_is_async) { if(!spawn_data->spawn_is_async) {
generic_spawn(child, MALL_NOT_STARTED); generic_spawn(child, MAM_I_NOT_STARTED);
local_state = get_spawn_state(spawn_data->spawn_is_async); local_state = get_spawn_state(spawn_data->spawn_is_async);
if (local_state == MALL_SPAWN_COMPLETED) if (local_state == MAM_I_SPAWN_COMPLETED)
deallocate_spawn_data(); deallocate_spawn_data();
} else { } else {
local_state = spawn_data->spawn_is_single ? local_state = spawn_data->spawn_is_single ?
MALL_SPAWN_SINGLE_PENDING : MALL_SPAWN_PENDING; MAM_I_SPAWN_SINGLE_PENDING : MAM_I_SPAWN_PENDING;
local_state = mall_conf->spawn_method == MALL_SPAWN_MERGE && spawn_data->initial_qty > spawn_data->target_qty ? local_state = mall_conf->spawn_method == MAM_SPAWN_MERGE && spawn_data->initial_qty > spawn_data->target_qty ?
MALL_SPAWN_ADAPT_POSTPONE : local_state; MAM_I_SPAWN_ADAPT_POSTPONE : local_state;
set_spawn_state(local_state, 0); set_spawn_state(local_state, 0);
if((spawn_data->spawn_is_single && mall->myId == mall->root) || !spawn_data->spawn_is_single) { if((spawn_data->spawn_is_single && mall->myId == mall->root) || !spawn_data->spawn_is_single) {
allocate_thread_spawn(child); allocate_thread_spawn(child);
...@@ -83,18 +83,18 @@ int init_spawn(MPI_Comm comm, MPI_Comm *child) { ...@@ -83,18 +83,18 @@ int init_spawn(MPI_Comm comm, MPI_Comm *child) {
*/ */
int check_spawn_state(MPI_Comm *child, MPI_Comm comm, int wait_completed) { int check_spawn_state(MPI_Comm *child, MPI_Comm comm, int wait_completed) {
int local_state; int local_state;
int global_state=MALL_NOT_STARTED; int global_state=MAM_I_NOT_STARTED;
if(spawn_data->spawn_is_async) { // Async if(spawn_data->spawn_is_async) { // Async
local_state = get_spawn_state(spawn_data->spawn_is_async); local_state = get_spawn_state(spawn_data->spawn_is_async);
if(local_state == MALL_SPAWN_SINGLE_PENDING || local_state == MALL_SPAWN_SINGLE_COMPLETED) { // Single if(local_state == MAM_I_SPAWN_SINGLE_PENDING || local_state == MAM_I_SPAWN_SINGLE_COMPLETED) { // Single
global_state = check_single_state(comm, child, local_state, wait_completed); global_state = check_single_state(comm, child, local_state, wait_completed);
} else if(local_state == MALL_SPAWN_PENDING || local_state == MALL_SPAWN_COMPLETED || local_state == MALL_SPAWN_ADAPTED) { // Generic } else if(local_state == MAM_I_SPAWN_PENDING || local_state == MAM_I_SPAWN_COMPLETED || local_state == MAM_I_SPAWN_ADAPTED) { // Generic
global_state = check_generic_state(comm, local_state, wait_completed); global_state = check_generic_state(comm, local_state, wait_completed);
} else if(local_state == MALL_SPAWN_ADAPT_POSTPONE) { } else if(local_state == MAM_I_SPAWN_ADAPT_POSTPONE) {
global_state = local_state; global_state = local_state;
} else { } else {
...@@ -102,18 +102,18 @@ int check_spawn_state(MPI_Comm *child, MPI_Comm comm, int wait_completed) { ...@@ -102,18 +102,18 @@ int check_spawn_state(MPI_Comm *child, MPI_Comm comm, int wait_completed) {
MPI_Abort(MPI_COMM_WORLD, -1); MPI_Abort(MPI_COMM_WORLD, -1);
return -10; return -10;
} }
} else if(mall_conf->spawn_method == MALL_SPAWN_MERGE){ // Start Merge shrink Sync } else if(mall_conf->spawn_method == MAM_SPAWN_MERGE){ // Start Merge shrink Sync
generic_spawn(child, MALL_DIST_COMPLETED); generic_spawn(child, MAM_I_DIST_COMPLETED);
global_state = get_spawn_state(spawn_data->spawn_is_async); global_state = get_spawn_state(spawn_data->spawn_is_async);
} }
if(global_state == MALL_SPAWN_COMPLETED || global_state == MALL_SPAWN_ADAPTED) if(global_state == MAM_I_SPAWN_COMPLETED || global_state == MAM_I_SPAWN_ADAPTED)
deallocate_spawn_data(); deallocate_spawn_data();
return global_state; return global_state;
} }
/* /*
* Elimina la bandera bloqueante MALL_SPAWN_ADAPT_POSTPONE para los hilos * Elimina la bandera bloqueante MAM_I_SPAWN_ADAPT_POSTPONE para los hilos
* auxiliares. Esta bandera los bloquea para que el metodo Merge shrink no * auxiliares. Esta bandera los bloquea para que el metodo Merge shrink no
* avance hasta que se complete la redistribucion de datos. Por tanto, * avance hasta que se complete la redistribucion de datos. Por tanto,
* al modificar la bandera los hilos pueden continuar. * al modificar la bandera los hilos pueden continuar.
...@@ -123,8 +123,8 @@ int check_spawn_state(MPI_Comm *child, MPI_Comm comm, int wait_completed) { ...@@ -123,8 +123,8 @@ int check_spawn_state(MPI_Comm *child, MPI_Comm comm, int wait_completed) {
*/ */
void unset_spawn_postpone_flag(int outside_state) { void unset_spawn_postpone_flag(int outside_state) {
int local_state = get_spawn_state(spawn_data->spawn_is_async); int local_state = get_spawn_state(spawn_data->spawn_is_async);
if(local_state == MALL_SPAWN_ADAPT_POSTPONE && outside_state == MALL_SPAWN_ADAPT_PENDING && spawn_data->spawn_is_async) { if(local_state == MAM_I_SPAWN_ADAPT_POSTPONE && outside_state == MAM_I_SPAWN_ADAPT_PENDING && spawn_data->spawn_is_async) {
set_spawn_state(MALL_SPAWN_PENDING, spawn_data->spawn_is_async); set_spawn_state(MAM_I_SPAWN_PENDING, spawn_data->spawn_is_async);
wakeup_redistribution(); wakeup_redistribution();
} }
} }
...@@ -149,16 +149,16 @@ void malleability_connect_children(MPI_Comm *parents) { ...@@ -149,16 +149,16 @@ void malleability_connect_children(MPI_Comm *parents) {
MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, &(spawn_data->spawn_is_multiple)); MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, &(spawn_data->spawn_is_multiple));
switch(mall_conf->spawn_method) { switch(mall_conf->spawn_method) {
case MALL_SPAWN_BASELINE: case MAM_SPAWN_BASELINE:
spawn_data->spawn_qty = spawn_data->target_qty; spawn_data->spawn_qty = spawn_data->target_qty;
baseline(*spawn_data, parents); baseline(*spawn_data, parents);
if(!spawn_data->spawn_is_intercomm) { if(!spawn_data->spawn_is_intercomm) {
intracomm_strategy(MAM_TARGETS, parents); intracomm_strategy(MAM_TARGETS, parents);
} }
break; break;
case MALL_SPAWN_MERGE: case MAM_SPAWN_MERGE:
spawn_data->spawn_qty = spawn_data->target_qty - spawn_data->initial_qty; spawn_data->spawn_qty = spawn_data->target_qty - spawn_data->initial_qty;
merge(*spawn_data, parents, MALL_NOT_STARTED); merge(*spawn_data, parents, MAM_I_NOT_STARTED);
break; break;
} }
free(spawn_data); free(spawn_data);
...@@ -180,15 +180,15 @@ void set_spawn_configuration(MPI_Comm comm) { ...@@ -180,15 +180,15 @@ void set_spawn_configuration(MPI_Comm comm) {
MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_INTERCOMM, &(spawn_data->spawn_is_intercomm)); MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_INTERCOMM, &(spawn_data->spawn_is_intercomm));
MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, &(spawn_data->spawn_is_multiple)); MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, &(spawn_data->spawn_is_multiple));
spawn_data->comm = comm; spawn_data->comm = comm;
spawn_data->mapping_fill_method = MALL_DIST_STRING; spawn_data->mapping_fill_method = MAM_PHY_TYPE_STRING;
spawn_data->sets = NULL; spawn_data->sets = NULL;
switch(mall_conf->spawn_method) { switch(mall_conf->spawn_method) {
case MALL_SPAWN_BASELINE: case MAM_SPAWN_BASELINE:
spawn_data->spawn_qty = spawn_data->target_qty; spawn_data->spawn_qty = spawn_data->target_qty;
spawn_data->already_created = 0; spawn_data->already_created = 0;
break; break;
case MALL_SPAWN_MERGE: case MAM_SPAWN_MERGE:
spawn_data->spawn_qty = spawn_data->target_qty - spawn_data->initial_qty; spawn_data->spawn_qty = spawn_data->target_qty - spawn_data->initial_qty;
spawn_data->already_created = spawn_data->initial_qty; spawn_data->already_created = spawn_data->initial_qty;
break; break;
...@@ -245,19 +245,19 @@ void generic_spawn(MPI_Comm *child, int data_stage) { ...@@ -245,19 +245,19 @@ void generic_spawn(MPI_Comm *child, int data_stage) {
processes_dist(spawn_data); processes_dist(spawn_data);
} }
switch(mall_conf->spawn_method) { switch(mall_conf->spawn_method) {
case MALL_SPAWN_BASELINE: case MAM_SPAWN_BASELINE:
local_state = baseline(*spawn_data, child); local_state = baseline(*spawn_data, child);
if(!spawn_data->spawn_is_intercomm) { if(!spawn_data->spawn_is_intercomm) {
local_state = intracomm_strategy(MAM_SOURCES, child); local_state = intracomm_strategy(MAM_SOURCES, child);
} }
break; break;
case MALL_SPAWN_MERGE: case MAM_SPAWN_MERGE:
local_state = merge(*spawn_data, child, data_stage); local_state = merge(*spawn_data, child, data_stage);
break; break;
} }
// END WORK // END WORK
aux_state = get_spawn_state(spawn_data->spawn_is_async); aux_state = get_spawn_state(spawn_data->spawn_is_async);
if(!(aux_state == MALL_SPAWN_PENDING && local_state == MALL_SPAWN_ADAPT_POSTPONE)) { if(!(aux_state == MAM_I_SPAWN_PENDING && local_state == MAM_I_SPAWN_ADAPT_POSTPONE)) {
set_spawn_state(local_state, spawn_data->spawn_is_async); set_spawn_state(local_state, spawn_data->spawn_is_async);
} }
} }
...@@ -295,14 +295,14 @@ void* thread_work(void *args) { ...@@ -295,14 +295,14 @@ void* thread_work(void *args) {
int local_state; int local_state;
MPI_Comm *child = (MPI_Comm *) args; MPI_Comm *child = (MPI_Comm *) args;
generic_spawn(child, MALL_NOT_STARTED); generic_spawn(child, MAM_I_NOT_STARTED);
local_state = get_spawn_state(spawn_data->spawn_is_async); local_state = get_spawn_state(spawn_data->spawn_is_async);
if(local_state == MALL_SPAWN_ADAPT_POSTPONE || local_state == MALL_SPAWN_PENDING) { if(local_state == MAM_I_SPAWN_ADAPT_POSTPONE || local_state == MAM_I_SPAWN_PENDING) {
// El grupo de procesos se terminara de juntar tras la redistribucion de datos // El grupo de procesos se terminara de juntar tras la redistribucion de datos
local_state = wait_redistribution(); local_state = wait_redistribution();
generic_spawn(child, MALL_DIST_COMPLETED); generic_spawn(child, MAM_I_DIST_COMPLETED);
} }
wakeup_completion(); wakeup_completion();
...@@ -313,22 +313,22 @@ void* thread_work(void *args) { ...@@ -313,22 +313,22 @@ void* thread_work(void *args) {
* Comprueba si una creacion de procesos asincrona en el * Comprueba si una creacion de procesos asincrona en el
* paso "single" ha terminado. * paso "single" ha terminado.
* Si no ha terminado se mantiene el estado * Si no ha terminado se mantiene el estado
* "MALL_SPAWN_SINGLE_PENDING". * "MAM_I_SPAWN_SINGLE_PENDING".
* *
* Si ha terminado se crean los hilos auxiliares para * Si ha terminado se crean los hilos auxiliares para
* los procesos no root y se devuelve el estado * los procesos no root y se devuelve el estado
* "MALL_SPAWN_PENDING". * "MAM_I_SPAWN_PENDING".
*/ */
int check_single_state(MPI_Comm comm, MPI_Comm *child, int global_state, int wait_completed) { int check_single_state(MPI_Comm comm, MPI_Comm *child, int global_state, int wait_completed) {
while(wait_completed && mall->myId == mall->root && global_state == MALL_SPAWN_SINGLE_PENDING) { while(wait_completed && mall->myId == mall->root && global_state == MAM_I_SPAWN_SINGLE_PENDING) {
global_state = wait_completion(); global_state = wait_completion();
} }
MPI_Bcast(&global_state, 1, MPI_INT, mall->root, comm); MPI_Bcast(&global_state, 1, MPI_INT, mall->root, comm);
// Non-root processes join root to finalize the spawn // Non-root processes join root to finalize the spawn
// They also must join if the application has ended its work // They also must join if the application has ended its work
if(global_state == MALL_SPAWN_SINGLE_COMPLETED) { if(global_state == MAM_I_SPAWN_SINGLE_COMPLETED) {
global_state = MALL_SPAWN_PENDING; global_state = MAM_I_SPAWN_PENDING;
set_spawn_state(global_state, spawn_data->spawn_is_async); set_spawn_state(global_state, spawn_data->spawn_is_async);
if(mall->myId != mall->root) { if(mall->myId != mall->root) {
...@@ -342,18 +342,18 @@ int check_single_state(MPI_Comm comm, MPI_Comm *child, int global_state, int wai ...@@ -342,18 +342,18 @@ int check_single_state(MPI_Comm comm, MPI_Comm *child, int global_state, int wai
* Comprueba si una creación de procesos asincrona en el * Comprueba si una creación de procesos asincrona en el
* paso "generic" ha terminado. * paso "generic" ha terminado.
* Si no ha terminado devuelve el estado * Si no ha terminado devuelve el estado
* "MALL_SPAWN_PENDING". * "MAM_I_SPAWN_PENDING".
* *
* Si ha terminado libera la memoria asociada a spawn_data * Si ha terminado libera la memoria asociada a spawn_data
* y devuelve el estado "MALL_SPAWN_COMPLETED". * y devuelve el estado "MAM_I_SPAWN_COMPLETED".
*/ */
int check_generic_state(MPI_Comm comm, int local_state, int wait_completed) { int check_generic_state(MPI_Comm comm, int local_state, int wait_completed) {
int global_state; int global_state;
while(wait_completed && local_state == MALL_SPAWN_PENDING) local_state = wait_completion(); while(wait_completed && local_state == MAM_I_SPAWN_PENDING) local_state = wait_completion();
MPI_Allreduce(&local_state, &global_state, 1, MPI_INT, MPI_MIN, comm); MPI_Allreduce(&local_state, &global_state, 1, MPI_INT, MPI_MIN, comm);
if(global_state == MALL_SPAWN_COMPLETED || global_state == MALL_SPAWN_ADAPTED) { if(global_state == MAM_I_SPAWN_COMPLETED || global_state == MAM_I_SPAWN_ADAPTED) {
set_spawn_state(global_state, spawn_data->spawn_is_async); set_spawn_state(global_state, spawn_data->spawn_is_async);
} }
return global_state; return global_state;
......
...@@ -17,11 +17,11 @@ int merge(Spawn_data spawn_data, MPI_Comm *child, int data_state) { ...@@ -17,11 +17,11 @@ int merge(Spawn_data spawn_data, MPI_Comm *child, int data_state) {
int is_children_group = 1; int is_children_group = 1;
if(spawn_data.initial_qty > spawn_data.target_qty) { //Shrink if(spawn_data.initial_qty > spawn_data.target_qty) { //Shrink
if(data_state == MALL_DIST_COMPLETED) { if(data_state == MAM_I_DIST_COMPLETED) {
merge_adapt_shrink(spawn_data.target_qty, child, spawn_data.comm, mall->myId); merge_adapt_shrink(spawn_data.target_qty, child, spawn_data.comm, mall->myId);
local_state = MALL_SPAWN_ADAPTED; local_state = MAM_I_SPAWN_ADAPTED;
} else { } else {
local_state = MALL_SPAWN_ADAPT_POSTPONE; local_state = MAM_I_SPAWN_ADAPT_POSTPONE;
} }
} else { //Expand } else { //Expand
MPI_Comm_get_parent(&intercomm); MPI_Comm_get_parent(&intercomm);
...@@ -30,7 +30,7 @@ int merge(Spawn_data spawn_data, MPI_Comm *child, int data_state) { ...@@ -30,7 +30,7 @@ int merge(Spawn_data spawn_data, MPI_Comm *child, int data_state) {
baseline(spawn_data, child); baseline(spawn_data, child);
merge_adapt_expand(child, is_children_group); merge_adapt_expand(child, is_children_group);
local_state = MALL_SPAWN_COMPLETED; local_state = MAM_I_SPAWN_COMPLETED;
} }
return local_state; return local_state;
...@@ -38,7 +38,7 @@ int merge(Spawn_data spawn_data, MPI_Comm *child, int data_state) { ...@@ -38,7 +38,7 @@ int merge(Spawn_data spawn_data, MPI_Comm *child, int data_state) {
int intracomm_strategy(int is_children_group, MPI_Comm *child) { int intracomm_strategy(int is_children_group, MPI_Comm *child) {
merge_adapt_expand(child, is_children_group); merge_adapt_expand(child, is_children_group);
return MALL_SPAWN_COMPLETED; return MAM_I_SPAWN_COMPLETED;
} }
//--------------PRIVATE MERGE TYPE FUNCTIONS---------------// //--------------PRIVATE MERGE TYPE FUNCTIONS---------------//
......
...@@ -54,7 +54,7 @@ void processes_dist(Spawn_data *spawn_data) { ...@@ -54,7 +54,7 @@ void processes_dist(Spawn_data *spawn_data) {
spawn_data->sets = (Spawn_set *) malloc(spawn_data->total_spawns * sizeof(Spawn_set)); spawn_data->sets = (Spawn_set *) malloc(spawn_data->total_spawns * sizeof(Spawn_set));
#if USE_MAL_SLURM #if USE_MAL_SLURM
switch(spawn_data->mapping_fill_method) { switch(spawn_data->mapping_fill_method) {
case MALL_DIST_STRING: case MAM_PHY_TYPE_STRING:
// if(MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, NULL) ) { // if(MAM_Contains_strat(MAM_SPAWN_STRATEGIES, MAM_STRAT_SPAWN_MULTIPLE, NULL) ) {
if(spawn_data->spawn_is_multiple) { if(spawn_data->spawn_is_multiple) {
generate_multiple_info_string_slurm(mall->nodelist, procs_array, used_nodes, spawn_data); generate_multiple_info_string_slurm(mall->nodelist, procs_array, used_nodes, spawn_data);
...@@ -62,7 +62,7 @@ void processes_dist(Spawn_data *spawn_data) { ...@@ -62,7 +62,7 @@ void processes_dist(Spawn_data *spawn_data) {
generate_info_string_slurm(mall->nodelist, procs_array, used_nodes, spawn_data); generate_info_string_slurm(mall->nodelist, procs_array, used_nodes, spawn_data);
} }
break; break;
case MALL_DIST_HOSTFILE: // FIXME Does not consider multiple spawn strat case MAM_PHY_TYPE_HOSTFILE: // FIXME Does not consider multiple spawn strat
generate_info_hostfile_slurm(mall->nodelist, procs_array, used_nodes, spawn_data); generate_info_hostfile_slurm(mall->nodelist, procs_array, used_nodes, spawn_data);
break; break;
} }
...@@ -98,10 +98,10 @@ void node_dist(Spawn_data spawn_data, int **qty, int *used_nodes, int *total_spa ...@@ -98,10 +98,10 @@ void node_dist(Spawn_data spawn_data, int **qty, int *used_nodes, int *total_spa
/* GET NEW DISTRIBUTION */ /* GET NEW DISTRIBUTION */
switch(mall_conf->spawn_dist) { switch(mall_conf->spawn_dist) {
case MALL_DIST_SPREAD: // DIST NODES @deprecated case MAM_PHY_DIST_SPREAD: // DIST NODES @deprecated
spread_dist(spawn_data, used_nodes, procs); spread_dist(spawn_data, used_nodes, procs);
break; break;
case MALL_DIST_COMPACT: // DIST CPUs case MAM_PHY_DIST_COMPACT: // DIST CPUs
compact_dist(spawn_data, used_nodes, procs); compact_dist(spawn_data, used_nodes, procs);
break; break;
} }
......
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