Array of type dim3?

Is it possible to have an array of type dim3? I.e. to have multiple grid sizes and select them based on the index? I’ve been using the code below to no avail.

dim3 dimGrid[N]

for(i=0;i<N,i++){dimGrid[N]=(number,number);}

and then launching a kernel with:

i=2;

myKernel<<<dimGrid[i], dimBlock>>>(pointer, pointer);

dim3 is a structure. To assign to it, you either need to assign the individual members:

dimGrid[N].x = number;

dimGrid[N].y = number;

dimGrid[N].z = 1;

or use the constructor provided in the runtime library

dimGrid[N] = dim3(number, number);

Note that all of the members need to be assigned values when passed as kernel execution parameters (which is why z must be assigned in the first example). The dim3 constructor will fill in any missing dimensions with 1 automagically.