Changeset 7577


Ignore:
Timestamp:
01/22/11 11:44:22 (9 years ago)
Author:
rlentz
Message:

Michael Bien created a work around that allowed JOCL to work around a bug specific to OSX OpenCL implementation.

Now when clCreateProgramWithSource is called by the high level JOCL API, the call blocks and the call blocks.

Updates were made in the project's libs.

Location:
branches/maven/projects/opencl-decon
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/maven/projects/opencl-decon/.classpath

    r7533 r7577  
    1010        <classpathentry exported="true" kind="lib" path="lib/ij.jar" sourcepath="/home/loci/workspace/imagej/src/ij"/> 
    1111        <classpathentry exported="true" kind="lib" path="lib/hessian-4.0.7.jar" sourcepath="lib/hessian-4.0.7-src.jar"/> 
    12         <classpathentry exported="true" kind="lib" path="lib/jocl.jar"> 
    13                 <attributes> 
    14                         <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="OpenCLIterative3DDeconvolution/lib/LINUX64"/> 
    15                 </attributes> 
    16         </classpathentry> 
    1712        <classpathentry kind="lib" path="lib/hessian-4.0.7-src.jar"/> 
    1813        <classpathentry exported="true" kind="lib" path="lib/gluegen.jar"/> 
    1914        <classpathentry exported="true" kind="lib" path="lib/gluegen-rt.jar"/> 
    20         <classpathentry exported="true" kind="lib" path="lib/LINUX64/JOCL-0.1.4-beta1.jar"> 
     15        <classpathentry exported="true" kind="lib" path="lib/APPLE/JOCL-0.1.4-beta1.jar"> 
    2116                <attributes> 
    22                         <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="OpenCLIterative3DDeconvolution/lib/LINUX64"/> 
     17                        <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="OpenCLIterative3DDeconvolution/lib/APPLE"/> 
    2318                </attributes> 
    2419        </classpathentry> 
     20        <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> 
     21        <classpathentry kind="lib" path="lib/APPLE/jocl.jar"/> 
    2522        <classpathentry kind="output" path="bin"/> 
    2623</classpath> 
  • branches/maven/projects/opencl-decon/src/demos/SobelFilterExample.java

    r7533 r7577  
    88import java.nio.ByteOrder; 
    99import java.nio.FloatBuffer; 
     10import java.nio.IntBuffer; 
    1011 
    1112import javax.imageio.ImageIO; 
     
    1314import org.imagejdev.api.StreamToString; 
    1415 
    15 import com.jogamp.common.os.Platform; 
     16import com.jogamp.common.nio.Buffers; 
     17import com.jogamp.common.nio.PointerBuffer; 
     18import com.jogamp.opencl.CL; 
    1619import com.jogamp.opencl.CLBuffer; 
    1720import com.jogamp.opencl.CLCommandQueue; 
    1821import com.jogamp.opencl.CLContext; 
    19 import com.jogamp.opencl.CLErrorHandler; 
    2022import com.jogamp.opencl.CLDevice.Type; 
     23import com.jogamp.opencl.CLException; 
    2124import com.jogamp.opencl.CLKernel; 
    2225import com.jogamp.opencl.CLMemory.Mem; 
     
    5861        {;} 
    5962         
    60         public synchronized SobelFilterExample init( int w, int h, boolean printDebugStatements, String openCLCodeString ) throws IOException 
     63    private final void checkError(String msg, int ret) { 
     64        if(ret != org.jocl.CL.CL_SUCCESS)  //to CLs org.jocl and com.jogamp.opencl 
     65            throw CLException.newException( ret, msg ); 
     66    } 
     67 
     68         
     69        public synchronized SobelFilterExample init( int w, int h, boolean printDebugStatements, final String openCLCodeString ) throws IOException 
    6170        { 
    6271                //Create a context from GPU 
    6372                context = CLContext.create( Type.GPU ); 
    64                  
     73         
    6574                // create the program 
    66                 program = context.createProgram( openCLCodeString ).build( "" ); 
    67                  
     75                program = context.createProgram( openCLCodeString ); 
     76                 
     77                //System.out.println( "Gotz srzs ?" +  program.getSource()); 
     78                program.build(); 
     79             
    6880                // Display java.libary.path -Djava.library.path="" 
    6981                if( DEBUG )  System.out.println(" Java.library.path is " + System.getProperty("java.library.path")); 
     
    101113                kernel.setArg( 2, imageWidth ); 
    102114                kernel.setArg( 3, imageHeight ); 
    103                  
     115 
    104116                return this; 
    105117        } 
     
    175187                int testHeight = image.getHeight(null); 
    176188                 
    177                  
    178                  
     189         
    179190                // get the OpenCL code 
    180191                String openCLCodeString = null; 
    181192                try { 
    182                         openCLCodeString = StreamToString.getString( SobelFilterExample.class.getResourceAsStream("sobel.cl"), true ); 
     193                        openCLCodeString = StreamToString.getString( SobelFilterExample.class.getResourceAsStream("sobel.cl"), false ); 
    183194                } catch (Exception e1) { 
    184195                        // TODO Auto-generated catch block 
    185196                        e1.printStackTrace(); 
    186197                } 
    187  
     198                 
     199                //if ( DEBUG ) System.out.println( openCLCodeString ); 
     200                 
    188201                final int numVariables = 4; 
    189202                final int numIterations = 1; 
     
    208221 
    209222 
    210         public static synchronized void runTest( Image image, int numIterations, long[] totalTime, String openCLCodeString, int testWidth, int testHeight ) 
     223        public static synchronized void runTest( Image image, int numIterations, long[] totalTime, final String openCLCodeString, int testWidth, int testHeight ) 
    211224        { 
    212225 
Note: See TracChangeset for help on using the changeset viewer.