Проблемы с запуском mpi с машинным файлом Ubuntu 18.04 - PullRequest
1 голос
/ 08 марта 2019

следуя этим рекомендациям MpichClusterUbuntu , я пытаюсь выполнить свою самую первую программу mpi с ПК с Ubuntu 18.04.01 Server Edition и ноутбуком с Ubuntu 18.04.02 Desktop. До шага 11 данного руководства все прошло нормально, без проблем.

Я установил машинный файл с именем hosts с этими двумя строками:

192.168.1.7 # first 'master' node: the PC
192.168.1.5 # second node: the laptop

После компиляции очень простого примера файла, содержащегося в руководстве без:

#include <stdio.h>
#include <mpi.h>

int main(int argc, char** argv) {
    int myrank, nprocs;

    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
    MPI_Comm_rank(MPI_COMM_WORLD, &myrank);

    printf("Hello from processor %d of %d\n", myrank, nprocs);
    MPI_Finalize();
    return 0;
}

mpiu@pc01:~$ mpicc mpi_hello.c -o mpi_hello

Выполнение без учета машинного файла 'hosts', это вывод:

mpiu@pc01:~$ mpiexec -n 8 ./mpi_hello
------------------------------------------------------------------
[[27419,1],0]: A high-performance Open MPI point-to-point messaging 
module was unable to find any relevant network interfaces:

Module: OpenFabrics (openib)
  Host: pc01

Another transport will be used instead, although this may result in
lower performance.

NOTE: You can disable this warning by setting the MCA parameter
btl_base_warn_component_unused to 0.
----------------------------------------------------------------
Hello from processor 1 of 8
Hello from processor 2 of 8
Hello from processor 5 of 8
Hello from processor 6 of 8
Hello from processor 0 of 8
Hello from processor 3 of 8
Hello from processor 7 of 8
Hello from processor 4 of 8
[pc01:25010] 7 more processes have sent help message help-mpi-btl-
base.txt / btl:no-nics
[pc01:25010] Set MCA parameter "orte_base_help_aggregate" to 0 to see all
help / error messages

И при выполнении вызова машинного файла 'hosts' выполнение остается бездействующим без вывода какого-либо вывода:

mpiu@pc01:~$ mpiexec -n 8 -machinefile hosts ./mpi_hello

PS: это содержимое /etc/netplan/50-cloud-init.yaml в «главном» узле (ПК):

network:
    ethernets:
        enp3s0:
            #addresses: []
            #dhcp4: true
            addresses: [192.168.1.7/24]
            gateway4: 192.168.1.1
            nameservers:
                addresses: [8.8.8.8,8.8.4.4]
            dhcp4: no
    version: 2

Обновление: после правильного комментария Жиля я удалил openmpi, который, как мне кажется, был установлен ранее.

Теперь выполняем шаг 11 руководства MpichClusterUbuntu18.04 : А) без вызова машинного файла:

marco@pc01:/mirror$ mpiexec -n 8 ./mpi_hello
Hello from processor 0 of 8
Hello from processor 1 of 8
Hello from processor 3 of 8
Hello from processor 5 of 8
Hello from processor 6 of 8
Hello from processor 7 of 8
Hello from processor 2 of 8
Hello from processor 4 of 8

B) Но называя машинный файл "hosts":

marco@pc01:/mirror$ mpiexec -n 8 -machinefile /home/mpiu/hosts    
./mpi_hello
ssh: Could not resolve hostname pc0: Temporary failure in name resolution
ssh: Could not resolve hostname riccarcohp: Temporary failure in name 
resolution
^C[mpiexec@pc01] Sending Ctrl-C to processes as requested
[mpiexec@pc01] Press Ctrl-C again to force abort
[mpiexec@pc01] HYDU_sock_write (utils/sock/sock.c:286): write error (Bad 
file descriptor)
[mpiexec@pc01] HYD_pmcd_pmiserv_send_signal (pm/pmiserv
/pmiserv_cb.c:177): unable to write data to proxy
[mpiexec@pc01] ui_cmd_cb (pm/pmiserv/pmiserv_pmci.c:79): unable to send    
signal downstream
[mpiexec@pc01] HYDT_dmxu_poll_wait_for_event (tools/demux
/demux_poll.c:77): callback returned error status
[mpiexec@pc01] HYD_pmci_wait_for_completion (pm/pmiserv
/pmiserv_pmci.c:198): error waiting for event
[mpiexec@pc01] main (ui/mpich/mpiexec.c:340): process manager error 
waiting for completion

После помещения в машинный файл 'hosts' только IP-адреса:

mpiu@pc01:/mirror$ mpiexec -n 8 -machinefile /home/mpiu/hosts ./mpi_hello
Permission denied, please try again.
Permission denied, please try again.
mpiu@192.168.1.5: Permission denied (publickey,password).

Но я могу ssh без проблем с ПК на ноутбук:

mpiu@pc01:/mirror$ ssh 192.168.1.5
mpiu@192.168.1.5's password:
mpiu@riccardo-HP-Laptop-15-da0xxx:~$

Теперь кажется, что РЕШЕНО, даже если я повторил в третий раз, верно ту же процедуру:

Вот шаги, которые я выполнил для настройки SSH без пароля между pc01 (и riccardohp (ноутбук):

marco@pc01:/$ su - mpiu
Password:
mpiu@pc01:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mpiu/.ssh/id_rsa):
Created directory '/home/mpiu/.ssh'.

Чтобы упростить его, я пропустил парольную фразу:

Your identification has been saved in /home/mpiu/.ssh/id_rsa.
Your public key has been saved in /home/mpiu/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:..... mpiu@pc01
The key's randomart image is:
+---[RSA 2048]----+
...................
...................
+----[SHA256]-----+

Я скопировал открытый ключ с pc01 на ноутбук:

mpiu@pc01:~$ ssh-copy-id 192.168.1.5
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home
/mpiu/.ssh/id_rsa.pub"
The authenticity of host '192.168.1.5 (192.168.1.5)' can't be 
established.
ECDSA key fingerprint is SHA256:.......................
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to 
filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are
prompted now it is to install the new keys

mpiu@192.168.1.5's password:
Number of key(s) added: 1
Now try logging into the machine, with:   "ssh '192.168.1.5'"
and check to make sure that only the key(s) you wanted were added.

mpiu@pc01:~$ ssh '192.168.1.5'
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.18.0-16-generic x86_64)
mpiu@riccardo-HP-Laptop-15-da0xxx:~$

Так что, по-видимому, похоже, что соединение ssh между pc01 и ноутбуком работает нормально ...

mpiu@riccardo-HP-Laptop-15-da0xxx:~$ ^C
mpiu@riccardo-HP-Laptop-15-da0xxx:~$ logout
Connection to 192.168.1.5 closed.
mpiu@pc01:~$ cd /
mpiu@pc01:/$ cd mirror
mpiu@pc01:/mirror$ mpicc mpi_hello.c -o mpi_hello
gcc: error: mpi_hello.c: No such file or directory
mpiu@pc01:/mirror$ nano mpi_hello.c
mpiu@pc01:/mirror$ mpicc mpi_hello.c -o mpi_hello
mpiu@pc01:/mirror$ mpiexec -n 8 ./mpi_hello
Hello from processor 0 of 8
Hello from processor 1 of 8
Hello from processor 2 of 8
Hello from processor 3 of 8
Hello from processor 4 of 8
Hello from processor 5 of 8
Hello from processor 6 of 8
Hello from processor 7 of 8

Я положил в файл hosts в / mirror:

192.168.1.7
192.168.1.5

mpiu@pc01:/mirror$ mpiexec -n 8 -machinefile hosts ./mpi_hello
Hello from processor 2 of 8
Hello from processor 4 of 8
Hello from processor 6 of 8
Hello from processor 0 of 8
Hello from processor 1 of 8
Hello from processor 3 of 8
Hello from processor 5 of 8
Hello from processor 7 of 8

Marco

...