OS X trick: replace library references in object files

Use otool -L to figure out what libraries are linked, then install_name_tool -change old new to modify them.

Mar 16, 2008

replacelibrary (/ostricks)
2008-03-16, 12:23 [edit]

OS X tricks: using MPI on a single Tiger Mac with mpich and mpi4py

→ Make sure passwordless ssh access is enabled: start "Remote Login" under System Preferences/Sharing, then generate a public/private dsa key pair.

ssh-keygen -t dsa
[tap enter three times]
cp $HOME/.ssh/id_dsa $HOME/.ssh/authorized_keys2

→ Then try ssh localhost, which should go through without a password.

→ Install MPICH1.

curl http://www-unix.mcs.anl.gov/mpi/mpich1/downloads/mpich.tar.gz \
    > mpich.tar.gz
tar zxf mpich.tar.gz
cd mpich-1.2.7p1
./configure --with-device=ch_p4 -rsh=ssh --prefix=$HOME
make install
cd ..

→ Make sure $HOME/bin is in your PATH.

→ Install mpi4py.

curl http://pypi.python.org/packages/source/m/mpi4py/mpi4py-0.5.0.tar.gz  \
    > mpi4py.tar.gz
tar zxf mpi4py.tar.gz
cd mpi4py-0.5.0
python setup.py install --prefix=$HOME
ln -s /Library/Frameworks/Python.framework .
[this seems to be needed on Tiger with Python 2.5]
python setup.py build_exe
cp build/exe.macosx-10.3-fat-2.5/mpi4py $HOME/bin/.
cd ..

$HOME/bin/mpi4py is now a parallelized Python interpreter that needs to be used with mpirun instead of python.

→ Now we're all set; as a test, we can run mpi4py-0.5.0/tests/helloworld.py. Because of mpich1's peculiarities, mpirun needs to be given the explicit location of mpi4py.

mpirun -np 4 $HOME/bin/mpi4py helloworld.py

→ Alas, this fails, because mpirun does not pass the correct environment (including PYTHONPATH to the slaves. One possibility is to hardwire the PYTHONPATH in the python script, adding something like this at the top:

import sys, os
sys.path.append(os.environ['HOME'] + '/lib/python2.5/site-packages')

Mar 04, 2008

mpich (/ostricks)
2008-03-04, 13:39 [edit]

OS X Trick: Converting GIF to JPEG from the command line

Use something like

sips -s format jpeg -s formatOptions high --out file.jpg file.gif

God knows what else sips is capable of… Certainly cropping, which I currently do with ImageMagick.

Jan 09, 2006

sipsconvert (/ostricks)
2006-01-09, 16:25 [edit]

  Login:   Password:   [rss] [cc] [w3] [css]

© M. Vallisneri 2012 — last modified on 2010/01/29

Tantum in modicis, quantum in maximis