8000 adl/oct/cl: Create `adl::oct::cl::config` · Issue #70 · flisboac/adl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adl/oct/cl: Create adl::oct::cl::config #70

Open
flisboac opened this issue Jan 28, 2018 · 0 comments
Open

adl/oct/cl: Create adl::oct::cl::config #70

flisboac opened this issue Jan 28, 2018 · 0 comments

Comments

@flisboac
Copy link
Owner
flisboac commented Jan 28, 2018

A helper class to be used as a template to create contexts and open devices. It'll receive operators, DBM and constant types as a base for feature selection (by means of clGetPlatformInfo and clGetDevicetInfo).

Still needs to flesh out its nterface. Some ideas:

// Some custom type definitions
using my_constant_type = float_int;
using my_allocator = std::allocator<my_constant_type>;

auto config = cl::config()
	// Further refinements take into consideration the previous definitions' types.
	// The calls here have a specific path, that is:
	// - Context (by means of with_context)
	// - Constant Type (and its constant_limits)
	// - DBM type
	// - Operator type
	// The config object should be able to receive templates and automatically apply the
	// types provided in previous steps, and then convert those combinations into 
	// predicates to be used in clGetPlatformInfo and clGetDeviceInfo.
	// The user can initiate as many with_context (and its inner) paths as needed.
	// The resulting config object's type itself is not a template, and as such is not
	// parameterized or restricted by the types used in the with_ methods.
	.with_context<cl::context>(
		cl::with_constant_type<my_constant_type>(
			.with_dbm_type<cl::dense_dbm, my_allocator>()
			.with_oper<cl::add_cons_close_oper>()
		), // constant_type
		cl::with_constant_type<float>(
			cl::with_dbm_type<cl::dense_dbm /*, std::allocator<float> */>(
				cl::with_oper<cl::add_cons_close_oper>()
			) // dbm_type
		) // constant_type
	) // context
	// The user can pass in a direct verification of some device/platform property with a predicate
	.with_cl_platform([](platform_id) { ... })
	.with_cl_platform_param<CL_PLATFROM_...>([](value, /*optional*/ platform_id) { ... })
	.with_cl_platform_param<CL_PLATFROM_...>(value)
	.with_cl_device([](device_id) { ... })
	.with_cl_device_param<CL_DEVICE_...>([](value, /*optional*/ device_id) { ... })
	.with_cl_device_param<CL_DEVICE_...>(value)
	// The user can also add specific context properties. These will be used when opening 
        // the CL context
	.with_cl_context_properties(CL_CONTEXT_..., ...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
0