Monday, July 08, 2013

Building Repast HPC on Mountain Lion

For a possible small consulting project, I've built Repast HPC on Mountain Lion and I'm making notes available here, since the build was not simple.

First, I needed the hdf5 library. I used hdf5-1.8.11 from the .tar.gz. This has to be built using ./configure --prefix=/usr/local/ (or somewhere else if you are doing something different to manage user-built programs). I was then able to run sudo make, sudo make check, sudo make install, and sudo make check-install and that all seemed to work fine (although the tests take quite a while, even on my 8-core Mac Pro).

Next, I needed to install netcdf. I went down a versioning rabbit hole for a number of hours with 4.3.0... I was _not_ able to get it to work! Use ./configure --prefix=/usr/local, make, make check, sudo make install.

Next, the netcdf-cxx, the C++ version. I used netcdf-cxx-4.2 -- NOT netcdf-cxx4-4.2 -- with ./configure --prefix=/usr/local/

Similarly, boost 1.54 had all kinds of problems. I had to use boost 1.48. ./ --prefix=/usr/local and sudo ./b2 ... the build process is extremely time consuming, and I had to manually install both the boost headers and the compiled libraries.

Next, openmp1 1.6.0 -- NOT 1.6.5. ./configure --prefix=/usr/local/ seemed to go OK, although it seems to run recursively on sub-projects, so it takes a long time, and creates hundreds of makefiles. Wow. Then sudo make install... so much stuff. My 8 cores are not really that much help, and don't seem to be busy enough. Maybe an SSD would help keep them stuffed. Where's my 2013 Mac Pro "space heater" edition, with a terabyte SSD? (Maybe when I get some income again...)

Finally, ./configure --prefix=/usr/local/ in repasthps-1.0.1, and make succeeded. After about 4 hours of messing around with broken builds. I had a lot with build issues for individual components and final problems with Repast HPC itself despite everything else building successfully, before I finally found this e-mail message chain that had some details about the API changes between different versions, and laid out a workable set of libraries:

They suggest that these versions work:

drwxr-xr-x@ 27 markehlen  staff    918 Aug 21 19:14 boost_1_48_0 
drwxr-xr-x@ 54 markehlen  staff   1836 Aug 21 19:19 netcdf- 
drwxr-xr-x@ 26 markehlen  staff    884 Aug 21 19:20 netcdf-cxx-4.2 
drwxr-xr-x@ 30 markehlen  staff   1020 Aug 21 19:04 openmpi-1.6 
drwxr-xr-x@ 31 markehlen  staff   1054 Aug 21 19:28 repasthpc-1.0.1

And that combination did seem to work for me. I was able to run the samples (after changing some directory permissions) with:

mpirun -np 4 ./zombie_model config.props model.props
mpirun -np 6 ./rumor_model config.props model.props


Notes on building Boost 1.54: doing a full build yielded some failures, with those megabyte-long C++ template error messages. I had to build individual libraries. The build process doesn't seem to honor the prefix and won't install libraries anywhere but a stage directory in the source tree. I had to manually copy files from stage/lib into /user/local/lib and manually copy the boost headers. There is an issue with building mpi, too:

./ --prefix=/usr/local/ --with-libraries=mpi --show-libraries

sudo ./b2

only works properly if I first put a user-config.jam file in my home directory containing "using mpi ;" Then I have to manually copy the boost mpi library.

Notes on bilding netcdf-cxx4-4.2: I had to use sudo make and sudo make install since it seems to write build products into /usr/local/ even before doing make install (!)


Nicholas Robison said...

Very nice, I remember trying to get openmpi to work on some linux VMs a couple of years ago, a HUGE pain. Any reason you didn't use homebrew? It seems to have the correct versions of hdf5, netcdf, openmpi and such.

Paul Potts said...

Nicholas, I usually like to build things from source when I can. If I had known it was going to be that difficult I certainly would have used homebrew. I'm not really familiar with it though.