如何确保多线程程序在 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
"这个期限是deadline,中文翻译成死期" who the hell translate deadline to 死期? any of these translations are much better: 截止日期, 期限, 限期 when your boss what your project's deadline is, does he mean what your project's 死期 is? LOL
I am also thinking about openMP. But, how to make sure that openMP take full use of available cores ? Suppose that I have 24 CPUs, each of them has 6 cores (each core supports hyperthreading). I have 10,000 computing tasks, each of them needs 0.001 second. Some of the tasks need to exchange data, which is very small. Which task needs to send/receive data to/from which task is pre-defined. It is known before the program in run. But, the exchange frequency may be very high. I want to schedule tasks such that (1) all cores are always kept busy. (2) all cores' workload is balanced. (3) communication overhead from the data exchange is kept as small as possible. Can openMP help me do this ? or I have to use boost/thread do this manually ? Any comments or ideas are appreciated. Thanks
You just need to make sure your program has at least 144 threads. The kernel will try to schedule to each core depend on the need.
Z*l
24 楼
英文原意就是这个意思啊。 http://en.wikipedia.org/wiki/Deadline Origin It began as a real line, drawn in the dirt or marked by a fence or rail, restricting prisoners in Civil War camps. They were warned, "If you cross this line, you're dead." To make dead sure this important boundary was not overlooked, guards and prisoners soon were calling it by its own bluntly descriptive name, the dead line [1]. 说明中文比较客气或者比较忌讳。
【在 o****o 的大作中提到】 : "这个期限是deadline,中文翻译成死期" : who the hell translate deadline to 死期? : any of these translations are much better: 截止日期, 期限, 限期 : when your boss what your project's deadline is, does he mean what your : project's 死期 is? LOL
f*y
25 楼
Is this a multicore server? I think it should be called a cluster.
【在 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.
好像pthread_setaffinity_np是唯一的方法吧。 I think that for the case here, it would be hard to ask OS to assign a different core for a thread. In linux, thread will be assigned to the same core in the beginning. But it will be migrated to other cores if the thread is a long-lived thread. If a thread is too short, then it possibly stay in the same core. I have an experience that using process can be faster than threads for this short lived threads.
【在 o****o 的大作中提到】 : "这个期限是deadline,中文翻译成死期" : who the hell translate deadline to 死期? : any of these translations are much better: 截止日期, 期限, 限期 : when your boss what your project's deadline is, does he mean what your : project's 死期 is? LOL