User Tools

Site Tools


howto:compile_on_windows_with_cygwin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howto:compile_on_windows_with_cygwin [2022/10/10 11:17] iwaohowto:compile_on_windows_with_cygwin [2023/12/01 00:25] (current) krack
Line 1: Line 1:
 +<note tip>We recommend to try first the [[https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-11-with-gui-support#1-overview|Windows Subsystem for Linux]] (WSL) before reaching for Cygwin.
 +Check [[howto:compile_on_windows|this howto]] for further details.
 +</note>
 +
 +
 ======How to Compile and Install CP2K on Windows with Cygwin====== ======How to Compile and Install CP2K on Windows with Cygwin======
  
Line 78: Line 83:
 Source codes of most prerequisities are available not only on individual supplyers but also on [[https://www.cp2k.org/static/downloads/]].\\ Source codes of most prerequisities are available not only on individual supplyers but also on [[https://www.cp2k.org/static/downloads/]].\\
  
-====3a LIBINT (optional)====+ 
 +====3a scalapack(optional)==== 
 + 
 +Download and extract [[https://www.cp2k.org/static/downloads/scalapack-2.1.0.tgz|"scalapack-2.1.0.tgz"]].\\ 
 + 
 +Rename "SLmake.inc.example" to "SLmake.inc" in the generated "scalapack-2.1.0" directory.\\ 
 + 
 +Edit the "SLmake.inc" as follows:\\ 
 +<code> 
 +#FCFLAGS       = -O3 
 +FCFLAGS       = -O3 -w -fallow-argument-mismatch 
 +</code> 
 + 
 +Edit "BLACS/TESTING/Makefile" as follows:\\ 
 +<code> 
 +#blacstest.o : blacstest.f 
 +# $(FC) $(NOOPT) -c $*.f 
 +blacstest.o : blacstest.f 
 + $(FC) -c $(FCFLAGS) $*.f 
 +</code> 
 + 
 +Change the current directory to "scalapack-2.1.0" on the Cygwin 64 terminal  and execute "make".\\ 
 + 
 +After the "make" is completed, copy the generated "libscalapack.a" to "/usr/local/lib" because "make install" does not work.\\ 
 + 
 +====3b LIBINT (optional)====
 Download a CP2K-configured LIBINT library from [[https://github.com/cp2k/libint-cp2k|libint-cp2k]] Download a CP2K-configured LIBINT library from [[https://github.com/cp2k/libint-cp2k|libint-cp2k]]
 and extract the archive (e.g."libint-v2.6.0-cp2k-lmax-7.tgz") by using the similar way as the cp2k tarball case or something like [[https://www.7-zip.org|7-zip]].\\ and extract the archive (e.g."libint-v2.6.0-cp2k-lmax-7.tgz") by using the similar way as the cp2k tarball case or something like [[https://www.7-zip.org|7-zip]].\\
Line 105: Line 135:
 and so on, the "make" is successful if "libint_f.mod" is found in the "fortran" directory.\\ and so on, the "make" is successful if "libint_f.mod" is found in the "fortran" directory.\\
  
-Copy a generated file "libint-v2.6.0-cp2k-lmax-7/lib/.libs/linint2.a" and a "libint-v2.6.0-cp2k-lmax-7/include/libint2" directory manually into "Cygwin/usr/local/lib" and "Cygwin/usr/local/include" directories respectively.\\+Copy a generated file "libint-v2.6.0-cp2k-lmax-7/lib/.libs/linint2.a" and a "libint-v2.6.0-cp2k-lmax-7/include/libint2" directory manually into "(cygwin-root)/usr/local/lib" and "(cygwin-root)/usr/local/include" directories respectively.\\
 ("Make install" does not seem to work.)\\ ("Make install" does not seem to work.)\\
  
-In the arch file of CP2K: add <code>-D__LIBINT</code> to the DFLAGS. Add <code>-L$(LIBINT_DIR)/lib -lint2 -lstdc++</code> to LIBS and <code>-I$(LIBINT_DIR)/include</code> to FCFLAGS. lstdc++ is needed because of using the GNU C++ compiler.\\+In the arch file of CP2K: add <code>-D__LIBINT</code> to the DFLAGS. Add <code>-L/usr/local/lib -lint2 -lstdc++</code> to LIBS and <code>-I/usr/local/include</code> to FCFLAGS. lstdc++ is needed because of using the GNU C++ compiler.\\
  
-====3b LIBXC (optional)====+====3c LIBXC (optional)====
 The version 5.1.0 (or later) of LIBXC can be downloaded from [[https://www.tddft.org/programs/libxc]].\\ The version 5.1.0 (or later) of LIBXC can be downloaded from [[https://www.tddft.org/programs/libxc]].\\
 Download and extract "libxc-5.1.0.tar.gz" by using the similar way as cp2k tarball case or something like [[https://www.7-zip.org|7-zip]].\\ Download and extract "libxc-5.1.0.tar.gz" by using the similar way as cp2k tarball case or something like [[https://www.7-zip.org|7-zip]].\\
Line 128: Line 158:
 In the arch file of CP2K: add <code>-D__LIBXC</code> to DFLAGS, <code>-I/usr/local/include</code> to FCFLAGS and <code>-L$/usr/local/lib -lxcf03 -lxc</code> to LIBS. In the arch file of CP2K: add <code>-D__LIBXC</code> to DFLAGS, <code>-I/usr/local/include</code> to FCFLAGS and <code>-L$/usr/local/lib -lxcf03 -lxc</code> to LIBS.
  
-====3c libxsmm(optional)=====+====3d libxsmm(optional)=====
  
 A library for matrix operations and deep learning primitives: [[https://github.com/hfp/libxsmm/]]\\ A library for matrix operations and deep learning primitives: [[https://github.com/hfp/libxsmm/]]\\
Line 143: Line 173:
 In the arch file of CP2K: add <code>-D__LIBXSMM</code> to enable it, with include and library paths, i.e., <code>FCFLAGS += -I/usr/local/include -D__LIBXSMM</code> and <code>LIBS += -L/usr/local/lib -lxsmmf -lxsmm -ldl</code>S\\ In the arch file of CP2K: add <code>-D__LIBXSMM</code> to enable it, with include and library paths, i.e., <code>FCFLAGS += -I/usr/local/include -D__LIBXSMM</code> and <code>LIBS += -L/usr/local/lib -lxsmmf -lxsmm -ldl</code>S\\
  
-====3d PEXSI (optional)====+====3e PEXSI (optional)====
  
 PEXSI requires parmetis, scotch, CombBLAS_bata, upcxx, symPACK and superLU_dist.\\ PEXSI requires parmetis, scotch, CombBLAS_bata, upcxx, symPACK and superLU_dist.\\
  
-===3d1 parmetis===+===3e1 parmetis===
  
 Download and extract [[http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.3.tar.gz|"parmetis-4.0.3.tar.gz"]].\\ Download and extract [[http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.3.tar.gz|"parmetis-4.0.3.tar.gz"]].\\
Line 196: Line 226:
 If you have an error during the "make", delete the all contents in "build" directory and try to rebuild.\\ If you have an error during the "make", delete the all contents in "build" directory and try to rebuild.\\
  
-===3d2 scotch===+===3e2 scotch===
  
 Download and extract [[https://www.cp2k.org/static/downloads/scotch_6.0.0.tar.gz|"scotch_6.0.0.tar.gz"]].\\ Download and extract [[https://www.cp2k.org/static/downloads/scotch_6.0.0.tar.gz|"scotch_6.0.0.tar.gz"]].\\
Line 217: Line 247:
 </code> </code>
  
-===3d3  CombBLAS_bata===+===3e3  CombBLAS_bata===
  
 Download and extract [[https://eecs.berkeley.edu/~aydin/CombBLAS_FILES/CombBLAS_beta_16_2.tgz|CombBLAS_beta_16_2.tgz]].\\ Download and extract [[https://eecs.berkeley.edu/~aydin/CombBLAS_FILES/CombBLAS_beta_16_2.tgz|CombBLAS_beta_16_2.tgz]].\\
Line 255: Line 285:
 </code> </code>
  
-===3d4 upcxx===+===3e4 upcxx===
  
 Download and extract [[https://bitbucket.org/berkeleylab/upcxx/downloads/upcxx-2019.9.0.tar.gz|"upcxx-2019.9.0.tar.gz"]]. Download and extract [[https://bitbucket.org/berkeleylab/upcxx/downloads/upcxx-2019.9.0.tar.gz|"upcxx-2019.9.0.tar.gz"]].
Line 267: Line 297:
 The successful installation will display "UPC++ successfully installed" at the end.\\ The successful installation will display "UPC++ successfully installed" at the end.\\
  
-===3d5 symPACK===+===3e5 symPACK===
  
 Download and extract [[https://github.com/symPACK/symPACK/archive/refs/tags/v2.0.1.tar.gz|"symPACK-2.0.1.tar.gz"]]. Download and extract [[https://github.com/symPACK/symPACK/archive/refs/tags/v2.0.1.tar.gz|"symPACK-2.0.1.tar.gz"]].
Line 280: Line 310:
 </code> </code>
  
-===3d6 superLU_dist===+===3e6 superLU_dist===
  
 Download and extract [[https://github.com/xiaoyeli/superlu_dist/archive/refs/tags/v6.1.0.tar.gz|"superlu_dist_6.1.0.tar.gz"]]. Download and extract [[https://github.com/xiaoyeli/superlu_dist/archive/refs/tags/v6.1.0.tar.gz|"superlu_dist_6.1.0.tar.gz"]].
Line 291: Line 321:
 $ export PARMETIS_BUILD_DIR=${HOME}/parmetis-4.0.3/build/CYGWIN_NT-10.0-x86_64 $ export PARMETIS_BUILD_DIR=${HOME}/parmetis-4.0.3/build/CYGWIN_NT-10.0-x86_64
 $ export COMBBLAS_ROOT=/usr/local/combblas $ export COMBBLAS_ROOT=/usr/local/combblas
-$ export COMBBLAS_BUILD_DIR=${HOME}/CombBLAS_beta_16_2/_build+$ export COMBBLAS_BUILD_DIR=${HOME}/CombBLAS_beta_16_2/build
 $ mkdir build $ mkdir build
 $ cd build $ cd build
Line 300: Line 330:
 </code> </code>
  
-Edit the following generated files after cmake and add the "-mpi" flag at the end of the line.\\+Edit the following generated files after cmake and add the "-lmpi" flag at the end of the line.\\
  
   *build/TEST/CMakeFiles/pdtest.dir/link.txt   *build/TEST/CMakeFiles/pdtest.dir/link.txt
Line 328: Line 358:
  
  
-===3d7 PEXSI===+===3e7 PEXSI===
  
 Download and extract [[https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v1.2.0.tar.gz|"pexsi_v1.2.0.tar.gz"]]. Download and extract [[https://bitbucket.org/berkeleylab/pexsi/downloads/pexsi_v1.2.0.tar.gz|"pexsi_v1.2.0.tar.gz"]].
Line 390: Line 420:
 Add <code>-lpexsi -llapack -lblas -lsuperlu_dist -lparmetis -lmetis</code>, and their paths with <code>-L/usr/local/pexsi/lib</code> to LIBS.\\ Add <code>-lpexsi -llapack -lblas -lsuperlu_dist -lparmetis -lmetis</code>, and their paths with <code>-L/usr/local/pexsi/lib</code> to LIBS.\\
  
-====3e QUIP (optional)===+====3f QUIP (optional)===
  
 Download "[[https://www.cp2k.org/static/downloads/QUIP-b4336484fb65b0e73211a8f920ae4361c7c353fd.tar.gz|QUIP-b4336484fb65b0e73211a8f920ae4361c7c353fd.tar.gz]]" and extract it. Download "[[https://www.cp2k.org/static/downloads/QUIP-b4336484fb65b0e73211a8f920ae4361c7c353fd.tar.gz|QUIP-b4336484fb65b0e73211a8f920ae4361c7c353fd.tar.gz]]" and extract it.
Line 547: Line 577:
 In the arch file of CP2K: Add <code>-D__QUIP</code> to DFLAGS. Add <code>-lquip</code> to LIBS. Add <code>-Wl,--stack,4194304</code> to FCFLAGS, to avoid a "Exception: STATUS_STACK_OVERFLOW" error.\\ In the arch file of CP2K: Add <code>-D__QUIP</code> to DFLAGS. Add <code>-lquip</code> to LIBS. Add <code>-Wl,--stack,4194304</code> to FCFLAGS, to avoid a "Exception: STATUS_STACK_OVERFLOW" error.\\
  
-====3f spfft(optional)====+====3g spfft(optional)====
  
 Download and extract [[https://github.com/eth-cscs/SpFFT/archive/refs/tags/v1.0.5.tar.gz|"SpFFT-1.0.5.tar.gz"]]. Download and extract [[https://github.com/eth-cscs/SpFFT/archive/refs/tags/v1.0.5.tar.gz|"SpFFT-1.0.5.tar.gz"]].
Line 562: Line 592:
 </code> </code>
  
-====3g spla(optional)====+====3h spla(optional)====
  
 Download and extract [[https://github.com/eth-cscs/spla/archive/refs/tags/v1.5.2.tar.gz|"spla-1.5.2.tar.gz"]]. Download and extract [[https://github.com/eth-cscs/spla/archive/refs/tags/v1.5.2.tar.gz|"spla-1.5.2.tar.gz"]].
Line 577: Line 607:
 </code> </code>
  
-====3h SIRIUS (optional)====+====3i SIRIUS (optional)====
  
 SIRIUS-7.3.0 requires spglib-1.0.2 or later and gsl 2.7 or later.\\ SIRIUS-7.3.0 requires spglib-1.0.2 or later and gsl 2.7 or later.\\
  
-===3h1 spglib===+===3i1 spglib===
  
 Download and extract [[https://www.cp2k.org/static/downloads/spglib-1.16.0.tar.gz|"spglib-1.16.1.tar.gz"]]. Download and extract [[https://www.cp2k.org/static/downloads/spglib-1.16.0.tar.gz|"spglib-1.16.1.tar.gz"]].
Line 600: Line 630:
 In the arch file of CP2K: Add <code>-D__SPGLIB</code> to DFLAGS. In the arch file of CP2K: Add <code>-D__SPGLIB</code> to DFLAGS.
  
-===3h2 gsl 2.7===+===3i2 gsl 2.7===
  
 If you have the following gsl-related error during building sirius (i.e. "make" sirius), gsl has not been installed on cygwin or the installed gsl is too old for the sirius.\\ If you have the following gsl-related error during building sirius (i.e. "make" sirius), gsl has not been installed on cygwin or the installed gsl is too old for the sirius.\\
Line 626: Line 656:
 The "make install" will install gsl into usr/local by default. The "make install" will install gsl into usr/local by default.
  
-===3h3 SIRIUS===+===3i3 SIRIUS===
  
 Download and extract [[https://github.com/electronic-structure/SIRIUS/archive/refs/tags/v7.3.0.tar.gz|"SIRIUS-7.3.0.tar.gz"]]. Download and extract [[https://github.com/electronic-structure/SIRIUS/archive/refs/tags/v7.3.0.tar.gz|"SIRIUS-7.3.0.tar.gz"]].
Line 666: Line 696:
 In the arch file of CP2K: Add <code>-D__SIRIUS</code> to DFLAGS.\\ In the arch file of CP2K: Add <code>-D__SIRIUS</code> to DFLAGS.\\
  
-====3i Libvori (optional)====+====3j Libvori (optional)====
  
 Download and extract [[https://brehm-research.de/files/libvori-220621.tar.gz|"libvori-220621.tar.gz"]]. Download and extract [[https://brehm-research.de/files/libvori-220621.tar.gz|"libvori-220621.tar.gz"]].
Line 685: Line 715:
 In the arch file of CP2K: Add <code>-D__LIBVORI</code> to DFLAGS. In the arch file of CP2K: Add <code>-D__LIBVORI</code> to DFLAGS.
  
-====3j libvdwxc (optional)====+====3k libvdwxc (optional)====
  
 Download and extract [[https://www.cp2k.org/static/downloads/libvdwxc-0.4.0.tar.gz|"libvdwxc-0.4.0.tar.gz"]]. Download and extract [[https://www.cp2k.org/static/downloads/libvdwxc-0.4.0.tar.gz|"libvdwxc-0.4.0.tar.gz"]].
Line 708: Line 738:
 <file> <file>
 # Put this file on cp2k-2022.1/arch and execute the following command on the cp2k-2022.1 root directory # Put this file on cp2k-2022.1/arch and execute the following command on the cp2k-2022.1 root directory
-# make ARCH=Cygwin-x86_64-gfortran-pexsi VERSION=ssmp +# make ARCH=Cygwin-x86_64-gfortran VERSION=ssmp 
-# if you wish to clean, do either make ARCH=Cygwin-x86_64-gfortran-pexsi VERSION=ssmp clean +# if you wish to clean, do either make ARCH=Cygwin-x86_64-gfortran VERSION=ssmp clean 
-# or make ARCH=Cygwin-x86_64-gfortran-pexsi VERSION=ssmp distclean+# or make ARCH=Cygwin-x86_64-gfortran VERSION=ssmp distclean
  
 CC       = gcc CC       = gcc
Line 758: Line 788:
   *libxc-5.1.0/src/xc_f90_lib_m.mod   *libxc-5.1.0/src/xc_f90_lib_m.mod
   *sirius-7.3.0/build/src/mod_files/sirius.mod   *sirius-7.3.0/build/src/mod_files/sirius.mod
 +  *pexsi_v1.2.0/build/include/f_ppexsi_interface.mod
   *QUIP-b4336484fb65b0e73211a8f920ae4361c7c353fd/build/linux_x86_64_gfortran/quip_unified_wrapper_module.mod\\   *QUIP-b4336484fb65b0e73211a8f920ae4361c7c353fd/build/linux_x86_64_gfortran/quip_unified_wrapper_module.mod\\
  
 Execute the "make" commands on the root directory of cp2k on the Cygwin terminal:\\ Execute the "make" commands on the root directory of cp2k on the Cygwin terminal:\\
 <code> <code>
-$ make ARCH=Cygwin-x86_64-gfortran-pexsi VERSION=ssmp+$ make ARCH=Cygwin-x86_64-gfortran VERSION=ssmp
 </code> </code>
  
howto/compile_on_windows_with_cygwin.1665400637.txt.gz · Last modified: 2022/10/10 11:17 by iwao