Skip to content

Commit

Permalink
Merge pull request #1641 from DGtal-team/openmpfix
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoeurjo authored Mar 28, 2022
2 parents 5f27365 + 4facd1b commit 404a79e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/buildAndDocumentation-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
TESTBLACKLIST: "(testLinearStructure)"
CONFIG_GLOBAL: -DBUILD_EXAMPLES=true -DBUILD_TESTING=true -DDGTAL_RANDOMIZED_TESTING_THRESHOLD=25
CONFIG_GLOBAL: -DBUILD_EXAMPLES=true -DBUILD_TESTING=true -DDGTAL_RANDOMIZED_TESTING_THRESHOLD=25 -DWITH_OPENMP=true
CONFIG_LINUX: -DWITH_MAGICK=true -DWITH_GMP=true -DWITH_FFTW3=true -DWARNING_AS_ERROR=ON -DWITH_HDF5=true -DWITH_QGLVIEWER=true -DWITH_CAIRO=true -DWITH_EIGEN=true -DWITH_ITK=true -DDGTAL_ENABLE_FLOATING_POINT_EXCEPTIONS=true
CONFIG_MAC: -DWITH_EIGEN=true -DWITH_GMP=true

Expand All @@ -36,7 +36,7 @@ jobs:
- name: Install macOS deps
if: matrix.os == 'macOS-latest'
run: brew install boost ninja eigen gmp
run: brew install boost ninja eigen gmp libomp

- name: Get white list of tests
run: |
Expand Down
14 changes: 8 additions & 6 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
surfel (signed cell of a Khalimksy space). (David Coeurjolly,
[#1631](https://github.com/DGtal-team/DGtal/pull/1631))


## Changes
- *Image*
- Bugfix in the SpaceND and HyperRectDomain classes to allow very large extent (e.g. >1024^3)
Expand Down Expand Up @@ -88,7 +88,7 @@
- New constructor in Point2DEmbedderIn3D to explicitly orient the image plane and
new shift method to avoid recomputing orientation plane.
(Bertrand Kerautret [#1619](https://github.com/DGtal-team/DGtal/pull/1619))



## Bug fixes
Expand All @@ -103,12 +103,14 @@
- Fix cmake IN_LIST use policy. (Bertrand Kerautret,
[#1592](https://github.com/DGtal-team/DGtal/pull/1592))
- Adding a explicit list of tests to exclude from Github Actions
(David Coeurjolly, [#1596](https://github.com/DGtal-team/DGtal/pull/1596)
(David Coeurjolly, [#1596](https://github.com/DGtal-team/DGtal/pull/1596))
- Fixing bugs in the exclude list for CI
(David Coeurjolly, [#1602](https://github.com/DGtal-team/DGtal/pull/1602)
(David Coeurjolly, [#1602](https://github.com/DGtal-team/DGtal/pull/1602))
- Reactivating Github Actions bots
(David Coeurjolly, [#1628](https://github.com/DGtal-team/DGtal/pull/1628)

(David Coeurjolly, [#1628](https://github.com/DGtal-team/DGtal/pull/1628))
- OpenMP fix in DGtalConfig on macOS M1 (David Coeurjolly,
[#1641](https://github.com/DGtal-team/DGtal/pull/1641))

- *Examples*
- We can now have examples using [polyscope](https://polyscope.run)
as viewer (`BUILD_POLYSCOPE_EXAMPLES` cmake variable). (David
Expand Down
28 changes: 28 additions & 0 deletions cmake/CheckDGtalOptionalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,34 @@ endif()
# -----------------------------------------------------------------------------
set(OPENMP_FOUND_DGTAL 0)
if(WITH_OPENMP)
if(APPLE)
message("-- Setting OpenMP flags on MacOs. Assuming `brew install libomp`")
if(CMAKE_C_COMPILER_ID MATCHES "Clang\$")
IF(EXISTS "/opt/homebrew/")
message(STATUS "Using M1/Homebrew C paths")
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I/opt/homebrew/include" CACHE INTERNAL "OpenMP flags for #Xcode toolchain.")
set(OpenMP_C_LIB_NAMES "omp" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_omp_LIBRARY "/opt/homebrew/lib/libomp.dylib" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
else()
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" CACHE INTERNAL "OpenMP flags for Xcode toolchain.")
set(OpenMP_C_LIB_NAMES "omp" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_omp_LIBRARY "/usr/local/opt/libomp/lib/libomp.dylib" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
endif()
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang\$")
IF(EXISTS "/opt/homebrew/")
message(STATUS "Using M1/Homebrew C++ paths")
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/opt/homebrew/include" CACHE INTERNAL "OpenMP flags for Xcode toolchain.")
set(OpenMP_CXX_LIB_NAMES "omp" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_omp_LIBRARY "/opt/homebrew/lib/libomp.dylib" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
else()
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" CACHE INTERNAL "OpenMP flags for Xcode toolchain.")
set(OpenMP_CXX_LIB_NAMES "omp" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_omp_LIBRARY "/usr/local/opt/libomp/lib/libomp.dylib" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
endif()
endif()
endif()

find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
set(OPENMP_FOUND_DGTAL 1)
Expand Down
23 changes: 18 additions & 5 deletions cmake/DGtalConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,33 @@ if(@OPENMP_FOUND_DGTAL@) #if OPENMP_FOUND_DGTAL
if(APPLE)
message("-- Setting OpenMP flags on MacOs. Assuming `brew install libomp`")
if(CMAKE_C_COMPILER_ID MATCHES "Clang\$")
IF(EXISTS "/opt/homebrew/")
message(STATUS "Using M1/Homebrew C paths")
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I/opt/homebrew/include" CACHE INTERNAL "OpenMP flags for #Xcode toolchain.")
set(OpenMP_C_LIB_NAMES "omp" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_omp_LIBRARY "/opt/homebrew/lib/libomp.dylib" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
else()
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" CACHE INTERNAL "OpenMP flags for Xcode toolchain.")
set(OpenMP_C_LIB_NAMES "omp" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_omp_LIBRARY "/usr/local/opt/libomp/lib/libomp.dylib" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
endif()
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang\$")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang\$")
IF(EXISTS "/opt/homebrew/")
message(STATUS "Using M1/Homebrew C++ paths")
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/opt/homebrew/include" CACHE INTERNAL "OpenMP flags for Xcode toolchain.")
set(OpenMP_CXX_LIB_NAMES "omp" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_omp_LIBRARY "/opt/homebrew/lib/libomp.dylib" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
else()
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" CACHE INTERNAL "OpenMP flags for Xcode toolchain.")
set(OpenMP_CXX_LIB_NAMES "omp" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
set(OpenMP_omp_LIBRARY "/usr/local/opt/libomp/lib/libomp.dylib" CACHE INTERNAL "OpenMP lib name for Xcode toolchain.")
endif()
endif()
endif()
find_dependency(OpenMP REQUIRED
@OpenMP_HINTS@
)
@OpenMP_HINTS@
)
set(WITH_OPENMP 1)
endif()

Expand All @@ -116,7 +129,7 @@ endif()


if(@CGAL_FOUND_DGTAL@) #if CGAL_FOUND_DGTAL
find_dependency(CGAL COMPONENTS Core
find_dependency(CGAL COMPONENTS Core
@CGAL_HINTS@
)
set(WITH_CGAL 1)
Expand Down

0 comments on commit 404a79e

Please sign in to comment.