AOCL-DLP provides comprehensive runtime control over threading behavior through environment variables and API calls.
AOCL-DLP Threading Variables:
Variable |
Type |
Description |
Example Values |
|---|---|---|---|
|
Integer |
Sets total number of threads for GEMM operations |
|
|
Integer |
Number of threads for inner loop parallelization (IC dimension) |
|
|
Integer |
Number of threads for outer loop parallelization (JC dimension) |
|
Note: When both DLP_IC_NT and DLP_JC_NT are set, DLP_NUM_THREADS is ignored.
OpenMP Environment Variables:
When using OpenMP threading model, these variables affect performance:
Variable |
Type |
Description |
Example Values |
|---|---|---|---|
|
Integer |
Number of OpenMP threads |
|
|
String |
Thread affinity policy |
|
|
String |
Thread placement specification |
|
|
String |
Thread wait policy for better performance |
|
Additional Environment Variables:
Variable |
Description |
Example |
|---|---|---|
|
Force specific instruction set, overriding auto-detection. See Dynamic Dispatch for the full list of supported values. |
|
|
Enable detailed logging for low-precision GEMM operations. This variable only takes effect if the library is built with |
|
Usage Examples:
Basic Threading Configuration:
# Set 8 threads for all GEMM operations
export DLP_NUM_THREADS=8
./your_application
# Use 2x4 thread decomposition (2 for JC, 4 for IC)
export DLP_JC_NT=2
export DLP_IC_NT=4
./your_application
OpenMP Optimization for NUMA Systems:
# Multi-socket systems - bind to specific NUMA node with interleaved memory
# Example: 128 cores total, using second socket (cores 64-127, NUMA node 1)
export OMP_WAIT_POLICY=active
export OMP_NUM_THREADS=128
export OMP_PLACES=cores
export OMP_PROC_BIND=close
numactl --cpunodebind=1 --interleave=1 ./your_application
# Alternative: Bind to specific core range
export OMP_WAIT_POLICY=active
export OMP_NUM_THREADS=64
export OMP_PLACES=cores
export OMP_PROC_BIND=close
numactl -C 64-127 --interleave=1 ./your_application
# Single-socket systems - keep threads and memory local
export OMP_WAIT_POLICY=active
export OMP_PROC_BIND=close
export OMP_PLACES=cores
export OMP_NUM_THREADS=16
numactl --cpunodebind=0 --membind=0 ./your_application
Recommended Production Command:
For optimal AOCL-DLP performance on multi-socket systems, use the following comprehensive command template:
# Optimal configuration for second socket with 128 cores
# Adjust OMP_NUM_THREADS based on your system's core count per socket
OMP_WAIT_POLICY=active \
OMP_NUM_THREADS=128 \
OMP_PLACES=cores \
OMP_PROC_BIND=close \
numactl --cpunodebind=1 --interleave=1 \
./your_application
API-Based Thread Control:
AOCL-DLP provides runtime APIs for thread control at two levels:
Thread-local APIs (affect only the calling thread – highest precedence):
#include "aocl_dlp.h"
// Set total number of threads (thread-local)
dlp_thread_set_num_threads(8);
// Set 2D thread decomposition: JC=2, IC=4 (thread-local)
dlp_thread_set_ways(2, 4);
Library-global APIs (affect all threads in the process):
// Set total number of threads (process-wide)
dlp_thread_set_num_threads_library(8);
// Set 2D decomposition (process-wide)
dlp_thread_set_ways_library(2, 4);
Query APIs (get active configuration):
// Get active thread count
md_t active_threads = dlp_thread_get_num_threads_active();
// Get active JC and IC ways
md_t jc = dlp_thread_get_jc_ways_active();
md_t ic = dlp_thread_get_ic_ways_active();
For comprehensive performance optimization strategies and detailed tuning information, refer to the Performance Guide Wiki and the Environment Variables Wiki.