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.
|