Linux installation Mpich

Source: Internet
Author: User

In order to do the lesson set, had to install a Mpich, find a long way. Below is a brief introduction to the installation method

  1. Yum installation, this is a relatively simple way to install
    Note: To configure the Yum network source installation epel-release extension source, I tried the local, seemingly no installation success

    [[email protected] yum.repos.d]# yum -y install mpich-3.2-devel.x86_64 mpich-3.2-devel.x86_64 mpich-3.2-doc.noarch 安装好之后是找不到命令的,需要手动配置环境变量[[email protected] yum.repos.d]# find / -name "mpicc"/usr/lib64/mpich-3.2/bin/mpicc先搜索一下安装路径设置环境变量:在 /etc/profile添加一下内容:PATH=$PATH://usr/lib64/mpich-3.2/bin/刷新一下:source /etc/profile命令就可直接使用了新建一个文件test.c[[email protected] ~]# cat test.c #include <mpi.h>#include <stdio.h>#include <math.h>int main(int argc,char* argv[]){

    int myID, Numprocs;
    int Namelen;
    Char Processor_name[mpi_max_processor_name];

    Mpi_init (&ARGC,&ARGV);/ Initialize parallel environment /
    Mpi_comm_rank (Mpi_comm_world,&myid);/ ID number of the current process /
    Mpi_comm_size (Mpi_comm_world,&numprocs);/ total number of processes /
    Mpi_get_processor_name (Processor_name,&namelen);/ name of the current processor /

    fprintf (stderr, "Hello world! Process%d of%d on%s\n ",
    myID, Numprocs, processor_name);

    Mpi_finalize ();/ End parallel Environment /
    return 0;
    }

    [[email protected] ~]# mpicc -o hello test.c [[email protected] ~]# mpirun -np 4 ./hello Fatal error in MPI_Init: Other MPI error, error stack:MPIR_Init_thread(474)..............: MPID_Init(190).....................: channel initialization failedMPIDI_CH3_Init(89).................: MPID_nem_init(320).................: MPID_nem_tcp_init(173).............: MPID_nem_tcp_get_business_card(420): MPID_nem_tcp_init(379).............: gethostbyname failed, c1 (errno 1)但是这里运行还是会报错,原因在于,没有配置好域名解析:需要配置域名解析在/etsc/hosts中与/etc/hostname中的名字需要一致,贴出我的配置[[email protected] ~]# cat /etc/hosts127.0.0.1   host::1         localhost [[email protected] ~]# cat /etc/hostnamehost可以通过ssh 连接host   如果连接成功说明配置成功接下来就可运行了[[email protected] ~]# mpirun -np 4 ./hello Hello World! Process 0 of 4 on hostHello World! Process 2 of 4 on hostHello World! Process 1 of 4 on hostHello World! Process 3 of 4 on host
  2. Source Installation Mpich

[Email protected] ~]# wget http://www.mpich.org/static/downloads/3.2/mpich-3.2.tar.gz
--2018-05-28 18:06:45--http://www.mpich.org/static/downloads/3.2/mpich-3.2.tar.gz
Parsing host www.mpich.org (www.mpich.org) ... 140.221.6.71
Connecting www.mpich.org (www.mpich.org) |140.221.6.71|:80 ... is connected.
An HTTP request has been made and is waiting for a response ... OK
Length: 11862150 (11M) [Application/x-gzip]
Saving to: "Mpich-3.2.tar.gz"

100%[=====================================================>] 11,862,150 213kb/s spents 54s

2018-05-28 18:07:40 (215 kb/s)-Saved "mpich-3.2.tar.gz" [11862150/11862150])

[[Email protected] ~]# tar zxf mpich-3.2.tar.gz
[[email protected] ~]# ls
Anaconda-ks.cfg initial-setup-ks.cfg mpich-3.2 mpich-3.2.tar.gz
[Email protected] ~]# CD MPICH-3.2/

[[email protected] mpich-3.2]# ls
ACLOCAL.M4 Configure Doc makefile.in mpi.def src
autogen.sh configure.ac examples man README subsys_include.m4
Changes contrib maint mpich.def Readme.envvar test
Confdb COPYRIGHT makefile.am mpich-doxygen.in release_notes www

Compile
[Email protected] mpich-3.2]#/configure--prefix=/usr/local/mpich
....................
config.status:executing default-4 Commands
Configuration completed. The middle of a big string, see this will succeed

Installation:
Note: If the error in the middle, may be missing gcc, build-essential dependency, yum directly installed on the line
[[email protected] mpich-3.2]# make && make install

The command cannot be found after the installation is successful, or the environment variable needs to be configured
[[email protected] mpich-3.2]# ls/usr/local/mpich/bin/*//This is the installation directory specified previously
/usr/local/mpich/bin/hydra_nameserver/usr/local/mpich/bin/mpiexec.hydra
/usr/local/mpich/bin/hydra_persist/usr/local/mpich/bin/mpif77
/usr/local/mpich/bin/hydra_pmi_proxy/usr/local/mpich/bin/mpif90
/usr/local/mpich/bin/mpic++/usr/local/mpich/bin/mpifort
/usr/local/mpich/bin/mpicc/usr/local/mpich/bin/mpirun
/usr/local/mpich/bin/mpichversion/usr/local/mpich/bin/mpivars
/usr/local/mpich/bin/mpicxx/usr/local/mpich/bin/parkill
/usr/local/mpich/bin/mpiexec

Add the same environment as before
[Email protected] mpich-3.2]# tail-1/etc/profile
Path= $PATH:/usr/local/mpich/bin/
[Email protected] mpich-3.2]# Source/etc/profile

Now you can see MPICC's orders ... It worked

Under test: (or use the example above)
[Email protected] ~]# mpicc-o test test.c
[Email protected] ~]# MPIRUN-NP 4./test
Fatal Error in Mpi_init:other MPI error, Error stack:
Mpir_init_thread (474) ........:
Mpid_init (...): Channel initialization failed, ....., .......
Mpidi_ch3_init (89) ..........:
Mpid_nem_init (320) ..........:
Mpid_nem_tcp_init (173) .......:
Mpid_nem_tcp_get_business_card (420):
Mpid_nem_tcp_init (379) .....: GetHostByName failed, C1 (errno 1)

Same error ....
But the solution is exactly the same as the one above, which is caused by the host name setting.

Linux installation Mpich

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.