about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/molecular-dynamics
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
commite0794be8a0d11e90461e5a9c85012a36b93ec976 (patch)
treeefd9cbc55ea3322867bf601c4d536758a3dd5fcc /nixpkgs/pkgs/applications/science/molecular-dynamics
parent3538874082ded7647b1ccec0343c7c1e882cfef3 (diff)
parent1a57d96edd156958b12782e8c8b6a374142a7248 (diff)
downloadnixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.gz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.bz2
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.lz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.xz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.zst
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.zip
Merge commit '1a57d96edd156958b12782e8c8b6a374142a7248'
Diffstat (limited to 'nixpkgs/pkgs/applications/science/molecular-dynamics')
-rw-r--r--nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/default.nix36
1 files changed, 26 insertions, 10 deletions
diff --git a/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/default.nix b/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/default.nix
index 151abb099f5b..84dd3b729b2b 100644
--- a/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/default.nix
+++ b/nixpkgs/pkgs/applications/science/molecular-dynamics/gromacs/default.nix
@@ -1,26 +1,44 @@
 { stdenv
 , fetchurl
 , cmake
-, singlePrec ? true
-, mpiEnabled ? false
+, hwloc
 , fftw
 , openmpi
 , perl
+, singlePrec ? true
+, mpiEnabled ? false
+, cpuAcceleration ? null
 }:
 
-stdenv.mkDerivation {
-  name = "gromacs-2020.3";
+let
+  # Select reasonable defaults for all major platforms
+  # The possible values are defined in CMakeLists.txt:
+  # AUTO None SSE2 SSE4.1 AVX_128_FMA AVX_256 AVX2_256
+  # AVX2_128 AVX_512 AVX_512_KNL MIC ARM_NEON ARM_NEON_ASIMD
+  SIMD = x: if (cpuAcceleration != null) then x else
+    if stdenv.hostPlatform.system == "i686-linux" then "SSE2" else
+    if stdenv.hostPlatform.system == "x86_64-linux" then "SSE4.1" else
+    if stdenv.hostPlatform.system == "x86_64-darwin" then "SSE4.1" else
+    if stdenv.hostPlatform.system == "aarch64-linux" then "ARM_NEON" else
+    "None";
+
+in stdenv.mkDerivation rec {
+  pname = "gromacs";
+  version = "2020.4";
 
   src = fetchurl {
-    url = "ftp://ftp.gromacs.org/pub/gromacs/gromacs-2020.3.tar.gz";
-    sha256 = "1acjrhcfzpqy2dncblhj97602jbg9gdha4q1bgji9nrj25lq6cch";
+    url = "ftp://ftp.gromacs.org/pub/gromacs/gromacs-${version}.tar.gz";
+    sha256 = "1rplvgna60nqyb8nspaz3bfkwb044kv3zxdaa5whql5m441nj6am";
   };
 
   nativeBuildInputs = [ cmake ];
-  buildInputs = [ fftw perl ]
+  buildInputs = [ fftw perl hwloc ]
   ++ (stdenv.lib.optionals mpiEnabled [ openmpi ]);
 
-  cmakeFlags = (
+  cmakeFlags = [
+    "-DGMX_SIMD:STRING=${SIMD cpuAcceleration}"
+    "-DGMX_OPENMP:BOOL=TRUE"
+  ] ++ (
     if singlePrec then [
       "-DGMX_DOUBLE=OFF"
     ] else [
@@ -30,8 +48,6 @@ stdenv.mkDerivation {
   ) ++ (
     if mpiEnabled then [
       "-DGMX_MPI:BOOL=TRUE"
-      "-DGMX_CPU_ACCELERATION:STRING=SSE4.1"
-      "-DGMX_OPENMP:BOOL=TRUE"
       "-DGMX_THREAD_MPI:BOOL=FALSE"
     ] else [
       "-DGMX_MPI:BOOL=FALSE"