Commit 05aaba8e authored by David Rohr's avatar David Rohr

improve debug output

parent e7310dea
......@@ -225,11 +225,11 @@ int bioem::configure(int ac, char* av[])
#ifdef WITH_MPI
MPI_Bcast(&param, sizeof(param), MPI_BYTE, 0, MPI_COMM_WORLD);
//refCtf, CtfParam, angles automatically filled by precalculare function below
MPI_Bcast(&Model, sizeof(Model), MPI_BYTE, 0, MPI_COMM_WORLD);
if (mpi_rank != 0) Model.points = (bioem_model::bioem_model_point*) mallocchk(sizeof(bioem_model::bioem_model_point) * Model.nPointsModel);
MPI_Bcast(Model.points, sizeof(bioem_model::bioem_model_point) * Model.nPointsModel, MPI_BYTE, 0, MPI_COMM_WORLD);
MPI_Bcast(&RefMap, sizeof(RefMap), MPI_BYTE, 0, MPI_COMM_WORLD);
if (mpi_rank != 0) RefMap.maps = (myfloat_t*) mallocchk(RefMap.refMapSize * sizeof(myfloat_t) * RefMap.ntotRefMap);
MPI_Bcast(RefMap.maps, RefMap.refMapSize * sizeof(myfloat_t) * RefMap.ntotRefMap, MPI_BYTE, 0, MPI_COMM_WORLD);
......@@ -283,10 +283,10 @@ int bioem::run()
// **************************************************************************************
// **** Main BioEM routine, projects, convolutes and compares with Map using OpenMP ****
// **************************************************************************************
if (param.printModel)
{
//....
return(0);
}
......@@ -338,21 +338,22 @@ int bioem::run()
proj_mapFFT = (mycomplex_t *) myfftw_malloc(sizeof(mycomplex_t) * param.param_device.NumberPixels * param.param_device.NumberFFTPixels1D);
conv_mapFFT = (mycomplex_t *) myfftw_malloc(sizeof(mycomplex_t) * param.param_device.NumberPixels * param.param_device.NumberFFTPixels1D);
HighResTimer timer;
HighResTimer timer, timer2;
if (DebugOutput >= 1 && mpi_rank == 0) printf("\tMain Loop (GridAngles %d, CTFs %d, RefMaps %d, Shifts (%d/%d)²), Pixels %d²\n", param.nTotGridAngles, param.nTotCTFs, RefMap.ntotRefMap, 2 * param.param_device.maxDisplaceCenter + param.param_device.GridSpaceCenter, param.param_device.GridSpaceCenter, param.param_device.NumberPixels);
const int iOrientStart = (int) ((long long int) mpi_rank * param.nTotGridAngles / mpi_size);
int iOrientEnd = (int) ((long long int) (mpi_rank + 1) * param.nTotGridAngles / mpi_size);
if (iOrientEnd > param.nTotGridAngles) iOrientEnd = param.nTotGridAngles;
for (int iOrient = iOrientStart; iOrient < iOrientEnd; iOrient++)
{
// ***************************************************************************************
// ***** Creating Projection for given orientation and transforming to Fourier space *****
if (DebugOutput >= 1) timer.ResetStart();
if (DebugOutput >= 1) timer2.ResetStart();
if (DebugOutput >= 2) timer.ResetStart();
createProjection(iOrient, proj_mapFFT);
if (DebugOutput >= 1) printf("Time Projection %d: %f\n", iOrient, timer.GetCurrentElapsedTime());
if (DebugOutput >= 2) printf("Time Projection %d: %f (rank %d)\n", iOrient, timer.GetCurrentElapsedTime(), mpi_rank);
// ***************************************************************************************
// ***** **** Internal Loop over convolutions **** *****
......@@ -362,7 +363,7 @@ int bioem::run()
if (DebugOutput >= 2) timer.ResetStart();
createConvolutedProjectionMap(iOrient, iConv, proj_mapFFT, conv_map, conv_mapFFT, sumCONV, sumsquareCONV);
if (DebugOutput >= 2) printf("Time Convolution %d %d: %f\n", iOrient, iConv, timer.GetCurrentElapsedTime());
if (DebugOutput >= 2) printf("Time Convolution %d %d: %f (rank %d)\n", iOrient, iConv, timer.GetCurrentElapsedTime(), mpi_rank);
// ***************************************************************************************
// *** Comparing each calculated convoluted map with all experimental maps ***
......@@ -379,9 +380,10 @@ int bioem::run()
(((double) param.param_device.NumberPixels - (double) param.param_device.maxDisplaceCenter / 2.) * ((double) param.param_device.NumberPixels - (double) param.param_device.maxDisplaceCenter / 2.) * 2. + 8.) * (double) sizeof(myfloat_t) / compTime;
const double nGBs2 = (double) RefMap.ntotRefMap * ((double) param.param_device.NumberPixels * (double) param.param_device.NumberPixels + 8.) * (double) sizeof(myfloat_t) / compTime;
printf("Time Comparison %d %d: %f sec (%f GFlops, %f GB/s (cached), %f GB/s)\n", iOrient, iConv, compTime, nFlops / 1000000000., nGBs / 1000000000., nGBs2 / 1000000000.);
printf("Time Comparison %d %d: %f sec (%f GFlops, %f GB/s (cached), %f GB/s) (rank %d)\n", iOrient, iConv, compTime, nFlops / 1000000000., nGBs / 1000000000., nGBs2 / 1000000000., mpi_rank);
}
}
if (DebugOutput >= 1) printf("Total time for orientation %d: %f (rank %d)\n", iOrient, timer2.GetCurrentElapsedTime(), mpi_rank);
}
//deallocating fftw_complex vector
myfftw_free(proj_mapFFT);
......@@ -403,7 +405,7 @@ int bioem::run()
// ************* Writing Out Probabilities ***************
// *** Angular Probability ***
#ifdef WITH_MPI
if (DebugOutput >= 2 && mpi_rank == 0) timer.ResetStart();
//Reduce Constant and summarize probabilities
......@@ -425,7 +427,7 @@ int bioem::run()
//Find MaxProb
MPI_Status mpistatus;
{
{
int* tmpi1 = new int[RefMap.ntotRefMap];
int* tmpi2 = new int[RefMap.ntotRefMap];
for (int i = 0;i < RefMap.ntotRefMap;i++)
......@@ -455,7 +457,7 @@ int bioem::run()
delete[] tmpi1;
delete[] tmpi2;
}
if (mpi_rank == 0)
{
for (int i = 0;i < RefMap.ntotRefMap;i++)
......@@ -465,13 +467,13 @@ int bioem::run()
pProbMap.Constoadd = tmp2[i];
}
}
delete[] tmp1;
delete[] tmp2;
delete[] tmp3;
if (DebugOutput >= 2 && mpi_rank == 0) printf("Time MPI Reduction: %f\n", timer.GetCurrentElapsedTime());
}
//Angle Reduction and Probability summation for individual angles
if (param.param_device.writeAngles)
{
......@@ -507,7 +509,7 @@ int bioem::run()
}
delete[] tmp1;
delete[] tmp2;
delete[] tmp3;
delete[] tmp3;
}
#endif
......@@ -729,7 +731,7 @@ int bioem::createConvolutedProjectionMap(int iMap, int iConv, mycomplex_t* lproj
// *** Calculating Cross-correlations of cal-convoluted map with its self *****
sumC = localmultFFT[0][0];
sumsquareC = 0;
if (FFTAlgo)
{
......@@ -743,7 +745,7 @@ int bioem::createConvolutedProjectionMap(int iMap, int iConv, mycomplex_t* lproj
int k = i * param.param_device.NumberFFTPixels1D;
sumsquareC += localmultFFT[k][0] * localmultFFT[k][0] + localmultFFT[k][1] * localmultFFT[k][1];
}
myfloat_t norm2 = (myfloat_t) (param.param_device.NumberPixels * param.param_device.NumberPixels);
sumsquareC = sumsquareC / norm2;
}
......@@ -765,7 +767,7 @@ int bioem::createConvolutedProjectionMap(int iMap, int iConv, mycomplex_t* lproj
myfloat_t norm4 = norm2 * norm2;
sumsquareC = sumsquareC / norm4;
}
cuda_custom_timeslot_end;
return(0);
......
......@@ -43,7 +43,7 @@ bioem_param::bioem_param()
refCTF = NULL;
CtfParam = NULL;
angles = NULL;
printModel = false;
}
......@@ -275,7 +275,7 @@ int bioem_param::readParameters(const char* fileinput)
void bioem_param::PrepareFFTs()
{
if (mpi_rank) cout << "Preparing FFTs\n";
if (mpi_rank == 0) cout << "Preparing FFTs\n";
releaseFFTPlans();
mycomplex_t *tmp_map, *tmp_map2;
tmp_map = (mycomplex_t *) myfftw_malloc(sizeof(mycomplex_t) * param_device.NumberPixels * param_device.NumberPixels);
......@@ -295,7 +295,7 @@ void bioem_param::PrepareFFTs()
myfftw_free(tmp_map);
myfftw_free(tmp_map2);
fft_plans_created = 1;
fft_plans_created = 1;
}
void bioem_param::releaseFFTPlans()
......@@ -380,7 +380,7 @@ int bioem_param::CalculateRefCTF()
refCTF = new mycomplex_t[getRefCtfCount()];
delete[] CtfParam;
CtfParam = new myfloat3_t[getCtfParamCount()];
for (int iamp = 0; iamp < numberGridPointsCTF_amp ; iamp++) //Loop over amplitud
{
amp = (myfloat_t) iamp * gridCTF_amp + startGridCTF_amp;
......
Markdown is supported
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