# include # include using namespace std; # include "mpi_stubs.H" namespace MPI { // Define global COMM_WORLD communicator. Should be initialized in Init Comm COMM_WORLD; //****************************************************************************80 void Finalize ( ) //****************************************************************************80 // // Purpose: // // MPI::FINALIZE shuts down the MPI library. // // Modified: // // 02 November 2007 // // Author: // // John Burkardt // // Reference: // // William Gropp, Ewing Lusk, Anthony Skjellum, // Using MPI: // Portable Parallel Programming with the Message-Passing Interface, // Second Edition, // MIT Press, 1999, // ISBN: 0262571323, // LC: QA76.642.G76. // // Parameters: // // None // { return; } //****************************************************************************80 void Init ( int &argc, char **&argv ) //****************************************************************************80 // // Purpose: // // MPI::INIT initializes the MPI library. // // Modified: // // 02 November 2007 // // Author: // // John Burkardt // // Reference: // // William Gropp, Ewing Lusk, Anthony Skjellum, // Using MPI: // Portable Parallel Programming with the Message-Passing Interface, // Second Edition, // MIT Press, 1999, // ISBN: 0262571323, // LC: QA76.642.G76. // // Parameters: // // Input, int &ARGC, a reference to the program's ARGC parameter. // // Input, char **&ARGV, a reference to the program's ARGV parameter. // { return; } //****************************************************************************80 void Init ( ) //****************************************************************************80 // // Purpose: // // MPI::INIT initializes the MPI library. // // Modified: // // 02 November 2007 // // Author: // // John Burkardt // // Reference: // // William Gropp, Ewing Lusk, Anthony Skjellum, // Using MPI: // Portable Parallel Programming with the Message-Passing Interface, // Second Edition, // MIT Press, 1999, // ISBN: 0262571323, // LC: QA76.642.G76. // // Parameters: // // None // { return; } //****************************************************************************80 double Wtick ( ) //****************************************************************************80 // // Purpose: // // MPI::WTICK returns the number of seconds in one tick of the timer. // // Discussion; // // This "stub" version always returns the value 1.0. // // Modified: // // 02 November 2007 // // Author: // // John Burkardt // // Reference: // // William Gropp, Ewing Lusk, Anthony Skjellum, // Using MPI: // Portable Parallel Programming with the Message-Passing Interface, // Second Edition, // MIT Press, 1999, // ISBN: 0262571323, // LC: QA76.642.G76. // // Parameters: // // Output, double WTICK, the number of seconds in one tick of the timer. // { static const double ticks = 1.0; return ticks; } //****************************************************************************80 double Wtime ( ) //****************************************************************************80 // // Purpose: // // MPI::WTIME returns the current wallclock time in seconds. // // Discussion: // // This "stub" version always returns a value that is 1.0 greater // than the value it returned on the previous call. // // Modified: // // 02 November 2007 // // Author: // // John Burkardt // // Reference: // // William Gropp, Ewing Lusk, Anthony Skjellum, // Using MPI: // Portable Parallel Programming with the Message-Passing Interface, // Second Edition, // MIT Press, 1999, // ISBN: 0262571323, // LC: QA76.642.G76. // // Parameters: // // Output, double WTIME, the current wallclock time in seconds. // { static double time = 0.0; time = time + 1.0; return time; } //****************************************************************************80 int Comm::Get_size ( ) const //****************************************************************************80 // // Purpose: // // MPI::COMM::GET_SIZE reports the number of processes in a communicator. // // Discussion: // // This "stub" version always returns a value of 1. // // Modified: // // 02 November 2007 // // Author: // // John Burkardt // // Reference: // // William Gropp, Ewing Lusk, Anthony Skjellum, // Using MPI: // Portable Parallel Programming with the Message-Passing Interface, // Second Edition, // MIT Press, 1999, // ISBN: 0262571323, // LC: QA76.642.G76. // // Parameters: // // Output, int GET_SIZE, the number of processors. // { return 1; } //****************************************************************************80 int Comm::Get_rank ( ) const //****************************************************************************80 // // Purpose: // // MPI::COMM::GET_RANK reports the rank of the calling process. // // Discussion: // // This "stub" version always returns the value 0. // // Modified: // // 02 November 2007 // // Author: // // John Burkardt // // Reference: // // William Gropp, Ewing Lusk, Anthony Skjellum, // Using MPI: // Portable Parallel Programming with the Message-Passing Interface, // Second Edition, // MIT Press, 1999, // ISBN: 0262571323, // LC: QA76.642.G76. // // Parameters: // // Output, int GET_RANK, the rank of the process. // { return 0; } } // // END OF NAMESPACE MPI // //****************************************************************************80 void timestamp ( ) //****************************************************************************80 // // Purpose: // // TIMESTAMP prints the current YMDHMS date as a time stamp. // // Example: // // 31 May 2001 09:45:54 AM // // Modified: // // 24 September 2003 // // Author: // // John Burkardt // // Parameters: // // None // { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct tm *tm; size_t len; time_t now; now = time ( NULL ); tm = localtime ( &now ); len = strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm ); cout << time_buffer << "\n"; return; # undef TIME_SIZE }