| 47 | } |
| 48 | |
| 49 | bool CLSymbols::load_default() |
| 50 | { |
| 51 | static const std::vector<std::string> libraries_filenames{"libOpenCL.so", "libGLES_mali.so", "libmali.so"}; |
| 52 | |
| 53 | if (_loaded.first) |
| 54 | { |
| 55 | return _loaded.second; |
| 56 | } |
| 57 | |
| 58 | // Indicate that default loading has been tried |
| 59 | _loaded.first = true; |
| 60 | |
| 61 | if (load(libraries_filenames, /* use_loader */ false)) |
| 62 | { |
| 63 | ARM_COMPUTE_ERROR_ON_MSG(this->clBuildProgram_ptr == nullptr, |
| 64 | "Failed to load OpenCL symbols from shared library"); |
| 65 | return true; |
| 66 | } |
| 67 | |
| 68 | #ifdef __ANDROID__ |
| 69 | // When running in NDK environment, the above libraries are not accessible. |
| 70 | static const std::vector<std::string> android_libraries_filenames{"libOpenCL-pixel.so", "libOpenCL-car.so"}; |
| 71 | |
| 72 | if (load(android_libraries_filenames, /* use_loader */ true)) |
| 73 | { |
| 74 | ARM_COMPUTE_ERROR_ON_MSG(this->clBuildProgram_ptr == nullptr, |
| 75 | "Failed to load OpenCL symbols from android shared library"); |
| 76 | return true; |
| 77 | } |
| 78 | #endif // __ANDROID__ |
| 79 | |
| 80 | // If not returned till here then libraries not found |
| 81 | std::stringstream ss; |
| 82 | std::for_each(libraries_filenames.begin(), libraries_filenames.end(), |
| 83 | [&ss](const std::string &s) { ss << s << " "; }); |
| 84 | #ifdef __ANDROID__ |
| 85 | std::for_each(android_libraries_filenames.begin(), android_libraries_filenames.end(), |
| 86 | [&ss](const std::string &s) { ss << s << " "; }); |
| 87 | #endif // __ANDROID__ |
| 88 | std::cerr << "Couldn't find any of the following OpenCL library: " << ss.str() << std::endl; |
| 89 | return false; |
| 90 | } |
| 91 | |
| 92 | bool CLSymbols::load(const std::vector<std::string> &libraries_filenames, bool use_loader) |
| 93 | { |
no test coverage detected