我有最简单的代码“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
它返回;
chasan@ubuntu:~/MpiProgrammes$ mpicc -o hello Hello.c
chasan@ubuntu:~/MpiProgrammes$ mpirun -np 4 hello
Alarm clock
chasan@ubuntu:~/MpiProgrammes$
它可能是什么?
答案 0 :(得分:0)
chasan@ubuntu:~/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)
答案 1 :(得分:0)
尝试使用命令“mpd&amp;”