Commit e82d8fa0 authored by Luka Stanisic's avatar Luka Stanisic

implementing another way of doing Autotuning (using bisection)

parent 433e8148
......@@ -526,6 +526,9 @@ int bioem::run()
int workload = getenv("GPUWORKLOAD") == NULL ? 100 : atoi(getenv("GPUWORKLOAD"));
int best_workload = workload;
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 (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);
......@@ -636,6 +639,42 @@ int bioem::run()
}
rebalance(workload);
}
if (Autotuning == 3 && !stopTuning && (iConv % 7 == 6))
{
if (compTime == 0.) compTime = timer.GetCurrentElapsedTime();
if (iOrient == iOrientStart && iConv == 6)
{
fb = compTime;
x = 75;
}
else
{
fx = compTime;
if (fx < fb)
{
if (x < b)
c = b;
else
a = b;
b = x;
fb = fx;
}
else
{
if (x < b)
a = x;
else
c = x;
}
x = (c-b > b-a) ? (int)(b+(c-b)/2) : (int)(a+(b-a)/2);
}
if ( (c-b == limit) && ( b-a == limit) ) stopTuning=true;
rebalance(x);
}
}
if (DebugOutput >= 1)
{
......
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