Different functions on different blocks


My code has two functions

A(int[] a, int size) 
B(int[][] b, int size, int []c)

I would like to execute each function on a block with 32 different inputs. My thought is to put these varaibles on a struct and declare an array of a struct. This means that the struct has the following

typedef struct{
 int[] a;
 int size;
 int [][] b;
 in[] c;
 int choice;

In the kernel,

if (data[threadId].choice == 1)
   execute function A
   execute function B

The issue with this approach is that I will have an array b and c that are declared in the memory with no usage. It there a better way to not declaring unused variables for some threads?

Array of struct is generally a bad data organization format in CUDA.

I would put these arrays in global memory. Then you can easily allocate only what is needed.

Thank you Robert_Crovella for your response. I will try that