Package multi :: Module multi_processor_base :: Class Multi_processor
[hide private]
[frames] | no frames]

Class Multi_processor

source code


The multi-processor base class.

Instance Methods [hide private]
 
__init__(self, processor_size, callback)
Initialise the processor.
source code
 
add_to_queue(self, command, memo=None)
Add a command for remote execution to the queue - an abstract method.
source code
 
chunk_queue(self, queue) source code
 
on_master(self) source code
 
on_slave(self) source code
 
post_run(self)
Method called after the application main loop has finished - designed for overriding.
source code
 
pre_run(self)
Method called before starting the application main loop
source code
 
process_result(self, result) source code
 
return_object(self, result)
Return a result to the master processor from a slave - an abstract method.
source code
 
return_result_command(self, result_object) source code
 
slave_receive_commands(self) source code

Inherited from processor.Processor: abort, assert_on_master, exit, fetch_data, get_intro_string, get_name, get_stdio_pre_strings, get_time_delta, master_queue_command, master_receive_result, processor_size, rank, rank_format_string, rank_format_string_width, run, run_command_globally, run_command_queue, run_queue, send_data_to_slaves, stdio_capture, stdio_restore

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]

Inherited from processor.Processor: NULL_RESULT, callback, data_store, grainyness, threaded_result_processing

Inherited from processor.Processor (private): _processor_size

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, processor_size, callback)
(Constructor)

source code 

Initialise the processor.

Parameters:
  • processor_size - The requested number of __slave__processors, if the number of processors is set by the environment (e.g. in the case of MPI via mpiexec -np <n-processors> on the command line the processor is free free to ignore this value. The default value from the command line is -1, and subclasses on receiving this value either raise and exception or determine the correct number of slaves to create (e.g. on a multi-cored machine using a threaded implementation the correct number of slaves would be equal to the number of cores available).
  • callback - The application callback which allows the host application to start its main loop and handle exceptions from the processor.
Overrides: object.__init__
(inherited documentation)

add_to_queue(self, command, memo=None)

source code 

Add a command for remote execution to the queue - an abstract method.

Parameters:
  • command - A command to execute on a slave processor.
  • memo - A place to place data needed on command completion (e.g. where to save the results) the data stored in the memo is provided to Result_commands generated by the command submitted.
Overrides: processor.Processor.add_to_queue
(inherited documentation)

post_run(self)

source code 

Method called after the application main loop has finished - designed for overriding.

The default implementation outputs the application runtime to STDOUT. All subclasses should call the base method as their last action via super(). Only called on the master on normal exit from the applications run loop.

Overrides: processor.Processor.post_run
(inherited documentation)

pre_run(self)

source code 

Method called before starting the application main loop

Overrides: processor.Processor.pre_run

return_object(self, result)

source code 

Return a result to the master processor from a slave - an abstract method.

Parameters:
  • result - A result to be returned to the master processor.
Overrides: processor.Processor.return_object
(inherited documentation)