Skip to content

Commit

Permalink
Merge pull request #469 from bluescarni/pr/build_system_fixes
Browse files Browse the repository at this point in the history
Support for oneTBB and build system fixes
  • Loading branch information
bluescarni authored Mar 5, 2021
2 parents 5b6e9c1 + 4e81060 commit b768fba
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: 2
version: 2.1

jobs:
bionic_gcc7_coverage:
focal_gcc9_coverage:
docker:
- image: circleci/buildpack-deps:bionic
- image: circleci/buildpack-deps:focal
steps:
- checkout
- run:
name: Build and test
command: bash ./tools/circleci_bionic_gcc7_coverage.sh
command: bash ./tools/circleci_focal_gcc9_coverage.sh
focal_gcc9_asan:
docker:
- image: circleci/buildpack-deps:focal
Expand Down Expand Up @@ -43,10 +43,10 @@ jobs:
command: bash ./tools/circleci_bionic_clang6_release.sh

workflows:
version: 2
version: 2.1
all_builds:
jobs:
- bionic_gcc7_coverage
- focal_gcc9_coverage
- focal_gcc9_asan
- focal_clang9
- bionic_clang6_release
Expand Down
20 changes: 15 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

project(pagmo VERSION 2.16.1 LANGUAGES CXX C)
project(pagmo VERSION 2.17.0 LANGUAGES CXX C)

# Setup module path.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/yacma")
Expand Down Expand Up @@ -114,8 +114,18 @@ if(YACMA_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8")
unset(_PAGMO_GCC_SUPPORTS_NO_OVERRIDE)
endif()

# TBB.
find_package(TBB REQUIRED)
# TBB. Try to find it first in config mode (supported
# since version 2021 after the oneTBB rename), and, if this
# fails, fall back to our own FindTBB.cmake. This is of course
# not an ideal solution, but it should work until oneTBB
# becomes widely deployed.
find_package(TBB QUIET CONFIG)
if(NOT TBB_FOUND)
message(STATUS "TBB not found using config mode, retrying in module mode.")
find_package(TBB REQUIRED MODULE)
else()
message(STATUS "TBB found using config mode.")
endif()

# Eigen3
if(PAGMO_WITH_EIGEN3)
Expand Down Expand Up @@ -300,8 +310,8 @@ if(PAGMO_BUILD_STATIC_LIBRARY)
add_library(pagmo STATIC "${PAGMO_SRC_FILES}")
else()
add_library(pagmo SHARED "${PAGMO_SRC_FILES}")
set_property(TARGET pagmo PROPERTY VERSION "6.0")
set_property(TARGET pagmo PROPERTY SOVERSION 6)
set_property(TARGET pagmo PROPERTY VERSION "7.0")
set_property(TARGET pagmo PROPERTY SOVERSION 7)
set_target_properties(pagmo PROPERTIES CXX_VISIBILITY_PRESET hidden)
set_target_properties(pagmo PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE)
endif()
Expand Down
10 changes: 10 additions & 0 deletions doc/sphinx/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
Changelog
=========

2.17.0 (unreleased)
-------------------

Fix
~~~

- Enable support in the build system for the latest
TBB version (oneTBB)
(`#469 <https://github.com/esa/pagmo2/pull/469>`__).

2.16.1 (2020-12-22)
-------------------

Expand Down
14 changes: 14 additions & 0 deletions src/batch_evaluators/thread_bfe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,23 @@ see https://www.gnu.org/licenses/. */
#include <limits>
#include <stdexcept>

#if defined(_MSC_VER)

// Disable a warning from MSVC in the TBB code.
#pragma warning(push)
#pragma warning(disable : 4324)

#endif

#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>

#if defined(_MSC_VER)

#pragma warning(pop)

#endif

#include <pagmo/batch_evaluators/thread_bfe.hpp>
#include <pagmo/bfe.hpp>
#include <pagmo/exceptions.hpp>
Expand Down
14 changes: 14 additions & 0 deletions src/detail/bfe_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,23 @@ see https://www.gnu.org/licenses/. */
#include <stdexcept>
#include <string>

#if defined(_MSC_VER)

// Disable a warning from MSVC in the TBB code.
#pragma warning(push)
#pragma warning(disable : 4324)

#endif

#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>

#if defined(_MSC_VER)

#pragma warning(pop)

#endif

#include <pagmo/detail/bfe_impl.hpp>
#include <pagmo/exceptions.hpp>
#include <pagmo/problem.hpp>
Expand Down
14 changes: 14 additions & 0 deletions src/islands/thread_island.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,22 @@ see https://www.gnu.org/licenses/. */
#include <string>
#include <utility>

#if defined(_MSC_VER)

// Disable a warning from MSVC in the TBB code.
#pragma warning(push)
#pragma warning(disable : 4324)

#endif

#include <tbb/task_group.h>

#if defined(_MSC_VER)

#pragma warning(pop)

#endif

#include <pagmo/algorithm.hpp>
#include <pagmo/detail/gte_getter.hpp>
#include <pagmo/exceptions.hpp>
Expand Down
14 changes: 14 additions & 0 deletions src/problems/translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,23 @@ see https://www.gnu.org/licenses/. */
#include <utility>
#include <vector>

#if defined(_MSC_VER)

// Disable a warning from MSVC in the TBB code.
#pragma warning(push)
#pragma warning(disable : 4324)

#endif

#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>

#if defined(_MSC_VER)

#pragma warning(pop)

#endif

#include <pagmo/exceptions.hpp>
#include <pagmo/io.hpp>
#include <pagmo/problem.hpp>
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function(ADD_PAGMO_TESTCASE arg1)
# Set the minimum C++ standard to C++17
target_compile_features(${arg1} PRIVATE cxx_std_17)
set_property(TARGET ${arg1} PROPERTY CXX_EXTENSIONS NO)
target_compile_definitions(${arg1} PRIVATE BOOST_ALLOW_DEPRECATED_HEADERS)
add_test(${arg1} ${arg1})
endfunction()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ cd build
# GCC build with coverage.
cmake ../ -DCMAKE_BUILD_TYPE=Debug -DPAGMO_BUILD_TESTS=yes -DPAGMO_WITH_EIGEN3=yes -DPAGMO_WITH_NLOPT=yes -DPAGMO_WITH_IPOPT=yes -DCMAKE_CXX_FLAGS="--coverage" -DPAGMO_ENABLE_IPO=yes
make -j2 VERBOSE=1
ctest -V
# NOTE: skip the torture tests because they take
# a lot of time when code coverage is turned on.
ctest -V -j2 -E torture

# Upload coverage data.
bash <(curl -s https://codecov.io/bash) -x gcov-7
bash <(curl -s https://codecov.io/bash) -x gcov-9

set +e
set +x

0 comments on commit b768fba

Please sign in to comment.