Last active
August 29, 2015 14:06
-
-
Save memmett/d00df480fb9034f0a2d2 to your computer and use it in GitHub Desktop.
PyBoxLib and BoxClaw on OSX 10.8.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Anaconda with GCC 4.9 | |
===================== | |
On a fresh OSX 10.8.5 MacBook Pro: | |
- Install homebrew | |
- Install gcc | |
brew install gcc | |
- Install anaconda | |
- Install mpi4py | |
conda install mpi4py | |
# for some reason the 'mpi*' commands are broken at this stage, so as a hack: | |
sudo mkdir /opt | |
sudo ln -s /Users/mwemmett/anaconda /opt/anaconda1anaconda2anaconda3 | |
- Tell OpenMPI to use GCC 4.9.1 | |
export OMPI_MPICC=gcc-4.9 | |
export OMPI_MPICXX=g++-4.9 | |
- Verify compilers (these should all give GCC 4.9.1) | |
mpicc --version | |
mpic++ --version | |
- Install PyBoxLib | |
cd BoxLib/Src/Python | |
export MPIHOME=$HOME/anaconda | |
python setup.py build | |
python setup.py install --user | |
- Get clawpack | |
git clone git://github.com/clawpack/clawpack.git | |
cd clawpack | |
python setup.py git-dev | |
pip install -e . | |
- Get the BoxClaw PR | |
cd pyclaw | |
git remote add memmett git@github.com:memmett/pyclaw.git | |
git fetch memmett | |
git checkout -t memmett/boxlib | |
- Enable BoxClaw in clawpack | |
cd clawpack/clawpack | |
ln -s ../pyclaw/src/boxclaw/ boxclaw | |
- Try it out! | |
export DYLD_LIBRARY_PATH=$HOME/anaconda/lib | |
cd clawpack/pyclaw/examples/acoustics_1d_homogeneous | |
python acoustics_1d.py use_boxlib=True | |
Sick hacks: | |
----------- | |
- For some reason 'python-config --libs' didn't include a '-L' flag, so I had to add one like this: | |
-L$(shell python-config --prefix)/lib | |
I think this is a shortcoming of Anaconda. The system python-config does the right thing (--ldflags). | |
- Related to the above, I had to export DYLD_LIBRARY_PATH or I would get an error about threads. | |
I believe this is related to the following: on my system the default python is 2.7.5 | |
(and libpython2.7 presumably matches this), while the anaconda python is 2.7.8. We link | |
PyBoxLib against the 2.7.8 version of libpython2.7, but if we don't set the DYLD path we | |
get the 2.7.5 version of libpython2.7. | |
System Python with GCC 4.9 | |
========================== | |
I'll try again without using Anaconda. Note that this is using the system Python which is 2.7.5. | |
- Install GCC 4.9 from homebrew | |
- Install pip | |
sudo easy_install pip | |
- Upgrade numpy and matplotlib: | |
pip install --upgrade numpy | |
pip install --upgrade matplotlib | |
- Install MPICH | |
cd mpich2-1.5 | |
env CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=$HOME/opt --enable-shared --enable-fast=all,-O3 | |
- Set path for mpich | |
export PATH=$PATH:$HOME/opt/bin | |
- Build PyBoxLib | |
cd BoxLib/Src/Python | |
python setup.py build | |
python setup.py install --user | |
- Install clawpack | |
cd clawpack | |
python setup.py install --user | |
cd ~/Library/Python/2.7/lib/python/site-packages/clawpack | |
ln -s /Users/mwemmett/projects/clawpack/pyclaw/src/boxclaw | |
- Try an example (it works!) | |
System Python with LLVM | |
======================= | |
Let's try one more time with the system Python and system gcc and g++ (which are actually clang in disguise). | |
- Install mpich | |
cd mpich2-1.5 | |
./configure --prefix=$HOME/opt-clang --enable-shared --enable-fast=all,-O3 --disable-libxml2 | |
make install | |
- Set path for mpich | |
export PATH=$PATH:$HOME/opt-clang/bin | |
which mpicc # this should show the mpicc in opt-clang | |
- Compile PyBoxLib | |
- Build PyBoxLib | |
cd BoxLib/Src/Python | |
python setup.py build | |
python setup.py install --user | |
ls -l ~/Library/Python/2.7/lib/python/site-packages/boxlib # this should show our new boxlib install | |
- Try an example again (it works!) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment