mirror of
https://gitee.com/openharmony/third_party_opencl-headers
synced 2024-11-26 16:50:30 +00:00
add CL so load and unload interface
Signed-off-by: fanghuameng <fanghuameng@huawei.com>
This commit is contained in:
parent
5d905009d9
commit
f1cc9ae857
@ -30,6 +30,9 @@ bool LoadOpenCLLibrary(void **handle_ptr);
|
||||
bool UnLoadOpenCLLibrary(void *handle);
|
||||
bool InitOpenCL();
|
||||
|
||||
bool InitOpenCLExtern(void **clSoHandle);
|
||||
bool UnLoadCLExtern(void *clSoHandle);
|
||||
|
||||
// get platform id
|
||||
using clGetPlatformIDsFunc = cl_int (*)(cl_uint, cl_platform_id *, cl_uint *);
|
||||
// get platform info
|
||||
|
@ -65,6 +65,25 @@ bool UnLoadOpenCLLibrary(void *handle)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InitOpenCLExtern(void **clSoHandle)
|
||||
{
|
||||
if (clSoHandle == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return LoadOpenCLLibrary(clSoHandle);
|
||||
}
|
||||
|
||||
bool UnLoadCLExtern(void *clSoHandle)
|
||||
{
|
||||
if (clSoHandle == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (dlclose(clSoHandle) != 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool LoadLibraryFromPath(const std::string &library_path, void **handle_ptr)
|
||||
{
|
||||
if (handle_ptr == nullptr) {
|
||||
|
Loading…
Reference in New Issue
Block a user