From 19e71dfa871977759b6a3eff7479e4a07e77038b Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Thu, 28 Oct 2021 13:50:39 +0200 Subject: [PATCH 1/2] gromacs: 2020.4 -> 2021.3, cuda, mpi cleanups, performance tunings gromacs: dont build double cuda version gromacs: propagate mpi --- .../molecular-dynamics/gromacs/default.nix | 52 +++++++++++-------- pkgs/top-level/all-packages.nix | 23 +++++--- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix index bdec2ccc669f..b0feba4de3d1 100644 --- a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix +++ b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix @@ -1,13 +1,8 @@ -{ lib, stdenv -, fetchurl -, cmake -, hwloc -, fftw -, perl -, singlePrec ? true -, mpiEnabled ? false -, mpi -, cpuAcceleration ? null +{ lib, stdenv, fetchurl, cmake, hwloc, fftw, perl, blas, lapack, + singlePrec ? true, + mpi ? null, + cudatoolkit ? null, + cpuAcceleration ? null }: let @@ -24,20 +19,32 @@ let in stdenv.mkDerivation rec { pname = "gromacs"; - version = "2020.4"; + version = "2021.3"; src = fetchurl { url = "ftp://ftp.gromacs.org/pub/gromacs/gromacs-${version}.tar.gz"; - sha256 = "1rplvgna60nqyb8nspaz3bfkwb044kv3zxdaa5whql5m441nj6am"; + sha256 = "4QmFbsREdo373kHzBZ4xI6vbj+Vsozsag/Me1FdaHMY="; }; nativeBuildInputs = [ cmake ]; - buildInputs = [ fftw perl hwloc ] - ++ (lib.optionals mpiEnabled [ mpi ]); + + buildInputs = [ + fftw + perl + hwloc + blas + lapack + ] ++ lib.lists.optional (mpi != null) mpi + ++ lib.lists.optional (cudatoolkit != null) cudatoolkit + ; + + propagatedBuildInputs = lib.lists.optional (mpi != null) mpi; + propagatedUserEnvPkgs = lib.lists.optional (mpi != null) mpi; cmakeFlags = [ "-DGMX_SIMD:STRING=${SIMD cpuAcceleration}" "-DGMX_OPENMP:BOOL=TRUE" + "-DBUILD_SHARED_LIBS=ON" ] ++ ( if singlePrec then [ "-DGMX_DOUBLE=OFF" @@ -46,13 +53,15 @@ in stdenv.mkDerivation rec { "-DGMX_DEFAULT_SUFFIX=OFF" ] ) ++ ( - if mpiEnabled then [ - "-DGMX_MPI:BOOL=TRUE" - "-DGMX_THREAD_MPI:BOOL=FALSE" - ] else [ - "-DGMX_MPI:BOOL=FALSE" - ] - ); + if (mpi != null) + then [ + "-DGMX_MPI:BOOL=TRUE" + "-DGMX_THREAD_MPI:BOOL=FALSE" + ] + else [ + "-DGMX_MPI:BOOL=FALSE" + ] + ) ++ lib.lists.optional (cudatoolkit != null) "-DGMX_GPU=CUDA"; meta = with lib; { homepage = "http://www.gromacs.org"; @@ -78,5 +87,6 @@ in stdenv.mkDerivation rec { See: http://www.gromacs.org/About_Gromacs for details. ''; platforms = platforms.unix; + maintainers = with maintainers; [ sheepforce markuskowa ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 52c23d8e4c44..9b889bf2b385 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31197,30 +31197,37 @@ with pkgs; gromacs = callPackage ../applications/science/molecular-dynamics/gromacs { singlePrec = true; - mpiEnabled = false; + mpi = null; fftw = fftwSinglePrec; - cmake = cmakeCurses; + cudatoolkit = null; }; gromacsMpi = lowPrio (gromacs.override { singlePrec = true; - mpiEnabled = true; + mpi = mpi; fftw = fftwSinglePrec; - cmake = cmakeCurses; + cudatoolkit = null; }); gromacsDouble = lowPrio (gromacs.override { singlePrec = false; - mpiEnabled = false; + mpi = null; fftw = fftw; - cmake = cmakeCurses; + cudatoolkit = null; }); gromacsDoubleMpi = lowPrio (gromacs.override { singlePrec = false; - mpiEnabled = true; + mpi = mpi; fftw = fftw; - cmake = cmakeCurses; + cudatoolkit = null; + }); + + gromacsCudaMpi = lowPrio (gromacs.override { + singlePrec = true; + mpi = mpi; + fftw = fftwSinglePrec; + cudatoolkit = cudatoolkit; }); zegrapher = libsForQt5.callPackage ../applications/science/math/zegrapher { }; From e4d824f4e3238132162c0a1032770094ae4f59d0 Mon Sep 17 00:00:00 2001 From: Phillip Seeber Date: Thu, 28 Oct 2021 14:52:30 +0200 Subject: [PATCH 2/2] gromacs: bool switches for MPI and CUDA --- .../molecular-dynamics/gromacs/default.nix | 18 +++++++++--------- pkgs/top-level/all-packages.nix | 14 ++++---------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix index b0feba4de3d1..6d7f4bf09092 100644 --- a/pkgs/applications/science/molecular-dynamics/gromacs/default.nix +++ b/pkgs/applications/science/molecular-dynamics/gromacs/default.nix @@ -1,7 +1,7 @@ -{ lib, stdenv, fetchurl, cmake, hwloc, fftw, perl, blas, lapack, +{ lib, stdenv, fetchurl, cmake, hwloc, fftw, perl, blas, lapack, mpi, cudatoolkit, singlePrec ? true, - mpi ? null, - cudatoolkit ? null, + enableMpi ? false, + enableCuda ? false, cpuAcceleration ? null }: @@ -34,12 +34,12 @@ in stdenv.mkDerivation rec { hwloc blas lapack - ] ++ lib.lists.optional (mpi != null) mpi - ++ lib.lists.optional (cudatoolkit != null) cudatoolkit + ] ++ lib.lists.optional enableMpi mpi + ++ lib.lists.optional enableCuda cudatoolkit ; - propagatedBuildInputs = lib.lists.optional (mpi != null) mpi; - propagatedUserEnvPkgs = lib.lists.optional (mpi != null) mpi; + propagatedBuildInputs = lib.lists.optional enableMpi mpi; + propagatedUserEnvPkgs = lib.lists.optional enableMpi mpi; cmakeFlags = [ "-DGMX_SIMD:STRING=${SIMD cpuAcceleration}" @@ -53,7 +53,7 @@ in stdenv.mkDerivation rec { "-DGMX_DEFAULT_SUFFIX=OFF" ] ) ++ ( - if (mpi != null) + if enableMpi then [ "-DGMX_MPI:BOOL=TRUE" "-DGMX_THREAD_MPI:BOOL=FALSE" @@ -61,7 +61,7 @@ in stdenv.mkDerivation rec { else [ "-DGMX_MPI:BOOL=FALSE" ] - ) ++ lib.lists.optional (cudatoolkit != null) "-DGMX_GPU=CUDA"; + ) ++ lib.lists.optional enableCuda "-DGMX_GPU=CUDA"; meta = with lib; { homepage = "http://www.gromacs.org"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9b889bf2b385..97b965de9c67 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31197,37 +31197,31 @@ with pkgs; gromacs = callPackage ../applications/science/molecular-dynamics/gromacs { singlePrec = true; - mpi = null; fftw = fftwSinglePrec; - cudatoolkit = null; }; gromacsMpi = lowPrio (gromacs.override { singlePrec = true; - mpi = mpi; + enableMpi = true; fftw = fftwSinglePrec; - cudatoolkit = null; }); gromacsDouble = lowPrio (gromacs.override { singlePrec = false; - mpi = null; fftw = fftw; - cudatoolkit = null; }); gromacsDoubleMpi = lowPrio (gromacs.override { singlePrec = false; - mpi = mpi; + enableMpi = true; fftw = fftw; - cudatoolkit = null; }); gromacsCudaMpi = lowPrio (gromacs.override { singlePrec = true; - mpi = mpi; + enableMpi = true; + enableCuda = true; fftw = fftwSinglePrec; - cudatoolkit = cudatoolkit; }); zegrapher = libsForQt5.callPackage ../applications/science/math/zegrapher { };