abacus-develop icon indicating copy to clipboard operation
abacus-develop copied to clipboard

Feature: set OpenMP thread num to a proper default value

Open caic99 opened this issue 10 months ago • 4 comments

Reminder

  • [ ] Have you linked an issue with this pull request?
  • [ ] Have you added adequate unit tests and/or case tests for your pull request?
  • [ ] Have you noticed possible changes of behavior below or in the linked issue?
  • [ ] Have you explained the changes of codes in core modules of ESolver, HSolver, ElecState, Hamilt, Operator or Psi? (ignore if not applicable)

Linked Issue

Fix #3701

Unit Tests and/or Case Tests for my changes

  • A unit test is added for each new feature or bug fix.

What's changed?

ABACUS will try to set a proper OpenMP threading value if OMP_NUM_THREADS is not set, and exit with error if the value set is beyond hardware availability (which should not happen since the value has been automatically set).

caic99 avatar Apr 10 '24 03:04 caic99

Could someone please help me on this error building tests?

caic99 avatar Apr 11 '24 04:04 caic99

@caic99 I have some test by using this repo. It worked well , but if the machine has hyper-thread (like WSL or bohrium image), the product of OMP number and MPI number will include hyper-thread and lead to lower parallel efficiency than the hardware-core (hyper-thread / 2) situation.

QuantumMisaka avatar Apr 11 '24 10:04 QuantumMisaka

@caic99 I have some test by using this repo. It worked well , but if the machine has hyper-thread (like WSL or bohrium image), the product of OMP number and MPI number will include hyper-thread and lead to lower parallel efficiency than the hardware-core (hyper-thread / 2) situation.

It's hard to determine with standard c++ API whether hyperthreading is used.

caic99 avatar Apr 11 '24 10:04 caic99

Any updates?

mohanchen avatar May 04 '24 07:05 mohanchen