单机Ubuntu下MPICH的安装与使用

第一步 Ubuntu下安装SSH服务器和客户端打开新立得,,在全部里键入openssh,选择openssh-client和openssh-server标记安装应用,或者直接执行$ sudo apt-get install openssh-client openssh-server

第二步 安装MPICH打开新立得,在全部里键入mpi,选择mpi-bin、mpi-doc、libmpich1.0-dev标记安装应用$ sudo apt-get install mpi-bin mpi-doc libmpich1.0-dev

第三步 测试安装$ touch hello.c键入以下内容到hello.c1 #include <mpi.h> 2 #include <stdio.h>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 hello.c$ mpirun -np 2 hello #应该会输出两次Hello,中间可能要求输入密码,如不想输入密码,看第四步

第四步 取消SSH的密码步骤$ ssh-keygen -t dsa #中间提示输入密码,直接回车,会在生成文件~/.ssh/id_dsa.pub$ cat id_dsa.pub >> authorized_keys$ mpirun -np 2 hello #应该没有密码输入提示了

发光并非太阳的专利,你也可以发光

单机Ubuntu下MPICH的安装与使用

相关文章:

你感兴趣的文章:

标签云: