mpi: use mpi attribute consistently as the default MPI implementations

Use the attribute mpi to provide a system wide default MPI
implementation. The default is openmpi (as before).
This now allows for overriding the MPI implentation by using
the overlay mechanism. Build all packages with mpich instead
of the default openmpi can now be achived like this:
self: super:
 {
   mpi = super.mpich;
 }

All derivations that have been using "mpi ? null" to provide optional
building with MPI have been change in the following way to allow for
optional builds with MPI:
{ ...
, mpi
, useMpi ? false
}
This commit is contained in:
Markus Kowalewski
2021-01-10 13:40:19 +01:00
parent f6a583eeec
commit 6dba41fbcb
27 changed files with 90 additions and 102 deletions

View File

@@ -1,7 +1,7 @@
{ stdenv, lib, fetchFromGitHub, fetchpatch, buildPythonPackage, python,
cudaSupport ? false, cudatoolkit ? null, cudnn ? null, nccl ? null, magma ? null,
mklDnnSupport ? true, useSystemNccl ? true,
openMPISupport ? false, openmpi ? null,
MPISupport ? false, mpi,
buildDocs ? false,
cudaArchList ? null,
@@ -29,8 +29,6 @@
isPy3k, pythonOlder }:
assert !openMPISupport || openmpi != null;
# assert that everything needed for cuda is present and that the correct cuda versions are used
assert !cudaSupport || cudatoolkit != null;
assert cudnn == null || cudatoolkit != null;
@@ -38,7 +36,7 @@ assert !cudaSupport || (let majorIs = lib.versions.major cudatoolkit.version;
in majorIs == "9" || majorIs == "10" || majorIs == "11");
# confirm that cudatoolkits are sync'd across dependencies
assert !(openMPISupport && cudaSupport) || openmpi.cudatoolkit == cudatoolkit;
assert !(MPISupport && cudaSupport) || mpi.cudatoolkit == cudatoolkit;
assert !cudaSupport || magma.cudatoolkit == cudatoolkit;
let
@@ -224,7 +222,7 @@ in buildPythonPackage rec {
typing-extensions
# the following are required for tensorboard support
pillow six future tensorflow-tensorboard protobuf
] ++ lib.optionals openMPISupport [ openmpi ]
] ++ lib.optionals MPISupport [ mpi ]
++ lib.optionals (pythonOlder "3.7") [ dataclasses ];
checkInputs = [ hypothesis ninja psutil ];