Using OpenMP on the Mac

  • Download gcc4.4 with support for the intel mac with leopard here

  • If you need it for a different type of Mac, see this page

  • If you want, you probably can replace whatever compiler your system already has with this compiler. If you’d like to keep your current compiler, and just use gcc4.4 for openmp, you probably want to build a script to setup your environment before using gcc4.4. The script I’m using is like this:
    • export DYLD_LIBRARY_PATH=/Users/lionetti/Desktop/gcc43/local/lib:$DYLD_LIBRARY_PATH
      export PATH=/Users/lionetti/Desktop/gcc43/local/bin:$PATH

  • Make sure to pass -fopenmp to the compiler
  • To use with python, you’ll need to link to the python libraries like this:
    • -L/Users/lionetti/cont_dev/pcty/MglToolsLib/lib/python2.5/config   -lpython2.5 -undefined dynamic_lookup -L/Users/lionetti/cont_dev/pcty/MglToolsLib/lib/python2.5/config -lpython2.5

  • At the moment, the only other special thing I’m doing is placing this line before a for loop that I’d like to run in parallel:
    •  #pragma omp parallel for