Module VASP

Module VASP

Watch this video on how to optimize and speed up VASP by selecting the correct number of CPUs.

CPU MPI job

Copy an example script from the test suite.

cp -R /opt/vasp-6.4.1/testsuite/tests/bulk_GaAs_G0W0_sym bulk_GaAs_G0W0_sym

The performance of VASP might be significantly influenced by the parameters NCORE and KPAR in your INCAR file.  Sometimes it is recommended that --ntasks-per-node (in your Slurm file) is equal to NCORE (in your INCAR file)

Create the Slurm script file. Adjust the number of nodes (--nodes 1), the number of processes (--ntasks-per-node 2), and the amount of memory (--mem-per-cpu 4G) needed for your job. If you increase --ntasks-per-node you might also change NCORE in your INCAR file.

vasp_cpu_mpi_slurm_script.sh
#!/bin/bash #SBATCH --job-name vasp_cpu_mpi #SBATCH --output vasp_cpu_mpi_output.log #SBATCH --error vasp_cpu_mpi_error.log #SBATCH --nodes 1 #SBATCH --ntasks-per-node 4 #SBATCH --mem-per-cpu 4G module load vasp/6.4.1 cd bulk_GaAs_G0W0_sym_NCORE srun vasp_std

You might need to edit the INCAR file to adjust NCORE to match the --ntasks-per-node set on Slurm.

SYSTEM = GaAs GGA = PE ISMEAR = 0 SIGMA = 0.01 ENCUT = 200 EDIFF=1.0E-9 ALGO=GW0 NBANDSGW=8 PRECFOCK=A NBANDS=240 LMAXFOCKAE=4 NOMEGA=50 ENCUTGW=100 OMEGAMIN=10 NCORE=4 KPAR=2 ; NCSHMEM = -1 ; FFTWMAKEPLAN = E ; PREC=Normal ENCUTGWSOFT = 100.0

Submit the job to Slurm.

sbatch vasp_cpu_mpi_slurm_script.sh

Monitor the execution of your job in the Slurm queue.

squeue -u $USER

The job may show up in the queue as running (R) or pending (PD). When the job completes, it will disappear from the queue and you can check the output.

[user@athena1 ~]$ sbatch vasp_cpu_mpi_slurm_script.sh Submitted batch job 123 [user@athena1 ~]$ squeue -u $USER JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) ## Job is running with JOBID 123 123 cpu vasp_cpu user R 0:01 1 athena101 [user@athena1 ~]$ squeue -u $USER JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) ## JOBID 123 completed and exited the queue [user@athena1 ~]$ tail bulk_GaAs_G0W0_sym_NCORE_2/OUTCAR User time (sec): 75.698 System time (sec): 0.900 Elapsed time (sec): 37.675 Maximum memory used (kb): 216360. Average memory used (kb): N/A Minor page faults: 29555 Major page faults: 97 Voluntary context switches: 11037

GPU job

Note that not all functions in VASP are ported to the GPU. Therefore, the runtime on the GPU might be slower than running on the CPU with MPI and a large number of processes.

Copy an example script from the test suite.

cp -R /opt/vasp-6.4.1/testsuite/tests/bulk_GaAs_G0W0_sym .

The performance of VASP might be significantly influenced by the parameters in the INCAR file. It is recommended to include the keyword "KPAR = 1” in the INCAR file for optimal performance.

Create the Slurm script file.  Adjust the amount of memory (--mem 16G) needed for your job. VASP recommends a number of processes equal to the number of GPUs. Keep it to 1.

vasp_gpu_slurm_script.sh
#!/bin/bash #SBATCH --job-name vasp_gpu #SBATCH --output vasp_gpu_output.log #SBATCH --error vasp_gpu_error.log #SBATCH --partition gpu #SBATCH --gres gpu:1 #SBATCH --ntasks-per-node 1 #SBATCH --mem 16G module use /opt/nvidia/hpc_sdk/modulefiles module load vasp/6.4.1 cd bulk_GaAs_G0W0_sym mpirun --bind-to none -n $SLURM_NTASKS vasp_std

Submit the job to Slurm.

sbatch vasp_gpu_slurm_script.sh

Monitor the execution of your job in the Slurm queue.

squeue -u $USER

The job may show up in the queue as running (R) or pending (PD). When the job completes, it will disappear from the queue and you can check the output.

[user@athena1 ~]$ cp -R /opt/vasp-6.4.1/testsuite/tests/bulk_GaAs_G0W0_sym . [user@athena1 ~]$ sbatch vasp_gpu_slurm_script.sh Submitted batch job 123 [user@athena1 ~]$ squeue -u $USER JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) ## Job is running with JOBID 123 123 gpu vasp_gpu user R 0:01 1 athena511 [user@athena1 ~]$ squeue -u $USER JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) ## JOBID 123 completed and exited the queue [user@athena1 ~]$ tail bulk_GaAs_G0W0_sym/OUTCAR User time (sec): 75.698 System time (sec): 0.900 Elapsed time (sec): 37.675 Maximum memory used (kb): 216360. Average memory used (kb): N/A Minor page faults: 29555 Major page faults: 97 Voluntary context switches: 11037