These are chat archives for bluescarni/pagmo_reborn

5th
May 2016
Dario Izzo
@darioizzo
May 05 2016 09:13
Continuous integration is now linked to our own docker image:
  • Docker user: pagmo
  • Docker pass: pagmo4docker
  • CI image is pagmo/ci-alpine:v1
    It contains the clang compiled boost libraries in `home/pagmo/' with the names:
    libboost_chrono.a                       libboost_prg_exec_monitor.so            libboost_system.so.1.60.0               libboost_timer.so.1.60.0
    libboost_chrono.so                      libboost_prg_exec_monitor.so.1.60.0     libboost_test_exec_monitor.a            libboost_unit_test_framework.a
    libboost_chrono.so.1.60.0               libboost_system.a                       libboost_timer.a                        libboost_unit_test_framework.so
    libboost_prg_exec_monitor.a             libboost_system.so                      libboost_timer.so                       libboost_unit_test_framework.so.1.60.0
Marcus Märtens
@CoolRunning
May 05 2016 09:14
:+1:
Francesco Biscani
@bluescarni
May 05 2016 09:58
that's frigging great :) gut gemacht!
Francesco Biscani
@bluescarni
May 05 2016 10:10
@darioizzo one comment is that maybe in the clang build the custom boost includes should be included rather than the system ones
because if the compiled unit test library's version is different from the version of the includes there could be problems
Francesco Biscani
@bluescarni
May 05 2016 10:24
actually to be completely rigorous we should make sure all libs/headers are consistent, but I suppose that if we are sure the two copies are the same version we should be fine
Dario Izzo
@darioizzo
May 05 2016 11:04
Thats true and i thought about it, but then the image size is 1.2 GB from 600MB, so I opted for removing the downloaded boost stuff. Boost 1.59 is the system and boost 1.60 is the unit_test, but I checked and it seemed to me no changes were made between versions
Francesco Biscani
@bluescarni
May 05 2016 11:05
fair enough, it might also be that they have a policy of backwards compatibility for the binary ABI
Dario Izzo
@darioizzo
May 05 2016 11:06
In any case now on docker Hub our image is 187 MB for download. If you pull it in docker it inflates to 680MB
which seems reasonable .... to me
Francesco Biscani
@bluescarni
May 05 2016 11:07
it's because of the multiple layers thing right?
Dario Izzo
@darioizzo
May 05 2016 11:07
I think so, did not really get what they are but yes ...
Francesco Biscani
@bluescarni
May 05 2016 11:07
and it does not matter much does it, at least for CI? we download it once...
I think those 187 MB might be extra pagmo stuff with respect to what the base alpine gives you
Dario Izzo
@darioizzo
May 05 2016 11:08
true but emma is not really a server where I like to have these services so I would like to keep it at bay
right
Francesco Biscani
@bluescarni
May 05 2016 11:09
we could always move it elsewhere, does not have to be emma
Dario Izzo
@darioizzo
May 05 2016 11:10
electra would be better, but for now I want to move to other stuff ... btw make it public and lets try the appveyor stuff
Francesco Biscani
@bluescarni
May 05 2016 11:11
don't know if I can do it today, I am alone with Ben
Dario Izzo
@darioizzo
May 05 2016 11:13
I am just saying ... whenever ... just lets make it public I do not see why keep it private if your guys do not check
Marcus Märtens
@CoolRunning
May 05 2016 12:51
Question: when I build the MSVC solution file, I get a bunch of "projects" in it: "ALL_BUILD, example0, example0_gh, RUN_TESTS, ZERO_CHECK". Only the example ones work right here - what are the others? Are they supposed to be there?
Dario Izzo
@darioizzo
May 05 2016 13:51
Not sure i can help, but if you activate the example option only on cmake, then only example0 and example0_gh are defined as target.
If you activate also the test option (which you eventually should ), then a number of files will be compiled too.
You can see in https://gitlab.com/EuropeanSpaceAgency/PaGMOreborn/builds/1286153 the output of a full build on linux. As you see many cpp files get compiled (one per test)
Marcus Märtens
@CoolRunning
May 05 2016 13:56
Example options? You mean Tutorials?
I have to tinker with the Test-option... there is boost-crap happening if I try that one.
Francesco Biscani
@bluescarni
May 05 2016 14:00
it's just different build targets
ALL means to build everything
the other targets let you build single executables
make all would be in Unix
make example_0 etc.
Marcus Märtens
@CoolRunning
May 05 2016 14:06
I remember compiling PaGMO on Linux... took some time. But here this goes too fast? So if I select "ALL_BUILD" for building, there is nothing really happen. Also, the source-files are not included in this project. If I was to change some code in core-classes of PaGMO, I doubt it would recompile?
btw: next days I devote to learning C++ and contributing to PaGMO... :)
Maybe this makes it clear: http://imgur.com/glGlSWw
Dario Izzo
@darioizzo
May 05 2016 14:14
It goes fast now as PaGMO is 1) header only so no need to precompile a library 2) because right now there is not much in PaGMOreborn 3) because I think you are not building the test
I think when you created the solution the option BUILD_TEST was not selected
So it is now just building two files, the two examples
As for learning c++ I wish I did too .... but maybe you will be a better student to Francesco :)
Marcus Märtens
@CoolRunning
May 05 2016 14:18
I will see that I get the tests running
Dario Izzo
@darioizzo
May 05 2016 14:18
Good luck :)
Marcus Märtens
@CoolRunning
May 05 2016 14:18
But I think I screwed up with Boost... as I also have MingW installed on this machine, I am not sure what compiler was used to compile boost and whether that is creating problems
so far CMake is complaining that my boost is too old... because it has version 0.0.0. :worried:
Dario Izzo
@darioizzo
May 05 2016 14:19
Did you select in bjam the toolset=MSCV option?
0.0.0 sounds pretty old
Marcus Märtens
@CoolRunning
May 05 2016 14:19
I haven't set any toolset option, so I better recompile the thing making sure it uses MSVC
Dario Izzo
@darioizzo
May 05 2016 14:20
Even if you do not select the option when you bootsrap it tells you something like "building with toolset XXX" and my guess is that by default in windows it tries MSVC
Francesco Biscani
@bluescarni
May 05 2016 14:24
I think it does use MSVC by default on Windows if it is available
Marcus Märtens
@CoolRunning
May 05 2016 14:24
yet, I must have missed some important options here, because CMake complains:
Francesco Biscani
@bluescarni
May 05 2016 14:24
the screenshot looks reasonable, it's what I'd expect on windows
Marcus Märtens
@CoolRunning
May 05 2016 14:24

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindBoost.cmake:1052 (file):
file STRINGS file "C:/Boost/boost_1_60_0/stage/lib/boost/version.hpp"
cannot be read.
Call Stack (most recent call first):
CMakeLists.txt:40 (find_package)

CMake Warning at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindBoost.cmake:725 (message):
Imported targets not available for Boost version 0
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindBoost.cmake:763 (_Boost_COMPONENT_DEPENDENCIES)
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindBoost.cmake:1315 (_Boost_MISSING_DEPENDENCIES)
CMakeLists.txt:40 (find_package)

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindBoost.cmake:1657 (message):
Unable to find the requested Boost libraries.

Boost version: 0.0.0

Boost include path: C:/Boost/boost_1_60_0/stage/lib

Detected version of Boost is too old. Requested version was 1.55 (or
newer).
Call Stack (most recent call first):
CMakeLists.txt:40 (find_package)

there is no version.hpp
only .lib-files
Dario Izzo
@darioizzo
May 05 2016 14:26
What is the detected BOOST HEADER location? I think that may be wrong, not the way you built them
Marcus Märtens
@CoolRunning
May 05 2016 14:27
C:/Boost/boost_1_60_0/stage/lib
this is where it compiled boost
Dario Izzo
@darioizzo
May 05 2016 14:27
Well are there headers in there?
Marcus Märtens
@CoolRunning
May 05 2016 14:27
only .lib
Dario Izzo
@darioizzo
May 05 2016 14:27
IN CMAKE one variable is for the boost header location, my guess is that is wrongly determined
Marcus Märtens
@CoolRunning
May 05 2016 14:28
there BOOST_DIR and BOOST_INCLUDE_DIR - only the latter is set to the location pointed out above
Dario Izzo
@darioizzo
May 05 2016 14:28
manually insert the correct location
Marcus Märtens
@CoolRunning
May 05 2016 14:28
I will try setting it to a different folder with version.hpp inside
Dario Izzo
@darioizzo
May 05 2016 14:29
My guess is that you put the boost root folder in some unexpected location. When I tried with pagmo legacy it all worked only if i did put the folder boost in C:/
and called it boost (i.e. removed the version). If not I had to set manually some stuff
May be some "expected behaviour" of the FIND_BOOST script of CMake
Francesco Biscani
@bluescarni
May 05 2016 14:34
the boost include looks wrong
file STRINGS file "C:/Boost/boost_1_60_0/stage/lib/boost/version.hpp"
Marcus Märtens
@CoolRunning
May 05 2016 14:34
fixed it
Francesco Biscani
@bluescarni
May 05 2016 14:35
can't find the file there
Marcus Märtens
@CoolRunning
May 05 2016 14:35

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindBoost.cmake:1657 (message):
Unable to find the requested Boost libraries.

Boost version: 1.60.0
Boost include path: C:/Boost/boost_1_60_0
Could not find the following Boost libraries:
boost_unit_test_framework

Dario Izzo
@darioizzo
May 05 2016 14:35
:clap:
Francesco Biscani
@bluescarni
May 05 2016 14:35
the stage dir is where stuff is built
Marcus Märtens
@CoolRunning
May 05 2016 14:35
aye, the root directory of boost was correct
do I need to compile the unit_test_framework first?
Dario Izzo
@darioizzo
May 05 2016 14:36
thats a boost library, I thought you did compile them .. if not yes you need it
Marcus Märtens
@CoolRunning
May 05 2016 14:36
maybe that was missed - will compile
Dario Izzo
@darioizzo
May 05 2016 14:37
no need to compile all of them, you only need this one.
Francesco Biscani
@bluescarni
May 05 2016 14:37
can you post a screenshot from you cmake with the advanced options displayed as well? (there should be a checkbox for that)
Marcus Märtens
@CoolRunning
May 05 2016 14:40
at the moment it looks like this: http://imgur.com/bLUvV62
actually I have the unit test framework compiled under stage
maybe I can just point to that directory
Francesco Biscani
@bluescarni
May 05 2016 14:41
so the include dir shoul dbe ok, try to point to the unit test library
Dario Izzo
@darioizzo
May 05 2016 14:41
directory and file name
Francesco Biscani
@bluescarni
May 05 2016 14:41
should be a dll right?
Dario Izzo
@darioizzo
May 05 2016 14:41
also build a Debug, not Release
Francesco Biscani
@bluescarni
May 05 2016 14:41
you need to point to the library file, not the directory
Dario Izzo
@darioizzo
May 05 2016 14:41
In Debug the tests are compiled, in Release not.
Marcus Märtens
@CoolRunning
May 05 2016 14:44
CMake generates now
1>------ Build started: Project: RUN_TESTS, Configuration: Debug x64 ------
1> Test project C:/PaGMO/PaGMOreborn/build
1> Start 1: example0
1> 1/2 Test #1: example0 ......................... Passed 0.01 sec
1> Start 2: example0_gh
1> 2/2 Test #2: example0_gh ...................... Passed 0.01 sec
1>
1> 100% tests passed, 0 tests failed out of 2
1>
1> Total Test time (real) = 0.02 sec
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
shouldn't there be more tests?
Dario Izzo
@darioizzo
May 05 2016 14:45
He did not compile any of them :(
Francesco Biscani
@bluescarni
May 05 2016 14:45
the "RUN_TESTS" target is the target that runs the tests
not the one that compiles them
it's like "make test" in linux
it will run only the tests that have been compiled
(in this case just the examples)
Marcus Märtens
@CoolRunning
May 05 2016 14:49
I tried to use the ALL_BUILD target but it does not look like it builds anything...
Francesco Biscani
@bluescarni
May 05 2016 14:49
did you re-run the cmake and re-generate the project files for MSVC?
and did you set the build type to DEBUG?
Marcus Märtens
@CoolRunning
May 05 2016 14:49
I will double-check that
Francesco Biscani
@bluescarni
May 05 2016 14:49
because the tests are built only in debug mode
Marcus Märtens
@CoolRunning
May 05 2016 14:50
my bad - it was on Release
now the whole thing looks different
Now it seems to try to compile things... and fails.
Dario Izzo
@darioizzo
May 05 2016 14:52
good progress though ...
Francesco Biscani
@bluescarni
May 05 2016 14:52
that's an improvement :) log?
Marcus Märtens
@CoolRunning
May 05 2016 14:52
linking errors
doesnt find the unit-test framework... damnit
but I also have 4 different versions of it
Francesco Biscani
@bluescarni
May 05 2016 14:53
can you paste it?
Marcus Märtens
@CoolRunning
May 05 2016 14:53
probably I picked the wrong one :worried:
Francesco Biscani
@bluescarni
May 05 2016 14:53
there's some hackish stuff in the CMakeLists.txt regarding the unit test library
Marcus Märtens
@CoolRunning
May 05 2016 14:53
Severity Code Description Project File Line Suppression State
Error LNK1104 cannot open file 'boost_unit_test_framework-vc140-mt-gd-1_60.lib' constrained C:\PaGMO\PaGMOreborn\build\tests\LINK 1
ah - wait
1>------ Build started: Project: constrained, Configuration: Debug x64 ------
2>------ Build started: Project: example0, Configuration: Debug x64 ------
3>------ Build started: Project: example0_gh, Configuration: Debug x64 ------
4>------ Build started: Project: generic, Configuration: Debug x64 ------
5>------ Build started: Project: hock_schittkowsky_71, Configuration: Debug x64 ------
6>------ Build started: Project: io, Configuration: Debug x64 ------
7>------ Build started: Project: multi_objective, Configuration: Debug x64 ------
8>------ Build started: Project: null_problem, Configuration: Debug x64 ------
1> Building Custom Rule C:/PaGMO/PaGMOreborn/tests/CMakeLists.txt
1> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tests\CMakeFiles\generate.stamp is up-to-date.
1> constrained.cpp
5> Building Custom Rule C:/PaGMO/PaGMOreborn/tests/CMakeLists.txt
3> Building Custom Rule C:/PaGMO/PaGMOreborn/tutorials/CMakeLists.txt
4> Building Custom Rule C:/PaGMO/PaGMOreborn/tests/CMakeLists.txt
5> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tests\CMakeFiles\generate.stamp is up-to-date.
2> Building Custom Rule C:/PaGMO/PaGMOreborn/tutorials/CMakeLists.txt
4> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tests\CMakeFiles\generate.stamp is up-to-date.
3> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tutorials\CMakeFiles\generate.stamp is up-to-date.
2> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tutorials\CMakeFiles\generate.stamp is up-to-date.
4> generic.cpp
5> hock_schittkowsky_71.cpp
3> example0_gh.cpp
6> Building Custom Rule C:/PaGMO/PaGMOreborn/tests/CMakeLists.txt
7> Building Custom Rule C:/PaGMO/PaGMOreborn/tests/CMakeLists.txt
6> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tests\CMakeFiles\generate.stamp is up-to-date.
7> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tests\CMakeFiles\generate.stamp is up-to-date.
2> example0.cpp
8> Building Custom Rule C:/PaGMO/PaGMOreborn/tests/CMakeLists.txt
8> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tests\CMakeFiles\generate.stamp is up-to-date.
6> io.cpp
7> multi_objective.cpp
8> null_problem.cpp
1>LINK : fatal error LNK1104: cannot open file 'boost_unit_test_framework-vc140-mt-gd-1_60.lib'
9>------ Build started: Project: population, Configuration: Debug x64 ------
9> Building Custom Rule C:/PaGMO/PaGMOreborn/tests/CMakeLists.txt
4>C:\PaGMO\PaGMOreborn\tests\generic.cpp(33): error C2143: syntax error: missing ';' before '<end Parse>'
9> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tests\CMakeFiles\generate.stamp is up-to-date.
6>LINK : fatal error LNK1104: cannot open file 'boost_unit_test_framework-vc140-mt-gd-1_60.lib'
4> c:\pagmo\pagmoreborn\include\utils../rng.hpp(24): note: while compiling class template static data member 'pagmo::detail::random_engine_type pagmo::detail::random_device_statics<void>::m_e'
4> c:\pagmo\pagmoreborn\include\utils../rng.hpp(57): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void>' being compiled
10>------ Build started: Project: problem, Configuration: Debug x64 ------
9> population.cpp
10> Building Custom Rule C:/PaGMO/PaGMOreborn/tests/CMakeLists.txt
10> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tests\CMakeFiles\generate.stamp is up-to-date.
7>LINK : fatal error LNK1104: cannot open file 'boost_unit_test_framework-vc140-mt-gd-1_60.lib'
11>------ Build started: Project: rng, Configuration: Debug x64 ------
12>------ Build started: Project: rosenbrock, Configuration: Debug x64 ------
10> problem.cpp
12> Building Custom Rule C:/PaGMO/PaGMOreborn/tests/CMakeLists.txt
12> CMake does not need to re-run because C:\PaGMO\PaGMOreborn\build\tests\CMakeFiles\generate.stamp is up-to-date.
12> rosenbrock.cpp
3> example0_gh.vcxproj -> C:\PaGMO\PaGMOreborn\build\tutorials\Debug\example0_gh.exe
3> example0_gh.vcxproj -> C:/PaGMO/PaGMOreborn/build/tutorials/Debug/example0_gh.pd
Francesco Biscani
@bluescarni
May 05 2016 14:54
cannot open file 'boost_unit_test_framework-vc140-mt-gd-1_60.lib'
Marcus Märtens
@CoolRunning
May 05 2016 14:54
aye
probably that is the one it wants
Francesco Biscani
@bluescarni
May 05 2016 14:55
in cmake you put the full path into the boost unit test library variable?
Marcus Märtens
@CoolRunning
May 05 2016 14:55
there are actually two variables
one for debug and one for release
now I put C:/Boost/boost_1_60_0/stage/lib/libboost_unit_test_framework-vc140-mt-gd-1_60.lib
before, it was something like sgd
mhh - still not working
Dario Izzo
@darioizzo
May 05 2016 14:58
same error?
Marcus Märtens
@CoolRunning
May 05 2016 14:58
yes
maybe there is something with the name wrong?
it complains about boost_unit_test_framework-vc140-mt-gd-1_60.lib
The actual filename is libboost_unit_test_framework-vc140-mt-gd-1_60.lib
Dario Izzo
@darioizzo
May 05 2016 14:59
which is what you point to right?
Marcus Märtens
@CoolRunning
May 05 2016 15:00
For both, DEBUG and RELEASE I do point to C:/Boost/boost_1_60_0/stage/lib/libboost_unit_test_framework-vc140-mt-gd-1_60.lib
Francesco Biscani
@bluescarni
May 05 2016 15:00
it might be because of MSVC auto linking support
supposedly MSVC is able to determine alone which libraries to link to
but it often does not work properly
Marcus Märtens
@CoolRunning
May 05 2016 15:01
I can try to point MSVC to the right direction
basically try adding BOOST_ALL_NO_LIB
Marcus Märtens
@CoolRunning
May 05 2016 15:03
k
Dario Izzo
@darioizzo
May 05 2016 15:03
@bluescarni I did something weird on the serialization of population. See the test that does not pass. Can you help?
It says that it does not find serialize, but its there ... I swear!!
Francesco Biscani
@bluescarni
May 05 2016 15:04
is it on the ci?
Dario Izzo
@darioizzo
May 05 2016 15:04
yes
just committed
Francesco Biscani
@bluescarni
May 05 2016 15:06
I guess the problem is the serialization of the rng not pop itself
Dario Izzo
@darioizzo
May 05 2016 15:06
right
Francesco Biscani
@bluescarni
May 05 2016 15:06
`note: in instantiation of function template specialization 'cereal::OutputArchive<cereal::JSONOutputArchive, 0>::processImpl<std::mersenne_twister_engine<unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>, 0>' requested here
I think I know how to do it
Dario Izzo
@darioizzo
May 05 2016 15:07
good because I do not :)
Ill wait then
Francesco Biscani
@bluescarni
May 05 2016 15:07
I'll do it when miriam comes back :)
Dario Izzo
@darioizzo
May 05 2016 15:08
k
Francesco Biscani
@bluescarni
May 05 2016 15:08
typing one handed with ben snaking around on my lap
Dario Izzo
@darioizzo
May 05 2016 15:08
let him type !!!
Then you will one day teach me how come you can parse a wall of text like the one of the failed build and extract the relevant line .....
Francesco Biscani
@bluescarni
May 05 2016 15:11
7 b bn ni v bbj 2 c c xsssssssr h b v byb d
Dario Izzo
@darioizzo
May 05 2016 15:11
Ciao Ben!!!
Francesco Biscani
@bluescarni
May 05 2016 15:11
I'll commit this code
Marcus Märtens
@CoolRunning
May 05 2016 15:11
cute! :smile:
Dario Izzo
@darioizzo
May 05 2016 15:12
afk for sometime, later ...
Marcus Märtens
@CoolRunning
May 05 2016 15:12
I am still searching for the user.hpp - it is not were you would expect it...
ah
found it ^^
Defining BOOST_TEST_NO_LIB in user.hpp worked
Now it fails on different matters
Francesco Biscani
@bluescarni
May 05 2016 15:18
log?
Marcus Märtens
@CoolRunning
May 05 2016 15:19
I might have built 32-bit boost? I am not sure...
1>------ Build started: Project: constrained, Configuration: Debug x64 ------
2>------ Build started: Project: generic, Configuration: Debug x64 ------
3>------ Build started: Project: hock_schittkowsky_71, Configuration: Debug x64 ------
4>------ Build started: Project: io, Configuration: Debug x64 ------
5>------ Build started: Project: multi_objective, Configuration: Debug x64 ------
6>------ Build started: Project: null_problem, Configuration: Debug x64 ------
7>------ Build started: Project: population, Configuration: Debug x64 ------
8>------ Build started: Project: problem, Configuration: Debug x64 ------
7> population.cpp
1> constrained.cpp
3> hock_schittkowsky_71.cpp
4> io.cpp
6> null_problem.cpp
5> multi_objective.cpp
2> generic.cpp
8> problem.cpp
1>constrained.obj : error LNK2019: unresolved external symbol "declspec(dllimport) public: static class boost::unit_test::unit_test_log_t & cdecl boost::unittest::singleton<class boost::unit_test::unit_test_log_t>::instance(void)" (__imp?instance@?$singleton@Vunit_test_log_t@unit_test@boost@@@unit_test@boost@@SAAEAVunit_test_log_t@23@XZ) referenced in function "void cdecl boost::unit_test::anonymous namespace'::dynamic initializer for 'unit_test_log''(void)" (??Eunit_test_log@?A0x4861179a@unit_test@boost@@YAXXZ)
1>constrained.obj : error LNK2019: unresolved external symbol "declspec(dllimport) public: void cdecl boost::unittest::unit_test_log_t::set_checkpoint(class boost::unit_test::basic_cstring<char const >,unsigned int64,class boost::unit_test::basic_cstring<char const >)" (imp?set_checkpoint@unit_test_log_t@unit_test@boost@@QEAAXV?$basic_cstring@
KaTeX parse error: Expected group after '_' at position 52: "public: void _̲_cdecl sort_po: CBD@23@_K0@Z) referenced in function "public: void __cdecl sort_population_con_test::test_method(void)" (?test_method@sort_population_con_test@@QEAAXXZ)
1>constrained.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::test_tools::assertion_result::assertion_result(bool)" (__imp_??0assertion_result@test_tools@boost@@QEAA@_N@Z) referenced in function "public: void __cdecl sort_population_con_test::test_method(void)" (?test_method@sort_population_con_test@@QEAAXXZ)
1>constrained.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::test_tools::assertion_result::~assertion_result(void)" (__imp_??1assertion_result@test_tools@boost@@QEAA@XZ) referenced in function "public: void __cdecl sort_population_con_test::test_method(void)" (?test_method@sort_population_con_test@@QEAAXXZ)
1>constrained.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) bool __cdecl boost::test_tools::tt_detail::report_assertion(class boost::test_tools::assertion_result const &,class boost::unit_test::lazy_ostream const &,class boost::unit_test::basic_cstring,unsigned __int64,enum boost::test_tools::tt_detail::tool_level,enum boost::test_tools::tt_detail::check_type,unsigned __int64,...)" (__imp_?report_assertion@tt_detail@test_tools@boost@@YA_NAEBVassertion_result@23@AEBVlazy_ostream@unit_test@3@V?$basic_cstring@
CBD@63@_KW4tool_level@123@W4check_type@123@3ZZ) referenced in function "public: void __cdecl sort_population_con_test::test_method(void)" (?test_method@sort_population_con_test@@QEAAXXZ)
Uhh.. isn't there a more convenient way to paste logs here?
Anyway, it says: 1>C:\Boost\boost_1_60_0\stage\lib\libboost_unit_test_framework-vc140-mt-gd-1_60.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'
That is troublesome... maybe I should compile 64bit?
Francesco Biscani
@bluescarni
May 05 2016 15:20
you can paste walls of log by closing them into triple backticks "```"
so I think there might be 2 things here, first the 64bit vs 32bit stuff
the second is that the unit test lib you compiled seems to be static but in the build system we assume it's dynamic
Marcus Märtens
@CoolRunning
May 05 2016 15:22
so basically I should compile dynamic 64bit boost libraries, correct?
Francesco Biscani
@bluescarni
May 05 2016 15:22
for the dynamic vs static stuff you can try to comment out this line: https://gitlab.com/EuropeanSpaceAgency/PaGMOreborn/blob/master/tests/CMakeLists.txt#L3
actually you could try this right now to see if anything changes
Marcus Märtens
@CoolRunning
May 05 2016 15:24
on it
Marcus Märtens
@CoolRunning
May 05 2016 15:24
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------ 2>------ Build started: Project: constrained, Configuration: Debug x64 ------ 3>------ Build started: Project: generic, Configuration: Debug x64 ------ 4>------ Build started: Project: hock_schittkowsky_71, Configuration: Debug x64 ------ 5>------ Build started: Project: io, Configuration: Debug x64 ------ 6>------ Build started: Project: multi_objective, Configuration: Debug x64 ------ 7>------ Build started: Project: null_problem, Configuration: Debug x64 ------ 8>------ Build started: Project: population, Configuration: Debug x64 ------ 9>------ Build started: Project: problem, Configuration: Debug x64 ------ 2> constrained.cpp 3> generic.cpp 4> hock_schittkowsky_71.cpp 9> problem.cpp 8> population.cpp 5> io.cpp 7> null_problem.cpp 6> multi_objective.cpp 2>libboost_unit_test_framework-vc140-mt-gd-1_60.lib(test_tree.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' 10>------ Build started: Project: rng, Configuration: Debug x64 ------ 3>C:\PaGMO\PaGMOreborn\tests\generic.cpp(33): error C2143: syntax error: missing ';' before '<end Parse>' 3> c:\pagmo\pagmoreborn\include\utils\../rng.hpp(24): note: while compiling class template static data member 'pagmo::detail::random_engine_type pagmo::detail::random_device_statics<void>::m_e' 3> c:\pagmo\pagmoreborn\include\utils\../rng.hpp(57): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void>' being compiled 5>libboost_unit_test_framework-vc140-mt-gd-1_60.lib(test_tree.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' 10> rng.cpp 11>------ Build started: Project: rosenbrock, Configuration: Debug x64 ------ 6>libboost_unit_test_framework-vc140-mt-gd-1_60.lib(test_tree.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' 12>------ Build started: Project: translate, Configuration: Debug x64 ------ 8>c:\pagmo\pagmoreborn\tests\../include/problems/rosenbrock.hpp(44): warning C4244: 'argument': conversion from 'double' to 'unsigned __int64', possible loss of data 7>c:\pagmo\pagmoreborn\include\problems\../problem.hpp(558): warning C4800: 'const pagmo::null_problem *': forcing value to bool 'true' or 'false' (performance warning) 7> C:\PaGMO\PaGMOreborn\tests\null_problem.cpp(46): note: see reference to function template instantiation 'bool pagmo::problem::is<pagmo::null_problem>(void) const' being compiled 9>c:\pagmo\pagmoreborn\tests\../include/problem.hpp(558): warning C4800: 'const base_p *': forcing value to bool 'true' or 'false' (performance warning) 9> C:\PaGMO\PaGMOreborn\tests\problem.cpp(486): note: see reference to function template instantiation 'bool pagmo::problem::is<base_p>(void) const' being compiled 9>c:\pagmo\pagmoreborn\tests\../include/problem.hpp(558): warning C4800: 'const full_p *': forcing value to bool 'true' or 'false' (performance warning) 9> C:\PaGMO\PaGMOreborn\tests\problem.cpp(487): note: see reference to function template instantiation 'bool pagmo::problem::is<full_p>(void) const' being compiled 8>C:\PaGMO\PaGMOreborn\tests\population.cpp(95): error C2143: syntax error: missing ';' before '<end Parse>' 8> c:\pagmo\pagmoreborn\include\rng.hpp(24): note: while compiling class template static data member 'pagmo::detail::random_engine_type pagmo::detail::random_device_statics<void>::m_e' 8> c:\pagmo\pagmoreborn\include\rng.hpp(57): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void>' being compiled 10>C:\PaGMO\PaGMOreborn\tests\rng.cpp(56): error C2143: syntax error: missing ';' before '<end Parse>'
Francesco Biscani
@bluescarni
May 05 2016 15:25
try to put a newline
before and after the first and last line of the code block
like this
dssd
sadsad
\`\`\`
I meant this
\`\`\`
well you get it :)
Marcus Märtens
@CoolRunning
May 05 2016 15:26
the hell?
test
Francesco Biscani
@bluescarni
May 05 2016 15:26
can you repaste that log formatted better?
Marcus Märtens
@CoolRunning
May 05 2016 15:27
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
2>------ Build started: Project: constrained, Configuration: Debug x64 ------
3>------ Build started: Project: generic, Configuration: Debug x64 ------
4>------ Build started: Project: hock_schittkowsky_71, Configuration: Debug x64 ------
5>------ Build started: Project: io, Configuration: Debug x64 ------
6>------ Build started: Project: multi_objective, Configuration: Debug x64 ------
7>------ Build started: Project: null_problem, Configuration: Debug x64 ------
8>------ Build started: Project: population, Configuration: Debug x64 ------
9>------ Build started: Project: problem, Configuration: Debug x64 ------
2>  constrained.cpp
3>  generic.cpp
4>  hock_schittkowsky_71.cpp
9>  problem.cpp
8>  population.cpp
5>  io.cpp
7>  null_problem.cpp
6>  multi_objective.cpp
2>libboost_unit_test_framework-vc140-mt-gd-1_60.lib(test_tree.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
10>------ Build started: Project: rng, Configuration: Debug x64 ------
3>C:\PaGMO\PaGMOreborn\tests\generic.cpp(33): error C2143: syntax error: missing ';' before '<end Parse>'
3>  c:\pagmo\pagmoreborn\include\utils\../rng.hpp(24): note: while compiling class template static data member 'pagmo::detail::random_engine_type pagmo::detail::random_device_statics<void>::m_e'
3>  c:\pagmo\pagmoreborn\include\utils\../rng.hpp(57): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void>' being compiled
5>libboost_unit_test_framework-vc140-mt-gd-1_60.lib(test_tree.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
10>  rng.cpp
11>------ Build started: Project: rosenbrock, Configuration: Debug x64 ------
6>libboost_unit_test_framework-vc140-mt-gd-1_60.lib(test_tree.obj) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
12>------ Build started: Project: translate, Configuration: Debug x64 ------
8>c:\pagmo\pagmoreborn\tests\../include/problems/rosenbrock.hpp(44): warning C4244: 'argument': conversion from 'double' to 'unsigned __int64', possible loss of data
7>c:\pagmo\pagmoreborn\include\problems\../problem.hpp(558): warning C4800: 'const pagmo::null_problem *': forcing value to bool 'true' or 'false' (performance warning)
7>  C:\PaGMO\PaGMOreborn\tests\null_problem.cpp(46): note: see reference to function template instantiation 'bool pagmo::problem::is<pagmo::null_problem>(void) const' being compiled
9>c:\pagmo\pagmoreborn\tests\../include/problem.hpp(558): warning C4800: 'const base_p *': forcing value to bool 'true' or 'false' (performance warning)
9>  C:\PaGMO\PaGMOreborn\tests\problem.cpp(486): note: see reference to function template instantiation 'bool pagmo::problem::is<base_p>(void) const' being compiled
9>c:\pagmo\pagmoreborn\tests\../include/problem.hpp(558): warning C4800: 'const full_p *': forcing value to bool 'true' or 'false' (performance warning)
9>  C:\PaGMO\PaGMOreborn\tests\problem.cpp(487): note: see reference to function template instantiation 'bool pagmo::problem::is<full_p>(void) const' being compiled
8>C:\PaGMO\PaGMOreborn\tests\population.cpp(95): error C2143: syntax error: missing ';' before '<end Parse>'
8>  c:\pagmo\pagmoreborn\include\rng.hpp(24): note: while compiling class template static data member 'pagmo::detail::random_engine_type pagmo::detail::random_device_statics<void>::m_e'
8>  c:\pagmo\pagmoreborn\include\rng.hpp(57): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void>' being compiled
10>C:\PaGMO\PaGMOreborn\tests\rng.cpp(56): error C2143: syntax error: missing ';' before '<end Parse>'
10>  c:\pagmo\pagmoreborn\tests\../include/rng.hpp(24): note: while compiling class template static data member 'pagmo::detail::random_engine_type pagmo::detail::random_device_statics<void>::m_e'
10>  c:\pagmo\pagmoreborn\tests\../include/rng.hpp(57): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void
Francesco Biscani
@bluescarni
May 05 2016 15:27
yay
ok so the missing symbols seem gone
that's good
Marcus Märtens
@CoolRunning
May 05 2016 15:27
aye... fatal error is now the 64bit thingy
Francesco Biscani
@bluescarni
May 05 2016 15:27
next is the x86 vs x64 stuff
Marcus Märtens
@CoolRunning
May 05 2016 15:27
So I recompile boost
Francesco Biscani
@bluescarni
May 05 2016 15:27
yeah plus some booyah in our code as well
Marcus Märtens
@CoolRunning
May 05 2016 15:27
probably delete the whole stage directory?
Francesco Biscani
@bluescarni
May 05 2016 15:27
I can look into that
Marcus Märtens
@CoolRunning
May 05 2016 15:28
to be safe?
Francesco Biscani
@bluescarni
May 05 2016 15:28
the built libraries should be split into different dirs and have different names when you recompile them in 64 bit, but if you want to be 100% sure you can wipe everything
Marcus Märtens
@CoolRunning
May 05 2016 15:28
the only option I should need is address-model=64 if I understand correctly?
Francesco Biscani
@bluescarni
May 05 2016 15:29
yeah, you could add other options to limit compilation to boost unit test rather than all libs
Marcus Märtens
@CoolRunning
May 05 2016 15:29
sort of feel uneasy if there is 32bit-stuff laying around
Francesco Biscani
@bluescarni
May 05 2016 15:29
sure ok
Marcus Märtens
@CoolRunning
May 05 2016 15:33
I managed to tell him only to compile test
Francesco Biscani
@bluescarni
May 05 2016 15:36
nice
Marcus Märtens
@CoolRunning
May 05 2016 15:37
1>------ Build started: Project: constrained, Configuration: Debug x64 ------
2>------ Build started: Project: generic, Configuration: Debug x64 ------
3>------ Build started: Project: hock_schittkowsky_71, Configuration: Debug x64 ------
4>------ Build started: Project: io, Configuration: Debug x64 ------
5>------ Build started: Project: multi_objective, Configuration: Debug x64 ------
6>------ Build started: Project: null_problem, Configuration: Debug x64 ------
7>------ Build started: Project: population, Configuration: Debug x64 ------
8>------ Build started: Project: problem, Configuration: Debug x64 ------
2>  generic.cpp
7>  population.cpp
6>     Creating library C:/PaGMO/PaGMOreborn/build/tests/Debug/null_problem.lib and object C:/PaGMO/PaGMOreborn/build/tests/Debug/null_problem.exp
3>     Creating library C:/PaGMO/PaGMOreborn/build/tests/Debug/hock_schittkowsky_71.lib and object C:/PaGMO/PaGMOreborn/build/tests/Debug/hock_schittkowsky_71.exp
8>     Creating library C:/PaGMO/PaGMOreborn/build/tests/Debug/problem.lib and object C:/PaGMO/PaGMOreborn/build/tests/Debug/problem.exp
4>  io.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\io.exe
4>  io.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/io.pdb (Full PDB)
5>  multi_objective.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\multi_objective.exe
5>  multi_objective.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/multi_objective.pdb (Full PDB)
1>  constrained.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\constrained.exe
1>  constrained.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/constrained.pdb (Full PDB)
9>------ Build started: Project: rng, Configuration: Debug x64 ------
10>------ Build started: Project: rosenbrock, Configuration: Debug x64 ------
11>------ Build started: Project: translate, Configuration: Debug x64 ------
9>  rng.cpp
2>C:\PaGMO\PaGMOreborn\tests\generic.cpp(33): error C2143: syntax error: missing ';' before '<end Parse>'
2>  c:\pagmo\pagmoreborn\include\utils\../rng.hpp(24): note: while compiling class template static data member 'pagmo::detail::random_engine_type pagmo::detail::random_device_statics<void>::m_e'
2>  c:\pagmo\pagmoreborn\include\utils\../rng.hpp(57): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void>' being compiled
10>     Creating library C:/PaGMO/PaGMOreborn/build/tests/Debug/rosenbrock.lib and object C:/PaGMO/PaGMOreborn/build/tests/Debug/rosenbrock.exp
11>     Creating library C:/PaGMO/PaGMOreborn/build/tests/Debug/translate.lib and object C:/PaGMO/PaGMOreborn/build/tests/Debug/translate.exp
6>  null_problem.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\null_problem.exe
6>  null_problem.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/null_problem.pdb (Full PDB)
3>  hock_schittkowsky_71.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\hock_schittkowsky_71.exe
3>  hock_schittkowsky_71.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/hock_schittkowsky_71.pdb (Full PDB)
12>------ Build started: Project: type_traits, Configuration: Debug x64 ------
13>------ Build started: Project: zdt, Configuration: Debug x64 ------
7>c:\pagmo\pagmoreborn\tests\../include/problems/rosenbrock.hpp(44): warning C4244: 'argument': conversion from 'double' to 'unsigned __int64', possible loss of data
8>  problem.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\problem.exe
8>  problem.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/problem.pdb (Full PDB)
13>     Creating library C:/PaGMO/PaGMOreborn/build/tests/Debug/zdt.lib and object C:/PaGMO/PaGMOreborn/build/tests/Debug/zdt.exp
7>C:\PaGMO\PaGMOreborn\tests\population.cpp(95): error C2143: syntax error: missing ';' before '<end Parse>'
7>  c:\pagmo\pagmoreborn\include\rng.hpp(24): note: while compiling class template static data member 'pagmo::detail::random_engine_type pagmo::detail::random_device_statics<void>::m_e'
7>  c:\pagmo\pagmoreborn\include\rng.hpp(57): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void>' being compiled
9>C:\PaGMO\PaGMOreborn\tests\rng.cpp(56)
9>C:\PaGMO\PaGMOreborn\tests\rng.cpp(56): error C2143: syntax error: missing ';' before '<end Parse>'
9>  c:\pagmo\pagmoreborn\tests\../include/rng.hpp(24): note: while compiling class template static data member 'pagmo::detail::random_engine_type pagmo::detail::random_device_statics<void>::m_e'
9>  c:\pagmo\pagmoreborn\tests\../include/rng.hpp(57): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void>' being compiled
12>  type_traits.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\type_traits.exe
12>  type_traits.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/type_traits.pdb (Full PDB)
10>  rosenbrock.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\rosenbrock.exe
10>  rosenbrock.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/rosenbrock.pdb (Full PDB)
11>  translate.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\translate.exe
11>  translate.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/translate.pdb (Full PDB)
13>  zdt.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\zdt.exe
13>  zdt.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/zdt.pdb (Full PDB)
========== Build: 10 succeeded, 3 failed, 4 up-to-date, 0 skipped ==========
Syntax errors?
Francesco Biscani
@bluescarni
May 05 2016 15:37
I was looking into them but they look fishy... can you try something?
C:\PaGMO\PaGMOreborn\tests\generic.cpp(33): error C2143: syntax error: missing ';' before '<end Parse>' like adding the ; here at the end
Marcus Märtens
@CoolRunning
May 05 2016 15:38
at the end of the file?
Francesco Biscani
@bluescarni
May 05 2016 15:39
yeah
ah wait
Marcus Märtens
@CoolRunning
May 05 2016 15:39
same error
Francesco Biscani
@bluescarni
May 05 2016 15:40
it seems actually that it is misleading
Marcus Märtens
@CoolRunning
May 05 2016 15:40
I was wondering about this syntax in braces {{}} as well
Francesco Biscani
@bluescarni
May 05 2016 15:41
try replacing random_engine_type random_device_statics<dummy>::m_e{static_cast<random_engine_type::result_type>(std::random_device{}())}; with:
Marcus Märtens
@CoolRunning
May 05 2016 15:41
Is this something new?
Francesco Biscani
@bluescarni
May 05 2016 15:41
random_engine_type random_device_statics<dummy>::m_e(static_cast<random_engine_type::result_type>(std::random_device()()));
yeah C++11 uniform initialisation syntax
Marcus Märtens
@CoolRunning
May 05 2016 15:42
I have also seen it in example0.cpp
Francesco Biscani
@bluescarni
May 05 2016 15:42
basically replace the curly brackets with round ones
Marcus Märtens
@CoolRunning
May 05 2016 15:43
I will try
there is still a ";"-error in rng.cpp
maybe I should change the curlies in rng.cpp?
std::thread t1([&]() {std::generate_n(std::back_inserter(prs4),N,random_device::next);});
into normal parenthesis?
Francesco Biscani
@bluescarni
May 05 2016 15:46
no this is a lambda function
it needs the curlies
what is the error message now?
Marcus Märtens
@CoolRunning
May 05 2016 15:47
3>C:\PaGMO\PaGMOreborn\tests\rng.cpp(56): error C2143: syntax error: missing ';' before '<end Parse>'
3>  c:\pagmo\pagmoreborn\tests\../include/rng.hpp(28): note: while compiling class template static data member 'std::mutex pagmo::detail::random_device_statics<void>::m_mutex'
3>  c:\pagmo\pagmoreborn\tests\../include/rng.hpp(58): note: see reference to class template instantiation 'pagmo::detail::random_device_statics<void>' being compiled
Francesco Biscani
@bluescarni
May 05 2016 15:47
std::mutex random_device_statics<dummy>::m_mutex{};
on line 28
replace with
std::mutex random_device_statics<dummy>::m_mutex;
curlies are not even needed here
Marcus Märtens
@CoolRunning
May 05 2016 15:50
We are getting there
1>------ Build started: Project: generic, Configuration: Debug x64 ------
2>------ Build started: Project: population, Configuration: Debug x64 ------
3>------ Build started: Project: rng, Configuration: Debug x64 ------
3>  rng.cpp
2>  population.cpp
1>  generic.cpp
2>c:\pagmo\pagmoreborn\tests\../include/problems/rosenbrock.hpp(44): warning C4244: 'argument': conversion from 'double' to 'unsigned __int64', possible loss of data
3>  rng.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\rng.exe
3>  rng.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/rng.pdb (Full PDB)
1>  generic.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\generic.exe
1>  generic.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/generic.pdb (Full PDB)
2>     Creating library C:/PaGMO/PaGMOreborn/build/tests/Debug/population.lib and object C:/PaGMO/PaGMOreborn/build/tests/Debug/population.exp
2>  population.vcxproj -> C:\PaGMO\PaGMOreborn\build\tests\Debug\population.exe
2>  population.vcxproj -> C:/PaGMO/PaGMOreborn/build/tests/Debug/population.pdb (Full PDB)
========== Build: 3 succeeded, 0 failed, 14 up-to-date, 0 skipped ==========
RUN_TESTS now has 15 tests, all passing :)
Francesco Biscani
@bluescarni
May 05 2016 15:52
yay
there's a legit warning in there, I can fix it here
can you to a clean re-build and repost the output
there were some warnings I wanted to look at
Marcus Märtens
@CoolRunning
May 05 2016 15:54
okay, one second
this is too large to paste it - are you fine with paste-bin?
Francesco Biscani
@bluescarni
May 05 2016 15:55
I use this usually: https://gist.github.com/
but anything works
if you paste the link to gist here it should pretty print it
Francesco Biscani
@bluescarni
May 05 2016 15:57
thanks I'll go through it once I have more than 20 seconds of time :)
you should commit everything apart from the cmakelists change
that one I need to fix it properly
Marcus Märtens
@CoolRunning
May 05 2016 15:59
okay - will do
done
Francesco Biscani
@bluescarni
May 05 2016 16:07
:+1:
Dario Izzo
@darioizzo
May 05 2016 16:44
warning in rosenbrock(44) fixed
Francesco Biscani
@bluescarni
May 05 2016 17:41
so I gave it a go to the rng serialization
seems to work here at least
Dario Izzo
@darioizzo
May 05 2016 19:40
you are on a roll :) !!
Can you explain me the back_inserter use instead of the begin() ?
Francesco Biscani
@bluescarni
May 05 2016 19:40
yes and I have a list of grievances :)
it's just stylistic, maybe slightly better because you don't re-init the same stuff twice
Dario Izzo
@darioizzo
May 05 2016 19:42
what does it do? why does it exist?
Francesco Biscani
@bluescarni
May 05 2016 19:43
to allow you to use various algorithms on containers which are initially empty
Dario Izzo
@darioizzo
May 05 2016 19:43
ah ok so you removed the init too?
Francesco Biscani
@bluescarni
May 05 2016 19:43
yes
Dario Izzo
@darioizzo
May 05 2016 19:44
right .. lost that ... and why is it preferrable?
Francesco Biscani
@bluescarni
May 05 2016 19:44
if you do std::vector(10) and then you copy in stuff, you end up initing the contents of the vector twice
first you construct default elements and then you assign new values to the elements
Dario Izzo
@darioizzo
May 05 2016 19:45
true but I make less allocations right?
I mean memory. If I keep inserting I will do at least two ... maybe more
Francesco Biscani
@bluescarni
May 05 2016 19:45
it depends on the implementation, but you can always avoid that by calling reserve on the vector
Dario Izzo
@darioizzo
May 05 2016 19:46
so the "suggested" way would be to reserve and then push_back (or back insert) ?
Francesco Biscani
@bluescarni
May 05 2016 19:47
in general yes, I doubt it makes any difference as long as you are just storing ints or doubles
Dario Izzo
@darioizzo
May 05 2016 19:47
k, now you can grieve :)
Francesco Biscani
@bluescarni
May 05 2016 19:47
:)
so first thing is the const_cast
Dario Izzo
@darioizzo
May 05 2016 19:48
right .... why not?
Francesco Biscani
@bluescarni
May 05 2016 19:48
that's not something you are supposed to use ever
Dario Izzo
@darioizzo
May 05 2016 19:48
but if I want a const data member .. ?
Francesco Biscani
@bluescarni
May 05 2016 19:48
unless under very peculiar conidtions
it's undefined behaviour to write into anything that's declared const
no matter how you remove the const qualifier
const_cast, C-style cast, reinterpret_cast
all UB
Dario Izzo
@darioizzo
May 05 2016 19:49
so how do I serialize const members?
Francesco Biscani
@bluescarni
May 05 2016 19:49
you can deserialize only stuff which is not const, at least when you have value semantics (it might be different if you have base pointers and the likes but let's forget about it)
the serialization function take all non-const references for deserializing
in the same way an assignment operator needs non-const
same thing
Dario Izzo
@darioizzo
May 05 2016 19:50
So if I serialize I cannot have a const data member?
Francesco Biscani
@bluescarni
May 05 2016 19:50
a = 5 -> a HAS to be non-const
yes that's correct
Dario Izzo
@darioizzo
May 05 2016 19:51
I never really cared about const correctness ... but I though it was important to some people . Feels weird to change the class because I need to serialize it ... but ok .. even better for me
Francesco Biscani
@bluescarni
May 05 2016 19:51
the fact that you don't care does not mean it's not important :) and the misuse of const_cast has nothing to do with const-correctness, it's just UB
you have to think that the requirement of being able to deserialize is the same as being able to assign values to a variable
Dario Izzo
@darioizzo
May 05 2016 19:52
Well if I have a class with a const data member and its const for a good reason, then I have to betray this good reason only because I use serialization
Francesco Biscani
@bluescarni
May 05 2016 19:52
you cannot write const int a; if then you intend to write into a no?
either you have to write into a class or you don't, it's just that
Dario Izzo
@darioizzo
May 05 2016 19:53
no const data member is good for me ... never liked those
Francesco Biscani
@bluescarni
May 05 2016 19:53
you could argue that serialization should be done in a way in which you create a new object instead of writing into an exitising one, and that's a fair point
but that's what we have to live with the libraries we use
anyway, the point is, don't ever ever use const_cast again, otherwise I'll haunt your dreams
Dario Izzo
@darioizzo
May 05 2016 19:55
my perfect header file:
using std;
class A {
    A() {const_cast<double&>(3);}
}
Francesco Biscani
@bluescarni
May 05 2016 19:56
now speaking of std...
Dario Izzo
@darioizzo
May 05 2016 19:56
std::sin ... etc.
yes I know
thats all you got?
Francesco Biscani
@bluescarni
May 05 2016 19:56
try me :)
next up, exception safety
Marcus Märtens
@CoolRunning
May 05 2016 19:57
What do you mean by "UB"?
Dario Izzo
@darioizzo
May 05 2016 19:57
Undefined Behaviour, what else
Francesco Biscani
@bluescarni
May 05 2016 19:57
it's dario's worst enemy
Marcus Märtens
@CoolRunning
May 05 2016 19:57
I will not use const_cast, don't worry... I wouldn't even know why I would use it the first place.
Francesco Biscani
@bluescarni
May 05 2016 19:57
:)
what's wrong in this code?
        void push_back(const vector_double &x)
        {
            auto new_id = std::uniform_int_distribution<unsigned long long>()(m_e);
            m_ID.push_back(new_id);
            m_x.push_back(x);
            m_f.push_back(m_prob.fitness(x));
        }
Marcus Märtens
@CoolRunning
May 05 2016 19:58
Ahhh... that old buddy which Francesco does not want in the house... I see...
Dario Izzo
@darioizzo
May 05 2016 19:58
We could use emplace?
and the assignment could become a construction?
Francesco Biscani
@bluescarni
May 05 2016 19:59
no, emplace in this case would be the same
what happens if m_prob.fitness(x) throws an exception?
Dario Izzo
@darioizzo
May 05 2016 19:59
thats the program halts?
Francesco Biscani
@bluescarni
May 05 2016 20:00
not if you are in python, or if you catch the exception
Marcus Märtens
@CoolRunning
May 05 2016 20:00
then m_x will still have that faulty x in it?
Francesco Biscani
@bluescarni
May 05 2016 20:00
yep... m_ID and m_x will have their size increased while m_f will be unmodified
and the population is left in an inconsistent state
Dario Izzo
@darioizzo
May 05 2016 20:01
bingo!!!
Francesco Biscani
@bluescarni
May 05 2016 20:01
we should have the "UB bingo"
Marcus Märtens
@CoolRunning
May 05 2016 20:02
awesome
Dario Izzo
@darioizzo
May 05 2016 20:02
well spotted though ... this one was tricky
who is the idiot that wrote it?
Marcus Märtens
@CoolRunning
May 05 2016 20:03
btw: I am still reading up tutorials and stuff, refreshing my shaky C++ basic knowledge to avoid humiliating myself too much.
Francesco Biscani
@bluescarni
May 05 2016 20:03
I don't think I ever bothered you about exception safety but I guess it's time to start :)
so what are the things in that snippet that can throw?
Dario Izzo
@darioizzo
May 05 2016 20:03
@CoolRunning there is nothing like being humiliated by Franceso's code reviews
Francesco Biscani
@bluescarni
May 05 2016 20:03
in addition to the fitness calculation
Dario Izzo
@darioizzo
May 05 2016 20:03
Even better than a ranked match at Dota!
Francesco Biscani
@bluescarni
May 05 2016 20:03
humiliated
really :)
Marcus Märtens
@CoolRunning
May 05 2016 20:04
^^
There can be more things that throw stuff?
push_back(x)!
maybe x is something really weird?
Francesco Biscani
@bluescarni
May 05 2016 20:05
that is correct.. the push back can fail 2 times actually
1) allocation of the extra space needed for the new element
2) copy of x (which is itself a vector and thus its copy can throw)
so the general idea is that whenever you have some properties of consistency that you want to maintain in your class, you need to implement mutable methods in such a way that when you modify the data members of the class you must do it in a way that cannot throw exceptions
so basically you divide the method into 2 parts: the first that can throw but does not modify anything, the second that does not throw and which does the actual modifcation
so in pseudo code something like that:
Marcus Märtens
@CoolRunning
May 05 2016 20:08
I would never have imagined these sort of problems.
Dario Izzo
@darioizzo
May 05 2016 20:09
Its a problem in population because we want to keep m_f, m_x and m_ID with the same size and consistent ...
Francesco Biscani
@bluescarni
May 05 2016 20:09
        void push_back(const vector_double &x)
        {
            // Part 1.
            auto new_id = std::uniform_int_distribution<unsigned long long>()(m_e);
            auto x_copy(x);
            auto fitness = m_prob.fitness(x);
            m_ID.reserve(m_ID.size() + 1u);
            m_x.reserve(m_x.size() + 1u);
            m_f.reserve(m_f.size() + 1u);
            // Part 2.
            m_ID.push_back(new_id);
            m_x.push_back(std::move(x));
            m_f.push_back(std::move(fitness));
        }
Marcus Märtens
@CoolRunning
May 05 2016 20:09
so this only happens if you have multiple data-members that are somewhat related to each other, right?
Francesco Biscani
@bluescarni
May 05 2016 20:09
yep
Dario Izzo
@darioizzo
May 05 2016 20:10
Francesco's pseudo codes usually compile !!! :)
Marcus Märtens
@CoolRunning
May 05 2016 20:10
how handy?
Dario Izzo
@darioizzo
May 05 2016 20:11
Can you make the modification and push? or shall I?
Marcus Märtens
@CoolRunning
May 05 2016 20:11
wow, so this is really careful coding... looks weird, but makes sense... oO
Francesco Biscani
@bluescarni
May 05 2016 20:11
I can do it, I just wanted to introduce this stuff so we can pre-empt it :)
Dario Izzo
@darioizzo
May 05 2016 20:12
Yes I know, I think I got it ...
Francesco Biscani
@bluescarni
May 05 2016 20:12
this is something useful to know in general I think, other languages like Python, Java, etc. all have the same problem
Dario Izzo
@darioizzo
May 05 2016 20:12
write Part 1. throw, Part 2. no throw
Francesco Biscani
@bluescarni
May 05 2016 20:12
yep
Dario Izzo
@darioizzo
May 05 2016 20:12
as comments
k
Francesco Biscani
@bluescarni
May 05 2016 20:15
so sometimes it is possible to do as above, that provides the strong exception safety guarantee
that is, in case of exceptions, it is as-if the method had never been invoked
it's not always possible to provide the strong guarantee, sometimes you can only do the basic
that is, in face of exceptions your object is in an undefined but valid state
that should be the bare minimum
Dario Izzo
@darioizzo
May 05 2016 20:17
depends on what is the definition of valid
Francesco Biscani
@bluescarni
May 05 2016 20:17
it usually means that you cannot assume anything about the properties of the object, and that you need to query it in order to know them
but still the object is usable, in the sense that it does not break any of its invariants
Dario Izzo
@darioizzo
May 05 2016 20:18
right ok ....
so here we are guaranteeing that the object is unmodified
Francesco Biscani
@bluescarni
May 05 2016 20:19
in the case of population an invariant which is probably assumed throughout the code is that the three internal vectors have the same size
yes
in this case what we are doing is cheap, so it's good to offer the strong guarantee
Dario Izzo
@darioizzo
May 05 2016 20:20
k got it!!
Francesco Biscani
@bluescarni
May 05 2016 20:20
a form of basic guarantee in this case would be that, inside the body of the method, we catch any exception, erase all vectors, and the re-throw the exception
in that case the exception raising would have modified the internal state of the population, but the pop object would still be usuable because the invariant would still be satisfied
you would just need to query it to know its new state
Dario Izzo
@darioizzo
May 05 2016 20:22
I think its a good lesson to learn, but I also think for this class is not super crucial
Francesco Biscani
@bluescarni
May 05 2016 20:22
it's part of the requirement to make it impossible to crash the C++ code from python
Dario Izzo
@darioizzo
May 05 2016 20:23
Agreed
Marcus Märtens
@CoolRunning
May 05 2016 20:23
So if you want to use C++ code in Python, you better make sure it has this notion of strong safety?
Francesco Biscani
@bluescarni
May 05 2016 20:25
the stronger safety the better, in general... the idea here is that no matter how shitty of a problem is implemented in Python, the C++ code should be robust enough to issue reasonable error messages and not crash due to segmentation faults and the likes
Dario Izzo
@darioizzo
May 05 2016 20:25
btw did you recheck now the test coverage?
I am curious to see what I forgot
Francesco Biscani
@bluescarni
May 05 2016 20:26
I was trying to set the automatic check, but the website is having issues atm
Dario Izzo
@darioizzo
May 05 2016 20:26
which website?
Francesco Biscani
@bluescarni
May 05 2016 20:26
codecov.io
Dario Izzo
@darioizzo
May 05 2016 20:27
a cool!!
so we are now moving the serialization to private in classes by default right?
Francesco Biscani
@bluescarni
May 05 2016 20:28
wanted to ask about that
Dario Izzo
@darioizzo
May 05 2016 20:28
it does not appear in doxygen that was my ratio
nor it generates a warning if not commented
on the other hand structs will have it
Francesco Biscani
@bluescarni
May 05 2016 20:29
but it does hide the fact that one can actually serialise the classes
unless we just write somewhere that all classes are serializable
Dario Izzo
@darioizzo
May 05 2016 20:29
why hide?
in the docs?
Francesco Biscani
@bluescarni
May 05 2016 20:29
because I can't really tell it's serializable if I don't see the save/load methods
Dario Izzo
@darioizzo
May 05 2016 20:29
yes we will have a small separate chapter on serialization
saying they all are
and in python saying the pickle thing
Francesco Biscani
@bluescarni
May 05 2016 20:30
fine for me, I don't have strong feelings but I was wondering why it bothers you so much to go and explicitly hide it
:)
Dario Izzo
@darioizzo
May 05 2016 20:32
its one of those methods that the user will never call. So it felt reasonable not to document it and have it private.
Francesco Biscani
@bluescarni
May 05 2016 20:33
the user could still be interested for saving and loading optimisation results, and things like that... but ok
Dario Izzo
@darioizzo
May 05 2016 20:34
I am good tho leave everything to public .... I hate privacy
let me implement
Francesco Biscani
@bluescarni
May 05 2016 20:34
it's fine as long as we are consistent about it
Dario Izzo
@darioizzo
May 05 2016 20:35
i say public
vote ...
Marcus Märtens
@CoolRunning
May 05 2016 20:36
public
Francesco Biscani
@bluescarni
May 05 2016 20:36
yay democracy
Dario Izzo
@darioizzo
May 05 2016 20:36
ok so I implement .. give me 5
Francesco Biscani
@bluescarni
May 05 2016 20:41
shall we doto lateR?
Dario Izzo
@darioizzo
May 05 2016 20:41
I am done after this commit
Marcus Märtens
@CoolRunning
May 05 2016 20:41
still punching the poor bots?
Francesco Biscani
@bluescarni
May 05 2016 20:41
getting punched by the bots
Dario Izzo
@darioizzo
May 05 2016 20:43
done
shall we dota? wanna join Marcus?
too boring for you probably :)
Marcus Märtens
@CoolRunning
May 05 2016 20:44
I will join for one bot-punching
Dario Izzo
@darioizzo
May 05 2016 20:44
Yeah!!!
Francesco Biscani
@bluescarni
May 05 2016 20:44
biobreak
Marcus Märtens
@CoolRunning
May 05 2016 20:45
are you in hangouts/skype/whatsoever?
Dario Izzo
@darioizzo
May 05 2016 20:49
hangouts dude