No more Bits: Only Bytes!!!

One way of sharing data between PPE program and SPE program is by using a header file defining a common data structure. The era of counting for bits of memory is comes to end by Cell BE’s byte level memory processing. The data passed between PPE and SPE programs should be in multiples of 16 bytes. And there is also a limit on the variables declared in a SPE program. So, in header file the size of total variables declared should in multiple of 16 bytes. If it is not; we have to follow a work around of adding few dummy variables in order to meet the 16bytes criteria.

For example following is the content of datadef.h header file:

typedef struct
{
/*Array to store the name of the array*/
char genome_file[32];
char output_file[32];

/*Variable to store the total number of input queries*/
unsigned int num_queries;
float aa_ga_weighting[20];
unsigned int dummy[3];

} filexchg_data

In the above sample at the end one dummy integer array is declared inorder to make the total size divisible by 16.

Here is the calculation:

32 + 32 + 4 + (4×20) + 12 = 160 / 16 = 10

Advertisement
Explore posts in the same categories: Programming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.