Skip to content

Commit e8112c7

Browse files
committed
hdf5: update to use parallel version of hdf5
hdf5 parallel is required for certain applications and should not conflict with serial applications as they are part of the same source code.
1 parent 6d88eee commit e8112c7

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

Diff for: Formula/h/hdf5.rb

+15-19
Original file line numberDiff line numberDiff line change
@@ -28,40 +28,33 @@ class Hdf5 < Formula
2828
depends_on "cmake" => :build
2929
depends_on "gcc" # for gfortran
3030
depends_on "libaec"
31+
depends_on "open-mpi" # for parallel support
3132
depends_on "pkg-config"
32-
3333
uses_from_macos "zlib"
3434

3535
conflicts_with "hdf5-mpi", because: "hdf5-mpi is a variant of hdf5, one can only use one or the other"
3636

3737
def install
3838
ENV["libaec_DIR"] = Formula["libaec"].opt_prefix.to_s
39+
# Work around incompatibility with new linker (FB13194355)
40+
# https://github.com/HDFGroup/hdf5/issues/3571
41+
ENV.append "LDFLAGS", "-Wl,-ld_classic" if DevelopmentTools.clang_build_version >= 1500
3942
args = %w[
4043
-DHDF5_USE_GNU_DIRS:BOOL=ON
4144
-DHDF5_INSTALL_CMAKE_DIR=lib/cmake/hdf5
4245
-DHDF5_BUILD_FORTRAN:BOOL=ON
4346
-DHDF5_BUILD_CPP_LIB:BOOL=ON
4447
-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON
48+
-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON
49+
-DHDF5_ENABLE_PARALLEL:BOOL=ON
50+
-DALLOW_UNSUPPORTED:BOOL=ON
51+
-DCMAKE_C_COMPILER=mpicc
52+
-DCMAKE_CXX_COMPILER=mpic++
53+
-DCMAKE_FC_COMPILER=mpifort
54+
-DCMAKE_F77_COMPILER=mpif77
55+
-DCMAKE_F90_COMPILER=mpif90
4556
]
4657
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
47-
48-
# Avoid c shims in settings files
49-
inreplace_c_files = %w[
50-
build/src/H5build_settings.c
51-
build/src/libhdf5.settings
52-
build/CMakeFiles/h5cc
53-
build/CMakeFiles/h5hlcc
54-
]
55-
inreplace inreplace_c_files, Superenv.shims_path/ENV.cc, ENV.cc
56-
57-
# Avoid cpp shims in settings files
58-
inreplace_cxx_files = %w[
59-
build/CMakeFiles/h5c++
60-
build/CMakeFiles/h5hlc++
61-
]
62-
inreplace_cxx_files << "build/src/libhdf5.settings" if OS.linux?
63-
inreplace inreplace_cxx_files, Superenv.shims_path/ENV.cxx, ENV.cxx
64-
6558
system "cmake", "--build", "build"
6659
system "cmake", "--install", "build"
6760
end
@@ -78,6 +71,8 @@ def install
7871
EOS
7972
system "#{bin}/h5cc", "test.c"
8073
assert_equal version.to_s, shell_output("./a.out").chomp
74+
system "#{bin}/h5pcc", "test.c"
75+
assert_equal version.to_s, shell_output("./a.out").chomp
8176

8277
(testpath/"test.f90").write <<~EOS
8378
use hdf5
@@ -107,6 +102,7 @@ def install
107102
end
108103
EOS
109104
system bin/"h5fc", "test.f90"
105+
system "#{bin}/h5pfc", "test.f90"
110106
assert_equal version.to_s, shell_output("./a.out").chomp
111107

112108
# Make sure that it was built with SZIP/libaec

0 commit comments

Comments
 (0)