Skip to content
Merged
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
141 changes: 110 additions & 31 deletions pkgs/by-name/ad/adios2/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
ninja,
gfortran,
pkg-config,
python3,
python3Packages,
mpi,
catalyst,
bzip2,
c-blosc2,
hdf5-mpi,
hdf5,
libfabric,
libpng,
libsodium,
Expand All @@ -25,9 +25,25 @@
yaml-cpp,
nlohmann_json,
llvmPackages,
ctestCheckHook,
mpiCheckPhaseHook,
testers,
mpiSupport ? true,
pythonSupport ? false,
withExamples ? false,
}:
let
adios2Packages = {
hdf5 = hdf5.override {
inherit mpi mpiSupport;
cppSupport = !mpiSupport;
};
catalyst = catalyst.override {
inherit mpi mpiSupport pythonSupport;
};
mpi4py = python3Packages.mpi4py.override { inherit mpi; };
};
in
stdenv.mkDerivation (finalAttrs: {
version = "2.10.2";
pname = "adios2";
Expand All @@ -41,7 +57,8 @@ stdenv.mkDerivation (finalAttrs: {

postPatch =
''
patchShebangs cmake/install/post/generate-adios2-config.sh.in
chmod +x cmake/install/post/adios2-config.pre.sh.in
patchShebangs cmake/install/post/{generate-adios2-config,adios2-config.pre}.sh.in
''
# Dynamic cast to nullptr on darwin platform, switch to unsafe reinterpret cast.
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
Expand All @@ -58,16 +75,17 @@ stdenv.mkDerivation (finalAttrs: {
pkg-config
]
++ lib.optionals pythonSupport [
python3
python3Packages.python
python3Packages.pybind11
python3Packages.pythonImportsCheckHook
];

buildInputs =
[
mpi
bzip2
c-blosc2
(hdf5-mpi.override { inherit mpi; })
adios2Packages.catalyst
adios2Packages.hdf5
libfabric
libpng
libsodium
Expand All @@ -82,53 +100,114 @@ stdenv.mkDerivation (finalAttrs: {
# Todo: add these optional dependencies in nixpkgs.
# sz
# mgard
# catalyst
]
++ lib.optional (lib.meta.availableOn stdenv.hostPlatform ucx) ucx
# openmp required by zfp
++ lib.optional stdenv.cc.isClang llvmPackages.openmp;

propagatedBuildInputs = lib.optionals pythonSupport [
(python3Packages.mpi4py.override { inherit mpi; })
python3Packages.numpy
];
propagatedBuildInputs =
lib.optional mpiSupport mpi
++ lib.optional pythonSupport python3Packages.numpy
++ lib.optional (mpiSupport && pythonSupport) adios2Packages.mpi4py;

cmakeFlags = [
# adios2 builtin modules
(lib.cmakeBool "ADIOS2_USE_DataMan" true)
(lib.cmakeBool "ADIOS2_USE_MHS" true)
(lib.cmakeBool "ADIOS2_USE_SST" mpiSupport)

# declare thirdparty dependencies explicitly
(lib.cmakeBool "ADIOS2_USE_EXTERNAL_DEPENDENCIES" true)
(lib.cmakeBool "ADIOS2_USE_Blosc2" true)
(lib.cmakeBool "ADIOS2_USE_BZip2" true)
(lib.cmakeBool "ADIOS2_USE_ZFP" true)
(lib.cmakeBool "ADIOS2_USE_SZ" false)
(lib.cmakeBool "ADIOS2_USE_LIBPRESSIO" false)
(lib.cmakeBool "ADIOS2_USE_MGARD" false)
(lib.cmakeBool "ADIOS2_USE_PNG" true)
(lib.cmakeBool "ADIOS2_USE_CUDA" false)
(lib.cmakeBool "ADIOS2_USE_Kokkos" false)
(lib.cmakeBool "ADIOS2_USE_MPI" mpiSupport)
(lib.cmakeBool "ADIOS2_USE_DAOS" false)
(lib.cmakeBool "ADIOS2_USE_DataSpaces" false)
(lib.cmakeBool "ADIOS2_USE_ZeroMQ" true)
(lib.cmakeBool "ADIOS2_USE_HDF5" true)
(lib.cmakeBool "ADIOS2_USE_HDF5_VOL" true)
(lib.cmakeBool "BUILD_TESTING" false)
(lib.cmakeBool "ADIOS2_USE_IME" false)
(lib.cmakeBool "ADIOS2_USE_Python" pythonSupport)
(lib.cmakeBool "ADIOS2_USE_Fortran" true)
(lib.cmakeBool "ADIOS2_USE_UCX" (lib.meta.availableOn stdenv.hostPlatform ucx))
(lib.cmakeBool "ADIOS2_USE_Sodium" true)
(lib.cmakeBool "ADIOS2_USE_Catalyst" true)
(lib.cmakeBool "ADIOS2_USE_Campaign" true)
(lib.cmakeBool "ADIOS2_USE_AWSSDK" false)

# use vendored gtest as nixpkgs#gtest does not include <iomanip> in <gtest/gtest.h>
(lib.cmakeBool "ADIOS2_USE_EXTERNAL_GTEST" false)
(lib.cmakeBool "BUILD_TESTING" finalAttrs.finalPackage.doCheck)
# higher MPIEXEC_MAX_NUMPROCS>8 might cause tests failure in
# - Engine.BP.BPJoinedArray.MultiBlock.BP4.MPI
# - Engine.BP.BPJoinedArray.MultiBlock.BP5.MPI
# - Bindings.Fortran.BPWriteReadHeatMap6D.MPI
# due to insufficiently robust data generation and comparison for larger MPI sizes.
(lib.cmakeFeature "MPIEXEC_MAX_NUMPROCS" "4")

# Enable support for Little/Big Endian Interoperability
(lib.cmakeBool "ADIOS2_USE_Endian_Reverse" true)

(lib.cmakeBool "ADIOS2_BUILD_EXAMPLES" withExamples)
(lib.cmakeBool "ADIOS2_USE_EXTERNAL_DEPENDENCIES" true)
(lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin")
(lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
(lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include")
(lib.cmakeFeature "CMAKE_INSTALL_PYTHONDIR" python3.sitePackages)
(lib.cmakeFeature "CMAKE_INSTALL_PYTHONDIR" python3Packages.python.sitePackages)
];

# equired for finding the generated adios2-config.cmake file
env.adios2_DIR = "${placeholder "out"}/lib/cmake/adios2";
# Tests are time-consuming and moved to passthru.tests.withCheck.
doCheck = false;
dontUseNinjaCheck = true;

# Ctest takes too much time, so we only perform some smoke Python tests.
doInstallCheck = pythonSupport;
preCheck = ''
export adios2_DIR=$PWD
'';

preCheck =
''
export PYTHONPATH=$out/${python3.sitePackages}:$PYTHONPATH
''
+ lib.optionalString (stdenv.hostPlatform.system == "aarch64-linux") ''
rm ../testing/adios2/python/TestBPWriteTypesHighLevelAPI.py
'';
enableParallelChecking = false;

pytestFlagsArray = [
"../testing/adios2/python/Test*.py"
__darwinAllowLocalNetworking = finalAttrs.finalPackage.doCheck && mpiSupport;

nativeCheckInputs = [
python3Packages.python
ctestCheckHook
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'd also need to use dontUseNinjaCheck = true for the hook to work, since the derivation uses ninja.

Worth noting though that there doesn't seem to be a use-case for it here. enableParallelChecking also works with plain make/ninja check phase since CMake hook also sets CTEST_PARALLEL_LEVEL env variable and that gets picked up by ctest. Its primary use is to pass additional flags / selectively disable tests in a more ergonomic manner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was meant to use ctestCheckHook to disable some tests failure on x86_64-linux platform, however i managed to fix thouse tests failure. I am opening this pr to see if there exist any tests failure on other platform and would like to disable thouse test failure.

mpiCheckPhaseHook
];

# required for finding the generated adios2-config.cmake file
preInstall = ''
export adios2_DIR=$out/lib/cmake/adios2
'';

pythonImportsCheck = [ "adios2" ];

nativeInstallCheckInputs = lib.optionals pythonSupport [
python3Packages.pythonImportsCheckHook
python3Packages.pytestCheckHook
];
passthru.tests = {
withCheck = finalAttrs.finalPackage.overrideAttrs {
doCheck = true;

disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
# TypeError: cannot pickle 'TextIOWrapper' instances
"Test.Engine.DataMan1xN.Serial"
"Test.Engine.DataManSingleValues"
# The test assumed to always contain n*64 byte-length records. Right now the length of index buffer is 71 bytes.
"Staging.1x1.Local2.BPS.BB.BP4_stream"
# Timeout
"Staging.3x5LockGeometry.FS.BB.FileStream"
"Engine.Staging.TestOnDemandMPI.ADIOS2OnDemandMPI.SST.MPI"
];
};

cmake-config = testers.hasCmakeConfigModules {
moduleNames = [ "adios2" ];
package = finalAttrs.finalPackage;
};
};

meta = {
homepage = "https://adios2.readthedocs.io/en/latest/";
Expand Down
1 change: 0 additions & 1 deletion pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ self: super: with self; {

adios2 = toPythonModule (
pkgs.adios2.override {
python3 = python;
python3Packages = self;
pythonSupport = true;
}
Expand Down