Quick Links
  • Homepage
        - Overview
        - Download
        - Screenshots
        - Community
  • Code Sample Pack
  • Reference Guide
  • Changelog
  • Overview of GLSL Hacker
  • Live Coding
  • Hack your first GLSL Code
  • Moon3D




  • GLSL Hacker Articles

    > Compute shaders on Radeon
    > Distance functions in GLSL
    > GLSL Interpolation Qualifiers
    > Tessellation Spacing Modes
    > Normal Visualizer with GS
    > 3D Surface Plots
    > Normal Mapping
    > Circle and Disc in GLSL
    > PhysX 3 Flag Demo
    > GLSL Hacker on Raspberry Pi
    GLSL Hacker

    Reference Guide
    Host-API Lua / Python



    Back to Homepage
    Back to Developer's Guide Index

    gh_opencl Library


    Description
    gh_opencl is the module that manages OpenCL functions.

    Number of functions: 6

    gh_opencl.get_num_platforms

    Description
    Returns the number of OpenCL platforms.

    Languages: Lua - Python

    Return Values
  • num_platforms [INTEGER]: number of OpenCL platforms.

    Code sample :

    num_platforms = gh_opencl.get_num_platforms()


    gh_opencl.get_platform_info

    Description
    Returns the main information about an OpenCL platform.

    Languages: Lua - Python

    Parameters
  • platform_index [INTEGER]: platform index.

    Return Values
  • vendor, name, version [STRING]: Vendor, name and version of the OpenCL platform.

    Code sample :

    vendor, name, version = gh_opencl.get_platform_info(0)


    gh_opencl.get_num_devices

    Description
    Returns the number of OpenCL devices of a particular platform.

    Languages: Lua - Python

    Parameters
  • platform_index [INTEGER]: platform index.

    Return Values
  • num_devices [INTEGER]: Number of OpenCL devices.

    Code sample :

    num_devices = gh_opencl.get_num_devices(0)


    gh_opencl.get_device_info

    Description
    Returns the identification information about an OpenCL device.

    Languages: Lua - Python

    Parameters
  • platform_index [INTEGER]: platform index.
  • device_index [INTEGER]: device index.

    Return Values
  • vendor, name, version [STRING]: Vendor, name and version of the OpenCL device.

    Code sample :

    vendor, name, version = gh_opencl.get_device_info(0, 0)


    gh_opencl.get_device_type

    Description
    Returns the type (GPU or CPU) of an OpenCL device.

    Languages: Lua - Python

    Parameters
  • platform_index [INTEGER]: platform index.
  • device_index [INTEGER]: device index.

    Return Values
  • type [INTEGER]: type: 1 (GPU) or 2 (CPU).

    Code sample :

    type = gh_opencl.get_device_type(0, 0)


    gh_opencl.get_device_compute_units_info

    Description
    Returns the information about a the compute units of an OpenCL device.

    Languages: Lua - Python

    Parameters
  • platform_index [INTEGER]: platform index.
  • device_index [INTEGER]: device index.

    Return Values
  • max_compute_units, clock_freq, flops [INTEGER]: max compute units, clock frequency in MHz, and FLOPS

    Code sample :

    max_compute_units, clock_freq, flops = gh_opencl.get_device_compute_units_info(0, 0)





  • (C)2012-2014 Geeks3D