I completely neglected to mention that you could also use hwloc (Hardware Locality), a small utility library for learning topology-kinds of things (including if you're bound, where you're bound, etc.). Hwloc is a sub-project of Open MPI:
http://www.open-mpi.org/projects/hwloc/ Open MPI uses hwloc internally, but you could also link your application against hwloc and call its C functions to get information about your process' locality, etc. On Sep 24, 2010, at 8:14 AM, Jeff Squyres wrote: > On the OMPI SVN trunk, we have an "Open MPI extension" call named > OMPI_Affinity_str(). Below is an excerpt from the man page. If this is > desirable, we can probably get it into 1.5.1. > > ----- > > NAME > OMPI_Affinity_str - Obtain prettyprint strings of processor affinity > information for this process > > > SYNTAX > C Syntax > #include <mpi.h> > #include <mpi-ext.h> > > int OMPI_Affinity_str(char ompi_bound[OMPI_AFFINITY_STRING_MAX], > char current_binding[OMPI_AFFINITY_STRING_MAX], > char exists[OMPI_AFFINITY_STRING_MAX]) > > [snip] > OUTPUT PARAMETERS > ompi_bound > A prettyprint string describing what processor(s) Open MPI > bound this process to, or a string indicating that Open MPI > did not bind this process. > > current_binding > A prettyprint string describing what processor(s) this > process is currently bound to, or a string indicating that > the process is bound to all available processors (and is > therefore considered "unbound"). > > exists A prettyprint string describing the available sockets and > cores on this host. > > > > > On Sep 23, 2010, at 11:10 PM, Ralph Castain wrote: > >> You mean via an API of some kind? Not through an MPI call, but you can do it >> (though your code will wind up OMPI-specific). Look at the OMPI source code >> in opal/mca/paffinity/paffinity.h and you'll see the necessary calls as well >> as some macros to help parse the results. >> >> Depending upon what version you are using, there may also be a function in >> opal/mca/paffinity/base/base.h to pretty-print that info for you. I believe >> it may only be in the developer's trunk right now, or it may have made it >> into the 1.5.0 release candidate.... >> >> >> On Thu, Sep 23, 2010 at 11:24 AM, Fernando Saez <saezferna...@gmail.com> >> wrote: >> Hi all, I'm new in the list. I don't know if this post has been treated >> before. >> >> My question is: >> >> Is there a way in the OMPI library to report which process is running >> on which core in a SMP system? I need to know processor affinity for >> optimizations issues. >> >> Regards >> >> Fernando Saez >> >> >> >> _______________________________________________ >> users mailing list >> us...@open-mpi.org >> http://www.open-mpi.org/mailman/listinfo.cgi/users >> >> _______________________________________________ >> users mailing list >> us...@open-mpi.org >> http://www.open-mpi.org/mailman/listinfo.cgi/users > > > -- > Jeff Squyres > jsquy...@cisco.com > For corporate legal information go to: > http://www.cisco.com/web/about/doing_business/legal/cri/ > > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/