diff --git a/.travis.yml b/.travis.yml index d3e1ee0..4b36558 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,14 +30,14 @@ env: - BOOST_MIN: 106100 # careful: hard coded below - GRAYBAT_ROOT: $TRAVIS_BUILD_DIR - OMP_NUM_THREADS: 4 # ignored in thread layer + - COMPILER: gcc matrix: - - COMPILER=gcc STRATEGY="" - #- COMPILER=clang STRATEGY="" + - RESOLVE_DEPS_BY: manual + - RESOLVE_DEPS_BY: conan before_install: - mkdir -p $HOME/build - #- export CMAKE_FLAGS="-DALPAKA_ACC_"$STRATEGY"_ENABLE=ON" - export CMAKE_FLAGS="-DCMAKE_CXX_FLAGS=\"-Werror\"" - if [ "$COMPILER" == "gcc" ]; then echo "Using g++-6"; @@ -67,17 +67,16 @@ install: mv -f cmake-3.3.2-Linux-x86_64/* . && rm -rf cmake-3.3.2-Linux-x86_64.tar.gz cmake-3.3.2-Linux-x86_64 && cd -; - fi - - cmake --version + fi + - cmake --version; ############################################################################# # BOOST # ############################################################################# - - export CMAKE_PREFIX_PATH=$BOOST_ROOT:$CMAKE_PREFIX_PATH - # cmake --find-package -DNAME=Boost -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST + - export CMAKE_PREFIX_PATH=$BOOST_ROOT:$CMAKE_PREFIX_PATH; - echo -e "#include \n#include \nint main() { std::cout << BOOST_VERSION << std::endl; return 0; }" - | $CXX -I$BOOST_ROOT/include -x c++ - >/dev/null || { echo 0; } + | $CXX -I$BOOST_ROOT/include -x c++ - >/dev/null || { echo 0; } - ls $BOOST_ROOT - - BOOST_FOUND=$([ $(./a.out) -ge $BOOST_MIN ] && { echo 0; } || { echo 1; }) + - BOOST_FOUND=$([ $(./a.out) -ge $BOOST_MIN ] && { echo 0; } || { echo 1; }); - if [ $BOOST_FOUND -ne 0 ]; then mkdir -p $BOOST_ROOT && cd $BOOST_ROOT && @@ -91,34 +90,72 @@ install: ./b2 install && rm -rf boost.tar.bz2 boost_1_61_0 && cd $HOME; + fi; + + + ############################################################################# + # Resolve missing dependencies + ############################################################################# + - if [ "$RESOLVE_DEPS_BY" == "manual" ]; then + echo "Resolve library dependencies manually."; + elif [ "$RESOLVE_DEPS_BY" == "conan" ]; then + pip install --upgrade pip --user; + pip install conan --user; fi + + ############################################################################# # ZMQ # ############################################################################# - - export CMAKE_PREFIX_PATH=$ZMQ_ROOT:$CMAKE_PREFIX_PATH - - echo $CMAKE_PREFIX_PATH - - ls $ZMQ_ROOT - - if [ ! "$(ls -A $ZMQ_ROOT)" ]; then - cd /tmp/ && - travis_retry git clone https://github.com/zeromq/libzmq.git&& - travis_retry git clone https://github.com/zeromq/cppzmq.git; - cd /tmp/libzmq/ && - ./autogen.sh && - mkdir -p $ZMQ_ROOT && - ./configure --prefix=$ZMQ_ROOT && - make && - make install && - cp /tmp/cppzmq/zmq.hpp $ZMQ_ROOT/include/ && - cp /tmp/cppzmq/zmq_addon.hpp $ZMQ_ROOT/include/; - else - echo "ZeroMQ directory already exists"; - fi +# export CMAKE_PREFIX_PATH=$ZMQ_ROOT:$CMAKE_PREFIX_PATH; +# echo $CMAKE_PREFIX_PATH; +# ls $ZMQ_ROOT; +# if [ ! "$(ls -A $ZMQ_ROOT)" ]; then +# cd /tmp/ && +# travis_retry git clone https://github.com/zeromq/libzmq.git&& +# travis_retry git clone https://github.com/zeromq/cppzmq.git; +# cd /tmp/libzmq/ && +# ./autogen.sh && +# mkdir -p $ZMQ_ROOT && +# ./configure --prefix=$ZMQ_ROOT && +# make && +# make install && +# cp /tmp/cppzmq/zmq.hpp $ZMQ_ROOT/include/ && +# cp /tmp/cppzmq/zmq_addon.hpp $ZMQ_ROOT/include/; +# else +# echo "ZeroMQ directory already exists"; +# fi; +# + #elif [ "$RESOLVE_DEPS_BY" = "conan" ]; then + # else +# echo "Resolve library dependencies using conan."; + +# fi +# TODO Metis script: - - cd $HOME/build - - cmake $CMAKE_FLAGS $GRAYBAT_ROOT + - if [ "$RESOLVE_DEPS_BY" == "manual" ]; then + echo "Build with manually installed dependencies."; + elif [ "$RESOLVE_DEPS_BY" == "conan" ]; then + echo "Build with conan installed dependencies."; + cd $HOME/build; + conan install $GRAYBAT_ROOT --build=missing -s compiler=gcc -s compiler.version=6.2 -s compiler.libcxx=libstdc++; + fi + - cmake $CMAKE_FLAGS -DCONAN_DISABLE_CHECK_COMPILER=TRUE $GRAYBAT_ROOT - make check - make gbZMQSignaling - - ./gbZMQSignaling& + - ./bin/gbZMQSignaling& - ctest --output-on-failure - killall gbZMQSignaling + +#- if ["$RESOLVE_DEPS_BY" = "manual"]; then +# cd $HOME/build; +# cmake $CMAKE_FLAGS $GRAYBAT_ROOT; +# make check +# elif ["$RESOLVE_DEPS_BY" = "conan"]; then +# cd $HOME/build; +# conan install $GRAYBAT_ROOT --build=missing; +# cmake $CMAKE_FLAGS $GRAYBAT_ROOT; +# make check +# fi + diff --git a/CMakeLists.txt b/CMakeLists.txt index 0999267..06dd691 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,13 +38,31 @@ if(${benchmark_FOUND}) set(LIBS ${LIBS} ${benchmark_LIBRARIES}) endif(${benchmark_FOUND}) +############################################################################### +# Conan +# - Resolves dependencies of ZMQ +############################################################################### + +if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") + include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") + conan_basic_setup() + message("${CMAKE_INCLUDE_PATH}") + message("${CMAKE_LIBRARY_PATH}") +endif() + ############################################################################### # Boost ############################################################################### -find_package(Boost 1.58.0 COMPONENTS unit_test_framework program_options REQUIRED) +find_package(Boost 1.56.0 COMPONENTS unit_test_framework program_options REQUIRED) include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) set(LIBS ${LIBS} ${Boost_LIBRARIES}) +############################################################################### +# Elegant Progressbars for a More Cililized Age +############################################################################### +#set(elegant-progressbars_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/elegant-progressbars/cmake") +#find_package(elegant-progressbars 1.0.0 REQUIRED CONFIG) + ############################################################################### # Graybat ############################################################################### @@ -60,6 +78,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-parameter") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") endif() @@ -84,6 +103,7 @@ endif() ############################################################################### # Targets ############################################################################### +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # Benchmark file(GLOB BENCHMARKS test/benchmark/*.cpp) @@ -120,9 +140,9 @@ target_link_libraries(gbZMQSignaling ${LIBS}) enable_testing() add_test(graybat_check_build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target check) add_test(graybat_example_build "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target example) -add_test(graybat_test_run mpiexec -n 2 check ) -add_test(graybat_gol_run mpiexec gol 90 4 ) -add_test(graybat_pr_run mpiexec pagerank ) +add_test(graybat_test_run mpiexec -n 2 bin/check ) +add_test(graybat_gol_run mpiexec bin/gol 90 4 ) +add_test(graybat_pr_run mpiexec bin/pagerank ) set_tests_properties(graybat_test_run PROPERTIES DEPENDS graybat_check_build) set_tests_properties(graybat_gol_run PROPERTIES DEPENDS graybat_example_build) set_tests_properties(graybat_pr_run PROPERTIES DEPENDS graybat_example_build) @@ -166,4 +186,4 @@ foreach(P ${_SOURCES_PRE}) set(_SOURCES ${_SOURCES} ${P}) endif() endforeach() -ADD_LIBRARY(CLION_DUMMY_TARGET EXCLUDE_FROM_ALL ${_SOURCES}) \ No newline at end of file +ADD_LIBRARY(CLION_DUMMY_TARGET EXCLUDE_FROM_ALL ${_SOURCES}) diff --git a/README.md b/README.md index 45a880a..4fb8ecd 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ The project is organized in a couple of subdirectories. * zeromq 4.1.3 (zeromq communication policy) * metis 5.1 (graph partitioning mapping) +**Note** that some graybat dependencies can be resolved using [conan](https://www.conan.io/) automatically. Have a look into the [conan documentation](http://docs.conan.io/en/latest/getting_started.html) for more details on that. ##Roadmap## * [Dynamic context](https://github.com/ComputationalRadiationPhysics/graybat/milestones/Dynamic%20Context) @@ -111,7 +112,6 @@ The following is a an example of how to embed graybat into your `CMakeLists.txt` Finally, the application can use graybat e.g. `#include `. - ##Compiling Tests/Examples## * Clone the repository: `git clone https://github.com/computationalradiationphysics/graybat.git` diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..bf3ea7d --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,12 @@ +[requires] +zmqcpp/4.1.1@memsharded/stable +ZMQ/4.1.1@memsharded/stable +Metis/5.1.0.p1@erikzenker/testing +Boost/1.62.0.beta.1@erikzenker/testing + +[generators] +cmake + +[options] +ZMQ:shared=True +Boost:shared=True diff --git a/graybatConfig.cmake b/graybatConfig.cmake index 28932a6..50a2973 100644 --- a/graybatConfig.cmake +++ b/graybatConfig.cmake @@ -27,7 +27,7 @@ # graybat ############################################################################### cmake_minimum_required(VERSION 3.3.0) -project("graybat") +project("graybat" CXX) set(graybat_INCLUDE_DIRS ${graybat_INCLUDE_DIRS} "${graybat_DIR}/include") @@ -43,10 +43,24 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") ############################################################################### set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${graybat_DIR}/include/graybat/utils/cmake/modules/" ) + ############################################################################### # DEPENDENCIES ############################################################################### +############################################################################### +# Conan +# - Resolves dependencies of ZMQ +############################################################################### + +if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") + include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") + conan_basic_setup() + message("${CMAKE_INCLUDE_PATH}") + message("${CMAKE_LIBRARY_PATH}") +endif() + + ############################################################################### # METIS LIB ############################################################################### @@ -54,13 +68,15 @@ find_package(METIS MODULE 5.1.0) set(graybat_INCLUDE_DIRS ${graybat_INCLUDE_DIRS} ${METIS_INCLUDE_DIRS}) set(graybat_LIBRARIES ${graybat_LIBRARIES} ${METIS_LIBRARIES}) + ############################################################################### # ZMQ LIB ############################################################################### -find_package(ZMQ MODULE 4.0.0) +find_package(ZMQ MODULE 4.0.0 REQUIRED) set(graybat_INCLUDE_DIRS ${graybat_INCLUDE_DIRS} ${ZMQ_INCLUDE_DIRS}) set(graybat_LIBRARIES ${graybat_LIBRARIES} ${ZMQ_LIBRARIES}) + ############################################################################### # Boost LIB ############################################################################### @@ -68,16 +84,18 @@ find_package(Boost 1.56.0 MODULE COMPONENTS mpi serialization REQUIRED) set(graybat_INCLUDE_DIRS ${graybat_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) set(graybat_LIBRARIES ${graybat_LIBRARIES} ${Boost_LIBRARIES}) + ################################################################################ # MPI LIB ################################################################################ -find_package(MPI MODULE) +find_package(MPI MODULE REQUIRED) set(graybat_INCLUDE_DIRS ${graybat_INCLUDE_DIRS} ${MPI_C_INCLUDE_PATH}) set(graybat_LIBRARIES ${graybat_LIBRARIES} ${MPI_C_LIBRARIES}) set(graybat_LIBRARIES ${graybat_LIBRARIES} ${MPI_CXX_LIBRARIES}) + ################################################################################ # Find PThreads ################################################################################ -find_package(Threads MODULE) +find_package(Threads MODULE REQUIRED) set(graybat_LIBRARIES ${graybat_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) diff --git a/include/graybat/utils/cmake/modules/FindZMQ.cmake b/include/graybat/utils/cmake/modules/FindZMQ.cmake index 2c130ae..9fae63b 100644 --- a/include/graybat/utils/cmake/modules/FindZMQ.cmake +++ b/include/graybat/utils/cmake/modules/FindZMQ.cmake @@ -26,7 +26,7 @@ else (ZMQ_LIBRARIES AND ZMQ_INCLUDE_DIRS) /usr/local/include /opt/local/include /sw/include - HINTS "${CMAKE_PREFIX_PATH}/include" + HINTS "${CMAKE_PREFIX_PATH}/include" "${CMAKE_INCLUDE_PATH}" ) @@ -38,6 +38,7 @@ else (ZMQ_LIBRARIES AND ZMQ_INCLUDE_DIRS) /usr/local/lib /opt/local/lib /sw/lib + HINTS "${CMAKE_LIBRARY_PATH}" ) set(ZMQ_INCLUDE_DIRS diff --git a/test/integration/CageUT.cpp b/test/integration/CageUT.cpp index 82e3259..f417482 100644 --- a/test/integration/CageUT.cpp +++ b/test/integration/CageUT.cpp @@ -18,6 +18,12 @@ * If not, see . */ +// BOOST +#define BOOST_TEST_DYN_LINK +#include +#include +#include + // STL #include #include @@ -26,11 +32,6 @@ #include /* std::getenv */ #include /* std::string, std::stoi */ -// BOOST -#include -#include -#include - // GRAYBAT #include #include diff --git a/test/integration/CommunicationPolicyUT.cpp b/test/integration/CommunicationPolicyUT.cpp index 0461666..0157da5 100644 --- a/test/integration/CommunicationPolicyUT.cpp +++ b/test/integration/CommunicationPolicyUT.cpp @@ -19,6 +19,7 @@ */ // BOOST +#define BOOST_TEST_DYN_LINK #include #include diff --git a/test/integration/EdgeUT.cpp b/test/integration/EdgeUT.cpp index c323cde..37021da 100644 --- a/test/integration/EdgeUT.cpp +++ b/test/integration/EdgeUT.cpp @@ -19,6 +19,7 @@ */ // BOOST +#define BOOST_TEST_DYN_LINK #include #include diff --git a/test/integration/UT.cpp b/test/integration/UT.cpp index 61b7b56..77b15f8 100644 --- a/test/integration/UT.cpp +++ b/test/integration/UT.cpp @@ -18,6 +18,6 @@ * If not, see . */ -#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "GrayBat Unit Tests" +#define BOOST_TEST_DYN_LINK #include diff --git a/test/integration/VertexUT.cpp b/test/integration/VertexUT.cpp index 9f835f9..70a2b7c 100644 --- a/test/integration/VertexUT.cpp +++ b/test/integration/VertexUT.cpp @@ -19,6 +19,7 @@ */ // BOOST +#define BOOST_TEST_DYN_LINK #include #include