Title: OpenCL interoperability does not work on 64-bit OS · Issue #265 · arrayfire/arrayfire-python · GitHub
Open Graph Title: OpenCL interoperability does not work on 64-bit OS · Issue #265 · arrayfire/arrayfire-python
X Title: OpenCL interoperability does not work on 64-bit OS · Issue #265 · arrayfire/arrayfire-python
Description: Currently the OpenCL interoperability does not work on 64-bit Windows machine. The reason for this is the use of c_int_t which defaults to long on Windows (which on the other hand is 32-bit). This can be problematic with things like devi...
Open Graph Description: Currently the OpenCL interoperability does not work on 64-bit Windows machine. The reason for this is the use of c_int_t which defaults to long on Windows (which on the other hand is 32-bit). This ...
X Description: Currently the OpenCL interoperability does not work on 64-bit Windows machine. The reason for this is the use of c_int_t which defaults to long on Windows (which on the other hand is 32-bit). This ...
Opengraph URL: https://github.com/arrayfire/arrayfire-python/issues/265
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"OpenCL interoperability does not work on 64-bit OS","articleBody":"Currently the OpenCL interoperability does not work on 64-bit Windows machine. The reason for this is the use of `c_int_t` which defaults to long on Windows (which on the other hand is 32-bit). This can be problematic with things like device IDs as they can easily go over 2^32/2-1. For example https://github.com/arrayfire/arrayfire-python/blob/master/arrayfire/opencl.py#L88 uses `c_int_t`, as well as a few other functions in the same file. This can be fixed by replacing the `c_int_t` with, for example, `c_void_ptr_t` as it is used with the context. Is there by the way some specific reason why context is treated differently?\r\n\r\nThere is also another issue. When the context is created by PyOpenCL, the input device, context and queue values are input as python ints in order to use the same context and queue, but on Windows you get `\u003cclass 'OverflowError'\u003e: int too long to convert` errors then. These can be avoided by casting them to, for example, `c_int64`-types. For example in https://github.com/arrayfire/arrayfire-python/blob/master/arrayfire/opencl.py#L156, replace `safe_call(backend.get().afcl_add_device_context(dev, ctx, que))` with `safe_call(backend.get().afcl_add_device_context(ct.c_int64(dev), ct.c_int64(ctx), ct.c_int64(que)))` (using `c_void_p` seems to work too).\r\n\r\nI haven't tested these changes extensively, but they do seem to get things working on 64-bit Windows. I can provide a PR if needed.","author":{"url":"https://github.com/villekf","@type":"Person","name":"villekf"},"datePublished":"2024-04-09T14:27:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/265/arrayfire-python/issues/265"}
| 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:6913a6fa-734a-7ea2-2771-20051dddeb99 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EE20:240CA0:13397CB:1985425:696BD650 |
| html-safe-nonce | 0a09b59b91f1b3dafc1c3a2037b8add73347c8cef695a5640d009431255a2319 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTIwOjI0MENBMDoxMzM5N0NCOjE5ODU0MjU6Njk2QkQ2NTAiLCJ2aXNpdG9yX2lkIjoiMTQwNzMyMzMwNzA1OTY5NzIzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | db41541967dfc78546094d6c76b2cc2b684a051d4ed0603610218efea292f4b4 |
| hovercard-subject-tag | issue:2233577066 |
| 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/arrayfire-python/265/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bdc8050413f4ec79dab279343e5cc8815c5c5bdb4a8ce7473f69c0edca763aba/arrayfire/arrayfire-python/issues/265 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bdc8050413f4ec79dab279343e5cc8815c5c5bdb4a8ce7473f69c0edca763aba/arrayfire/arrayfire-python/issues/265 |
| og:image:alt | Currently the OpenCL interoperability does not work on 64-bit Windows machine. The reason for this is the use of c_int_t which defaults to long on Windows (which on the other hand is 32-bit). This ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | villekf |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/arrayfire/arrayfire-python git https://github.com/arrayfire/arrayfire-python.git |
| octolytics-dimension-user_id | 5395442 |
| octolytics-dimension-user_login | arrayfire |
| octolytics-dimension-repository_id | 37599258 |
| octolytics-dimension-repository_nwo | arrayfire/arrayfire-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 37599258 |
| octolytics-dimension-repository_network_root_nwo | arrayfire/arrayfire-python |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width