Ansel detectará automáticamente los errores en tiempo de ejecución de OpenCL. Al detectar un error, volverá a procesar todo en la CPU. Si bien esto ralentizará el procesamiento, no debería afectar el resultado final.

Puede haber varias razones por las que OpenCL puede fallar durante la fase de inicialización. OpenCL depende de los requisitos de hardware y de la presencia de ciertos controladores y bibliotecas. Además, todos estos deben ajustarse en términos de fabricante, modelo y número de revisión. Si algo no encaja (por ejemplo, su controlador de gráficos, cargado como un módulo del kernel, no coincide con la versión de su libOpenCL.so), es probable que el soporte OpenCL no esté disponible.

En este caso, lo mejor es iniciar Ansel desde una consola con Ansel -d opencl.

Esto proporcionará resultados de depuración adicionales sobre la inicialización y el uso de OpenCL. Primero, si encuentra una línea que comienza con [opencl_init] FINALLY ... eso debería indicarle si el soporte OpenCL está disponible para usted o no. Si la inicialización falló, mire los mensajes de arriba para cualquier cosa que diga como could not be detected (no se pudo detectar) o could not be created (no se pudo crear). Compruebe si hay alguna pista sobre dónde falló.

A continuación, se muestran algunos casos que se han observado en el pasado:

  • Ansel states that no OpenCL aware graphics card is detected or that the available memory on your GPU is too low and the device is discarded. In that case you might need to buy a new card if you really want OpenCL support.

  • Ansel finds your libOpenCL.so but then tell you that it couldn’t get a platform. NVIDIA drivers will often give error code -1001 in this case. This happens because libOpenCL.so is only a wrapper library. For the real work further vendor-specific libraries need to be loaded. This has failed for some reason. There is a structure of files in /etc/OpenCL on your system that libOpenCL.so consults to find these libraries. See if you can find something fishy in there and try to fix it. Often the required libraries cannot be found by your system’s dynamic loader. Giving full path names might help.

  • Ansel states that a context could not be created. This often indicates a version mismatch between the loaded graphics driver and libOpenCL. Check if you have left-over kernel modules or graphics libraries from an older installation and take appropriate action. When in doubt, perform a clean reinstall of your graphics driver. Sometimes, immediately after a driver update, the loaded kernel driver does not match the newly installed libraries. In this case reboot your system before trying again.

  • Ansel crashes during startup. This can happen if your OpenCL setup is completely broken or if your driver/library contains a severe bug. If you can’t fix it, you can still use Ansel with option --disable-opencl, which will skip the entire OpenCL initialization step.

  • Ansel fails to compile its OpenCL source files at run-time. In this case you will see a number of error messages looking like typical compiler errors. This could indicate an incompatibility between your OpenCL implementation and Ansel’s interpretation of the standard. In that case please raise an issue on github  and we will try to assist. Please also report if you see significant differences between CPU and GPU processing of an image.

También existen algunas implementaciones de OpenCL en CPU, que vienen como controladores proporcionados por INTEL o AMD. Hemos observado que no proporcionan ninguna ganancia de velocidad en comparación con nuestro código de CPU optimizado a mano. Por lo tanto, Ansel simplemente descarta estos dispositivos por defecto. Este comportamiento se puede cambiar estableciendo la variable de configuración opencl_use_cpu_devices (en$HOME/.config/Anselrc) en TRUE.