This PR fixes the non deterministic crashes when running tests on multidevice.
The errors come from the fact getDevice() will return the current active device, which might not be the one you want if you're running multidevice tests concurrently.
GetDefaultDeviceContext uses GetDevice and the different getDefaultConfigs functions use GetDefaultDeviceContext which means when you get the default config for a primitive it might not be on the right device.
I wrote GetDefaultContextForDevice(device int) and a function for each config that returns a config on the given device.
I also added cr.setDevice(cfg.Ctx.GetDeviceId) where it was needed (before creating a stream or a slice, or before a Check)
Describe the changes
This PR fixes the non deterministic crashes when running tests on multidevice. The errors come from the fact getDevice() will return the current active device, which might not be the one you want if you're running multidevice tests concurrently. GetDefaultDeviceContext uses GetDevice and the different getDefaultConfigs functions use GetDefaultDeviceContext which means when you get the default config for a primitive it might not be on the right device. I wrote GetDefaultContextForDevice(device int) and a function for each config that returns a config on the given device. I also added cr.setDevice(cfg.Ctx.GetDeviceId) where it was needed (before creating a stream or a slice, or before a Check)
Linked Issues
Resolves #