termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
31.27k stars 3.32k forks source link

[Feature]: Integration of libopenCL for gpu operations in termux #3885

Closed lsnnt closed 2 months ago

lsnnt commented 2 months ago

Feature description

Many mobile have their gpu for video decoding, for playing games etc. I want to integrate the gpu in termux so that i can perform some gpu based programming such as geting a custom public key using https://github.com/10gic/vanitygen-plusplus faster as compared to its cpu version

Additional information

i know most mobile manufactures include the libOpenCL.so file in /vendor/lib/libOpenCL.so or under /vendor/lib64/libOpenCL.so for more detailed knowledge see this stackoverflow not related to android but may help

sylirre commented 2 months ago

OpenCL already supported by Termux.

lsnnt commented 2 months ago

But why i get this type of error and if i can fix it

clgetPlatformIDs(0): Unknown code -1001 
Could not open any device clGetPlatformIDs(0): 
Unknown code -1001
Available OpenCL platforms:

same type of error in ubuntu (when occured in google colab) i currently don't have gpu can be fixed by this

sylirre commented 2 months ago

Install clinfo and run

LD_LIBRARY_PATH=/vendor/lib64 clinfo

For 32bit devices you'll need

LD_LIBRARY_PATH=/vendor/lib clinfo

There should be long output with contents similar to:

Screenshot_20240312-100115_Termux

If you have errors at this step, you are out of luck and can't use OpenCL.


If clinfo confirmed that OpenCL is usable, then you can try running your program:

LD_LIBRARY_PATH=/vendor/lib64 /path/to/binary

Replace /path/to/binary with proper path to your executable file.

lsnnt commented 2 months ago

Thank you it worked