LeMonADE-project / LeMonADE

Library for Monte Carlo Simulation applying the Bond Fluctuation Model
Other
3 stars 11 forks source link

Support for make -j #73

Closed mxmlnkn closed 7 years ago

mxmlnkn commented 7 years ago

It might be useful to write CMake in such a way, that the project can be built succesfully in parallel. Currently on develop when I try to do it, it tries to compile an example depending on LeMonADE.a before that static library was built:

mkdir build && cd build && cmake .. && make -j 3

Log:

-- The C compiler identification is GNU 5.4.1
-- The CXX compiler identification is GNU 5.4.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Build type is Release
USING CXX COMPILER FLAGS -O3 -DNDEBUG -O3 -msse2 -mssse3 -fexpensive-optimizations 
USING C COMPILER FLAGS -O3 -DNDEBUG -O3 -msse2 -mssse3 -fexpensive-optimizations 
INSTALLDIR_LEMONADE set to default/usr/local
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.12") 
Build documentation with: make docs
Existing File documentation with doxygen
-- Configuring done
-- Generating done
-- Build files have been written to: /media/f/Studium/MasterThesis_2017-2018/LeMonADE/build
Scanning dependencies of target libLeMonADE-static
Scanning dependencies of target Example0
Scanning dependencies of target SimpleSimulator
[  4%] Building CXX object projects/Examples/example0/CMakeFiles/Example0.dir/ex0main.cpp.o
[  8%] Building CXX object src/CMakeFiles/libLeMonADE-static.dir/LeMonADE/feature/FeatureBox.cpp.o
[ 12%] Building CXX object projects/SimpleSimulator/CMakeFiles/SimpleSimulator.dir/main.cpp.o
[ 16%] Linking CXX executable ../../../bin/Example0
[ 16%] Built target Example0
[ 20%] Building CXX object src/CMakeFiles/libLeMonADE-static.dir/LeMonADE/io/AbstractRead.cpp.o
Scanning dependencies of target Example1
[ 25%] Building CXX object projects/Examples/example1/CMakeFiles/Example1.dir/ex1main.cpp.o
[ 29%] Building CXX object src/CMakeFiles/libLeMonADE-static.dir/LeMonADE/io/Parser.cpp.o
[ 33%] Building CXX object src/CMakeFiles/libLeMonADE-static.dir/LeMonADE/utility/FastBondset.cpp.o
[ 37%] Linking CXX executable ../../../bin/Example1
/usr/bin/ld: cannot find -lLeMonADE
collect2: error: ld returned 1 exit status
projects/Examples/example1/CMakeFiles/Example1.dir/build.make:94: recipe for target 'bin/Example1' failed
make[2]: *** [bin/Example1] Error 1
CMakeFiles/Makefile2:336: recipe for target 'projects/Examples/example1/CMakeFiles/Example1.dir/all' failed
make[1]: *** [projects/Examples/example1/CMakeFiles/Example1.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 41%] Building CXX object src/CMakeFiles/libLeMonADE-static.dir/LeMonADE/utility/R250.cpp.o
[ 45%] Building CXX object src/CMakeFiles/libLeMonADE-static.dir/LeMonADE/utility/RandomNumberGenerators.cpp.o
[ 50%] Building CXX object src/CMakeFiles/libLeMonADE-static.dir/LeMonADE/utility/ResultFormattingTools.cpp.o
[ 54%] Building CXX object src/CMakeFiles/libLeMonADE-static.dir/LeMonADE/utility/SlowBondset.cpp.o
[ 58%] Building CXX object src/CMakeFiles/libLeMonADE-static.dir/LeMonADE/utility/TaskManager.cpp.o
[ 62%] Linking CXX static library ../lib/libLeMonADE.a
[ 62%] Built target libLeMonADE-static
[ 66%] Linking CXX executable ../../bin/SimpleSimulator
[ 66%] Built target SimpleSimulator
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Trying to build it again it will work now, because the library is already compiled from the first run:

make -j 3

Log:

[  8%] Built target Example0
[ 16%] Built target SimpleSimulator
[ 58%] Built target libLeMonADE-static
Scanning dependencies of target Example2
[ 62%] Linking CXX executable ../../../bin/Example1
Scanning dependencies of target Example3
[ 66%] Building CXX object projects/Examples/example2/CMakeFiles/Example2.dir/ex2main.cpp.o
[ 70%] Building CXX object projects/Examples/example3/CMakeFiles/Example3.dir/ex3main.cpp.o
[ 75%] Built target Example1
Scanning dependencies of target Example4
[ 79%] Building CXX object projects/Examples/example4/CMakeFiles/Example4.dir/ex4main.cpp.o
[ 83%] Linking CXX executable ../../../bin/Example2
[ 83%] Built target Example2
Scanning dependencies of target Example5
[ 87%] Linking CXX executable ../../../bin/Example3
[ 91%] Building CXX object projects/Examples/example5/CMakeFiles/Example5.dir/ex5main.cpp.o
[ 91%] Built target Example3
[ 95%] Linking CXX executable ../../../bin/Example4
[ 95%] Built target Example4
[100%] Linking CXX executable ../../../bin/Example5
[100%] Built target Example5
MartinWenge commented 7 years ago

fixed by #74