Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Tobias Leibner
dune-common
Commits
c209aa6d
Commit
c209aa6d
authored
4 years ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
[bugfix][Python] indentation of compilation call.
parent
5a2735c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/dune/generator/builder.py
+12
-6
12 additions, 6 deletions
python/dune/generator/builder.py
with
12 additions
and
6 deletions
python/dune/generator/builder.py
+
12
−
6
View file @
c209aa6d
...
...
@@ -131,6 +131,9 @@ class Builder:
self
.
savedOutput
[
1
].
write
(
"
\n
###############################
\n
"
)
def
load
(
self
,
moduleName
,
source
,
pythonName
):
## TODO replace if rank if something better
## and remove barrier further down
if
comm
.
rank
==
0
:
module
=
sys
.
modules
.
get
(
"
dune.generated.
"
+
moduleName
)
if
module
is
None
:
...
...
@@ -146,7 +149,7 @@ class Builder:
with
open
(
os
.
path
.
join
(
sourceFileName
),
'
w
'
)
as
out
:
out
.
write
(
code
)
line
=
"
dune_add_pybind11_module(NAME
"
+
moduleName
+
"
EXCLUDE_FROM_ALL)
"
# first check if t
r
his line is already present in the CMakeLists file
# first check if this line is already present in the CMakeLists file
# (possible if a previous script was stopped by user before module was compiled)
with
open
(
os
.
path
.
join
(
self
.
generated_dir
,
"
CMakeLists.txt
"
),
'
r
'
)
as
out
:
found
=
line
in
out
.
read
()
...
...
@@ -163,12 +166,15 @@ class Builder:
else
:
logger
.
info
(
"
Loading
"
+
pythonName
)
# end of exclusive dune-py lock
# for compilation a shared lock is enough
with
Lock
(
os
.
path
.
join
(
self
.
dune_py_dir
,
'
lock-module.lock
'
),
flags
=
LOCK_SH
):
# lock generated module
with
Lock
(
os
.
path
.
join
(
self
.
dune_py_dir
,
'
lock-
'
+
moduleName
+
'
.lock
'
),
flags
=
LOCK_EX
):
self
.
compile
(
moduleName
)
# for compilation a shared lock is enough
with
Lock
(
os
.
path
.
join
(
self
.
dune_py_dir
,
'
lock-module.lock
'
),
flags
=
LOCK_SH
):
# lock generated module
with
Lock
(
os
.
path
.
join
(
self
.
dune_py_dir
,
'
lock-
'
+
moduleName
+
'
.lock
'
),
flags
=
LOCK_EX
):
self
.
compile
(
moduleName
)
## end if module is not None
## TODO remove barrier here
comm
.
barrier
()
module
=
importlib
.
import_module
(
"
dune.generated.
"
+
moduleName
)
...
...
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