howto:compile
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howto:compile [2015/01/18 21:59] – Sync with INSTALL file from svn oschuett | howto:compile [2023/11/13 13:04] (current) – oschuett | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How to compile the CP2K code ====== | + | This page has been moved to: https://github.com/cp2k/cp2k/blob/master/INSTALL.md |
- | + | ||
- | ===== 1. Acquire the code: ===== | + | |
- | + | ||
- | see http:// | + | |
- | The preferred method is to download it from the SVN | + | |
- | + | ||
- | For the trunk (development) version: | + | |
- | svn checkout svn:// | + | |
- | + | ||
- | For released branch versions: | + | |
- | svn checkout svn:// | + | |
- | + | ||
- | If SVN is not installed on your system get it at | + | |
- | http:// | + | |
- | + | ||
- | ===== 2. Install Prerequisites ===== | + | |
- | Sub-points here discuss prerequisites needed to build CP2K. | + | |
- | Some of these can be conveniently installed by a script see: [[ http:// | + | |
- | + | ||
- | ==== 2a. GNU make ==== | + | |
- | GNU make should be on your system (gmake or make on linux) and used for | + | |
- | the build, go to http:// | + | |
- | download from http:// | + | |
- | also python (2.X) is required for building. | + | |
- | + | ||
- | ==== 2b. Fortran and C Compiler ==== | + | |
- | A Fortran 95 compiler and matching C compiler should be installed on your system. | + | |
- | We have good experience with gcc/ | + | |
- | compilers have bugs that might cause them to fail (internal compiler errors, | + | |
- | segfaults) or, worse, yield a mis-compiled CP2K. Report bugs to compiler | + | |
- | vendors; they (and we) have an interest in fixing them. | + | |
- | + | ||
- | ==== 2c. BLAS and LAPACK ==== | + | |
- | BLAS and LAPACK should be installed. | + | |
- | can make a very significant difference (up to 100%, e.g., ACML, MKL, | + | |
- | ESSL). | + | |
- | + | ||
- | + | ||
- | <note important> | + | |
- | Note that the BLAS/LAPACK libraries must match the Fortran | + | |
- | compiler used. Use the latest versions available and download all patches! | + | |
- | </ | + | |
- | + | ||
- | * The canonical BLAS and LAPACK can be obtained from the Netlib repository. http:// | + | |
- | * A faster alternative is to use the ATLAS project. It provides BLAS and enough of LAPACK to run CP2K, both optimized for the local machine upon installation. http:// | + | |
- | * GotoBLAS is yet a faster BLAS alternative: | + | |
- | + | ||
- | If compiling with OpenMP support then it is recommended to use a | + | |
- | non-threaded version of BLAS. In particular if compiling with MKL | + | |
- | and using OpenMP you must define '' | + | |
- | MKL with multiple OpenMP threads in CP2K requires that CP2K was compiled | + | |
- | with the Intel compiler (and '' | + | |
- | pre-processing is performed using cpp instead of the compiler). | + | |
- | + | ||
- | ==== 2d. MPI and SCALAPACK ==== | + | |
- | MPI (version 2) and SCALAPACK are needed for parallel code. | + | |
- | (Use the latest versions available and download all patches!) | + | |
- | If your computing platform does not provide MPI, there are several freely | + | |
- | available alternatives: | + | |
- | + | ||
- | * MPICH2 MPI: http:// | + | |
- | * OpenMPI MPI: http:// | + | |
- | * ScaLAPACK: http:// | + | |
- | + | ||
- | ==== 2e. FFTW ==== | + | |
- | FFTW can be used to improve FFT speed on a wide range of architectures. | + | |
- | It is strongly recommended to install and use FFTW3. The current version | + | |
- | of CP2K works with FFTW 3.X (use '' | + | |
- | http:// | + | |
- | + | ||
- | <note important> | + | |
- | Note that FFTW must know the Fortran compiler you will use in order to | + | |
- | install properly (e.g., '' | + | |
- | to use gfortran). | + | |
- | </ | + | |
- | + | ||
- | Note that on machines and compilers which support SSE you can configure | + | |
- | FFTW3 with '' | + | |
- | (NAG f95, Intel IA32/ | + | |
- | or otherwise set the define '' | + | |
- | When building an OpenMP parallel version of CP2K (ssmp or psmp), the | + | |
- | FFTW3 threading library libfftw3_threads (or libfftw3_omp) is required. | + | |
- | + | ||
- | ==== 2f. LIBINT ==== | + | |
- | Hartree-Fock exchange (optional, use '' | + | |
- | package to be installed. It is easiest to install with a Fortran compiler | + | |
- | that supports ISO_C_BINDING and Fortran procedure pointers (recent | + | |
- | gfortran, xlf90, ifort). | + | |
- | Additional information can be found in | + | |
- | cp2k/ | + | |
- | Tested against libinit-1.1.4 and currently hardcoded to the default | + | |
- | angular momentum LIBINT_MAX_AM 5 | + | |
- | (check your include/ | + | |
- | http:// | + | |
- | + | ||
- | <note important> | + | |
- | Note that you should **NOT** use libinit-1.1.3. | + | |
- | </ | + | |
- | + | ||
- | ==== 2g. libsmm (optional) ==== | + | |
- | * A library for small matrix multiplies can be built from the included source (see tools/ | + | |
- | * Add '' | + | |
- | * Add '' | + | |
- | + | ||
- | ==== 2h. CUDA (optional) ==== | + | |
- | * (Experimental): | + | |
- | * Use '' | + | |
- | * USE '' | + | |
- | + | ||
- | ==== 2i. Machine architecture abstraction (optional) ==== | + | |
- | * Use the '' | + | |
- | * Machine architecture visualization is supported only with hwloc. Process/ | + | |
- | * Note that it is not possible to use at same time hwloc and libnuma. | + | |
- | * Consult [[ http:// | + | |
- | + | ||
- | ==== 2j. Process mapping (optional) ==== | + | |
- | * Use the target machine flag (see 3b) to compile with topology support. | + | |
- | * The compiler must support ISO_C_BINDING. | + | |
- | * Consult [[ http:// | + | |
- | * You can also define the strategy to be used using as a command line, with -mpi-mapping [1, | + | |
- | + | ||
- | ^ No. ^ | + | |
- | | 1 | SMP-style rank ordering | + | |
- | | 2 | file based rank ordering | + | |
- | | 3 | hilbert space-filling curve | | + | |
- | | 4 | peano space-fillinng curve | | + | |
- | | 5 | round-robin rank ordering | + | |
- | | 6 | hilbert-peano | + | |
- | | 7 | cannon pattern mapping | + | |
- | + | ||
- | ==== 2k. libxc (optional) ==== | + | |
- | * The version 2.0.1 (or later) of libxc needs to be downloaded (http:// | + | |
- | * Add '' | + | |
- | * Add '' | + | |
- | + | ||
- | ==== 2l. ELPA ==== | + | |
- | Library ELPA for the solution of the eigenvalue problem | + | |
- | * One version of ELPA need to be downloaded (http:// | + | |
- | * Add '' | + | |
- | * ELPA replaces the ScaLapack SYEVD to improve the performance of the diagonalization | + | |
- | * For specific architectures it can be better to install specifically optimized kernels (see BG) and/or employ a higher optimization level to compile it. | + | |
- | + | ||
- | ==== 2m. Python ==== | + | |
- | python 2.x is needed to run the dependency generator. | + | |
- | On most system python is already installed. | + | |
- | For more information visit: http:// | + | |
- | + | ||
- | ===== Compile ===== | + | |
- | + | ||
- | ==== 3a. ARCH files ==== | + | |
- | The location of compiler and libraries needs to be specified. Examples | + | |
- | for a number of common architectures examples can be found in cp2k/ | + | |
- | The names of these files match architecture.version (e.g., Linux-x86-64-gfortran.sopt). | + | |
- | + | ||
- | Conventionally, | + | |
- | ^ Acronym ^ Meaning | + | |
- | | sopt | serial | + | |
- | | popt | parallel (only MPI) | general usage | | + | |
- | | ssmp | parallel (only OpenMP) | + | |
- | | psmp | parallel (MPI + OpenMP) | memory limited calculations | + | |
- | + | ||
- | You'll need to modify one of these files to match your system' | + | |
- | You can now build CP2K using these settings (where -j N allows for a | + | |
- | parallel build using N processes): | + | |
- | > cd cp2k/ | + | |
- | > make -j N ARCH=architecture VERSION=version | + | |
- | e.g. | + | |
- | > make -j N ARCH=Linux-x86-64-gfortran VERSION=sopt | + | |
- | as a short-cut, you can build several version of the code at once | + | |
- | > make -j N ARCH=Linux-x86-64-gfortran VERSION=" | + | |
- | An executable should appear in cp2k/ | + | |
- | + | ||
- | All compiled files, libraries, executables, | + | |
- | versions can be removed with | + | |
- | > make distclean | + | |
- | To remove only objects and mod files (i.e., keep exe) for a given | + | |
- | ARCH/ | + | |
- | > make ARCH=Linux-x86-64-gfortran VERSION=sopt clean | + | |
- | to remove everything for a given ARCH/ | + | |
- | > make ARCH=Linux-x86-64-gfortran VERSION=sopt realclean | + | |
- | + | ||
- | ==== 3b. Compilation Flags ==== | + | |
- | The following flags should be present (or not) in the arch file | + | |
- | (see also 3c, next) | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | various network interconnections: | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | * with '' | + | |
- | * with '' | + | |
- | * '' | + | |
- | + | ||
- | Some options controlling MPI behavior and capabilities: | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ==== 3c. Compiler tweaks ==== | + | |
- | CP2K currently assumes Fortran2003 compliance, even though few features are used. | + | |
- | Explicitly required, are full ISO_C_BINDING support, rank remapping, procedure pointers. | + | |
- | For OpenMP, version 3.1 is assumed. | + | |
- | + | ||
- | If you you get compilation errors about unsupported language | + | |
- | features, then some flags may be used to reduce the language | + | |
- | features required. | + | |
- | + | ||
- | In addition, some flags are used to declare compiler support for | + | |
- | additional language features that the compiler supports. | + | |
- | + | ||
- | Other language capabilities and support: | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ==== 3d. Experimental & Debugging Options ==== | + | |
- | Additional esoteric, development, | + | |
- | section can be safely skipped over. Listed here just for | + | |
- | completeness besides the flags described in this document. | + | |
- | * '' | + | |
- | + | ||
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ==== 3e. Automatic architecture discovery ==== | + | |
- | The `I'm feeling lucky' version of building will try to guess what architecture | + | |
- | you're on. Just type | + | |
- | > make | + | |
- | and the script [[ http://sourceforge.net/p/cp2k/ | + | |
- | architecture. | + | |
- | part of the architecture string. | + | |
- | > export FORT_C_NAME=gfortran | + | |
- | + | ||
- | ==== 3f. Plumed support ==== | + | |
- | Compiling together with plumed v1.3 | + | |
- | + | ||
- | - get the 1.3 version of plumed from their svn repository | + | |
- | - unpack the plumed-1.3 archive somewhere | + | |
- | - set the environment variable $plumedir to the root directory of the plumed distribution < | + | |
- | - symlink the plumed/ | + | |
- | - run the plumedpatch_cp2k script with parameter -patch, it should create a subdirectory src-plumed containing a number of cpp files and a plumed.inc < | + | |
- | - compile cp2k and plumed together with (it is safer to run a distclean before compiling) < | + | |
- | + | ||
- | ===== 4. If it doesn' | + | |
- | If things fail, take a break... have a look at section 3c and go back | + | |
- | to 3a (or skip to step 7). | + | |
- | + | ||
- | ===== 5. Adding a new architecture ===== | + | |
- | If your compiler/ | + | |
- | to support it. Only [[ http:// | + | |
- | + | ||
- | ===== 6. Regtesting ===== | + | |
- | If compilation works fine, you can run one of the test cases | + | |
- | to try out the executable (most inputs in any of the cp2k/ | + | |
- | directories are tested on a daily basis). | + | |
- | > cd ~/ | + | |
- | > ~/ | + | |
- | + | ||
- | systematic regtesting is described here: http:// | + | |
- | + | ||
- | ===== 7. Talk to us ==== | + | |
- | In any case please tell us your comments, praise, criticism, thanks, ... | + | |
- | you can send email to the people in the team: | + | |
- | http:// | + | |
- | + | ||
- | ===== 8. Manual ===== | + | |
- | A reference manual of CP2K can be found on the web: http:// | + | |
- | or can be generated using the cp2k executable, see | + | |
- | http:// | + | |
- | + | ||
- | ===== 9. Happy computing! ===== | + | |
- | + | ||
- | The CP2K team. | + |
howto/compile.1421618360.txt.gz · Last modified: 2020/08/21 10:15 (external edit)