Commit 8d6cfa64 authored by Iker Martín Álvarez's avatar Iker Martín Álvarez
Browse files

Hotfix - Some bugs when handling strings have been resolved. There is still an...

Hotfix - Some bugs when handling strings have been resolved. There is still an error when performing multiple reconfigurations
parent 93ff2656
...@@ -38,8 +38,7 @@ int main(int argc, char *argv[]) { ...@@ -38,8 +38,7 @@ int main(int argc, char *argv[]) {
int req; int req;
int im_child; int im_child;
//FIXME El codigo no es capaz de hacer mas de una redistribucion - Arreglar malleabilityTypes.c int num_cpus, num_nodes;
int num_cpus, num_nodes; //nodelist_len; //FIXME Eliminar cuando se utilice Slurm
char *nodelist = NULL; char *nodelist = NULL;
num_cpus = 20; //FIXME NUMERO MAGICO //TODO Usar openMP para obtener el valor con un pragma num_cpus = 20; //FIXME NUMERO MAGICO //TODO Usar openMP para obtener el valor con un pragma
if (argc >= 5) { if (argc >= 5) {
...@@ -405,7 +404,6 @@ void init_application() { ...@@ -405,7 +404,6 @@ void init_application() {
run_id = atoi(group->argv[2]); run_id = atoi(group->argv[2]);
} }
//config_file = read_ini_file(group->argv[1]);
init_config(group->argv[1], &config_file); init_config(group->argv[1], &config_file);
results = malloc(sizeof(results_data)); results = malloc(sizeof(results_data));
init_results_data(results, config_file->n_resizes, config_file->n_stages, config_file->groups[group->grp].iters); init_results_data(results, config_file->n_resizes, config_file->n_stages, config_file->groups[group->grp].iters);
......
...@@ -41,7 +41,6 @@ typedef struct ...@@ -41,7 +41,6 @@ typedef struct
char* array, *full_array; char* array, *full_array;
double* double_array; double* double_array;
// Arrays to indicate how many bytes are received from each rank // Arrays to indicate how many bytes are received from each rank
//int *counts, *displs;
struct Counts counts; struct Counts counts;
} iter_stage_t; } iter_stage_t;
......
...@@ -117,7 +117,13 @@ int init_malleability(int myId, int numP, int root, MPI_Comm comm, char *name_ex ...@@ -117,7 +117,13 @@ int init_malleability(int myId, int numP, int root, MPI_Comm comm, char *name_ex
return MALLEABILITY_CHILDREN; return MALLEABILITY_CHILDREN;
} }
mall->nodelist_len = strlen(nodelist); if(nodelist != NULL) { //TODO To be deprecated by using Slurm or else statement
mall->nodelist_len = strlen(nodelist);
} else { // If no nodelist is detected, get it from the actual run
mall->nodelist = malloc(MPI_MAX_PROCESSOR_NAME * sizeof(char));
MPI_Get_processor_name(mall->nodelist, &mall->nodelist_len);
//TODO Get name of each process and create real nodelist
}
zombies_service_init(); zombies_service_init();
return MALLEABILITY_NOT_CHILDREN; return MALLEABILITY_NOT_CHILDREN;
......
...@@ -90,7 +90,6 @@ int check_spawn_state(MPI_Comm *child, MPI_Comm comm, double *real_time) { ...@@ -90,7 +90,6 @@ int check_spawn_state(MPI_Comm *child, MPI_Comm comm, double *real_time) {
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);
//printf("Test 3.5 local=%d\n",local_state);
if(local_state == MALL_SPAWN_SINGLE_PENDING || local_state == MALL_SPAWN_SINGLE_COMPLETED) { // Single if(local_state == MALL_SPAWN_SINGLE_PENDING || local_state == MALL_SPAWN_SINGLE_COMPLETED) { // Single
global_state = check_single_state(comm, local_state); global_state = check_single_state(comm, local_state);
...@@ -221,8 +220,9 @@ void set_spawn_configuration(char *cmd, int num_cpus, int num_nodes, char *nodel ...@@ -221,8 +220,9 @@ void set_spawn_configuration(char *cmd, int num_cpus, int num_nodes, char *nodel
physical_struct_create(target_qty, spawn_data->already_created, num_cpus, num_nodes, nodelist, type_dist, MALL_DIST_STRING, &(spawn_data->dist)); physical_struct_create(target_qty, spawn_data->already_created, num_cpus, num_nodes, nodelist, type_dist, MALL_DIST_STRING, &(spawn_data->dist));
//COPY PROGRAM NAME //COPY PROGRAM NAME
spawn_data->cmd = malloc(strlen(cmd) * sizeof(char)); spawn_data->cmd = malloc((strlen(cmd)+1) * sizeof(char));
strcpy(spawn_data->cmd, cmd); strcpy(spawn_data->cmd, cmd);
spawn_data->cmd[strlen(cmd)]='\0';
} else { } else {
spawn_data->cmd = malloc(1 * sizeof(char)); spawn_data->cmd = malloc(1 * sizeof(char));
......
...@@ -213,16 +213,18 @@ void compact_dist(struct physical_dist dist, int *used_nodes, int *procs) { ...@@ -213,16 +213,18 @@ void compact_dist(struct physical_dist dist, int *used_nodes, int *procs) {
*/ */
void generate_info_string(int target_qty, MPI_Info *info){ void generate_info_string(int target_qty, MPI_Info *info){
char *host_string, *host; char *host_string, *host;
int len; int len, err;
host = malloc(MPI_MAX_PROCESSOR_NAME * sizeof(char)); host = "localhost";
MPI_Get_processor_name(host, &len); //host = malloc(MPI_MAX_PROCESSOR_NAME * sizeof(char));
//MPI_Get_processor_name(host, &len);
// CREATE AND SET STRING HOSTS // CREATE AND SET STRING HOSTS
write_str_node(&host_string, 0, target_qty, host); err = write_str_node(&host_string, 0, target_qty, host);
if (err<0) {printf("Error when generating mapping: %d\n", err); MPI_Abort(MPI_COMM_WORLD, err);}
// SET MAPPING // SET MAPPING
MPI_Info_create(info); MPI_Info_create(info);
MPI_Info_set(*info, "hosts", host_string); MPI_Info_set(*info, "hosts", host_string);
free(host); //free(host);
free(host_string); free(host_string);
} }
...@@ -275,19 +277,19 @@ int write_str_node(char **hostfile_str, size_t len_og, size_t qty, char *node_na ...@@ -275,19 +277,19 @@ int write_str_node(char **hostfile_str, size_t len_og, size_t qty, char *node_na
char *ocurrence; char *ocurrence;
size_t i, len, len_node; size_t i, len, len_node;
len_node = strlen(node_name); len_node = strlen(node_name) + 1; // Str length + ','
len = qty * (len_node + 1); len = qty * len_node; // Number of times the node is used
if(len_og == 0) { // Memoria no reservada if(len_og == 0) { // Memoria no reservada
*hostfile_str = (char *) malloc(len * sizeof(char) - sizeof(char)); *hostfile_str = (char *) malloc((len+1) * sizeof(char));
} else { // Cadena ya tiene datos } else { // Cadena ya tiene datos
*hostfile_str = (char *) realloc(*hostfile_str, (len_og + len) * sizeof(char) - sizeof(char)); *hostfile_str = (char *) realloc(*hostfile_str, (len_og + len + 1) * sizeof(char));
} }
if(hostfile_str == NULL) return -1; // No ha sido posible alojar la memoria if(hostfile_str == NULL) return -1; // No ha sido posible alojar la memoria
ocurrence = (char *) malloc((len_node+1) * sizeof(char)); ocurrence = (char *) malloc((len_node+1) * sizeof(char));
if(ocurrence == NULL) return -2; // No ha sido posible alojar la memoria if(ocurrence == NULL) return -2; // No ha sido posible alojar la memoria
err = sprintf(ocurrence, ",%s", node_name); err = snprintf(ocurrence, len_node+1, ",%s", node_name);
if(err < 0) return -3; // No ha sido posible escribir sobre la variable auxiliar if(err < 0) return -3; // No ha sido posible escribir sobre la variable auxiliar
i=0; i=0;
......
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