I have a very primitive code. i think it should work, but the second (portable memory) allocation fails.
It is caused by second context creation, if i remove it, everything works fine.
[codebox]
#include “cuda.h”
int main(int argc, char* argv)
{
void* a =0;
void* b =0;
CUcontext ctx1=0;
CUcontext ctx2=0;
cuInit(0);
cuCtxCreate(&ctx1, 0 , 0 );
cuCtxPopCurrent(NULL);
// ***** second context creation *********
cuCtxCreate(&ctx2, 0 , 0 );
cuCtxPopCurrent(NULL);
//***********************************
cuCtxPushCurrent(ctx1);
CUresult ra = cuMemHostAlloc( &a, 4, CU_MEMHOSTALLOC_PORTABLE ); // <---Success
CUresult rb = cuMemHostAlloc( &b, 4, CU_MEMHOSTALLOC_PORTABLE ); // <-failed
// rb = CUDA_ERROR_OUT_OF_MEMORY
return 0;
}[/codebox]
Environment info:
Win7 x64 RC1
Visual Studio 2008 VC++ compiler
CUDA toolkit 2.3 ( 3.0beta same behaviour)
Driver: 196.21
Hardware: 2 X GTX280
PS:
I think, that I use context management well, and I’m sure that I have more free memory than 4 bytes.