Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker运行镜像cpu模式下,cpu的利用率最大只有1600%,如何提升? #281

Open
421hl opened this issue Mar 14, 2024 · 4 comments

Comments

@421hl
Copy link

421hl commented Mar 14, 2024

我有一台虚机测试运行,32个cpus,我观察到在cpu模式运行下,通过docker stats查看cpu利用率最多只有1600%(如果满负荷,理论上应该达到3200%)。
调整虚机到64个cpus,观察cpu利用率依然只有1600%(如果满负荷,理论上应该达到6400%)。
说明文档中有写到,cpu模式测试性能时是跑的16个线程,是否跟这个有关系?能否有参数进行调整让cpu利用率提高一些?

@magnww
Copy link

magnww commented Mar 18, 2024

环境变量num_threads可以设置线程数

@421hl
Copy link
Author

421hl commented Mar 28, 2024

环境变量num_threads可以设置线程数

还请指教,num_threads 这个参数具体在哪里设置,感谢!

@magnww
Copy link

magnww commented Mar 28, 2024

环境变量num_threads可以设置线程数

还请指教,num_threads 这个参数具体在哪里设置,感谢!

docker run -it --rm -v $PWD:/opt -p 8000:8000 -e MODEL=/opt/chatglm-ggml.bin \
+   -e num_threads=64 \
    chatglm.cpp \
    uvicorn chatglm_cpp.openai_api:app --host 0.0.0.0 --port 8000

@zyz619963502zyz
Copy link

zyz619963502zyz commented Apr 2, 2024

环境变量num_threads可以设置线程数

还请指教,num_threads这个参数具体在哪里设置,谢谢!

开2个页面访问,一个正常输出,第二个等待;

一个正常输出
image

第二个页面等待,第一个结束,就正常输出了
image

你知道原因吗,难道单线程跑?我跑得是下面 chatglm6b-v3.1
image
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants