Reply – Re: putUnmapMemory - compile error
Your Name
Subject
Message
or Cancel
In Reply To
Re: putUnmapMemory - compile error
— by Michael Bien Michael Bien
  Hi,

the current usage is:
ByteBuffer mapped = queue.putMapMemory(clBuffer);
//...
queue.putUnmapMemory(clBuffer, mapped);


OpenCL requires the OpenCL buffer and the pointer to the mapped memory
for the unmap operation. Long time ago the method was indeed
only putUnmapMemory(clBuffer) but it required to create a clone of the
clBuffer which was IMO to confusing.

very old version:
ByteBuffer mapped = queue.putMapMemory(clBuffer);
//...
queue.putUnmapMemory(clBuffer.cloneWith(mapped));

best regards,
michael

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

On 06/28/2011 02:31 PM, suleman [via jogamp] wrote:

>
> Hi,
>
> I am trying to use putMapBuffers, program work OK when i donot use
> "putUnmapMemory" calls, when i use those calls (as shown in following code)
> Java compiler complains:
>
> memTest]$ javac *.java
> MemTest.java:102: cannot find symbol
> symbol  : method putUnmapMemory(com.jogamp.opencl.CLBuffer<capture#107 of
> ?>)
> location: class com.jogamp.opencl.CLCommandQueue
>                  queue.putUnmapMemory(clBufferA);
>                       ^
> MemTest.java:103: cannot find symbol
> symbol  : method putUnmapMemory(com.jogamp.opencl.CLBuffer<capture#645 of
> ?>)
> location: class com.jogamp.opencl.CLCommandQueue
>                  queue.putUnmapMemory(clBufferB);
>                       ^
> MemTest.java:104: cannot find symbol
> symbol  : method putUnmapMemory(com.jogamp.opencl.CLBuffer<capture#65 of
> ?>)
> location: class com.jogamp.opencl.CLCommandQueue
>                  queue.putUnmapMemory(clBufferC);
>                       ^
> 3 errors
>
>
> Program code
> ------------------------------------------
> ....
>   CLBuffer<?>  clBufferA = context.createBuffer((globalWorkSize*4),
> Mem.READ_ONLY, ALLOCATE_BUFFER);
>   CLBuffer<?>  clBufferB = context.createBuffer((globalWorkSize*4),
> Mem.READ_ONLY, ALLOCATE_BUFFER);
>   CLBuffer<?>  clBufferC = context.createBuffer((globalWorkSize*4),
> Mem.WRITE_ONLY, ALLOCATE_BUFFER);
> .....
> ByteBuffer h_data1 = queue.putMapBuffer(clBufferA,WRITE,true);
> ByteBuffer h_data2 = queue.putMapBuffer(clBufferB,WRITE,true);
> queue.put1DRangeKernel(kernel, 0, globalWorkSize, localWorkSize);
> ByteBuffer h_data3 = queue.putMapBuffer(clBufferC,READ,true);
>
> queue.putUnmapMemory(clBufferA);
> queue.putUnmapMemory(clBufferB);
> queue.putUnmapMemory(clBufferC);
>