Rate This Document
Findability
Accuracy
Completeness
Readability

BiSheng Compiler

The BiSheng Compiler is a high-performance, high-reliability, and easy-to-expand compiler toolchain developed by the Huawei Compiler Laboratory for general-purpose processor architectures, such as Kunpeng. It introduces and enhances multiple compilation optimization technologies and supports different programming languages (e.g. C, C++, and Fortran) and their OpenMP extensions.

For details, see the BiSheng Compiler User Guide.

KMP_DISABLE_MEMKIND_INIT Description

The KMP_DISABLE_MEMKIND_INIT environment variable is added to BiSheng Compiler 5.0.0.2. For details, see Table 1.

Table 1 KMP_DISABLE_MEMKIND_INIT description

Configuration

Description

KMP_DISABLE_MEMKIND_INIT=true

Replaces the Open Multi-Processing (OpenMP) on-chip memory extension interfaces (such as omp_high_bw_mem_alloc) with their DDR-equivalent versions in the source code. As a result, the performance of related interfaces is affected.

KMP_DISABLE_MEMKIND_INIT=false

Replaces the OpenMP on-chip memory extension interfaces (such as omp_high_bw_mem_alloc) with the memkind-equivalent versions in the source code. This improves performance on a hardware platform with on-chip memory.

In the Bisheng Compiler, KMP_DISABLE_MEMKIND_INIT is set to false by default, retaining the original implementation. However, to optimize OpenMP program initialization, this variable has been set to true in the environment variable script of the HPCKit BiSheng Compiler. If you think that this configuration affects service performance, you can change KMP_DISABLE_MEMKIND_INIT to false by modifying the modulefile or setvars.sh file of the BiSheng Compiler.

KMP_BLOCKTIME环境变量说明

KML_BLOCKTIME是LLVM/OpenMP运行时环境变量。该变量用于控制并行区域执行完毕后,工作线程在进入阻塞状态前保持自旋等待的主动轮询时长。

当程序离开一个并行区域时,工作线程不会立即释放CPU资源,而是进入自旋阶段以优化后续并行任务的响应延迟。其具体状态行为取决于KMP_BLOCKTIME的设定值

  • 在KMP_BLOCKTIME设定的时间内:线程保持活跃并积极轮询新任务。如果在期间有新的并行区域启动,线程可以迅速做出响应。
  • 超过KMP_BLOCKTIME时间后:如果依然没有新任务,线程就会进入睡眠状态,将CPU资源还给操作系统内核。此后如需再次触发,将引入系统内核开销。

保持OpenMP默认时长设置,请执行:

export KMP_BLOCKTIME=200ms

如有其他配置需要,可参照如下方式:

# 设置等待时间为 5 毫秒
export KMP_BLOCKTIME=5ms

# 设置等待时间为 500 微秒
export KMP_BLOCKTIME=500us

# 让工作线程永远保持活跃,不进入睡眠
export KMP_BLOCKTIME=infinite