Newsgroups: comp.parallel
From: Ian_Boston <ieb@ecs.soton.ac.uk>
Subject: Re: How to solve this simple problem in F90, HPF, PVM, or MPI?  (Summary of Responses to "Is SP2 the best supercomputer?")
Organization: Electronics and Computer Science, University of Southampton
Date: Wed, 28 Jun 1995 16:21:35 GMT
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Message-ID: <3srvif$c95@bright.ecs.soton.ac.uk>

Zhiwei Xu <zxu@monalisa.usc.edu> wrote:
>Dear Colleagues,
---snip lots---
>
>4.3	The following loop is a simplified version of a real code fragment.
>	I feel that there is no simple parallel implementation in Fortran 90,
>	HPF, MPI, or PVM, because they lack supports for atomicity and eureka.
>	I would appreciate any suggestions and will summarize the proposed
>	solutions.
>
>----------------------------------------------
>COMPLEX 		A[N][M];	
>Target_Structure	TargetList[10] ;
>
>k=0 ;
>for ( i=0 ; i<N ; i++ )
>	for ( j=0 ; j<M; j++ )
>	{
>		if ( IsTarget(A[i][j]) )
>		{
>			TargetList[k].distance = i ;
>			TargetList[k].direction = j ;
>			k = k++ ;
>			if ( k==10 ) goto finished ;
>		}
>	}
>finished:
>-------------------------------------------------

If you are going to impliment shared memory constructs in a message passing
environment you are going to have to perform message passing and therefore
it is highly likely that performance will suffer. Parallelisation of the 
above example really depends on the profile of the target problem and it 
would be wrong to say that it is not simple in MPI, PVM, F90 or whatever..

If the computational effort is high for 'IsTarget' then communication could
be considered in the inner loop to sycronise the value of 'k'. However I 
suspect that this is not the case. Therefore communication outside the inner
loop would be necessary, sycronising k and making the decision to jump (yuck)
out at the end of each column/row. There would be some loss in efficiency, but
the penalty would be less than in the inner loop.

If you did have semaphores, or other shared memory constructs on the SP2, you
would have the same problems since there would be a message overhead. If you 
had hardware shared memory constructs, then it wouldn't be an SP2 :) it would
be an SGI PC, DEC 8400, MasPar MP2 or something else and might allegidly have
bus conflict problems!

-- 
-----------------------------------------------------------------------------
Dr Ian Boston                                                  _/    _/    _/
Parallel Applications Centre                                 _/_/  _/_/  _/_/ 
2 Venture Road                                               _/_/  _/_/  _/_/
Chilworth                    Phone:  +44 1703 760834         _/_/  _/_/  _/_/  
Southampton                  Fax:    +44 1703 760833         _/_/  _/_/  _/_/  
S016 7NP                     E-Mail: ieb@pac.soton.ac.uk     _/_/  _/_/  _/_/
United Kingdom                                               _/_/  _/_/  _/_/
                                                             _/    _/    _/

