Wiki source code of Open MPI install on Mac OS X

Last modified by Xwiki VePa on 2024/02/07 07:37

Show last authors
1 {{tip}}
2 If have not already installed the GNU compilers, check out the [[HOWTO for installing the GNU compilers on Mac OS X>>doc:GNU compiler install on Mac OS X]].
3 {{/tip}}
4
5 {{section}}
6 {{column width="50%"}}
7 {{panel borderStyle="solid" title="Table of Contents"}}
8 {{toc/}}
9 {{/panel}}
10 {{/column}}
11
12 {{column}}
13 {{panel borderStyle="solid" title="Purpose"}}
14 {{excerpt atlassian-macro-output-type="BLOCK"}}
15 (((
16 //This HOWTO will guide you through the installation of //**Open MPI**// on Mac OS X.//
17 )))
18 {{/excerpt}}
19 {{/panel}}
20 {{/column}}
21 {{/section}}
22
23 ===== Background =====
24
25 ----
26
27 (((
28 [[Message Passing Interface>>url:http://en.wikipedia.org/wiki/Message_Passing_Interface||rel="nofollow" shape="rect"]] (MPI) is an application interface that allows processes to communicate by sending and receiving messages. In essence, it facilitates communication when multiple computers/processors/cores are performing distributed calculations. For people familiar with computer clusters, MPI is the interface that helps the compute nodes talk to each other in parallel computations. I won't provide detailed information about MPI and programming practices for using MPI here, but rather the purpose of this page is to help you install one of the freely available MPI implementations (**[[Open MPI>>url:http://www.open-mpi.org/||rel="nofollow" shape="rect"]]**) on a computer running Mac OS X.
29 )))
30
31 (((
32 Why might you consider installing **Open MPI**? First, many programs that were designed to run distributed across several computers using MPI can now be run on a multi-core modern desktop computer. To me, this is the biggest motivation, since I can test software more easily on my desktop (or laptop) machine than on a cluster. Second, multi-core computers are the future. Almost any machine purchased in the last year or two has multiple processor cores. Why not put them to use?
33 )))
34
35 ===== Requirements =====
36
37 ----
38
39 To install **Open MPI** as described in this HOWTO, you'll need the following:
40
41 * A Mac running Mac OS 10.6 (Snow Leopard), 10.7 (Lion), 10.8 (Mountain Lion) or 10.9 (Mavericks)
42 * Internet access
43 * Fortran and or C/C++ compilers (If you don't have compliers installed, check out the [[HOWTO on installing the GNU compilers>>doc:HUGG.Helsinki University Geodynamics Group (HUGG) wiki.Tutorials and HOWTOs.GNU compiler install on Mac OS X.WebHome]])
44
45 ===== Instructions =====
46
47 ----
48
49 The installation of **Open MPI** on Mac is surprisingly easy.
50
51 1. Download source code from [[http:~~/~~/www.open-mpi.org/software/>>url:http://www.open-mpi.org/software/||rel="nofollow" shape="rect"]]. At the time of posting the current stable release of **Open MPI** is [[version 1.6.5>>url:http://www.open-mpi.org/software/ompi/v1.6/downloads/openmpi-1.6.5.tar.gz||shape="rect"]].
52 1. (((
53 Copy the archive file to a temporary location to compile it. Open **Terminal.app** and change directories to the new location of the **Open MPI** archive. If you downloaded the source code as a {{code language="none"}}.tar.gz{{/code}} file, you can untar/zip it by typing
54
55 {{code}}
56 tar zxvf openmpi-1.6.5.tar.gz
57 {{/code}}
58
59 (% style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;" %)which will create a directory called {{code language="none"}}openmpi-1.6.5/{{/code}}. Change directories into the new directory.
60 )))
61 1. (((
62 You can now run the configuration script. As mentioned above, if you don't have any compilers installed, you should check out the [[HOWTO on installing the GNU compilers>>doc:HUGG.Helsinki University Geodynamics Group (HUGG) wiki.Tutorials and HOWTOs.GNU compiler install on Mac OS X.WebHome]] before proceeding. If you only have one set of compilers installed, you can run the configuration script by typing
63
64 {{code}}
65 ./configure --prefix=/usr/local
66 {{/code}}
67
68 (% style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;" %)If you would like to install **Open MPI** someplace other than {{code language="none"}}/usr/local{{/code}}, you can change the installation directory listed after the {{code language="none"}}prefix{{/code}} flag.
69
70 1.
71
72 If you have multiple compilers installed, you can specify which compilers you would like to use as follows
73
74 {{code}}
75 ./configure CC=icc CXX=icpc F77=ifort FC=ifort --prefix=/usr/local
76 {{/code}}
77
78 (% style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;" %)where you specify the C ({{code language="none"}}CC{{/code}}), C++ ({{code language="none"}}CXX{{/code}}), Fortran 77 ({{code language="none"}}F77{{/code}}) and Fortran 90 and later ({{code language="none"}}FC{{/code}}) compilers with the listed variables.
79 )))
80 1. (((
81 Assuming the configuration script runs without issue, you can compile the code by typing
82
83 {{code}}
84 make all
85 {{/code}}
86
87 (% style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;" %)which will compile the **Open MPI** libraries/binaries and configure the wrappers for using the specified compilers. This should take a bit...
88 )))
89 1. (((
90 Again, assuming the code compiles without issue, you can install **Open MPI** by typing
91
92 {{code}}
93 sudo make install
94 {{/code}}
95
96 (% style="background-color: transparent; font-size: 10pt; line-height: 13pt; color: rgb(255, 0, 0)" %)**Beware that using {{code language="none"}}sudo{{/code}} can do major damage to your computer if you aren't careful**(% style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;" %). You can now feel free to delete the temporary **Open MPI** build directory (e.g., {{code language="none"}}openmpi-1.6.5/{{/code}}) since the code has been installed. If you think you might want to rebuild with different compilers or change the configuration, you may want to keep this directory around.
97 )))
98
99 So now you should have a functional installation of **Open MPI** on your Mac. You should be able to compile code that uses MPI by using the **Open MPI** compiler wrappers ({{code language="none"}}mpicc{{/code}}, {{code language="none"}}mpicxx{{/code}}, {{code language="none"}}mpif77{{/code}}, {{code language="none"}}mpif90{{/code}}) and run MPI-enabled programs with {{code language="none"}}mpiexec{{/code}}. If you try to use the new **Open MPI** executables and they are not found, it may be that {{code language="none"}}/usr/local/bin{{/code}} (or wherever you specified with the {{code language="none"}}--prefix{{/code}} flag in the configure stage) is not in your {{code language="none"}}$PATH{{/code}} environment variable. You can confirm this by typing
100
101 {{code}}
102 echo $PATH
103 {{/code}}
104
105 (% style="background-color: transparent;font-size: 10.0pt;line-height: 13.0pt;" %)if you do not see {{code language="none"}}/usr/local/bin{{/code}} listed between the colons, you will need to add it. I describe how to do this at the end of the [[ HOWTO on installing the GNU compilers>>doc:HUGG.Helsinki University Geodynamics Group (HUGG) wiki.Tutorials and HOWTOs.GNU compiler install on Mac OS X.WebHome]].
106
107 ===== Tips & Warnings =====
108
109 ----
110
111 * (((
112 For assistance on linking to **Open MPI** or running MPI-enabled software, check out the [[Open MPI documentation >>url:http://www.open-mpi.org/doc/||rel="nofollow" shape="rect"]].
113 )))
114
115 Related
116
117 ----
118
119 * [[HOWTO on installing the GNU compilers>>doc:HUGG.Helsinki University Geodynamics Group (HUGG) wiki.Tutorials and HOWTOs.GNU compiler install on Mac OS X.WebHome]]