Skip to content
Snippets Groups Projects
Commit 5037a1d2 authored by Robert K's avatar Robert K
Browse files

[cleanup][ThreadPass] Re-enable threaded initialization since dead lock

seems to be fixed in dune-fem.
parent 5067b02b
No related branches found
No related tags found
1 merge request!29Fix threading with python.
Pipeline #34475 failed
......@@ -252,21 +252,22 @@ namespace Fem
// initialize thread pass here since it otherwise fails when parameters
// are passed from the Python side
#if 1
// initialize each thread pass by the thread itself to avoid NUMA effects
{
// see threadhandle.hh
Fem :: ThreadHandle :: runLocked( *this );
}
#else
{
// fall back if the above does not work
const int maxThreads = Fem::ThreadManager::maxThreads();
for(int i=0; i<maxThreads; ++i)
{
createInnerPass( i, i == 0 );
}
}
/*
// initialize each thread pass by the thread itself to avoid NUMA effects
{
// see threadhandle.hh
Fem :: ThreadHandle :: runLocked( *this );
}
*/
#endif
#ifndef NDEBUG
{
......
import os
# set number of threads to be used for thread parallel version
os.environ['OMP_NUM_THREADS'] = '4'
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('problem', type=int,
......@@ -31,13 +35,14 @@ domain = (reader.dgf, "unitsquare.dgf")
os.makedirs("advection", exist_ok=True)
##################
threading=True
if problem == 1:
gridView = view( aluGrid( domain, dimgrid=2 ) )
gridView.hierarchicalGrid.globalRefine(3)
evolve(gridView, order, Model, "advection/none",
space="onb", limiter=None,
maxLevel=-1, threading=False, codegen=True, outputs=5)
maxLevel=-1, threading=threading, codegen=True, outputs=5)
##################
......@@ -45,7 +50,7 @@ if problem == 2:
gridView = view( aluGrid( domain, dimgrid=2 ) )
gridView.hierarchicalGrid.globalRefine(3)
evolve(gridView, order, Model, "advection/minmod",
space="onb", maxLevel=-1, threading=False, codegen=True, outputs=5)
space="onb", maxLevel=-1, threading=threading, codegen=True, outputs=5)
if problem == 3:
from ufl import conditional
......@@ -58,7 +63,7 @@ if problem == 3:
gridView.hierarchicalGrid.globalRefine(3)
evolve(gridView, order, Model, "advection/physical",
space="lobatto", limiter="lp",
maxLevel=-1, threading=False, codegen=True, outputs=5)
maxLevel=-1, threading=threading, codegen=True, outputs=5)
if problem == 4:
from ufl import conditional
......@@ -71,7 +76,7 @@ if problem == 4:
evolve(gridView, order, Model, "advection/scaling",
#space="lobatto", limiter="scaling",
space="legendre", limiter="scaling",
maxLevel=-1, threading=False, codegen=True, outputs=5)
maxLevel=-1, threading=threading, codegen=True, outputs=5)
##################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment