1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//! # [![](http://meritbadge.herokuapp.com/ocl)](https://crates.io/crates/ocl) | [GitHub](https://github.com/cogciprocate/ocl)
//!
//! Rust implementation of OpenCL™.
//!
//! This documentation is sometimes built from the [`dev` branch](https://github.com/cogciprocate/ocl/tree/dev) and may occasionally differ slightly from what is on crates.io and the master branch. 
//!
//! Documentation is very much a work in progress, as is the library itself. Please help by filing an [issue](https://github.com/cogciprocate/ocl/issues) about unclear and/or incomplete documentation and it will be addressed.
//!
//! An explanation of how dimensions and sizes of buffers and work queues are intended 
//! to be used will be coming as soon as a few more things are ironed out. Until then please see the [examples].
//!
//!
//! ## Low Level Interfaces
//!
//! For lower level interfaces and to use OpenCL features that have not yet been implemented on the top-level interface types, see the [`core`] and [`cl_h`] modules.
//!
//!
//! ## Help Wanted
//!
//! Please help complete any functionality you may need by filing an 
//! [issue] or creating a [pull request](https://github.com/cogciprocate/ocl/pulls).
//!
//! <br/>
//! *“OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos.”*

//!
//! [issue]: https://github.com/cogciprocate/ocl/issues
//! [`core`]: /ocl/ocl/core/index.html
//! [`cl_h`]: /ocl/ocl/cl_h/index.html
//! [`Result`]: /ocl/ocl/type.Result.html
//! [examples]: https://github.com/cogciprocate/ocl/tree/master/examples

// #![warn(missing_docs)]
// #![feature(zero_one)]
// #![feature(question_mark)]
// #![feature(stmt_expr_attributes)]

#[macro_use] extern crate enum_primitive;
#[macro_use] extern crate bitflags;
extern crate libc;
extern crate num;
extern crate rand;

pub mod util;
#[cfg(test)] mod tests;
mod standard;
mod error;
pub mod core;
pub mod cl_h;

pub use standard::{Platform, Device, Context, Program, Queue, Kernel, Buffer, Image, Event, 
	EventList, Sampler, SpatialDims, ProQue};
pub use self::error::{Error, Result};


pub mod traits {
	//! Commonly used traits.
	pub use standard::{WorkDims, MemLen};
	pub use core::OclPrm;
}

pub mod builders {
	//! Builders and associated settings-related types.

	pub use standard::{ContextBuilder, BuildOpt, ProgramBuilder, ImageBuilder, ProQueBuilder,
		DeviceSpecifier, BufferCmd, BufferCmdKind, BufferCmdDataShape, 
		ImageCmd, ImageCmdKind, KernelCmd};
	pub use core::{ImageFormat, ImageDescriptor, ContextProperties};
	// #[cfg(not(release))] pub use standard::BufferTest;
}

pub mod flags {
	//! Bitflags for various parameter types.

	pub use core::{
		// cl_device_type - bitfield 
		DeviceType, DEVICE_TYPE_DEFAULT, DEVICE_TYPE_CPU, DEVICE_TYPE_GPU, DEVICE_TYPE_ACCELERATOR,
			DEVICE_TYPE_CUSTOM, DEVICE_TYPE_ALL,
		// cl_device_fp_config - bitfield
		DeviceFpConfig, FP_DENORM, FP_INF_NAN, FP_ROUND_TO_NEAREST, FP_ROUND_TO_ZERO, 
			FP_ROUND_TO_INF, FP_FMA, FP_SOFT_FLOAT, FP_CORRECTLY_ROUNDED_DIVIDE_SQRT,
		// cl_device_exec_capabilities - bitfield
		DeviceExecCapabilities, EXEC_KERNEL, EXEC_NATIVE_KERNEL,
		// cl_command_queue_properties - bitfield
		CommandQueueProperties, QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, QUEUE_PROFILING_ENABLE,
		// cl_device_affinity_domain
		DeviceAffinityDomain, DEVICE_AFFINITY_DOMAIN_NUMA, DEVICE_AFFINITY_DOMAIN_L4_CACHE, 
			DEVICE_AFFINITY_DOMAIN_L3_CACHE, DEVICE_AFFINITY_DOMAIN_L2_CACHE, 
			DEVICE_AFFINITY_DOMAIN_L1_CACHE, DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE,
		// cl_mem_flags - bitfield
		MemFlags, MEM_READ_WRITE, MEM_WRITE_ONLY, MEM_READ_ONLY, MEM_USE_HOST_PTR, 
			MEM_ALLOC_HOST_PTR, MEM_COPY_HOST_PTR, MEM_HOST_WRITE_ONLY, MEM_HOST_READ_ONLY, 
			MEM_HOST_NO_ACCESS,
		// cl_mem_migration_flags - bitfield
		MemMigrationFlags, MIGRATE_MEM_OBJECT_HOST, MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED,
		// cl_map_flags - bitfield
		MapFlags, MAP_READ, MAP_WRITE, MAP_WRITE_INVALIDATE_REGION,
		// cl_program_binary_type
		ProgramBinaryType, PROGRAM_BINARY_TYPE_NONE, PROGRAM_BINARY_TYPE_COMPILED_OBJECT, 
			PROGRAM_BINARY_TYPE_LIBRARY, PROGRAM_BINARY_TYPE_EXECUTABLE,
		// cl_kernel_arg_type_qualifer 
		KernelArgTypeQualifier, KERNEL_ARG_TYPE_NONE, KERNEL_ARG_TYPE_CONST, 
			KERNEL_ARG_TYPE_RESTRICT, KERNEL_ARG_TYPE_VOLATILE,	
	};
}

pub mod enums {
	//! Enumerators for settings and information requests.

	pub use standard::{DeviceSpecifier, BufferCmdKind, BufferCmdDataShape};

	// API enums.
	pub use core::{ImageChannelOrder, ImageChannelDataType, Cbool, Polling, PlatformInfo,
		DeviceInfo, DeviceMemCacheType, DeviceLocalMemType, ContextInfo,
		ContextInfoOrPropertiesPointerType, PartitionProperty, CommandQueueInfo, ChannelType, 
		MemObjectType, MemInfo, ImageInfo, AddressingMode, FilterMode, SamplerInfo, ProgramInfo,
		ProgramBuildInfo, BuildStatus, KernelInfo, KernelArgInfo, KernelArgAddressQualifier, 
		KernelArgAccessQualifier, KernelWorkGroupInfo, EventInfo, CommandType, 
		CommandExecutionStatus, BufferCreateType, ProfilingInfo};

	// Custom enums.
	pub use core::{KernelArg, ContextProperty, PlatformInfoResult, DeviceInfoResult, 
		ContextInfoResult, CommandQueueInfoResult, MemInfoResult, ImageInfoResult, 
		SamplerInfoResult, ProgramInfoResult, ProgramBuildInfoResult, KernelInfoResult, 
		KernelArgInfoResult, KernelWorkGroupInfoResult, EventInfoResult, ProfilingInfoResult};

	// Error status.
	pub use cl_h::Status;
}