Programmer Guide/Shell Items/SPU: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 17: Line 17:
The inputs are assigned during SPU creation and cannot be changed later! If the command is successful, the new SPU item is initialized and put into '''stop mode'''. The option /Nothread means that rather than creating an SPU-thread, the SPU runs in the shell's thread (this means the macro processing is blocked while the SPU is running).  
The inputs are assigned during SPU creation and cannot be changed later! If the command is successful, the new SPU item is initialized and put into '''stop mode'''. The option /Nothread means that rather than creating an SPU-thread, the SPU runs in the shell's thread (this means the macro processing is blocked while the SPU is running).  


==SPU Item Commands==


An SPU without its own thread (created with '''/Nothread''')does not send messages and cannot be used in a multi-SPU circuit (i.e. cannot be connected to other SPU's). This type of SPU should only be used for short computations (e.g. initialize graph scales, compute parameter statistics) because the macro command processing is suspended while the SPU is running.
;<code>SET <var>spuname</var> RUN [<var>cycles</var>]</code>:Start evaluation. If <var>cycles</var> is a number greater than zero, it specifies the number of evaluation cycles to be performed before the SPU stops automatically. Otherwise the SPU evaluation runs until the user issues a <code>STOP</code> command, the evaluation is finished (all data processed) or an error occurs.
 
;<code>SET <var>spuname</var> STOP</code>:Stop evaluation. The evaluation of the SPU is stopped immediately (after finishing the current cycle). The SPU then generates a <code>[[Programmer Guide/Shell Items/IP/IP|STOP]]</code> message
 
;<code>SET <var>spuname</var> EXIT</code>:Terminate the SPU process and prepare item for deletion. This function must be executed before an SPU item can be deleted. It terminates the thread running the SPU code and performs all necessary cleanup actions. The SPU sends the <code>EXIT</code> message when finished.
 
Notes:
*If SPU items are connected in order to build a complex parallel-processed circuit, the first SPU in the chain is called the master SPU. All commands from the shell should be sent to the master SPU (which controls all other SPU items in the chain) and all messages (except <code>EXIT</code>) are sent back by the master SPU. Only the <code>EXIT</code> message is sent by each SPU to be sure that the SPU item can be deleted.
*An SPU without its own thread (created with '''/Nothread''') does not send messages and cannot be used in a multi-SPU circuit (i.e. cannot be connected to other SPU's). This type of SPU should only be used for short computations (e.g. initialize graph scales, compute parameter statistics) because the macro command processing is suspended while the SPU is running.





Revision as of 12:11, 28 April 2011

A SPU is a shell item for controlling Signal Processing Units (SPUs). An SPU is a circuit connecting one or more Signal Processing Atom together. The ciruit (its SP-atoms, inputs, outputs and internal connections) is defined in a SPU section of a source file, which must be loaded before the SPU item (the runtime instance of the circuit) can be created.

SPU Item Creation

An SPU item is created using the NEW SPU command.

NEW SPU spuname spusource inval1 ... [/Nothread] [ /G ]
spuname
the name of the SPU item; the asterisk (*) can be used to assign an automatically created unique name
spusource
the name of a loaded SPU source code
inval1, ...
the values for the SPU inputs; the values must be specified in the order defined in the SPU source header
/Nothread
do not create a SPU thread (SPU runs in the shell's thread);
/G
create a temporary SPU item; use this option only together with /Nothread

The command creates a run-time SPU item named spuname which is based on the loaded SPU source code spusource. The arguments inval1, ... are the parameters and inputs of the SPU and can be:

  1. constant numeric or string expressions,
  2. outputs of other SPU items or
  3. outputs of value items.

The inputs are assigned during SPU creation and cannot be changed later! If the command is successful, the new SPU item is initialized and put into stop mode. The option /Nothread means that rather than creating an SPU-thread, the SPU runs in the shell's thread (this means the macro processing is blocked while the SPU is running).

SPU Item Commands

SET spuname RUN [cycles]
Start evaluation. If cycles is a number greater than zero, it specifies the number of evaluation cycles to be performed before the SPU stops automatically. Otherwise the SPU evaluation runs until the user issues a STOP command, the evaluation is finished (all data processed) or an error occurs.
SET spuname STOP
Stop evaluation. The evaluation of the SPU is stopped immediately (after finishing the current cycle). The SPU then generates a STOP message
SET spuname EXIT
Terminate the SPU process and prepare item for deletion. This function must be executed before an SPU item can be deleted. It terminates the thread running the SPU code and performs all necessary cleanup actions. The SPU sends the EXIT message when finished.

Notes:

  • If SPU items are connected in order to build a complex parallel-processed circuit, the first SPU in the chain is called the master SPU. All commands from the shell should be sent to the master SPU (which controls all other SPU items in the chain) and all messages (except EXIT) are sent back by the master SPU. Only the EXIT message is sent by each SPU to be sure that the SPU item can be deleted.
  • An SPU without its own thread (created with /Nothread) does not send messages and cannot be used in a multi-SPU circuit (i.e. cannot be connected to other SPU's). This type of SPU should only be used for short computations (e.g. initialize graph scales, compute parameter statistics) because the macro command processing is suspended while the SPU is running.


<splist parent= sort=asc sortby=title showpath=no liststyle=unordered kidsonly=yes >

Navigation menu

Personal tools