| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# GaudiPython::Parallel Namespace Reference

## Classes
class | Statistics
class | Task
class | WorkManager
class | SshSession
## Functions
def | _prefunction
def | _ppfunction
def | _detect_ncpus
## Variables
list | __all__ = [ 'Task','WorkManager' ]
list | excluded_varnames = ['HOSTNAME', 'SSH_CLIENT', 'SSH_CONNECTION', 'DISPLAY']

## Function Documentation

def GaudiPython::Parallel::_detect_ncpus | ( |  | ) | `[private]`

    Detects the number of effective CPUs in the system

Definition at line 37 of file Parallel.py.

    00037                    :
    00038   """Detects the number of effective CPUs in the system"""
    00039   #for Linux, Unix and MacOS
    00040   if hasattr(os, "sysconf"):
    00041     if os.sysconf_names.has_key("SC_NPROCESSORS_ONLN"):
    00042       #Linux and Unix
    00043       ncpus = os.sysconf("SC_NPROCESSORS_ONLN")
    00044       if isinstance(ncpus, int) and ncpus > 0:
    00045         return ncpus
    00046       else:
    00047         #MacOS X
    00048         return int(os.popen2("sysctl -n hw.ncpu")[1].read())
    00049   #for Windows
    00050   if os.environ.has_key("NUMBER_OF_PROCESSORS"):
    00051     ncpus = int(os.environ["NUMBER_OF_PROCESSORS"]);
    00052     if ncpus > 0:
    00053       return ncpus
    00054   #return the default value
    00055   return 1
    00056
    class Statistics(object):

def GaudiPython::Parallel::_ppfunction | ( |  | args | ) | `[private]`

Definition at line 19 of file Parallel.py.

    00019                         :
    00020   #--- Unpack arguments
    00021   task, item = args
    00022   stat = Statistics()
    00023   #--- Initialize the remote side (at least once)
    00024   if not task.__class__._initializeDone :
    00025     for k,v in task.environ.items() :
    00026       if k not in excluded_varnames : os.environ[k] = v
    00027     task.initializeRemote()
    00028     task.__class__._initializeDone = True
    00029   #--- Reset the task output
    00030   task._resetOutput()
    00031   #--- Call processing
    00032   task.process(item)
    00033   #--- Collect statistics
    00034   stat.stop()
    00035   return (copy.deepcopy(task.output), stat)
    00036
    def _detect_ncpus():

def GaudiPython::Parallel::_prefunction | ( |  | f,
|  |  | task,
|  |  | item |
| ) |  |  | `[private]`

Definition at line 17 of file Parallel.py.

    00017                                  :
    00018   return f((task,item))
    def _ppfunction( args ) :

## Variable Documentation

list GaudiPython::Parallel::__all__ = [ 'Task','WorkManager' ]

Definition at line 12 of file Parallel.py.

list GaudiPython::Parallel::excluded_varnames = ['HOSTNAME', 'SSH_CLIENT', 'SSH_CONNECTION', 'DISPLAY']

Definition at line 13 of file Parallel.py.