I am having an issue with some of my code that tries to ‘page’ things on and off the GPU when necessary. My calls to cudaHostAlloc is throwing an access violation yet I don’t think I am doing anything odd.
The code that seems to be relevant is:
float* newAddress = NULL;
//Some checks here to make sure this hostAlloc is possible and sensible
if (cudaSuccess == cudaHostAlloc(&newAddress,sizeof(float) * m_currentDataElements, cudaHostAllocWriteCombined)
{
cudaMemcpy(newAddress, m_dData, sizeof(float) * m_currentDataElements, cudaMemcpyDeviceToHost);
cudaFree(m_dData);
m_dData = NULL;
}
else
{
//do other stuff
}
Basically trying to cudaHostAlloc 4MB into the newAddress is just throwing the exception and I cannot fathom why?
Cheers,
Tiomat