static void select_callback(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { switch(cell_index->row) { case 0: standard_run(0); break; case 1: standard_run(1); break; case 2: standard_run(2); break; case 3: standard_run(3); break; case 4: standard_run(4); break; case 5: standard_run(5); break; case 6: standard_run(6); break; case 7: standard_run(7); break; case 8: standard_run(8); break; default: break; } }
int main ( int argc, char *argv[] ) { const int verbose = 0; // set to 1 for more info int myid,numprocs,precision,fail,ns; char* filename; adainit(); MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&numprocs); MPI_Comm_rank(MPI_COMM_WORLD,&myid); if(verbose > 0) { printf("\nHello from process %d!\n", myid); MPI_Barrier(MPI_COMM_WORLD); } if(myid == 0) precision = prompt_for_precision(); MPI_Bcast(&precision,1,MPI_INT,0,MPI_COMM_WORLD); if(verbose > 0) printf("\nProcess %d has %d as precision.\n", myid, precision); MPI_Barrier(MPI_COMM_WORLD); filename = (char*)calloc(80,sizeof(char)); if(myid == 0) { char nl; printf("\nReading the name of the output file ..."); printf("\nGive a string of characters : "); scanf("%s",filename); scanf("%c",&nl); /* skip newline symbol for next reading ...*/ if(verbose > 0) printf("\nThe output file is \"%s\".\n", filename); ns = strlen(filename); fail = define_output_file_with_string(ns,filename); } MPI_Bcast(&ns,1,MPI_INT,0,MPI_COMM_WORLD); MPI_Bcast(filename,ns,MPI_CHAR,0,MPI_COMM_WORLD); if(verbose > 0) printf("\nNode %d has filename \"%s\".\n", myid, filename); MPI_Barrier(MPI_COMM_WORLD); switch(precision) { case 0: fail = standard_run(myid,numprocs,ns,filename,verbose); break; case 1: fail = dobldobl_run(myid,numprocs,ns,filename,verbose); break; case 2: fail = quaddobl_run(myid,numprocs,ns,filename,verbose); break; default: printf("Invalid choice of precision.\n"); } MPI_Finalize(); adafinal(); return 0; }