CUDA contexts


I am somewhat uncertain as to the purpose of contexts. According to the programming guide each context is assigned a distinct address space. But why would this be desirable, isn’t it always best to have all resources of the Graphics card available. Also al CUDA programs run sequentially therefore one context should be enough, one can just unload modules and load new ones. Is creating a context just a way to garantie that all memory is zeroed out?


The main purpose of contexts is to enable using multiple GPUs - typically you only need one context per GPU.

CUDA doesn’t guarantee that memory is zeroed when creating a context.

Ok I see thanks!