Build AMUSE on Windows

I'm currently in the process of building AMUSE on windows, the goal is to get a build process capable of producing binaries for people wanting to try amuse and running on windows (So not the most optimized version, or every last code needs to be available). Also build process will not be fully automatic.

getting the software

  1. python from portable python (I installed it in c:\amuse\pe)
  2. visual studio 9 express, see here  https://www.microsoft.com/visualstudio/en-us/products/2008-editions/express
  3. mpich2,  http://www.mcs.anl.gov/research/projects/mpich2/
  4. hdf5 shared lib, see here  http://www.hdfgroup.org/HDF5/release/obtain5.html#obtain
  5. mingw and msys, for gnu compilers, make and other unix tools
  6. tdm gcc (for gnu compilers compatible with mpich2, see here  http://tdm-gcc.tdragon.net/)
  7. subversion binary windows (google it)
  8. cmake binary windows (google it)
  9. gsl (tested with version 1.12)
  10. fftw 3 (see here  http://www.fftw.org/install/windows.html)

Install everything in a common root directory (not the default Program Files, I choose: c:\amuse)

python packages

mpi4py

(run in a dos prompt with vcvarsall.bat ran)

  1. download from PYPI
  2. unpack somewhere
  3. edit mpicfg, look for section mpich2 and windows and copy this to the top section
  4. run: c:\amuse\pp\App\python.exe setup.py install

h5py

(run in a dos prompt with vcvarsall.bat ran)

  1. downalod from PYPI
  2. run: set HDF5_DIR c:\amuse\hdf5\1.8.9
  3. run: c:\amuse\pp\App\python.exe configure.py
  4. run: c:\amuse\pp\App\python.exe setup.py install

docutils, nosetests

use easy_install from portable python:

  1. run: c:\amuse\pp\App\Scripts\easy_install.exe docutils
  2. run: c:\amuse\pp\App\Scripts\easy_install.exe nosetests

MPI compilers

MPICH2 for windows does not seem to come with mpiXX wrappers.

To fix this, I copied over the mpiXX scripts from a UNIX install and edited the directories at the start of the file. I emptied all C, fortran and LD flags (-O2 -m64 etc,)

For mpif90, you'll need to remove all references to ${MPILIBNAME}f90 and replace it with fmpich2g.

$ mpif90 -show                                                                                                                                                     
gfortran -I/c/amuse/mpich2/include -I/c/amuse/mpich2/include -L/c/amuse/mpich2/lib -lfmpich2g -lmpi  
$ mpicxx -show                                                                                                                                                     
c++ -I/c/amuse/mpich2/include/ -L/c/amuse/mpich2/lib -lmpicxx -lmpi

Set the mpiXX script in the path

cmake

For cmake you need to define the cmake generator (defaults to MSVC projects and we need MSYS Makefiles)

export CMAKE_GENERATOR="MSYS Makefiles"

TDM compiler

Add the TDM binary directory as the first item to your path:

export PATH=/c/TDM/bin:$PATH

gsl

Add the gsl bin and lib-shared directories to the windows PATH

After configure edit the config.mk file and change the GSL_LIBS setting to point to lib-shared instead of lib

export PATH=$PATH:/c/amuse/gsl-1.12/bin:/c/amuse/gsl-1.12/lib-shared/

part of config.mk:

FOUND_GSL=yes                                                                  
GSL_FLAGS=-I/c/amuse/gsl-1.12/bin/../include                                   
GSL_LIBS=-L/c/amuse/gsl-1.12/bin/../lib-shared -lgsl -lgslcblas   

fftw3

Add the fftw3 directory to your path:

export PATH=$PATH:/c/amuse/fftw3/

Edit the config.mk file after configure to set the FFTW specific flags (configure will probably not find fftw3 automatically)

FOUND_FFTW=yes                                                                 
FFTW_FLAGS=-I/c/amuse/fftw3/                                                   
FFTW_LIBS=-L/c/amuse/fftw3/ -llibfftw3-3   

HDF5

Edit the config.mk file after configure

HDF5_FLAGS=-I/c/amuse/HDF5/1.8.9/include                                       
HDF5_LIBS=-L/c/amuse/HDF5/1.8.9/bin -lhdf5dll                                  

Amuse

Get amuse from svn (or latests release might also work)

  1. export PYTHON="C:
    amuse\pp\App\python.exe"
  2. Run configure ./configure --with-hdf5=/c/amuse/HDF5/1.8.9/ FFTW_FLAGS=-I/c/amuse/fftw3/ FFTW_LIBS="-L/c/amuse/fftw3/ -llibfftw3-3"
  3. Edit config.mk for fftw, gsl, hdf5 etc.
  4. Run make

Current status on the windows port: 24 out of 31 codes built Not built: adaptb, hacs64, hop, kepler, pynbody, simplex, smalln

create file amuserc with:

[channel]
worker_code_suffix=.exe

Run a test with:

/c/amuse/mpich2/bin/mpiexec.exe -localonly 1  /c/amuse/pp/app/Scripts/nosetests -v test/codes_tests/test_sse.py