need to cudaSetDevice again after cudaDeviceReset ?
thanks
It may be necessary. I would certainly expect it to be necessary if the device you intend to use is other than device 0, the default.
thanks! how about always using the only device 0 ? not necessary but better&safe to call cudaSetDevice(0) again?
I pretty much never use cudaDeviceReset. I think it is a bad idea. So I don’t really have lots of detailed recommendations for its use. I don’t think it ever needs to be used. I wouldn’t use it and I wouldn’t recommend that it be used.
When I only have a single device in view, I don’t bother ever calling cudaSetDevice(0)
, either. That is an API default.
it seems it will free more gpu memory after cudaDeviceReset than not call it after free all cuda objects.
so what’s the best way to switch device when multi-devices. while running. thanks!