These are chat archives for bluescarni/pagmo_reborn

20th
Jun 2016
Dario Izzo
@darioizzo
Jun 20 2016 08:44
lol .... :)
@bluescarni I would like to add the operator == to population. This would check ID, f and x but not the mutable rngs state ..... ok for you?
As of version 3.12.0, the SQLite library consists of approximately 116.3 KSLOC of C code. (KSLOC means thousands of "Source Lines Of Code" or, in other words, lines of code excluding blank lines and comments.) By comparison, the project has 787 times as much test code and test scripts - 91577.3 KSLOC.
Dario Izzo
@darioizzo
Jun 20 2016 09:46
they get 100% coverage .... that is remarkable, we already have lines we cannot test and we are like at the beginning!!
Francesco Biscani
@bluescarni
Jun 20 2016 09:49
well they do things like injecting customised malloc() functions that throw after a certain amount of allocations to simulate out-of-memory conditions
Dario Izzo
@darioizzo
Jun 20 2016 09:49
malloc can be customized?
Francesco Biscani
@bluescarni
Jun 20 2016 09:52
you can inject alternative implementations of any function if you use LD_PRELOAD, including malloc()
Dario Izzo
@darioizzo
Jun 20 2016 10:16
N.E.P.
Francesco Biscani
@bluescarni
Jun 20 2016 10:53
atom for latex editing if fricking awesome
it supports synctex, which I did not know it even existed... basically you can keep 2 panes open, one with the open TeX file the other with the PDF output (via the pdfview extension). Then if you click on a section of the PDF, it scrolls over the TeX source to where you clicked in the PDF file
Dario Izzo
@darioizzo
Jun 20 2016 11:16
We can use LCOV_EXCL_LINE to exclude lines from the coverage .... I started to do so to fix some small "bugs" of the coverage analysis
Francesco Biscani
@bluescarni
Jun 20 2016 11:21
you mean to fix codecov bullshit or to hide real missing coverage?
Dario Izzo
@darioizzo
Jun 20 2016 11:22
Its not codecov, I found out that also lcov makes mistakes.
Like:
  119901 : bool pareto_dominance(const vector_double &obj1, const vector_double &obj2)
      42             : {
      43      119901 :     if (obj1.size() != obj2.size()) {
      44         170 :         pagmo_throw(std::invalid_argument,
      45             :             "Different number of objectives: " + std::to_string(obj1.size()) +
      46             :             " and " + std::to_string(obj2.size()) +
      47           0 :          ": cannot define dominance");
      48             :     }
See the 0 there?
Francesco Biscani
@bluescarni
Jun 20 2016 11:22
ah right that stuff
Dario Izzo
@darioizzo
Jun 20 2016 11:22
the macro pagmo_throw is expanded in some way and no hits are detected
So there I add LCOV_EXCL_LINE
Francesco Biscani
@bluescarni
Jun 20 2016 11:23
right, the macro is 2 lines long, so maybe that's why
Dario Izzo
@darioizzo
Jun 20 2016 11:23
I could also add it to the lines we decided not to test, but that would be hiding
Francesco Biscani
@bluescarni
Jun 20 2016 11:23
it would probably be better to try to fix the macro rather than having to add that line at each throw
Dario Izzo
@darioizzo
Jun 20 2016 11:23
ok how?
I could not think to a fix
Francesco Biscani
@bluescarni
Jun 20 2016 11:24
well the macro is two lines long, the second line contains only a throw; instruction
Marcus Märtens
@CoolRunning
Jun 20 2016 11:24
@bluescarni : Texmaker supported a similar feature already aeons ago - indispensable to fix typos. :smile:
Francesco Biscani
@bluescarni
Jun 20 2016 11:24
but I don't want to use different editors for different workloads :)
it's like emacs all over again
Marcus Märtens
@CoolRunning
Jun 20 2016 11:25
your choice, dude
Francesco Biscani
@bluescarni
Jun 20 2016 11:25
the reason for adding that throw; is that if you have something like:
int merda()
{
    pagmo_throw(std::runtime_error,"this should never be used");
}
then the compiler will complain without the throw; because it cannot understand that pagmo_throw prevent the end of the function to ever be reached
it complains because the function is supposed to return int
so the extra throw; line is a hint to the compiler that the function never finishes
but maybe there's other ways to deal with this
I just think that having to use LCOV_EXCL_LINE clutters and it is not scalable
Dario Izzo
@darioizzo
Jun 20 2016 11:29
ok, then I do not use it. But (with this error) the coverage is less helpful as it points in red to errors that are not there.
Is there another way to fix this properly then?
Francesco Biscani
@bluescarni
Jun 20 2016 11:30
modifying appropriately the pagmo_throw() macro, but if you are asking if I have a solution ready no, I don't
Dario Izzo
@darioizzo
Jun 20 2016 11:32
So if i understood, he is complaining that the second line of the macro (throw) is never hit?
Francesco Biscani
@bluescarni
Jun 20 2016 11:33
I guess
I have a sketch of solution if you want to try on your end
Dario Izzo
@darioizzo
Jun 20 2016 11:34
sure
Francesco Biscani
@bluescarni
Jun 20 2016 11:34
struct ex_thrower has two call operators, you see them?
Dario Izzo
@darioizzo
Jun 20 2016 11:34
yep
Francesco Biscani
@bluescarni
Jun 20 2016 11:35
replace in both cases void operator() with [[ noreturn ]] void operator()
then remove the second line from the macro (that is, remove ;throw)
Dario Izzo
@darioizzo
Jun 20 2016 11:36
done
Francesco Biscani
@bluescarni
Jun 20 2016 11:36
then try compiling and see if you get warnings
Dario Izzo
@darioizzo
Jun 20 2016 11:36
what is [[ noreturn]]
Francesco Biscani
@bluescarni
Jun 20 2016 11:37
it informs the compiler that that function never returns
Dario Izzo
@darioizzo
Jun 20 2016 11:37
compiling
why the parenthesis? weird syntax
Francesco Biscani
@bluescarni
Jun 20 2016 11:37
so I am hoping that the compiler now understands that when you use the ex_thrower thing it can never return
Dario Izzo
@darioizzo
Jun 20 2016 11:38
what is the difference between these atrreibutes and say, inline?
Francesco Biscani
@bluescarni
Jun 20 2016 11:39
inline existed before C++11, and implementations can define their own implementation-defined attributes (whereas they are not supposed to invent new keywords)
Dario Izzo
@darioizzo
Jun 20 2016 11:40
no warnings. getting cov analytics
Francesco Biscani
@bluescarni
Jun 20 2016 11:41
not even sure why I used the ex_thrower struct instead of just a function, this has to be one of the oldest pieces of code in piranha
Dario Izzo
@darioizzo
Jun 20 2016 11:41
"old" as in two years ... you rewrote everything right?
Francesco Biscani
@bluescarni
Jun 20 2016 11:42
not really, the codebase was started at the end of 2010 roughly
Dario Izzo
@darioizzo
Jun 20 2016 11:42
     105           2 :             pagmo_throw(std::invalid_argument, "The fitness vector at position: "
     106             :                 + std::to_string(i) + " has dimension "
     107             :                 + std::to_string(input_f[i].size()) + " while I was expecting: "
     108           1 :                 + std::to_string(M) + "(first element dimension)");
works.
strangely now it counts one hit to the last line of the macro?
Francesco Biscani
@bluescarni
Jun 20 2016 11:43
not sure what happens, I guess one would need to check how the code actually looks after expansion
Dario Izzo
@darioizzo
Jun 20 2016 11:44
What about the use of LCOV_EXCL_LINE on those lines we decided we cannot test (remember the discussion on problem?)
Francesco Biscani
@bluescarni
Jun 20 2016 11:45
IMO it's sweeping under the rug, just like casting blindly signed to unsigned to "fix" compiler warnings
Dario Izzo
@darioizzo
Jun 20 2016 11:45
ok though you may say that, so I leave them in red
Francesco Biscani
@bluescarni
Jun 20 2016 11:51
ah now I remember why I need the struct... I was not that braindamaged at the time
Dario Izzo
@darioizzo
Jun 20 2016 11:51
so what happened?
Francesco Biscani
@bluescarni
Jun 20 2016 11:52
well it boils down to the fact that calling a function like this foo(1,2,3,) is illegal in C++
Dario Izzo
@darioizzo
Jun 20 2016 11:52
and you need it for the variadic macro stuff?
Francesco Biscani
@bluescarni
Jun 20 2016 11:53
yeah... so put the first three arguments (whose number if fixed) in the ctor of the struct, and then forward the other variadic arguments to the call operator
foo(1,2,3)()
foo(1,2,3)(4)
etc.
Dario Izzo
@darioizzo
Jun 20 2016 11:54
right
sick
Dario Izzo
@darioizzo
Jun 20 2016 17:43
@bluescarni I finished the test coverage branch. AFAIK it can be merged. Only two lines remain untested and are the ones we discussed in the pagmo::problem constructor
Next, I would move onto the implementation of MOEA/D (leaving PaDE for phase 2 when the multithreading stuff will be put in place)
@CoolRunning Hows the hypervolume MR going? In MOEA/D I could use the hypervolume to test some stuff ....
Marcus Märtens
@CoolRunning
Jun 20 2016 19:34
@darioizzo Haven't found the time last week, but it just needs another kick. Will try tomorrow.
Dario Izzo
@darioizzo
Jun 20 2016 19:39
Yay