OpenCL interoperability does not work on 64-bit OS
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 48/100
Direção de pesquisa
Os pontos de entrada afetados estão em arrayfire/opencl.py, por volta das linhas 88 e 156, além dos outros usos de c_int_t nesse arquivo. Leia primeiro essas declarações de ctypes e, em seguida, reproduza a configuração de OpenCL/PyOpenCL no Windows de 64 bits; considera-se concluído quando os IDs de dispositivo e os valores compartilhados de dispositivo, contexto e fila não sofrem mais overflow e a interoperabilidade funciona.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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?
There 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 <class 'OverflowError'>: 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).
I 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.
- Linguagem predominante
- Python
- Estrelas
- 422
- Forks
- 63
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de arrayfire/arrayfire-python
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
arrayfire/arrayfire-python#271 ·
-
Unwrap phase function Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
arrayfire/arrayfire-python#270 ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
arrayfire/arrayfire-python#269 ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 38/100
arrayfire/arrayfire-python#268 · 1 comentário ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 48/100
arrayfire/arrayfire-python#267 · 1 comentário · 1 reação ·
Todas as issues de arrayfire/arrayfire-python
Issues semelhantes
-
Add: hunch Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
DiamondLightSource/dodal#2211 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
openml/openml-python#1749 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
sipyourdrink-ltd/bernstein#6191 ·