为什么” NumExpr 默认为 8 个线程。 ” python 中显示警告消息?
我正在尝试使用 python 中的 lux 库来获取可视化建议。它显示诸如 NumExpr defaulting to 8threading. 之类的警告。
import pandas as pd
import numpy as np
import opendatasets as od
pip install lux-api
import lux
import matplotlib
然后:
link = "https://www.kaggle.com/noordeen/insurance-premium-prediction"
od.download(link)
df = pd.read_csv("./insurance-premium-prediction/insurance.csv")
I am trying to use the lux library in python to get visualization recommendations. It shows warnings like NumExpr defaulting to 8 threads..
import pandas as pd
import numpy as np
import opendatasets as od
pip install lux-api
import lux
import matplotlib
And then:
link = "https://www.kaggle.com/noordeen/insurance-premium-prediction"
od.download(link)
df = pd.read_csv("./insurance-premium-prediction/insurance.csv")
But, everything is working fine. Is there any problem or should I ignore it?
Warning shows like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在大多数情况下,这并不是真正值得担心的事情。该警告来自此函数,此处为最重要的部分:
所以如果两者都不是设置
NUMEXPR_MAX_THREADS
或NUMEXPR_NUM_THREADS
或OMP_NUM_THREADS
时,NumExpr 使用的线程数与内核数相同(即使 文档说“最多 8”,但这不是我看到的 在代码中)。您可能想要使用另一数量的线程,例如,当计算真正巨大的矩阵时,人们可以从中受益,或者使用更少的线程,因为没有任何改进。在 shell 中或在导入 numexpr 之前设置环境变量,例如
This is not really something to worry about in most cases. The warning comes from this function, here the most important part:
So if neither
NUMEXPR_MAX_THREADS
norNUMEXPR_NUM_THREADS
norOMP_NUM_THREADS
are set, NumExpr uses so many threads as there are cores (even if the documentation says "at most 8", yet this is not what I see in the code).You might want to use another number of threads, e.g. while really huge matrices are calculated and one could profit from it or to use less threads, because there is no improvement. Set the environment variables either in the shell or prior to importing numexpr, e.g.