1 of 1 people found this helpful
First of all, if you are doing HPC. No, premature optimization is not the root of evil. Your program needs hours or even days (or months) wall time(actual time) to compute. Any optimization is valuable. Also, I don't think this is an optimization by any means(at least in the HPC world). This looks like a design/feature issue. As for the open-close principle. I believe you should have a central OpenCL manager that handles the lifetime of contexts. Where then you create devices and buffers from the context the manager creates.
Back to the topic. I don't think copying buffer between context without CPU is possible. All OpenCL memory copying mechanics only works in the same context.