mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 16:03:23 +00:00
gromacs: fix SIMD flags, and OpenMP
* make CPU acceleration selectable. * update cmake flag for acceleration CPU_ACCELERATION -> SIMD GMX_CPU_ACCELERATION is outdated and has been ignored. * add hwloc to inputs * always build with OpenMP * change name -> pname
This commit is contained in:
parent
75b469241b
commit
58e1666a58
@ -1,26 +1,44 @@
|
|||||||
{ stdenv
|
{ stdenv
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, cmake
|
, cmake
|
||||||
, singlePrec ? true
|
, hwloc
|
||||||
, mpiEnabled ? false
|
|
||||||
, fftw
|
, fftw
|
||||||
, openmpi
|
, openmpi
|
||||||
, perl
|
, perl
|
||||||
|
, singlePrec ? true
|
||||||
|
, mpiEnabled ? false
|
||||||
|
, cpuAcceleration ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
let
|
||||||
name = "gromacs-2020.4";
|
# 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 {
|
src = fetchurl {
|
||||||
url = "ftp://ftp.gromacs.org/pub/gromacs/gromacs-2020.4.tar.gz";
|
url = "ftp://ftp.gromacs.org/pub/gromacs/gromacs-${version}.tar.gz";
|
||||||
sha256 = "1rplvgna60nqyb8nspaz3bfkwb044kv3zxdaa5whql5m441nj6am";
|
sha256 = "1rplvgna60nqyb8nspaz3bfkwb044kv3zxdaa5whql5m441nj6am";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
buildInputs = [ fftw perl ]
|
buildInputs = [ fftw perl hwloc ]
|
||||||
++ (stdenv.lib.optionals mpiEnabled [ openmpi ]);
|
++ (stdenv.lib.optionals mpiEnabled [ openmpi ]);
|
||||||
|
|
||||||
cmakeFlags = (
|
cmakeFlags = [
|
||||||
|
"-DGMX_SIMD:STRING=${SIMD cpuAcceleration}"
|
||||||
|
"-DGMX_OPENMP:BOOL=TRUE"
|
||||||
|
] ++ (
|
||||||
if singlePrec then [
|
if singlePrec then [
|
||||||
"-DGMX_DOUBLE=OFF"
|
"-DGMX_DOUBLE=OFF"
|
||||||
] else [
|
] else [
|
||||||
@ -30,8 +48,6 @@ stdenv.mkDerivation {
|
|||||||
) ++ (
|
) ++ (
|
||||||
if mpiEnabled then [
|
if mpiEnabled then [
|
||||||
"-DGMX_MPI:BOOL=TRUE"
|
"-DGMX_MPI:BOOL=TRUE"
|
||||||
"-DGMX_CPU_ACCELERATION:STRING=SSE4.1"
|
|
||||||
"-DGMX_OPENMP:BOOL=TRUE"
|
|
||||||
"-DGMX_THREAD_MPI:BOOL=FALSE"
|
"-DGMX_THREAD_MPI:BOOL=FALSE"
|
||||||
] else [
|
] else [
|
||||||
"-DGMX_MPI:BOOL=FALSE"
|
"-DGMX_MPI:BOOL=FALSE"
|
||||||
|
Loading…
Reference in New Issue
Block a user