The Tutorial and API Reference of VEDA  2.11.1
VEDA API

To use VEDA API functions, include "veda.h" header. More...

Functions

VEDAresult vedaInit (uint32_t Flags)
 Initialize the VEDA driver API library. More...
 
VEDAresult vedaExit (void)
 Releases the VEDA driver API library gracefully. More...
 
VEDAresult vedaDriverGetVersion (const char **str)
 Return the latest AVEO version supported by VEDA. More...
 
VEDAresult vedaLaunchKernel (VEDAfunction f, VEDAstream stream, VEDAargs args)
 Enqueues a VEDA device function f on the VEDA device. More...
 
VEDAresult vedaLaunchKernelEx (VEDAfunction f, VEDAstream stream, VEDAargs args, const int destroyArgs, const int Checkresult)
 Enqueues a VEDA device function f on the VEDA device with flexibility. More...
 
VEDAresult vedaLaunchHostFunc (VEDAstream stream, VEDAhost_function fn, void *userData)
 Enqueues a host function call in a stream. More...
 
VEDAresult vedaArgsCreate (VEDAargs *args)
 Instantiate the VEDA function argument handler. More...
 
VEDAresult vedaArgsDestroy (VEDAargs args)
 Destroy the VEDA function argument handler. More...
 
VEDAresult vedaArgsSetI8 (VEDAargs args, const int idx, const int8_t value)
 Initialize the VEDA function arguments for 8 bit integer value. More...
 
VEDAresult vedaArgsSetI16 (VEDAargs args, const int idx, const int16_t value)
 Initialize the VEDA function arguments for 16 bit integer value. More...
 
VEDAresult vedaArgsSetI32 (VEDAargs args, const int idx, const int32_t value)
 Initialize the VEDA function arguments for 32 bit integer value. More...
 
VEDAresult vedaArgsSetI64 (VEDAargs args, const int idx, const int64_t value)
 Initialize the VEDA function arguments for 64 bit integer value. More...
 
VEDAresult vedaArgsSetU8 (VEDAargs args, const int idx, const uint8_t value)
 Initialize the VEDA function arguments for 8 bit unsigned integer value. More...
 
VEDAresult vedaArgsSetU16 (VEDAargs args, const int idx, const uint16_t value)
 Initialize the VEDA function arguments for 16 bit unsigned integer value. More...
 
VEDAresult vedaArgsSetU32 (VEDAargs args, const int idx, const uint32_t value)
 Initialize the VEDA function arguments for 32 bit unsigned integer value. More...
 
VEDAresult vedaArgsSetU64 (VEDAargs args, const int idx, const uint64_t value)
 Initialize the VEDA function arguments for 64 bit unsigned integer value. More...
 
VEDAresult vedaArgsSetHMEM (VEDAargs args, const int idx, const void *value)
 Initialize the VEDA function arguments by converting the heterogeneous memory address to VEDA device memory address. More...
 
VEDAresult vedaArgsSetPtr (VEDAargs args, const int idx, const VEDAdeviceptr value)
 Initialize the VEDA function arguments as a device memory location. More...
 
VEDAresult vedaArgsSetVPtr (VEDAargs args, const int idx, const VEDAdeviceptr value)
 Initialize the VEDA function arguments as a host memory location. More...
 
VEDAresult vedaArgsSetF32 (VEDAargs args, const int idx, const float value)
 Initialize the VEDA function arguments for single precision floating point value. More...
 
VEDAresult vedaArgsSetF64 (VEDAargs args, const int idx, const double value)
 Initialize the VEDA function arguments for double precision floating point value. More...
 
VEDAresult vedaArgsSetStack (VEDAargs args, const int idx, void *ptr, VEDAargs_intent intent, const size_t size)
 Initialize the VEDA function arguments to the buffer on stack. More...
 
VEDAresult vedaCtxDestroy (VEDAcontext ctx)
 Destroy a VEDA context. More...
 
VEDAresult vedaCtxGetApiVersion (VEDAcontext ctx, uint32_t *version)
 Gets the context's API version. More...
 
VEDAresult vedaCtxGetCurrent (VEDAcontext *pctx)
 Returns the VEDA context bound to the calling CPU thread. More...
 
VEDAresult vedaCtxGetDevice (VEDAdevice *device)
 Returns the device ID for the current context. More...
 
VEDAresult vedaCtxPopCurrent (VEDAcontext *pctx)
 Pops the current VEDA context from the current CPU thread. More...
 
VEDAresult vedaCtxPushCurrent (VEDAcontext ctx)
 Pushes a context on the current CPU thread. More...
 
VEDAresult vedaCtxSetCurrent (VEDAcontext ctx)
 Binds the specified VEDA context to the calling CPU thread. More...
 
VEDAresult vedaCtxStreamCnt (int *cnt)
 Gets the VEDA SM count. More...
 
VEDAresult vedaCtxSynchronize (void)
 Block for a context's tasks to complete. More...
 
VEDAresult vedaCtxCreate (VEDAcontext *pctx, int mode, VEDAdevice dev)
 Create a VEDA context. More...
 
VEDAresult vedaCtxGet (VEDAcontext *ctx, const VEDAdevice device)
 Retrieve the VEDA Context bound to the VEDA device. More...
 
VEDAresult vedaDeviceGetTemp (float *tempC, const int coreIdx, VEDAdevice dev)
 Retrieve the core temperature of the VEDA device in Celsius. More...
 
VEDAresult vedaDeviceGetCount (int *count)
 Retrieve the number of initializaed VEDA device. More...
 
VEDAresult vedaDeviceTotalMem (size_t *bytes, VEDAdevice dev)
 Retrieve the total memory of the VEDA device in bytes. More...
 
VEDAresult vedaDevicePrimaryCtxRelease (VEDAdevice dev)
 This function is not yet implemented. More...
 
VEDAresult vedaDevicePrimaryCtxSetFlags (VEDAdevice dev, uint32_t flags)
 This function is not yet implemented. More...
 
VEDAresult vedaDeviceGetPhysicalId (int *id, VEDAdevice dev)
 Retrieve the Physical ID of the given VEDA device. More...
 
VEDAresult vedaDeviceGetAVEOId (int *id, VEDAdevice dev)
 Retrieve the AVEO ID of the given VEDA device. More...
 
VEDAresult vedaDeviceGetNUMAId (int *id, VEDAdevice dev)
 Retrieve the NUMA ID of the given VEDA device. More...
 
VEDAresult vedaDeviceDistance (float *distance, VEDAdevice devA, VEDAdevice devB)
 Retrieve the distance of the two given VEDA devices. More...
 
VEDAresult vedaDeviceGet (VEDAdevice *device, int ordinal)
 Returns a handle to compute VEDA Device. More...
 
VEDAresult vedaDeviceGetPower (float *watts, VEDAdevice dev)
 Returns a VE device power corresponding to VEDA Device. More...
 
VEDAresult vedaDeviceGetCurrent (float *current, VEDAdevice dev)
 Returns a VE device AUX current corresponding to VEDA Device. More...
 
VEDAresult vedaDeviceGetCurrentEdge (float *current, VEDAdevice dev)
 Returns a VE device PCIe edge current corresponding to VEDA Device. More...
 
VEDAresult vedaDeviceGetVoltage (float *voltage, VEDAdevice dev)
 Returns a VE device AUX voltage corresponding to VEDA Device. More...
 
VEDAresult vedaDeviceGetVoltageEdge (float *voltage, VEDAdevice dev)
 Returns a VE device PCIe edge voltage corresponding to VEDA Device. More...
 
VEDAresult vedaDeviceGetAttribute (int *pi, VEDAdevice_attribute attrib, VEDAdevice dev)
 Returns information about the VEDA device. More...
 
VEDAresult vedaDeviceGetName (char *name, int len, VEDAdevice dev)
 Returns an identifer string for the VEDA device. More...
 
VEDAresult vedaDevicePrimaryCtxGetState (VEDAdevice dev, uint32_t *flags, int *active)
 Get the state of the primary context. More...
 
VEDAresult vedaDevicePrimaryCtxReset (VEDAdevice dev)
 Destroy all allocations and reset all state on the primary context. More...
 
VEDAresult vedaDevicePrimaryCtxRetain (VEDAcontext *pctx, VEDAdevice dev)
 Retain the primary Context on the VEDA device. More...
 
VEDAresult vedaMemGetDevice (VEDAdevice *dev, VEDAdeviceptr ptr)
 Get the VEDA device information correspoding to the Device pointer. More...
 
VEDAresult vedaMemAlloc (VEDAdeviceptr *ptr, size_t size)
 Allocates VEDA device memory. More...
 
VEDAresult vedaMemAllocAsync (VEDAdeviceptr *ptr, size_t size, VEDAstream stream)
 Allocates memory with stream ordered semantics. More...
 
VEDAresult vedaMemAllocHost (void **pp, size_t bytesize)
 Allocates host memory. More...
 
VEDAresult vedaMemAllocPitch (VEDAdeviceptr *dptr, size_t *pPitch, size_t WidthInBytes, size_t Height, uint32_t ElementSizeByte)
 Allocates pitched device memory. More...
 
VEDAresult vedaMemAllocPitchAsync (VEDAdeviceptr *dptr, size_t *pPitch, size_t WidthInBytes, size_t Height, uint32_t ElementSizeByte, VEDAstream stream)
 Allocates pitched device memory with stream order symantics. More...
 
VEDAresult vedaMemFree (VEDAdeviceptr ptr)
 Frees device memory. More...
 
VEDAresult vedaMemFreeAsync (VEDAdeviceptr ptr, VEDAstream stream)
 Frees device memory with stream ordered semantics. More...
 
VEDAresult vedaMemFreeHost (void *ptr)
 Frees host memory. More...
 
VEDAresult vedaMemGetAddressRange (VEDAdeviceptr *base, size_t *size, VEDAdeviceptr vptr)
 Get information on memory allocations. More...
 
VEDAresult vedaMemGetInfo (size_t *free, size_t *total)
 Gets free and total memory. More...
 
VEDAresult vedaMemcpy (VEDAdeviceptr dst, VEDAdeviceptr src, size_t ByteCount)
 Copies Memory. More...
 
VEDAresult vedaMemcpyAsync (VEDAdeviceptr dst, VEDAdeviceptr src, size_t ByteCount, VEDAstream hStream)
 Copies Memory Asynchronously. More...
 
VEDAresult vedaMemcpyDtoD (VEDAdeviceptr dstDevice, VEDAdeviceptr srcDevice, size_t ByteCount)
 Copies Memory from VEDA Device to VEDA Device. More...
 
VEDAresult vedaMemcpyDtoDAsync (VEDAdeviceptr dst, VEDAdeviceptr src, size_t size, VEDAstream hStream)
 Copies Memory from VEDA device to VEDA device Asynchronously. More...
 
VEDAresult vedaMemcpyDtoH (void *dstHost, VEDAdeviceptr srcDevice, size_t ByteCount)
 Copies Memory from VEDA Device to Host. More...
 
VEDAresult vedaMemcpyDtoHAsync (void *dstHost, VEDAdeviceptr srcDevice, size_t ByteCount, VEDAstream hStream)
 Copies Memory from VEDA device to Host Asynchronously. More...
 
VEDAresult vedaMemcpyHtoD (VEDAdeviceptr dstDevice, const void *srcHost, size_t ByteCount)
 Copies Memory from Host to VEDA Device. More...
 
VEDAresult vedaMemcpyHtoDAsync (VEDAdeviceptr dstDevice, const void *srcHost, size_t ByteCount, VEDAstream hStream)
 Copies Memory from Host to VEDA device Asynchronously. More...
 
VEDAresult vedaMemsetD16 (VEDAdeviceptr dstDevice, uint16_t us, size_t N)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD16Async (VEDAdeviceptr dstDevice, uint16_t us, size_t N, VEDAstream hStream)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD2D16 (VEDAdeviceptr dstDevice, size_t dstPitch, uint16_t us, size_t Width, size_t Height)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD2D16Async (VEDAdeviceptr dstDevice, size_t dstPitch, uint16_t us, size_t Width, size_t Height, VEDAstream hStream)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD2D32 (VEDAdeviceptr dstDevice, size_t dstPitch, uint32_t ui, size_t Width, size_t Height)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD2D32Async (VEDAdeviceptr dstDevice, size_t dstPitch, uint32_t ui, size_t Width, size_t Height, VEDAstream hStream)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD2D8 (VEDAdeviceptr dstDevice, size_t dstPitch, uint8_t uc, size_t Width, size_t Height)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD2D8Async (VEDAdeviceptr dstDevice, size_t dstPitch, uint8_t uc, size_t Width, size_t Height, VEDAstream hStream)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD32 (VEDAdeviceptr dstDevice, uint32_t ui, size_t N)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD32Async (VEDAdeviceptr dstDevice, uint32_t ui, size_t N, VEDAstream hStream)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD64 (VEDAdeviceptr dstDevice, uint64_t ui, size_t N)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD64Async (VEDAdeviceptr dstDevice, uint64_t ui, size_t N, VEDAstream hStream)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD8 (VEDAdeviceptr dstDevice, uint8_t uc, size_t N)
 Initializes device memory. More...
 
VEDAresult vedaMemsetD8Async (VEDAdeviceptr dstDevice, uint8_t uc, size_t N, VEDAstream hStream)
 Initializes device memory. More...
 
VEDAresult vedaMemReport (void)
 Prints the memory information of each Intialized VEDA device. More...
 
VEDAresult vedaMemPtr (void **ptr, VEDAdeviceptr vptr)
 Gets the VEDA device address for the given VEDA device virtual address. More...
 
VEDAresult vedaMemPtrSize (void **ptr, size_t *size, VEDAdeviceptr vptr)
 Gets the VEDA device address and allocation size against the given VEDA device virtual address. More...
 
VEDAresult vedaMemSize (size_t *size, VEDAdeviceptr vptr)
 Gets the VEDA memory size in bytes for the given VEDA device virtual address. More...
 
VEDAresult vedaMemHMEM (void **ptr, VEDAdeviceptr vptr)
 Gets the Hetrogenous Memory address for the given VEDA device virtual address. More...
 
VEDAresult vedaMemHMEMSize (void **ptr, size_t *size, VEDAdeviceptr vptr)
 Gets the VEDA HMEM address and allocation size against the given VEDA device virtual address. More...
 
VEDAresult vedaMemGetRawPointer (void **rawPtr, VEDAdeviceptr vptr)
 Gets the VEDA device address for the given VEDA device virtual address. More...
 
VEDAresult vedaMemGetHMEMPointer (void **hmemPtr, VEDAdeviceptr vptr)
 Gets the Hetrogenous Memory address for the given VEDA device virtual address. More...
 
VEDAresult vedaModuleGetFunction (VEDAfunction *hfunc, VEDAmodule hmod, const char *name)
 Return the VE address of the VEDA device function located in VEDA module. More...
 
VEDAresult vedaModuleLoad (VEDAmodule *module, const char *fname)
 To load the VE device code into the VE memory. More...
 
VEDAresult vedaModuleUnload (VEDAmodule hmod)
 To unload/remove the VE device code from the VE memory. More...
 
VEDAresult vedaStreamGetFlags (VEDAstream hStream, uint32_t *flags)
 Query the flags of a given stream. More...
 
VEDAresult vedaStreamQuery (VEDAstream hStream)
 Determine status of a compute stream. More...
 
VEDAresult vedaStreamSynchronize (VEDAstream hStream)
 Wait until a stream's tasks are completed. More...
 
VEDAresult vedaStreamAddCallback (VEDAstream stream, VEDAstream_callback callback, void *userData, unsigned int flags)
 Add a callback to a compute stream. More...
 

Detailed Description

To use VEDA API functions, include "veda.h" header.

Function Documentation

VEDAresult vedaInit ( uint32_t  Flags)

Initialize the VEDA driver API library.

Parameters
FlagsInitialization flags for VEDA library.
Return values
VEDA_SUCCESSon Success

Initializes the driver API and must be called before any other function of the VEDA driver API. Currently, the Flags parameter must be 0. If vedaInit() has not been called, any function from the driver API will return VEDA_ERROR_NOT_INITIALIZED.

Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_cxx/host.cpp, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/Device_stream.cpp, examples/VH/fortran.c, examples/VH/hello.c, examples/VH/numa_node.cpp, examples/VH/Omp_stream.cpp, examples/VH/omphello.c, examples/VH/omphellofortran.c, and examples/VH/Scalar_stream.cpp.
VEDAresult vedaExit ( void  )

Releases the VEDA driver API library gracefully.

Return values
VEDA_SUCCESSon Success

This function should be called from the hybrid program in order to perform the proper cleanup of the VEDA driver library.

Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_cxx/host.cpp, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/Device_stream.cpp, examples/VH/fortran.c, examples/VH/hello.c, examples/VH/numa_node.cpp, examples/VH/Omp_stream.cpp, examples/VH/omphello.c, examples/VH/omphellofortran.c, and examples/VH/Scalar_stream.cpp.
VEDAresult vedaDriverGetVersion ( const char **  str)

Return the latest AVEO version supported by VEDA.

Parameters
strPointer to hold the AVEO version.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDAresult vedaLaunchKernel ( VEDAfunction  f,
VEDAstream  stream,
VEDAargs  args 
)

Enqueues a VEDA device function f on the VEDA device.

Parameters
fHandle to VEDA Device function to launch.
streamStream Identifier.
argsHandle to the VEDA device parameters
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

VEDA device function arguements can be allocated and set through the vedaArgsCreate and vedaArgsSet* APIs.

Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/Device_stream.cpp, examples/VH/fortran.c, examples/VH/omphello.c, and examples/VH/omphellofortran.c.
VEDAresult vedaLaunchKernelEx ( VEDAfunction  f,
VEDAstream  stream,
VEDAargs  args,
const int  destroyArgs,
const int  Checkresult 
)

Enqueues a VEDA device function f on the VEDA device with flexibility.

Parameters
fHandle to VEDA Device function to launch.
streamStream Identifier.
argsHandle to the VEDA device parameters.
destroyArgsSet 1 if the VEDA arguement needs to be destroyed after VEDA device function is called else 0.
CheckresultSet 1 if the return value is required from the VEDA device function else 0.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
Examples:
examples/Hybrid_Offloading/helloworld_veda_cxx/host.cpp, and examples/VH/hello.c.
VEDAresult vedaLaunchHostFunc ( VEDAstream  stream,
VEDAhost_function  fn,
void *  userData 
)

Enqueues a host function call in a stream.

Parameters
streamStream Identifier.
fnThe function to call once preceding stream operations are complete.
userDataUser-specified data to be passed to the function.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Enqueues a host function to run in a stream. The function will be called after currently enqueued work and will block work added after it.

VEDAresult vedaArgsCreate ( VEDAargs *  args)

Instantiate the VEDA function argument handler.

Parameters
argsHandle for VEDA function argument handler
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_OUT_OF_MEMORY If no memory left on VEDA device to allocate arguments on VEDA device.

Further with the help of this VEDA function argument handler VEDA hybrid programmer can set the arguments for the VEDA device function.

Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_cxx/host.cpp, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/fortran.c, examples/VH/hello.c, examples/VH/omphello.c, and examples/VH/omphellofortran.c.
VEDAresult vedaArgsDestroy ( VEDAargs  args)

Destroy the VEDA function argument handler.

Parameters
argsHandle for VEDA function argument handler
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/fortran.c, examples/VH/omphello.c, and examples/VH/omphellofortran.c.
VEDAresult vedaArgsSetI8 ( VEDAargs  args,
const int  idx,
const int8_t  value 
)

Initialize the VEDA function arguments for 8 bit integer value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetI16 ( VEDAargs  args,
const int  idx,
const int16_t  value 
)

Initialize the VEDA function arguments for 16 bit integer value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetI32 ( VEDAargs  args,
const int  idx,
const int32_t  value 
)

Initialize the VEDA function arguments for 32 bit integer value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetI64 ( VEDAargs  args,
const int  idx,
const int64_t  value 
)

Initialize the VEDA function arguments for 64 bit integer value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetU8 ( VEDAargs  args,
const int  idx,
const uint8_t  value 
)

Initialize the VEDA function arguments for 8 bit unsigned integer value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetU16 ( VEDAargs  args,
const int  idx,
const uint16_t  value 
)

Initialize the VEDA function arguments for 16 bit unsigned integer value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetU32 ( VEDAargs  args,
const int  idx,
const uint32_t  value 
)

Initialize the VEDA function arguments for 32 bit unsigned integer value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetU64 ( VEDAargs  args,
const int  idx,
const uint64_t  value 
)

Initialize the VEDA function arguments for 64 bit unsigned integer value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetHMEM ( VEDAargs  args,
const int  idx,
const void *  value 
)

Initialize the VEDA function arguments by converting the heterogeneous memory address to VEDA device memory address.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.

Set the VEDA device memory address as an argument by converting the heterogeneous memory address to VEDA device memory address.

VEDAresult vedaArgsSetPtr ( VEDAargs  args,
const int  idx,
const VEDAdeviceptr  value 
)

Initialize the VEDA function arguments as a device memory location.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.

Set the VEDA device memory location as an argument

VEDAresult vedaArgsSetVPtr ( VEDAargs  args,
const int  idx,
const VEDAdeviceptr  value 
)

Initialize the VEDA function arguments as a host memory location.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.

Set the VEDA host memory location as an argument.

VEDAresult vedaArgsSetF32 ( VEDAargs  args,
const int  idx,
const float  value 
)

Initialize the VEDA function arguments for single precision floating point value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetF64 ( VEDAargs  args,
const int  idx,
const double  value 
)

Initialize the VEDA function arguments for double precision floating point value.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
valueValue to be set for the VEDA function argument.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.
VEDAresult vedaArgsSetStack ( VEDAargs  args,
const int  idx,
void *  ptr,
VEDAargs_intent  intent,
const size_t  size 
)

Initialize the VEDA function arguments to the buffer on stack.

Parameters
argsHandle to VEDA function argument.
idxVEDA function argument number
ptrPointer to the buffer which needs to be copied to the VEDA device function stack.
intentDefines the intent of the buffer as below –
VEDA_ARGS_INTENT_IN – If the buffer should be treated as the Input buffer to the VEDA device function.
VEDA_ARGS_INTENT_OUT – If the buffer should be treated as the Output buffer to the VEDA device function and some output is expected.
VEDA_ARGS_INTENT_INOUT – If the buffer should be treated as both Input and Output.
sizeSize of the buffer.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_ARGS If VEDA argument handler is not initialized.

Set the VEDA function argument to the buffer on stack.

Examples:
examples/VH/fortran.c.
VEDAresult vedaCtxDestroy ( VEDAcontext  ctx)

Destroy a VEDA context.

Parameters
ctxContext to destroy.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.

Destroys the VEDA context specified by ctx. The context ctx will be destroyed regardless of how many threads it is current to. It is the responsibility of the calling function to ensure that no API call issues using ctx while vedaCtxDestroy() is executing. Destroys and cleans up all resources associated with the context. It is the caller's responsibility to ensure that the context or its resources are not accessed or passed in subsequent API calls and doing so will result in undefined behavior. These resources include VEDA types such as VEDAmodule, VEDAfunction, VEDAstream. If ctx is current to the calling thread then ctx will also be popped from the current thread's context stack (as though vedaCtxPopCurrent() were called). If ctx is current to other threads, then ctx will remain current to those threads, and attempting to access ctx from those threads will result in the error VEDA_ERROR_CONTEXT_IS_DESTROYED.

Examples:
examples/VH/Device_stream.cpp.
VEDAresult vedaCtxGetApiVersion ( VEDAcontext  ctx,
uint32_t *  version 
)

Gets the context's API version.

Parameters
ctxContext to check.
versionPointer to hold the version.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaCtxGetCurrent ( VEDAcontext *  pctx)

Returns the VEDA context bound to the calling CPU thread.

Parameters
pctxReturned context handle.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Returns in *pctx the VEDA context bound to the calling CPU thread. If no context is bound to the calling CPU thread then *pctx is set to NULL and VEDA_SUCCESS is returned.

VEDAresult vedaCtxGetDevice ( VEDAdevice *  device)

Returns the device ID for the current context.

Parameters
deviceReturned device ID for the current context.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Returns in *device the ordinal of the current context's device.

VEDAresult vedaCtxPopCurrent ( VEDAcontext *  pctx)

Pops the current VEDA context from the current CPU thread.

Parameters
pctxReturned new context handle.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Pops the current VEDA context from the CPU thread and passes back the old context handle in *pctx. That context may then be made current to a different CPU thread by calling vedaCtxPushCurrent().

If a context was current to the CPU thread before vedaCtxCreate() or vedaCtxPushCurrent() was called, this function makes that context current to the CPU thread again.

VEDAresult vedaCtxPushCurrent ( VEDAcontext  ctx)

Pushes a context on the current CPU thread.

Parameters
ctxContext to push.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.

Pushes the given context ctx onto the CPU thread's stack of current contexts. The specified context becomes the CPU thread's current context, so all VEDA functions that operate on the current context are affected. The previous current context may be made current again by calling vedaCtxDestroy() or vedaCtxPopCurrent().

Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_cxx/host.cpp, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/fortran.c, examples/VH/hello.c, examples/VH/omphello.c, and examples/VH/omphellofortran.c.
VEDAresult vedaCtxSetCurrent ( VEDAcontext  ctx)

Binds the specified VEDA context to the calling CPU thread.

Parameters
ctxContext to bind to the calling CPU thread.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.

Binds the specified VEDA context to the calling CPU thread. If ctx is NULL then the VEDA context previously bound to the calling CPU thread is unbound and VEDA_SUCCESS is returned.

If there exists a VEDA context stack on the calling CPU thread, this will replace the top of that stack with ctx. If ctx is NULL then this will be equivalent to popping the top of the calling CPU thread's VEDA context stack (or a no-op if the calling CPU thread's VEDA context stackis empty).

VEDAresult vedaCtxStreamCnt ( int *  cnt)

Gets the VEDA SM count.

Parameters
cntpointer to hold the VEDA SM count.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Returns the VEDA SM count of the VEDA context bound to the calling CPU thread.

Examples:
examples/VH/Device_stream.cpp, examples/VH/Omp_stream.cpp, and examples/VH/Scalar_stream.cpp.
VEDAresult vedaCtxSynchronize ( void  )

Block for a context's tasks to complete.

Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Blocks until the device has completed all preceding requested tasks. vedaCtxSynchronize() returns an error if one of the preceding tasks failed.

Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_cxx/host.cpp, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/fortran.c, examples/VH/hello.c, examples/VH/omphello.c, and examples/VH/omphellofortran.c.
VEDAresult vedaCtxCreate ( VEDAcontext *  pctx,
int  mode,
VEDAdevice  dev 
)

Create a VEDA context.

Parameters
pctxReturned context handle of the new context.
modeContext mode may contain below two values –
VEDA_CONTEXT_MODE_OMP
VEDA_CONTEXT_MODE_SCALAR
devDevice to create context on
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_CANNOT_CREATE_CONTEXTError while creating VEDA context.
VEDA_ERROR_CANNOT_CREATE_STREAMerror while creating VEDA SM.

Creates a new VEDA context and associates it with the calling thread. The flags parameter is described below. The caller of vedaCtxCreate() must call vedaCtxDestroy() or when done using the context. If any context is already current to the thread, it is changed by the newly created context and it may be restored by a subsequent call to vedaCtxPopCurrent().
VEDA Context may be created with below two flags-
VEDA_CONTEXT_MODE_OMP: In this mode, number of streaming multiprocessor(SM) is always 1. However, in this mode the number of OPENMP threads in each VEDA SM is configured as the minimum value between the number of cores of the VEDA device and the user configured value for the number of OPENMP threads on VE device (set through environment variable).
VEDA_CONTEXT_MODE_SCALAR: : In this mode number of streaming multiprocessor(SM) are the minimum value between the number of cores of the VEDA device and the user configured value for the number of OPENMP threads on VE device (set through environment variable). However, in this mode number of OPENMP threads in each VEDA SM is configured as 1.

Examples:
examples/VH/Device_stream.cpp, examples/VH/Omp_stream.cpp, and examples/VH/Scalar_stream.cpp.
VEDAresult vedaCtxGet ( VEDAcontext *  ctx,
const VEDAdevice  device 
)

Retrieve the VEDA Context bound to the VEDA device.

Parameters
ctxVEDA Context handle.
deviceVEDA device ID.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaDeviceGetTemp ( float *  tempC,
const int  coreIdx,
VEDAdevice  dev 
)

Retrieve the core temperature of the VEDA device in Celsius.

Parameters
tempCpointer to hold the core temperature.
coreIdxCore index of the VEDA device.
devVEDA device ID.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaDeviceGetCount ( int *  count)

Retrieve the number of initializaed VEDA device.

Parameters
countpointer to hold the count of the VEDA device.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
Examples:
examples/VH/Device_stream.cpp, examples/VH/numa_node.cpp, examples/VH/Omp_stream.cpp, and examples/VH/Scalar_stream.cpp.
VEDAresult vedaDeviceTotalMem ( size_t *  bytes,
VEDAdevice  dev 
)

Retrieve the total memory of the VEDA device in bytes.

Parameters
bytespointer to hold the VEDA device memory.
devVEDA device ID.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaDevicePrimaryCtxRelease ( VEDAdevice  dev)

This function is not yet implemented.

Parameters
dev
Returns
VEDA_SUCCESS

This function is not yet implemented but return VEDA_SUCCESS while calling it.

VEDAresult vedaDevicePrimaryCtxSetFlags ( VEDAdevice  dev,
uint32_t  flags 
)

This function is not yet implemented.

Parameters
dev
flags
Returns
VEDA_SUCCESS

This function is not yet implemented but return VEDA_SUCCESS while calling it.

VEDAresult vedaDeviceGetPhysicalId ( int *  id,
VEDAdevice  dev 
)

Retrieve the Physical ID of the given VEDA device.

Parameters
idpointer to hold the physical id of the VEDA device
devVEDA device ID.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.

Physical ID is the Slot ID of the underlying VE node, physical ID is used internally to retrieve the VE node information like VE node temperature, voltage etc. from the VE device file.

VEDAresult vedaDeviceGetAVEOId ( int *  id,
VEDAdevice  dev 
)

Retrieve the AVEO ID of the given VEDA device.

Parameters
idpointer to hold the AVEO id of the VEDA device
devVEDA device ID.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.

AVEO ID is the logical node ID of the underlying VE node assigned by the VEOS at the time of the VE node initialization.

VEDAresult vedaDeviceGetNUMAId ( int *  id,
VEDAdevice  dev 
)

Retrieve the NUMA ID of the given VEDA device.

Parameters
idpointer to hold the NUMA id of the VEDA device
devVEDA device ID.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.

if VE device is not configured in NUMA mode then this ID will be 0..

VEDAresult vedaDeviceDistance ( float *  distance,
VEDAdevice  devA,
VEDAdevice  devB 
)

Retrieve the distance of the two given VEDA devices.

Parameters
distancepointer to hold the distance.
devAhandle to the first VEDA device.
devBhandle to the second VEDA device.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.

Returns following value of distances:
0: if both the VEDA devices are initialized on the same VE device.
0.5: if both the VEDA devices are initialized on the difference NUMA node of the same VE device.
1: if both the VEDA devices are initialized on the difference VE node.

Examples:
examples/VH/numa_node.cpp.
VEDAresult vedaDeviceGet ( VEDAdevice *  device,
int  ordinal 
)

Returns a handle to compute VEDA Device.

Parameters
devicepointer to hold the VEDA device handle.
ordinalVEDA device number to get the VEDA device handle.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaDeviceGetPower ( float *  watts,
VEDAdevice  dev 
)

Returns a VE device power corresponding to VEDA Device.

Parameters
wattspointer to hold the VE device power.
devVEDA device handle.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.

Calculated VE device power includes both the PCIe edge power as well as the VE device AUX power with added 5W.

VEDAresult vedaDeviceGetCurrent ( float *  current,
VEDAdevice  dev 
)

Returns a VE device AUX current corresponding to VEDA Device.

Parameters
currentpointer to hold the VE device voltage.
devVEDA device handle.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaDeviceGetCurrentEdge ( float *  current,
VEDAdevice  dev 
)

Returns a VE device PCIe edge current corresponding to VEDA Device.

Parameters
currentpointer to hold the VE device current.
devVEDA device handle.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaDeviceGetVoltage ( float *  voltage,
VEDAdevice  dev 
)

Returns a VE device AUX voltage corresponding to VEDA Device.

Parameters
voltagepointer to hold the VE device voltage.
devVEDA device handle.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaDeviceGetVoltageEdge ( float *  voltage,
VEDAdevice  dev 
)

Returns a VE device PCIe edge voltage corresponding to VEDA Device.

Parameters
voltagepointer to hold the VE device voltage.
devVEDA device handle.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaDeviceGetAttribute ( int *  pi,
VEDAdevice_attribute  attrib,
VEDAdevice  dev 
)

Returns information about the VEDA device.

Parameters
piReturned VEDA device attribute value.
attribVEDA Device attribute to query.
devVEDA device handle.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.

Returns in *pi the integer value of the attribute attrib on device dev. The supported attributes are:
VEDA_DEVICE_ATTRIBUTE_SINGLE_TO_DOUBLE_PRECISION_PERF_RATIO: VEDA precision ratio.
VEDA_DEVICE_ATTRIBUTE_CLOCK_RATE: Clock chip clock frequency of the VEDA device.
VEDA_DEVICE_ATTRIBUTE_CLOCK_BASE: Clock Base clock frequency of the VEDA device.
VEDA_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT: Number of VE cores corresponding to VEDA device.
VEDA_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE: Clock memory clock frequency of the VEDA device.
VEDA_DEVICE_ATTRIBUTE_L1D_CACHE_SIZE: Size of the L1 cache of the device of VEDA device.
VEDA_DEVICE_ATTRIBUTE_L1I_CACHE_SIZE: Size of L1 instruction cache of the VEDA device.
VEDA_DEVICE_ATTRIBUTE_L2_CACHE_SIZE: Size of L2 data cache of the VEDA device.
VEDA_DEVICE_ATTRIBUTE_LLC_CACHE_SIZE: Size of last level cache of the VEDA device.
VEDA_DEVICE_ATTRIBUTE_MODEL: VE device model corresponding to VEDA device.
VEDA_DEVICE_ATTRIBUTE_ABI_VERSION: VE device ABI version corresponding to VEDA device.
VEDA_DEVICE_ATTRIBUTE_FIREWARE_VERSION: VE device firmware version corresponding to VEDA device.

Examples:
examples/VH/Scalar_stream.cpp.
VEDAresult vedaDeviceGetName ( char *  name,
int  len,
VEDAdevice  dev 
)

Returns an identifer string for the VEDA device.

Parameters
nameReturned identifier string for the VEDA device.
lenMaximum length of string to store in name.
devDevice to get the identifier string
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.

Returns an ASCII string identifying the device dev in the NULL-terminated string pointed to by name. len specifies the maximum length of the string that may be returned.

VEDAresult vedaDevicePrimaryCtxGetState ( VEDAdevice  dev,
uint32_t *  flags,
int *  active 
)

Get the state of the primary context.

Parameters
devVEDA Device to get the primary context flags for.
flagsPointer to store flags
activePointer to store context state; 0 = inactive, 1 = active.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaDevicePrimaryCtxReset ( VEDAdevice  dev)

Destroy all allocations and reset all state on the primary context.

Parameters
devVEDA Device for which primary context is destroyed.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_CANNOT_CREATE_CONTEXTError while creating VEDA context.
VEDA_ERROR_CANNOT_CREATE_STREAMerror while creating VEDA SM.

Explicitly destroys and cleans up all resources associated with the current device in the current process.

VEDAresult vedaDevicePrimaryCtxRetain ( VEDAcontext *  pctx,
VEDAdevice  dev 
)

Retain the primary Context on the VEDA device.

Parameters
pctxReturned context handle of the new VEDA context.
devVEDA Device for which primary context is requested.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_CANNOT_CREATE_CONTEXTError while creating VEDA context.
VEDA_ERROR_CANNOT_CREATE_STREAMerror while creating VEDA SM.

Retains the primary context on the device. Once the user successfully retains the primary context, the primary context will be active and available to the user until the user resets it with vedaDevicePrimaryCtxReset(). Unlike vedaCtxCreate() the newly retained context is not pushed onto the stack.

Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_cxx/host.cpp, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/fortran.c, examples/VH/hello.c, examples/VH/omphello.c, and examples/VH/omphellofortran.c.
VEDAresult vedaMemGetDevice ( VEDAdevice *  dev,
VEDAdeviceptr  ptr 
)

Get the VEDA device information correspoding to the Device pointer.

Parameters
devPointer to hold the VEDA device handle.
ptrVEDA device pointer
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaMemAlloc ( VEDAdeviceptr *  ptr,
size_t  size 
)

Allocates VEDA device memory.

Parameters
ptrReturned VEDA device pointer
sizeRequested allocation size in bytes.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDA_ERROR_OUT_OF_MEMORYVEDA device memory exausted.

Allocates size bytes of linear memory on the VEDA device and returns in *ptr a pointer to the allocated memory.

VEDAresult vedaMemAllocAsync ( VEDAdeviceptr *  ptr,
size_t  size,
VEDAstream  stream 
)

Allocates memory with stream ordered semantics.

Parameters
ptrReturned VEDA device pointer
sizeRequested allocation size in bytes.
streamThe stream establishing the stream ordering contract and the memory pool to allocate from
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDA_ERROR_OUT_OF_MEMORYVEDA device memory exausted.

Inserts an allocation operation into stream. A pointer to the allocated memory is returned immediately in *ptr. The allocation must not be accessed until the the allocation operation completes.

VEDAresult vedaMemAllocHost ( void **  pp,
size_t  bytesize 
)

Allocates host memory.

Parameters
ppReturned host pointer
bytesizeRequested allocation size in bytes.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDA_ERROR_OUT_OF_MEMORYHost memory exausted.
VEDAresult vedaMemAllocPitch ( VEDAdeviceptr *  dptr,
size_t *  pPitch,
size_t  WidthInBytes,
size_t  Height,
uint32_t  ElementSizeByte 
)

Allocates pitched device memory.

Parameters
dptrReturned device pointer
pPitchReturned pitch of allocation in bytes.
WidthInBytesRequested allocation width in bytes
HeightRequested allocation height in rows
ElementSizeByteSize of largest reads/writes for range
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDA_ERROR_OUT_OF_MEMORYHost memory exausted.

Allocates at least WidthInBytes * Height bytes of linear memory on the device and returns in *dptr a pointer to the allocated memory. The pitch returned in *pPitch by vedaMemAllocPitch() is the width in bytes of the allocation.

VEDAresult vedaMemAllocPitchAsync ( VEDAdeviceptr *  dptr,
size_t *  pPitch,
size_t  WidthInBytes,
size_t  Height,
uint32_t  ElementSizeByte,
VEDAstream  stream 
)

Allocates pitched device memory with stream order symantics.

Parameters
dptrReturned device pointer
pPitchReturned pitch of allocation in bytes.
WidthInBytesRequested allocation width in bytes
HeightRequested allocation height in rows
ElementSizeByteSize of largest reads/writes for range
streamThe stream establishing the stream ordering contract and the memory pool to allocate from
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDA_ERROR_OUT_OF_MEMORYHost memory exausted.

Allocates at least WidthInBytes * Height bytes of linear memory on the device and returns in *dptr a pointer to the allocated memory. The pitch returned in *pPitch by vedaMemAllocPitch() is the width in bytes of the allocation.

VEDAresult vedaMemFree ( VEDAdeviceptr  ptr)

Frees device memory.

Parameters
ptrPointer to memory to free.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Frees the memory space pointed to by dptr, which must have been returned by a previous call to vedaMemAlloc() or vedaMemAllocPitch().

VEDAresult vedaMemFreeAsync ( VEDAdeviceptr  ptr,
VEDAstream  stream 
)

Frees device memory with stream ordered semantics.

Parameters
ptrPointer to memory to free.
streamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Inserts a free operation into stream. The allocation must not be accessed after stream execution reaches the free. After this API returns, accessing the memory from any subsequent work launched on the VEDA device or querying its pointer attributes results in undefined behavior.

VEDAresult vedaMemFreeHost ( void *  ptr)

Frees host memory.

Parameters
ptrPointer to memory to free.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Frees the memory space pointed to by dptr, which must have been returned by a previous call to vedaMemAllocHost().

VEDAresult vedaMemGetAddressRange ( VEDAdeviceptr *  base,
size_t *  size,
VEDAdeviceptr  vptr 
)

Get information on memory allocations.

Parameters
baseReturned base address.
sizeReturned size of device memory allocation.
vptrDevice pointer to query.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Returns the base address in *base and size in *size of the allocation by vedaMemAlloc() or vedaMemAllocPitch() that contains the input pointer vptr.

VEDAresult vedaMemGetInfo ( size_t *  free,
size_t *  total 
)

Gets free and total memory.

Parameters
freeReturned free memory in bytes.
totalReturned total memory in bytes.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Returns in *total the total amount of memory available to the the current context. Returns in *free the amount of memory on the VEDA device that is free.

VEDAresult vedaMemcpy ( VEDAdeviceptr  dst,
VEDAdeviceptr  src,
size_t  ByteCount 
)

Copies Memory.

Parameters
dstDestination virtual address pointer.
srcSource virtual address pointer.
ByteCountSize of memory copy in bytes.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Copies data between two pointers. dst and src are base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.

VEDAresult vedaMemcpyAsync ( VEDAdeviceptr  dst,
VEDAdeviceptr  src,
size_t  ByteCount,
VEDAstream  hStream 
)

Copies Memory Asynchronously.

Parameters
dstDestination virtual address pointer.
srcSource virtual address pointer.
ByteCountSize of memory copy in bytes.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Copies data between two pointers. dst and src are base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.

VEDAresult vedaMemcpyDtoD ( VEDAdeviceptr  dstDevice,
VEDAdeviceptr  srcDevice,
size_t  ByteCount 
)

Copies Memory from VEDA Device to VEDA Device.

Parameters
dstDeviceDestination device pointer.
srcDeviceSource device pointer.
ByteCountSize of memory copy in bytes.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Copies from device memory to device memory. dstDevice and srcDevice are the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.

VEDAresult vedaMemcpyDtoDAsync ( VEDAdeviceptr  dst,
VEDAdeviceptr  src,
size_t  size,
VEDAstream  hStream 
)

Copies Memory from VEDA device to VEDA device Asynchronously.

Parameters
dstDestination virtual address pointer.
srcSource virtual address pointer.
sizeSize of memory copy in bytes.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Copies from device memory to device memory. dstDevice and srcDevice are the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.

VEDAresult vedaMemcpyDtoH ( void *  dstHost,
VEDAdeviceptr  srcDevice,
size_t  ByteCount 
)

Copies Memory from VEDA Device to Host.

Parameters
dstHostDestination host pointer.
srcDeviceSource device pointer.
ByteCountSize of memory copy in bytes.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Copies from device memory to host. dstHost and srcDevice are the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.

VEDAresult vedaMemcpyDtoHAsync ( void *  dstHost,
VEDAdeviceptr  srcDevice,
size_t  ByteCount,
VEDAstream  hStream 
)

Copies Memory from VEDA device to Host Asynchronously.

Parameters
dstHostDestination virtual address pointer.
srcDeviceSource virtual address pointer.
ByteCountSize of memory copy in bytes.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Copies from device memory to host. dstHost and srcDevice are the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.

VEDAresult vedaMemcpyHtoD ( VEDAdeviceptr  dstDevice,
const void *  srcHost,
size_t  ByteCount 
)

Copies Memory from Host to VEDA Device.

Parameters
dstDeviceDestination device pointer.
srcHostSource host pointer.
ByteCountSize of memory copy in bytes.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Copies from host memory to device memory. dstDevice and srcHost are the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.

VEDAresult vedaMemcpyHtoDAsync ( VEDAdeviceptr  dstDevice,
const void *  srcHost,
size_t  ByteCount,
VEDAstream  hStream 
)

Copies Memory from Host to VEDA device Asynchronously.

Parameters
dstDeviceDestination virtual address pointer.
srcHostSource Host virtual address pointer.
ByteCountSize of memory copy in bytes.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Copies from host memory to device memory. dstDevice and srcHost are the base pointers of the destination and source, respectively. ByteCount specifies the number of bytes to copy.

VEDAresult vedaMemsetD16 ( VEDAdeviceptr  dstDevice,
uint16_t  us,
size_t  N 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
usValue to set.
NNumber of Elements.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the memory range of N 16-bit values to the specified value us.

VEDAresult vedaMemsetD16Async ( VEDAdeviceptr  dstDevice,
uint16_t  us,
size_t  N,
VEDAstream  hStream 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
usValue to set.
NNumber of Elements.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the memory range of N 16-bit values to the specified value us.

VEDAresult vedaMemsetD2D16 ( VEDAdeviceptr  dstDevice,
size_t  dstPitch,
uint16_t  us,
size_t  Width,
size_t  Height 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
dstPitchPitch of destination device pointer.
usValue to set.
WidthWidth of row.
HeightNumber of rows.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the 2D memory range of Width 16-bit values to the specified value uc. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row.

VEDAresult vedaMemsetD2D16Async ( VEDAdeviceptr  dstDevice,
size_t  dstPitch,
uint16_t  us,
size_t  Width,
size_t  Height,
VEDAstream  hStream 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
dstPitchPitch of destination device pointer.
usValue to set.
WidthWidth of row.
HeightNumber of rows.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the 2D memory range of Width 16-bit values to the specified value uc. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row.

VEDAresult vedaMemsetD2D32 ( VEDAdeviceptr  dstDevice,
size_t  dstPitch,
uint32_t  ui,
size_t  Width,
size_t  Height 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
dstPitchPitch of destination device pointer.
uiValue to set.
WidthWidth of row.
HeightNumber of rows.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the 2D memory range of Width 32-bit values to the specified value uc. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row.

VEDAresult vedaMemsetD2D32Async ( VEDAdeviceptr  dstDevice,
size_t  dstPitch,
uint32_t  ui,
size_t  Width,
size_t  Height,
VEDAstream  hStream 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
dstPitchPitch of destination device pointer.
uiValue to set.
WidthWidth of row.
HeightNumber of rows.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the 2D memory range of Width 32-bit values to the specified value uc. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row.

VEDAresult vedaMemsetD2D8 ( VEDAdeviceptr  dstDevice,
size_t  dstPitch,
uint8_t  uc,
size_t  Width,
size_t  Height 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
dstPitchPitch of destination device pointer.
ucValue to set.
WidthWidth of row.
HeightNumber of rows.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the 2D memory range of Width 8-bit values to the specified value uc. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row.

VEDAresult vedaMemsetD2D8Async ( VEDAdeviceptr  dstDevice,
size_t  dstPitch,
uint8_t  uc,
size_t  Width,
size_t  Height,
VEDAstream  hStream 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
dstPitchPitch of destination device pointer.
ucValue to set.
WidthWidth of row.
HeightNumber of rows.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the 2D memory range of Width 8-bit values to the specified value uc. Height specifies the number of rows to set, and dstPitch specifies the number of bytes between each row.

VEDAresult vedaMemsetD32 ( VEDAdeviceptr  dstDevice,
uint32_t  ui,
size_t  N 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
uiValue to set.
NNumber of Elements.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the memory range of N 32-bit values to the specified value us.

VEDAresult vedaMemsetD32Async ( VEDAdeviceptr  dstDevice,
uint32_t  ui,
size_t  N,
VEDAstream  hStream 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
uiValue to set.
NNumber of Elements.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the memory range of N 32-bit values to the specified value us.

VEDAresult vedaMemsetD64 ( VEDAdeviceptr  dstDevice,
uint64_t  ui,
size_t  N 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
uiValue to set.
NNumber of Elements.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the memory range of N 64-bit values to the specified value us.

VEDAresult vedaMemsetD64Async ( VEDAdeviceptr  dstDevice,
uint64_t  ui,
size_t  N,
VEDAstream  hStream 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
uiValue to set.
NNumber of Elements.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the memory range of N 64-bit values to the specified value us.

VEDAresult vedaMemsetD8 ( VEDAdeviceptr  dstDevice,
uint8_t  uc,
size_t  N 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
ucValue to set.
NNumber of Elements.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the memory range of N 8-bit values to the specified value us.

VEDAresult vedaMemsetD8Async ( VEDAdeviceptr  dstDevice,
uint8_t  uc,
size_t  N,
VEDAstream  hStream 
)

Initializes device memory.

Parameters
dstDeviceDestination device pointer.
ucValue to set.
NNumber of Elements.
hStreamThe stream establishing the stream ordering contract.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Sets the memory range of N 8-bit values to the specified value us.

VEDAresult vedaMemReport ( void  )

Prints the memory information of each Intialized VEDA device.

Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Prints the each allocation VEDA memory address and size of the every VEDA device.

VEDAresult vedaMemPtr ( void **  ptr,
VEDAdeviceptr  vptr 
)

Gets the VEDA device address for the given VEDA device virtual address.

Parameters
ptrPointer to hold the VEDA device address.
vptrPointer containing the VEDA device virtual address.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDAresult vedaMemPtrSize ( void **  ptr,
size_t *  size,
VEDAdeviceptr  vptr 
)

Gets the VEDA device address and allocation size against the given VEDA device virtual address.

Parameters
ptrPointer to hold the VEDA device address.
sizetotal size of the allocation in bytes.
vptrPointer containing the VEDA device virtual address.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDAresult vedaMemSize ( size_t *  size,
VEDAdeviceptr  vptr 
)

Gets the VEDA memory size in bytes for the given VEDA device virtual address.

Parameters
sizetotal size of the allocation in bytes.
vptrPointer containing the VEDA device virtual address.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDAresult vedaMemHMEM ( void **  ptr,
VEDAdeviceptr  vptr 
)

Gets the Hetrogenous Memory address for the given VEDA device virtual address.

Parameters
ptrPointer to hold the HMEM address.
vptrPointer containing the VEDA device virtual address.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDAresult vedaMemHMEMSize ( void **  ptr,
size_t *  size,
VEDAdeviceptr  vptr 
)

Gets the VEDA HMEM address and allocation size against the given VEDA device virtual address.

Parameters
ptrPointer to hold the VEDA HMEM address.
sizetotal size of the allocation in bytes.
vptrPointer containing the VEDA device virtual address.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDAresult vedaMemGetRawPointer ( void **  rawPtr,
VEDAdeviceptr  vptr 
)

Gets the VEDA device address for the given VEDA device virtual address.

Parameters
rawPtrPointer to hold the VEDA device address.
vptrPointer containing the VEDA device virtual address.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDAresult vedaMemGetHMEMPointer ( void **  hmemPtr,
VEDAdeviceptr  vptr 
)

Gets the Hetrogenous Memory address for the given VEDA device virtual address.

Parameters
hmemPtrPointer to hold the HMEM address.
vptrPointer containing the VEDA device virtual address.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.
VEDAresult vedaModuleGetFunction ( VEDAfunction *  hfunc,
VEDAmodule  hmod,
const char *  name 
)

Return the VE address of the VEDA device function located in VEDA module.

Parameters
hfuncBuffer to hold the VE address of the VEDA device function.
hmodhandle to the VEDA module corresponding to the VE device code.
nameName of the VEDA device function for which the VE address is required.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_VALUE In case the name of the VEDA device function is passed as NULL.
VEDA_ERROR_FUNCTION_NOT_FOUND Internal error from the AVEO library
Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_cxx/host.cpp, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/Device_stream.cpp, examples/VH/fortran.c, examples/VH/hello.c, examples/VH/omphello.c, and examples/VH/omphellofortran.c.
VEDAresult vedaModuleLoad ( VEDAmodule *  module,
const char *  fname 
)

To load the VE device code into the VE memory.

Parameters
modulePointer to hold the reference of the VEDA module.
fnameLibrary name of the file name containing VE device code.
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_INVALID_VALUE If the provided VE library name is not valid.
VEDA_ERROR_MODULE_NOT_FOUND Internal error from the AVEO library
Examples:
examples/Hybrid_Offloading/helloworld_veda_c/host.c, examples/Hybrid_Offloading/helloworld_veda_cxx/host.cpp, examples/Hybrid_Offloading/helloworld_veda_fortran/host.c, examples/VH/Device_stream.cpp, examples/VH/fortran.c, examples/VH/hello.c, examples/VH/omphello.c, and examples/VH/omphellofortran.c.
VEDAresult vedaModuleUnload ( VEDAmodule  hmod)

To unload/remove the VE device code from the VE memory.

Parameters
hmodPointer to the VEDA module corresponding to the VE device code..
Returns
VEDA_SUCCESS on Success
VEDA_ERROR_NOT_INITIALIZED If VEDA device is not initialized.
VEDA_ERROR_UNKOWN_CONTEXT If VEDA context is not initialized.
VEDAresult vedaStreamGetFlags ( VEDAstream  hStream,
uint32_t *  flags 
)

Query the flags of a given stream.

Parameters
hStreamHandle to the stream to be queried
flagsPointer to an unsigned integer in which the stream's flags are returned.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDAresult vedaStreamQuery ( VEDAstream  hStream)

Determine status of a compute stream.

Parameters
hStreamDetermine status of a compute stream.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Returns CUDA_SUCCESS if all operations in the stream specified by hStream have completed

VEDAresult vedaStreamSynchronize ( VEDAstream  hStream)

Wait until a stream's tasks are completed.

Parameters
hStreamDetermine status of a compute stream.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Waits until the device has completed all operations in the stream specified by hStream.

Examples:
examples/VH/Device_stream.cpp.
VEDAresult vedaStreamAddCallback ( VEDAstream  stream,
VEDAstream_callback  callback,
void *  userData,
unsigned int  flags 
)

Add a callback to a compute stream.

Parameters
streamDetermine status of a compute stream.
callbackThe function to call once preceding stream operations are complete.
userDataUser specified data to be passed to the callback function.
flagsReserved for future use, must be 0.
Return values
VEDA_SUCCESSon Success
VEDA_ERROR_NOT_INITIALIZEDVEDA library not initialized
VEDA_ERROR_INVALID_DEVICEVEDA device id is not valid.
VEDA_ERROR_UNKNOWN_CONTEXTVEDA context is not set for the calling thread.
VEDA_ERROR_CONTEXT_IS_DESTROYEDVEDA current context is already destroyed.

Adds a callback to be called on the host after all currently enqueued items in the stream have completed.