diff --git a/cpp/base.hpp b/cpp/base.hpp index 4604426c855e1f18f7f0dcaf88e7fc58d6e1c8a2..4bbaa48631249914058d3b8bc869684b24600924 100644 --- a/cpp/base.hpp +++ b/cpp/base.hpp @@ -145,7 +145,7 @@ inline void DEBUG_MSG(const char * format, ...) va_start(argptr, format); sprintf( debug_message_buffer, - "cpu%.4d ", + "MPIrank%.4d ", myrank); vsnprintf( debug_message_buffer + 8, @@ -162,7 +162,7 @@ inline void DEBUG_MSG_WAIT(MPI_Comm communicator, const char * format, ...) va_start(argptr, format); sprintf( debug_message_buffer, - "cpu%.4d ", + "MPIrank%.4d ", myrank); vsnprintf( debug_message_buffer + 8, diff --git a/cpp/fftw_interface.hpp b/cpp/fftw_interface.hpp index fd88ed4aff49285ff907a2f5ddcd01af42d42612..8528aba39dbe56855181ae26be9fc1b984171aa5 100644 --- a/cpp/fftw_interface.hpp +++ b/cpp/fftw_interface.hpp @@ -94,8 +94,18 @@ public: }; using many_plan = many_plan_container; + + static char* sprint(const many_plan mp) + { + return fftwf_sprint_plan(mp.plan_to_use); + } #else using many_plan = fftwf_plan; + + static char* sprint(many_plan mp) + { + return fftwf_sprint_plan(mp); + } #endif static complex* alloc_complex(const size_t in_size){ @@ -451,8 +461,18 @@ public: }; using many_plan = many_plan_container; + + static char* sprint(const many_plan mp) + { + return fftw_sprint_plan(mp.plan_to_use); + } #else using many_plan = fftw_plan; + + static char* sprint(const many_plan mp) + { + return fftw_sprint_plan(mp); + } #endif static complex* alloc_complex(const size_t in_size){ diff --git a/cpp/field.cpp b/cpp/field.cpp index 1b3cb6e35146be59f0a1ead4843b6fe9548be0c7..875bc4b326f2e23334ec3513ea9bdd7f7b9e1f2b 100644 --- a/cpp/field.cpp +++ b/cpp/field.cpp @@ -103,6 +103,7 @@ field<rnumber, be, fc>::field( this->data = fftw_interface<rnumber>::alloc_real( this->rmemlayout->local_size); memset(this->data, 0, sizeof(rnumber)*this->rmemlayout->local_size); + char *plan_information = NULL; this->c2r_plan = fftw_interface<rnumber>::mpi_plan_many_dft_c2r( 3, nfftw, ncomp(fc), FFTW_MPI_DEFAULT_BLOCK, FFTW_MPI_DEFAULT_BLOCK, @@ -110,6 +111,9 @@ field<rnumber, be, fc>::field( this->data, this->comm, this->fftw_plan_rigor | FFTW_MPI_TRANSPOSED_IN); + plan_information = fftw_interface<rnumber>::sprint(this->c2r_plan); + DEBUG_MSG("field::field c2r plan representation is\n\%s\n", plan_information); + free(plan_information); this->r2c_plan = fftw_interface<rnumber>::mpi_plan_many_dft_r2c( 3, nfftw, ncomp(fc), FFTW_MPI_DEFAULT_BLOCK, FFTW_MPI_DEFAULT_BLOCK, @@ -117,6 +121,9 @@ field<rnumber, be, fc>::field( (typename fftw_interface<rnumber>::complex*)this->data, this->comm, this->fftw_plan_rigor | FFTW_MPI_TRANSPOSED_OUT); + plan_information = fftw_interface<rnumber>::sprint(this->r2c_plan); + DEBUG_MSG("field::field r2c plan representation is\n\%s\n", plan_information); + free(plan_information); break; } } diff --git a/cpp/field.hpp b/cpp/field.hpp index 15b298be48556b7c2ff2747ad5771ffddd99d7de..427d091ebb3570c876d85dce1aa390b930bf1bde 100644 --- a/cpp/field.hpp +++ b/cpp/field.hpp @@ -334,6 +334,36 @@ class field in_global_y - this->rlayout->starts[1], in_global_z - this->rlayout->starts[0]); } + + int print_plan(const std::string preamble) + { + char *c2r_plan_information = fftw_interface<rnumber>::sprint(this->c2r_plan); + char *r2c_plan_information = fftw_interface<rnumber>::sprint(this->r2c_plan); + if (this->myrank == 0) + { + std::cout << preamble << + std::endl << + "----c2r plan is:\n" << + c2r_plan_information << + std::endl << + "----r2c plan is:\n" << + r2c_plan_information << + std::endl; + } + std::string err_message = ( + std::string("MPI rank ") + + preamble + + std::to_string(this->myrank) + + std::string("\n----c2r plan is:\n") + + std::string(c2r_plan_information) + + std::string("\n----r2c plan is:\n") + + std::string(r2c_plan_information) + + std::string("\n")); + std::cerr << err_message; + free(c2r_plan_information); + free(r2c_plan_information); + return EXIT_SUCCESS; + } }; /** \brief Compute gradient of a field diff --git a/cpp/vorticity_equation.cpp b/cpp/vorticity_equation.cpp index 5372660ea790dc957b99e7ad5c33d522bf7f65be..e6c500b90277f2d586bf92ef5aa3c645f2949c3b 100644 --- a/cpp/vorticity_equation.cpp +++ b/cpp/vorticity_equation.cpp @@ -143,6 +143,10 @@ vorticity_equation<rnumber, be>::vorticity_equation( nx, ny, nz, MPI_COMM_WORLD, FFTW_PLAN_RIGOR); this->u = this->cvelocity; + /* print fftw plan information for relevant fields */ + this->rvorticity->print_plan("rvorticity"); + this->cvelocity->print_plan("cvelocity"); + /* initialize kspace */ this->kk = new kspace<be, SMOOTH>( this->cvorticity->clayout, DKX, DKY, DKZ);