GSL cannot reach the specified tolerance

I have a problem with exactly the same fitting code working differently on two machines, one with 32 and one with 64 bits. My settings for the fitter are:

	ROOT::Math::MinimizerOptions::SetDefaultMinimizer("GSLMultiFit", "");
	ROOT::Math::MinimizerOptions::SetDefaultPrintLevel(3);
	ROOT::Math::MinimizerOptions::SetDefaultStrategy(1);
	ROOT::Math::MinimizerOptions::SetDefaultTolerance(0.001);

although I am not sure if they all affect GSL :slight_smile:

The problem is, that on one machines the fit goes on, on the second it decides on the first iteration that the tolarance cannot be reached:

Initial params 976.08654785 0.14824319097 -0.28525488592 3.581870079 1 488 2 1
Minimize using GSLNLSMinimizer undefined
new calc -3 -3 0.14839319097 -0.28525488592 2591.4641685 488 2 488.05062932
new calc -3 -3 0.14824319097 -0.28510488592 2591.4679096 488 3 488.0505913
GSLNLSMinimizer: Start iterating......... 
new calc -3 -3 0.21234165025 -0.29249671767 2619.93383 488 4 488.05177028
new calc -3 -3 0.21249151291 -0.29249671767 2620.0142855 488 5 488.05175889
new calc -3 -3 0.21234165025 -0.29234671938 2619.8736349 488 6 488.05171682
----------> Iteration 0 / 100 status success
            FVAL = 433.867933819512814
            X Values :  Distance = 976.08654785 X0 = 0.21234165025 Y0 = -0.29249
671767 Axis = 3.581870079 Scale = 1 Offset = 488 Power = 2 Lambda = 1 Convolutio
n = 1
          after Gradient and Delta tests:  the iteration has not converged yet
Initial params 976.08654785 0.14824319097 -0.28525488592 3.581870079 1 488 2 1
Minimize using GSLNLSMinimizer undefined
new calc -3 -3 0.14839319097 -0.28525488592 2591.4641685 488 2 488.05062932
new calc -3 -3 0.14824319097 -0.28510488592 2591.4679096 488 3 488.0505913
GSLNLSMinimizer: Start iterating......... 
----------> Iteration 0 / 100 status cannot reach the specified tolerance in F
            FVAL = 680.768965186504033
            X Values :  Distance = 976.08654785 X0 = 0.14824319097 Y0 = -0.28525488592 Axis = 3.581870079 Scale = 1 Offset = 488 Power = 2 Lambda = 1 Convolution = 1
GSLNLSMinimizer: Minimization did not converge

The lines starting with “new calc” are printed from within the function. The function is called with exactly the same parameters on both machines (0.14839319097 -0.28525488592 and so on) and returns the same values for position -3 -3 (488.05062932 and so on) before “start iterating”. So I assume it is calculated properly on both machines. Why the decision about continuing the fit is different?

Hi,

Strange, but I suspect there is a precision problem in evaluating the derivative of your function. You should check also those, do you calculate them analytically or numerically ?
Also comparing the function value is not sufficient. The algorithm uses as input the residual at each point. Are you sure those are the same on both machines ?

Best Regards

Lorenzo

Numerically. I do nothing about derivatives.

Well, I printed difference between function and histogram and also error for the histogram. All the values - function, histo, error are the same up to 13 place decimal. I guess such an accuracy should be enough for fitter to behave in the same manner.

My function is not easy to debug - it does some caching and rejects some points, thus it has many return places. But as far as I can see, the first difference in output of values/residuals etc. is when fitter calls the function with completely different parameter on 64 bit machine and with the same parameters as previous on 32 bit machine. Probably these “same” parameters differ on decimal place higher then 13.

Prior to this call with completely different parameters I cannot find any difference, but I’ll keep debugging… Is there any way to print every step of the fitter from within the fitter? I mean parameters and residuals each function call?

Is it possible that default step is somehow different on the two machines? How to check what the step size is?

Hi,

it seems difficult this to me. To understand the problem better, you should enabled the DEBUG option in GSL.
To do this recompile GSL (or at least the functions) in the multifit directory, with -DDEBUG
I cannot help you more without having your program

Best Regards

Lorenzo