From: Randy Crawford <rlc@ncsa.uiuc.edu>
Newsgroups: comp.parallel
Subject: Re: Origin2000 Shared Memory
Date: 9 May 1999 04:47:58 GMT
Organization: University of Illinois at Urbana-Champaign
Approved: bigrigg@cs.cmu.edu
Message-Id: <7h341u$j44$1@goldenapple.srv.cs.cmu.edu>
Originator: bigrigg@ux6.sp.cs.cmu.edu
Xref: ukc comp.parallel:15574


John Roberts wrote:
> When I run a parallel shared memory (as opposed to MPI) program on an
> Origin 2000 how do I specify and determine how many processors I'm
> using?
> What is the difference between each of the following? They all seem to
> work to some degree.
> setenv NUM_THREADS $(THREADS)
> setenv OMP_NUM_THREADS $(THREADS)
> setenv MPC_NUM_THREADS $(THREADS)

NUM_THREADS

  Not a standard Irix environment variable.  Often used by pthread
  programmers.  However, Irix tools do not recognize this variable.

OMP_NUM_THREADS

  Used by OpenMP binaries only (C or Fortran).

MPC_NUM_THREADS

  Should be MPC_SET_NUMTHREADS.  Used by the Irix MP multithreading
  library, for Power C/Fortran and their shared-memory parallel 
  directives (like $do_across).

> If I run 8 threads, what's to say that all 8 threads aren't time
> sharing on the same CPU? 

In POSIX threads, the means to control this is pthread_setconcurrency().

In MP and OpenMP threads, use dplace to allocate your threads via
various strategies.  

However, in most cases, I think you'll find that your processes spread 
out pretty well without additional twiddling.

> If I get 8 CPU's do I have exclusive access
> to them, or can other threads time-share with mine? 

They will timeshare, unless your machine is running a batch scheduler
that dedicates the machine or the partition of the machine in which 
your program is running all by itself.

There may be other solutions.  Look into how batch schedulers do this,
(NQE, PBS, LSF, etc).

> Can my threads be
> migrated to other processors? How do I know when this happens?

Yes, unless you use runon(1) or dplace(1) to lock each process to a CPU.
You'll know with MP or OpenMP because top(1) reports the CPU ID as well.
(The "State" field reports the process's status/CPU#.)

-- 
Randy Crawford
rlc@ncsa.uiuc.edu
rlc@sgi.com

    Joyce Kilmer was thinking about central Illinois.

--
Articles to bigrigg+parallel@cs.cmu.edu (Admin: bigrigg@cs.cmu.edu)
Archive: http://www.hensa.ac.uk/parallel/internet/usenet/comp.parallel

