howto:compile_on_windows_with_cygwin
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
howto:compile_on_windows_with_cygwin [2018/04/05 15:26] – [1.Cygwin installation:] gtocci | howto:compile_on_windows_with_cygwin [2023/02/06 01:14] – [3e PEXSI (optional)] iwao | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How to Compile and Install CP2K on Windows | + | <note tip> |
- | ===== 1.Cygwin installation: | ||
- | [[http:// | ||
- | To compile CP2K on Windows, you should install [[http:// | ||
- | For 32 bit Windows execute | ||
- | For 64 bit Windows[[http:// | ||
- | When installing Cygwin make sure you install the following additional packages:\\ | ||
- | *Devel | ||
- | *“bison” | ||
- | *“byacc” | ||
- | *“gcc-fortran” | ||
- | *“gcc-g++” | ||
- | *“make” | ||
- | *Libs | ||
- | *“lapack” | ||
- | *“liblapack-devel” | ||
- | *“liblapack0” | ||
- | *Python | ||
- | *Vim\\ | ||
- | Please operate according to the wizard to finish the Cygwin installation.\\ | ||
- | ===== 2.Acquiring | + | ======How to Compile and Install CP2K on Windows with Cygwin====== |
- | Visit [[http://sourceforge.net/ | + | |
- | Some archivers generate '' | + | I believe there are several ways to build CP2K binaries for Windows. Here I describe how to install Cygwin on Windows 10/11, build CP2K with openmpi on the Cygwin, and run it on a PC without Cygwin.\\ |
+ | |||
+ | |||
+ | =====1 Install Cygwin===== | ||
+ | |||
+ | [[https://www.cygwin.com|Cygwin]] is a large collection | ||
+ | |||
+ | You can install Cygwin on your 64 bit Windows by using [[https:// | ||
+ | and build cp2k on the Cygwin-Windows system.\\ | ||
+ | |||
+ | When installing | ||
< | < | ||
- | tar -xvf cp2k-2.x.x.tar.bz2 | + | Archive |
+ | hdf5 | ||
+ | libhdf5-devel | ||
+ | Devel | ||
+ | bison | ||
+ | byacc | ||
+ | cmake | ||
+ | gcc-fortran | ||
+ | gcc-g++ | ||
+ | make | ||
+ | GNOME | ||
+ | libglade | ||
+ | Libs | ||
+ | fftw3 | ||
+ | lapack | ||
+ | libevent-devel | ||
+ | libxerces-c31 | ||
+ | libxerces-c-devel | ||
+ | libfftw3-devel | ||
+ | libfftw3-omp3 | ||
+ | libfftw3_3 | ||
+ | libgsl-devel | ||
+ | libgsl0 | ||
+ | libgsl19 | ||
+ | liblapack-devel | ||
+ | liblapack0 | ||
+ | libopenmpi-devel | ||
+ | libopenmpi12 | ||
+ | libopenmpi40 | ||
+ | libopenmpicxxl | ||
+ | libopenmpifh40 | ||
+ | libopenmpiusef08_40 | ||
+ | libopenmpiusetkr40 | ||
+ | openmpi | ||
+ | zlib | ||
+ | zlib-devel | ||
+ | Python | ||
+ | Math | ||
+ | libopenblas | ||
+ | Science | ||
+ | gsl | ||
+ | Utils | ||
+ | hdf5 | ||
+ | libhdf5-devel | ||
+ | libhwloc-devel | ||
</ | </ | ||
- | ===== 3.Compilation with Cygwin ===== | + | Follow the wizard instruction to finish the Cygwin (and packages) installation.\\ |
- | An example CP2K ARCH file for a serial build of CP2K on Cygwin is as follows:\\ | + | |
- | < | + | |
- | CC = cc | + | |
- | CPP = | + | |
- | FC = gfortran | + | =====2 Acquire the Code===== |
- | LD = gfortran | + | |
+ | Download a [[https:// | ||
+ | (use the versioned tarballs, `cp2k-X.Y.tar.bz2`) and extract a tarball on the Cygwin64 bash terminal as follows:\\ | ||
+ | |||
+ | < | ||
+ | $ tar -xvf cp2k-X.Y.tar.bz2 | ||
+ | </ | ||
+ | |||
+ | For more details on downloading CP2K, see [[https:// | ||
+ | |||
+ | =====3 Build Prerequisites===== | ||
+ | |||
+ | Source codes of most prerequisities are available not only on individual supplyers but also on [[https:// | ||
+ | |||
+ | |||
+ | ====3a scalapack(optional)==== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Rename " | ||
+ | |||
+ | Edit the " | ||
+ | < | ||
+ | # | ||
+ | FCFLAGS | ||
+ | </ | ||
+ | |||
+ | Edit " | ||
+ | < | ||
+ | # | ||
+ | # $(FC) $(NOOPT) -c $*.f | ||
+ | blacstest.o : blacstest.f | ||
+ | $(FC) -c $(FCFLAGS) $*.f | ||
+ | </ | ||
+ | |||
+ | Change the current directory to " | ||
+ | |||
+ | After the " | ||
+ | |||
+ | ====3b LIBINT (optional)==== | ||
+ | Download a CP2K-configured LIBINT library from [[https:// | ||
+ | and extract the archive (e.g." | ||
+ | |||
+ | Change the current directory to the generated libint directory and execute the following commands on Cygwin 64 bash terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd libint-v2.6.0-cp2k-lmax-7 | ||
+ | $ ./configure --enable-fortran=yes --with-cxx=gcc | ||
+ | $ make | ||
+ | </ | ||
+ | |||
+ | If you find a static library file " | ||
+ | |||
+ | And then change the current directory to " | ||
+ | |||
+ | < | ||
+ | $ cd fortran | ||
+ | $ make | ||
+ | </ | ||
+ | |||
+ | However this may result in: | ||
+ | < | ||
+ | " | ||
+ | </ | ||
+ | and so on, the " | ||
+ | |||
+ | Copy a generated file " | ||
+ | ("Make install" | ||
+ | |||
+ | In the arch file of CP2K: add < | ||
+ | |||
+ | ====3c LIBXC (optional)==== | ||
+ | The version 5.1.0 (or later) of LIBXC can be downloaded from [[https:// | ||
+ | Download and extract " | ||
+ | |||
+ | Change the current directory to the " | ||
+ | |||
+ | < | ||
+ | $ cd libxc-5.1.0 | ||
+ | $ export F77=gfortran | ||
+ | $ ./configure --prefix=/ | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | Libxc will be installed into /usr/local/ in this case.\\ | ||
+ | |||
+ | In the arch file of CP2K: add < | ||
+ | |||
+ | ====3d libxsmm(optional)===== | ||
+ | |||
+ | A library for matrix operations and deep learning primitives: [[https:// | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Change the current directory to the " | ||
+ | |||
+ | < | ||
+ | $ make | ||
+ | $ make PREFIX=/ | ||
+ | </ | ||
+ | |||
+ | In the arch file of CP2K: add < | ||
+ | |||
+ | ====3e PEXSI (optional)==== | ||
+ | |||
+ | PEXSI requires parmetis, scotch, CombBLAS_bata, | ||
+ | |||
+ | ===3e1 parmetis=== | ||
+ | |||
+ | Download and extract [[http:// | ||
+ | |||
+ | Cygwin does' | ||
+ | |||
+ | < | ||
+ | / | ||
+ | * This function prints a backtrace of calling functions | ||
+ | **************************************************************************/ | ||
+ | void PrintBackTrace() | ||
+ | { | ||
+ | #ifdef HAVE_EXECINFO_H | ||
+ | /* | ||
+ | void *array[10]; | ||
+ | int i, size; | ||
+ | char **strings; | ||
+ | |||
+ | size = backtrace(array, | ||
+ | strings = backtrace_symbols(array, | ||
+ | | ||
+ | printf(" | ||
+ | for (i=0; i<size; i++) { | ||
+ | printf(" | ||
+ | } | ||
+ | free(strings); | ||
+ | */ | ||
+ | #endif | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | And then execute the following commands on the Cygwin terminal: | ||
+ | |||
+ | < | ||
+ | $ make config | ||
+ | </ | ||
+ | |||
+ | If you find "ld: cannot find -lmpi_cxx" | ||
+ | |||
+ | After "make config", | ||
+ | |||
+ | < | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | Parmetis will be installed into /usr/local/ by default.\\ | ||
+ | If you have an error during the " | ||
+ | |||
+ | ===3e2 scotch=== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | (It looks like [[https:// | ||
+ | |||
+ | Copy " | ||
+ | |||
+ | Add " | ||
+ | |||
+ | < | ||
+ | CFLAGS = -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_PTHREAD -Drestrict=__restrict -DINTSIZE64 -DIDXSIZE64 -DOMPI_BUILDING | ||
+ | </ | ||
+ | |||
+ | And then execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd scotch_6.0.0/ | ||
+ | $ make ptscotch | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | ===3e3 | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Edit " | ||
+ | |||
+ | < | ||
+ | ADD_SUBDIRECTORY( usort ) | ||
+ | target_link_libraries(CombBLAS PUBLIC Usortlib) | ||
+ | |||
+ | ADD_SUBDIRECTORY( graph500-1.2/ | ||
+ | target_link_libraries(CombBLAS PUBLIC GraphGenlib) | ||
+ | |||
+ | # add new | ||
+ | SET(CMAKE_EXE_LINKER_FLAGS | ||
+ | #end add new | ||
+ | |||
+ | # Set up exported configuration | ||
+ | # This allows CombBLAS to be installed in two ways: | ||
+ | # 1. In /usr/local (or whatever prefix is specified) | ||
+ | # 2. Exporting the current build directory. This allows a user to make | ||
+ | # modifications to CombBLAS and have the changes automatically recompiled for | ||
+ | # dependent projects. | ||
+ | # Either way, we need to create a CombBLASConfig.cmake | ||
+ | </ | ||
+ | |||
+ | And then execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd CombBLAS_beta_16_2 | ||
+ | $ mkdir build | ||
+ | $ mkdir install | ||
+ | $ cd build | ||
+ | $ cmake .. -DCMAKE_INSTALL_PREFIX=../ | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | ===3e4 upcxx=== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ ./install / | ||
+ | </ | ||
+ | |||
+ | The successful installation will display "UPC++ successfully installed" | ||
+ | |||
+ | ===3e5 symPACK=== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd symPACK-2.0.1 | ||
+ | $ mkdir build | ||
+ | $ cd build | ||
+ | $ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/ | ||
+ | </ | ||
+ | |||
+ | ===3e6 superLU_dist=== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd SuperLU_DIST_6.1.0 | ||
+ | $ export PARMETIS_ROOT=/ | ||
+ | $ export PARMETIS_BUILD_DIR=${HOME}/ | ||
+ | $ export COMBBLAS_ROOT=/ | ||
+ | $ export COMBBLAS_BUILD_DIR=${HOME}/ | ||
+ | $ mkdir build | ||
+ | $ cd build | ||
+ | $ cmake .. \ | ||
+ | -DTPL_PARMETIS_INCLUDE_DIRS="/ | ||
+ | -DTPL_PARMETIS_LIBRARIES="/ | ||
+ | -DCMAKE_INSTALL_PREFIX=/ | ||
+ | </ | ||
+ | |||
+ | Edit the following generated files after cmake and add the " | ||
+ | |||
+ | *build/ | ||
+ | *build/ | ||
+ | *build/ | ||
+ | *build/ | ||
+ | *build/ | ||
+ | *build/ | ||
+ | *build/ | ||
+ | *build/ | ||
+ | *build/ | ||
+ | *build/ | ||
+ | *build/ | ||
+ | |||
+ | For example:\\ | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | < | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | SuperLU_DIST will be installed into /usr/local/ by default.\\ | ||
+ | |||
+ | |||
+ | ===3e7 PEXSI=== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd pexsi_v1.2.0 | ||
+ | $ mkdir build | ||
+ | </ | ||
+ | |||
+ | Copy config/ | ||
+ | |||
+ | < | ||
+ | $ cp config/ | ||
+ | $ mv build/ | ||
+ | </ | ||
+ | |||
+ | Edit the content of " | ||
+ | |||
+ | < | ||
+ | CC=mpicc | ||
+ | CXX=mpicxx | ||
+ | FC=mpif90 | ||
+ | PEXSI_INSTALL_DIR=/ | ||
+ | BLAS_LIB=/ | ||
+ | LAPACK_LIB=/ | ||
+ | DSUPERLU_DIR=/ | ||
+ | PARMETIS_DIR=/ | ||
+ | METIS_DIR=/ | ||
+ | GFORTRAN_LIB=/ | ||
+ | |||
+ | cmake \ | ||
+ | -DCMAKE_INSTALL_PREFIX=$PEXSI_INSTALL_DIR \ | ||
+ | -DCMAKE_C_COMPILER=$CC \ | ||
+ | -DCMAKE_CXX_COMPILER=$CXX \ | ||
+ | -DCMAKE_CXX_FLAGS=-DOMPI_BUILDING \ | ||
+ | -DCMAKE_Fortran_COMPILER=$FC \ | ||
+ | -Dlinalg_BLAS_LIBRARIES=" | ||
+ | -Dlinalg_LAPACK_LIBRARIES=" | ||
+ | -Dsuperlu_dist_INCLUDE_DIR=$DSUPERLU_DIR/ | ||
+ | -Dsuperlu_dist_LIBRARIES=$DSUPERLU_DIR/ | ||
+ | -Dmetis_INCLUDE_DIR=$METIS_DIR/ | ||
+ | -Dmetis_LIBRARIES=$METIS_DIR/ | ||
+ | -Dparmetis_INCLUDE_DIR=$PARMETIS_DIR/ | ||
+ | -Dparmetis_LIBRARIES=$PARMETIS_DIR/ | ||
+ | .. | ||
+ | |||
+ | </ | ||
+ | |||
+ | Execute the following commands:\\ | ||
+ | < | ||
+ | $ ./build.sh | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | The "make install" | ||
+ | |||
+ | In the arch file of CP2K: Add < | ||
+ | Add < | ||
+ | |||
+ | ====3f QUIP (optional)=== | ||
+ | |||
+ | Download " | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd QUIP-b4336484fb65b0e73211a8f920ae4361c7c353fd | ||
+ | $ export QUIP_ARCH=linux_x86_64_gfortran | ||
+ | $ make config | ||
+ | </ | ||
+ | |||
+ | In the following "make config" | ||
+ | |||
+ | < | ||
+ | Using QUIP_ARCH=linux_x86_64_gfortran, | ||
+ | |||
+ | In the following, hit enter to accept the defaults. | ||
+ | |||
+ | |||
+ | BUILD OPTIONS | ||
+ | ============= | ||
+ | |||
+ | |||
+ | Please enter the linking options for LAPACK and BLAS libraries: | ||
+ | | ||
+ | |||
+ | |||
+ | Please enter the preferred python command: | ||
+ | | ||
+ | / | ||
+ | |||
+ | Please enter the preferred pip command: | ||
+ | | ||
+ | /bin/pip2.7 | ||
+ | |||
+ | Please enter any other extra linking options: | ||
+ | | ||
+ | |||
+ | |||
+ | OPTIONAL INTERNAL FEATURES | ||
+ | ========================== | ||
+ | |||
+ | |||
+ | Would you like to compile with CP2K support? [y/n] | ||
+ | | ||
+ | y | ||
+ | |||
+ | Would you like to compile with VASP support? [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | Would you like to compile with Tight Binding (TB) support? [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | Would you like to compile with preconditioned minimisation support? (not working with Intel compiler) [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | Would you like to compile with Learn-on-the-fly (LOTF) support? [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | Would you like to compile with ONIOM support? [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | Would you like to compile with LOCAL_E_MIX support? [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | Would you like to compile with QuasiContinuum wrapper support? [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | OPTIONAL FEATURES (EXTRA CODE REQUIRED) | ||
+ | ======================================= | ||
+ | |||
+ | |||
+ | Would you like to compile with GAP support ? [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | Please enter directories where the Turbo-GAP main directory is: | ||
+ | | ||
+ | |||
+ | |||
+ | |||
+ | Would you like to turn on QR decomposition for some GAP operations? [y/n] | ||
+ | | ||
+ | |||
+ | Checking for ThirdParty directory... | ||
+ | Not found. | ||
+ | |||
+ | Would you like to compile with TTM3-F support? [y/n] | ||
+ | | ||
+ | |||
+ | Would you like to compile with SCME support ? [y/n] | ||
+ | | ||
+ | |||
+ | Would you like to compile with MTP support ? [y/n] | ||
+ | | ||
+ | |||
+ | Would you like to compile with many-body dispersion support ? [y/n] | ||
+ | | ||
+ | |||
+ | Would you like to compile with TTM_NF support ? [y/n] | ||
+ | | ||
+ | |||
+ | Would you like to compile with CH4 support ? [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | OPTIONAL EXTERNAL LIBRARIES | ||
+ | =========================== | ||
+ | |||
+ | Would you like to compile with NetCDF4 support? [y/n] | ||
+ | | ||
+ | |||
+ | |||
+ | Please enter directories where MDCORE libraries are kept: | ||
+ | | ||
+ | |||
+ | |||
+ | Please enter directory where the ASAP library is kept: | ||
+ | | ||
+ | |||
+ | |||
+ | Please enter directories where CGAL libraries are kept: | ||
+ | | ||
+ | |||
+ | |||
+ | Please enter directories where METIS libraries are kept: | ||
+ | | ||
+ | |||
+ | |||
+ | Please enter directories where LMTO_TBE libraries are kept: | ||
+ | | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | After "make config", | ||
+ | < | ||
+ | $ make | ||
+ | $ export QUIP_INSTALLDIR=/ | ||
+ | $ make install | ||
+ | $ make libquip | ||
+ | </ | ||
+ | |||
+ | If you find " | ||
+ | Copy " | ||
+ | |||
+ | In the arch file of CP2K: Add < | ||
+ | |||
+ | ====3g spfft(optional)==== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd spFFT-1.0.5 | ||
+ | $ mkdir build | ||
+ | $ cd build | ||
+ | $ cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DSPFFT_FORTRAN=ON -DSPFFT_OMP=ON -DSPFFT_MPI=ON -DSPFFT_SINGLE_PRECISION=OFF -DCMAKE_INSTALL_PREFIX=/ | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | ====3h spla(optional)==== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd spla-1.5.2 | ||
+ | $ mkdir build | ||
+ | $ cd build | ||
+ | $ cmake .. -DCMAKE_INSTALL_PREFIX=/ | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | ====3i SIRIUS (optional)==== | ||
+ | |||
+ | SIRIUS-7.3.0 requires spglib-1.0.2 or later and gsl 2.7 or later.\\ | ||
+ | |||
+ | ===3i1 spglib=== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd spglib-1.16.2 | ||
+ | $ mkdir build | ||
+ | $ cd build | ||
+ | $ cmake .. | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | The "make install" | ||
+ | |||
+ | In the arch file of CP2K: Add < | ||
+ | |||
+ | ===3i2 gsl 2.7=== | ||
+ | |||
+ | If you have the following gsl-related error during building sirius (i.e. " | ||
+ | |||
+ | < | ||
+ | sirius-7.3.0/ | ||
+ | 31 | #include < | ||
+ | | ^~~~~~~~~~~~~~~~~~~~~~ | ||
+ | compilation terminated. | ||
+ | </ | ||
+ | |||
+ | Gsl 2.7 or later is required in this case. If Cygwin setup.exe does't supply the latest binary, you had better build the gsl from the source.\\ | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd gsl-2.7 | ||
+ | $ ./configure | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | The "make install" | ||
+ | |||
+ | ===3i3 SIRIUS=== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd sirius-7.3.0 | ||
+ | $ mkdir build | ||
+ | $ cd build | ||
+ | $ export CXX=mpicxx CC=mpicc FC=mpif90 | ||
+ | $ cmake .. -DCMAKE_INSTALL_PREFIX=/ | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | If you have a link error "ld: smearing.cpp: | ||
+ | the error is caused by your own built gsl which installed into " | ||
+ | Edit " | ||
+ | |||
+ | < | ||
+ | / | ||
+ | ... | ||
+ | CMakeFiles/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | Edit the cp2k code, " | ||
+ | |||
+ | < | ||
+ | | ||
+ | ! brhr editted | ||
+ | ! CALL sirius_initialize(.FALSE.) | ||
+ | CALL sirius_initialize(.TRUE.) | ||
+ | ! end brhr editted | ||
+ | END SUBROUTINE cp_sirius_init | ||
+ | </ | ||
+ | |||
+ | In the arch file of CP2K: Add < | ||
+ | |||
+ | ====3j Libvori (optional)==== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd libvori-220621 | ||
+ | $ mkdir build | ||
+ | $ cd build | ||
+ | $ cmake -DCMAKE_CXX_COMPILER=g++ .. | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | The "make install" | ||
+ | |||
+ | In the arch file of CP2K: Add < | ||
+ | |||
+ | ====3k libvdwxc (optional)==== | ||
+ | |||
+ | Download and extract [[https:// | ||
+ | |||
+ | Execute the following commands on the Cygwin terminal:\\ | ||
+ | |||
+ | < | ||
+ | $ cd libvdwxc-0.4.0 | ||
+ | $ ./configure | ||
+ | $ make | ||
+ | $ make install | ||
+ | </ | ||
+ | |||
+ | The "make install" | ||
+ | |||
+ | In the arch file of CP2K: Add < | ||
+ | |||
+ | =====4 Compile CP2K with Cygwin===== | ||
+ | |||
+ | Prepare a arch file. The following is an example with all options. \\ | ||
+ | |||
+ | < | ||
+ | # Put this file on cp2k-2022.1/ | ||
+ | # make ARCH=Cygwin-x86_64-gfortran VERSION=ssmp | ||
+ | # if you wish to clean, do either make ARCH=Cygwin-x86_64-gfortran VERSION=ssmp clean | ||
+ | # or make ARCH=Cygwin-x86_64-gfortran VERSION=ssmp distclean | ||
+ | |||
+ | CC = gcc | ||
+ | FC = mpif90 | ||
+ | LD = mpif90 | ||
AR = ar -r | AR = ar -r | ||
+ | |||
+ | CFLAGS = -g -O2 -fopenmp | ||
CPPFLAGS = | CPPFLAGS = | ||
- | DFLAGS | + | |
- | FCFLAGS | + | DFLAGS |
- | LDFLAGS | + | DFLAGS += -D__LIBXSMM |
- | LIBS | + | |
+ | FCFLAGS | ||
+ | FCFLAGS += -fbacktrace | ||
+ | FCFLAGS += -I/ | ||
+ | FCFLAGS += -I/ | ||
+ | |||
+ | LDFLAGS | ||
+ | |||
+ | |||
+ | LIBS = | ||
+ | LIBS | ||
+ | LIBS | ||
+ | LIBS | ||
+ | LIBS | ||
+ | LIBS | ||
+ | LIBS | ||
+ | LIBS | ||
+ | LIBS | ||
+ | LIBS | ||
OBJECTS_ARCHITECTURE = machine_gfortran.o | OBJECTS_ARCHITECTURE = machine_gfortran.o | ||
</ | </ | ||
- | Remove | + | |
- | Launch | + | Save the arch file in the ARCH directory with the name e.g. "Cygwin-x86_64-gfortran.ssmp" |
+ | |||
+ | Prepare three nested empty destination directories (" | ||
+ | |||
+ | Put some required FORTRAN modules in the inner-most ssmp directory | ||
+ | |||
+ | These are:\\ | ||
+ | |||
+ | *libint-v2.6.0-cp2k-lmax-7/ | ||
+ | *libxc-5.1.0/ | ||
+ | *libxc-5.1.0/ | ||
+ | *sirius-7.3.0/ | ||
+ | *pexsi_v1.2.0/ | ||
+ | *QUIP-b4336484fb65b0e73211a8f920ae4361c7c353fd/build/ | ||
+ | |||
+ | Execute the "make" commands on the root directory of cp2k on the Cygwin terminal:\\ | ||
< | < | ||
- | make ARCH=Cygwin-i686-gfortran VERSION=sopt | + | $ make ARCH=Cygwin-x86_64-gfortran VERSION=ssmp |
</ | </ | ||
- | It may take 1 or 2 hours until a compilation is completed. | ||
- | If you find '' | ||
- | ===== 4.Installation | + | When the " |
- | By using either cygcheck command | + | |
- | The following | + | =====5 Install |
- | *cygwin\lib\lapack\cygblas-0.dll | + | |
- | *cygwin\bin\cygwin1.dll | + | ====5a The file placement==== |
- | *cygwin\bin\cyggfortran-3.dll | + | Prepare a empty directory named "cp2k-(version string or a unique string to descriminate your build)" |
- | *cygwin\bin\cygquadmath-0.dll | + | |
- | *cygwin\bin\cyggcc_s-1.dll | + | Prepare five empty directories, |
- | *cygwin\lib\lapack\cyglapack-0.dll | + | |
- | Copy these DLLs (except Windows system DLLs) to the same directory as '' | + | Copy cp2k binaries which were generated in " |
- | Pressing SHIFT key right-click '' | + | Copy other DLLs in " |
- | And you type on the command prompt: | + | |
- | < | + | The dependent DLLs will vary depending on which libraries you use. |
- | Then you might see: | + | You can parse the dependencies by using either cygcheck command |
+ | |||
+ | The following | ||
< | < | ||
- | CP2K version | + | (cygwin-root)/ |
- | SVN source code revision svn:XXXXX | + | (cygwin-root)/ |
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
</ | </ | ||
- | Congratulations! You can now run CP2K on Windows. | + | |
+ | Copy also the opemmpi executables into the " | ||
+ | < | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | (cygwin-root)/ | ||
+ | </ | ||
+ | |||
+ | Prepare an empty directory named " | ||
+ | |||
+ | Copy the cp2k data directory into the inside of " | ||
+ | For example, if you built cp2k in " | ||
+ | |||
+ | Prepare a empty directory named " | ||
+ | copy " | ||
+ | |||
+ | Copy openmpi help files (the folder and the all contents of (cygwin-root)/ | ||
+ | |||
+ | ====5b A batch script file==== | ||
+ | Prepare a batch script to launch the cp2k calculations in the upper directory of the " | ||
+ | |||
+ | < | ||
+ | @echo off | ||
+ | set ORGPATH=%PATH% | ||
+ | set PATH=%PATH%; | ||
+ | set OPAL_PREFIX=%CD% | ||
+ | set PMIX_MCA_gds=hash | ||
+ | cp2k.ssmp %* | ||
+ | set PATH=%ORGPATH% | ||
+ | set OPAL_PREFIX= | ||
+ | set PMIX_MCA_gds= | ||
+ | </ | ||
+ | |||
+ | The statement "set ORGPATH=%PATH%" | ||
+ | The statement "set PATH=%PATH%; | ||
+ | The statement " | ||
+ | The statement "set PMIX_MCA_gds=hash" | ||
+ | The statement " | ||
+ | The set statements after " | ||
+ | |||
+ | For details on openmpi environmental variables, please refer to: | ||
+ | [[https:// | ||
+ | |||
+ | Save the script as the name " | ||
+ | |||
+ | ====5c A quick test==== | ||
+ | Open the folder which contains startcp2k.bat and " | ||
+ | Enter " | ||
+ | |||
+ | On the command prompt, execute the following command: | ||
+ | < | ||
+ | $ startcp2k --version | ||
+ | </ | ||
+ | |||
+ | Then you might see:\\ | ||
+ | < | ||
+ | CP2K version 2022.1 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | -cpp -I / | ||
+ | | ||
+ | | ||
+ | rt/ -I / | ||
+ | | ||
+ | | ||
+ | / | ||
+ | | ||
+ | __SPGLIB -D __SIRIUS -D __LIBVDWXC -D __LIBXSMM -D __LIBPEXSI -D __ | ||
+ | QUIP -D __LIBVORI -D __COMPILE_ARCH=" | ||
+ | D __COMPILE_DATE=" | ||
+ | | ||
+ | | ||
+ | | ||
+ | -mavx -mavx2 -mno-sse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi | ||
+ | -mbmi2 -mno-aes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq | ||
+ | | ||
+ | 2ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno- | ||
+ | | ||
+ | alg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm - | ||
+ | | ||
+ | mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mn | ||
+ | | ||
+ | | ||
+ | | ||
+ | vaes -mno-waitpkg -mno-wbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves | ||
+ | -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -m | ||
+ | no-kl -mno-widekl -mno-avxvnni --param=l1-cache-size=32 --param=l1-c | ||
+ | | ||
+ | | ||
+ | r -fbacktrace -fopenmp -fopenmp-simd -funroll-loops -ftree-vectorize | ||
+ | </ | ||
+ | |||
+ | Congratulations! You got a hold of CP2K run on Windows.\\ | ||
howto/compile_on_windows_with_cygwin.txt · Last modified: 2023/12/01 00:25 by krack