Hi Charles, > I know I can set a device type with: > > viennacl::ocl::set_context_device_type(id, viennacl::ocl::gpu_tag()); > > but is there a where for me to subsequently change that to `cpu_tag()` > within the same main() function?
Depends on what you want to achieve. You can call set_context_device_type() multiple times and reset the device type. However, once you allocate a matrix or vector, the context gets initialized and hence you can no longer change the device type. > I see I can change devices with: > > viennacl::ocl::current_context().switch_device(1); > > but, if I understand correctly, that just switches be devices of the > same type. You can place all available devices into the same context and then switch between them via current_context().switch_device(). If you want different devices to work on the same OpenCL memory (e.g. two devices working on the same viennacl::vector), then this is what you should do. Keep in mind, however, that moving memory between devices is fairly expensive. It is, however, not possible to reinitialize the same context with a new device, because this requires to deallocate all memory buffers, destruct all OpenCL programs, etc. Best regards, Karli ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140 _______________________________________________ ViennaCL-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/viennacl-devel
