Changes between Version 82 and Version 83 of WikiStart

Sep 30, 2016 2:02:41 PM (4 years ago)

info on building parallel CBC in Visual Studio


  • WikiStart

    v82 v83  
    8282It is also possible to build Cbc with the Visual Studio compiler from the command line using the procedure for Unix-like environments, using the Msys2 shell or CYGWIN. This is the recommended and best-supported way of building Cbc in Windows from source.
     84If you want to build a '''parallel version''' of CBC using Visual Studio you can following instructions: (thanks to Tobias Stengel and Alexis Guigue).
     88- A VS solution with all necessary projects (libCbc, libClp, libCbcSolver, libCgl, libCoinUtils, libOsi, libOsiCbc, libOsiClp). The project files can be found inside the "MSVisualStudio" folders.
     90Steps (based on VS 2013):
     921. for each of the lib* projects do:
     94   add "CBC_THREAD" under Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions (a subset of the lib* projects may be sufficient, but it doesn't hurt to do it for all)
     962. Link against a pthreads library. [ PThreadsWin32]  works (even in 64 bits systems) and is distributed under the LGPL. If you decide to use the precompiled binaries: both pthreadVC2.^[#noteVS note]^ and pthreadVS2.^[#noteVS note]^ seem to work. Otherwise: third party VS project files for pthreads4win can be found on github.
     98[=#noteVS Note:]  if you use C++/Cli, make sure that no callback (eventHandlers, custom cut generators, custom heuristics, ...) contains managed code. Otherwise your code will crash at runtime with AssembyNotFoundExceptions inside the native threads created by Cbc. Even if not, problems with the GC are likely.
     1003. Iff you link statically against pthreads4win, you have to define PTW32_STATIC_LIB when building your program/Cbc (e.g. via Properties -> C/C++/Preprocessor ->  Preprocessor Definitions) AND - only if you build pthreads yourself - when building pthreads. Linking pthreads dynamically works without additional preprocessor definitions.
     1024. pass "-threads" "yourNumber" to CbcMain1
    84104== Documentation ==