-
Notifications
You must be signed in to change notification settings - Fork 49
Building Charm on Windows
The main compiler for Charm++ on Microsoft Windows platforms is Visual Studio. Experimental build support for GCC and Clang is also possible through MSYS2. The NetLRTS (Ethernet) and MPI communication layers are supported, as well as the Multicore mode for within-node computations.
By default, Charm++ uses VS as its Windows compiler, though we require a Unix shell in addition.
First, install Visual Studio. The Visual Studio Build Tools are sufficient. These are free, although the install size is still several gigabytes. This page has useful info for downloading and installing the VS Build Tools: https://wiki.python.org/moin/WindowsCompilers
The full VS IDE works too, and is useful for debugging.
To support the MPI communication substrate, install Microsoft MPI.
https://www.microsoft.com/en-us/download/details.aspx?id=56727
msmpisdk.msi
provides the build time headers and libraries, while msmpisetup.exe
is for run time.
Cygwin and MSYS2 are the two supported shells for this build process. You may use either one, and it is recommended to install both side-by-side.
Install Cygwin. Make sure to select the following packages as part of the installation process:
- gcc-core
- binutils
- make
- autoconf
- automake
- cmake
Install MSYS2, fully following the instructions. When complete, open MSYS2 MinGW (64-bit), and run:
pacman -S mingw-w64-x86_64-{toolchain,cmake} make autoconf automake git
First, launch these shortcuts. Alternatively, you can skip this two-step terminal creation procedure and instead adapt src/arch/win/vsenv.sh
from the Charm repository to your system.
In the Start Menu, navigate to Visual Studio 20XX\Visual Studio Tools\VC
and run x64 Native Tools Command Prompt for VS 20XX.
Alternatively, run one of the following commands:
"C:\Program Files\Microsoft Visual Studio\20XX\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
"C:\Program Files (x86)\Microsoft Visual Studio\20XX\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
In the Start Menu, navigate to Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts
and run VS2015 x64 Native Tools Command Prompt.
Alternatively, run the following command:
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
Assuming default paths, paste this in the VS command prompt:
C:\cygwin64\bin\mintty.exe -
Run cl
to test that MSVC can be found. You may close the cmd.exe window.
If Cygwin sets the command line variables CC
, CXX
, LD
, etc. by default, use the unset
command to clear them before attempting a build.
unset CC
unset CXX
unset LD
In the cmd.exe shell, paste:
C:\msys64\msys2_shell.cmd -mingw64 -full-path
After this, run cl
to test that MSVC can be found. You may close the cmd.exe window.
Example commands:
./build charm++ multicore-win-x86_64
./build charm++ netlrts-win-x86_64
./build charm++ netlrts-win-x86_64 smp
./build charm++ mpi-win-x86_64
./build charm++ mpi-win-x86_64 smp
MSYS2 is the only option for using GCC or Clang on Windows; Cygwin will not work. Please note that support for compilers other than Visual Studio on Windows is considered experimental.
See the Installing MSYS2 section above.
It is possible to set up Microsoft MPI for use with MinGW-GCC, but this requires some extra setup. The following links may be helpful.
- https://www.symscape.com/configure-msmpi-v8-1-for-mingw-w64
- http://www.math.ucla.edu/~wotaoyin/windows_coding.html
- https://social.microsoft.com/Forums/en-US/245dcda4-7699-494f-bbe1-b76eb19e53da/linking-msmpi-with-mingw-gfortran
- https://abhilashreddy.com/writing/3/mpi_instructions.html
- http://www.paratools.com/mingw/#Microsoft_MPI
- https://github.com/dev-cafe/autocmake/issues/85
Open the MSYS2 MinGW64 shortcut.
Example commands:
./build charm++ multicore-win-x86_64 gcc
./build charm++ netlrts-win-x86_64 gcc
./build charm++ netlrts-win-x86_64 smp gcc
./build charm++ mpi-win-x86_64 gcc
./build charm++ mpi-win-x86_64 smp gcc
./build charm++ multicore-win-x86_64 clang
./build charm++ netlrts-win-x86_64 clang
./build charm++ netlrts-win-x86_64 smp clang
./build charm++ mpi-win-x86_64 clang
./build charm++ mpi-win-x86_64 smp clang