Compute Library
 22.05
Context Class Reference

Context classAvailable tuning modes. More...

#include <Acl.hpp>

Collaboration diagram for Context:
[legend]

Data Structures

struct  Options
 < Context options More...
 

Public Member Functions

 Context (Target target, StatusCode *status=nullptr)
 Constructor. More...
 
 Context (Target target, const Options &options, StatusCode *status=nullptr)
 Constructor. More...
 
- Public Member Functions inherited from ObjectBase< AclContext_ >
 ~ObjectBase ()=default
 Destructor. More...
 
 ObjectBase (const ObjectBase< AclContext_ > &)=default
 Copy constructor. More...
 
 ObjectBase (ObjectBase< AclContext_ > &&)=default
 Move Constructor. More...
 
ObjectBase< AclContext_ > & operator= (const ObjectBase< AclContext_ > &)=default
 Copy assignment operator. More...
 
ObjectBase< AclContext_ > & operator= (ObjectBase< AclContext_ > &&)=default
 Move assignment operator. More...
 
void reset (AclContext_ *val)
 Reset object value. More...
 
const AclContext_get () const
 Access uderlying object. More...
 
AclContext_get ()
 Access uderlying object. More...
 

Detailed Description

Context classAvailable tuning modes.

Context acts as a central aggregate service for further objects created from it. It provides, internally, common facilities in order to avoid the use of global statically initialized objects that can lead to important side-effect under specific execution contexts.

For example context contains allocators for object creation, for further backing memory allocation, any serialization interfaces and other modules that affect the construction of objects, like program caches for OpenCL.

Definition at line 317 of file Acl.hpp.

Constructor & Destructor Documentation

◆ Context() [1/2]

Context ( Target  target,
StatusCode status = nullptr 
)
inlineexplicit

Constructor.

Note
Serves as a simpler delegate constructor
As context options, default conservative options will be used
Parameters
[in]targetTarget to create context for
[out]statusStatus information if requested

Definition at line 375 of file Acl.hpp.

376  : Context(target, Options(), status)
377  {
378  }
Context(Target target, StatusCode *status=nullptr)
Constructor.
Definition: Acl.hpp:375

◆ Context() [2/2]

Context ( Target  target,
const Options options,
StatusCode status = nullptr 
)
inline

Constructor.

Parameters
[in]targetTarget to create context for
[in]optionsContext construction options
[out]statusStatus information if requested

Definition at line 385 of file Acl.hpp.

References AclCreateContext(), and Context::Options::copts.

386  {
387  AclContext ctx;
388  const auto st = detail::as_enum<StatusCode>(AclCreateContext(&ctx, detail::as_cenum<AclTarget>(target), &options.copts));
389  reset(ctx);
390  report_status(st, "[Compute Library] Failed to create context");
391  if(status)
392  {
393  *status = st;
394  }
395  }
void reset(AclContext_ *val)
Reset object value.
Definition: Acl.hpp:148
AclStatus AclCreateContext(AclContext *ctx, AclTarget target, const AclContextOptions *options)
__cplusplus
Definition: AclContext.cpp:78

The documentation for this class was generated from the following file: