Building an MPI program with Managed Build

Topics include:

Creating an MPI Project

  1. To create a new MPI project in C using the managed build facility, Select File -> New -> Project ... The New Project dialog opens.
  2. Select C -> Managed Make C Project.

  1. Click Next.
  2. Type the name of your project, e.g. MyCProject

  1. Click Finish.

  1. Now create a source file. Click File -> New -> Source File.
  2. Type a name for the source file, e.g. "test.c"

  1. Click Finish.

  1. Since this is a managed build project, Eclipse creates a makefile and tries to build with the new file.

  1. Enter a program in the editor. (If you have the PTP MPI Tools installed, a sample program is available in the PTP MPI tools help, available as: testMPI.c
  2. Save your program. The program will be compiled automatically by the managed build system.

Include Paths

  1. In order to locate needed include files, bring up the Project Properties on this C/C++ project.
  2. To bring up the Project Properties dialog, activate the context menu on the Project, and select "Properties."

  1. The project properties window is displayed for this C project.
  2. Select "C/C++ Build" on the left, and under "Configuration settings" on the "Tool Settings" tab, select "Directories" under "GCC Compiler."

  1. To add an include path, click the add button for Include Paths.

  1. Then enter or browse to find the location of the MPI includes, and select "OK."

  1. Now you also need to add the path to the library: Under GCC Linker, Libraries, select the add button for "Libraries (-l)"

  1. For the library value, enter 'mpi' and select 'OK'

  1. Then select the add button for "Library Search Path (-L)" and enter the path to the lib directory. Select 'OK'

  1. Now select "OK" in the project properties dialog to close this dialog. Now your project should rebuild without errors relating to finding the include files.

Specifying the mpicc toolchain

  1. Now specify the build/link command.
  2. Again in Project properties, C/C++ build page, Tool Settings tab, click on "GCC C compiler" and change the default "gcc" value to "mpicc" (or whatever the build command is for your MPI environment).

  1. Then do the same for the "GCC C Linker."

  1. Now proceed to launch the parallel program.

Back to Top | Back to Table of Contents