2012-04-03 26 views
0

我正在集羣中工作,每個節點有16個處理器。我的Open MPI版本是 1.5.3。我寫了下面簡單的代碼在FORTRAN:mpirun與兩個節點不工作

program MAIN 
    implicit none 
    include 'mpif.h' 
    integer status(MPI_STATUS_SIZE) 
    integer ierr,my_rank,size 


    integer irep, nrep, iex 
    character*1 task 


    !Initialize MPI 
    call mpi_init(ierr) 
    call mpi_comm_rank(MPI_COMM_WORLD,my_rank,ierr) 
    call mpi_comm_size(MPI_COMM_WORLD,size,ierr) 


    do iex=1,2 

    if(my_rank.eq.0) then 
     !Task for the master 
     nrep = size 

     do irep=1,nrep-1 
      task='q' 
      print *, 'master',iex,task 
      call mpi_send(task,1,MPI_BYTE,irep,irep+1, 
&      MPI_COMM_WORLD,ierr) 
     enddo 


    else 
     !Here are the tasks for the slaves 


     !Receive the task sent by the master node 
     call mpi_recv(task,1,MPI_BYTE,0,my_rank+1, 
&     MPI_COMM_WORLD,status,ierr) 


     print *, 'slaves', my_rank,task 


    endif 

    enddo 


    call mpi_finalize(ierr) 

    end 

然後我編譯代碼:

/usr/lib64/openmpi/bin/mpif77 -o test2 test2.f 

/usr/lib64/openmpi/bin/mpirun -np 32 -hostfile nodefile test2 

我nodefile運行它看起來是這樣的:

node1 
node1 
... 
node2 
node2 
... 

with node1 an d節點2每個重複16次。

我可以成功編譯。當我運行它爲-np 16(所以只有一個節點)它運行 罰款:每個奴隸完成其任務,我得到終端提示。但是當我嘗試-np 32,並非所有的奴隸完成 他們的工作,只有他們16。

其實有32個節點的程序不會給我提示 提示,所以我認爲程序堆疊在某個地方,正在等待 某些任務被執行。

我想收到您的任何評論,據我在這個 瑣碎的問題花了一些時間。

謝謝。

+0

試試這個node0:16 node1:16 – peaceman 2012-04-03 17:00:24

回答

0

我不確定你的節點文件是否正確。我期望看到這樣的行:

node1 slots=16 

OpenMPI是相當有據可查的,你有檢查出他們的FAQ?

+0

其實我試過幾種方法來設置節點,包括-host node1,node2。我試過你說的話,行爲完全一樣,我沒有得到迴應。 – armando 2012-04-03 15:08:43

0

您是否試過mpiexec而不是mpirun?