The following is how I initialize my cuda context,
And they seem to be initialized to the thread and not the entire process.
After reading http://forums.nvidia…howtopic=194860 , I understand that the feature is supported in CUDA 4.0 but only for runtime API. Is there a CTX flag in CUDA 4.0 for driver API which can make the context global ?
Also, by making the context global, will I be able to free mapped memory from a thread other than the one which allocated it ? I tried using the flag CU_MEMHOSTALLOC_PORTABLE but I couldnt get it to work.
after creating with cuCtxCreate you get as global context as you can get. That context is also set current for the current thread, so there is no need to call cuCtxAttach in your case. To unbind the context from the current thread you call cuCtxPopCurrent.
after creating with cuCtxCreate you get as global context as you can get. That context is also set current for the current thread, so there is no need to call cuCtxAttach in your case. To unbind the context from the current thread you call cuCtxPopCurrent.
there’s no way to do what the runtime API does with the driver API in 4.0–we ran out of time (weren’t happy with the APIs). it’s coming in the next release.
there’s no way to do what the runtime API does with the driver API in 4.0–we ran out of time (weren’t happy with the APIs). it’s coming in the next release.
I cannot unbind the context since I would like the thread to continue running as usual. When I free one of my objects, there is a pointer to cuda mapped memory which needs to be freed as well, but the thread which frees my object is not the thread which runs the kernel. Using a mutex to synchronize the pop & push of a context will not work for me, although I find the approach interesting.
I cannot unbind the context since I would like the thread to continue running as usual. When I free one of my objects, there is a pointer to cuda mapped memory which needs to be freed as well, but the thread which frees my object is not the thread which runs the kernel. Using a mutex to synchronize the pop & push of a context will not work for me, although I find the approach interesting.