Title: [BUG] createGLBuffer and copyToGLBuffer do not point to the same device · Issue #242 · arrayfire/forge · GitHub
Open Graph Title: [BUG] createGLBuffer and copyToGLBuffer do not point to the same device · Issue #242 · arrayfire/forge
X Title: [BUG] createGLBuffer and copyToGLBuffer do not point to the same device · Issue #242 · arrayfire/forge
Description: If you have more than one display cards, all the examples in forge/examples/opencl will fail. A temporary workaround is to modify createCLGLContext in cl_helpers.h so that cl::Context always use the last device instead of the first devic...
Open Graph Description: If you have more than one display cards, all the examples in forge/examples/opencl will fail. A temporary workaround is to modify createCLGLContext in cl_helpers.h so that cl::Context always use th...
X Description: If you have more than one display cards, all the examples in forge/examples/opencl will fail. A temporary workaround is to modify createCLGLContext in cl_helpers.h so that cl::Context always use th...
Opengraph URL: https://github.com/arrayfire/forge/issues/242
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] createGLBuffer and copyToGLBuffer do not point to the same device","articleBody":"If you have more than one display cards, all the examples in forge/examples/opencl will fail. \r\n\r\nA temporary workaround is to modify createCLGLContext in cl_helpers.h so that cl::Context always use the last device instead of the first device. But it is not a solution at all. \r\n\r\n```\r\nvoid get_devices(const forge::Window \u0026wnd,\r\n std::vector\u003ccl::Platform\u003e \u0026platforms_interop,\r\n std::vector\u003cDevice\u003e \u0026devices_interop) {\r\n std::vector\u003ccl::Platform\u003e platforms;\r\n Platform::get(\u0026platforms);\r\n\r\n for (auto platform : platforms) {\r\n std::vector\u003ccl::Device\u003e devices;\r\n try {\r\n platform.getDevices(CL_DEVICE_TYPE_GPU, \u0026devices);\r\n for (auto device : devices) {\r\n if (checkGLInterop(platform, device, wnd)) {\r\n devices_interop.push_back(device);\r\n platforms_interop.push_back(platform);\r\n }\r\n }\r\n\r\n } catch (const cl::Error \u0026err) {\r\n if (err.err() != CL_DEVICE_NOT_FOUND) {\r\n std::cout \u003c\u003c \"Platform: \" \u003c\u003c platform.getInfo\u003cCL_PLATFORM_NAME\u003e()\r\n \u003c\u003c \" got error = \" \u003c\u003c err.err() \u003c\u003c std::endl;\r\n throw std::runtime_error(\"Fatal Error!\");\r\n }\r\n }\r\n }\r\n if (devices_interop.size() == 0)\r\n throw std::runtime_error(\"No CL-GL sharing contexts found\");\r\n}\r\n\r\ncl::Context createCLGLContext(const forge::Window \u0026wnd, cl::Platform platform,\r\n cl::Device device) {\r\n // std::cout \u003c\u003c \"Platform: \" \u003c\u003c platform.getInfo\u003cCL_PLATFORM_NAME\u003e()\r\n // \u003c\u003c std::endl;\r\n // std::cout \u003c\u003c \"Device: \" \u003c\u003c device.getInfo\u003cCL_DEVICE_NAME\u003e() \u003c\u003c std::endl;\r\n#if defined(OS_MAC)\r\n CGLContextObj cgl_current_ctx = CGLGetCurrentContext();\r\n CGLShareGroupObj cgl_share_group = CGLGetShareGroup(cgl_current_ctx);\r\n\r\n cl_context_properties cps[] = {CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE,\r\n (cl_context_properties)cgl_share_group, 0};\r\n#elif defined(OS_LNX)\r\n cl_context_properties cps[] = {CL_GL_CONTEXT_KHR,\r\n (cl_context_properties)wnd.context(),\r\n CL_GLX_DISPLAY_KHR,\r\n (cl_context_properties)wnd.display(),\r\n CL_CONTEXT_PLATFORM,\r\n (cl_context_properties)platform(),\r\n 0};\r\n#else /* OS_WIN */\r\n cl_context_properties cps[] = {CL_GL_CONTEXT_KHR,\r\n (cl_context_properties)wnd.context(),\r\n CL_WGL_HDC_KHR,\r\n (cl_context_properties)wnd.display(),\r\n CL_CONTEXT_PLATFORM,\r\n (cl_context_properties)platform(),\r\n 0};\r\n#endif\r\n return cl::Context(device, cps);\r\n}\r\n\r\ncl::Context createCLGLContext(const forge::Window \u0026wnd) {\r\n std::vector\u003ccl::Platform\u003e platforms;\r\n std::vector\u003cDevice\u003e devices;\r\n get_devices(wnd, platforms, devices);\r\n for (size_t i = devices.size() - 1; i \u003e= 0; i--) {\r\n // for (size_t i = 0; i \u003c devices.size(); i++) {\r\n try {\r\n return createCLGLContext(wnd, platforms[i], devices[i]);\r\n\r\n } catch (const cl::Error \u0026err) {\r\n std::cout \u003c\u003c \"[createCLGLContext]Error:\" \u003c\u003c err.err() \u003c\u003c std::endl;\r\n }\r\n }\r\n return cl::Context();\r\n}\r\n```","author":{"url":"https://github.com/3togo","@type":"Person","name":"3togo"},"datePublished":"2023-04-20T03:33:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/242/forge/issues/242"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:70ace9a5-83ea-a870-3b71-87400a1faefd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB26:26B0AA:4D4C3F4:681697F:696E12FB |
| html-safe-nonce | 1c2c7b97bec6a4fa60451a0bd3566f214a69fe5da62de1d3bdeeb3005ca1b4ed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjI2OjI2QjBBQTo0RDRDM0Y0OjY4MTY5N0Y6Njk2RTEyRkIiLCJ2aXNpdG9yX2lkIjoiNDU1NjExNjk1ODk2NTk3MjQzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d1400d79c94747be64d2aa95f262b471f684742ad715d1a8a3ead787de2e9ac7 |
| hovercard-subject-tag | issue:1675942950 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/arrayfire/forge/242/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8229b1d3da1e4555bd5af40a794864c14701c5001cd46e23aa46960926a779b9/arrayfire/forge/issues/242 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8229b1d3da1e4555bd5af40a794864c14701c5001cd46e23aa46960926a779b9/arrayfire/forge/issues/242 |
| og:image:alt | If you have more than one display cards, all the examples in forge/examples/opencl will fail. A temporary workaround is to modify createCLGLContext in cl_helpers.h so that cl::Context always use th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 3togo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1a7d6d739bf034e67486b9f97a31887ca30302b72a0acac49b6bcddff34356d7 |
| turbo-cache-control | no-preview |
| go-import | github.com/arrayfire/forge git https://github.com/arrayfire/forge.git |
| octolytics-dimension-user_id | 5395442 |
| octolytics-dimension-user_login | arrayfire |
| octolytics-dimension-repository_id | 35898690 |
| octolytics-dimension-repository_nwo | arrayfire/forge |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 35898690 |
| octolytics-dimension-repository_network_root_nwo | arrayfire/forge |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 87d7872ec7094ed247923539669aabda9230966f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width