On Tue, 28 Jun 2005, Davide Cesari wrote:
> 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
>
Hello,
I found the program also works "as is" on an Opteron cluster running FC 2
with LAM 7.1.1. Maybe you aren't using gcc as the C compiler? Why are
the higher rank processes failing, segfault?
------------------------------------------------------------
Anthony Ciani (aciani1_at_[hidden])
Computational Condensed Matter Physics
Department of Physics, University of Illinois, Chicago
http://ciani.phy.uic.edu/~tony
------------------------------------------------------------
|