[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Excessive copies of set elements in GMPL
From: |
Domingo Alvarez Duarte |
Subject: |
Excessive copies of set elements in GMPL |
Date: |
Thu, 16 Jul 2020 10:51:37 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
Hello !
Trying to improve GLPK/GMPL I can see that GMPL model generation is
making an excessive number of set element copies (see bellow).
For simplicity we declare a SET of 1,000,000 elements and print it's
cardinality, the profiler show that 3 copies of the set are made, with
problems with significant size this adds up quickly making then
unmanageable.
Does someone with more knowledge of the GMPL implementation shed a light
here ?
It seems that this is a hanging fruit that can give a performance boost
and reduce the memory usage to 1/3.
See this example:
=====
set S := {1..1000000};
display card(S);
end;
=====
Compiling glpk/glpsol for profiling:
=====
CFLAGS="-g -pg" ./configure
=====
Then executing:
=====
glpsol -m test.mod
gprof glpsol gmon.out > glpsol.profile.txt
=====
Here is the relevant part of the generated profile from gprof:
=====
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
17.95 0.07 0.07 13000025 0.00 0.00 _glp_dmp_get_atom
7.69 0.15 0.03 5000000 0.00 0.00 _glp_mpl_copy_symbol
7.69 0.18 0.03 4000001 0.00 0.00 _glp_mpl_add_member
7.69 0.21 0.03 1000001 0.00 0.00 _glp_mpl_expand_tuple
5.13 0.23 0.02 13000008 0.00 0.00 _glp_dmp_free_atom
5.13 0.25 0.02 4000004 0.00 0.00 _glp_mpl_delete_tuple
5.13 0.27 0.02 3000001 0.00 0.00 _glp_mpl_arelset_size
5.13 0.29 0.02 1000001 0.00 0.00 loop_domain_func
2.56 0.31 0.01 8000003 0.00 0.00 _glp_mpl_tuple_dimen
2.56 0.33 0.01 3000001 0.00 0.00 _glp_mpl_copy_tuple
2.56 0.34 0.01 2000000 0.00 0.00
_glp_mpl_arelset_member
2.56 0.35 0.01 1000000 0.00 0.00
_glp_mpl_enter_domain_block
2.56 0.36 0.01 1000000 0.00 0.00
_glp_mpl_get_domain_tuple
2.56 0.37 0.01 1000000 0.00 0.00 _glp_mpl_is_member
2.56 0.38 0.01 1000000 0.00 0.00 iter_set_func
2.56 0.39 0.01 3 3.33 44.28 _glp_mpl_copy_elemset
0.00 0.39 0.00 5000001 0.00 0.00 _glp_mpl_delete_symbol
0.00 0.39 0.00 4000000 0.00 0.00 _glp_mpl_add_tuple
0.00 0.39 0.00 2000003 0.00 0.00 _glp_mpl_eval_numeric
0.00 0.39 0.00 2000000 0.00 0.00
_glp_mpl_update_dummy_indices
0.00 0.39 0.00 1000003 0.00 0.00 _glp_mpl_create_tuple
0.00 0.39 0.00 1000000 0.00 0.00
_glp_mpl_assign_dummy_index
0.00 0.39 0.00 999999 0.00 0.00
_glp_mpl_compare_symbols
=====
Cheers !
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Excessive copies of set elements in GMPL,
Domingo Alvarez Duarte <=