PakProject.com
A Free Source of Learning
You are here: Home > How To's > Parallel Programing >
 
  How to configure Open MPI on Linux Ubuntu and windows ?

 

Configuring Open MPI in Ubuntu

1. Download OpenMPI (openmpi-1.7.3.tar.gz) from http://www.open-mpi.org/software/ompi/v1.7/

2. After unzipping, open new terminal, and navigate to the directory of extracted Open MPI

3. On shell, write the following command:
............................................
shell$ sudo su
............................................
and then enter your system password. By doing this, you will get the administrator privileges, and will not get permission denied messages.

4. Give the below commands to install Open MPI after reading the following note:

Note:
a). "ompi" in the below command is the folder name where Open MPI will be installed. This folder will be created at the location /usr/local.

b). If an error occurs during configuration step, such as, "xxxx failed the sanity check, etc," then this means that the package xxxx is not installed in the system, so use commands, such as "sudo apt-get update", and then "sudo apt-get install xxxx" to install the package xxxx, and run configuration again.

COMMANDS TO INSTALL Open MPI
............................................
shell$ ./configure --prefix=/usr/local/ompi
<...lots of output...>
shell$ make
shell$ make install
............................................

5. After Open MPI is installed, we need to set the environment variables. Open a new terminal, and give command:
............................................
gksudo nautilus
............................................
this will give us gui based file system access with administrator privileges.

Open file "bash.bashrc" located in folder "/etc" and add the following two lines at the end of this file:

............................................
export PATH=/usr/local/ompi/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/ompi/lib
............................................

6. Restart system after adding the above two lines

7. Open new terminal. Write command "mpicc" or "mpic++" or "mpirun". If these commands demand file as input than Open MPI has been installed successfully. We can also use command: "ompi_info" that will give us details of installed Open MPI framework.

8. Install java runtime. For that purpose, we use command: "sudo apt-get install default-jre". If this command does not work, search some other command to install java runtime environment. To test whether or not java is installed, use this command in terminal: "java". If there is no message like "No such command found" this means, java is also installed. (We need java to run eclipse that is developed in java)

9. Download "Eclipse IDE for C/C++ Developers" from the website: "http://www.eclipse.org/downloads/". Make sure, you are downloading eclipse kepler.

10. Install "Eclipse Parallel Tools Platform (PTP)". Go to Help -> Install New Software. In "Open with" text box, put address: "http://download.eclipse.org/releases/kepler" and press Enter. A list of options will appear with check box. Click on check box for option "Parallel
Tools Platform" and finish its installation. Exit eclipse and reload.

11. Create a MPI program and test:

Go to File -> New -> C Project -> MPI Hello World C Project. On right side under: "ToolChains", select "Linux GCC", Click next -> next:

Un-check "Use default information" and write these:
............................................
Include path: usr/local/ompi/include (click on browse to double check whether or not mpi.h is present at this path)
Library name: mpi
Library search path: usr/local/ompi/lib (click on browse to double check libmpi... are there)
............................................

Press finish to create the project.

12. Select newly created folder of project, right click, and click on properties.
Expand "C/C++ Build", and under tab "Tool settings -> GCC C Compiler". Click on folder "Includes" and see whether the path is there or not. If not, then put the "include" folder path (user/local/ompi/include)

Under GCC C Linker, click on folder "Libraries". In the upper box, library name must be set as "mpi" and in the lower box, the library search path must be set as "usr/local/ompi/lib" (if these items are not already there, set them). Click ok to close the window

13. Press Ctrl+b to build the application. If no error shows up, then every thing is fine so far.

14. Select project folder, right click, click on "Run as" and click on "Run configurations".

15. On left pan, double click on "Parallel Application", and perform these settings:

Under "Resources" tab, select "Target System Configuration" as "Open MPI-Generic-Interactive"
Select "Connection Type" as "Local"
Select Number of processes as 2

Under "Application" tab, under "Application program: " give path to the project exe file that was created when we built the project in step 13. Click on browse, the exe file will be in "debug" folder of project most probably.

Under "Environment" tab, click "Select" and select "PATH" environment variable.

Apply all these changes, and click on "Run".

If the output shows up, then you have run your parallel application successfully.

16. In order to debug your application, follow the step 6.2 provided on open mpi website: http://www.open-mpi.org/faq/?category=debugging#serial-debuggers

In eclipse there is also an option to do parallel debugging but that as a first step requires the building of "sdm" exe file, which is downloadable from eclipse PTP website. I did all those steps but parallel debugging failed in my case in eclipse, so I used the effective method provided by the Open MPI website above.

Configure Open MPI on Windows XP

1. Install Cygwin for windows with “OPEN MPI” and “make” packages.
2. Set “Path” environment variable of windows with “Cygwin”, “Cygwin/bin”, “Cygwin/lib”.
3. Download eclipse kepler.
4. Install PTP package in eclipse by “Help -> install new software” and giving path of “http://download.eclipse.org/tools/ptp/updates/kepler” and pressing enter.
5. File -> New -> MPI C Project
6. Set “include” path as “/usr/include” and “lib” path as “/lib” and mpi library name as “mpi”

 

Leave Your Comments  
  COMMENTS
 
 
  

For any suggestions, feedback, complaints and advertisement contact us at info @ pakproject . com -- Copyrights © pakproject.com Disclaimer