diff --git a/src/RMHD_converter.cpp b/src/RMHD_converter.cpp index 0b1a6378654a703621717a215e8b5d26f2c01537..ca8b9566ade160fedc04125338dd1c9cebb5eb5b 100644 --- a/src/RMHD_converter.cpp +++ b/src/RMHD_converter.cpp @@ -1,5 +1,6 @@ #include "RMHD_converter.hpp" #include <string> +#include <iostream> extern int myrank, nprocs; @@ -52,6 +53,7 @@ RMHD_converter::RMHD_converter( } int n[7]; + proc_print_err_message("aloha 00"); // first 3 arguments are dimensions for input array // i.e. actual dimensions for the Fourier representation. // NOT real space grid dimensions @@ -62,6 +64,7 @@ RMHD_converter::RMHD_converter( n[1] = n2; this->f0c = new field_descriptor(2, n, MPI_COMPLEX8, MPI_COMM_WORLD); + proc_print_err_message("aloha 01"); // f1c will be pointing at the input array after it has been // transposed in 2D, therefore we have this correspondence: // f0c->sizes[0] = f1c->sizes[1]*f1c->sizes[2] @@ -70,18 +73,21 @@ RMHD_converter::RMHD_converter( n[2] = n1; this->f1c = new field_descriptor(3, n, MPI_COMPLEX8, MPI_COMM_WORLD); + proc_print_err_message("aloha 02"); // the description for the fully transposed field n[0] = n2; n[1] = n1; n[2] = n0; this->f2c = new field_descriptor(3, n, MPI_COMPLEX8, MPI_COMM_WORLD); + proc_print_err_message("aloha 03"); // following 3 arguments are dimensions for real space grid dimensions // f3r and f3c will be allocated in this call fftwf_get_descriptors_3D( N0, N1, N2, &this->f3r, &this->f3c); + proc_print_err_message("aloha 04"); //allocate fields this->c0 = fftwf_alloc_complex(this->f0c->local_size); this->c12 = fftwf_alloc_complex(this->f1c->local_size); @@ -89,6 +95,7 @@ RMHD_converter::RMHD_converter( // 4 instead of 2, because we have 2 fields to write this->r3 = fftwf_alloc_real( 4*this->f3c->local_size); + proc_print_err_message("aloha 05"); // allocate plans this->complex2real0 = fftwf_mpi_plan_dft_c2r_3d( f3r->sizes[0], f3r->sizes[1], f3r->sizes[2], @@ -101,20 +108,24 @@ RMHD_converter::RMHD_converter( MPI_COMM_WORLD, FFTW_PATIENT); + proc_print_err_message("aloha 06"); // various descriptions for the real data n[0] = N0*2; n[1] = N1; n[2] = N2; this->f4r = new field_descriptor(3, n, MPI_REAL4, MPI_COMM_WORLD); + proc_print_err_message("aloha 07"); n[0] = N0/8; n[1] = N1/8; n[2] = N2/8; n[3] = 8*8*8*2; this->drcubbie = new field_descriptor(4, n, MPI_REAL4, MPI_COMM_WORLD); + proc_print_err_message("aloha 08"); n[0] = (N0/8) * (N1/8) * (N2/8); n[1] = 8*8*8*2; this->dzcubbie = new field_descriptor(2, n, MPI_REAL4, MPI_COMM_WORLD); + proc_print_err_message("aloha 09"); //set up output file descriptor int out_rank, out_nprocs; out_nprocs = nprocs/nfiles; @@ -123,6 +134,7 @@ RMHD_converter::RMHD_converter( n[0] = ((N0/8) * (N1/8) * (N2/8)) / nfiles; n[1] = 8*8*8*2; MPI_Comm_split(MPI_COMM_WORLD, this->out_group, out_rank, &this->out_communicator); + proc_print_err_message("aloha 10"); this->dout = new field_descriptor(2, n, MPI_REAL4, this->out_communicator); } diff --git a/src/fftwf_tools.cpp b/src/fftwf_tools.cpp index 33b57d2914de449e1b04bd50ad612563fccba900..5dc37a06561a83f24a9974ea44b4c30df0c5268e 100644 --- a/src/fftwf_tools.cpp +++ b/src/fftwf_tools.cpp @@ -128,18 +128,18 @@ int fftwf_get_descriptors_3D( field_descriptor **fr, field_descriptor **fc) { - // I need to check whether there's already something there... - if (*fr != NULL) delete *fr; - if (*fc != NULL) delete *fc; + proc_print_err_message("fftwf_get_descriptors 00"); int ntmp[3]; ntmp[0] = n0; ntmp[1] = n1; ntmp[2] = n2; *fr = new field_descriptor(3, ntmp, MPI_REAL4, MPI_COMM_WORLD); + proc_print_err_message("fftwf_get_descriptors 01"); ntmp[0] = n0; ntmp[1] = n1; ntmp[2] = n2/2+1; *fc = new field_descriptor(3, ntmp, MPI_COMPLEX8, MPI_COMM_WORLD); + proc_print_err_message("fftwf_get_descriptors 02"); return EXIT_SUCCESS; } diff --git a/src/field_descriptor.cpp b/src/field_descriptor.cpp index 225f7affb3776896723a71e4cdfd5e8343f166d4..a11e81df97eedb3f233606e4cda32d12b2c64059 100644 --- a/src/field_descriptor.cpp +++ b/src/field_descriptor.cpp @@ -3,6 +3,8 @@ #include <iostream> #include "field_descriptor.hpp" +extern int myrank, nprocs; + field_descriptor::field_descriptor( int ndims, int *n, @@ -233,3 +235,12 @@ field_descriptor* field_descriptor::get_transpose() return new field_descriptor(this->ndims, n, this->mpi_dtype, this->comm); } +void proc_print_err_message(const char *message) +{ + for (int i = 0; i < nprocs; i++) + { + if (myrank == i) + std::cerr << i << " " << message << std::endl; + MPI_Barrier(MPI_COMM_WORLD); + } +} diff --git a/src/field_descriptor.hpp b/src/field_descriptor.hpp index a4b37737865ebc0a81c75a8b8828de08ba5c8f42..b8e9c36c00cc8d09d4616613a47cbdbff2893fed 100644 --- a/src/field_descriptor.hpp +++ b/src/field_descriptor.hpp @@ -75,5 +75,7 @@ int fftwf_clip_zero_padding( field_descriptor *f, float *a); +void proc_print_err_message(const char *message); + #endif//FIELD_DESCRIPTOR diff --git a/src/full.cpp b/src/full.cpp index 9971bd9fcb93ac84ea00b9ece2eb391d294e330f..f3f77c43d92c188a17ba015f549980d51700d5c0 100644 --- a/src/full.cpp +++ b/src/full.cpp @@ -1,4 +1,5 @@ #include "RMHD_converter.hpp" +#include <iostream> int myrank, nprocs; @@ -9,11 +10,16 @@ int main(int argc, char *argv[]) MPI_Comm_size(MPI_COMM_WORLD, &nprocs); RMHD_converter *bla = new RMHD_converter( - atoi(argv[1]), atoi(argv[2]), atoi(argv[3]), - atoi(argv[4]), atoi(argv[5]), atoi(argv[6]), - 2); + (1364/2+1), 1364, 1364, + 2048, 2048, 2048, + 64); - bla->convert("Kdata0", "Kdata1", "Rdata"); + bla->convert("K138000QNP002", + "K138000QNP003", + "U138000"); + bla->convert("K138000QNP005", + "K138000QNP006", + "B138000"); delete bla; // clean up