ExpHP / rsp2

phonons in rust
Apache License 2.0
2 stars 1 forks source link

Poor usage of multithreading observed on edge #109

Open ExpHP opened 4 years ago

ExpHP commented 4 years ago

I ran a computation yesterday at edge:data/out-sparse-matrix-opt with -n16 and never saw the CPU usage climb much above 200% CPU during the majority of CG or force constants calculation. (I didn't see diagonalization but I've witnessed that using full CPU power in the past and hopefully it still did this time as well)

This is the first computation of this sort that I've run in a while so I can't recall if this is a new problem or an old one. It just seemed.... kind of disgusting.

Anyways, not worth doing anything about it now at this critical time. Just a problem that I noticed.

ExpHP commented 4 years ago

Okay, part of this was because I forgot that optimizing with lattice parameter disables bond list caching. This wasn't too noticeable on smaller systems, but regenerating the bond list is pretty expensive in big systems and it is done by serial code.

There is already an option to reduce the frequency of bond list invalidation.

potential:
  - kc-layered:
      skin-check-frequency: 0  # or 100, or 5000, etc.

(unrelated: why is it called skin-check-frequency and not skin-check-interval?)

This speeds up some big systems (~0.22 degrees) by a good factor of three (based on logfile timings), making it use multithreading about 30% of the time (ballpark estimate based on watching top).

I didn't look too much into the remaining performance issue but if I had to guess it's probably the serialized code that converts forces on normals into bond forces after KC runs...