ingonyama-zk / icicle

A hardware acceleration library for compute intensive cryptography :ice_cube:
https://dev.ingonyama.com/icicle/overview
MIT License
329 stars 97 forks source link

Bug/vlad/fix ci crash multidevice #500

Closed vladfdp closed 4 months ago

vladfdp commented 5 months ago

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 #