Package edu.rit.pj

Class PJProperties

java.lang.Object
edu.rit.pj.PJProperties

public class PJProperties extends Object
Class PJProperties provides static methods for reading Java system properties that control the behavior of Parallel Java. The PJ properties are:
  • pj.nn -- The number of backend nodes in a parallel program. (getPjNn())
  • pj.np -- The number of processes in a parallel program; also the size of the world communicator. (getPjNp())
  • pj.nt -- The number of CPUs per process in a parallel program; also the default number of threads in a parallel team. (getPjNt())

    When running a Parallel Java program via the job queue on a cluster parallel computer (see package edu.rit.pj.cluster for further information), the Job Scheduler Daemon uses the nn, np, and nt settings to assign resources to the job.

    If neither nn nor np is specified, the Job Scheduler will run the job with one process on one node.

    If nn or np is specified but not both, the Job Scheduler will run the job on nn (or np) nodes with one process on each node.

    If nn and np are both specified and nn >= np, the Job Scheduler will run the job on np nodes with one process on each node.

    If nn and np are both specified and nn < np, the Job Scheduler will run the job on nn nodes with with more than one process on some or all of the nodes, apportioning the np processes as equally as possible among the nn nodes. Note that in this case, different nodes may be assigned different numbers of processes.

    On each node, the Job Scheduler will assign nt CPUs to each process. If nt is not specified, the default is to use all the CPUs in the node, apportioning the CPUs as equally as possible among the processes on the node. Note that in this case, different processes may be assigned different numbers of CPUs.

  • pj.schedule -- The schedule for a parallel loop in a parallel program. (getPjSchedule())
  • pj.host -- The host name of the Job Scheduler Daemon to use when running a cluster parallel program. (getPjHost())
  • pj.port -- The port number of the Job Scheduler Daemon to use when running a cluster parallel program. (getPjPort())
  • pj.jobtime -- The maximum amount of time (seconds) the job is allowed to run when running a cluster parallel program. (getPjJobTime())
  • pj.jvmflags -- JVM flags to include on the Java command line when running a backend process in a cluster parallel program. (getPjJvmFlags())
  • pj.prng -- The fully-qualified class name of the default pseudorandom number generator (PRNG) class. (getPjPrng())

You can specify a PJ property on the Java command line like this:

    java -Dpj.nt=4 . . .

Version:
21-May-2008
Author:
Alan Kaminsky
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Determine the host name of the Job Scheduler Daemon to use when running a cluster parallel program.
    static int
    Determine the maximum amount of time (seconds) the job is allowed to run when running a cluster parallel program.
    static String
    Determine the JVM flags to include on the Java command line when running a backend process in a cluster parallel program.
    static int
    Determine the number of backend nodes in a parallel program.
    static int
    Determine the number of processes in a parallel program.
    static int
    Determine the number of CPUs per process in a parallel program.
    static int
    Determine the port number of the Job Scheduler Daemon to use when running a cluster parallel program.
    static String
    Determine the fully-qualified class name of the default pseudorandom number generator (PRNG) class.
    static String
    Determine the schedule for a parallel loop in an SMP parallel program.

    Methods inherited from class java.lang.Object

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

    • getPjNn

      public static int getPjNn()
      Determine the number of backend nodes in a parallel program.

      If the "pj.nn" Java system property is specified, it must be an integer greater than or equal to 1.

      Returns:
      Number of backend nodes for a parallel program.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if the "pj.nn" property value is not an integer greater than or equal to 1.
    • getPjNp

      public static int getPjNp()
      Determine the number of processes in a parallel program. This is the number of backend processes set up when the Comm.init() method is executed (see class Comm). This is also the size of the world communicator.

      If the "pj.np" Java system property is specified, it must be an integer greater than or equal to 1.

      Returns:
      Number of processes for a parallel program.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if the "pj.np" property value is not an integer greater than or equal to 1.
    • getPjNt

      public static int getPjNt()
      Determine the number of CPUs per process in a parallel program. This is the number of threads a ParallelTeam will have if the number of threads is not specified as a constructor argument.

      If the "pj.nt" Java system property is specified, it must be an integer greater than or equal to 1.

      If the "pj.nt" Java system property is not specified, this method returns 0 to signify that all available CPUs should be used.

      Returns:
      Number of CPUs per process for a parallel program, or 0 if not specified.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if the "pj.nt" property value is not an integer greater than or equal to 1.
    • getPjSchedule

      public static String getPjSchedule()
      Determine the schedule for a parallel loop in an SMP parallel program. This is the schedule that will be used if the parallel for loop has a runtime schedule. For further information, see class IntegerSchedule and class LongSchedule.

      If the "pj.schedule" Java property is specified, that value gives the type of schedule, which must be one of the following:

      • "fixed" -- Fixed schedule.
      • "dynamic" -- Dynamic schedule with a chunk size of 1.
      • "dynamic(<n>)" -- Dynamic schedule with a chunk size of <n>, an integer >= 1.
      • "guided" -- Self-guided schedule with a minimum chunk size of 1.
      • "guided(<n>)" -- Self-guided schedule with a minimum chunk size of <n>, an integer >= 1.
      • "classname" -- Schedule that is an instance of the given class. classname is the fully-qualified class name of the schedule class. The instance is constructed using the subclass's no-argument constructor.
      • "classname(arg,arg,...)" -- Schedule that is an instance of the given class. classname is the fully-qualified class name of the schedule class. The arguments between the parentheses are split into separate strings separated by commas. There cannot be parentheses or commas within the arguments themselves. The instance is constructed using the subclass's constructor whose argument is an array of Strings, namely the individual arguments between the parentheses.

      If the "pj.schedule" Java property is not specified, the default schedule for a runtime schedule is used. Normally this is a fixed schedule, but a program can specify a different default.

      Returns:
      Schedule for a parallel for loop (one of the above strings), or null if the "pj.schedule" Java property is not specified.
    • getPjHost

      public static String getPjHost()
      Determine the host name of the Job Scheduler Daemon to use when running a cluster parallel program. The program contacts the Job Scheduler Daemon when the Comm.init() method is executed (see class Comm). For further information, see package edu.rit.pj.cluster and class JobScheduler.

      If the "pj.host" Java system property is specified, it gives the Job Scheduler Daemon's host name (or IP address).

      If the "pj.host" Java system property is not specified, a host name of "localhost" is returned.

      Returns:
      Job Scheduler Daemon host name.
    • getPjPort

      public static int getPjPort()
      Determine the port number of the Job Scheduler Daemon to use when running a cluster parallel program. The program contacts the Job Scheduler Daemon when the Comm.init() method is executed (see class Comm). For further information, see package edu.rit.pj.cluster and class JobScheduler.

      If the "pj.port" Java system property is specified, it gives the Job Scheduler Daemon's port number.

      If the "pj.port" Java system property is not specified, the well-known Parallel Java port number (20617) is returned.

      Returns:
      Job Scheduler Daemon port number.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if the "pj.port" property value is not an integer.
    • getPjJobTime

      public static int getPjJobTime()
      Determine the maximum amount of time (seconds) the job is allowed to run when running a cluster parallel program. If a program running in the Parallel Java job queue has not finished in the given amount of time, the job frontend process automatically termintes the job when the given number of seconds have elapsed since the job started executing. If a program is not running in the Parallel Java job queue (if there is no Job Scheduler Daemon present), then the job time setting is ignored and the program will not time out.

      If the "pj.jobtime" Java system property is specified, it must be an integer greater than or equal to 1, and that gives the the maximum job timeout in seconds.

      If the "pj.jobtime" Java system property is not specified, a value of 0 is returned to signify that there is no job timeout.

      Returns:
      Job timeout (seconds), or 0 if no job timeout.
      Throws:
      IllegalArgumentException - (unchecked exception) Thrown if the "pj.jobtime" property value is not an integer greater than or equal to 1.
    • getPjJvmFlags

      public static String getPjJvmFlags()
      Determine the JVM flags to include on the Java command line when running a backend process in a cluster parallel program. When a job backend process is started, the JVM flags are included on the command line immediately after the "java" command. These flags then control the job backend process's JVM. For further information, see package edu.rit.pj.cluster.

      If the "pj.jvmflags" Java system property is specified, it gives the JVM flags exactly as they are to appear on the Java command line. If there are multiple flags separated by whitespace, the "pj.jvmflags" Java system property must be enclosed in quotation marks.

      If the "pj.jvmflags" Java system property is not specified, there are no JVM flags, and an empty string is returned.

      Example. To cause the job backend processes' JVMs to use an initial heap size of 4 MB and a maximum heap size of 128 MB, specify the "pj.jvmflags" property as follows when running the program:     java -Dpj.jvmflags="-Xms4m -Xmx128m" . . .

      Note that quotation marks are needed around the property value because of the embedded whitespace. This property value causes the Job Launcher Daemon to launch each job backend process's JVM with this command:     java -Xms4m -Xmx128m . . .

      which in turn tells each job backend process's JVM to use initial and maximum heap sizes of 4 MB and 128 MB.

      Returns:
      JVM flags.
    • getPjPrng

      public static String getPjPrng()
      Determine the fully-qualified class name of the default pseudorandom number generator (PRNG) class.

      If the "pj.prng" Java system property is specified, it gives the fully-qualified class name of the PRNG class that the static getInstance(long) method in class Random will construct. Specifying the "pj.prng" property will substitute a different PRNG algorithm into a program without needing to recompile. See class Random for further information.

      If the "pj.prng" Java system property is not specified, a PRNG class name of "edu.rit.util.DefaultRandom" is returned. See class DefaultRandom for further information.

      Returns:
      Default PRNG class name.