mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:39:23 +08:00
localPackages.vasp-gpu: fix
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
{ buildFHSEnv, writeScript, stdenvNoCC, requireFile, nvhpc, lmod }:
|
||||
{
|
||||
buildFHSEnv, writeScript, stdenvNoCC, requireFile, substituteAll,
|
||||
config, cudaCapabilities ? config.cudaCapabilities, nvhpcArch ? config.nvhpcArch or "px",
|
||||
nvhpc, lmod
|
||||
}:
|
||||
let
|
||||
env = buildFHSEnv
|
||||
{
|
||||
@@ -14,6 +18,14 @@ let
|
||||
export MKLROOT=/usr
|
||||
make DEPS=1 -j$NIX_BUILD_CORES
|
||||
'';
|
||||
include = substituteAll
|
||||
{
|
||||
src = ./makefile.include;
|
||||
cudaCapabilities = builtins.concatStringsSep "," (builtins.map
|
||||
(cap: "cc${builtins.replaceStrings ["."] [""] cap}")
|
||||
cudaCapabilities);
|
||||
inherit nvhpcArch;
|
||||
};
|
||||
vasp = stdenvNoCC.mkDerivation rec
|
||||
{
|
||||
pname = "vasp";
|
||||
@@ -26,7 +38,7 @@ let
|
||||
hashMode = "recursive";
|
||||
message = "Source file not found.";
|
||||
};
|
||||
configurePhase = "cp ${./makefile.include} makefile.include";
|
||||
configurePhase = "cp ${include} makefile.include";
|
||||
enableParallelBuilding = true;
|
||||
buildPhase = "${env}/bin/env ${buildScript}";
|
||||
installPhase =
|
||||
@@ -35,8 +47,16 @@ let
|
||||
cp -r bin $out
|
||||
'';
|
||||
};
|
||||
startScript = writeScript "start"
|
||||
''
|
||||
. /usr/share/lmod/lmod/init/bash
|
||||
module use /usr/share/nvhpc/modulefiles
|
||||
module load nvhpc
|
||||
exec $@
|
||||
'';
|
||||
in buildFHSEnv
|
||||
{
|
||||
name = "vasp-gpu";
|
||||
targetPkgs = pkgs: with pkgs; [ nvhpc gfortran zlib mkl lmod vasp ];
|
||||
runScript = startScript;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ CPP = nvfortran -Mpreprocess -Mfree -Mextend -E $(CPP_OPTIONS) $*$(FUFFI
|
||||
|
||||
# N.B.: you might need to change the cuda-version here
|
||||
# to one that comes with your NVIDIA-HPC SDK
|
||||
FC = mpif90 -acc -gpu=cc89,cuda12.3 -mp
|
||||
FCL = mpif90 -acc -gpu=cc89,cuda12.3 -mp -c++libs
|
||||
FC = mpif90 -acc -gpu=@cudaCapabilities@ -mp
|
||||
FCL = mpif90 -acc -gpu=@cudaCapabilities@ -mp -c++libs
|
||||
|
||||
FREE = -Mfree
|
||||
|
||||
@@ -56,7 +56,7 @@ CXX_PARS = nvc++ --no_warnings
|
||||
##
|
||||
# When compiling on the target machine itself , change this to the
|
||||
# relevant target when cross-compiling for another architecture
|
||||
VASP_TARGET_CPU ?= -tp=zen4
|
||||
VASP_TARGET_CPU ?= -tp=@nvhpcArch@
|
||||
FFLAGS += $(VASP_TARGET_CPU)
|
||||
|
||||
# Specify your NV HPC-SDK installation (mandatory)
|
||||
|
||||
@@ -28,7 +28,7 @@ inputs:
|
||||
# text editor
|
||||
appflowy notion-app-enhanced joplin-desktop standardnotes logseq
|
||||
# math, physics and chemistry
|
||||
mathematica paraview localPackages.vasp jmol # qchem.quantum-espresso
|
||||
mathematica paraview localPackages.vasp localPackages.vasp-gpu jmol # qchem.quantum-espresso
|
||||
# encryption and password management
|
||||
john crunch hashcat
|
||||
# container and vm
|
||||
|
||||
@@ -151,7 +151,8 @@ inputs:
|
||||
{
|
||||
nixpkgs.config = { cudaSupport = true; }
|
||||
// (if nixpkgs.cuda.capabilities != null then { cudaCapabilities = nixpkgs.cuda.capabilities; } else {})
|
||||
// (if nixpkgs.cuda.forwardCompat != null then { cudaForwardCompat = nixpkgs.cuda.forwardCompat; } else {});
|
||||
// (if nixpkgs.cuda.forwardCompat != null then { cudaForwardCompat = nixpkgs.cuda.forwardCompat; } else {})
|
||||
// (if nixpkgs.march != null then { nvhpcArch = nixpkgs.march; } else {});
|
||||
environment.systemPackages = [ inputs.pkgs.cudatoolkit ];
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user