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

Several updates to clarify the examples provided to enable OpenCL functionality from ImageJ.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/maven/projects/opencl-decon/README

    r7501 r7504  
    1 This code was developed to show how to use JOCL to leverage OpenCL within ImageJ both on the machine 
    2 ImageJ is running from as well as remotely, using binary web services. 
     1( Please ensure installation of OpenCL prior to running these programs ) 
     2The source at http://dev.loci.wisc.edu/svn/software/branches/maven/projects/opencl-decon was developed to demonstrate successful leveraging of OpenCL within ImageJ using JOCL both locally andÊremotely (as a binary web service). 
    33 
    4 src - Java and OpenCL source files 
    5 sourcedata - PSF and 3D data used as a very small sample data set for the FHT3D Example. 
     4The folder structure of the source consists of the following folders: 
     5src - Java and OpenCL source files (extension .cl) 
     6sourcedata - PSF and 3D data used as a small sample data set for the FHT3D Example. 
    67lib - libraries needed for classes using JOCL, ImageJ, and Hessian 4.0.7 
     8native - contains the dynamic libraries needed for runtime execution for various operating systems 
    79 
    810There are several components available in this project to demonstrate various capabilities for use within ImageJ. 
     11To use OpenCL from Java in ImageJ we leverage JOCL. ÊJOCL uses JNI to make calls into the OpenCL API. ÊThe OpenCL code you write can also leverage JOCL to accelerate execution ofÊImageJ plugins from Java. 
    912 
    10 //Please ensure you have installed OpenCL and successfully run at least one included GUI based example 
     13Notice the files fht.cl and sobel.cl in the source (src) directory. ÊThe Java code in provided in the examples compile these two files for execution on the OpenCL enabled device that is programmatically chosen at runtime.  It is runtime compilation of OpenCL that allows execution on any potential OpenCL enabled device. 
    1114 
    12 Setup: Install OpenCL for your host machine. 
     15Start exploring the examples by viewing the file SobelFilterExample.java. ÊNotice the Main() method calls run() which use an awt.Image type as an input parameter. ÊModify and run the Main() method as Java Application with VM Arguments -Xmx1024m.Ê 
    1316 
    14 To OpenCL files from Java we use JOCL which enables development of OpenCL plugins for ImageJ. 
    15   Look in the source (src) directory and note the location of fht.cl and sobel.cl.  These files are referenced at runtime and 
    16   compiled for execution by an OpenCL enabled device.   
    17   Start with SobelFilterExample.java and run as Java Application with VM Arguments -Xmx1024m.  
    18   The program will load an image from a web server, process it locally using OpenCL, and display the results.  This action 
    19   acts as a test/control gate to ensure configuration of JOCL and OpenCL native libraries.  Modify this example 
    20   to suite your needs, but be sure JOCL and OpenCL are working correctly before proceeding. 
    21   
    22 Working with ImageJ: If developing an ImageJ plugin using OpenCL realize that the runtime logic can be placed in the run(String) method. 
    23 JOCL jars and native libraries for the target platform will need to be available for JOCL to make calls into the OpenCL libraries installed on the runtime host. 
    24    
    25 Now that you have called OpenCL from Java on your platform. You might have a compute intensive portion of 
    26 a processing pipeline that you may wish to port to OpenCL.  The FHT3D_3D_Deconvolution.java class demonstrates calling OpenCL to perform 
    27 a portion of the processing required from within a complex implementation. 
     17ÊÊWithout modification,ÊSobelFilterExample.javaÊloads an image from a web server, process it locally using OpenCL, and displays the results. ÊThere is nothing novel about this example. ÊIt simply allows runtime testing ofÊseveral system configuration stepsÊto ensure working configuration of JOCL and OpenCL native libraries.Ê Modify this example to suite your needs, but please ensure proper JOCL and OpenCL configuration before proceeding. 
     18Ê 
     19Working within ImageJ: If developing an ImageJ plugin using OpenCL realize that programatic control is passed to your plugin inside the PlugIn (or PluginFilter) run() method.  Thus an example of this can be found in src.demos.OpenCL_SobelFilter.java.  For this plugin to run within ImageJ, the JOCL jars and native libraries respective to the target platform will need to be available by the ImageJ classloader.   The supporting JOCL native libraries can be copied into the plugin directory within ImageJ to allow plugin implementations using OpenCL from Java to reference the installed native libraries provided by the OpenCL installation. Ê 
    2820 
    29 Finally, the need may arise where the GPU compute capabilities you wish to leverage are not on the same computer that ImageJ is running on.  The FHTEJBService and 
    30 Iterative_Deconvolve_3D_WS classes demonstrate how to remotely serve up the functionality leveraging standard, open source J2EE technologies. 
     21Now that you have a working example of an OpenCL ImageJ plugin (running from Java on your platform). You may wish to see an a compute intensive example demonstrating modification of an existing Java implementation that delegates a portion of the implementation to OpenCL.Ê Take a look at the developer comments (//xyz) in the FHT3D_3D_Deconvolution.java example to see what steps are used to brokering of data between Java and OpenCL portions of a complex implementation. 
    3122 
    32  
    33  
    34  
    35    
     23Finally, the need may arise where the GPU compute capabilities you wish to leverage are not on the same computer that ImageJ is running on.Ê The FHTEJBService and Iterative_Deconvolve_3D_WS classes demonstrate how to remotely serve up the functionality leveraging standard, open source J2EE technologies.  
Note: See TracChangeset for help on using the changeset viewer.