<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Azar Feyziyev on Medium]]></title>
        <description><![CDATA[Stories by Azar Feyziyev on Medium]]></description>
        <link>https://medium.com/@feyziyev007?source=rss-d18eaa44c1d3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Q6uHShS1LRpHF0WdLVpL0w.jpeg</url>
            <title>Stories by Azar Feyziyev on Medium</title>
            <link>https://medium.com/@feyziyev007?source=rss-d18eaa44c1d3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 09:11:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@feyziyev007/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to install OpenMPI on Ubuntu (18.04) Cluster]]></title>
            <link>https://feyziyev007.medium.com/how-to-install-openmpi-on-ubuntu-18-04-cluster-2fb3f03bdf61?source=rss-d18eaa44c1d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fb3f03bdf61</guid>
            <category><![CDATA[openmpi]]></category>
            <category><![CDATA[ubuntu-18]]></category>
            <category><![CDATA[hpc]]></category>
            <category><![CDATA[nfs-server]]></category>
            <category><![CDATA[cluster]]></category>
            <dc:creator><![CDATA[Azar Feyziyev]]></dc:creator>
            <pubDate>Mon, 16 Aug 2021 12:50:16 GMT</pubDate>
            <atom:updated>2021-08-24T08:48:30.782Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*lkzY0KzcU-ra9bqSHa7Kcw.png" /></figure><p>Step 0: Create user and set ip addr</p><p>Step 1: Install ssh (ssh server and ssh client for all machines)</p><p>Step 2: Install nfs (nfs server on master, nfs client on nodes)</p><p>Step 3: Install OpenMPI in all machines</p><p>Step 4: Test</p><h3><strong>Step 0</strong></h3><p>Create user account for MPI and work on it</p><pre>sudo adduser mpiuser</pre><pre>sudo usermod -aG sudo mpiuser</pre><pre>su mpiuser</pre><p>Add all the hosts to server. Examples:</p><pre>sudo nano /etc/hosts</pre><p>Then add hostnames and ip addresses on <strong>Master machine.</strong></p><p>Master machine is azcos1; others are worker nodes(azcos2, azcos3,azcos4,5,6)</p><pre>127.0.0.1       localhost<br>10.1.20.1       azcos1<br>10.1.20.2       azcos2<br>10.1.20.3       azcos3<br>10.1.20.4       azcos4<br>10.1.20.5       azcos5<br>10.1.20.6       azcos6</pre><p>You should add the master hostname on all nodes.</p><pre>sudo nano /etc/hosts</pre><pre>10.1.20.1       azcos1</pre><h3>Step 1 — Install ssh</h3><ol><li>Run update for all</li></ol><pre>sudo apt-get update<br>sudo apt-get upgrade</pre><p>2. Check ip addr and run</p><pre>sudo apt-get install net-tools</pre><pre>ifconfig</pre><p>3. Install ssh server and client for all machines</p><pre>sudo apt-get install openssh-server openssh-client</pre><p>4. Create directory .ssh for all machines, run</p><pre>mkdir ~/.ssh<br>chmod 700 ~/.ssh</pre><p>5. Generate ssh keys for <strong><em>passwordless</em></strong> ssh ( on <strong>Master<em> </em>machine</strong>)</p><pre>cd ~/.ssh</pre><pre>ssh-keygen -t rsa</pre><pre>cp id_rsa.pub authorized_keys</pre><pre>chmod 600 authorized_keys</pre><pre>ssh-copy-id azcos2 (hostnames of all node machines, azcos3, azcos4, azcos5, azcos6)</pre><p>6. Node machines — do it all nodes</p><pre>cat id_rsa (do it on master machine)</pre><pre>vi id_rsa (paste it here)</pre><pre>chmod 600 id_rsa</pre><pre>vi authorized_keys</pre><pre>chmod 600 authorized_keys</pre><p>7. Edit sshd_config file and restart ssh server</p><pre>sudo nano /etc/ssh/sshd_config</pre><p>Add this two lines.</p><pre>PubkeyAuthentication yes<br>RSAAuthentication yes</pre><p>Then restart ssh server.</p><pre>sudo service ssh restart</pre><p>8. Try to ssh the nodes without password</p><pre>ssh azcos2 (and others)</pre><h3>Step 2 — Install nfs</h3><ol><li>Install NFS server on <strong>master machine</strong></li></ol><pre>sudo apt-get install nfs-kernel-server</pre><p>2. Create a directory and run:</p><pre>sudo apt-get install nfs-kernel-server</pre><pre>sudo chown nobody:nogroup /home/mpiuser/Desktop/sharedfolder</pre><pre>sudo chmod 777 /home/mpiuser/Desktop/sharedfolder</pre><p>3. Export files</p><pre>sudo nano /etc/exports</pre><p>then add these lines, save:</p><pre>/home/mpiuser/Desktop/sharedfolder azcos2(rw,sync,no_subtree_check)<br>/home/mpiuser/Desktop/sharedfolder azcos3(rw,sync,no_subtree_check)<br>/home/mpiuser/Desktop/sharedfolder azcos4(rw,sync,no_subtree_check)<br>/home/mpiuser/Desktop/sharedfolder azcos5(rw,sync,no_subtree_check)<br>/home/mpiuser/Desktop/sharedfolder azcos6(rw,sync,no_subtree_check)</pre><p>then</p><pre>sudo exportfs -a</pre><p>4. Restart NFS server, run</p><pre>sudo systemctl restart nfs-kernel-server</pre><p>5. Check firewall status(inactive), type:</p><pre>sudo ufw status</pre><p>6. We should install <strong>nfs client</strong> to <strong>all the nodes</strong>.</p><pre>sudo apt-get install nfs-common</pre><pre>sudo mkdir -p /home/mpiuser/Desktop/sharedfolder</pre><pre>sudo chown nobody:nogroup /home/mpiuser/Desktop/sharedfolder</pre><pre>sudo chmod 777 /home/mpiuser/Desktop/sharedfolder</pre><pre>sudo mount azcos1:/home/mpiuser/Desktop/sharedfolder /home/mpiuser/Desktop/sharedfolder</pre><p>7. Then test nfs</p><p>You can create a file in /sharedfolder. You can see this file on all machines where /home/mpiuser/Desktop/sharedfolder.</p><h3>Step 3 — Install OpenMPI</h3><p>1. Install gcc for all machines, run:</p><pre>sudo apt-get install gcc</pre><pre>sudo apt-get install openmpi-bin openmpi-common libopenmpi-dev libgtk2.0-dev</pre><p>2. Download and decompress file openmpi for all machines:</p><p>You can download file from official website <a href="https://www.open-mpi.org/">(https://www.open-mpi.org/</a>)</p><pre>sudo wget <a href="https://www.open-mpi.org/software/ompi/v4.1/downloads/openmpi-4.1.1.tar.gz">https://www.open-mpi.org/software/ompi/v4.1/downloads/openmpi-4.1.1.tar.gz</a></pre><pre>sudo tar  -xvzf /home/mpiuser/openmpi-4.1.1.tar.gz</pre><p>3. install OpenMPI for all machines</p><pre>cd /home/mpiuser/Desktop/openmpi-4.1.1</pre><pre>sudo ./configure --prefix=&quot;/home/mpiuser/.openmpi&quot;<br>sudo make<br>sudo make install<br></pre><p>4. Export PATH, run:</p><pre>export PATH=”$PATH:/home/mpiuser/.openmpi/bin”</pre><pre>export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/home/mpiuser/.openmpi/lib”</pre><p>5. Test by running mpirun or mpircc</p><p>If you see the below, it means successfully installed.</p><pre>mpiuser@azcos6:~$ mpirun<br>--------------------------------------------------------------------<br>mpirun could not find anything to do.</pre><pre>It is possible that you forgot to specify how many processes to run<br>via the &quot;-np&quot; argument.<br>--------------------------------------------------------------------</pre><h3>Step 4 — Test</h3><ol><li>Compile mpi program</li></ol><p>Go to the <a href="https://github.com/feyziyev007/openmpi/blob/master/mpi-prime.c"><strong><em>link</em></strong></a> , copy the code and paste it here:</p><pre>vi mpi-prime.c</pre><p>Compile mpi file.</p><pre>mpicc mpi-prime.c -o ./outputfile</pre><p>copy outputfile to the sharedfolder &amp; check the file in the nodes sharedfolder</p><p>2. Run cluster</p><p>Go to shared folder on master machine, run:</p><pre>cd /home/mpiuser/Desktop/sharedfolder</pre><pre>mpirun --hostfile /etc/hosts -np 5 ./outputfile</pre><p>if you see like below, it is ok.</p><pre>mpiuser@azcos1:~/Desktop/sharedfolder$ mpirun --hostfile /etc/hosts -np 5 ./outputfile<br>16 August 2021 04:31:31 PM</pre><pre>PRIME_MPI<br>  C/MPI version</pre><pre>An MPI example program to count the number of primes.<br>  The number of processes is 5</pre><pre>N        Pi          Time</pre><pre>1         0        0.006863<br>         2         1        0.000528<br>         4         2        0.000504<br>         8         4        0.000508<br>        16         6        0.000513<br>        32        11        0.000512<br>        64        18        0.000511<br>       128        31        0.000514<br>       256        54        0.000515<br>       512        97        0.000501<br>      1024       172        0.000741<br>      2048       309        0.001029<br>      4096       564        0.002891<br>      8192      1028        0.005456<br>     16384      1900        0.014796<br>     32768      3512        0.031765<br>     65536      6542        0.115813<br>    131072     12251        0.436057<br>    262144     23000        1.638243<br>    524288     43390        6.200569<br>   1048576     82025       23.463462</pre><pre>PRIME_MPI - Master process:<br>  Normal end of execution.</pre><pre>16 August 2021 04:32:03 PM<br>mpiuser@azcos1:~/Desktop/sharedfolder$</pre><p>Thank you! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fb3f03bdf61" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>