最大化TensorFlow* CPU性能 (shell)

详细用法 :最大化TensorFlow* CPU性能
原文:Maximize TensorFlow* Performance on CPU: Considerations and Recommendations for Inference Workloads

export TF_ENABLE_ONEDNN_OPTS=1
intra_op_parallelism = number of physical core per socket
#每个插槽的物理内核数
inter_op_parallelism = number of sockets

get the number of physical core per socket and number of sockets on your platform

#!/bin/bash
total_cpu_cores=$(nproc)
number_sockets=$(($(grep "^physical id" /proc/cpuinfo | awk '{print $4}' | sort -un | tail -1)+1))
number_cpu_cores=$(( (total_cpu_cores/2) / number_sockets))

echo "number of CPU cores per socket: $number_cpu_cores";
echo "number of socket: $number_sockets";
data_format = NHWC
export TF_ENABLE_MKL_NATIVE_FORMAT=1 (or 0)
numactl --cpunodebind=0 --membind=0 python
numactl --cpunodebind=N --membind=N python
numactl --cpunodebind=0 --membind=0 python & numactl --cpunodebind=1 --membind=1 python
export OMP_NUM_THREADS=num physical cores
export KMP_AFFINITY=granularity=fine,compact,1,0
export KMP_BLOCKTIME=0 (or 1)
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值