PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

Setting Processor Affinity

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
khea_actua1



Joined: 06 Nov 2008
Posts: 42
Location: Carleton University

PostPosted: Wed Mar 21, 2012 3:36 pm    Post subject: Setting Processor Affinity Reply with quote

Hi,

I was wondering if there was an easy way to set processor affinity when using PGI (or rather, if the PGI tools have their own way to set it) with MPI (mpich)

Or should I just use sched_setaffinity() tools (or taskset tools from the shell)?

Thanks.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6660
Location: The Portland Group Inc.

PostPosted: Thu Mar 22, 2012 11:23 am    Post subject: Reply with quote

You can use taskset, numctl, or the PGI environment variables "MP_BIND" and "MP_BLIST". However, in all cases to use these with MPI you need to set them individually per process. Typically this is done by writing a wrapper shell script which sets the appropriate environment or utility options and then launches the program. For example, here's a C shell script for use with MPICH2 and two processes.

Code:
$ cat run.csh
#!/bin/csh

setenv MP_BIND YES

if ($PMI_RANK == 0) then
  setenv MP_BLIST 0
  /bin/time $1
else
  setenv MP_BLIST 1
  /bin/time $1
endif 
$ mpiexec -np 2 run.csh a.out


"PMI_RANK" is set by the MPICH2 driver. Note that not every MPI implementation will have it's own environment variable to define the rank. Please consult the documentation of your MPI implementation for details.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group