OMP_NUM_THREADS and hwloc/linux error Running Lammps

Hello. I have started using Lammps on Ubuntu. The simulation works and I get the expected results. However, there are some warnings which I can’t fix. I’m using LAMMPS (23 Jun 2022 - Update 4) version of Lammps on Ubuntu 22.04.

One is:

hwloc/linux: Ignoring PCI device with non-16bit domain.
Pass --enable-32bits-pci-domain to configure to support such devices
(warning: it would break the library ABI, don’t enable unless really needed).
hwloc/linux: Ignoring PCI device with non-16bit domain.
Pass --enable-32bits-pci-domain to configure to support such devices
(warning: it would break the library ABI, don’t enable unless really needed).
LAMMPS (23 Jun 2022 - Update 4)

second is:

OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
using 1 OpenMP thread(s) per MPI task.

Any help would be appreciated.

First off, please always follow some common sense rules before and when posting new topics to this forum. For example:

  • Always use a meaningful subject that describes what your new topic is about. Since you are posting to a category about LAMMPS, using the subject “Lammps” is about a bad as not using a subject at all. Please keep in mind that this is not just for you personally, but for the entire community and any responses should be easily found by others with the same questions.
  • Always do some searches on the web and/or here in the forum to figure out what the situation is about. As you are new and not doing anything unusual, the chance is high that somebody else has had the same concern and that was answered.
  • Always report which specific LAMMPS version you are using and how you installed it.
  • Always be mindful of how much effort it is to respond to questions. This is a community forum, which means that any responses come from volunteers, people that are fellow LAMMPS users just as you.

This is not at all a LAMMPS issue. A quick web search finds that this originates from OpenMPI, which is the default MPI library on Ubuntu and uses the “hwloc” library (if available) to manage processor and memory affinity and NUMA optimizations etc.

This is also something where you should easily find an answer for from a search of the forum (we have an archive of messages that goes back over 15 years) or the web.

This is due to having a LAMMPS executable with OpenMP support. It explicitly states that the OMP_NUM_THREADS environment variable. that is needed to control the number of OpenMP threads, has not been set. Under normal circumstances the number of OpenMP threads used would then be left to the compiler vendor. Since those usually choose to use all available threads, LAMMPS prints a warning, that it does not follow that behavior and makes a more reasonable choice of using only 1 thread (since LAMMPS also supports MPI and when running multiple MPI processes on the same host, each would use all threads, this would lead to a very inefficient behavior).

Both warnings can be ignored. The second can be easily suppressed by setting OMP_NUM_THREADS to 1 in your environment (and then only change it to a different value when you want to use OpenMP threads), e.g. when using LAMMPS styles from the 7.4.4. OPENMP package — LAMMPS documentation

Thanks for your reply. I can definitely change the subject line. I’m just not sure which subject to pick.

Now about the Open_MPI, I understand where is comes from, my question was how to fix it without making any changes to the Lammps itself.

For the second warning, the OMP_NUM_THREADS, I don’t want to set it to one. I want the system dynamically be able to change, or at least using the max number for that. Thread is different from the #cores, so choosing one seems very simplistic, unless I’m missing something.

Just use some common sense here. An obvious choice would be something “Unexpected warnings when running LAMMPS”. Anything descriptive is better than just “Lammps”. When you write a paper you don’t just put “Paper” as a title, or do you?

You are asking in the wrong place. This is a forum about LAMMPS and not OpenMPI. Do a web search, look for previous discussions on the subject (you are not likely the first to encounter this) and see what people have suggested to get rid of it (if anything). The simple solution would be to either not compile with MPI support or use a different MPI library.

You are not making any sense here. As I already explained, you do want to keep this at 1 unless you are explicitly running a hybrid MPI+OpenMP simulation where you then have to very carefully and explicitly choose how many MPI processes you run and how many OpenMP threads per MPI process. There is no “dynamic change”.
To give an example: if you are running on a laptop with a quad-core cpu, you typically want to run with mpirun -np 4. If you also set OMP_NUM_THREADS to 4 (or disable the part of the code than forces it to 1 unless the environment variable is set), then your calculation would be using a total of 16 threads on only 4 cores. On modern CPUs this overloading will result in a massive slowdown.
Using OpenMP threads only makes sense when you are using the OPENMP or INTEL or KOKKOS package and you are running under circumstances, where the MPI parallelization becomes less efficient. On CPUs with hyper-threading enabled, sometimes using 2 OpenMP threads is more efficient than using twice as many MPI processes. Generally, hyperthreading is disabled on most HPC clusters, because it interferes with effective usage on multi-node jobs (it is a much better help to improve performance on desktops with fluctuating workloads).

Bottom line, if you have as little experience in these matters as it appears, do not use threading and set OMP_NUM_THREADS to 1 or just ignore the (harmless) warning.