Install and use MPICH in standalone Ubuntu

Source: Internet
Author: User
Tags ssh server
Step 1 install the SSH server and client in Ubuntu to open the new version. Type openssh in all and select openssh-client and openssh-server to mark the application installation, you can also directly run $ sudoapt-getinstallopenssh-clientopenssh-server to install MPICH in step 2, enter mpi in all, and select mpi-bin, mpi-doc, libmp ich1.0-d.

Step 1 install the SSH server and client in Ubuntu
Open the new version, type openssh in all, select openssh-client and openssh-server to mark the application installation, or directly execute
$ Sudo apt-get install openssh-client openssh-server

Step 2 install MPICH
Open the new version, type mpi in all, and select mpi-bin, mpi-doc, libmp ich1.0-dev to install the application.
$ Sudo apt-get install mpi-bin mpi-doc libmp ich1.0-dev

Step 3 test installation
$ Touch hello. c
Enter the following content to hello. c
1 # include
2 # include
3 int main (int argc, char * argv [])
4 {
5 int npes, myrank;
6 MPI_Init (& argc, & argv );
7 MPI_Comm_size (MPI_COMM_WORLD, & npes );
8 MPI_Comm_rank (MPI_COMM_WORLD, & myrank );
9 printf ("From process % d out of % d, Hello World! \ N ", myrank, npes );
10 MPI_Finalize ();
11}
$ Mpicc-o hello. c
$ Mpirun-np 2 hello # It should output two Hello messages. You may need to enter the password in the middle. If you do not want to enter the password, see step 4.

Step 4: cancel the SSH Password
$ Ssh-keygen-t dsa # enter the password in the middle and press enter to generate the file ~ /. Ssh/id_dsa.pub
$ Cat id_dsa.pub> authorized_keys
$ Mpirun-np 2 hello # there should be no password input prompt

Related Article

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.