Menu

setting OMP_NUM_THREADS

2016-12-06
2016-12-06
  • Sander Rhebergen

    Hi,

    I am trying to set OMP_NUM_THREADS, but it seems ngsolve overwrites what I'm setting. From the command line I do for example

    export OMP_NUM_THREADS=2

    which then gets set (echo $OMP_NUM_THREADS gives me 2), but when I run a simulation I get a message:

    Running parallel using 8 thread(s)
    (number of threads can be changed by setting OMP_NUM_THREADS)

    How do I set OMP_NUM_THREADS such that ngsolve doesn't overwrite it?

    thanks,
    Sander

     
  • Joachim Schoeberl

    I just removed this relict from openmp. Use

    SetNumThreads(n)
    

    in your python script.

     
  • Sander Rhebergen

    I did as you suggested but with no succes. At the top of my python scripct I have now

    from ngsolve import *
    SetNumThreads(2)
    

    but still when I run the code I get

    Using Lapack
    Including sparse direct solver Pardiso
    Running parallel using 8 thread(s)
    (number of threads can be changed by setting OMP_NUM_THREADS)
    python init file = /opt/netgen/bin/init.py

    thanks,
    Sander

     
  • Joachim Schoeberl

    when you check (e.g. using top) how many threads you are actually using you should see two. This applies to the ngsolve parallelization using TaskManager. External solvers (like pardiso) do use the OMP_NUM_THREADS variable.

     
  • Sander Rhebergen

    thanks - I think it's doing now as expected.
    Sander

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.