Hi,
I am trying to compile and run a small program which will reverse an array. The kernel is supposed to transfer the array onto the shared memory and again onto the global memory in reversed order.
My code gets compiled. But when I run it… program executes and I get the reversed array printed out, but I also get the following error message.
“This application has requested the Runtime to terminate it in an unusual way. Please contact the application’s support team for more information” and also a pop-up message box saying “An exception unknown software exception has occured in the application at location 0x004…”
Can any one help me… Why does this happen and how do I fix it? My kernel code is given below…[codebox]
global void reverse_array_shared(int* dev_arr1, int* dev_arr2, int array_size)
{
extern shared int sh_array;
int in_index = blockDim.x*blockIdx.x + threadIdx.x;
int out_index = array_size - 1 - in_index;
if(in_index < array_size)
{
/** Transferring data from Global memory into shared memory**/
sh_array[threadIdx.x] = dev_arr1[in_index];
/** Transfer it back into global memory but in a different order **/
dev_arr2[out_index] = sh_array[threadIdx.x];
}
[/codebox]
Appreciate any help… Thanks.
best,
Avinash