Commit 7ea5eebb authored by iker_martin's avatar iker_martin
Browse files

Fixed minow bug inside malleability codes. Types were not correctly recognised

parent e4e11cf5
......@@ -50,7 +50,7 @@ void get_rows_dist(Compute_data *computeData, int numP, int n);
void mat_alloc(Compute_data *computeData, SparseMatrix mat, struct Dist_data dist_data);
void computeSolution(Compute_data computeData, double **subsol, SparseMatrix mat, int myId, double **full_vec);
void pre_compute(Compute_data *computeData, struct Dist_data dist_data, double *subsol, double *full_vec);
int compute(Compute_data *computeData, struct Dist_data *dist_data);
int compute(Compute_data *computeData, struct Dist_data *dist_data, int sm);
void free_computeData(Compute_data *computeData);
//===================================MALLEABILITY FUNCTIONS====================================================
......@@ -73,6 +73,7 @@ void getIds_intercomm(struct Dist_data dist_data, int numP_other, int **idS);
int main (int argc, char *argv[]) {
int terminate;
int req, num_nodes, num_cpus = 20;
int sm, ss, rm, rs;
char *nodelist = NULL;
Compute_data computeData;
......@@ -83,6 +84,9 @@ int main (int argc, char *argv[]) {
computeData.subm.vptr = NULL;
computeData.vlen = NULL;
//FIXME Cambiar
sm = 1; ss = 1; rm = 0; rs = 1;
int numP, myId, num_children = 0;
struct Dist_data dist_data;
if (argc >= 5) {
......@@ -105,14 +109,14 @@ int main (int argc, char *argv[]) {
if( !new_group ) { //First set of processes
init_app(&computeData, &dist_data, argv);
dist_old(&dist_data, &computeData, num_children, 0, 1, 0, 1);
dist_old(&dist_data, &computeData, num_children, sm, ss, rm, rs);
} else {
dist_new(&dist_data, &computeData);
}
if ( computeData.iter == 0 ) {
terminate = compute(&computeData, &dist_data);
terminate = compute(&computeData, &dist_data, sm);
}
terminate = 1;
if(myId == ROOT && terminate) {
......@@ -385,10 +389,10 @@ void pre_compute(Compute_data *computeData, struct Dist_data dist_data, double *
/*
* Bucle de computo principal
*/
int compute(Compute_data *computeData, struct Dist_data *dist_data) {
int compute(Compute_data *computeData, struct Dist_data *dist_data, int sm) {
int IZERO = 0, IONE = 1;
double DONE = 1.0, DMONE = -1.0, DZERO = 0.0;
int state = MALL_NOT_STARTED;
int ended_loop = 1;
int cnt = 0;
......@@ -396,7 +400,9 @@ int compute(Compute_data *computeData, struct Dist_data *dist_data) {
while ((computeData->iter < computeData->maxiter) && (computeData->tol > computeData->umbral)) {
//while (computeData->tol > computeData->umbral) {
if (computeData->iter == 3) { malleability_checkpoint(); }
if (computeData->iter == 3) { state = malleability_checkpoint(); }
if (dist_data->myId == 0) {printf("TEST %d\n", computeData->iter);}
if ((state == MALL_COMPLETED && sm == 0) || state == MALL_ZOMBIE) {break;}
// if(dist_data->myId == ROOT) printf ("(%d,%20.10e)\n", computeData->iter, computeData->tol);
......
......@@ -83,6 +83,7 @@ void modify_data(void *data, size_t index, size_t total_qty, int type, size_t re
void comm_data_info(malleability_data_t *data_struct_rep, malleability_data_t *data_struct_dist, int is_children_group, int myId, int root, MPI_Comm intercomm) {
int is_intercomm, rootBcast = MPI_PROC_NULL;
size_t i, j;
datatype;
MPI_Datatype entries_type, struct_type;
......@@ -107,7 +108,15 @@ void comm_data_info(malleability_data_t *data_struct_rep, malleability_data_t *d
if(is_children_group) {
for(i=0; i < data_struct_rep->entries; i++) {
data_struct_rep->arrays[i] = (void *) malloc(data_struct_rep->qty[i] * sizeof(int)); //TODO Tener en cuenta que no siempre es int
if(data_struct_rep->types[i] == MAL_INT) {
data_struct_rep->arrays[i] = (void *) malloc(data_struct_rep->qty[i] * sizeof(int));
} else if(data_struct_rep->types[i] == MAL_DOUBLE) {
data_struct_rep->arrays[i] = (void *) malloc(data_struct_rep->qty[i] * sizeof(double));
} else {
printf("Malleability -- Redistribution data array type not recognised\n");
MPI_Abort(MPI_COMM_WORLD, -1);
}
data_struct_rep->requests[i] = (MPI_Request *) malloc(data_struct_rep->request_qty[i] * sizeof(MPI_Request));
for(j=0; j < data_struct_rep->request_qty[i]; j++) {
data_struct_rep->requests[i][j] = MPI_REQUEST_NULL;
......
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