Skip to content

Building Charm on Windows

Evan Ramos edited this page Apr 17, 2023 · 2 revisions

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.

Visual Studio

By default, Charm++ uses VS as its Windows compiler, though we require a Unix shell in addition.

Installing Visual Studio

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.

MPI Library Installation (Optional)

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.

Shell Installation

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.

Installing Cygwin

https://www.cygwin.com/

Install Cygwin. Make sure to select the following packages as part of the installation process:

  • gcc-core
  • binutils
  • make
  • autoconf
  • automake
  • cmake

Installing MSYS2

https://www.msys2.org/

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

Environment Launch

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.

VS 2017 / VS 2019 / VS 2022

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"

VS 2015

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

Launching Cygwin

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

Launching MSYS2

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.

Building with Visual Studio

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

GCC or Clang

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.

Toolchain Installation

See the Installing MSYS2 section above.

MPI Library Installation (Experimental)

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.

Building with GCC or Clang

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