Dr. Stephan Nickell ha scritto:
> Hiho,
>
> a simple C code:
>
>
>>>cat hi.c
>
>
> #include <stdio.h>
> #include "mpi.h"
> int main(int argc, char *argv[])
> {
> char greet[12];
> int i, numprocs, myid;
> MPI_Status status;
> MPI_Init(&argc,&argv);
> MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
> MPI_Comm_rank(MPI_COMM_WORLD,&myid);
> if(myid == 0)
> {
> sprintf(greet,"Hello world");
> }
> printf("%s from processor %d of %d.\n",&greet,myid,numprocs);
> MPI_Finalize();
> }
>
Hi Stephan,
Just a couple of suggestions to be sure it is not a C issue, before passing
the problem to the (64 bit) Gurus:
- The string greet should be initialized to something before printing also on
processes other than 0 otherwise strange things may happen
- It is more correct to printf("%s...\n",greet...); rather than &greet, although
the compiler may forgive this
Maybe testing the return code from the MPI_ calls may give some information!?
Anyway on my 32 bit cluster the program works also "as is".
best regards, Davide
|