简化 vasp 打包

This commit is contained in:
2024-05-13 18:44:51 +08:00
parent e0f992ead9
commit 055f63f0c9
23 changed files with 109 additions and 1106 deletions

View File

@@ -1,25 +0,0 @@
{ version ? "4.2.0", stdenv, fetchurl, lib }:
let versions =
{
"4.1.0" = "1k9anln9hmdjflrkq4iacrmhma7gfrfj6d0b8ywxys0wfpdvy12v";
"4.2.0" = "1aycw6ygzr1db6xf3z7v5lpznhs8j7gcpkawd304vcj5qw75cnpd";
};
in stdenv.mkDerivation
{
pname = "aocc";
inherit version;
src = fetchurl
{
url = "https://download.amd.com/developer/eula/aocc/aocc-"
+ builtins.concatStringsSep "-" (lib.lists.take 2 (builtins.splitVersion version))
+ "/aocc-compiler-${version}.tar";
sha256 = versions.${version};
};
dontBuild = true;
installPhase =
''
mkdir -p $out
cp -r bin include lib lib32 libexec share $out
'';
dontFixup = true;
}

View File

@@ -1,28 +0,0 @@
{ version ? "4.2.0", stdenv, fetchurl, lib }:
let versions =
{
"4.1.0" = "04780c2zks0g76c4n4a2cbbhs1qz4lza4ffiw1fj0md3f1lxihr5";
"4.2.0" = "0p4x0zza6y18hjjs1971gyc5kjd2f8nzzynp2jabhl2vxiys2nnj";
};
in stdenv.mkDerivation
{
pname = "aocl";
inherit version;
src = fetchurl
{
url = "https://download.amd.com/developer/eula/aocl/aocl-"
+ builtins.concatStringsSep "-" (lib.lists.take 2 (builtins.splitVersion version))
+ "/aocl-linux-aocc-${version}.tar.gz";
sha256 = versions.${version};
};
dontBuild = true;
installPhase =
''
installDir=$(mktemp -d)
bash ./install.sh -t $installDir
mkdir -p $out
cp -r $installDir/${version}/aocc/lib_LP64 $out/lib
cp -r $installDir/${version}/aocc/include_LP64 $out/include
'';
dontFixup = true;
}

View File

@@ -43,44 +43,27 @@ inputs: rec
lmod = inputs.pkgs.callPackage ./lmod { src = inputs.topInputs.lmod; };
vasp = rec
{
source = inputs.pkgs.callPackage ./vasp/source.nix {};
src = inputs.pkgs.callPackage ./vasp/source.nix {};
gnu = inputs.pkgs.callPackage ./vasp/gnu
{
inherit (inputs.pkgs.llvmPackages) openmp;
inherit wannier90 additionalCommands;
hdf5 = inputs.pkgs.hdf5.override { mpiSupport = true; fortranSupport = true; };
};
gnu-mkl = inputs.pkgs.callPackage ./vasp/gnu-mkl
{
inherit (inputs.pkgs.llvmPackages) openmp;
inherit wannier90 additionalCommands;
inherit wannier90 src;
hdf5 = inputs.pkgs.hdf5.override { mpiSupport = true; fortranSupport = true; };
};
nvidia = inputs.pkgs.callPackage ./vasp/nvidia
{ inherit lmod nvhpc wannier90 additionalCommands vtst; hdf5 = hdf5-nvhpc; };
{ inherit lmod nvhpc wannier90 vtst src; hdf5 = hdf5-nvhpc; };
intel = inputs.pkgs.callPackage ./vasp/intel
{ inherit lmod oneapi wannier90 additionalCommands vtst; hdf5 = hdf5-oneapi; };
amd = inputs.pkgs.callPackage ./vasp/amd
{ inherit aocc aocl wannier90 additionalCommands; hdf5 = hdf5-aocc; openmpi = openmpi-aocc; gcc = gcc-pie; };
{ inherit lmod oneapi wannier90 vtst src; hdf5 = hdf5-oneapi; };
wannier90 = inputs.pkgs.callPackage
"${inputs.topInputs.nixpkgs-unstable}/pkgs/by-name/wa/wannier90/package.nix" {};
hdf5-nvhpc = inputs.pkgs.callPackage ./vasp/hdf5-nvhpc { inherit lmod nvhpc; inherit (inputs.pkgs.hdf5) src; };
hdf5-oneapi = inputs.pkgs.callPackage ./vasp/hdf5-oneapi { inherit lmod oneapi; inherit (inputs.pkgs.hdf5) src; };
hdf5-aocc = inputs.pkgs.callPackage ./vasp/hdf5-aocc
{ inherit (inputs.pkgs.hdf5) src; inherit aocc; openmpi = openmpi-aocc; gcc = gcc-pie; };
openmpi-aocc = inputs.pkgs.callPackage ./vasp/openmpi-aocc { inherit aocc; gcc = gcc-pie; };
gcc-pie = inputs.pkgs.wrapCC (inputs.pkgs.gcc.cc.overrideAttrs (prev:
{ configureFlags = prev.configureFlags ++ [ "--enable-default-pie" ];}));
additionalCommands = let uid = inputs.config.nixos.user.uid.gb; in
''[ "$(${inputs.pkgs.coreutils}/bin/id -u)" -eq ${builtins.toString uid} ] && exit 1'';
vtst = (inputs.pkgs.callPackage ./vasp/vtst.nix {});
vtstscripts = inputs.pkgs.callPackage ./vasp/vtstscripts.nix {};
};
# TODO: use other people packaged hpc version
oneapi = inputs.pkgs.callPackage ./oneapi {};
mumax = inputs.pkgs.callPackage ./mumax { src = inputs.topInputs.mumax; };
aocc = inputs.pkgs.callPackage ./aocc {};
aocl = inputs.pkgs.callPackage ./aocl {};
kylin-virtual-keyboard = inputs.pkgs.libsForQt5.callPackage ./kylin-virtual-keyboard
{ src = inputs.topInputs.kylin-virtual-keyboard; };
biu = inputs.pkgs.callPackage ./biu { inherit nameof; };

View File

@@ -1,75 +0,0 @@
{
buildFHSEnv, writeScript, stdenvNoCC, requireFile, substituteAll,
aocc, rsync, which, hdf5, wannier90, aocl, openmpi, gcc, zlib, glibc, binutils, libpsm2,
additionalCommands ? ""
}:
let
sources = import ../source.nix { inherit requireFile; };
buildEnv = buildFHSEnv
{
name = "buildEnv";
targetPkgs = _: [ zlib aocc aocl openmpi gcc.cc gcc.cc.lib glibc.dev binutils.bintools ];
};
buildScript = writeScript "build"
''
mkdir -p bin
make DEPS=1 -j$NIX_BUILD_CORES
'';
include = version: substituteAll
{
src = ./makefile.include-${version};
gccArch = stdenvNoCC.hostPlatform.gcc.arch;
};
vasp = version: stdenvNoCC.mkDerivation rec
{
pname = "vasp-amd";
inherit version;
src = sources.${version};
configurePhase =
''
cp ${include version} makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
'';
buildInputs = [ wannier90 ];
nativeBuildInputs = [ rsync which ];
AMDBLIS_ROOT = aocl;
AMDLIBFLAME_ROOT = aocl;
AMDSCALAPACK_ROOT = aocl;
AMDFFTW_ROOT = aocl;
HDF5_ROOT = hdf5;
WANNIER90_ROOT = wannier90;
OMPI_CC = "clang";
OMPI_CXX = "clang++";
OMPI_FC = "flang";
buildPhase = "${buildEnv}/bin/buildEnv ${buildScript}";
installPhase =
''
mkdir -p $out/bin
for i in std gam ncl; do cp bin/vasp_$i $out/bin/vasp-$i; done
'';
dontFixup = true;
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
};
startScript = version: writeScript "vasp-nvidia-${version}"
''
# if OMP_NUM_THREADS is not set, set it according to SLURM_CPUS_PER_TASK or to 1
if [ -z "''${OMP_NUM_THREADS-}" ]; then
if [ -n "''${SLURM_CPUS_PER_TASK-}" ]; then
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
else
OMP_NUM_THREADS=1
fi
fi
export OMP_NUM_THREADS
${additionalCommands}
exec "$@"
'';
runEnv = version: buildFHSEnv
{
name = "vasp-amd-${builtins.replaceStrings ["."] [""] version}-env";
targetPkgs = _: [ zlib (vasp version) aocc aocl openmpi gcc.cc.lib hdf5 wannier90 libpsm2 ];
runScript = startScript version;
};
in builtins.mapAttrs (version: _: runEnv version) sources

View File

@@ -1,91 +0,0 @@
# Default precompiler options
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Dvasp6 \
-Duse_bse_te \
-Dtbdyn \
-Dfock_dblbuf \
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
CPP = flang -E -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS) -ffree-form
FC = mpif90 -fopenmp
FCL = mpif90 -fopenmp
FREE = -ffree-form -ffree-line-length-none
FFLAGS = -w -fno-fortran-main -Mbackslash
OFLAG = -O2
OFLAG_IN = $(OFLAG)
DEBUG = -O0
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
OBJECTS_O2 += fft3dlib.o
# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = $(FC)
CC_LIB = clang
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB = $(FREE)
OBJECTS_LIB = linpack_double.o getshmem.o
# For the parser library
CXX_PARS = clang++
LLIBS = -lstdc++
##
## Customize as of this point! Of course you may change the preceding
## part of this file as well if you like, but it should rarely be
## necessary ...
##
# When compiling on the target machine itself, change this to the
# relevant target when cross-compiling for another architecture
VASP_TARGET_CPU ?= -march=@gccArch@
FFLAGS += $(VASP_TARGET_CPU)
# BLAS (mandatory)
AMDBLIS_ROOT ?= /path/to/your/amdblis/installation
BLAS = -L${AMDBLIS_ROOT}/lib -lblis-mt
# LAPACK (mandatory)
AMDLIBFLAME_ROOT ?= /path/to/your/amdlibflame/installation
LAPACK = -L${AMDLIBFLAME_ROOT}/lib -lflame
# scaLAPACK (mandatory)
AMDSCALAPACK_ROOT ?= /path/to/your/amdscalapack/installation
SCALAPACK = -L${AMDSCALAPACK_ROOT}/lib -lscalapack
LLIBS += $(SCALAPACK) $(LAPACK) $(BLAS)
# FFTW (mandatory)
AMDFFTW_ROOT ?= /path/to/your/amdfftw/installation
LLIBS += -L$(AMDFFTW_ROOT)/lib -lfftw3 -lfftw3_omp
INCS += -I$(AMDFFTW_ROOT)/include
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (recommended)
CPP_OPTIONS+= -Dsysv
FCL += fftlib.o
CXX_FFTLIB = clang++ -fopenmp -std=c++11 -DFFTLIB_THREADSAFE
INCS_FFTLIB = -I./include -I$(AMDFFTW_ROOT)/include
LIBS += fftlib
LLIBS += -ldl

View File

@@ -1,91 +0,0 @@
# Default precompiler options
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Dvasp6 \
-Duse_bse_te \
-Dtbdyn \
-Dfock_dblbuf \
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
CPP = flang -E -ffree-form -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS) -ffree-form
FC = mpif90 -fopenmp
FCL = mpif90 -fopenmp
FREE = -ffree-form -ffree-line-length-none
FFLAGS = -w -fno-fortran-main -Mbackslash
OFLAG = -O2
OFLAG_IN = $(OFLAG)
DEBUG = -O0
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
OBJECTS_O2 += fft3dlib.o
# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = $(FC)
CC_LIB = clang
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB = $(FREE)
OBJECTS_LIB = linpack_double.o getshmem.o
# For the parser library
CXX_PARS = clang++
LLIBS = -lstdc++
##
## Customize as of this point! Of course you may change the preceding
## part of this file as well if you like, but it should rarely be
## necessary ...
##
# When compiling on the target machine itself, change this to the
# relevant target when cross-compiling for another architecture
VASP_TARGET_CPU ?= -march=@gccArch@
FFLAGS += $(VASP_TARGET_CPU)
# BLAS (mandatory)
AMDBLIS_ROOT ?= /path/to/your/amdblis/installation
BLAS = -L${AMDBLIS_ROOT}/lib -lblis-mt
# LAPACK (mandatory)
AMDLIBFLAME_ROOT ?= /path/to/your/amdlibflame/installation
LAPACK = -L${AMDLIBFLAME_ROOT}/lib -lflame
# scaLAPACK (mandatory)
AMDSCALAPACK_ROOT ?= /path/to/your/amdscalapack/installation
SCALAPACK = -L${AMDSCALAPACK_ROOT}/lib -lscalapack
LLIBS += $(SCALAPACK) $(LAPACK) $(BLAS)
# FFTW (mandatory)
AMDFFTW_ROOT ?= /path/to/your/amdfftw/installation
LLIBS += -L$(AMDFFTW_ROOT)/lib -lfftw3 -lfftw3_omp
INCS += -I$(AMDFFTW_ROOT)/include
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (recommended)
CPP_OPTIONS+= -Dsysv
FCL += fftlib.o
CXX_FFTLIB = clang++ -fopenmp -std=c++11 -DFFTLIB_THREADSAFE
INCS_FFTLIB = -I./include -I$(AMDFFTW_ROOT)/include
LIBS += fftlib
LLIBS += -ldl

View File

@@ -1,57 +0,0 @@
{
stdenvNoCC, requireFile, writeShellApplication,
rsync, mkl, mpi, openmp, gfortran, gcc, fftwMpi, hdf5, wannier90,
additionalCommands ? ""
}:
let
sources = import ../source.nix { inherit requireFile; };
include = version: ./makefile.include-${version};
vasp = version: stdenvNoCC.mkDerivation rec
{
pname = "vasp-gnu-mkl";
inherit version;
src = sources.${version};
configurePhase =
''
cp ${include version} makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
mkdir -p bin
'';
enableParallelBuilding = true;
makeFlags = "DEPS=1";
buildInputs = [ mkl mpi openmp fftwMpi.dev fftwMpi hdf5 hdf5.dev wannier90 ];
nativeBuildInputs = [ rsync gfortran gfortran.cc gcc ];
FFTW_ROOT = fftwMpi.dev;
HDF5_ROOT = hdf5.dev;
WANNIER90_ROOT = wannier90;
MKLROOT = mkl;
installPhase =
''
mkdir -p $out/bin
for i in std gam ncl; do
cp bin/vasp_$i $out/bin/vasp-$i
done
'';
};
startScript = version: writeShellApplication
{
name = "vasp-gnu-${builtins.replaceStrings ["."] [""] version}-env";
runtimeInputs = [(vasp version)];
text =
''
# if OMP_NUM_THREADS is not set, set it according to SLURM_CPUS_PER_TASK or to 1
if [ -z "''${OMP_NUM_THREADS-}" ]; then
if [ -n "''${SLURM_CPUS_PER_TASK-}" ]; then
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
else
OMP_NUM_THREADS=1
fi
fi
export OMP_NUM_THREADS
${additionalCommands}
exec "$@"
'';
};
in builtins.mapAttrs (version: _: startScript version) sources

View File

@@ -1,87 +0,0 @@
# Default precompiler options
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Dvasp6 \
-Duse_bse_te \
-Dtbdyn \
-Dfock_dblbuf \
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
CPP = gcc -E -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS)
FC = mpif90 -fopenmp
FCL = mpif90 -fopenmp
FREE = -ffree-form -ffree-line-length-none
FFLAGS = -w -ffpe-summary=none
OFLAG = -O2
OFLAG_IN = $(OFLAG)
DEBUG = -O0
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
OBJECTS_O2 += fft3dlib.o
# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = $(FC)
CC_LIB = gcc
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB = $(FREE)
OBJECTS_LIB = linpack_double.o getshmem.o
# For the parser library
CXX_PARS = g++
LLIBS = -lstdc++
##
## Customize as of this point! Of course you may change the preceding
## part of this file as well if you like, but it should rarely be
## necessary ...
##
# When compiling on the target machine itself, change this to the
# relevant target when cross-compiling for another architecture
# VASP_TARGET_CPU ?= -march=native
# FFLAGS += $(VASP_TARGET_CPU)
# For gcc-10 and higher (comment out for older versions)
FFLAGS += -fallow-argument-mismatch
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
MKLROOT ?= /path/to/your/mkl/installation
LLIBS_MKL = -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64 -lgomp -lpthread -lm -ldl
INCS = -I$(MKLROOT)/include/fftw
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
# Comment out the two lines below if you want to use scaLAPACK from MKL instead
#SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
#LLIBS_MKL = -L$(SCALAPACK_ROOT)/lib -lscalapack -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
LLIBS += $(LLIBS_MKL)
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (hardly any benefit in combination with MKL's FFTs)
#CPP_OPTIONS+= -Dsysv
#FCL += fftlib.o
#CXX_FFTLIB = g++ -fopenmp -std=c++11 -DFFTLIB_USE_MKL -DFFTLIB_THREADSAFE
#INCS_FFTLIB = -I./include -I$(MKLROOT)/include/fftw
#LIBS += fftlib
#LLIBS += -ldl

View File

@@ -1,87 +0,0 @@
# Default precompiler options
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Dvasp6 \
-Duse_bse_te \
-Dtbdyn \
-Dfock_dblbuf \
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
CPP = gcc -E -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS)
FC = mpif90 -fopenmp
FCL = mpif90 -fopenmp
FREE = -ffree-form -ffree-line-length-none
FFLAGS = -w -ffpe-summary=none
OFLAG = -O3
OFLAG_IN = $(OFLAG)
DEBUG = -O0
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
OBJECTS_O2 += fft3dlib.o
# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = $(FC)
CC_LIB = gcc
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB = $(FREE)
OBJECTS_LIB = linpack_double.o getshmem.o
# For the parser library
CXX_PARS = g++
LLIBS = -lstdc++
##
## Customize as of this point! Of course you may change the preceding
## part of this file as well if you like, but it should rarely be
## necessary ...
##
# When compiling on the target machine itself, change this to the
# relevant target when cross-compiling for another architecture
# VASP_TARGET_CPU ?= -march=native
# FFLAGS += $(VASP_TARGET_CPU)
# For gcc-10 and higher (comment out for older versions)
FFLAGS += -fallow-argument-mismatch
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
MKLROOT ?= /path/to/your/mkl/installation
LLIBS_MKL = -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64 -lgomp -lpthread -lm -ldl
INCS = -I$(MKLROOT)/include/fftw
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
# Comment out the two lines below if you want to use scaLAPACK from MKL instead
#SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
#LLIBS_MKL = -L$(SCALAPACK_ROOT)/lib -lscalapack -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
LLIBS += $(LLIBS_MKL)
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (hardly any benefit in combination with MKL's FFTs)
#CPP_OPTIONS+= -Dsysv
#FCL += fftlib.o
#CXX_FFTLIB = g++ -fopenmp -std=c++11 -DFFTLIB_USE_MKL -DFFTLIB_THREADSAFE
#INCS_FFTLIB = -I./include -I$(MKLROOT)/include/fftw
#LIBS += fftlib
#LLIBS += -ldl

View File

@@ -1,56 +1,47 @@
{
stdenvNoCC, requireFile, writeShellApplication,
rsync, blas, scalapack, mpi, openmp, gfortran, gcc, fftwMpi, hdf5, wannier90,
additionalCommands ? ""
stdenvNoCC, writeShellApplication, src,
rsync, blas, scalapack, mpi, openmp, gfortran, gcc, fftwMpi, hdf5, wannier90
}:
let
sources = import ../source.nix { inherit requireFile; };
include = version: ./makefile.include-${version};
vasp = version: stdenvNoCC.mkDerivation rec
{
pname = "vasp-gnu";
inherit version;
src = sources.${version};
configurePhase =
''
cp ${include version} makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
mkdir -p bin
'';
enableParallelBuilding = true;
makeFlags = "DEPS=1";
buildInputs = [ blas scalapack mpi openmp fftwMpi.dev fftwMpi hdf5 hdf5.dev wannier90 ];
nativeBuildInputs = [ rsync gfortran gfortran.cc gcc ];
FFTW_ROOT = fftwMpi.dev;
HDF5_ROOT = hdf5.dev;
WANNIER90_ROOT = wannier90;
installPhase =
''
mkdir -p $out/bin
for i in std gam ncl; do
cp bin/vasp_$i $out/bin/vasp-$i
done
'';
};
startScript = version: writeShellApplication
{
name = "vasp-gnu-${builtins.replaceStrings ["."] [""] version}-env";
runtimeInputs = [(vasp version)];
text =
''
# if OMP_NUM_THREADS is not set, set it according to SLURM_CPUS_PER_TASK or to 1
if [ -z "''${OMP_NUM_THREADS-}" ]; then
if [ -n "''${SLURM_CPUS_PER_TASK-}" ]; then
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
else
OMP_NUM_THREADS=1
fi
let vasp = stdenvNoCC.mkDerivation
{
name = "vasp-gnu";
inherit src;
configurePhase =
''
cp ${./makefile.include} makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
'';
enableParallelBuilding = true;
makeFlags = "DEPS=1";
buildInputs = [ blas scalapack mpi openmp fftwMpi.dev fftwMpi hdf5 hdf5.dev wannier90 ];
nativeBuildInputs = [ rsync gfortran gfortran.cc gcc ];
FFTW_ROOT = fftwMpi.dev;
HDF5_ROOT = hdf5.dev;
WANNIER90_ROOT = wannier90;
installPhase =
''
mkdir -p $out/bin
for i in std gam ncl; do
cp bin/vasp_$i $out/bin/vasp-$i
done
'';
};
in writeShellApplication
{
name = "vasp-gnu-env";
runtimeInputs = [ vasp ];
text =
''
# if OMP_NUM_THREADS is not set, set it according to SLURM_CPUS_PER_TASK or to 1
if [ -z "''${OMP_NUM_THREADS-}" ]; then
if [ -n "''${SLURM_CPUS_PER_TASK-}" ]; then
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
else
OMP_NUM_THREADS=1
fi
export OMP_NUM_THREADS
fi
export OMP_NUM_THREADS
${additionalCommands}
exec "$@"
'';
};
in builtins.mapAttrs (version: _: startScript version) sources
exec "$@"
'';
}

View File

@@ -49,38 +49,29 @@ LLIBS = -lstdc++
# When compiling on the target machine itself, change this to the
# relevant target when cross-compiling for another architecture
# VASP_TARGET_CPU ?= -march=native
# FFLAGS += $(VASP_TARGET_CPU)
# For gcc-10 and higher (comment out for older versions)
FFLAGS += -fallow-argument-mismatch
# BLAS and LAPACK (mandatory)
# OPENBLAS_ROOT ?= /path/to/your/openblas/installation
# BLASPACK = -L$(OPENBLAS_ROOT)/lib -lopenblas
BLASPACK = -lblas
# scaLAPACK (mandatory)
# SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
# SCALAPACK = -L$(SCALAPACK_ROOT)/lib -lscalapack
SCALAPACK = -lscalapack
LLIBS += $(SCALAPACK) $(BLASPACK)
# FFTW (mandatory)
FFTW_ROOT ?= /path/to/your/fftw/installation
LLIBS += -L$(FFTW_ROOT)/lib -lfftw3 -lfftw3_omp
INCS += -I$(FFTW_ROOT)/include
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (recommended)

View File

@@ -1,92 +0,0 @@
# Default precompiler options
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Dvasp6 \
-Duse_bse_te \
-Dtbdyn \
-Dfock_dblbuf \
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
CPP = gcc -E -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS)
FC = mpif90 -fopenmp
FCL = mpif90 -fopenmp
FREE = -ffree-form -ffree-line-length-none
FFLAGS = -w -ffpe-summary=none
OFLAG = -O3
OFLAG_IN = $(OFLAG)
DEBUG = -O0
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
OBJECTS_O2 += fft3dlib.o
# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = $(FC)
CC_LIB = gcc
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB = $(FREE)
OBJECTS_LIB = linpack_double.o getshmem.o
# For the parser library
CXX_PARS = g++
LLIBS = -lstdc++
##
## Customize as of this point! Of course you may change the preceding
## part of this file as well if you like, but it should rarely be
## necessary ...
##
# When compiling on the target machine itself, change this to the
# relevant target when cross-compiling for another architecture
# VASP_TARGET_CPU ?= -march=native
# FFLAGS += $(VASP_TARGET_CPU)
# For gcc-10 and higher (comment out for older versions)
FFLAGS += -fallow-argument-mismatch
# BLAS and LAPACK (mandatory)
# OPENBLAS_ROOT ?= /path/to/your/openblas/installation
# BLASPACK = -L$(OPENBLAS_ROOT)/lib -lopenblas
BLASPACK = -lblas
# scaLAPACK (mandatory)
# SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
# SCALAPACK = -L$(SCALAPACK_ROOT)/lib -lscalapack
SCALAPACK = -lscalapack
LLIBS += $(SCALAPACK) $(BLASPACK)
# FFTW (mandatory)
FFTW_ROOT ?= /path/to/your/fftw/installation
LLIBS += -L$(FFTW_ROOT)/lib -lfftw3 -lfftw3_omp
INCS += -I$(FFTW_ROOT)/include
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (recommended)
CPP_OPTIONS+= -Dsysv
FCL += fftlib.o
CXX_FFTLIB = g++ -fopenmp -std=c++11 -DFFTLIB_THREADSAFE
INCS_FFTLIB = -I./include -I$(FFTW_ROOT)/include
LIBS += fftlib
LLIBS += -ldl

View File

@@ -1,46 +0,0 @@
{
buildFHSEnv, writeScript, stdenvNoCC,
src,
aocc, cmake, openmpi, zlib, gcc, glibc, binutils, pkg-config
}:
let
buildEnv = buildFHSEnv
{
name = "buildEnv";
targetPkgs = _: [ zlib aocc gcc.cc.lib.lib glibc.dev binutils.bintools openmpi pkg-config ];
extraBwrapArgs = [ "--bind" "$out" "$out" ];
};
buildScript = writeScript "build"
''
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$out -DHDF5_INSTALL_CMAKE_DIR=$out/lib/cmake \
-DHDF5_BUILD_FORTRAN=ON -DHDF5_ENABLE_PARALLEL=ON ..
make -j$NIX_BUILD_CORES
make install
'';
in stdenvNoCC.mkDerivation
{
name = "hdf5-aocc";
inherit src;
dontConfigure = true;
enableParallelBuilding = true;
nativeBuildInputs = [ cmake ];
CC = "clang";
CXX = "clang++";
FC = "flang";
OMPI_CC = "clang";
OMPI_CXX = "clang++";
OMPI_FC = "flang";
CFLAGS = "-march=${stdenvNoCC.hostPlatform.gcc.arch} -O2";
CXXFLAGS = "-march=${stdenvNoCC.hostPlatform.gcc.arch} -O2";
FCFLAGS = "-march=${stdenvNoCC.hostPlatform.gcc.arch} -O2";
buildPhase =
''
mkdir -p $out
${buildEnv}/bin/buildEnv ${buildScript}
'';
dontInstall = true;
dontFixup = true;
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
}

View File

@@ -1,10 +1,9 @@
{
buildFHSEnv, writeScript, stdenvNoCC, requireFile, substituteAll, symlinkJoin, writeTextDir,
config, oneapiArch ? config.oneapiArch or "SSE3", additionalCommands ? "",
buildFHSEnv, writeScript, stdenvNoCC, substituteAll, symlinkJoin, writeTextDir, src,
config, oneapiArch ? config.oneapiArch or "SSE3",
oneapi, gcc, glibc, lmod, rsync, which, wannier90, binutils, hdf5, zlib, vtst
}:
let
sources = import ../source.nix { inherit requireFile; };
buildEnv = buildFHSEnv
{
name = "buildEnv";
@@ -17,27 +16,21 @@ let
module use ${oneapi}/share/intel/modulefiles
module load tbb compiler-rt oclfpga # dependencies
module load mpi mkl compiler
mkdir -p bin
make DEPS=1 -j$NIX_BUILD_CORES
'';
include = version: substituteAll
{
src = ./makefile.include-${version};
inherit oneapiArch;
};
include = substituteAll { src = ./makefile.include; inherit oneapiArch; };
gccFull = symlinkJoin { name = "gcc"; paths = [ gcc gcc.cc gcc.cc.lib glibc.dev binutils.bintools ]; };
vasp = version: stdenvNoCC.mkDerivation rec
vasp = stdenvNoCC.mkDerivation
{
pname = "vasp-intel";
inherit version;
src = sources.${version};
name = "vasp-intel";
inherit src;
patches = [ ../vtst.patch ];
configurePhase =
''
cp ${include version} makefile.include
cp ${include} makefile.include
chmod +w makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
cp -r ${vtst version}/* src
cp -r ${vtst}/* src
chmod -R +w src
'';
nativeBuildInputs = [ rsync which ];
@@ -52,7 +45,7 @@ let
dontFixup = true;
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
};
startScript = { version, variant }: writeScript "vasp-intel-${version}"
startScript = variant: writeScript "vasp-intel"
''
. ${lmod}/share/lmod/lmod/init/bash
module use ${oneapi}/share/intel/modulefiles
@@ -86,30 +79,26 @@ let
# set OMP_STACKSIZE if not set
export OMP_STACKSIZE=''${OMP_STACKSIZE-512M}
${additionalCommands}
${
if variant == "env" then ''exec "$@"''
else
''
if [ -n "''${SLURM_JOB_ID-}" ]; then
exec mpirun -n $SLURM_NTASKS ${vasp version}/bin/vasp-${variant}
exec mpirun -n $SLURM_NTASKS ${vasp}/bin/vasp-${variant}
else
exec mpirun -n 1 ${vasp version}/bin/vasp-${variant}
exec mpirun -n 1 ${vasp}/bin/vasp-${variant}
fi
''
}
'';
runEnv = { version, variant }: let shortVersion = builtins.replaceStrings ["."] [""] version; in buildFHSEnv
runEnv = variant: buildFHSEnv
{
name = "vasp-intel-${shortVersion}${if variant == "" then "" else "-${variant}"}";
targetPkgs = _: [ zlib (vasp version) (writeTextDir "etc/release" "") gccFull ];
runScript = startScript { inherit version; variant = if variant == "" then "std" else variant; };
name = "vasp-intel${if variant == "" then "" else "-${variant}"}";
targetPkgs = _: [ zlib vasp (writeTextDir "etc/release" "") gccFull ];
runScript = startScript (if variant == "" then "std" else variant);
};
in builtins.mapAttrs
(version: _: symlinkJoin
{
name = "vasp-intel-${version}";
paths = builtins.map (variant: runEnv { inherit version variant; }) [ "" "env" "std" "gam" "ncl" ];
})
sources
in symlinkJoin
{
name = "vasp-intel";
paths = builtins.map (variant: runEnv variant) [ "" "env" "std" "gam" "ncl" ];
}

View File

@@ -52,32 +52,24 @@ LLIBS = -lstdc++
VASP_TARGET_CPU ?= -x@oneapiArch@
FFLAGS += $(VASP_TARGET_CPU)
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
# Intel MKL (FFTW, BLAS, LAPACK, and scaLAPACK)
# (Note: for Intel Parallel Studio's MKL use -mkl instead of -qmkl)
FCL += -qmkl
MKLROOT ?= /path/to/your/mkl/installation
MKLROOT ?= /path/to/your/mkl/installation
LLIBS += -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
INCS =-I$(MKLROOT)/include/fftw
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
# Comment out the two lines below if you want to use scaLAPACK from MKL instead
# SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
# LLIBS += -L${SCALAPACK_ROOT}/lib -lscalapack
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (hardly any benefit in combination with MKL's FFTs)
#CPP_OPTION += -Dsysv
#FCL = mpif90 fftlib.o -qmkl
#FCL = mpiifort fftlib.o -qmkl
#CXX_FFTLIB = icpc -qopenmp -std=c++11 -DFFTLIB_USE_MKL -DFFTLIB_THREADSAFE
#INCS_FFTLIB = -I./include -I$(MKLROOT)/include/fftw
#LIBS += fftlib

View File

@@ -1,83 +0,0 @@
# Default precompiler options
CPP_OPTIONS = -DHOST=\"LinuxIFC\" \
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Dvasp6 \
-Duse_bse_te \
-Dtbdyn \
-Dfock_dblbuf \
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
CPP = fpp -f_com=no -free -w0 $*$(FUFFIX) $*$(SUFFIX) $(CPP_OPTIONS)
FC = mpiifx -qopenmp
FCL = mpiifx
FREE = -free -names lowercase
FFLAGS = -assume byterecl -w
OFLAG = -O2
OFLAG_IN = $(OFLAG)
DEBUG = -O0
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
OBJECTS_O2 += fft3dlib.o
# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = $(FC)
CC_LIB = icx
CFLAGS_LIB = -O
FFLAGS_LIB = -O1
FREE_LIB = $(FREE)
OBJECTS_LIB = linpack_double.o getshmem.o
# For the parser library
CXX_PARS = icpx
LLIBS = -lstdc++
##
## Customize as of this point! Of course you may change the preceding
## part of this file as well if you like, but it should rarely be
## necessary ...
##
# When compiling on the target machine itself, change this to the
# relevant target when cross-compiling for another architecture
VASP_TARGET_CPU ?= -x@oneapiArch@
FFLAGS += $(VASP_TARGET_CPU)
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
# (Note: for Intel Parallel Studio's MKL use -mkl instead of -qmkl)
FCL += -qmkl
MKLROOT ?= /path/to/your/mkl/installation
LLIBS += -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
INCS =-I$(MKLROOT)/include/fftw
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
# Comment out the two lines below if you want to use scaLAPACK from MKL instead
# SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
# LLIBS += -L${SCALAPACK_ROOT}/lib -lscalapack
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (hardly any benefit in combination with MKL's FFTs)
#CPP_OPTION += -Dsysv
#FCL = mpif90 fftlib.o -qmkl
#CXX_FFTLIB = icpc -qopenmp -std=c++11 -DFFTLIB_USE_MKL -DFFTLIB_THREADSAFE
#INCS_FFTLIB = -I./include -I$(MKLROOT)/include/fftw
#LIBS += fftlib

View File

@@ -1,43 +1,36 @@
{
buildFHSEnv, writeScript, stdenvNoCC, requireFile, substituteAll, symlinkJoin,
config, cudaCapabilities ? config.cudaCapabilities, nvhpcArch ? config.nvhpcArch or "px", additionalCommands ? "",
buildFHSEnv, writeScript, stdenvNoCC, substituteAll, symlinkJoin, src,
config, cudaCapabilities ? config.cudaCapabilities, nvhpcArch ? config.nvhpcArch or "px",
nvhpc, lmod, mkl, gfortran, rsync, which, hdf5, wannier90, zlib, vtst
}:
let
sources = import ../source.nix { inherit requireFile; };
buildEnv = buildFHSEnv
{
name = "buildEnv";
targetPkgs = _: [ zlib ];
};
buildEnv = buildFHSEnv { name = "buildEnv"; targetPkgs = _: [ zlib ]; };
buildScript = writeScript "build"
''
. ${lmod}/share/lmod/lmod/init/bash
module use ${nvhpc}/share/nvhpc/modulefiles
module load nvhpc
mkdir -p bin
make DEPS=1 -j$NIX_BUILD_CORES
'';
include = version: substituteAll
include = substituteAll
{
src = ./makefile.include-${version};
src = ./makefile.include;
cudaCapabilities = builtins.concatStringsSep "," (builtins.map
(cap: "cc${builtins.replaceStrings ["."] [""] cap}")
cudaCapabilities);
inherit nvhpcArch;
};
vasp = version: stdenvNoCC.mkDerivation rec
vasp = stdenvNoCC.mkDerivation
{
pname = "vasp-nvidia";
inherit version;
src = sources.${version};
name = "vasp-nvidia";
inherit src;
patches = [ ../vtst.patch ];
configurePhase =
''
cp ${include version} makefile.include
cp ${include} makefile.include
chmod +w makefile.include
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
cp -r ${vtst version}/* src
cp -r ${vtst}/* src
chmod -R +w src
'';
enableParallelBuilding = true;
@@ -55,7 +48,7 @@ let
dontFixup = true;
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
};
startScript = { version, variant }: writeScript "vasp-nvidia-${version}"
startScript = variant: writeScript "vasp-nvidia"
''
. ${lmod}/share/lmod/lmod/init/bash
module use ${nvhpc}/share/nvhpc/modulefiles
@@ -71,30 +64,26 @@ let
fi
export OMP_NUM_THREADS
${additionalCommands}
${
if variant == "env" then ''exec "$@"''
else
''
if [ -n "''${SLURM_JOB_ID-}" ]; then
exec mpirun --bind-to none ${vasp version}/bin/vasp-${variant}
exec mpirun --bind-to none ${vasp}/bin/vasp-${variant}
else
exec mpirun -np 1 ${vasp version}/bin/vasp-${variant}
exec mpirun -np 1 ${vasp}/bin/vasp-${variant}
fi
''
}
'';
runEnv = { version, variant }: let shortVersion = builtins.replaceStrings ["."] [""] version; in buildFHSEnv
runEnv = variant: buildFHSEnv
{
name = "vasp-nvidia-${shortVersion}${if variant == "" then "" else "-${variant}"}";
targetPkgs = _: [ zlib (vasp version) ];
runScript = startScript { inherit version; variant = if variant == "" then "std" else variant; };
name = "vasp-nvidia${if variant == "" then "" else "-${variant}"}";
targetPkgs = _: [ zlib vasp ];
runScript = startScript (if variant == "" then "std" else variant);
};
in builtins.mapAttrs
(version: _: symlinkJoin
in symlinkJoin
{
name = "vasp-nvidia-${version}";
paths = builtins.map (variant: runEnv { inherit version variant; }) [ "" "env" "std" "gam" "ncl" ];
})
sources
name = "vasp-nvidia";
paths = builtins.map (variant: runEnv variant) [ "" "env" "std" "gam" "ncl" ];
}

View File

@@ -11,7 +11,7 @@ CPP_OPTIONS = -DHOST=\"LinuxNV\" \
-Dfock_dblbuf \
-D_OPENMP \
-D_OPENACC \
-DUSENCCL -DUSENCCLP2P -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
-DUSENCCL -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
CPP = nvfortran -Mpreprocess -Mfree -Mextend -E $(CPP_OPTIONS) $*$(FUFFIX) > $*$(SUFFIX)
@@ -79,7 +79,7 @@ INCS += -I$(QD)/include/qd
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
MKLROOT ?= /path/to/your/mkl/installation
LLIBS_MKL = -Mmkl -L$(MKLROOT)/lib -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64
LLIBS_MKL = -Mmkl -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64
INCS += -I$(MKLROOT)/include/fftw
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
@@ -91,13 +91,11 @@ LLIBS += $(LLIBS_MKL)
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (hardly any benefit for the OpenACC GPU port, especially in combination with MKL's FFTs)

View File

@@ -1,109 +0,0 @@
# Default precompiler options
CPP_OPTIONS = -DHOST=\"LinuxNV\" \
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
-DscaLAPACK \
-DCACHE_SIZE=4000 \
-Davoidalloc \
-Dvasp6 \
-Duse_bse_te \
-Dtbdyn \
-Dqd_emulate \
-Dfock_dblbuf \
-D_OPENMP \
-D_OPENACC \
-DUSENCCL -DUSENCCLP2P -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
CPP = nvfortran -Mpreprocess -Mfree -Mextend -E $(CPP_OPTIONS) $*$(FUFFIX) > $*$(SUFFIX)
# N.B.: you might need to change the cuda-version here
# to one that comes with your NVIDIA-HPC SDK
FC = mpif90 -acc -gpu=@cudaCapabilities@ -mp
FCL = mpif90 -acc -gpu=@cudaCapabilities@ -mp -c++libs
FREE = -Mfree
FFLAGS = -Mbackslash -Mlarge_arrays
OFLAG = -fast
DEBUG = -Mfree -O0 -traceback
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
LLIBS = -cudalib=cublas,cusolver,cufft,nccl -cuda
# Redefine the standard list of O1 and O2 objects
SOURCE_O1 := pade_fit.o
SOURCE_O2 := pead.o
# For what used to be vasp.5.lib
CPP_LIB = $(CPP)
FC_LIB = nvfortran
CC_LIB = nvc -w
CFLAGS_LIB = -O
FFLAGS_LIB = -O1 -Mfixed
FREE_LIB = $(FREE)
OBJECTS_LIB = linpack_double.o getshmem.o
# For the parser library
CXX_PARS = nvc++ --no_warnings
##
## Customize as of this point! Of course you may change the preceding
## part of this file as well if you like, but it should rarely be
## necessary ...
##
# When compiling on the target machine itself , change this to the
# relevant target when cross-compiling for another architecture
VASP_TARGET_CPU ?= -tp=@nvhpcArch@
FFLAGS += $(VASP_TARGET_CPU)
# Specify your NV HPC-SDK installation (mandatory)
#... first try to set it automatically
NVROOT =$(shell which nvfortran | awk -F /compilers/bin/nvfortran '{ print $$1 }')
# If the above fails, then NVROOT needs to be set manually
#NVHPC ?= /opt/nvidia/hpc_sdk
#NVVERSION = 21.11
#NVROOT = $(NVHPC)/Linux_x86_64/$(NVVERSION)
## Improves performance when using NV HPC-SDK >=21.11 and CUDA >11.2
OFLAG_IN = -fast -Mwarperf
SOURCE_IN := nonlr.o
# Software emulation of quadruple precsion (mandatory)
QD ?= $(NVROOT)/compilers/extras/qd
LLIBS += -L$(QD)/lib -lqdmod -lqd
INCS += -I$(QD)/include/qd
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
MKLROOT ?= /path/to/your/mkl/installation
LLIBS_MKL = -Mmkl -L$(MKLROOT)/lib -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64
INCS += -I$(MKLROOT)/include/fftw
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
# Comment out the two lines below if you want to use scaLAPACK from MKL instead
# SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
# LLIBS_MKL = -L$(SCALAPACK_ROOT)/lib -lscalapack -Mmkl
LLIBS += $(LLIBS_MKL)
# HDF5-support (optional but strongly recommended)
CPP_OPTIONS+= -DVASP_HDF5
HDF5_ROOT ?= /path/to/your/hdf5/installation
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
INCS += -I$(HDF5_ROOT)/include
# For the VASP-2-Wannier90 interface (optional)
CPP_OPTIONS += -DVASP2WANNIER90
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
# For the fftlib library (hardly any benefit for the OpenACC GPU port, especially in combination with MKL's FFTs)
#CPP_OPTIONS+= -Dsysv
#FCL += fftlib.o
#CXX_FFTLIB = nvc++ -mp --no_warnings -std=c++11 -DFFTLIB_USE_MKL -DFFTLIB_THREADSAFE
#INCS_FFTLIB = -I./include -I$(MKLROOT)/include/fftw
#LIBS += fftlib
#LLIBS += -ldl

View File

@@ -1,45 +0,0 @@
{
lib, buildFHSEnv, writeScript, stdenvNoCC,
openmpi,
aocc, cmake, libnl, pmix, libpsm2, libfabric, zlib, numactl, ucx, ucc, libevent, hwloc, rdma-core, perl, glibc, binutils, gcc
}:
let
buildEnv = buildFHSEnv
{
name = "buildEnv";
targetPkgs = _: [ zlib aocc gcc.cc.lib.lib glibc.dev binutils.bintools libnl numactl ucx ucc libevent hwloc rdma-core libpsm2 libfabric perl ];
extraBwrapArgs = [ "--bind" "$out" "$out" ];
};
buildScript = writeScript "build"
''
./configure --prefix=$out --disable-mca-dso
make -j$NIX_BUILD_CORES
make install
'';
in stdenvNoCC.mkDerivation
{
name = "openmpi-aocc";
inherit (openmpi) src postPatch;
dontConfigure = true;
CC = "clang";
CXX = "clang++";
FC = "flang";
OMPI_CC = "clang";
OMPI_CXX = "clang++";
OMPI_FC = "flang";
CFLAGS = "-march=${stdenvNoCC.hostPlatform.gcc.arch} -O2";
CXXFLAGS = "-march=${stdenvNoCC.hostPlatform.gcc.arch} -O2";
FCFLAGS = "-march=${stdenvNoCC.hostPlatform.gcc.arch} -O2";
enableParallelBuilding = true;
buildPhase =
''
runHook preBuild
mkdir -p $out
${buildEnv}/bin/buildEnv ${buildScript}
runHook postBuild
'';
postBuild = with openmpi; postInstall + postFixup;
dontInstall = true;
dontFixup = true;
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
}

View File

@@ -1,16 +1,7 @@
{ requireFile }:
let
hashes =
{
# nix-store --query --hash $(nix store add-path ./vasp-6.4.0)
"6.3.1" = "1xdr5kjxz6v2li73cbx1ls5b1lnm6z16jaa4fpln7d3arnnr1mgx";
"6.4.0" = "189i1l5q33ynmps93p2mwqf5fx7p4l50sls1krqlv8ls14s3m71f";
};
sources = version: sha256: requireFile
{
name = "vasp-${version}";
inherit sha256;
hashMode = "recursive";
message = "Source file not found.";
};
in builtins.mapAttrs sources hashes
{ requireFile }: requireFile
{
name = "vasp.6.4.3.tgz";
# nix-prefetch-url file://$(pwd)/vasp.6.4.3.tgz
sha256 = "1x14dixils77rr4c6yqmxkvyzgfz6906badsw2shksd3y9ryfc7y";
message = "Source file not found.";
}

View File

@@ -1,9 +1,8 @@
{ fetchzip, lib }: version:
let
src = fetchzip
{
url = "http://theory.cm.utexas.edu/code/vtstcode-199.tgz";
sha256 = "06c9f14a90ka3p396q6spr25xwkih4n01nm1qjj9fnvqzxlp9k9y";
};
shortVersion = builtins.concatStringsSep "." (lib.lists.take 2 (builtins.splitVersion version));
in if version == null then src else "${src}/vtstcode${shortVersion}"
{ fetchzip, lib }:
let
src = fetchzip
{
url = "http://theory.cm.utexas.edu/code/vtstcode-199.tgz";
sha256 = "06c9f14a90ka3p396q6spr25xwkih4n01nm1qjj9fnvqzxlp9k9y";
};
in "${src}/vtstcode6.4"

View File

@@ -2,10 +2,6 @@ inputs:
{
config = inputs.lib.mkIf (builtins.elem "workstation" inputs.config.nixos.packages._packageSets)
{
nixos.packages._packages =
(builtins.concatLists (builtins.map
(compiler: builtins.map (version: inputs.pkgs.localPackages.vasp.${compiler}.${version}) [ "6.4.0" ])
[ "intel" "nvidia" ]))
++ [ inputs.pkgs.localPackages.vasp.vtstscripts ];
nixos.packages._packages = with inputs.pkgs.localPackages.vasp; [ gnu intel nvidia vtstscripts ];
};
}