Commit e4af4bce authored by Luka Stanisic's avatar Luka Stanisic

adding recalibration

parent 06776f09
......@@ -14,6 +14,10 @@
#ifdef WITH_MPI
#include <mpi.h>
#define RECALIB_FACTOR 200
#define FIRST_STABLE 7
#define STABLE_ITERATION(i) (i % (FIRST_STABLE + 1) == FIRST_STABLE)
#define MPI_CHK(expr) \
if (expr != MPI_SUCCESS) \
{ \
......@@ -528,7 +532,11 @@ int bioem::run()
bool stopTuning=false;
int a=1, b=50, c=100, x=75, limit=1;
double fb=0., fx=0.;
if (Autotuning == 3) rebalance(b);
if (Autotuning == 3)
{
workload=b;
rebalance(b);
}
if (DebugOutput >= 1 && mpi_rank == 0) printf("\tMain Loop GridAngles %d, CTFs %d, RefMaps %d, Shifts (%d/%d)², Pixels %d², OMP Threads %d, MPI Ranks %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, omp_get_max_threads(), mpi_size);
......@@ -560,6 +568,16 @@ int bioem::run()
for (int iOrient = iOrientAtOnce; iOrient < iTmpEnd;iOrient++)
{
/* Recalibrate if needed */
if (((iOrient - iOrientStart) % RECALIB_FACTOR == 0) && ((iTmpEnd - iOrient) > RECALIB_FACTOR) && (Autotuning == 3) )
{
a=1, b=50, c=100, x=75, limit=1;
fb=0., fx=0.;
workload=b;
rebalance(b);
stopTuning=false;
}
mycomplex_t* proj_mapFFT = &proj_mapsFFT[(iOrient - iOrientAtOnce) * ProjMapSize];
// ***************************************************************************************
......@@ -599,7 +617,7 @@ int bioem::run()
printf("\t\tTime 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 (Autotuning == 1 && !stopTuning && (iConv % 5 == 4))
if (Autotuning == 1 && !stopTuning && STABLE_ITERATION(iConv))
{
if (compTime == 0.) compTime = timer.GetCurrentElapsedTime();
......@@ -639,11 +657,11 @@ int bioem::run()
}
rebalance(workload);
}
if (Autotuning == 3 && !stopTuning && (iConv % 7 == 6))
if (Autotuning == 3 && !stopTuning && STABLE_ITERATION(iConv))
{
if (compTime == 0.) compTime = timer.GetCurrentElapsedTime();
if (iOrient == iOrientStart && iConv == 6)
if (((iOrient - iOrientStart) % RECALIB_FACTOR == 0) && (iConv == FIRST_STABLE))
{
fb = compTime;
x = 75;
......@@ -667,12 +685,12 @@ int bioem::run()
else
c = x;
}
x = (c-b > b-a) ? (int)(b+(c-b)/2) : (int)(a+(b-a)/2);
x = (c-b > b-a) ? (int)(b+(c-b)/2) : (int)(a+(b-a+1)/2);
}
if ( (c-b == limit) && ( b-a == limit) ) stopTuning=true;
workload=x;
rebalance(x);
}
}
......
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