Login  Register

Re: jocl.CLProgram.create() line 74

Posted by Michael Bien on Jan 15, 2011; 3:58am
URL: https://forum.jogamp.org/jocl-CLProgram-create-line-74-tp2250272p2260045.html

there are a few options how we could fix this issue.

(the main problem is that we can't pass a String down to OpenCL, we have to convert it first into char**. That is fine as long we can delete the char** right after the function returns)

e.g the quickest fix would be to switch from String to (direct) ByteBuffer for the source parameter and document it that the user is responsible to hold a reference on that buffer (and don't modify it) until the program is compiled. This is not very nice from the public api perspective thats why i would like to prevent that somehow.

it could quickly lead to bugs if the user would do things like:
ByteBuffer src = readSource1();
program1 = createProgramFromSource..
src = readSource2();
program2 = createProgramFromSource..

compile program1
compile program2

The high level binding would be less problematic since its statefull... but this would lead to additional copy of the sources in e.g CLProgram as ByteBuffer if we want to keep the CLProgram.create(String src) api. (Note: the driver stores the sources too...)

have to think about that...
any feedback appreciated.

-michael

On 01/15/2011 03:17 AM, Rick Lentz wrote:
Hi Michael,

  The only thing I thought about adding was Mac OS version (10.6.5).  Thank you again for your help.  I am not sure what options are available to address this issue.  If I can help by posting in the Apple Developer forums - or in another way, please let me know.

Best regards,

Rick Lentz

On Fri, Jan 14, 2011 at 11:26 AM, Michael Bien <[hidden email]> wrote:
the mailing list doesn't seem to accept my mails anymore... mail is attached..
feel free to add any info to the bug report if you like.

-michael

-------- Original Message --------
Subject: Re: jocl.CLProgram.create() line 74
Date: Fri, 14 Jan 2011 16:55:32 +0100
From: Michael Bien [hidden email]
To: Rick Lentz @ imagejdev.org [via jogamp] [hidden email]


thank you Rick, i filed a bug report and set its priority to blocker: https://jogamp.org/bugzilla/show_bug.cgi?id=458
(see description)

-michael

On 01/14/2011 04:35 PM, Rick Lentz @ imagejdev.org [via jogamp] wrote:
I tested on another Mac just to ensure that it was not a single case regarding APPLE.  Here is the console output /results (Failed):

OS: Mac OS X
ARCH: x86_64
VM: Java HotSpot(TM) 64-Bit Server VM
lib path: /Users/hinerm/Documents/workspace/OpenCLIterative3DDeconvolution/lib:/Users/hinerm/Documents/workspace/OpenCLIterative3DDeconvolution/lib/APPLE
CLContext [id: 4296115824, platform: Apple, profile: FULL_PROFILE, devices: 2]
OpenCL 1.0 (Aug 22 2010 18:08:16)
please ignore [Ljava.lang.String;@29c56c60PointerBuffer:AbstractBuffer[capacity 1, position 1, elementSize 8, ByteBuffer.capacity 8]
src:    __kernel vo
-> success


**JUnit reports the same error as above***


A third test was run on Ubuntu 9.10 x64.  This test passed:


OS: Linux
ARCH: amd64
VM: Java HotSpot(TM) 64-Bit Server VM
lib path: /home/chrysalisbiosciencesadmin/workspace/OpenCLIterative3DDeconvolution/lib:/home/chrysalisbiosciencesadmin/workspace/OpenCLIterative3DDeconvolution/lib/LINUX64:/home/chrysalisbiosciencesadmin/workspace/OpenCLIterative3DDeconvolution/lib/LINUX64
CLContext [id: 1093557648, platform: NVIDIA CUDA, profile: FULL_PROFILE, devices: 3]
OpenCL 1.0 CUDA 3.2.1
please ignore [Ljava.lang.String;@509ced8ePointerBuffer:AbstractBuffer[capacity 1, position 1, elementSize 8, ByteBuffer.capacity 8]
src:    __kernel void sobel( __global float* input, __global float* output, int width,  int height ) {    
       int x = get_global_id(0);  
       int y = get_global_id(1);  
       int offset = y * width + x;  
                                                               
         float p0, p1, p2, p3, p5, p6, p7, p8 = 0;            
                                                               
                                                               
              if( x < 1 || y < 1 || x > width - 2 || y > height - 2 )  
              {  
                 output[offset] = 0;  
              }  
              else  
              {  
                  p0 = input[offset - width - 1] ;  
                  p1 = input[offset - width] ;  
                  p2 = input[offset - width + 1] ;  
                  p3 = input[offset - 1] ;  
                  p5 = input[offset + 1] ;  
                  p6 = input[offset + width - 1] ;  
                  p7 = input[offset + width] ;  
                  p8 = input[offset + width + 1] ;  
   
                  float sum1 = p0 + 2*p1 + p2 - p6 - 2*p7 - p8;  //GY  
                  float sum2 = p0 + 2*p3 + p6 - p2 - 2*p5 - p8;  //GX  
   
                  output[offset] = sqrt(  sum1*sum1 + sum2*sum2 );  
              }  
      }  
-> success




View message @ http://jogamp.762907.n3.nabble.com/jocl-CLProgram-create-line-74-tp2250272p2256102.html
To start a new topic under jogamp, email [hidden email]
To unsubscribe from jogamp, click here.

-- 
http://michael-bien.com/



-- 
http://michael-bien.com/