2010-10-02 77 views
0

我有最簡單的代碼的 「Hello world」意外返回消息: 「鬧鐘」

#include <stdio.h> /* printf and BUFSIZ defined there */ 
#include <stdlib.h> /* exit defined there */ 
#include <mpi.h> /* all MPI-2 functions defined there */ 

int main(argc, argv) 
int argc; 
char *argv[]; 
{ 
    int rank, size, length; 
    char name[BUFSIZ]; 

    MPI_Init(&argc, &argv); 
    MPI_Comm_rank(MPI_COMM_WORLD, &rank); 
    MPI_Comm_size(MPI_COMM_WORLD, &size); 
    MPI_Get_processor_name(name, &length); 

    printf("%s: hello world from process %d of %d\n", name, rank, size); 

    MPI_Finalize(); 

    exit(0); 
} 

我編這

mpicc -o hello hello.c 

,並試圖用4個進程

運行
mpirun -np 4 hello 

它返回;

[email protected]:~/MpiProgrammes$ mpicc -o hello Hello.c 
[email protected]:~/MpiProgrammes$ mpirun -np 4 hello 
Alarm clock 
[email protected]:~/MpiProgrammes$ 

它可能是什麼?

+0

哪個平臺和MPI實現您使用,包括版本? – msw 2010-10-02 16:01:24

+0

在mpirun-ing之前你有lamboo(啓動lam mpi守護進程)嗎?例如lamboot; mpirun -np 4 hello; lamhalt? – 2010-10-02 16:24:56

回答

0

嘗試使用命令 「MPD &」

0
[email protected]:~/MpiProgrammes$ laminfo 
      LAM/MPI: 7.1.2 
       Prefix: /usr/lib/lam 
     Architecture: i486-pc-linux-gnu 
     Configured by: buildd 
     Configured on: Wed Nov 5 07:09:57 UTC 2008 
     Configure host: rothera 
     Memory manager: ptmalloc2 
      C bindings: yes 
     C++ bindings: yes 
    Fortran bindings: yes 
      C compiler: gcc 
     C++ compiler: g++ 
    Fortran compiler: gfortran 
    Fortran symbols: underscore 
     C profiling: yes 
     C++ profiling: yes 
    Fortran profiling: yes 
     C++ exceptions: no 
     Thread support: yes 
     ROMIO support: yes 
     IMPI support: no 
     Debug support: no 
     Purify clean: no 
      SSI boot: globus (API v1.1, Module v0.6) 
      SSI boot: rsh (API v1.1, Module v1.1) 
      SSI boot: slurm (API v1.1, Module v1.0) 
      SSI coll: lam_basic (API v1.1, Module v7.1) 
      SSI coll: shmem (API v1.1, Module v1.0) 
      SSI coll: smp (API v1.1, Module v1.2) 
      SSI rpi: crtcp (API v1.1, Module v1.1) 
      SSI rpi: lamd (API v1.0, Module v7.1) 
      SSI rpi: sysv (API v1.0, Module v7.1) 
      SSI rpi: tcp (API v1.0, Module v7.1) 
      SSI rpi: usysv (API v1.0, Module v7.1) 
       SSI cr: self (API v1.0, Module v1.0)