DeepLink-org / deeplink.framework

BSD 3-Clause "New" or "Revised" License
55 stars 28 forks source link

support set cpu affinity #872

Closed zhaoguochun1995 closed 2 months ago

zhaoguochun1995 commented 2 months ago

设置cpu 亲和性,让特定的几个cpu使用特定加速卡,减小线程切换的开销,提高缓存命中率。默认情况下(DIPU_CPU_AFFINITY=0),会根据当前可用cpu核心数量和当前可用所有加速卡数量自动计算出每张卡使用的cpu核心数。如果用户手动设置DIPU_CPU_AFFINITY=N, 则每张卡会使用N个cpu核。

Set CPU affinity to let specific CPUs use specific accelerator cards, reduce thread switching overhead, and improve cache hit rate. By default (DIPU_CPU_AFFINITY=0), the number of CPU cores used by each card will be automatically calculated based on the number of currently available CPU cores and the number of all currently available accelerator cards. If DIPU_CPU_AFFINITY=N, each card will use N CPU cores.