flake.lib.buildNixpkgsConfig: enable lsf support for openmpi

This commit is contained in:
2026-01-03 15:57:18 +08:00
parent 6efc29a7a4
commit ebc05b9911
5 changed files with 75 additions and 40 deletions

View File

@@ -73,6 +73,11 @@ in platformConfig //
{ commandLineArgs = prev.commandLineArgs or "" + " --disable-features=GlobalShortcutsPortal"; });
xray = prev.xray.overrideAttrs (prev: { patches = prev.patches or [] ++ [ ./xray.patch ]; });
btop = prev.btop.overrideAttrs (prev: { patches = prev.patches or [] ++ [ ./btop.patch ]; });
prrte = prev.prrte.overrideAttrs (prev:
{
configureFlags = prev.configureFlags or [] ++ [ "--with-lsf" ];
buildInputs = prev.buildInputs or [] ++ [ final.localPackages.lsf final.libnsl ];
});
}
// (
let

View File

@@ -211,4 +211,13 @@
structuredExtraConfig = { BTRFS_ALLOCATOR_HINTS = lib.kernel.yes; BTRFS_READ_POLICIES = lib.kernel.yes; };
};
};
# download include from /opt/ibm/lsfsuite/lsf/10.1/include into lsf/include
# download lib from /opt/ibm/lsfsuite/lsf/10.1/linux2.6-glibc2.3-x86_64/lib into lsf/lib and only preserve .so
lsf = pkgs.requireFile
{
name = "lsf";
sha256 = "0rij4xx705yj1vr5jd31hb8izmb35vkrdql0850qc5cn30jnkf4l";
hashMode = "recursive";
message = "lsf not found.";
};
}

View File

@@ -147,6 +147,7 @@ inputs: rec
missgram = inputs.pkgs.callPackage ./missgram { inherit biu sqlgen; stdenv = inputs.pkgs.clang18Stdenv; };
sqlgen = inputs.pkgs.callPackage ./sqlgen.nix { src = inputs.topInputs.sqlgen; inherit reflectcpp; };
reflectcpp = inputs.pkgs.callPackage ./reflectcpp.nix { src = inputs.topInputs.reflectcpp; };
lsf = inputs.pkgs.callPackage ./lsf.nix { src = inputs.topInputs.self.src.lsf; };
fromYaml = content: builtins.fromJSON (builtins.readFile
(inputs.pkgs.runCommand "toJSON" {}

18
packages/lsf.nix Normal file
View File

@@ -0,0 +1,18 @@
{ stdenv, src, autoPatchelfHook, libz }: stdenv.mkDerivation rec
{
name = "lsf";
inherit src;
dontConfigure = true;
dontBuild = true;
buildInputs = [ stdenv.cc.cc libz ];
nativeBuildInputs = [ autoPatchelfHook ];
autoPatchelfIgnoreMissingDeps = [ "libnvidia-ml.so.1" ];
installPhase =
''
runHook preInstall
mkdir -p $out
cp -r * $out
rm $out/lib/{hwloc_nvml,sec_ego_kerberos,sec_ego_gsskrb,sec_ego_pam_default}.so
runHook postInstall
'';
}

View File

@@ -1,44 +1,46 @@
{ stdenv, src, writeShellScriptBin, lib, rsync, which, wannier90, hdf5, mpi, mkl }:
let vasp = stdenv.mkDerivation
{
name = "vasp-intel";
src = src.vasp;
patches = [ ../vtst.patch ];
configurePhase =
let
vasp = stdenv.mkDerivation
{
name = "vasp-intel";
src = src.vasp;
patches = [ ../vtst.patch ];
configurePhase =
''
cp ${./makefile.include} makefile.include
chmod +w makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
cp -r ${src.vtst.patch}/vtstcode6.4.3/* src
chmod -R +w src
'';
buildInputs = [ hdf5 wannier90 mkl ];
nativeBuildInputs = [ rsync which mpi ];
installPhase =
''
mkdir -p $out/bin
for i in std gam ncl; do cp bin/vasp_$i $out/bin/vasp-$i; done
'';
# NIX_DEBUG = "7";
enableParallelBuilding = true;
env = { DEPS = "1"; MKLROOT = mkl; OMPI_F90 = "ifx"; };
};
wrapper = writeShellScriptBin "vasp-intel"
''
cp ${./makefile.include} makefile.include
chmod +w makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
cp -r ${src.vtst.patch}/vtstcode6.4.3/* src
chmod -R +w src
'';
buildInputs = [ hdf5 wannier90 mkl ];
nativeBuildInputs = [ rsync which mpi ];
installPhase =
''
mkdir -p $out/bin
for i in std gam ncl; do cp bin/vasp_$i $out/bin/vasp-$i; done
'';
# NIX_DEBUG = "7";
enableParallelBuilding = true;
env = { DEPS = "1"; MKLROOT = mkl; OMPI_F90 = "ifx"; };
};
in writeShellScriptBin "vasp-intel"
''
export PATH=${vasp}/bin:${mpi}/bin''${PATH:+:$PATH}
export PATH=${vasp}/bin:${mpi}/bin''${PATH:+:$PATH}
# set OMP_NUM_THREADS if SLURM_CPUS_PER_TASK is set
if [ -z "$OMP_NUM_THREADS" ] && [ -n "$SLURM_CPUS_PER_TASK" ]; then
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
fi
# set OMP_NUM_THREADS to 1 if not set
if [ -z "$OMP_NUM_THREADS" ]; then
export OMP_NUM_THREADS=1
fi
# set OMP_STACKSIZE to 512M if not set
if [ -z "$OMP_STACKSIZE" ]; then
export OMP_STACKSIZE=512m
fi
# set OMP_NUM_THREADS if SLURM_CPUS_PER_TASK is set
if [ -z "$OMP_NUM_THREADS" ] && [ -n "$SLURM_CPUS_PER_TASK" ]; then
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
fi
# set OMP_NUM_THREADS to 1 if not set
if [ -z "$OMP_NUM_THREADS" ]; then
export OMP_NUM_THREADS=1
fi
# set OMP_STACKSIZE to 512M if not set
if [ -z "$OMP_STACKSIZE" ]; then
export OMP_STACKSIZE=512m
fi
exec "$@"
''
exec "$@"
'';
in wrapper // { passthru = wrapper.passthru // { inherit mpi; }; }