Re: MPI with Xcode
Re: MPI with Xcode
- Subject: Re: MPI with Xcode
- From: email@hidden
- Date: Tue, 01 Nov 2016 12:40:18 -0400
> On Nov 1, 2016, at 9:02 AM, Bernard Bernu <email@hidden> wrote:
>
> Hi every body,
>
> I have a multi-thread code working well on various Mac I have and SGI computer working with shared memory.
>
> I need now to switch to MPI in order to run on massively parallel computers.
>
> I succeed to install MPI (openmpi-1.6.5), so I can run simple test code from Terminal.
>
> I need help for installing this compiler on Xcod.
> I found nothing I can use on my platform (Mac 10.12, Xcode 8.0).
>
> Thanks,
>
> Bernard
You can compile from within Xcode using the mpic++ compiler.
I downloaded openmpi-2.0.0 and installed it using:
./configure --prefix=/usr/local/openmpi
make
sudo make install
Next add a new file named mpi (Xcode will add the extension .xcconfig) to your project and choose "Configuration Settings File".
I put the following in that file:
CC = /usr/local/openmpi/bin/mpic++
In Xcode, select the project icon in the left sidebar, choose Info and then under Configurations specify your mpi.xcconfig file so it will use that compiler.
You'll also want to go the Build Settings, find "Header Search Paths" and add /usr/local/openmpi/include
so that when you #include <mpi.h> it can find the header file.
That will let you compile within Xcode.
If you also want to run it from within Xcode, you need to edit the Scheme, select Run from the list on the left, choose Other and then navigate to where you installed OpenMPI (/usr/local/openmpi/bin). This is a bit tricky as it won't easily let you do this. An easy workaround is to use the bash Terminal and do "cd /usr/local/openmpi" followed by "open ." which opens a Finder window and then drag the bin directory to the sidebar so you can access the directory within the open panel. Do this first and then after choosing other, select the orterun option as the executable (which is a symlink to mpirun).
Then in the Arguments tab add something like the following to "Arguments Passed On Launch"
-np 4
$(BUILT_PRODUCTS_DIR)/targetName
where targetName is the name of the executable for your project.
The only problem I've had with this setup is I can get the mpi executable to read input from within Xcode so either set it up to read the input from a file or you can do the final step of running it from the Terminal instead of trying to run it within Xcode.
If you're not familiar with Xcode some of these steps may be a little tricky to follow. If you want to re-install openmpi with:
./configure --prefix=/usr/local/openmpi
make
sudo make install
I can send you (off list) a zip file with an Xcode project set up to work when OpenMPI is installed in that directory.
HTH,
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden