203 virtual void*
memCalloc(
const size_t num,
const size_t size) = 0;
An execution abstraction of a Device object.
virtual Result createJobForceAsync(const uint32_t numSub, const AsyncCallback &callback, void *arg, uint32_t timeout=0)=0
Creates a new job with the specified number of sub asynchronously.
Context(const Context &)=delete
Deleted copy constructor.
virtual void * memCalloc(const size_t num, const size_t size)=0
Allocates zero-initialized memory on the device.
virtual Result destroyJob(Job *job)=0
Destroys the specified job.
virtual void * memAlloc(const size_t size)=0
Allocates memory on the device.
virtual uint32_t availableSubCount() const =0
Returns the available number of Sub.
virtual void memFree(const void *ptr)=0
Frees previously allocated memory on the device.
virtual uint32_t deviceId() const =0
Returns the ID of the device.
virtual Job * createJob(const uint32_t numSub)=0
Creates a new job with the specified number of sub.
virtual uint64_t availableMemSize() const =0
Returns the available memory size of the device.
virtual void * memRealloc(void *ptr, const size_t size)=0
Resizes previously allocated device memory.
virtual Result getAttribute(DeviceAttr attr, uint64_t &value) const =0
Returns information about the device attribute.
virtual Job * createJob()=0
Creates a new job with the default number of sub.
std::function< void(Job *job, void *arg)> AsyncCallback
Callback function type for job creation.
Context & operator=(const Context &)=delete
Deleted copy assignment operator.
virtual ~Context()=default
Manages device compute resources and offloads user applications.
void destroyContext(Context *context)
Destroys the specified context.
void clearDefaultDeviceId()
Clears the cached default device ID.
uint32_t getNumDevice()
Retrieves the number of available devices.
std::optional< uint32_t > getDefaultDeviceId()
Returns the current process-wide default device ID.
uint32_t availableSubCount(uint32_t deviceId)
Returns the number of currently available compute resources (Subs) on a device, without creating a Co...
Context * createContext()
Creates a context. Defaults to the first available device.