mpi4jax/mpi4jax

Support windows (?)

PhilipVinc opened this issue · 8 comments

Right now, the way we build up compilation flags is unix-specific. I have no idea if it would work on windows.
Moreover, tests are limited to unix systems, as well as the conda recipe.

We could investigate if it can work on win (though I'm not sure it's worth the hassle).

I don't have a windows machine available though

Honest question: Does anyone use MPI on Windows?

We could set up a Windows CI chain on AppVeyor and get some inspiration from the mpi4py tests.

Should be doable to pull this off, so I guess we should do it at some point...

yes,
very low priority.

Let's get everything else sorted first...

Sooo, turns out JAX doesn't even have Windows support. I guess that settles it for now.

Jax now supports windows

I'm doing this for completeness, although I don't think anyone would really use MPI on Windows...

On Windows, the only rather actively maintained implementation of MPI is MS-MPI. Both MPICH and Open MPI dropped support years ago. It may be possible to build them (I didn't try), but first we need a Linux-like compiler toolchain (MSYS2), and the performance would be bad because they use Linux-like threads.

Also, MS-MPI does not have CUDA binding, but we need to make mpi4jax compile even if the user has installed CUDA.

What's worse, MS-MPI binaries do not ship with mpicc (there is only mpiexec), and the easiest way to install a mpicc would be MSYS2. That's also why the default configuration of mpi4py on Windows does not provide mpicc, and we need other ways to call it.

So the instructions are:

  1. Install MS-MPI binaries from https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi ;
  2. Install MSYS2, and the package mingw-w64-x86_64-msmpi in it;
  3. Make sure that mpiexec.exe and mpicc.exe are in your PATH;
  4. Patch pyconfig.h so that it recognizes mingw-w64, see cython/cython#3405 (comment) ;
  5. Download the source of mpi4jax;
  6. Add the following in setup.cfg:
    [build]
    compiler = mingw32
    
    This may be the only way to specify the compiler toolchain in pip. We need to specify mingw32 (it is actually mingw-w64) and prevent pip from automatically finding msvc;
  7. pip install .

I'm not familiar with building and distributing the package. Is there a better way for us to specify the compiler, so the user doesn't need to download and compile the source manually?

Is there any hope to go through WSL instead? Does OpenMPI work through WSL?

Is there any hope to go through WSL instead? Does OpenMPI work through WSL?

Yes it does, and I've been using it for a year