Module Devices


module Devices: sig .. end


type dim3 = {
   x : int;
   y : int;
   z : int;
}
val cuda_init : unit -> unit
val cl_init : unit -> unit

type specificLibrary =
| Cuda
| OpenCL
| Both
type context 

type generalInfo = {
   name : string;
   totalGlobalMem : int;
   localMemSize : int;
   clockRate : int;
   totalConstMem : int;
   multiProcessorCount : int;
   eccEnabled : bool;
   specific : specificLibrary;
   id : int;
   ctx : context;
}
type cudaInfo = {
   major : int;
   minor : int;
   regsPerBlock : int;
   warpSize : int;
   memPitch : int;
   maxThreadsPerBlock : int;
   maxThreadsDim : dim3;
   maxGridSize : dim3;
   textureAlignment : int;
   deviceOverlap : bool;
   kernelExecTimeoutEnabled : bool;
   integrated : bool;
   canMapHostMemory : bool;
   computeMode : int;
   concurrentKernels : bool;
   pciBusID : int;
   pciDeviceID : int;
}
type platformInfo = {
   platform_profile : string;
   platform_version : string;
   platform_name : string;
   platform_vendor : string;
   platform_extensions : string;
   num_devices : int;
}
type deviceType =
| CL_DEVICE_TYPE_CPU
| CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
| CL_DEVICE_TYPE_DEFAULT

type clDeviceFPConfig =
| CL_FP_DENORM
| CL_FP_INF_NAN
| CL_FP_ROUND_TO_NEAREST
| CL_FP_ROUND_TO_ZERO
| CL_FP_ROUND_TO_INF
| CL_FP_FMA
| CL_FP_NONE

type clDeviceQueueProperties =
| CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
| CL_QUEUE_PROFILING_ENABLE

type clDeviceGlobalMemCacheType =
| CL_READ_WRITE_CACHE
| CL_READ_ONLY_CACHE
| CL_NONE

type clDeviceLocalMemType =
| CL_LOCAL
| CL_GLOBAL

type clDeviceExecutionCapabilities =
| CL_EXEC_KERNEL
| CL_EXEC_NATIVE_KERNEL
type clDeviceID 

type openCLInfo = {
   platform_info : platformInfo;
   device_type : deviceType;
   profile : string;
   version : string;
   vendor : string;
   extensions : string;
   vendor_id : int;
   max_work_item_dimensions : int;
   address_bits : int;
   max_mem_alloc_size : int;
   image_support : bool;
   max_read_image_args : int;
   max_write_image_args : int;
   max_samplers : int;
   mem_base_addr_align : int;
   min_data_type_align_size : int;
   global_mem_cacheline_size : int;
   global_mem_cache_size : int;
   max_constant_args : int;
   endian_little : bool;
   available : bool;
   compiler_available : bool;
   single_fp_config : clDeviceFPConfig;
   global_mem_cache_type : clDeviceGlobalMemCacheType;
   queue_properties : clDeviceQueueProperties;
   local_mem_type : clDeviceLocalMemType;
   double_fp_config : clDeviceFPConfig;
   max_constant_buffer_size : int;
   execution_capabilities : clDeviceExecutionCapabilities;
   half_fp_config : clDeviceFPConfig;
   max_work_group_size : int;
   image2D_max_height : int;
   image2D_max_width : int;
   image3D_max_depth : int;
   image3D_max_height : int;
   image3D_max_width : int;
   max_parameter_size : int;
   max_work_item_size : dim3;
   prefered_vector_width_char : int;
   prefered_vector_width_short : int;
   prefered_vector_width_int : int;
   prefered_vector_width_long : int;
   prefered_vector_width_float : int;
   prefered_vector_width_double : int;
   profiling_timer_resolution : int;
   driver_version : string;
   device_id : clDeviceID;
}
type specificInfo =
| CudaInfo of cudaInfo
| OpenCLInfo of openCLInfo
| OtherInfo

type device = {
   general_info : generalInfo;
   specific_info : specificInfo;
}
val get_cuda_compatible_devices : unit -> int
val get_opencl_compatible_devices : unit -> int
val get_cuda_device : int -> device
val get_opencl_device : int -> int -> device
val cuda_compatible_devices : int Pervasives.ref
val opencl_compatible_devices : int Pervasives.ref
val total_num_devices : int Pervasives.ref
val current_cuda_device : int Pervasives.ref
val current_opencl_device : int Pervasives.ref
val is_available : int -> bool
val init : ?only:specificLibrary -> unit -> device array
val cuda_devices : unit -> int
val opencl_devices : unit -> int
val gpgpu_devices : unit -> int
val cuda_flush : generalInfo -> unit
val opencl_flush : generalInfo -> int -> unit
val flush : device -> ?queue_id:int -> unit -> unit
val hasCLExtension : device -> string -> bool