Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-fem-dg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dune-fem
dune-fem-dg
Commits
a3b0db3b
Commit
a3b0db3b
authored
11 months ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
[feature] Add threaded compilation.
parent
af0adf86
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pydemo/camc-paper/evolve.py
+12
-8
12 additions, 8 deletions
pydemo/camc-paper/evolve.py
with
12 additions
and
8 deletions
pydemo/camc-paper/evolve.py
+
12
−
8
View file @
a3b0db3b
...
...
@@ -4,6 +4,7 @@ from dune.common import comm
print
=
partial
(
print
,
flush
=
True
)
if
comm
.
rank
==
0
else
lambda
*
args
,
**
kwargs
:
None
import
time
,
numpy
from
concurrent.futures
import
ThreadPoolExecutor
from
dune.generator
import
path
,
algorithm
from
dune.typeregistry
import
generateTypeName
...
...
@@ -23,13 +24,16 @@ spaces = {
'
gauss
'
:
lambda
*
args
,
**
kwargs
:
dglagrange
(
*
args
,
**
kwargs
,
pointType
=
"
gauss
"
)
}
def
getSpace
(
gridView
,
order
,
dimRange
,
space
):
if
order
==
0
:
return
finiteVolume
(
gridView
,
dimRange
=
dimRange
)
else
:
return
space
(
gridView
,
dimRange
=
dimRange
,
order
=
order
,
codegen
=
False
)
# return tuple of spaces
def
getSpaces
(
gridView
,
order
,
dimRange
,
space
):
with
ThreadPoolExecutor
(
max_workers
=
2
)
as
executor
:
if
order
==
0
:
spc
=
executor
.
submit
(
finiteVolume
,
gridView
,
dimRange
=
dimRange
)
else
:
spc
=
executor
.
submit
(
space
,
gridView
,
order
=
order
,
dimRange
=
dimRange
,
codegen
=
False
)
sfv
=
executor
.
submit
(
finiteVolume
,
gridView
,
dimRange
=
dimRange
)
return
(
spc
.
result
(),
sfv
.
result
())
def
evolve
(
gridView
,
order
,
Model
,
outName
,
limiter
=
"
default
"
,
space
=
'
onb
'
,
...
...
@@ -42,7 +46,8 @@ def evolve(gridView, order, Model, outName,
print
(
'
evolve:
'
,
order
,
outName
,
limiter
,
space
,
maxLevel
,
parameters
,
codegen
,
outputs
,
threading
)
space
=
getSpace
(
gridView
,
order
,
dimRange
=
Model
.
dimRange
,
space
=
spaces
[
space
])
space
,
fvspc
=
getSpaces
(
gridView
,
order
,
dimRange
=
Model
.
dimRange
,
space
=
spaces
[
space
])
U_h
=
space
.
interpolate
(
Model
.
U0
,
name
=
"
solution
"
)
if
limiter
==
"
modal
"
:
...
...
@@ -88,7 +93,6 @@ def evolve(gridView, order, Model, outName,
un
=
U_h
.
copy
()
indicator
,
residualOperator
=
residualIndicator
(
Model
,
space
,
un
)
fvspc
=
finiteVolume
(
gridView
,
dimRange
=
space
.
dimRange
)
fvU
=
fvspc
.
interpolate
(
U_h
,
name
=
"
fvU
"
)
pointdata
=
[
U_h
]
celldata
=
[
partitionFunction
(
gridView
),
fvU
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment