Context¶
Functions
-
SplaError spla_ctx_create(SplaContext *ctx, SplaProcessingUnit pu)¶
Create Context with default configuration for given processing unit.
- Parameters
ctx – [out] Context handle.
pu – [in] Processing unit to be used for computations.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_destroy(SplaContext *ctx)¶
Destroy context.
- Parameters
ctx – [in] Context handle.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_processing_unit(SplaContext ctx, SplaProcessingUnit *pu)¶
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
pu – [out] Procesing unit used for computations.
- Returns
Error code or SPLA_SUCCESS.
- SPLA_DEPRECATED SplaError spla_ctx_num_threads (SplaContext ctx, int *numThreads)
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
numThreads – [out] Maximum number of threads used for computations.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_num_tiles(SplaContext ctx, int *numTiles)¶
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
numTiles – [out] Number of tiles used to overlap computation and communication.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_tile_size_host(SplaContext ctx, int *tileSizeHost)¶
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
tileSizeHost – [out] Size of tiles for host compuations and partitioning of communication.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_tile_size_gpu(SplaContext ctx, int *tileSizeGPU)¶
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
tileSizeGPU – [out] Size of tiles on GPU.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_op_threshold_gpu(SplaContext ctx, int *opThresholdGPU)¶
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
opThresholdGPU – [out] Operations threshold, below which computation may be done on Host, even if processing unit is set to GPU. For GEMM, the number of operations is estimatex as 2mnk.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_gpu_device_id(SplaContext ctx, int *deviceId)¶
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
deviceId – [out] Id of GPU used for computations. This is set as fixed parameter by query of device id at context creation.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_allocated_memory_host(SplaContext ctx, uint_least64_t *size)¶
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
size – [in] Total allocated memory on host in bytes used for internal buffers. Does not include allocations through standard C++ allocators. May change with with use of context.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_allocated_memory_pinned(SplaContext ctx, uint_least64_t *size)¶
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
size – [in] Total allocated pinned memory on host in bytes used for internal buffers. Does not include allocations through standard C++ allocators. May change with with use of context.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_allocated_memory_gpu(SplaContext ctx, uint_least64_t *size)¶
Access a Context parameter.
- Parameters
ctx – [in] Context handle.
size – [in] Total allocated memory on gpu in bytes used for internal buffers. Does not include allocations by device libraries like cuBLAS / rocBLAS. May change with with use of context.
- Returns
Error code or SPLA_SUCCESS.
- SPLA_DEPRECATED SplaError spla_ctx_set_num_threads (SplaContext ctx, int numThreads)
Set the number of threads to be used.
- Parameters
ctx – [in] Context handle.
numThreads – [in] Number of threads.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_set_num_tiles(SplaContext ctx, int numTiles)¶
Set the number of tiles.
- Parameters
ctx – [in] Context handle.
numTiles – [in] Number of tiles.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_set_tile_size_host(SplaContext ctx, int tileSizeHost)¶
Set the tile size used for computations on host and partitioning communication.
- Parameters
ctx – [in] Context handle.
tileSizeHost – [in] Size of tiles on host.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_set_op_threshold_gpu(SplaContext ctx, int opThresholdGPU)¶
Set the operations threshold, below which computation may be done on Host, even if processing unit is set to GPU.
For GEMM, the number of operations is estimatex as 2mnk.
- Parameters
ctx – [in] Context handle.
opThresholdGPU – [in] Threshold in number of operations.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_set_tile_size_gpu(SplaContext ctx, int tileSizeGPU)¶
Set tile size for GPU computations.
- Parameters
ctx – [in] Context handle.
tileSizeGPU – [in] Size of tiles on GPU.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_set_alloc_host(SplaContext ctx, void *(*allocateFunc)(size_t), void (*deallocateFunc)(void*))¶
Set the allocation and deallocation functions for host memory.
Internal default uses a memory pool for better performance. Not available in Fortran module.
- Parameters
ctx – [in] Context handle.
allocateFunc – [in] Function allocating given size in bytes.
deallocateFunc – [in] Function to deallocate memory allocated using allocateFunc.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_set_alloc_pinned(SplaContext ctx, void *(*allocateFunc)(size_t), void (*deallocateFunc)(void*))¶
Set the allocation and deallocation functions for pinned host memory.
Internal default uses a memory pool for better performance. Not available in Fortran module.
- Parameters
ctx – [in] Context handle.
allocateFunc – [in] Function allocating given size in bytes.
deallocateFunc – [in] Function to deallocate memory allocated using allocateFunc.
- Returns
Error code or SPLA_SUCCESS.
-
SplaError spla_ctx_set_alloc_gpu(SplaContext ctx, void *(*allocateFunc)(size_t), void (*deallocateFunc)(void*))¶
Set the allocation and deallocation functions for gpu memory.
Internal default uses a memory pool for better performance. Not available in Fortran module.
- Parameters
ctx – [in] Context handle.
allocateFunc – [in] Function allocating given size in bytes.
deallocateFunc – [in] Function to deallocate memory allocated using allocateFunc.
- Returns
Error code or SPLA_SUCCESS.