Package edu.rit.pj

Class HybridTeam


public class HybridTeam extends WorkerTeam
Class HybridTeam provides a team of threads, distributed across the processes of a cluster parallel program, for executing a WorkerRegion in parallel.

A hybrid team uses a communicator for message passing. The communicator is specified as a constructor argument; if not specified, the world communicator is used. Every process that is part of the communicator must create the hybrid team. In class HybridTeam, there are one or more worker threads per process; typically, the number of threads in each process equals the number of CPUs on the node executing the process. (To get just one worker thread per process, use class WorkerTeam.) Every worker thread in every process has a unique index, going from index 0 for the first thread in the first process to index K−1 for the last thread in the last process, where K is the total number of worker threads in all the processes. In process rank 0, there is an additional master thread.

When a hybrid team is constructed, the processes in the communicator send messages amongst themselves to make every process aware of the number of worker threads in each process. These messages use a tag of Integer.MIN_VALUE. If an I/O error occurs during this message passing, the constructor throws an IOException.

To execute a worker region, create a HybridTeam object; create an instance of a concrete subclass of class WorkerRegion; and pass this instance to the hybrid team's execute() method. For further information, see class WorkerRegion.

Version:
18-Nov-2009
Author:
Alan Kaminsky
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a new hybrid team with the default number of threads per process and using the world communicator for message passing.
    HybridTeam(int K)
    Construct a new hybrid team with the given number of threads per process and using the world communicator for message passing.
    HybridTeam(int K, Comm comm)
    Construct a new hybrid team with the given number of threads per process and using the given communicator for message passing.
    Construct a new hybrid team with the default number of threads per process and using the given communicator for message passing.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Determine the default number of threads per process for a hybrid team.
    int
    workerRank(int w)
    Determine the rank of the process that contains the worker thread with the given index.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HybridTeam

      public HybridTeam() throws IOException
      Construct a new hybrid team with the default number of threads per process and using the world communicator for message passing. If the "pj.nt" Java property is specified, that property gives the default number of threads per process, which must be an integer greater than or equal to 1. If the "pj.nt" Java property is not specified, the default number of threads in each process is the value returned by the Runtime.availableProcessors() method. You can specify the default number of threads per process on the Java command line like this:
           java -Dpj.nt=4 . . .
       
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if the "pj.nt" property value is not an integer greater than or equal to 1.
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
    • HybridTeam

      public HybridTeam(int K) throws IOException
      Construct a new hybrid team with the given number of threads per process and using the world communicator for message passing.
      Parameters:
      K - Number of threads per process.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if K is less than 1.
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
    • HybridTeam

      public HybridTeam(Comm comm) throws IOException
      Construct a new hybrid team with the default number of threads per process and using the given communicator for message passing. If the "pj.nt" Java property is specified, that property gives the default number of threads per process, which must be an integer greater than or equal to 1. If the "pj.nt" Java property is not specified, the default number of threads in each process is the value returned by the Runtime.availableProcessors() method. You can specify the default number of threads per process on the Java command line like this:
           java -Dpj.nt=4 . . .
       
      Parameters:
      comm - Communicator to use for message passing.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if the "pj.nt" property value is not an integer greater than or equal to 1.
      NullPointerException - (unchecked exception) Thrown if comm is null.
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
    • HybridTeam

      public HybridTeam(int K, Comm comm) throws IOException
      Construct a new hybrid team with the given number of threads per process and using the given communicator for message passing.
      Parameters:
      K - Number of threads per process.
      comm - Communicator to use for message passing.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if K is less than 1.
      NullPointerException - (unchecked exception) Thrown if comm is null.
      IOException - Thrown if an I/O error occurred.
      IOException - if any.
  • Method Details

    • getDefaultThreadCount

      public static int getDefaultThreadCount()
      Determine the default number of threads per process for a hybrid team. If the "pj.nt" Java property is specified, that property gives the default number of threads per process, which must be an integer greater than or equal to 1. If the "pj.nt" Java property is not specified, the default number of threads in each process is the value returned by the Runtime.availableProcessors() method. You can specify the default number of threads per process on the Java command line like this:
           java -Dpj.nt=4 . . .
       
      Returns:
      Default number of threads per process for a hybrid team.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if the "pj.nt" property value is not an integer greater than or equal to 1.
    • workerRank

      public int workerRank(int w)
      Determine the rank of the process that contains the worker thread with the given index. Determine the rank of the process that contains the worker thread with the given index.
      Overrides:
      workerRank in class WorkerTeam
      Parameters:
      w - Worker index.
      Returns:
      Worker process rank.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if w is not in the range 0 .. getTotalThreadCount()−1.