[Cbe-oss-dev] Lifetime of SPE contexts & gangs

Jeremy Kerr jk at ozlabs.org
Wed May 9 19:43:49 EST 2007


Gerhard,

> This is what the libspe2 spec has to say about this:
> 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.

Sure - if that's done correctly, then we have no problem here. (does 
this mean that whichever approach we take is ok according to the spec, 
because it's essentially undefined behaviour?)

> From that perspective, another option could be that
> spe_context_destroy() fails, if it still has associated contexts.

I don't like this option much, as noone ever checks the result of 
close().

Also, it doesn't really get us anywhere, as the gang will be closed 
(implicitly) when the process exits, it's just postponing the problem.

> So far, we mainly see this problem, if an application exits without
> cleaning up properly. So, my preference would be the second option.

All of my proposed options will fix this - is there a particular 
preference for the second?

Cheers,


Jeremy



More information about the cbe-oss-dev mailing list