Difference between revisions of "Building on Windows"

From GridPACK
Jump to: navigation, search
(Boost)
Line 75: Line 75:
 
   .\b2 ^
 
   .\b2 ^
 
     --prefix=%GridPACKDir% ^
 
     --prefix=%GridPACKDir% ^
    --toolset=msvc-11.0 ^
 
 
     --with-mpi ^
 
     --with-mpi ^
 
     --with-serialization ^
 
     --with-serialization ^
Line 86: Line 85:
 
     link=static runtime-link=shared ^
 
     link=static runtime-link=shared ^
 
     install
 
     install
  [...]
 
    ...updated 12553 targets...
 
 
:* Option 2: build everything (except python -- I'm not sure what's required for that)  
 
:* Option 2: build everything (except python -- I'm not sure what's required for that)  
 
   C:\GridPACK\src\boost_1_61_0>.\b2 ^
 
   C:\GridPACK\src\boost_1_61_0>.\b2 ^
Line 97: Line 94:
 
     link=static runtime-link=shared ^
 
     link=static runtime-link=shared ^
 
     install
 
     install
  [...]
 
  ...updated 12553 targets...
 
 
  
 
Notes:
 
Notes:
Line 117: Line 111:
 
* Get the source [http://icl.cs.utk.edu/lapack-for-windows/clapack/clapack-3.2.1-CMAKE.tgz here].
 
* Get the source [http://icl.cs.utk.edu/lapack-for-windows/clapack/clapack-3.2.1-CMAKE.tgz here].
 
* Configure, build, and install
 
* Configure, build, and install
    set prefix="C:\GridPACK"
 
 
     cmake -Wdev ^
 
     cmake -Wdev ^
 
         -G "Visual Studio 10 2010 Win64" ^
 
         -G "Visual Studio 10 2010 Win64" ^
         -D CMAKE_INSTALL_PREFIX:PATH="%prefix%" ^
+
         -D CMAKE_INSTALL_PREFIX:PATH="%GridPACKDir%" ^
 
         ..
 
         ..
 
     cmake --build . --config Release
 
     cmake --build . --config Release
Line 126: Line 119:
  
 
== SuiteSparse ==
 
== SuiteSparse ==
 +
 +
* For use with PETSc
 +
* Get the source for the Windows port from [https://github.com/jlblancoc/suitesparse-metis-for-windows here].
 +
* Needs BLAS/LAPACK that's consistent with PETSc, so try to just use the one PETSc likes.
 +
* Edit <tt>CMakeLists.txt</tt> to remove the library suffix at this point:
 +
  ## get POSTFIX for lib install dir
 +
  #if(CMAKE_SIZEOF_VOID_P MATCHES "8")
 +
  #  set(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 inst dir placement")
 +
  #else()
 +
    set(LIB_POSTFIX "" CACHE STRING "suffix for 32/64 inst dir placement")
 +
  #endif()
 +
  mark_as_advanced(LIB_POSTFIX)
 +
* Configure, build, and install
 +
  cmake -Wdev ^
 +
      -G "Visual Studio 10 2010 Win64" ^
 +
      -D BUILD_METIS:BOOL=NO ^
 +
      -D SUITESPARSE_INSTALL_PREFIX:PATH="%GridPACKDir%" ^
 +
      -D SUITESPARSE_USE_CUSTOM_BLAS_LAPACK_LIBS:BOOL=ON ^
 +
      -D SUITESPARSE_CUSTOM_BLAS_LIB:PATH=%prefix%\lib\blas.lib ^
 +
      -D SUITESPARSE_CUSTOM_LAPACK_LIB:PATH=%prefix%\lib\lapack.lib ^
 +
      -D CMAKE_INSTALL_PREFIX:PATH="%GridPACKDir" ^
 +
      ..
 +
  cmake --build . --config Release
 +
  cmake --build . --target install --config Release
 +
 +
 +
  
 
== PETSc ==
 
== PETSc ==
  
 
== Global Arrays ==
 
== Global Arrays ==

Revision as of 19:06, 6 December 2016

Building GridPACK on Windows is not for the faint of heart.

System Preparation

The following are available as native Windows applications and can just be installed in the normal Windows way:

  • Visual C++ in some form.
    • The "free" ones, Visual Studio Express and Community, should work.
  • Windows SDK
    Usually, this is just installed with Visual Studio
  • CMake is required
  • A minimal Cygwin installation is necessary.
    Cygwin is required to build, and test for, PETSc. If the system has a Cygwin installation that is being used, it would probably be best to make another installation for GridPACK installation exclusively.
    • Minimum required packages:
      • Base
      • Python
    • Rename /usr/bin/link.exe so it does not interfere with Windows LINK.EXE
    • If you want to use a Cygwin shell to build and/or debug GridPACK applications:
      • Do not install a compiler set.
      • Do not install CMake.
  • Microsoft MPI
    This appears to be the only modern implementation available for Windows. In the past, the OpenMPI and MPICH implementation were available for Windows, but no more.
  • Some software to unpack .zip, .gz, and tar archives. Commands to unpack all of these archives are available with Cygwin. Windows can handle .zip archives natively.
  • (optional) MS-MPI Debugger Extension is useful for debugging problem with parallel programs.

Build Required Libraries

  • In these instructions, everything is done from the Command Prompt. Open a 64-bit Visual Studio command prompt, which should be available from the Start Menu. Type, or copy and paste, the commands below into that command prompt window.
  • Choose a place to install libraries. C:\GridPACK is used in this case. Avoid a path with spaces or special characters in it. It's convenient to set an environment variable to hold this path. GridPACKDir is used here.
  • Make a folder there in which source archives can be unpacked and the builds can be performed. C:\GridPACK\src is used here. Again, avoid a path with spaces or special characters in it.
  • Prepare prepare VS/CMake to use MPI. Enter the command
   set msmpi

the response should be something like

   MSMPI_BIN=C:\Program Files\Microsoft MPI\Bin\
   MSMPI_INC=C:\Program Files (x86)\Microsoft SDKs\MPI\Include\
   MSMPI_LIB32=C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x86\
   MSMPI_LIB64=C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64\

Boost

  • Download source from here and unpack in %GridPACKDir%\src
  • Remember to set msmpi as described above
  • Bootstrap the boost.build, e.g.,
   C:\GridPACK\src\boost_1_58_0>.\bootstrap.bat
  • Add using mpi; to project-config.jam
  • As you might imagine, Boost is not built on Windows with MPI often. Consequently, it's a little out of date. The file mpi.jam needs to be modified. It's in a different place depending on the version. In Boost 1.61 it is ./tools/build/src/tools/mpi.jam. Modify mpi.jam to make it work using the following patch:
    247a248,250
    >     local win_ms_mpi_sdk = "C:\\Program Files (x86)\\Microsoft SDKs\\MPI" ;
    >     local win_ms_mpi = "C:\\Program Files\\Microsoft MPI" ;
    >
    249,251c252,254
    <     local cluster_pack_path_native = "C:\\Program Files\\Microsoft Compute Cluster Pack" ;
    <     local cluster_pack_path = [ path.make $(cluster_pack_path_native) ] ;
    <     if [ GLOB $(cluster_pack_path_native)\\Include : mpi.h ]
    ---
    >     # local cluster_pack_path_native = "C:\\Program Files\\Microsoft Compute Cluster Pack" ;
    >     # local cluster_pack_path = [ path.make $(cluster_pack_path_native) ] ;
    >     if [ GLOB $(win_ms_mpi_sdk)\\Include : mpi.h ]
    255c258
    <         ECHO "Found Microsoft Compute Cluster Pack: $(cluster_pack_path_native)" ;
    ---
    >         ECHO "Found Microsoft Compute Cluster Pack: $(win_ms_mpi_sdk)" ;
    260,262c263,265
    <       options = <include>$(cluster_pack_path)/Include
    <                 <address-model>64:<library-path>$(cluster_pack_path)/Lib/amd64
    <                 <library-path>$(cluster_pack_path)/Lib/i386
    ---
    >       options = <include>$(win_ms_mpi_sdk)/Include
    >                 <address-model>64:<library-path>$(win_ms_mpi_sdk)/Lib/x64
    >                 <library-path>$(win_ms_mpi_sdk)/Lib/x86
    268c271
    <       .mpirun = "\"$(cluster_pack_path_native)\\Bin\\mpiexec.exe"\" ;
    ---
    >       .mpirun = "\"$(win_ms_mpi)\\Bin\\mpiexec.exe"\" ;
  • Configure, build, and install. The python library is not needed; iostreams is skipped unless some additional libraries are installed; graph_parallel fails to build (see this ticket). There are two options for building:
  • Option 1: just build what GridPACK requires (header-only libraries are still installed)
 .\b2 ^
   --prefix=%GridPACKDir% ^
   --with-mpi ^
   --with-serialization ^
   --with-random ^
   --with-filesystem ^
   --with-system ^
   --build-type=complete ^
   threading=single ^
   address-model=64 ^
   link=static runtime-link=shared ^
   install
  • Option 2: build everything (except python -- I'm not sure what's required for that)
 C:\GridPACK\src\boost_1_61_0>.\b2 ^
   --prefix=%GridPACKDir% ^
   --without-python ^
   --build-type=complete ^
   threading=single ^
   address-model=64 ^
   link=static runtime-link=shared ^
   install

Notes:

BLAS/LAPACK (CLAPACK)

Some implementation of BLAS/LAPACK is required for PETSc and some other libraries. The implementation described here was chosen because it does not require a Fortran compiler. It is apparently really slow. It will probably be necessary to install Intel compilers and MKL in order to get improvement in speed. The Windows port of CLAPACK is described here.

  • Get the source here.
  • Configure, build, and install
   cmake -Wdev ^
       -G "Visual Studio 10 2010 Win64" ^
       -D CMAKE_INSTALL_PREFIX:PATH="%GridPACKDir%" ^
       ..
   cmake --build . --config Release
   cmake --build . --target install --config Release

SuiteSparse

  • For use with PETSc
  • Get the source for the Windows port from here.
  • Needs BLAS/LAPACK that's consistent with PETSc, so try to just use the one PETSc likes.
  • Edit CMakeLists.txt to remove the library suffix at this point:
 ## get POSTFIX for lib install dir
 #if(CMAKE_SIZEOF_VOID_P MATCHES "8")
 #  set(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 inst dir placement")
 #else()
   set(LIB_POSTFIX "" CACHE STRING "suffix for 32/64 inst dir placement")
 #endif()
 mark_as_advanced(LIB_POSTFIX)
  • Configure, build, and install
 cmake -Wdev ^
     -G "Visual Studio 10 2010 Win64" ^
     -D BUILD_METIS:BOOL=NO ^
     -D SUITESPARSE_INSTALL_PREFIX:PATH="%GridPACKDir%" ^
     -D SUITESPARSE_USE_CUSTOM_BLAS_LAPACK_LIBS:BOOL=ON ^
     -D SUITESPARSE_CUSTOM_BLAS_LIB:PATH=%prefix%\lib\blas.lib ^
     -D SUITESPARSE_CUSTOM_LAPACK_LIB:PATH=%prefix%\lib\lapack.lib ^
     -D CMAKE_INSTALL_PREFIX:PATH="%GridPACKDir" ^
     ..
 cmake --build . --config Release
 cmake --build . --target install --config Release



PETSc

Global Arrays