Repast / repast4py

Git repository for Repast for Python development
Other
51 stars 4 forks source link

Windows Build #58

Open etatara opened 8 months ago

etatara commented 8 months ago

Trying to compile on Windows 10 without WSL.

Development environment:

To run the repast4py setup.py:

  1. Checkout the project
  2. Launch a 64-bit Visual Studio command console "x64 Native Tools Command Prompt for VS 2022" (assumes also using 64-bit python)
  3. use where cl to find the full path of the compiler, and then set the 'CC' environment variable, e.g.
    • set CC="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe"
    • Use quotes around the path otherwise the python setup will fail
  4. python setup.py build_ext --inplace
  5. python -m build --wheel
etatara commented 8 months ago

Some unit tests are not passing in Windows

FAILED (errors=1)
Traceback (most recent call last):
  File "L:\repast4py\tests\ctopo_tests.py", line 81, in test_local_bounds_4x2_sticky
    comm = MPI.COMM_WORLD.Create_group(new_group)
  File "mpi4py\MPI\Comm.pyx", line 186, in mpi4py.MPI.Comm.Create_group
NotImplementedError
FAILED (errors=1)

The Microsoft MPI implementation may not be complete or standardized relative to the latest MPICH.

etatara commented 8 months ago

Trying the Intel One API Tookit:

https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit.html#gs.5kou46

image

image

etatara commented 8 months ago

https://www.intel.com/content/www/us/en/developer/tools/oneapi/hpc-toolkit.html

image

etatara commented 8 months ago

Getting errors with the Intel MPI built with MSVC on my Windows machine.

https://stackoverflow.com/questions/29264640/mpiexec-and-python-mpi4py-gives-rank-0-and-size-1 https://pypi.org/project/mpi4py/#install

etatara commented 8 months ago

The mpi4py wheel from pypi is built against MSMPI. Repast4py needs to be built against the same MPI Implementation as mpi4py. Some of the MPI functions like MPI_Comm_create_group used by repast4py are not implemented in MSMPI, so mpi4py would need to be custom build against an appropriate MPI implementation such as openMPI or IntelMPI.

https://mpi4py.readthedocs.io/en/stable/install.html

etatara commented 8 months ago

MPI_Comm_create_group() is only used in unit tests, so perhaps we can rewrite and use something like MPI_Comm_create() which appears to be nearly the same and does work with MSMPI.

etatara commented 8 months ago

With MSMPI and building repast4py on Windows 10, all unit single process tests pass using python -m unittest discover tests

with torch==2.1.0

etatara commented 8 months ago

Replacing MPI.COMM_WORLD.Create_group() with MPI.COMM_WORLD.Create() in the unit test code almost all (except one) multiprocess unit tests are passing with MSMPI on Windows 10. 002ad94

etatara commented 8 months ago

The windows_build branch is passing all tests and the ci-build workflow is producing Windows wheels that have been manually tested. Move to close this issue and merge windows_build into develop after the next code review.