当您拥有AMD CPU时,可以加快使用Intel-MKL的代码的速度吗? [英] When you have an AMD CPU, can you speed up code that uses the Intel-MKL?

查看:987
本文介绍了当您拥有AMD CPU时,可以加快使用Intel-MKL的代码的速度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个AMD CPU,我正在尝试运行一些使用Intel-MKL的代码。该代码比我预期的要慢得多。

I have an AMD cpu and I'm trying to run some code that uses Intel-MKL. The code is significantly slower than I expected.

推荐答案

是的,您可以加快代码的速度。设置环境变量 MKL_DEBUG_CPU_TYPE = 5 然后运行您的代码。


仅供参考,这会影响任何事情使用Intel-MKL库并在AMD CPU上运行(即影响所有操作系统,并影响所有编程语言和所有程序(旧版本的Matlab ,C,C ++,Python,Anaconda-Python,机器学习,例如Tensorflow和Pytorch ,再次在AMD CPU上使用Intel-MKL库的任何东西)。

Yes you can speed up your code. Set the environment variable MKL_DEBUG_CPU_TYPE=5 then run your code.

FYI this slow down affects anything that uses Intel-MKL library and runs on AMD CPU (i.e. affects all operating systems and affects all programming languages and all programs (older versions of Matlab, C, C++, Python, Anaconda-Python, Machine-Learning like Tensorflow and Pytorch , again anything that uses Intel-MKL library on AMD CPU)).

FYI设置和获取环境变量超出了此问题的范围,但是这里有一些有用的链接:

FYI Setting and getting environment variables is out of scope for this question but here are some helpful links:

  • for Windows and another link with screenshots
    • personally i do: "old" control panel --> system --> advanced --> environment variables --> system variables --> ceate new

    • 简单的 bash 用户只想为其自己的用户设置环境变量,将 export MKL_DEBUG_CPU_TYPE = 5 行添加到用户的 .bashrc中文件

    • for the simple case of a bash user who wants to set the environment variable just for their own user append the line export MKL_DEBUG_CPU_TYPE=5 to your user's .bashrc file

    ps


    • 默认行为是Intel-MKL如果检测到非英特尔则检查CPU并运行较慢的代码。

    • 设置环境变量将覆盖默认行为,即使没有Intel硬件也可以使执行更快的代码。


    • 多年以来,英特尔一直让他们的编译代码先检查CPU,然后再检测到该CPU是否为非Intel处理器。代码会选择运行较慢的代码

    • 有诉讼

    • 诉讼的结果是英特尔不得不披露他们在做什么,但确实不必停止他们正在做的事情

    • 这是具有更多历史记录和信息的Wiki页面: https://en.wikipedia.org/wiki/Intel_C%2B%2B_Compiler#Reception

    • Intel for many years had their compiled code check the CPU first then if the CPU was detected as non-intel the code would choose to run slower code
    • there was a lawsuit
    • a result of the lawsuit was that Intel had to disclose what they were doing but did not have to stop what they were doing
    • here's the wiki page with more history and information: https://en.wikipedia.org/wiki/Intel_C%2B%2B_Compiler#Reception

    这篇关于当您拥有AMD CPU时,可以加快使用Intel-MKL的代码的速度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆