Multi-threading not actually working on another machine

Alfio Lazzaro alfio.... at
Sat Feb 25 06:26:40 UTC 2017

The CP2K output is fine. 
Now, if you rely on top command to see how many threads you are running, 
that is somehow underestimated (it will show you the average CPU 
utilization). You can use the options in the second answer of this post 
to disaggregate all the running threads.
Another test is to set less number of threads (for example 
OMP_NUM_THREADS=4) and see how it goes.
In any case, as I mentioned in my previous email, for such large number of 
cores you should consider to run the PSMP version, i.e. MPI+OpenMP (your 40 
cores are using different NUMA domains, so you should set at least one MPI 
rank per NUMA domain).


Il giorno venerdì 24 febbraio 2017 17:06:49 UTC+1, William Tao ha scritto:
> Dear Alfio,
> I did set up the OMP_NUM_THREADS as 40 for my calculation. And here is 
> part of my output in the very beginning.
>  GLOBAL| Force Environment number                                         
>      1
>  GLOBAL| Basis set file name                                           
>  GLOBAL| Potential file name                                     
>  GLOBAL| MM Potential file name                                     
>  GLOBAL| Coordinate file name                                         
>  GLOBAL| Method name                                                       
>  CP2K
>  GLOBAL| Project name                                             ATOM-309
>  GLOBAL| Preferred FFT library                                             
>  GLOBAL| Preferred diagonalization lib.                                   
>     SL
>  GLOBAL| Run type                                                         
>     MD
>  GLOBAL| All-to-all communication in single precision                     
>      F
>  GLOBAL| FFTs using library dependent lengths                             
>      F
>  GLOBAL| Global print level                                               
>    LOW
>  GLOBAL| Total number of message passing processes                         
>     1
> * GLOBAL| Number of threads for this process                               
>     40*
>  GLOBAL| This output is from process                                       
>     0
>  GLOBAL| CPU model name :  Intel(R) Xeon(R) CPU E7-8891 v3 @ 2.80GHz
> However, when running, it could only use up to 8 threads.
> Thank you.
> William
> 在 2017年2月24日星期五 UTC-6上午1:47:37,Alfio Lazzaro写道:
>> Dear William,
>> CP2K uses OpenMP for the threading. The number of threads is set by using 
>> the environment variable OMP_NUM_THREADS and it goes at runtime, therefore 
>> there is no relation with the compilation (you can specify the number of 
>> threads at runtime). By default, if you don't set the variable, OpenMP 
>> assumes the maximum number of available threads on the system (8 and 40 in 
>> your case). That's why you see 40 threads. However, you should consider 
>> that it is very hard to get good scalability for such large number of 
>> threads (actually it depends on your workload), that's why in "average" 
>> (what you see from top command) you are using 8 corresponding fully loaded 
>> threads.
>> I can suggest to experiment with setting a different number of threads. 
>> Just use:
>> export OMP_NUM_THREADS=<any number between 1 and 40>
>> before running CP2K.
>> Another better solution would be to use MPI and OpenMP (psmp version), by 
>> using 4 MPI ranks and 10 threads (for example). Likely it would give you 
>> better performance...
>> Alfio
>> Il giorno giovedì 23 febbraio 2017 22:48:01 UTC+1, William Tao ha scritto:
>>> Dear friends,
>>> I compiled the cp2k version 4.1 on a 8-core CPU machine.
>>> When I run the binary cp2k.ssmp on another machine with 40-core CPU, the 
>>> output prints that the number of threads is 40.
>>> However, when I check with "top" command, the process could use up to 
>>> 800% CPU.
>>> Does anybody know what is going on?
>>> William 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the CP2K-user mailing list