MantisBT - CMake
View Issue Details
0015527CMakeCMakepublic2015-04-22 02:462016-02-01 09:10
Nico Schlömer 
 
normalfeaturealways
closedfixed 
 
CMake 3.4CMake 3.4 
0015527: FindHDF5.cmake: Make it possible to require parallel builds
Since Ubuntu 15.04, parallel [1] and serial [2] HDF5 installations no longer conflict and can be installed alongside. Calling `FIND_PACKAGE(HDF5)` on a system where both are installed will consistently pick one of the two (serial), making it impossible to to build against the parallel HDF5 installation without deinstalling the serial one.

FindHDF5.cmake already has a switch that tells you which version was picked after the fact, but it'd be really useful if you could *require* parallel (or serial) HDF5 when searching for it.


[1] http://packages.ubuntu.com/vivid/libhdf5-mpi-dev [^]
[2] http://packages.ubuntu.com/vivid/libhdf5-dev [^]
No tags attached.
Issue History
2015-04-22 02:46Nico SchlömerNew Issue
2015-04-22 09:37Brad KingNote Added: 0038578
2015-08-09 17:43Pierre de BuylNote Added: 0039257
2015-08-12 12:51Nico SchlömerNote Added: 0039271
2015-08-12 13:30Pierre de BuylNote Added: 0039272
2015-08-12 14:34Nico SchlömerNote Added: 0039275
2015-08-30 21:01Paul RomanoNote Added: 0039356
2015-09-14 04:45Paul RomanoNote Added: 0039410
2015-09-14 04:46Paul RomanoNote Edited: 0039410bug_revision_view_page.php?bugnote_id=39410#r1895
2015-09-14 10:12Brad KingNote Added: 0039418
2015-09-14 10:12Brad KingStatusnew => resolved
2015-09-14 10:12Brad KingResolutionopen => fixed
2015-09-14 10:12Brad KingFixed in Version => CMake 3.4
2015-09-14 10:12Brad KingTarget Version => CMake 3.4
2016-02-01 09:10Robert MaynardNote Added: 0040396
2016-02-01 09:10Robert MaynardStatusresolved => closed

Notes
(0038578)
Brad King   
2015-04-22 09:37   
The FindHDF5 module currently has no maintainer:

 http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]

so no one is actively working on issues reported against it.
(0039257)
Pierre de Buyl   
2015-08-09 17:43   
Can you try with

-DHDF5_Fortran_COMPILER_EXECUTABLE=h5pfc

added to your cmake invocation, after removing the CMakeFiles from your build dir? On debian I could make it pick the parallel install.
(0039271)
Nico Schlömer   
2015-08-12 12:51   
@Pierre Nope, I'm just getting
```
-- Unable to determine HDF5 Fortran flags from HDF5 wrapper.
```
then (and it CMake finds the serial HDF5).
(0039272)
Pierre de Buyl   
2015-08-12 13:30   
For further tracking it would be good to have cmake version, hdf5 version, etc.

The FindHDF5 file issues the message you see when the exit status of "h5pfc -show" is not 0.

Can you compile and execute properly a parallel HDF5 Fortran program?

What is the output of "h5pfc -show"?
(0039275)
Nico Schlömer   
2015-08-12 14:34   
I was able to find the correct libraries by explicitly setting the HDF5 paths
```
    -DHDF5_INCLUDE_DIRS:PATH=/usr/include/hdf5/openmpi/ \
    -DHDF5_LIBRARY_DIRS:PATH=/usr/lib/x86_64-linux-gnu/hdf5/openmpi/ \

```
I guess we could consider this bug invalid then.
(0039356)
Paul Romano   
2015-08-30 21:01   
I can confirm that it if both h5cc and h5pcc (or h5fc/h5pfc) are on a user's PATH, FindHDF5.cmake will consistently pick the serial installation and thus there is no way to get it to find the parallel version. This seems to be because a single call to find_program(...) searches for both h5cc and h5pcc but h5cc appears first. If you reverse them and list h5pcc first, then the parallel version becomes preferred. Thus, one simple solution might be to just introduce a variable, say HDF5_PREFER_PARALLEL, which determines the search order. If it's true, then the call to find_program would list h5pcc first.

Nico, I tried your solution but it doesn't work for me, i.e., HDF5_LIBRARIES still returns libraries for the serial installation.
(0039410)
Paul Romano   
2015-09-14 04:45   
(edited on: 2015-09-14 04:46)
The HDF5_PREFER_PARALLEL solution has been implemented on the 'next' branch:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd26a19a [^]

(0039418)
Brad King   
2015-09-14 10:12   
The change linked in 0015527:0039410 is now in 'master'.
(0040396)
Robert Maynard   
2016-02-01 09:10   
Closing resolved issues that have not been updated in more than 4 months.