A followup as requested by Sarath.
> I always find that after giving mpirun, the printf
> statement never appears on the screen, the cursor
> waits and once I enter a number, it goes on with the
> execution. Ironically at the end of the WHOLE thing, a
> small "Enter the number of terms" message appears...IS
> this non-interactiveness preventible...Sorry if the
> question appears too trivial...Coming to the main
> issue
This is a i/o buffering issue. Try putting 'fflush(stdout)" before the scanf.
This might not work - but someone might be able to enlighten us with the
appropriate ROM-IO function that should be called (or flag that can be set).
> 2) Can I pass data from proc 0 like this
>
> " for(k=0;k<9;k++)
>
> MPI_Send(&array[k][0][0],10,MPI_FLOAT,1,11,MPI_COMM_WORLD)"
>
> And the corresponding array being accepted in
> processor 1 in a similar loop???
You could - though I think you need two loops - because the next dimension of
array needs to be scanned thorugh (unless you only want to sent [k][0][0..9]
rather than [k][0..9][0..9]. An alternative is to send the whole array at
once - if you declare array as :
float array[1000];
Then you only need to pass one message at the beginning, and the
pointer-mathematics involved in [k][j][i] is about the same as
array[k*100+j*10+i] (but you write it explicitly instead).
Does this answer your question ?
--
_______________________________________________________________________
Dr JB Procter:Biomolecular Modelling at ZBH - Center for Bioinformatics
Hamburg http://www.zbh.uni-hamburg.de/mitarbeiter/procter
|