SPE context creation

The SPE context is one of the base data structures for the libspe implementation. It holds all persistent information about a "logical SPE" used by the application. This data structure should only be accessed through libspe API calls, and should not be accessed directly.

Before being able to use an SPE, the SPE context data structure has to be created and initialized. This is done by calling the function spe_context_create.

When an application no longer needs a specific SPE context, it should call the function spe_context_destroy to release all associated resources and free the memory used by the SPE context data structure.

The SPE gang context is another of the base data structures for the libspe implementation. It holds all persistent information about a group of SPE contexts that should be treated as a gang, that is, be executed together with certain properties. This data structure should only be accessed through libspe API calls, and should not be accessed directly.

Before being able to use an SPE gang context, that is, before calling spe_context_create to add SPE contexts as members to the gang, the SPE gang context data structure must be created and initialized. This is done by calling the function spe_gang_context_create.

When an application no longer needs a specific SPE gang context, it should release all associated resources and free the memory used by the SPE context data structure. It does this by first calling spe_context_destroy to destroy all SPE contexts associated with the gang by on each of them and then calling the function spe_gang_context_destroy.

SPE-SPE affinity is always specified in affinity pairs. The function spe_context_create_affinity specifies SPE affinity. This function allows an SPE context to be created and placed next to another previously created SPE context. The SPUFS scheduler honors this relationship by scheduling the SPE contexts on physically adjacent SPUs. This routine can be used to create a chain of SPE contexts that consumes all of the SPU resources on a Cell BE. If you want to use additional SPU resources, you must create a separate gang for that purpose.