Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
dorie
dorie
Commits
8000e4a9
Commit
8000e4a9
authored
Dec 18, 2016
by
Dion Haefner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow mpirun to run as root during CI
parent
eb5ab619
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
8 deletions
+32
-8
bin/dorie.in
bin/dorie.in
+22
-5
python/parfield/wrapper/pf_from_file.py.in
python/parfield/wrapper/pf_from_file.py.in
+9
-2
testing/parfield_parallel.mini.in
testing/parfield_parallel.mini.in
+1
-1
No files found.
bin/dorie.in
View file @
8000e4a9
...
...
@@ -25,7 +25,11 @@ MPIEXEC_POSTFLAGS = "@MPIEXEC_POSTFLAGS@"
DORIE_EXECUTABLE
=
os
.
path
.
join
(
DORIEDIR
,
"dune/dorie/dorie"
)
PARAMETERDIR
=
os
.
path
.
join
(
DORIEDIR
,
"doc/default_files"
)
DORIE_PYTHON
=
os
.
path
.
join
(
DORIEDIR
,
"dune-env"
)
MPIRUN
=
lambda
nproc
,
exe
,
*
args
:
[
k
for
k
in
[
MPIEXEC
,
MPIEXEC_NUMPROC_FLAG
,
str
(
nproc
),
MPIEXEC_PREFLAG
,
str
(
exe
),
MPIEXEC_POSTFLAGS
]
+
list
(
args
)
if
k
]
def
MPIRUN
(
nproc
,
exe
,
*
args
,
mpi_flags
=
None
):
mpi_flags
=
[]
if
not
mpi_flags
else
list
(
mpi_flags
)
return
[
k
for
k
in
[
MPIEXEC
,
MPIEXEC_NUMPROC_FLAG
,
str
(
nproc
)]
\
+
mpi_flags
+
[
MPIEXEC_PREFLAG
,
str
(
exe
),
MPIEXEC_POSTFLAGS
]
+
list
(
args
)
if
k
]
def
run
(
args
):
if
not
os
.
path
.
isfile
(
args
[
"config"
]):
...
...
@@ -34,7 +38,8 @@ def run(args):
if
args
[
"parallel"
]
==
1
:
subprocess
.
check_call
([
DORIE_EXECUTABLE
,
args
[
"config"
]])
else
:
subprocess
.
check_call
(
MPIRUN
(
args
[
"parallel"
],
DORIE_EXECUTABLE
,
args
[
"config"
]))
subprocess
.
check_call
(
MPIRUN
(
args
[
"parallel"
],
DORIE_EXECUTABLE
,
args
[
"config"
],
mpi_flags
=
args
[
"mpi_flags"
]))
except
subprocess
.
CalledProcessError
:
print
(
"Error while running DORiE"
)
sys
.
exit
(
1
)
...
...
@@ -56,7 +61,13 @@ def pfg(args):
if
args
[
"parallel"
]
==
1
:
subprocess
.
check_call
([
DORIE_PYTHON
,
"pf_from_file.py"
,
args
[
"config"
]])
else
:
subprocess
.
check_call
([
DORIE_PYTHON
,
"pf_from_file.py"
,
args
[
"config"
],
"--parallel"
,
str
(
args
[
"parallel"
])])
if
args
[
"mpi_flags"
]:
mpi_flags
=
[
"--mpi-flags="
+
f
for
f
in
args
[
"mpi_flags"
]]
else
:
mpi_flags
=
[]
subprocess
.
check_call
([
DORIE_PYTHON
,
"pf_from_file.py"
,
args
[
"config"
],
"--parallel"
,
str
(
args
[
"parallel"
]),
*
mpi_flags
])
except
subprocess
.
CalledProcessError
:
print
(
"Error while running DORiE"
)
sys
.
exit
(
1
)
...
...
@@ -91,7 +102,7 @@ if __name__ == "__main__": # parse command line and call command handler
parser_pfg
=
subparsers
.
add_parser
(
'pfg'
,
help
=
"Start parameter field generator."
,
description
=
"Start parameter field generator."
,
usage
=
"%(prog)s <config> [-h] [-p [N]]"
)
usage
=
"%(prog)s <config> [-h] [-p [N]]
[-m=MPI_FLAGS]
"
)
parser_pfg
.
add_argument
(
'config'
,
help
=
"Configuration file for the parameter field generator. "
"Can be created with 'dorie create'."
)
...
...
@@ -99,15 +110,21 @@ if __name__ == "__main__": # parse command line and call command handler
const
=
multiprocessing
.
cpu_count
(),
type
=
int
,
required
=
False
,
help
=
"Run in parallel on N processes. "
"If N is not specified, run on all available CPU threads."
)
parser_pfg
.
add_argument
(
'-m'
,
'--mpi-flags'
,
action
=
"append"
,
required
=
False
,
help
=
"Additional flags that are passed to mpirun when run in parallel. "
"May be specified multiple times."
)
parser_pfg
.
set_defaults
(
func
=
pfg
)
parser_run
=
subparsers
.
add_parser
(
'run'
,
help
=
"Run DORiE."
,
description
=
"Run DORiE."
,
usage
=
"%(prog)s <config> [-h] [-p [N]]"
)
usage
=
"%(prog)s <config> [-h] [-p [N]]
[-m=MPI_FLAGS]
"
)
parser_run
.
add_argument
(
'config'
,
help
=
"DORiE configuration file. Can be created with 'dorie create'."
)
parser_run
.
add_argument
(
'-p'
,
'--parallel'
,
metavar
=
'N'
,
nargs
=
'?'
,
default
=
1
,
const
=
multiprocessing
.
cpu_count
(),
type
=
int
,
required
=
False
,
help
=
"Run in parallel on N processes. "
"If N is not specified, run on all available CPU threads."
)
parser_run
.
add_argument
(
'-m'
,
'--mpi-flags'
,
action
=
"append"
,
required
=
False
,
help
=
"Additional flags that are passed to mpirun when run in parallel. "
"May be specified multiple times."
)
parser_run
.
set_defaults
(
func
=
run
)
parser_plot
=
subparsers
.
add_parser
(
'plot'
,
help
=
"Plot a preview of a VTK file created by DORiE."
,
...
...
python/parfield/wrapper/pf_from_file.py.in
View file @
8000e4a9
...
...
@@ -23,7 +23,11 @@ MPIEXEC_POSTFLAGS = "@MPIEXEC_POSTFLAGS@"
#
RFG_EXEC
=
os
.
path
.
join
(
DORIEDIR
,
"dune/dorie-rfg/dorie-rfg"
)
MPIRUN
=
lambda
nproc
,
exe
,
*
args
:
[
k
for
k
in
[
MPIEXEC
,
MPIEXEC_NUMPROC_FLAG
,
str
(
nproc
),
MPIEXEC_PREFLAG
,
str
(
exe
),
MPIEXEC_POSTFLAGS
]
+
list
(
args
)
if
k
]
def
MPIRUN
(
nproc
,
exe
,
*
args
,
mpi_flags
=
None
):
mpi_flags
=
[]
if
not
mpi_flags
else
list
(
mpi_flags
)
return
[
k
for
k
in
[
MPIEXEC
,
MPIEXEC_NUMPROC_FLAG
,
str
(
nproc
)]
\
+
mpi_flags
+
[
MPIEXEC_PREFLAG
,
str
(
exe
),
MPIEXEC_POSTFLAGS
]
+
list
(
args
)
if
k
]
if
__name__
==
"__main__"
:
try
:
# catch all exceptions we we can output an error message
...
...
@@ -33,6 +37,9 @@ if __name__ == "__main__":
parser
.
add_argument
(
'param'
,
help
=
'The configuration file holding all parameterization information'
)
parser
.
add_argument
(
'-p'
,
'--parallel'
,
metavar
=
'N'
,
nargs
=
'?'
,
default
=
1
,
const
=
multiprocessing
.
cpu_count
(),
type
=
int
,
required
=
False
,
help
=
"Run in parallel on N processes. If N is not specified, run on all available CPU threads."
)
parser
.
add_argument
(
'-m'
,
'--mpi-flags'
,
action
=
"append"
,
required
=
False
,
help
=
"Additional flags that are passed to mpirun when run in parallel. "
"May be specified multiple times."
)
parser
.
add_argument
(
'--debug'
,
help
=
'Display warnings'
,
action
=
'store_true'
,
required
=
False
)
args
=
vars
(
parser
.
parse_args
())
...
...
@@ -55,7 +62,7 @@ if __name__ == "__main__":
if
args
[
"parallel"
]
==
1
:
subprocess
.
check_call
([
RFG_EXEC
,
args
[
"param"
]])
else
:
subprocess
.
check_call
(
MPIRUN
(
args
[
"parallel"
],
RFG_EXEC
,
args
[
"param"
]))
subprocess
.
check_call
(
MPIRUN
(
args
[
"parallel"
],
RFG_EXEC
,
args
[
"param"
]
,
mpi_flags
=
args
[
"mpi_flags"
]
))
except
subprocess
.
CalledProcessError
:
print
(
"FFT Field generator failed"
)
sys
.
exit
(
1
)
...
...
testing/parfield_parallel.mini.in
View file @
8000e4a9
...
...
@@ -2,7 +2,7 @@ include ${CMAKE_BINARY_DIR}/doc/default_files/parfield.ini
__name = pfg_parallel
_test_command = pfg
_test_command_options = --parallel
_test_command_options = --parallel
-m=--allow-run-as-root
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_data_path = {_asset_path}/parfield-data
_evaluation = reference
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment