由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
CS版 - 如何确保多线程程序在 multicore server 上 用所有的 core
相关主题
请教:Speed UP CPUCS opening @ Santa Clara, CA (转载)
openMP or boost::thread (pthread) for multithreading ?natural and logical languages
各位de过的人生中最可怕的bug是什么?求C++的书, 本人会Core Java
Matlab开多线程真爽啊 (转载)为什么有这么多逻辑?
问个单cpu下的并行处理速度问题为什么多个线程生成的随机数是一样的?
请教windows下多线程程序的优化.【求助】Fortran多线程执行效率问题
Research Software Engineer Opportunity多线程优化求助!
cs master请教职业方向定位,有包子外行转CS进行中,听说cs是吃青春饭,郁闷中
相关话题的讨论汇总
话题: cores话题: cpu话题: multicore话题: threads话题: core
进入CS版参与讨论
1 (共1页)
l******9
发帖数: 579
1
如何确保多线程程序在 multicore server 上确实使用了 所有的 core
to do computing in parallel physically (not logically)
I have a multicore server, which has 24 CPU, each CPU has 6 cores.
It is Intel xzeon X5650 2.67GHz
cpu cores : 6 (support 6 threads)
cpu MHz : 1596.000
totally, I have 24 * 6 = 144 cores.
I designed a multithreaded C++ program with boost/thread.
How to make sure that my program is run by all 144 cores ?
Any help is really appreciated.
thanks
r********3
发帖数: 2998
2
你开144个线程不就行了?
现在的操作系统都能够合理调度并行的线程到不同的core上。
l******9
发帖数: 579
3
thanks for you reply.
I can generate these threads.
But, how to make sure that these threads are really scheduled to
these cores by OS ?
I try yo use "top" command on linux but it is not helpful.
On the multicore server, there are 24 CPUs, each of them has 6 cores.
Sometimes, only one CPU is used to run a multithread program
no matter how many threads are generated.
I run some test program, which create 4 (boost) threads but only one
core is used.
I cannot see all 4 threads are run in 4 cores in parallel.
They may be run sequentially.
Any help is really appreciated.
Thanks

【在 r********3 的大作中提到】
: 你开144个线程不就行了?
: 现在的操作系统都能够合理调度并行的线程到不同的core上。

r********3
发帖数: 2998
4
不会的。现代操作系统一个重要的功能就是调节多任务到多个CPU core上。我在Linux,
Windows,Unix上都从来没有遇到你说的那种调度错误。我估计是你的程序写错了,或者
说你的多个线程之前有太多的竞争资源。

【在 l******9 的大作中提到】
: thanks for you reply.
: I can generate these threads.
: But, how to make sure that these threads are really scheduled to
: these cores by OS ?
: I try yo use "top" command on linux but it is not helpful.
: On the multicore server, there are 24 CPUs, each of them has 6 cores.
: Sometimes, only one CPU is used to run a multithread program
: no matter how many threads are generated.
: I run some test program, which create 4 (boost) threads but only one
: core is used.

N**D
发帖数: 10322
5
read the man of top more

【在 l******9 的大作中提到】
: thanks for you reply.
: I can generate these threads.
: But, how to make sure that these threads are really scheduled to
: these cores by OS ?
: I try yo use "top" command on linux but it is not helpful.
: On the multicore server, there are 24 CPUs, each of them has 6 cores.
: Sometimes, only one CPU is used to run a multithread program
: no matter how many threads are generated.
: I run some test program, which create 4 (boost) threads but only one
: core is used.

j********e
发帖数: 124
6
Good you are using Linux, google for "CPU proximity" for thread scheduling.
Linux kernel can support features like specify which core to run a thread.
r******e
发帖数: 617
7
使用这个函数pthread_setaffinity_np()可以将线程绑定在你想要运行的核上
你可以给每个线程显式地绑定在每个核上。但这个方法可能不是最好的方法。最好
是让操作系统来调度

.

【在 j********e 的大作中提到】
: Good you are using Linux, google for "CPU proximity" for thread scheduling.
: Linux kernel can support features like specify which core to run a thread.

r******e
发帖数: 617
8
你可以检查下你的linux的编译选项,是否打开了对多处理器的支持

【在 l******9 的大作中提到】
: thanks for you reply.
: I can generate these threads.
: But, how to make sure that these threads are really scheduled to
: these cores by OS ?
: I try yo use "top" command on linux but it is not helpful.
: On the multicore server, there are 24 CPUs, each of them has 6 cores.
: Sometimes, only one CPU is used to run a multithread program
: no matter how many threads are generated.
: I run some test program, which create 4 (boost) threads but only one
: core is used.

z***e
发帖数: 5393
9
你以为计算机除了你那几个thread之外,没有别的东西在跑了???

【在 l******9 的大作中提到】
: 如何确保多线程程序在 multicore server 上确实使用了 所有的 core
: to do computing in parallel physically (not logically)
: I have a multicore server, which has 24 CPU, each CPU has 6 cores.
: It is Intel xzeon X5650 2.67GHz
: cpu cores : 6 (support 6 threads)
: cpu MHz : 1596.000
: totally, I have 24 * 6 = 144 cores.
: I designed a multithreaded C++ program with boost/thread.
: How to make sure that my program is run by all 144 cores ?
: Any help is really appreciated.

d***x
发帖数: 336
10
你不能保证一定每个线程一个核,而且操作系统内存的进程多了

【在 r********3 的大作中提到】
: 你开144个线程不就行了?
: 现在的操作系统都能够合理调度并行的线程到不同的core上。

s*****x
发帖数: 52
11

我很好奇这是你们自己定制的机器吗?我没见过 Intel 单机这么多core的many-core
machine在. 最常见的是4 sockets, each socket has 6 cores, each core has 2
hyperthreads. So 4*6*2 = 48 logical CPUs.

【在 l******9 的大作中提到】
: 如何确保多线程程序在 multicore server 上确实使用了 所有的 core
: to do computing in parallel physically (not logically)
: I have a multicore server, which has 24 CPU, each CPU has 6 cores.
: It is Intel xzeon X5650 2.67GHz
: cpu cores : 6 (support 6 threads)
: cpu MHz : 1596.000
: totally, I have 24 * 6 = 144 cores.
: I designed a multithreaded C++ program with boost/thread.
: How to make sure that my program is run by all 144 cores ?
: Any help is really appreciated.

1 (共1页)
进入CS版参与讨论
相关主题
外行转CS进行中,听说cs是吃青春饭,郁闷中问个单cpu下的并行处理速度问题
c++posix多线程问题请教 (转载)请教windows下多线程程序的优化.
About scheduling for RAIDResearch Software Engineer Opportunity
表扬一下Rajeev Alur 同学cs master请教职业方向定位,有包子
请教:Speed UP CPUCS opening @ Santa Clara, CA (转载)
openMP or boost::thread (pthread) for multithreading ?natural and logical languages
各位de过的人生中最可怕的bug是什么?求C++的书, 本人会Core Java
Matlab开多线程真爽啊 (转载)为什么有这么多逻辑?
相关话题的讨论汇总
话题: cores话题: cpu话题: multicore话题: threads话题: core