|
From: | Domingo Alvarez Duarte |
Subject: | Re: GLPK compiled with -march=native produces different results |
Date: | Fri, 17 Jul 2020 20:09:57 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
Hello !
Right now with this artificial example to test "set" manipulation before and after may changes I'm getting this results (with osemosys GMPL only the difference is less impressive):
===== Standard GLPK
/usr/bin/time ./glpsol -m sum-test.mod
GLPSOL: GLPK LP/MIP Solver, v4.65
...
Memory used: 645.0 Mb (676328733 bytes)
2.55user 0.27system 0:02.82elapsed 100%CPU (0avgtext+0avgdata
664748maxresident)k
/usr/bin/time ./glpsol --check -m osemosys.mod -d atlantis.dat
GLPSOL: GLPK LP/MIP Solver, v4.65
...
--- Problem Characteristics ---
Number of rows = 232144
Number of columns = 226799
Number of non-zeros (matrix) = 562936
Number of non-zeros (objrow) = 27
2.63user 0.11system 0:02.74elapsed 100%CPU (0avgtext+0avgdata
309692maxresident)k
===== https://github.com/mingodad/GLPK
/usr/bin/time ./glpsol -m sum-test.mod
GLPSOL: GLPK LP/MIP Solver, v4.65
...
Memory used: 169.0 Mb (177220245 bytes)
1.29user 0.06system 0:01.35elapsed 100%CPU (0avgtext+0avgdata
176304maxresident)k
/usr/bin/time ./glpsol --check -m osemosys.mod -d atlantis.dat
GLPSOL: GLPK LP/MIP Solver, v4.65
...
--- Problem Characteristics ---
Number of rows = 232144
Number of columns = 226799
Number of non-zeros (matrix) = 562936
Number of non-zeros (objrow) = 27
1.84user 0.10system 0:01.94elapsed 100%CPU (0avgtext+0avgdata
288264maxresident)k
=====
=====
set S := {1..1000000};
param d { i in S} := if ((i mod 2) == 0) then 0.0000000123 else
12345.0000000001;
display card(S);
display sum {i in S} d[i];
display card(S)*2;
display card(S)*3;
display sum {i in S : (i mod 2) == 0} d[i];
display sum {i in S : (i mod 2) <> 0} d[i];
end;
=====
Cheers !
Hello Peter !
Every day is a day to learn something new !
Thank you for reply !
Indeed using this option I'm getting identical outputs.
With the modifications I did to GLPK 4.65 (one of then to allow eliminate "xassert" defining "-DNDEBUG") https://github.com/mingodad/GLPK
====
CFLAGS="-g -O3 -march=native -ffp-contract=off -DWITH_SPLAYTREE -DNDEBUG -flto" ./configure
====
Cheers !
On 17/7/20 18:04, Peter Cawley wrote:
Perhaps you are looking for -ffp-contract=off. With the default -ffp-contract=fast, GCC will make use of FMA instructions if the -march architecture supports them. FMA instructions are usually more accurate than separate multiply then add, but do not give bitwise identical results to a multiply followed by an add (because FMA has no rounding step between the multiply and the add).
On Fri, Jul 17, 2020 at 4:34 PM Domingo Alvarez Duarte <mingodad@gmail.com> wrote:
Hello !
Doing tests with GLPK I noticed that if I compile it with "-march=native
-g -O2" on a computer with an "i7" processor the solution for several
files change, the objective function result remain the same but other
values varies from model to model.
Example dist.mod:
====
6 rlim[w96] NU 3 0 3 -11283.2 #
only -O2
====
6 rlim[w96] NU 3 0 3 -11283.1 #
-O2 -march=native
====
Example mfasp.mod:
====
1 r[1,2] 9 1 # only -O2
2 r[2,3] 2 1
====
1 r[1,2] 1 1 # -O2 -march=native
2 r[2,3] 10 1
====
Cheers !
[Prev in Thread] | Current Thread | [Next in Thread] |