Skip to content
Snippets Groups Projects
Commit 539002ae authored by Gregor Weiss's avatar Gregor Weiss
Browse files

ENH: optional removal

parent 6bb10f0f
Branches
Tags v2012
No related merge requests found
...@@ -54,12 +54,29 @@ Settings::Settings(int argc, char *argv[], int rank, int nproc) : rank{rank} ...@@ -54,12 +54,29 @@ Settings::Settings(int argc, char *argv[], int rank, int nproc) : rank{rank}
steps = convertToUint("steps", argv[8]); steps = convertToUint("steps", argv[8]);
iterations = convertToUint("iterations", argv[9]); iterations = convertToUint("iterations", argv[9]);
if ( argc == 11 ) { if ( argc >= 11 ) {
if ( std::string(argv[10]) == std::string("read") ) { if ( std::string(argv[10]) == std::string("read") ) {
read = true; read = true;
} }
if ( std::string(argv[10]) == std::string("remove") ) {
remove = true;
}
} }
if ( argc >= 12 ) {
if ( std::string(argv[10]) == std::string("read")
||
std::string(argv[11]) == std::string("read")) {
read = true;
}
if ( std::string(argv[10]) == std::string("remove")
||
std::string(argv[11]) == std::string("remove")) {
remove = true;
}
}
if (npx * npy != this->nproc) if (npx * npy != this->nproc)
{ {
throw std::invalid_argument("N*M must equal the number of processes"); throw std::invalid_argument("N*M must equal the number of processes");
......
...@@ -25,7 +25,8 @@ struct Settings ...@@ -25,7 +25,8 @@ struct Settings
unsigned int ndy; // Local array size in y dimension per process unsigned int ndy; // Local array size in y dimension per process
unsigned int steps; // Number of output steps unsigned int steps; // Number of output steps
unsigned int iterations; // Number of computing iterations between steps unsigned int iterations; // Number of computing iterations between steps
bool read{ false }; // Number of computing iterations between steps bool read{ false }; // Switch to turn on re-reading
bool remove{ false }; // Switch to turn on removal
// calculated values from those arguments and number of processes // calculated values from those arguments and number of processes
unsigned int gndx; // Global array size in slow dimension unsigned int gndx; // Global array size in slow dimension
......
...@@ -153,17 +153,19 @@ int main( int argc, char* argv[] ) { ...@@ -153,17 +153,19 @@ int main( int argc, char* argv[] ) {
} }
} }
MPI_Barrier(MPI_COMM_WORLD); if ( settings.remove ) {
measTime = MPI_Wtime(); MPI_Barrier(MPI_COMM_WORLD);
measTime = MPI_Wtime();
io.remove( t ); io.remove( t );
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
measTime = MPI_Wtime() - measTime; measTime = MPI_Wtime() - measTime;
MPI_Reduce( &measTime, &maxTime, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); MPI_Reduce( &measTime, &maxTime, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
if ( rank == 0 ) { if ( rank == 0 ) {
printTime( "Removing step " + std::to_string( t ), maxTime ); printTime( "Removing step " + std::to_string( t ), maxTime );
}
} }
} }
......
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