Alternative VE Offloading  3.0.2
VEO API

VE Offloading API functions. More...

Functions

int veo_api_version ()
 return the API version of the VE Offload implementation More...
 
const char * veo_version_string ()
 VEO version. More...
 
veo_proc_handle * veo_proc_create_static (int venode, char *tmp_veobin)
 create a VE process with non-default veorun binary More...
 
veo_proc_handle * veo_proc_create (int venode)
 create a VE process More...
 
int veo_proc_destroy (veo_proc_handle *proc)
 destroy a VE process More...
 
int veo_proc_identifier (veo_proc_handle *proc)
 find a veo_proc_handle's identifier More...
 
uint64_t veo_load_library (veo_proc_handle *proc, const char *libname)
 load a VE library More...
 
int veo_unload_library (veo_proc_handle *proc, const uint64_t libhandle)
 unload a VE library More...
 
uint64_t veo_get_sym (veo_proc_handle *proc, uint64_t libhdl, const char *symname)
 find a symbol in VE program More...
 
int veo_alloc_mem (veo_proc_handle *h, uint64_t *addr, const size_t size)
 Allocate a VE memory buffer. More...
 
int veo_alloc_hmem (veo_proc_handle *h, void **addr, const size_t size)
 Allocate a VE memory buffer or a VH memory buffer which users can use them as heterogeneous memory. More...
 
int veo_free_mem (veo_proc_handle *h, uint64_t addr)
 Free a VE memory buffer. More...
 
int veo_free_hmem (void *addr)
 Free a VE memory buffer. More...
 
int veo_read_mem (veo_proc_handle *h, void *dst, uint64_t src, size_t size)
 Read VE memory. More...
 
int veo_write_mem (veo_proc_handle *h, uint64_t dst, const void *src, size_t size)
 Write VE memory. More...
 
int veo_hmemcpy (void *dst, const void *src, size_t size)
 Copy VE/VH memory. More...
 
int veo_num_contexts (veo_proc_handle *h)
 Return number of open contexts in a proc. More...
 
veo_thr_ctxt * veo_get_context (veo_proc_handle *proc, int idx)
 Return a pointer of VEO thread context in a proc. More...
 
veo_thr_ctxt * veo_context_open (veo_proc_handle *proc)
 open a VEO context More...
 
veo_thr_ctxt * veo_context_open_with_attr (veo_proc_handle *proc, veo_thr_ctxt_attr *tca)
 open a VEO context with attributes. More...
 
int veo_context_close (veo_thr_ctxt *ctx)
 close a VEO context More...
 
void veo_context_sync (veo_thr_ctxt *ctx)
 synchronize a VEO context More...
 
int veo_get_context_state (veo_thr_ctxt *ctx)
 get VEO context state More...
 
veo_args * veo_args_alloc (void)
 allocate VEO arguments object (veo_args) More...
 
int veo_args_set_i64 (veo_args *ca, int argnum, int64_t val)
 set a 64-bit integer argument More...
 
int veo_args_set_u64 (veo_args *ca, int argnum, uint64_t val)
 set a 64-bit uunsigned integer argument More...
 
int veo_args_set_i32 (veo_args *ca, int argnum, int32_t val)
 set a 32-bit integer argument More...
 
int veo_args_set_u32 (veo_args *ca, int argnum, uint32_t val)
 set a 32-bit unsigned integer argument More...
 
int veo_args_set_i16 (veo_args *ca, int argnum, int16_t val)
 set a 16-bit integer argument More...
 
int veo_args_set_u16 (veo_args *ca, int argnum, uint16_t val)
 set a 16-bit unsigned integer argument More...
 
int veo_args_set_i8 (veo_args *ca, int argnum, int8_t val)
 set a 8-bit integer argument More...
 
int veo_args_set_u8 (veo_args *ca, int argnum, uint8_t val)
 set a 8-bit unsigned integer argument More...
 
int veo_args_set_double (veo_args *ca, int argnum, double val)
 set a double precision floating point number argument More...
 
int veo_args_set_float (veo_args *ca, int argnum, float val)
 set a single precision floating point number argument More...
 
int veo_args_set_stack (veo_args *ca, enum veo_args_intent inout, int argnum, char *buff, size_t len)
 set VEO function calling argument pointing to buffer on stack More...
 
int veo_args_set_hmem (struct veo_args *ca, int argnum, void *val)
 set a heteroginious memory argument More...
 
void veo_args_clear (veo_args *ca)
 clear arguments set in VEO arguments object More...
 
void veo_args_free (veo_args *ca)
 free VEO arguments object More...
 
int veo_call_sync (veo_proc_handle *h, uint64_t addr, veo_args *ca, uint64_t *result)
 Call VE function synchronously on a proc. More...
 
uint64_t veo_call_async (veo_thr_ctxt *ctx, uint64_t addr, veo_args *args)
 request a VE thread to call a function More...
 
int veo_call_peek_result (veo_thr_ctxt *ctx, uint64_t reqid, uint64_t *retp)
 pick up a resutl from VE function if it has finished More...
 
int veo_call_wait_result (veo_thr_ctxt *ctx, uint64_t reqid, uint64_t *retp)
 pick up a resutl from VE function More...
 
uint64_t veo_alloc_mem_async (veo_thr_ctxt *ctx, const size_t size)
 Allocate a VE memory buffer asynchronously. More...
 
uint64_t veo_free_mem_async (veo_thr_ctxt *ctx, uint64_t addr)
 Free a VE memory buffer asynchronously. More...
 
uint64_t veo_async_read_mem (veo_thr_ctxt *ctx, void *dst, uint64_t src, size_t size)
 Asynchronously read VE memory. More...
 
uint64_t veo_async_write_mem (veo_thr_ctxt *ctx, uint64_t dst, const void *src, size_t size)
 Asynchronously write VE memory. More...
 
uint64_t veo_call_async_by_name (veo_thr_ctxt *ctx, uint64_t libhdl, const char *symname, veo_args *args)
 request a VE thread to call a function More...
 
uint64_t veo_call_async_vh (veo_thr_ctxt *ctx, uint64_t(*func)(void *), void *arg)
 call a VH function asynchronously More...
 
veo_thr_ctxt_attr * veo_alloc_thr_ctxt_attr (void)
 allocate and initialize VEO thread context attributes object (veo_thr_ctxt_attr). More...
 
int veo_free_thr_ctxt_attr (veo_thr_ctxt_attr *tca)
 free VEO thread context attributes object. More...
 
int veo_set_thr_ctxt_stacksize (veo_thr_ctxt_attr *tca, size_t stack_sz)
 set stack size of VE thread which executes a VE function. More...
 
int veo_get_thr_ctxt_stacksize (veo_thr_ctxt_attr *tca, size_t *stack_sz)
 get stack size of VE thread which executes a VE function. More...
 

Detailed Description

VE Offloading API functions.

To use VEO API functions, include "ve_offload.h" header.

Function Documentation

int veo_api_version ( )

return the API version of the VE Offload implementation

Return values
integervalue with API version
const char* veo_version_string ( )

VEO version.

Returns
pointer to VEO version string
veo_proc_handle* veo_proc_create_static ( int  venode,
char *  tmp_veobin 
)

create a VE process with non-default veorun binary

A VE process is created on the VE node specified by venode. If venode is -1, a VE process is created on the VE node specified by environment variable VE_NODE_NUMBER. If venode is -1 and environment variable VE_NODE_NUMBER is not set, a VE process is created on the VE node #0

A user executes the program which invokes this function through the job scheduler, the value specified by venode will be treated as a logical VE node number. It will be translated into physical VE node number assigned by the job scheduler. If venode is -1, the first VE node of the VE nodes assigned by the job scheduler is used.

VE supports normal mode and NUMA mode (Partitioning mode). Under NUMA mode, if a user specifies the same VE node to this function and creates multiple VE processes, the processes will be created alternately on NUMA nodes.

A user can control VE program execution using environment variables such as VE_LD_LIBRARY_PATH ,VE_OMP_NUM_THREADS and VE_NUMA_OPT. These environmet variables are also available when a user calls this function.

Parameters
[in]venodeVE node number
[in]tmp_veobinVE alternative veorun binary path
Returns
pointer to VEO process handle upon success
Return values
NULLVE process creation failed.
Examples:
examples/VH/fortran.c, examples/VH/hello_static.c, examples/VH/ompfortran_static.c, and examples/VH/omphello_static.c.
veo_proc_handle* veo_proc_create ( int  venode)

create a VE process

A VE process is created on the VE node specified by venode. If venode is -1, a VE process is created on the VE node specified by environment variable VE_NODE_NUMBER. If venode is -1 and environment variable VE_NODE_NUMBER is not set, a VE process is created on the VE node #0

A user executes the program which invokes this function through the job scheduler, the value specified by venode will be treated as a logical VE node number. It will be translated into physical VE node number assigned by the job scheduler. If venode is -1, the first VE node of the VE nodes assigned by the job scheduler is used.

VE supports normal mode and NUMA mode (Partitioning mode). Under NUMA mode, if a user specifies the same VE node to this function and creates multiple VE processes, the processes will be created alternately on NUMA nodes.

A user can control VE program execution using environment variables such as VE_LD_LIBRARY_PATH ,VE_OMP_NUM_THREADS and VE_NUMA_OPT. These environmet variables are also available when a user calls this function.

Parameters
[in]venodeVE node number
Returns
pointer to VEO process handle upon success
Return values
NULLVE process creation failed.
Examples:
examples/VH/hello.c, examples/VH/mpi-veo.c, examples/VH/ompfortran.c, and examples/VH/omphello.c.
int veo_proc_destroy ( veo_proc_handle *  proc)

destroy a VE process

Parameters
[in]procpointer to VEO process handle
Return values
0VEO process handle is successfully destroyed.
-1VEO process handle destruction failed.
Examples:
examples/VH/fortran.c, examples/VH/hello.c, examples/VH/hello_static.c, examples/VH/mpi-veo.c, examples/VH/ompfortran.c, examples/VH/ompfortran_static.c, examples/VH/omphello.c, and examples/VH/omphello_static.c.
int veo_proc_identifier ( veo_proc_handle *  proc)

find a veo_proc_handle's identifier

Parameters
[in]procpointer to VEO process handle
Return values
>=0 VEO process identifier, i.e. index in the proc list
-1VEO process not found in list
uint64_t veo_load_library ( veo_proc_handle *  proc,
const char *  libname 
)

load a VE library

Parameters
[in]procVEO process handle
[in]libnamea library file name to load
Returns
a handle for the library
Return values
0library loading request failed.
Examples:
examples/VH/hello.c, examples/VH/mpi-veo.c, examples/VH/ompfortran.c, and examples/VH/omphello.c.
int veo_unload_library ( veo_proc_handle *  proc,
const uint64_t  libhandle 
)

unload a VE library

Parameters
[in]procVEO process handle
[in]libhandlea library handle
Return values
0if request succeeded
uint64_t veo_get_sym ( veo_proc_handle *  proc,
uint64_t  libhdl,
const char *  symname 
)

find a symbol in VE program

Parameters
[in]procVEO process handle
[in]libhdla library handle
[in]symnamesymbol name to find
Returns
VEMVA of the symbol upon success.
Return values
0failed to find symbol.
int veo_alloc_mem ( veo_proc_handle *  h,
uint64_t *  addr,
const size_t  size 
)

Allocate a VE memory buffer.

Parameters
[in]hVEO process handle
[out]addrVEMVA address
[in]sizesize in bytes
Return values
0memory allocation succeeded.
-1memory allocation failed.
-2internal error.
int veo_alloc_hmem ( veo_proc_handle *  h,
void **  addr,
const size_t  size 
)

Allocate a VE memory buffer or a VH memory buffer which users can use them as heterogeneous memory.

This function allocates a VE memory buffer if h is a valid handle. This function allocates a VH memory buffer if h is NULL. This function returns the address with the process identifier. Since the number of processes that can be identified by the process identifier is 16, this function will fail if the user attempts to identify more than 16 processes. The memory allocated using this function must be transferred to the VE side with veo_args_set_hmem(), and freed with veo_free_hmem(). The data transfer of this memory between VH and VE, same VE, or different VE processes must be done by veo_hmemcpy(). veo_hmemcpy() allows user to transfer data from VH to VE, from VE to VH, from VH to VH, or VE to VE(same node). The transfer direction is determined from the identifier of the virtual address of the argument passed to veo_hmemcpy(). Users can check with veo_is_ve_addr() that the target address is flagged with the VE process identifier or not. Users need to remove the process identifier using veo_get_hmem_addr() before using the allocated memory.

Parameters
[in]hVEO process handle
[out]addra pointer to VEMVA address with the identifier
[in]sizesize in bytes
Return values
0memory allocation succeeded.
-1memory allocation or proc identifier acquisition failed.
-2internal error.
Examples:
examples/VH/mpi-veo.c.
int veo_free_mem ( veo_proc_handle *  h,
uint64_t  addr 
)

Free a VE memory buffer.

Parameters
[in]hVEO process handle
[in]addrVEMVA address
Return values
0memory is successfully freed.
-1internal error.
int veo_free_hmem ( void *  addr)

Free a VE memory buffer.

This function free the memory allocated by veo_alloc_hmem().

Parameters
[in]addra pointer to VEMVA address
Return values
0memory is successfully freed.
-1internal error.
Examples:
examples/VH/mpi-veo.c.
int veo_read_mem ( veo_proc_handle *  h,
void *  dst,
uint64_t  src,
size_t  size 
)

Read VE memory.

Parameters
[in]hVEO process handle
[out]dstdestination VHVA
[in]srcsource VEMVA
[in]sizesize in byte
Returns
zero upon success; negative upon failure.
int veo_write_mem ( veo_proc_handle *  h,
uint64_t  dst,
const void *  src,
size_t  size 
)

Write VE memory.

Parameters
[in]hVEO process handle
[out]dstdestination VEMVA
[in]srcsource VHVA
[in]sizesize in byte
Returns
zero upon success; negative upon failure.
int veo_hmemcpy ( void *  dst,
const void *  src,
size_t  size 
)

Copy VE/VH memory.

This function copies memory. When only the destination is the VE memory allocated by veo_alloc_hmem(), the data is transferred from VH to VE. When only the source is the VE memory allocated by veo_alloc_hmem(), the data is transferred from VE to VH. When both the source and the destination are VH memory, they are copied on VH. When both the source and the destination are VE memory allocated by veo_alloc_hmem(), they are copied on VE. In this case, both the source and the destination need to be VE memory allocated to the same process. When the source is VE memory attached by veo_shared_mem_attach() with VE_REGISTER_VEMVA and the destination is VE memory allocated by veo_alloc_hmem() to the same VE process, the data is transferred from the attached VE memory to the allocated VE memory. When the source is VE memory allocated by veo_alloc_hmem() and the destination is VE memory attached by veo_shared_mem_attach() with VE_REGISTER_VEMVA to the same VE process, the data is transferred from the allocated VE memory to the attached VE memory.

Parameters
[out]dsta pointer to destination
[in]srca pointer to source
[in]sizesize in byte
Returns
zero upon success; negative upon failure.
int veo_num_contexts ( veo_proc_handle *  h)

Return number of open contexts in a proc.

Parameters
[in]hVEO process handle
Returns
number of open contexts: negative upon failure.
veo_thr_ctxt* veo_get_context ( veo_proc_handle *  proc,
int  idx 
)

Return a pointer of VEO thread context in a proc.

The argument idx takes an integer value zero or more and less than the result of veo_num_contexts(). The context with idx=0 is the main context of the ProcHandle. It will not be destroyed when closed, instead it is destroyed when the proc is killed by veo_proc_destroy(), or when the program ends. veo_get_context() returns NULL if a user specifies idx with a value which is the result of veo_num_contexts() or more.

Parameters
[in]procVEO process handle
[in]idxa index which takes an integer value zero or more and less than the result of veo_num_contexts()
Returns
a pointer to VEO thread context upon success.
veo_thr_ctxt* veo_context_open ( veo_proc_handle *  proc)

open a VEO context

Create a new VEO context, a pseudo thread and VE thread for the context. All attributes which veo_context_open_with_attr() can specify have default value.

Parameters
[in]procVEO process handle
Returns
a pointer to VEO thread context upon success.
Return values
NULLfailed to create a VEO context.
Examples:
examples/VH/fortran.c, examples/VH/hello.c, examples/VH/hello_static.c, examples/VH/mpi-veo.c, examples/VH/ompfortran.c, examples/VH/ompfortran_static.c, examples/VH/omphello.c, and examples/VH/omphello_static.c.
veo_thr_ctxt* veo_context_open_with_attr ( veo_proc_handle *  proc,
veo_thr_ctxt_attr *  tca 
)

open a VEO context with attributes.

Create a new VEO context, a pseudo thread and VE thread for the context.

Parameters
[in]procVEO process handle
[in]tcaveo_thr_ctxt_attr object
Returns
a pointer to VEO thread context upon success.
Return values
NULLfailed to create a VEO context.
int veo_context_close ( veo_thr_ctxt *  ctx)

close a VEO context

Parameters
[in]ctxa VEO context to close
Return values
0VEO context is successfully closed.
non-zerofailed to close VEO context.
Examples:
examples/VH/fortran.c, examples/VH/hello.c, examples/VH/hello_static.c, examples/VH/mpi-veo.c, examples/VH/ompfortran.c, examples/VH/ompfortran_static.c, examples/VH/omphello.c, and examples/VH/omphello_static.c.
void veo_context_sync ( veo_thr_ctxt *  ctx)

synchronize a VEO context

While the submission lock is held, wait until all commands have been processed in this context.

Parameters
[in]ctxthe VEO context to synchronize
int veo_get_context_state ( veo_thr_ctxt *  ctx)

get VEO context state

Parameters
[in]ctxVEO context
Returns
the state of the VEO context state.
Return values
VEO_STATE_RUNNINGVEO context is running.
VEO_STATE_EXITVEO context exited.
veo_args* veo_args_alloc ( void  )

allocate VEO arguments object (veo_args)

Returns
pointer to veo_args
Return values
NULLthe allocation of veo_args failed.
Examples:
examples/VH/fortran.c, examples/VH/hello.c, examples/VH/hello_static.c, examples/VH/mpi-veo.c, examples/VH/ompfortran.c, examples/VH/ompfortran_static.c, examples/VH/omphello.c, and examples/VH/omphello_static.c.
int veo_args_set_i64 ( veo_args *  ca,
int  argnum,
int64_t  val 
)

set a 64-bit integer argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
Examples:
examples/VH/fortran.c.
int veo_args_set_u64 ( veo_args *  ca,
int  argnum,
uint64_t  val 
)

set a 64-bit uunsigned integer argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
int veo_args_set_i32 ( veo_args *  ca,
int  argnum,
int32_t  val 
)

set a 32-bit integer argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
Examples:
examples/VH/mpi-veo.c.
int veo_args_set_u32 ( veo_args *  ca,
int  argnum,
uint32_t  val 
)

set a 32-bit unsigned integer argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
int veo_args_set_i16 ( veo_args *  ca,
int  argnum,
int16_t  val 
)

set a 16-bit integer argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
int veo_args_set_u16 ( veo_args *  ca,
int  argnum,
uint16_t  val 
)

set a 16-bit unsigned integer argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
int veo_args_set_i8 ( veo_args *  ca,
int  argnum,
int8_t  val 
)

set a 8-bit integer argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
int veo_args_set_u8 ( veo_args *  ca,
int  argnum,
uint8_t  val 
)

set a 8-bit unsigned integer argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
int veo_args_set_double ( veo_args *  ca,
int  argnum,
double  val 
)

set a double precision floating point number argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
int veo_args_set_float ( veo_args *  ca,
int  argnum,
float  val 
)

set a single precision floating point number argument

Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]valvalue to be set
Returns
zero upon success; negative upon failure.
int veo_args_set_stack ( veo_args *  ca,
enum veo_args_intent  inout,
int  argnum,
char *  buff,
size_t  len 
)

set VEO function calling argument pointing to buffer on stack

Parameters
[in,out]capointer to veo_args object
[in]inoutintent of argument. VEO_INTENT_IN, VEO_INTENT_OUT, VEO_INTENT_INOUT are supported
[in]argnumargument number that is being set
[in]buffchar pointer to buffer that will be copied to the VE stack
[in]lenlength of buffer that is copied to the VE stack
Return values
0argumen is successfully set.
-1an error occurred.

The buffer is copied to the stack and will look to the VE callee like a local variable of the caller function. Use this to pass structures to the VE "kernel" function. The size of arguments passed on the stack is limited to 63MB, since the size of the initial stack is 64MB. Allocate and use memory buffers on heap when you have huge argument arrays to pass.

Examples:
examples/VH/fortran.c.
int veo_args_set_hmem ( struct veo_args *  ca,
int  argnum,
void *  val 
)

set a heteroginious memory argument

Note
Remove the bit 63:59 flag by veo_get_hmem_addr(), when argument val set the memory allocated by veo_alloc_hmem().
Parameters
[in,out]caveo_args
[in]argnumthe argnum-th argument
[in]vala pointer to value to be set
Returns
zero upon success; negative upon failure.
Examples:
examples/VH/mpi-veo.c.
void veo_args_clear ( veo_args *  ca)

clear arguments set in VEO arguments object

Parameters
[in,out]caveo_args object
Examples:
examples/VH/fortran.c, and examples/VH/mpi-veo.c.
int veo_call_sync ( veo_proc_handle *  h,
uint64_t  addr,
veo_args *  ca,
uint64_t *  result 
)

Call VE function synchronously on a proc.

Parameters
[in]hVEO process handle
[in]addrVEMVA address of VE function
[in]cacall args
[out]resultpointer to result variable
Returns
zero upon success; negative upon failure.
uint64_t veo_call_async ( veo_thr_ctxt *  ctx,
uint64_t  addr,
veo_args *  args 
)

request a VE thread to call a function

Parameters
[in]ctxVEO context to execute the function on VE.
[in]addrVEMVA of the function to call
[in]argsarguments to be passed to the function
Returns
request ID
Return values
VEO_REQUEST_ID_INVALIDrequest failed.
int veo_call_peek_result ( veo_thr_ctxt *  ctx,
uint64_t  reqid,
uint64_t *  retp 
)

pick up a resutl from VE function if it has finished

Parameters
[in]ctxVEO context
[in]reqidrequest ID
[out]retppointer to buffer to store the return value from the function.
Return values
VEO_COMMAND_OKfunction is successfully returned.
VEO_COMMAND_EXCEPTIONan exception occurred on function.
VEO_COMMAND_ERRORan error occurred on function.
VEO_COMMAND_UNFINISHEDfunction is not finished.
-1internal error.
int veo_call_wait_result ( veo_thr_ctxt *  ctx,
uint64_t  reqid,
uint64_t *  retp 
)

pick up a resutl from VE function

Parameters
[in]ctxVEO context
[in]reqidrequest ID
[out]retppointer to buffer to store the return value from the function.
Return values
VEO_COMMAND_OKfunction is successfully returned.
VEO_COMMAND_EXCEPTIONan exception occurred on execution.
VEO_COMMAND_ERRORan error occurred on execution.
VEO_COMMAND_UNFINISHEDfunction is not finished.
-1internal error.
Examples:
examples/VH/fortran.c, examples/VH/hello.c, examples/VH/hello_static.c, examples/VH/mpi-veo.c, examples/VH/ompfortran.c, examples/VH/ompfortran_static.c, examples/VH/omphello.c, and examples/VH/omphello_static.c.
uint64_t veo_alloc_mem_async ( veo_thr_ctxt *  ctx,
const size_t  size 
)

Allocate a VE memory buffer asynchronously.

The buffer allocation is queued as a urpc alloc request which returns a request ID. This can be queried to retrieve the allocated address as result of the request.

Parameters
[in]ctxVEO thread context
[in]sizesize in bytes
Returns
request ID
Return values
VEO_REQUEST_ID_INVALIDrequest failed.
uint64_t veo_free_mem_async ( veo_thr_ctxt *  ctx,
uint64_t  addr 
)

Free a VE memory buffer asynchronously.

The buffer de-allocation is queued as a urpc request which returns a request ID. This can be queried to retrieve the allocated address as result of the request.

Parameters
[in]ctxVEO thread context
[in]addrVEMVA address
Returns
request ID
Return values
VEO_REQUEST_ID_INVALIDrequest failed.
uint64_t veo_async_read_mem ( veo_thr_ctxt *  ctx,
void *  dst,
uint64_t  src,
size_t  size 
)

Asynchronously read VE memory.

Parameters
[in]ctxVEO context
[out]dstdestination VHVA
[in]srcsource VEMVA
[in]sizesize in byte
Returns
request ID
Return values
VEO_REQUEST_ID_INVALIDrequest failed.
uint64_t veo_async_write_mem ( veo_thr_ctxt *  ctx,
uint64_t  dst,
const void *  src,
size_t  size 
)

Asynchronously write VE memory.

Parameters
[in]ctxVEO context
[out]dstdestination VEMVA
[in]srcsource VHVA
[in]sizesize in byte
Returns
request ID
Return values
VEO_REQUEST_ID_INVALIDrequest failed.
uint64_t veo_call_async_by_name ( veo_thr_ctxt *  ctx,
uint64_t  libhdl,
const char *  symname,
veo_args *  args 
)

request a VE thread to call a function

Parameters
[in]ctxVEO context to execute the function on VE.
[in]libhdla library handle
[in]symnamesymbol name to find
[in]argsarguments to be passed to the function
Returns
request ID
Return values
VEO_REQUEST_ID_INVALIDrequest failed.
Examples:
examples/VH/fortran.c, examples/VH/hello.c, examples/VH/hello_static.c, examples/VH/mpi-veo.c, examples/VH/ompfortran.c, examples/VH/ompfortran_static.c, examples/VH/omphello.c, and examples/VH/omphello_static.c.
uint64_t veo_call_async_vh ( veo_thr_ctxt *  ctx,
uint64_t(*)(void *)  func,
void *  arg 
)

call a VH function asynchronously

Parameters
[in]ctxVEO context in which to execute the function.
[in]funcaddress of VH function to call
[in]argpointer to arguments structure for the function
Returns
request ID
Return values
VEO_REQUEST_ID_INVALIDif request failed.
veo_thr_ctxt_attr* veo_alloc_thr_ctxt_attr ( void  )

allocate and initialize VEO thread context attributes object (veo_thr_ctxt_attr).

Returns
pointer to veo_thr_ctxt_attr
Return values
NULLthe allocation of veo_thr_ctxt_attr failed.
int veo_free_thr_ctxt_attr ( veo_thr_ctxt_attr *  tca)

free VEO thread context attributes object.

Note
freeing a VEO thread context attributes object has no effect on VEO thread contexts that were created using that object.
Parameters
[in]tcaveo_thr_ctxt_attr object
Return values
0VEO thread context attributes are successfully freed.
-1VEO thread context attributes de-allocation failed.
int veo_set_thr_ctxt_stacksize ( veo_thr_ctxt_attr *  tca,
size_t  stack_sz 
)

set stack size of VE thread which executes a VE function.

Parameters
[in]tcaveo_thr_ctxt_attr object
[in]stack_szstack size of VE thread
Returns
0 upon success; -1 upon failure.
int veo_get_thr_ctxt_stacksize ( veo_thr_ctxt_attr *  tca,
size_t *  stack_sz 
)

get stack size of VE thread which executes a VE function.

Parameters
[in]tcaveo_thr_ctxt_attr object
[out]stack_szpointer to store stack size of VE thread.
Returns
0 upon success; -1 upon failure.