Hi,
Is it possible to change the number of devices used by Optix at runtime?
More details
We have a feature that only works with a single GPU.
However, we must use all the available GPUs when this feature is not enabled.
This feature can be toggled on/off at any moment.
If I setDevices() at runtime (ie. after buffers and context data have been bound) then this error occurs:
Unknown error (Details: Function "RTresult _rtContextSetDevices(RTcontext, unsigned int, const int*)" caught exception: Assertion failed: "oldPolicy.discardHostMemoryOnUnmap", file: /root/sw/wsapps/raytracing/rtsdk/rel5.1/src/Memory/MemoryManager.cpp, line: 1490
================================================================================
Backtrace:
(0) () +0x711547
(1) () +0x70dd31
(2) () +0x70db79
(3) () +0x3b651a
(4) () +0x3c86e3
(5) () +0x3c8f27
(6) () +0x3ca68e
(7) () +0x3245b8
(8) () +0x1c779a
(9) () +0x177c96
(10) rtContextSetDevices() +0x1ae
(11) void optix::ContextObj::setDevices<__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > > >(__gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >, __gnu_cxx::__normal_iterator<unsigned int*, std::vector<unsigned int, std::allocator<unsigned int> > >) +0xa5
(12) RaytracingContext::setDeviceCount(DeviceCount) +0x191
...
(This happens whether I switch from 2 to 1 GPU or from 1 to 2 GPUs.)
In a smaller test application, we found that what works is to recreate the context, setDevices() immediately and never change it again.
Can you confirm if we do have to create a new context each time we need to change the number of devices, or should it be possible to change it dynamically?
Thanks