Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
technical:recipes:vasp-6-darwin [2021-02-16 09:53] – [Versions] anita | technical:recipes:vasp-6-darwin [2021-02-16 10:00] (current) – [Runtime environment] anita | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Building VASP 6 on Caviness/ | ||
+ | |||
+ | Over the years the VASP build system has changed significantly. | ||
+ | |||
+ | The build procedure outlined herein uses Open MPI on top of the Intel compiler suite in conjunction with CUDA 11 with the target executable destined for use on Volta- and Turing-generation NVIDIA devices. | ||
+ | |||
+ | ===== Directory Preparation ===== | ||
+ | |||
+ | To begin, choose a directory in which the VASP version(s) will be built and installed. | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ VASP_BASEDIR=~/ | ||
+ | [user@login00.darwin ~]$ VASP_BASEDIR_PRIVS=0700 | ||
+ | </ | ||
+ | If you are managing VASP software for your entire workgroup, you could instead use | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ VASP_BASEDIR=" | ||
+ | [user@login00.darwin ~]$ VASP_BASEDIR_PRIVS=2770 | ||
+ | </ | ||
+ | |||
+ | If the directory hierarchy does not yet exist, it can be setup using | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ mkdir -p -m $VASP_BASEDIR_PRIVS " | ||
+ | </ | ||
+ | |||
+ | All VASP source code packages you download should be copied to that '' | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ cp ~/ | ||
+ | </ | ||
+ | |||
+ | ===== Source Preparation ===== | ||
+ | |||
+ | In this example version 6.1.0 of VASP will be built; all sub-programs (NCL, Gamma-only, standard, GPU, GPU NCL) will be created. | ||
+ | |||
+ | The Intel compiler suite is well-documented with regard to building VASP, so there is usually very little reason to try alternative toolchains (like GNU or Portland). | ||
+ | |||
+ | We will create a directory to hold our base build of VASP 6.1.0, naming it with the version identifier: | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ VASP_INSTALL_PREFIX=" | ||
+ | [user@login00.darwin ~]$ mkdir -m $VASP_BASEDIR_PRIVS " | ||
+ | [user@login00.darwin ~]$ cd " | ||
+ | [user@login00.darwin 6.1.0]$ tar -xf " | ||
+ | [user@login00.darwin 6.1.0]$ mv vasp.6.1.0 src | ||
+ | [user@login00.darwin 6.1.0]$ cd src | ||
+ | </ | ||
+ | Our current working directory is now the //build root// for this copy of VASP 6.1.0. | ||
+ | |||
+ | ==== Selecting Machine-Specific Parameters ==== | ||
+ | |||
+ | The VASP 6 build environment requires a '' | ||
+ | |||
+ | * VALET sets many environment variables that facilitate reuse of a single '' | ||
+ | * Several Make variables need to be explicitly exported in order for sub-make environments to inherit them properly. | ||
+ | * Though the '' | ||
+ | |||
+ | This is the '' | ||
+ | <file make makefile.include.darwin> | ||
+ | # Precompiler options | ||
+ | CPP_OPTIONS= -DHOST=\" | ||
+ | -DMPI -DMPI_BLOCK=8000 -Duse_collective \ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | CPP = fpp -f_com=no -free -w0 $*$(FUFFIX) $*$(SUFFIX) $(CPP_OPTIONS) $(CPPFLAGS) | ||
+ | |||
+ | FC = mpifort | ||
+ | FCL = mpifort -mkl=sequential | ||
+ | |||
+ | FREE = -free -names lowercase | ||
+ | |||
+ | FFLAGS | ||
+ | OFLAG = -O2 | ||
+ | OFLAG_IN | ||
+ | DEBUG = -O0 | ||
+ | |||
+ | MKL_PATH | ||
+ | BLAS = | ||
+ | LAPACK | ||
+ | BLACS = -lmkl_blacs_intelmpi_lp64 | ||
+ | SCALAPACK | ||
+ | |||
+ | OBJECTS | ||
+ | |||
+ | INCS | ||
+ | |||
+ | LLIBS = $(LDFLAGS) $(SCALAPACK) $(LAPACK) $(BLAS) | ||
+ | |||
+ | |||
+ | OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o | ||
+ | OBJECTS_O2 += fft3dlib.o | ||
+ | |||
+ | # For what used to be vasp.5.lib | ||
+ | CPP_LIB | ||
+ | FC_LIB | ||
+ | CC_LIB | ||
+ | CFLAGS_LIB = -O | ||
+ | FFLAGS_LIB = -O1 | ||
+ | FREE_LIB | ||
+ | |||
+ | OBJECTS_LIB= linpack_double.o getshmem.o | ||
+ | |||
+ | # For the parser library | ||
+ | CXX_PARS | ||
+ | LLIBS += -lstdc++ | ||
+ | |||
+ | # Normally no need to change this | ||
+ | SRCDIR | ||
+ | BINDIR | ||
+ | |||
+ | # | ||
+ | # GPU Stuff | ||
+ | |||
+ | CPP_GPU | ||
+ | |||
+ | OBJECTS_GPU= fftmpiw.o fftmpi_map.o fft3dlib.o fftw3d_gpu.o fftmpiw_gpu.o | ||
+ | |||
+ | CC = icc | ||
+ | CXX = icpc | ||
+ | CFLAGS | ||
+ | |||
+ | ## | ||
+ | ## vpkg_devrequire cuda/< | ||
+ | ## environment for us (CUDA_PREFIX, | ||
+ | ## | ||
+ | CUDA_ROOT | ||
+ | export CUDA_ROOT | ||
+ | NVCC := nvcc -ccbin=icc $(CPPFLAGS) | ||
+ | CUDA_LIB | ||
+ | |||
+ | ## | ||
+ | ## compute_30, | ||
+ | ## compute_60 was Pascal (present on Caviness, not DARWIN) | ||
+ | ## compute_70, | ||
+ | ## compute_75 is Turing | ||
+ | ## | ||
+ | ## | ||
+ | ## | ||
+ | GENCODE_ARCH | ||
+ | | ||
+ | | ||
+ | | ||
+ | export GENCODE_ARCH | ||
+ | |||
+ | ## | ||
+ | ## vpkg_require openmpi/< | ||
+ | ## setup for us to query this argument | ||
+ | ## | ||
+ | MPI_INC | ||
+ | export MPI_INC | ||
+ | </ | ||
+ | It should be saved to the build root as '' | ||
+ | ==== Build Environment ==== | ||
+ | |||
+ | The '' | ||
+ | <code bash> | ||
+ | [user@login00.darwin src]$ vpkg_rollback all | ||
+ | </ | ||
+ | This, of course, does not remove changes you introduce manually in your '' | ||
+ | |||
+ | From a clean shell environment, | ||
+ | <code bash> | ||
+ | [user@login00.darwin src]$ vpkg_require openmpi/ | ||
+ | Adding dependency `intel/ | ||
+ | Adding package `openmpi/ | ||
+ | [user@login00.darwin src]$ vpkg_devrequire cuda/11.1.1 | ||
+ | Adding package `cuda/ | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | <code bash> | ||
+ | [user@login00.darwin src]$ which nvcc | ||
+ | / | ||
+ | [user@login00.darwin src]$ which mpifort | ||
+ | / | ||
+ | [user@login00.darwin src]$ echo $CUDA_PREFIX | ||
+ | / | ||
+ | [user@login00.darwin src]$ echo $CPPFLAGS | ||
+ | -I/ | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | ===== Compilation and Linking ===== | ||
+ | |||
+ | At this point, compilation and linking of the five variants of the VASP 6.1.0 program is simple: | ||
+ | <code bash> | ||
+ | [user@login00.darwin src]$ make all | ||
+ | </ | ||
+ | |||
+ | This will take some time. If you are tempted to speed-up the compilation using Make parallelism, | ||
+ | < | ||
+ | fock.F(3619): | ||
+ | USE fock | ||
+ | --------^ | ||
+ | </ | ||
+ | |||
+ | A natural speed-up to the build is to omit the variants that are unnecessary to your work. If only the standard variant is needed, then build just that one: | ||
+ | <code bash> | ||
+ | [user@login00.darwin src]$ make std | ||
+ | </ | ||
+ | |||
+ | A successful build will produce executables in the '' | ||
+ | <code bash> | ||
+ | [user@login00.darwin src]$ ls -l bin | ||
+ | total 38372 | ||
+ | -rwxr-xr-x 1 user everyone 29892256 Feb 15 11:13 vasp_std | ||
+ | </ | ||
+ | |||
+ | ===== Installation ===== | ||
+ | |||
+ | In order to foster better software management, it is advisable **not** to use the executables within the build root. Any subsequent attempt to recompile (e.g. to fix an omission in '' | ||
+ | |||
+ | Once the build has completed successfully, | ||
+ | <code bash> | ||
+ | [user@login00.darwin src]$ mkdir -m $VASP_BASEDIR_PRIVS " | ||
+ | [user@login00.darwin src]$ for exe in bin/*; do install -Cv --backup=numbered " | ||
+ | ‘bin/ | ||
+ | ‘bin/ | ||
+ | ‘bin/ | ||
+ | ‘bin/ | ||
+ | ‘bin/ | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | ===== VALET Package Definition ===== | ||
+ | |||
+ | With this version of VASP built, the remaining step is to leverage VALET for setup of the runtime environment when you use the software. | ||
+ | <code bash> | ||
+ | [user@login00.darwin src]$ vpkg_rollback all | ||
+ | [user@login00.darwin src]$ cd | ||
+ | [user@login00.darwin ~]$ echo $VASP_BASEDIR | ||
+ | / | ||
+ | </ | ||
+ | Since this build was done in the user's home directory, they were personal copies of the software and should use a //VALET package definition file// stored in '' | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ VALET_PKG_DIR=~/ | ||
+ | </ | ||
+ | versus an installation made for an entire workgroup, which would store the VALET package definition files in '' | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ VALET_PKG_DIR=" | ||
+ | </ | ||
+ | Whichever scheme is in-use, ensure the directory exists: | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ mkdir -p --mode=$VALET_PKG_DIR_MODE " | ||
+ | </ | ||
+ | |||
+ | VALET allows package definitions in a variety of formats (XML, JSON, YAML) but YAML tends to be the simplest format so we will use it here. | ||
+ | |||
+ | ==== Package section ==== | ||
+ | |||
+ | The //package section// of the definition file includes items that apply to all versions/ | ||
+ | <code yaml> | ||
+ | vasp: | ||
+ | prefix: / | ||
+ | description: | ||
+ | url: " | ||
+ | </ | ||
+ | The //package identifier// | ||
+ | |||
+ | ==== Versions ==== | ||
+ | |||
+ | The '' | ||
+ | <code yaml> | ||
+ | vasp: | ||
+ | prefix: / | ||
+ | description: | ||
+ | url: " | ||
+ | | ||
+ | versions: | ||
+ | " | ||
+ | description: | ||
+ | dependencies: | ||
+ | - openmpi/ | ||
+ | - cuda/11.1.1 | ||
+ | </ | ||
+ | |||
+ | <WRAP center round tip 80%> | ||
+ | The version identifier '' | ||
+ | |||
+ | The implicit behavior is overridden by providing a '' | ||
+ | </ | ||
+ | |||
+ | It is a good idea to specify which version definition should act as the default. | ||
+ | |||
+ | <file yaml vasp.vpkg_yaml> | ||
+ | vasp: | ||
+ | prefix: / | ||
+ | description: | ||
+ | url: " | ||
+ | | ||
+ | default-version: | ||
+ | | ||
+ | versions: | ||
+ | " | ||
+ | description: | ||
+ | dependencies: | ||
+ | - openmpi/ | ||
+ | - cuda/11.1.1 | ||
+ | </ | ||
+ | |||
+ | saved at '' | ||
+ | |||
+ | ==== Checking the definition file ==== | ||
+ | |||
+ | The package definition file can be checked for proper syntax using the VALET command '' | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ vpkg_check " | ||
+ | / | ||
+ | |||
+ | [vasp] { | ||
+ | contexts: all | ||
+ | actions: { | ||
+ | VASP_PREFIX=${VALET_PATH_PREFIX} (contexts: development) | ||
+ | } | ||
+ | http:// | ||
+ | Vienna Ab-initio Simulation Package | ||
+ | prefix: / | ||
+ | source file: / | ||
+ | default version: vasp/6.1.0 | ||
+ | versions: { | ||
+ | [vasp/ | ||
+ | contexts: all | ||
+ | dependencies: | ||
+ | openmpi/ | ||
+ | cuda/11.1.1 | ||
+ | } | ||
+ | compiled with Open MPI, Intel compilers, MKL, ScaLAPACK, CUDA | ||
+ | prefix: / | ||
+ | standard paths: { | ||
+ | bin: / | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | The file had no errors in its YAML syntax. | ||
+ | |||
+ | ==== Runtime environment ==== | ||
+ | |||
+ | To load **vasp** 6.1.0 into the runtime environment, | ||
+ | <code bash> | ||
+ | [user@login00.darwin ~]$ vpkg_require vasp/6.1.0 | ||
+ | Adding dependency `intel/ | ||
+ | Adding dependency `openmpi/ | ||
+ | Adding dependency `cuda/ | ||
+ | Adding package `vasp/ | ||
+ | [user@login00.darwin ~]$ which vasp_std | ||
+ | ~/ | ||
+ | </ | ||
+ | The '' | ||
+ | |||