int MPI_Finalize(void) { DBGPRINT3("Entering Old MPI_Finalize at base level - Location = %px",&(MPI_Finalize)); if (NOT_ACTIVATED(MPI_Finalize_MAJOR,MPI_Finalize_MINOR)) return PMPI_Finalize(); else { int err=Internal_XMPI_Finalize(); PMPI_Finalize(); return err; } }
int MPI_Finalize( void ) { int i,j; PMPI_Gather( my_send_count, proc_num, MPI_INT, send_count, proc_num, MPI_INT, 0, MPI_COMM_WORLD ); PMPI_Gather( my_send_size, proc_num, MPI_INT, send_size, proc_num, MPI_INT, 0, MPI_COMM_WORLD ); FILE *fp; if(my_rank == 0){ fp = fopen("matrix.data", "w"); for(i = 0; i < proc_num; i++){ for(j = 0; j < proc_num; j++){ if(j != i && send_count[i*proc_num+j] != 0) //fprintf(fp, "%d %d %d %d\n", i, j, send_count[i * proc_num + j], send_size[i * proc_num + j]); fprintf(fp, "%d %d %d %lf\n", i, j, send_count[i * proc_num + j], (double)(send_size[i * proc_num + j])/send_count[i * proc_num + j]); } } fclose(fp); } PMPI_Finalize(); }
int MPI_Finalize() { PMPI_Barrier(MPI_COMM_WORLD); EPLIB_finalize(); PMPI_Barrier(MPI_COMM_WORLD); return PMPI_Finalize(); }
int MPI_Finalize(void) { int result, MPIT_result; uint64_t * exchange_count_matrix = NULL; uint64_t * exchange_size_matrix = NULL; uint64_t * exchange_avg_size_matrix = NULL; if (0 == comm_world_rank) { exchange_count_matrix = (uint64_t *) malloc(comm_world_size * comm_world_size * sizeof(uint64_t)); exchange_size_matrix = (uint64_t *) malloc(comm_world_size * comm_world_size * sizeof(uint64_t)); exchange_avg_size_matrix = (uint64_t *) malloc(comm_world_size * comm_world_size * sizeof(uint64_t)); } stop_monitoring_result(&counts); stop_monitoring_result(&sizes); get_monitoring_result(&counts); get_monitoring_result(&sizes); PMPI_Gather(counts.vector, comm_world_size, MPI_UNSIGNED_LONG, exchange_count_matrix, comm_world_size, MPI_UNSIGNED_LONG, 0, MPI_COMM_WORLD); PMPI_Gather(sizes.vector, comm_world_size, MPI_UNSIGNED_LONG, exchange_size_matrix, comm_world_size, MPI_UNSIGNED_LONG, 0, MPI_COMM_WORLD); if (0 == comm_world_rank) { int i, j; //Get the same matrix than profile2mat.pl for (i = 0; i < comm_world_size; ++i) { for (j = i + 1; j < comm_world_size; ++j) { exchange_count_matrix[i * comm_world_size + j] = exchange_count_matrix[j * comm_world_size + i] = (exchange_count_matrix[i * comm_world_size + j] + exchange_count_matrix[j * comm_world_size + i]) / 2; exchange_size_matrix[i * comm_world_size + j] = exchange_size_matrix[j * comm_world_size + i] = (exchange_size_matrix[i * comm_world_size + j] + exchange_size_matrix[j * comm_world_size + i]) / 2; if (exchange_count_matrix[i * comm_world_size + j] != 0) exchange_avg_size_matrix[i * comm_world_size + j] = exchange_avg_size_matrix[j * comm_world_size + i] = exchange_size_matrix[i * comm_world_size + j] / exchange_count_matrix[i * comm_world_size + j]; } } write_mat("monitoring_msg.mat", exchange_count_matrix, comm_world_size); write_mat("monitoring_size.mat", exchange_size_matrix, comm_world_size); write_mat("monitoring_avg.mat", exchange_avg_size_matrix, comm_world_size); } free(exchange_count_matrix); free(exchange_size_matrix); free(exchange_avg_size_matrix); destroy_monitoring_result(&counts); destroy_monitoring_result(&sizes); MPIT_result = MPI_T_pvar_session_free(&session); if (MPIT_result != MPI_SUCCESS) { fprintf(stderr, "WARNING : failed to free MPI_T session, monitoring results may be impacted : check your OpenMPI installation\n"); } MPIT_result = MPI_T_finalize(); if (MPIT_result != MPI_SUCCESS) { fprintf(stderr, "WARNING : failed to finalize MPI_T interface, monitoring results may be impacted : check your OpenMPI installation\n"); } result = PMPI_Finalize(); return result; }
int MPI_Finalize (void) { _MPI_COVERAGE(); return PMPI_Finalize(); /* #ifdef _MPI_DEBUG if (x == _MPI_NOT_OK) printf ("\n>>>>ERROR MPI_Finalize\n"); else printf(">>MPI_Finalize was called.\n"); #endif */ }
static int _MPI_Finalize () { int rc = 0; mpiPi_finalize (); mpiPi.enabled = 0; mpiPi_msg_debug ("calling PMPI_Finalize\n"); rc = PMPI_Finalize (); mpiPi_msg_debug ("returning from PMPI_Finalize\n"); return rc; }
void ipm_sig_handler(int sig) { int isinit; IPMDBG("In ipm_sig_handler() sig=%d\n", sig); if(sig == SIGTERM || sig == SIGXCPU || sig==SIGABRT) { ipm_finalize(0); #if defined(HAVE_MPI) && defined(DELAYED_MPI_FINALIZE) isinit=0; PMPI_Initialized(&isinit); if( isinit ) PMPI_Finalize(); #endif } }
int smpi_replay_finalize(){ double sim_time= 1.; /* One active process will stop. Decrease the counter*/ active_processes--; if(!active_processes){ /* Last process alive speaking */ /* end the simulated timer */ sim_time = smpi_process_simulated_elapsed(); XBT_INFO("Simulation time %g", sim_time); _xbt_replay_action_exit(); } return PMPI_Finalize(); }
void ipm_atexit_handler() { int isinit; IPMDBG("in ipm_atexit_handler()\n"); ipm_finalize(0); IPMDBG("after ipm_finalize()\n"); #if defined(HAVE_MPI) && defined(DELAYED_MPI_FINALIZE) isinit=0; PMPI_Initialized(&isinit); if( isinit ) PMPI_Finalize(); #endif }
int main(int argc, char *argv[]) { int numproc, rank, len; char hostname[MPI_MAX_PROCESSOR_NAME]; PMPI_Init(&argc, &argv); PMPI_Comm_size(MPI_COMM_WORLD, &numproc); PMPI_Comm_rank(MPI_COMM_WORLD, &rank); PMPI_Get_processor_name(hostname, &len); if (rank==0) { int *freq,i,j; freq=(int *)malloc(sizeof(int)*numproc); char *temp; temp=(char*)malloc(sizeof(char)*(numproc-1)); MPI_Status *stat, *stat1; stat = (MPI_Status*)malloc(sizeof(MPI_Status)*(numproc-1)); stat1 = (MPI_Status*)malloc(sizeof(MPI_Status)*(numproc-1)); MPI_Request *req; req = (MPI_Request *)malloc(sizeof(MPI_Request)*(numproc-1)); int N=numproc*numproc; for(i=1; i<numproc; i++) { PMPI_Recv(temp+i-1, 1, MPI_CHAR, i, 0, MPI_COMM_WORLD, stat+(i-1));//, req+(i-1)*2); } for(i=1; i<numproc; i++) { PMPI_Recv(freq+i*numproc, numproc, MPI_INT, i, 1, MPI_COMM_WORLD, stat1+(i-1)); } printf("echo\n"); // MPI_Waitall((numproc-1), req, stat); for (i=1; i<numproc; i++) { printf("Rank %d ", i); for (j=0; j<numproc; j++) { if(j!=i) { int loc = i*numproc+j; printf("%d ",freq[loc]); } } printf("\n"); } } else { int i, *nsend; char *rMsg, msg='x'; rMsg=(char*)malloc(sizeof(char)); nsend=(int*)malloc(sizeof(int)*numproc); // msg=(char*)malloc(sizeof(char)); // memset(msg, 'z', sizeof(char)); memset(nsend, 0, sizeof(int)*numproc); MPI_Request *req; req = (MPI_Request *)malloc(sizeof(MPI_Request)*(numproc)); MPI_Status *stat; stat = (MPI_Status*)malloc(sizeof(MPI_Status)*(numproc-1)); for (i=0; i<numproc; i++) { if(i!=rank) { *(nsend+i)+=*(nsend+i)+1; PMPI_Isend(&msg, 1, MPI_CHAR, i, 0, MPI_COMM_WORLD, &(req[i])); } } // printf("Echo-1\n"); for (i=1; i<numproc; i++) { if (i!=rank) PMPI_Recv(rMsg, 1, MPI_CHAR, i, 0, MPI_COMM_WORLD, stat+i-1); } // printf("Echo-2\n"); MPI_Isend(nsend, numproc, MPI_INT, 0, 1, MPI_COMM_WORLD, req+numproc); // MPI_Isend(msg, 1, MPI_CHAR, i, 0, MPI_COMM_WORLD, req+numproc); // printf("Echo-3\n"); } PMPI_Finalize(); return(0); }
void ompi_finalize_f(MPI_Fint *ierr) { int c_ierr = PMPI_Finalize(); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); }
int MPI_Finalize(void) { MPE_Finish_log("log.dat"); return PMPI_Finalize(); };
int main(int argc, char **argv) { int *buf, i, rank, nints, len; char *filename, *tmp; int errs=0, toterrs; MPI_File fh; MPI_Status status; PMPI_Init(&argc,&argv); PMPI_Comm_rank(MPI_COMM_WORLD, &rank); /* process 0 takes the file name as a command-line argument and broadcasts it to other processes */ if (!rank) { i = 1; while ((i < argc) && strcmp("-fname", *argv)) { i++; argv++; } if (i >= argc) { fprintf(stderr, "\n*# Usage: simple -fname filename\n\n"); PMPI_Abort(MPI_COMM_WORLD, 1); } argv++; len = strlen(*argv); filename = (char *) malloc(len+10); strcpy(filename, *argv); PMPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); PMPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); } else { PMPI_Bcast(&len, 1, MPI_INT, 0, MPI_COMM_WORLD); filename = (char *) malloc(len+10); PMPI_Bcast(filename, len+10, MPI_CHAR, 0, MPI_COMM_WORLD); } buf = (int *) malloc(SIZE); nints = SIZE/sizeof(int); for (i=0; i<nints; i++) buf[i] = rank*100000 + i; /* each process opens a separate file called filename.'myrank' */ tmp = (char *) malloc(len+10); strcpy(tmp, filename); sprintf(filename, "%s.%d", tmp, rank); PMPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); PMPI_File_write(fh, buf, nints, MPI_INT, &status); PMPI_File_close(&fh); /* reopen the file and read the data back */ for (i=0; i<nints; i++) buf[i] = 0; PMPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, MPI_INFO_NULL, &fh); PMPI_File_read(fh, buf, nints, MPI_INT, &status); PMPI_File_close(&fh); /* check if the data read is correct */ for (i=0; i<nints; i++) { if (buf[i] != (rank*100000 + i)) { errs++; fprintf(stderr, "Process %d: error, read %d, should be %d\n", rank, buf[i], rank*100000+i); } } MPI_Allreduce( &errs, &toterrs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD ); if (rank == 0) { if( toterrs > 0) { fprintf( stderr, "Found %d errors\n", toterrs ); } else { fprintf( stdout, " No Errors\n" ); } } free(buf); free(filename); free(tmp); PMPI_Finalize(); return 0; }
int MPI_Finalize(void) { rq_end( requests_avail_1 ); return PMPI_Finalize(); }
int MPI_Finalize(void) { return PMPI_Finalize(); }