I have the following code which allocates global memory on the GPU.
__global__ void mallocTest()
{
char* ptr = (char*)malloc(123);
//....
free(ptr);
}
Will every thread allocate memory for a separate ptr?
so if i have 2 blocks of 10 threads, then 20 arrays are allocated (ie every thread allocate memory for its own use)?
How can i only allocate the memory per block instead of per thread?
ie if i have 2 blocks and 10 threads, only 2 arrays are allocated.
is this possible?