LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2005-11-05 15:02:54


The function MPI_Comm_rank is probably the function you are looking for
to report the value of myid. For example:

     int myid;
     MPI_Comm_rank(comm, &rank);

You should probably take an MPI tutorial to get familiar with the basic
functions (such as MPI_Comm_rank). An excellent one can be found here:

     http://webct.ncsa.uiuc.edu:8900/public/MPI/

On Nov 5, 2005, at 11:30 AM, Subir Singh Lamba wrote:

> Hi all,
>
> I need help to accomplish a task regarding useage of MPI with C.
> I need you help in MPI implementation. I have developed a sequential
> code
> (some 10,000 lines) in C and now I have to parallelize it. The code
> consists of a main program and different functions which perform
> various
> tasks in conjunction with the main program. My problem is to
> parallelize
> at the level of function for e.g within a function I want to use as
>
>                                                                        
>         
> if (myid == 0)
> {
> (somejob)
> }
> if (myid = 1)
> {
> (some job)
> }
>
>                                                                        
>         
> Now the problem which I am encountering is I do not want to use the
> argument of the function to send the process rank ( here it is myid)
> to
> the function and still do the parallelization at the level of the
> function. I have tried many ways one of them being using myid as an
> extern
> variable but have been unsuccessful uptil now.
>
>                                                                        
>         
>   So I need find some way so as to make the function recognize the
> process
> rank and perform the required job.
>
>                                                                        
>         
>   Any help from you will be greatly appreciated.
>
>                                                                        
>         
> With regards,
>
>                                                                        
>         
> Subir
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/

-- 
{+} Jeff Squyres
{+} The Open MPI Project
{+} http://www.open-mpi.org/