Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-codegen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Christian Heinigk
dune-codegen
Commits
218469c2
Commit
218469c2
authored
6 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Implement proper file locking to allow multiple processes to autotune the same stuff
parent
9d9eef7d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/dune/perftool/sumfact/autotune.py
+24
-22
24 additions, 22 deletions
python/dune/perftool/sumfact/autotune.py
python/setup.py
+1
-1
1 addition, 1 deletion
python/setup.py
with
25 additions
and
23 deletions
python/dune/perftool/sumfact/autotune.py
+
24
−
22
View file @
218469c2
...
...
@@ -11,6 +11,7 @@ from pytools import product
import
os
import
re
import
subprocess
import
filelock
def
get_cmake_cache_entry
(
entry
):
...
...
@@ -193,28 +194,29 @@ def autotune_realization(sf):
name
=
os
.
path
.
join
(
dir
,
"
autotune_sumfact_{}
"
.
format
(
sf
.
function_name
))
filename
=
os
.
path
.
join
(
dir
,
"
{}.cc
"
.
format
(
basename
))
logname
=
os
.
path
.
join
(
dir
,
"
{}.log
"
.
format
(
basename
))
# If the log file already exists, we can reuse the benchmark results
# and do not need to rerun it.
if
not
os
.
path
.
isfile
(
logname
):
# Generate and compile a benchmark program
with
cache_restoring
():
generate_standalone_code
(
sf
,
filename
,
logname
)
ret
=
subprocess
.
call
(
compiler_invocation
(
name
,
filename
))
assert
ret
==
0
# Check whether the user specified an execution wrapper
call
=
[]
wrapper
=
get_cmake_cache_entry
(
"
DUNE_PERFTOOL_BENCHMARK_WRAPPER
"
)
if
wrapper
:
call
.
append
(
wrapper
)
# Run the benchmark program
call
.
append
(
name
)
devnull
=
open
(
os
.
devnull
,
'
w
'
)
ret
=
subprocess
.
call
(
call
,
stdout
=
devnull
,
stderr
=
subprocess
.
STDOUT
)
assert
ret
==
0
lock
=
"
{}.lock
"
.
format
(
name
)
# Generate and compile a benchmark program
with
cache_restoring
():
with
filelock
.
FileLock
(
lock
):
if
not
os
.
path
.
isfile
(
logname
):
if
os
.
path
.
isfile
(
filename
):
generate_standalone_code
(
sf
,
filename
,
logname
)
ret
=
subprocess
.
call
(
compiler_invocation
(
name
,
filename
))
assert
ret
==
0
# Check whether the user specified an execution wrapper
call
=
[]
wrapper
=
get_cmake_cache_entry
(
"
DUNE_PERFTOOL_BENCHMARK_WRAPPER
"
)
if
wrapper
:
call
.
append
(
wrapper
)
# Run the benchmark program
call
.
append
(
name
)
devnull
=
open
(
os
.
devnull
,
'
w
'
)
ret
=
subprocess
.
call
(
call
,
stdout
=
devnull
,
stderr
=
subprocess
.
STDOUT
)
assert
ret
==
0
# Extract the result form the log file
return
float
(
next
(
iter
(
open
(
logname
,
"
r
"
))))
/
1000000
This diff is collapsed.
Click to expand it.
python/setup.py
+
1
−
1
View file @
218469c2
...
...
@@ -41,7 +41,7 @@ setup(name='dune.perftool',
'
dune.perftool.ufl
'
,
'
dune.perftool.ufl.transformations
'
,
],
install_requires
=
[
'
dune.testtools
'
,
'
sympy
'
,
'
frozendict
'
,
'
pytest
'
,
'
pytest-pep8
'
],
install_requires
=
[
'
dune.testtools
'
,
'
sympy
'
,
'
frozendict
'
,
'
pytest
'
,
'
pytest-pep8
'
,
'
filelock
'
],
cmdclass
=
{
'
test
'
:
PyTest
},
entry_points
=
{
"
console_scripts
"
:
[
...
...
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