Hi

I have a kernel F, which operates on an array acontaining following data:

a=[1 2 3 4 5 6 ]

The kernel operates on a and gives the following results:

1-Element wise square in a2=[1 4 9 16 25 36 ]

2-Sum of the elements of a in block_Sums=[21]

My algorithm says that I must again apply the same kernel F on block_Sums=[21], which is one of the outputs of the kerenel.

In short:

INPUT OUTPUT

First reference: F:–>a= { a2, block_Sums}

do this again but not on a, instead on block_Sums

Second Reference: F:–>block_Sums= { block_Sums2, xyz}

My requirement is to get block_Sums2, and ignore xyz which is useless for me.

The problem is if I call the kerenel twice from the host, the arguments and execution configuration in the kernel F need to be changed in the two references (because as can be seen from the above the dimensions of the input arrays a and block_Sums in the two ref are different).Can anybody tell me how to get around with this problem? Any better approach than calling the kernel twice in a row?

Thanks for your time.