PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Error in API Hook on PGCL by the way of wrapper DLL.
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
ckit



Joined: 16 Jul 2012
Posts: 7

PostPosted: Mon Nov 12, 2012 5:07 pm    Post subject: Error in API Hook on PGCL by the way of wrapper DLL. Reply with quote

Hi.

Now, I'm trying to hook OpenCLAPI of PGCL.
I chose how to call from libOpenCL.so wrapped to alias original libOpenCL.so.

However, when I run the PGCL sample's NDKOclImageInverse, the program return an error (CL_INVALID_BINARY) in clCreateWithBinary().
I think the problem is not in the binary when I use the original OpenCLAPI Since program can be performed by the same binary.

When I use the original PGCL Library, similar errors occured when not calling setDriverDirectory() and setTmpDirPath() in OpenCLActivitiy class in PGCL sample's JavaLibOpenCL project.

If there is a function that needs to be called or a variable that needs to be rewritten, please let me know.
Also, might be the cause of something else, please let me know if come up with. For example, the configuration of make.

I do not know the cause, I need your help.
Thank you for your attention.

My system and code are as follows:

/* Envirionment */
Target Device : Xperia P
My system's description of "/proc/cpuinfo" is as follows:

Processor : ARMv7 Processor rev 1 (v7l)
processor : 0
BogoMIPS : 4.80

processor : 1
BogoMIPS : 4.80

Features : swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x2
CPU part : 0xc09
CPU revision : 1

Hardware : riogrande
Revision : 0000
Serial : 0000000000000000

/* my code */
Code:

//---call dlopen,dlsym------
dl_handle = dlopen("[app_path]/lib/libOpenCLo.so", RTLD_NOW);
if(!dl_handle)
{
    //error
}
LOGD("NDK:LC: [%s]", "Load:libOpenCLo.so");
dlerror();
p_clCreateContextFromType = (func_clCreateContextFromType)dlsym(dl_handle, "clCreateContextFromType");
LOGD("NDK:LC: [%s]", dlerror()); // no error

//---call function------
cl_program clCreateProgramWithBinary(
      cl_context context,
      cl_uint num_devices,
      const cl_device_id *device_list,
      const size_t *lengths,
      const unsigned char **binaries,
      cl_int *binary_status,
      cl_int *errcode_ret)
{
     cl_program ret = p_clCreateProgramWithBinary(
           context,
           num_devices,
           device_list,
           lengths,
           binaries,
           binary_status,
           errcode_ret
     );

     return ret;
}
Back to top
View user's profile
SebD



Joined: 02 Jan 2008
Posts: 8

PostPosted: Thu Nov 15, 2012 10:09 am    Post subject: Reply with quote

Hi ckit,

Sorry but I don't understand what you're trying to do.
Can you give more information ?

In the code sample you've given, you redefine clCreateProgramWithBinary to call to p_clCreateProgramWithBinary. I guess this routine is part of your OpenCL lib right ?

My understanding is that you would like a PGCL produced binary to be loaded/executed by your own lib that would replace our current libOpenCL.so, is this correct ?

I need first your answer to better understand your problem and eventually reply to your request.

Best Regards
Seb
Back to top
View user's profile
ckit



Joined: 16 Jul 2012
Posts: 7

PostPosted: Mon Nov 19, 2012 12:47 am    Post subject: Reply with quote

Sorry for my bad English and less information.

What I want to do is that I call a function of libOpenCL.so from own lib. After changing the value of the argument of function of OpenCL called in own lib, I want to call a function of libOpenCL.so in own lib.

p_clCreateProgramWithBinary have called the function of the original libOpenCL. Because I changed the name of the original libOpenCL.so libOpenCLo.so.
I'm sorry for confusing you.

Thank you.
Back to top
View user's profile
SebD



Joined: 02 Jan 2008
Posts: 8

PostPosted: Mon Nov 19, 2012 5:50 am    Post subject: Reply with quote

Hi ckit,

One more question for you, are you trying to call your own lib from Java ?

Seb
Back to top
View user's profile
ckit



Joined: 16 Jul 2012
Posts: 7

PostPosted: Tue Nov 20, 2012 5:27 am    Post subject: Reply with quote

That's right.
I call the code below in Java.
Since I use JavaLibOpenCL of PGCL sample, the statement was written already.

System.loadLibrary ("OpenCL");

I have confirmed similar code using JNI on Ubuntu that will work with other SDK. So, I believe that there is no big mistake in this code.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group