Here’s the code I’m trying to run:
// Create a 3 channel format description
cudaChannelFormatDesc channelDesc= cudaCreateChannelDesc(32, 32, 32, 0, cudaChannelFormatKindFloat);
// Allocate array
cudaMallocArray(&posBuff, &channelDesc, m_imgWidth, m_imgHeight);
// Now we upload host memory to GPU
cudaMemcpyToArray(posBuff, 0, 0, tempBuff, m_imgWidth*m_imgHeight*3*sizeof(float), cudaMemcpyHostToDevice);
posBuff is a cudaArray*
The problem is cudaMallocArray isn’t setting posBuff to anything, it comes back out as a null pointer, so the cudaMemcpyToArray call seg faults. m_imgWidth and m_imgHeight are both 512, so there should be plenty of memory to hold the array.