int main(){ int rank, nprocs; mpi_initialize(rank, nprocs); mpi_print_name(rank); const char *rows[6] = {"1e3", "1e4", "1e5", "1e6", "1e7", "1e8"}; int nlist[6] = {1000, 1000*10, 1000*100, 1000*1000, 1000*1000*10, 1000*1000*100}; const char* cols[2] = {"cycles", "b/w"}; double data[12]; for(int i=0; i < 6; i++){ data[i] = time(rank, nprocs, nlist[i]); data[i+6] = 32.0*nlist[i]/data[i]; } if(rank == 0){//output table char fname[200]; verify_dir("DBG"); sprintf(fname, "DBG/time_cycle_NP%d.txt", nprocs); link_cout(fname); Table tbl; tbl.dim(6, 2); tbl.rows(rows); tbl.cols(cols); tbl.data(data); tbl.print(); unlink_cout(); } mpi_finalize(); }
int main(){ int rank; int nprocs; mpi_initialize(rank, nprocs); generate_output(rank, nprocs); mpi_finalize(); }
int main( int argc, char** argv ) { int rank, size; // we read with one MPI process Dims mpi_topology(1, 1, 1); MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); if (size > 1) { std::cerr << "Only 1 MPI process supported" << std::endl; mpi_finalize(); return 1; } // read command line options ProgramOptions options; bool parseSuccessfull = false; std::ostream *outStream = &std::cout; options.outputFile = ""; options.step = 0; try { parseSuccessfull = parseOptions( argc, argv, options ); } catch ( const std::runtime_error& e ) { errorStream << "Error: " << e.what( ) << std::endl; mpi_finalize(); return 1; } if ( !parseSuccessfull ) { mpi_finalize(); return 1; } ITools *tools = nullptr; switch ( options.fileMode) { case FM_SPLASH: tools = new ToolsSplashParallel( options, mpi_topology, *outStream ); break; #if (ENABLE_ADIOS==1) case FM_ADIOS: tools = new ToolsAdiosParallel( options, mpi_topology, *outStream ); break; #endif } try { std::ofstream file; if ( options.toFile ) { file.open( options.outputFile.c_str( ) ); if ( !file.is_open( ) ) throw std::runtime_error( "Failed to open output file for writing." ); outStream = &file; } // apply requested command to file if ( options.listDatasets ) tools->listAvailableDatasets( ); else tools->convertToText( ); if ( options.toFile ) { file.close( ); } } catch ( const std::runtime_error& e ) { errorStream << "Error: " << e.what( ) << std::endl; delete tools; mpi_finalize(); return 1; } // cleanup delete tools; mpi_finalize(); return 0; }
void python_mpi_finalize(){ mpi_finalize(); }
void finalized(){ mpi_finalize(); }