Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hdf5: support HDF5_PREFER_PARELLEL cmake option #3859

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions modules/hdf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ if(NOT HDF5_FOUND)
ocv_module_disable(hdf) # no return
endif()

set(HAVE_HDF5 1)
# See https://github.com/opencv/opencv_contrib/issues/3858
# If HDF5_PREFER_PARALLEL is enabled, find_package(HDF5) sets HDF5_IS_PARALLEL=ON.
if(HDF5_IS_PARALLEL)
find_package(MPI)
if(NOT MPI_FOUND)
message(STATUS "Module opencv_hdf disabled because the following dependency is not found: MPI")
ocv_module_disable(hdf) # no return
endif()
else()
unset(MPI_CXX_LIBRARIES)
unset(MPI_CXX_INCLUDE_DIRS)
endif()

set(HAVE_HDF5 1)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Winvalid-offsetof)

set(the_description "Hierarchical Data Format I/O")
ocv_define_module(hdf opencv_core WRAP python)
ocv_target_link_libraries(${the_module} ${HDF5_LIBRARIES})
ocv_include_directories(${HDF5_INCLUDE_DIRS})
ocv_target_link_libraries(${the_module} ${HDF5_LIBRARIES} ${MPI_CXX_LIBRARIES})
ocv_include_directories(${HDF5_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_DIRS})
4 changes: 4 additions & 0 deletions modules/hdf/include/opencv2/hdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ This module provides storage routines for Hierarchical Data Format objects.

In order to use it, the hdf5 library has to be installed, which
means cmake should find it using `find_package(HDF5)`.

You can use parallel hdf5 library with `-DHDF5_PREFER_PARELLEL=ON` cmake option.
Depended MPI library(e.g. Open MPI or MPICH) is detected in `find_package(MPI)`.
To set prefer MPI library, `update-alternatives` command is helpful for your Ubuntu.
@}
*/

Expand Down