Ubuntu+open mpi+ssh Small cluster simple configuration __parallel

Source: Internet
Author: User
Tags free ssh

In order to complete the course assignments, the author is committed to find the most simple configuration methods. The goal is to connect three nodes to run a simple MPI program.

Reference: https://www.open-mpi.org, https://blog.csdn.net/kongxx/article/details/52227572 each node initialization

To facilitate subsequent SSH connections, set all nodes to have the same username (because SSH IP is equivalent to SSH $USER @ip). Please refer to https://blog.csdn.net/silent56_th/article/details/80033636 for the section on creating a new user.

An optional operation to facilitate subsequent input is to map a name to the IP address of the other node by modifying/etc/hosts in each node for reference. password-free SSH connection between nodes

Detailed reference: https://blog.csdn.net/kongxx/article/details/47046817

In a nutshell, Node A uses an algorithm such as RSA to generate a public key for identity authentication, and Node B authorizes node A by recording the public key of Node A. After authorization is complete, node A can access Node B without a password.

Theoretically only need other nodes to authorize the main node, the author in order to prevent bugs, all of the nodes are authorized. Introduction and compilation of Open MPI

For a brief introduction to MPI and open MPI, see: Https://www.open-mpi.org/video/?category=general

Simply to say that MPI is the protocol, Open MPI is a concrete implementation.

About the compilation of open MPI: Https://www.open-mpi.org/faq/?category=building#easy-build

Easy steps: Download decompression –>configure (--prefix for specified installation location) –> sudo make all install

The author directly installs the open MPI to the system, so the--prefix=/user/local, and the subsequent need to set the path and other system parameters, or the appropriate location of the bin and Lib path into the $PATH and $LD _library_path (you can . BASHRC settings) compiling and running code

The MPICC command is similar to the GCC/CC usage, and the simple operation is MPICC <c_filename>-o <excutable_filename>

Single node execution: MPIRUN-NP <processor_num> <filename>, where-NP specifies the number of processors, and the first unexplained string (<filename>) is considered an executable file name.

Small cluster implementation: MPIRUN-NP <processor_num>--hostfile

localhost   slots=2
slave1  slots=2
slave2  slots=2

Where localhost is the local node, SLAVE1/2 is the IP address of the other two nodes in the primary node (set in/etc/hosts)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.