2014-12-17 3 views
1

Я пытаюсь создать набор рабочих процессов на нескольких хостах с использованием MPI4py и OpenMPI, но команда spawn, похоже, игнорирует мой файл хоста. Я отправил my full test, но вот основные части:Создание процессов с использованием файла хоста с mpi4py

на основе a forum discussion, мой менеджер скрипт вызывает порождение с опцией hostfile:

mpi_info = MPI.Info.Create() 
mpi_info.Set("hostfile", "worker_hosts") 

comm = MPI.COMM_SELF.Spawn(sys.executable, 
          args=['testworker.py'], 
          maxprocs=args.worker_count, 
          info=mpi_info).Merge() 

В файле worker_hosts я список узлов в моем Scyld Беовульф кластер:

myhead1 slots=2 
mycompute1 slots=2 
mycompute2 slots=2 
mycompute3 slots=2 
mycompute4 slots=3 

менеджера и рабочие все вызовы MPI.Get_processor_name(), но все они сообщают «myhead1». Если я использую один и тот же хост-файл с mpirun он работает:

> mpirun -hostfile worker_hosts -np 3 python -c "from mpi4py import MPI; print MPI.Get_processor_name()" 
myhead1 
myhead1 
mycompute1 

Если изменить имя хоста файла на то, что не существует, как bogus_file, я получаю сообщение об ошибке:

-------------------------------------------------------------------------- 
Open RTE was unable to open the hostfile: 
    bogus_file 
Check to make sure the path and filename are correct. 
-------------------------------------------------------------------------- 
[Bulbasaur:86523] [[3458,0],0] ORTE_ERROR_LOG: Not found in file base/rmaps_base_support_fns.c at line 83 
[Bulbasaur:86523] [[3458,0],0] ORTE_ERROR_LOG: Not found in file rmaps_rr.c at line 82 
[Bulbasaur:86523] [[3458,0],0] ORTE_ERROR_LOG: Not found in file base/rmaps_base_map_job.c at line 88 
[Bulbasaur:86523] [[3458,0],0] ORTE_ERROR_LOG: Not found in file base/plm_base_launch_support.c at line 105 
[Bulbasaur:86523] [[3458,0],0] ORTE_ERROR_LOG: Not found in file plm_rsh_module.c at line 1173 

Таким образом, OpenMPI заметил параметр hostfile, он просто не использует его. Опция hostfile указана в OpenMPI documentation.

Key     Type  Description 
---     ----  ----------- 
host     char * Host on which the process should be spawned. 
           See the orte_host man page for an 
           explanation of how this will be used. 
hostfile    char * Hostfile containing the hosts on which 
           the processes are to be spawned. See 
           the orte_hostfile man page for an 
           explanation of how this will be used. 

Как указать файл хоста для запроса появления?

ответ

1

Я нашел более позднюю версию OpenMPI documentation, который дал мне волшебный вариант:

Key     Type  Description 
---     ----  ----------- 
host     char * Host on which the process should be 
           spawned. See the orte_host man 
           page for an explanation of how this 
           will be used. 
hostfile    char * Hostfile containing the hosts on which 
           the processes are to be spawned. See 
           the orte_hostfile man page for 
           an explanation of how this will be 
           used. 
add-host    char * Add the specified host to the list of 
           hosts known to this job and use it for 
           the associated process. This will be 
           used similarly to the -host option. 
add-hostfile   char * Hostfile containing hosts to be added 
           to the list of hosts known to this job 
           and use it for the associated 
           process. This will be used similarly 
           to the -hostfile option. 

Если я изменяю к использованию add-hostfile, он отлично работает:

mpi_info.Set("add-hostfile", "worker_hosts") 

Если вы застряли используя более старую версию OpenMPI, попробуйте запустить сценарий менеджера с mpirun и тем же файлом хоста. Это также сработало, когда я все еще использовал опцию hostfile.

mpirun -hostfile worker_hosts -np1 python testmanager.py 

 Смежные вопросы

  • Нет связанных вопросов^_^