Package multi :: Module uni_processor :: Class Uni_processor
[hide private]
[frames] | no frames]

Class Uni_processor

source code


The uni-processor class.

Instance Methods [hide private]
 
__init__(self, processor_size, callback)
Initialise the class.
source code
 
add_to_queue(self, command, memo=None)
Add a command for remote execution to the queue - an abstract method.
source code
 
assert_on_master(self)
Make sure that this is the master processor and not a slave.
source code
str
get_intro_string(self)
Return the string to append to the end of the relax introduction string.
source code
str
get_name(self)
Get the name of the current processor - an abstract method.
source code
bool
on_master(self)
For the uni-processor fabric, we are always on the master.
source code
 
master_queue_command(self, command, dest)
Slave to master processor data transfer - send the result command from the slave.
source code
Result_command instance
master_receive_result(self)
Slave to master processor data transfer - receive the result command from the slave.
source code
 
post_run(self)
Dummy function for preventing the printing of the run time.
source code
int
processor_size(self)
Return 1 as this is the uni-processor.
source code
int
rank(self)
The uni-processor is always of rank 0.
source code
 
return_object(self, result)
Return a result to the master processor from a slave - an abstract method.
source code
 
run_queue(self)
Run the processor queue - an abstract method.
source code

Inherited from processor.Processor: abort, exit, fetch_data, get_stdio_pre_strings, get_time_delta, pre_run, rank_format_string, rank_format_string_width, run, run_command_globally, run_command_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 class.

Parameters:
  • processor_size (int) - The number of processors.
  • callback (?) - The callback object.
Overrides: object.__init__

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)

assert_on_master(self)

source code 

Make sure that this is the master processor and not a slave.

As this is the Uni-processor, the processor is always the master. Hence this method does nothing.

Raises:
  • Exception - If not on the master processor.
Overrides: processor.Processor.assert_on_master

get_intro_string(self)

source code 

Return the string to append to the end of the relax introduction string.

Returns: str
The string describing this Processor fabric.
Overrides: processor.Processor.get_intro_string

get_name(self)

source code 

Get the name of the current processor - an abstract method.

The string should identify the current master or slave processor uniquely but is purely for information and debugging. For example the mpi implementation uses the string <host-name>-<process-id> whereas the thread implementation uses the id of the current thread as provided by python.

Returns: str
The processor identifier.
Overrides: processor.Processor.get_name
(inherited documentation)

on_master(self)

source code 

For the uni-processor fabric, we are always on the master.

Returns: bool
The flag specifying if we are on the master or slave processors.

master_queue_command(self, command, dest)

source code 

Slave to master processor data transfer - send the result command from the slave.

This mimics a slave to master data transfer initiated by a slave by holding the result command so that the matching self.master_receive_result(), which is called by the master processor, can return it. As the master and slave processors are one and the same, the command is just held as a private class variable.

Parameters:
  • command (Results_command instance) - The results command to send to the master.
  • dest (int) - The destination processor's rank.
Overrides: processor.Processor.master_queue_command

master_receive_result(self)

source code 

Slave to master processor data transfer - receive the result command from the slave.

This mimics a slave to master data transfer initiated by a slave by holding the result command so that the matching self.master_receive_result(), which is called by the master processor, can return it. As the master and slave processors are one and the same, the command is just held as a private class variable.

Returns: Result_command instance
The result command sent by the slave.
Overrides: processor.Processor.master_receive_result

post_run(self)

source code 

Dummy function for preventing the printing of the run time.

Overrides: processor.Processor.post_run

processor_size(self)

source code 

Return 1 as this is the uni-processor.

Returns: int
The number of processors.
Overrides: processor.Processor.processor_size

rank(self)

source code 

The uni-processor is always of rank 0.

Returns: int
The processor rank.
Overrides: processor.Processor.rank

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)

run_queue(self)

source code 

Run the processor queue - an abstract method.

All commands queued with add_to_queue will be executed, this function causes the current thread to block until the command has completed.

Overrides: processor.Processor.run_queue
(inherited documentation)