Module ocl_core::types::abs [] [src]

Abstract data type wrappers.

Reference

The following table describes abstract data types supported by OpenCL (from SDK):

  • cl_platform_id: The ID for a platform.
  • cl_device_id: The ID for a device.
  • cl_context: A context.
  • cl_command_queue: A command queue.
  • cl_mem: A memory object.
  • cl_program: A program.
  • cl_kernel: A kernel.
  • cl_event: An event.
  • cl_sampler: A sampler.

The following new derived wrappers are also included in this module:

  • cl_events: A list of events.

Who cares. Why bother?

These types ensure as best they can that stored pointers to any of the above objects will be valid until that pointer is dropped by the Rust runtime (which obviously is not a 100% guarantee).

What this means is that you can share, clone, store, and throw away these types, and any types that contain them, among multiple threads, for as long as you'd like, with an insignificant amount of overhead, without having to worry about the dangers of dereferencing those types later on. As good as the OpenCL library generally is about this, it fails in many cases to provide complete protection against segfaults due to dereferencing old pointers particularly on certain ahem platforms.

Structs

CommandQueue

cl_command_queue

Context

cl_context

DeviceId

cl_device_id

Event

cl_event

EventRefWrapper

Wrapper used by EventList to send event pointers to core functions cheaply.

Kernel

cl_kernel

Mem

cl_mem

MemMap

A pointer to a region of mapped (pinned) memory.

PlatformId

cl_platform_id

Program

cl_program

Sampler

cl_sampler

Traits

AsMem

AsRef with a type being carried along for convenience.

ClContextPtr

Types with a copy of a context pointer.

ClDeviceIdPtr

Types with a reference to a raw device_id pointer.

ClEventPtrRef

Types with a reference to a raw event pointer.

ClNullEventPtr

Types with a mutable pointer to a new, null raw event pointer.

ClPlatformIdPtr

Types with a reference to a raw platform_id pointer.

ClVersions

Types with a fixed set of associated devices and an associated platform.

ClWaitListPtr

Types with a reference to a raw event array and an associated element count.

MemCmdAll

Types which can be passed to any and all ::enqueue_... functions as the primary (ptr) argument and can also be passed as kernel cl_mem arguments.

MemCmdRw

Types which can be passed as the primary (ptr) argument value to ::enqueue_read_buffer, ::enqueue_write_buffer, ::enqueue_read_buffer_rect, ::enqueue_write_buffer_rect, ::enqueue_read_image, or ::enqueue_write_image.