Beginner question about using cuMemGetInfo() from C api (3.2)

Hi, I’ve read other posts about being able to call cuMemGetInfo() from the C runtime api. I’m still having problems with the call returning a 201. I’m not sure what other information to supply that might be helpful other than that I am using the 3.2 sdk on linux. Building on the command line with “nvcc -arch=sm_20 -lglut -lcuda test.cu”. (GPU is a GeForce GTS 450 with 2.1 compute capability). In other posts related to this the problem appears to be resolved with a link to libcuda, but it doesn’t seem to be the case here. Thanks for any help.

OK, digging a little deeper I see that I was calling cuMemGetInfo() relatively early into my main function; so no cuda context had been implicitly created yet. After making a call to cudaMalloc (which I presume implicitly creates a cuda context) , I could then call the cuMemGetInfo and have it return memory information. So, since I want to actually use cuMemGetInfo before and after my call to cudaMalloc I need to implicily create a context with another cuda call. Assuming that my understanding of the above is correct, is there any documentation on which function calls will trigger the creation of a context? Thanks.