C++ vector expression template library for OpenCL/CUDA
Classes | Functions | Variables
vex::Filter Namespace Reference

Device filters. More...


struct  Name
 Selects devices whose names match given value. More...
struct  CC
 Compute capability filter. More...
struct  Vendor
 Selects devices whose vendor name match given value. More...
struct  Platform
 Selects devices whose platform name match given value. More...
struct  Type
 Selects devices by type. More...
struct  Extension
 Selects devices providing given OpenCL extensions. More...
struct  Count
 Selects no more than given number of devices. More...
struct  Position
 Selects one device at the given position. More...
struct  General
 Runtime filter holder. More...


std::vector< std::function
< bool(const backend::device &)> > 
backend_env_filters ()
 List of device filters based on environment variables.
template<class Filter >
ExclusiveFilter Exclusive (Filter &&filter)
 Allows exclusive access to compute devices across several processes. More...
template<class LHS , class RHS >
FilterBinaryOp< FilterAnd > operator&& (LHS &&lhs, RHS &&rhs)
 Join two filters with AND operator.
template<class LHS , class RHS >
FilterBinaryOp< FilterOr > operator|| (LHS &&lhs, RHS &&rhs)
 Join two filters with OR operator.
template<class Filter >
NegateFilter operator! (Filter &&filter)
 Negate a filter.


const CC DoublePrecision (1, 3) = {}
 Selects devices supporting double precision.
const Extension GLSharing ("cl_khr_gl_sharing")
 Selects devices supporting OpenGL Sharing Extension.
const AnyFilter All = {}
 Selects any device. More...
const AnyFilter Any = {}
 Selects any device.
const EnvFilter Env
 Environment filter. More...

Detailed Description

Device filters.

Function Documentation

template<class Filter >
ExclusiveFilter vex::Filter::Exclusive ( Filter &&  filter)

Allows exclusive access to compute devices across several processes.

Returns devices that pass through provided device filter and are not locked.

filterCompute device filter
Depends on boost::interprocess library.

lock files are created in directory specified in VEXCL_LOCK_DIR environment variable. If the variable does not exist, /tmp is used on Linux and TMPDIR% on Windows. The lock directory should exist and be writable by the running user.

Variable Documentation

const AnyFilter vex::Filter::All = {}

Selects any device.

const EnvFilter vex::Filter::Env

Environment filter.

Selects devices with respect to environment variables. Recognized variables are:

  • OCL_PLATFORM – platform name;
  • OCL_VENDOR – device vendor;
  • OCL_DEVICE – device name;
  • OCL_TYPE – device type (CPU, GPU, ACCELERATOR);
  • OCL_MAX_DEVICES – maximum number of devices to use.
  • OCL_POSITION – devices position in the device list.
Since this filter possibly counts passed devices, it should be the last in filter expression. Same reasoning applies as in case of Filter::Count.