Browsing the archives for the how-to tag.


MPI on xCode

Geeky Stuff

I am currently working on a small MPI project, and I had one hell of a time getting MPI up and running, specifically the MPICC (compiler) to work in xCode.

So here it is if you were wondering how to get it to work:

Put the following into a file called MPICC.pbcompspec

/**
Xcode Compiler Specification for MPICC
*/
{   Type = Compiler;
Identifier = com.apple.compilers.mpicc;
BasedOn = com.apple.compilers.gcc.4_2;
Name = “MPICC”;
Version = “Default”;
Description = “MPI GNU C/C++ Compiler 4.0″;
ExecPath = “/usr/bin/mpicc”;      // This gets converted to the g++ variant automatically
PrecompStyle = pch;
}

Note: ExecPath should be set to your mpicc path, find this by typing which mpicc in terminal. BasedOn should be set to whatever the system GCC is (4.2 for snow leopard).

Save this file to the following directory: /Developer/Library/Xcode/Specifications/, if the directory does not exist, create it, restart xCode.

Finally in your project, open the build targets and select the one you want to build with MPICC, get info on it, and add a custom rule for c source, MPICC should be in the list somewhere, if it is not then you messed up somewhere above.

Setting a custom C xCode target rule

Setting a custom C xCode target rule

The file: mpicc.pbcompspec

Sources:

http://lists.apple.com/archives/xcode-users/2008/Apr/msg00104.html

http://www.open-mpi.org/community/lists/devel/2007/02/1313.php

2 Comments