Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
graintracking
DCT
Commits
a62975b5
Commit
a62975b5
authored
8 years ago
by
Nicola Vigano
Committed by
Nicola Vigano
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
dct_launch: fixed matlab_script invocation and added valgrind debugging support
Signed-off-by:
Nicola Vigano
<
vigano@yoda.esrf.fr
>
parent
7097d4ff
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
dct_launch.py
+11
-4
11 additions, 4 deletions
dct_launch.py
zUtil_Python/dct_matlab_invocation.py
+31
-2
31 additions, 2 deletions
zUtil_Python/dct_matlab_invocation.py
with
42 additions
and
6 deletions
dct_launch.py
+
11
−
4
View file @
a62975b5
...
...
@@ -86,14 +86,21 @@ class DCTLauncher(object):
if
(
len
(
self
.
args
)
is
not
0
)
and
self
.
args
[
0
]
in
(
"
-h
"
,
"
--help
"
):
print
(
"
Usage:
"
)
print
(
"
# python %s matlab_script [matlab_commands]
"
%
os
.
path
.
basename
(
__file__
))
print
(
"
Where [matlab_commands] could be a script name or malab commands
"
)
print
(
"
# python %s matlab_script [commands]
"
%
os
.
path
.
basename
(
__file__
))
print
(
"
Options:
"
)
print
(
"
-h | --help : to show this help
"
)
print
(
"
--profile : to specify the type of profiling. Options:
'
cuda
'"
)
print
(
"
--debug : to specify the type of profiling. Options:
'
valgrind
'"
)
print
(
"
--script : to specify the script/commands to be launched
"
)
else
:
decoded_args
=
dct
.
dct_matlab_invocation
.
DCTMatlabInvocation
.
filter_parameters
(
self
.
args
)
invoker
=
dct
.
dct_matlab_invocation
.
DCTMatlabInvocation
(
dct_dir
=
self
.
dct_dir
,
\
extra_cmds
=
self
.
args
,
\
extra_cmds
=
decoded_args
[
"
script
"
]
,
\
skip_functions_check
=
True
)
invoker
.
invoke
()
invoker
.
invoke
(
profiler
=
decoded_args
[
'
profile
'
],
\
debugger
=
decoded_args
[
'
debug
'
])
def
_launchUpdate
(
self
):
util
=
dct
.
dct_utils_git
.
DCTGit
(
self
.
dct_dir
)
...
...
This diff is collapsed.
Click to expand it.
zUtil_Python/dct_matlab_invocation.py
+
31
−
2
View file @
a62975b5
...
...
@@ -6,6 +6,7 @@ Created on Feb 7, 2013
import
os
import
subprocess
import
re
from
.
import
dct_io_xml
from
.
import
dct_utils_platform
...
...
@@ -29,7 +30,30 @@ class DCTMatlabInvocation(object):
self
.
utils
=
dct_utils_platform
.
UtilsFactory
.
getMachineDep
()
def
invoke
(
self
):
@staticmethod
def
filter_parameters
(
args
):
launcher_accepted_args
=
(
"
--profile
"
,
"
--debug
"
,
"
--script
"
)
decoded_args
=
{
'
profile
'
:
None
,
'
debug
'
:
None
,
'
script
'
:
None
}
skip_next
=
False
for
ind_arg
in
range
(
len
(
args
)):
if
skip_next
is
True
:
skip_next
=
False
continue
for
modifier
in
launcher_accepted_args
:
if
args
[
ind_arg
]
==
modifier
:
if
len
(
args
)
<=
(
ind_arg
+
1
):
raise
ValueError
(
"
Not enough arguments for modifier: %s
"
%
modifier
)
if
decoded_args
[
modifier
[
2
:]]
is
not
None
:
dct_io_xml
.
DCTOutput
.
printWarning
(
\
"
Overwriting previous argument
'
%s
'
for modifier
'
%s
'
, with argument
'
%s
'"
\
%
decoded_args
[
modifier
[
2
:]],
modifier
,
args
[
ind_arg
+
1
])
decoded_args
[
modifier
[
2
:]]
=
args
[
ind_arg
+
1
]
skip_next
=
True
if
decoded_args
[
"
profile
"
]
is
not
None
and
decoded_args
[
"
debug
"
]
is
not
None
:
raise
ValueError
(
"
Profiling and debugging cannot be used at the same time!
"
)
return
decoded_args
def
invoke
(
self
,
profiler
=
None
,
debugger
=
None
):
self
.
conf
=
dct_io_xml
.
DCTConf
(
self
.
confPath
)
# Adding runtime libraries
...
...
@@ -54,7 +78,12 @@ class DCTMatlabInvocation(object):
env_var
=
os
.
environ
[
"
LD_PRELOAD
"
]
os
.
environ
[
"
LD_PRELOAD
"
]
=
"
:
"
.
join
([
lib
,
env_var
])
cmd
=
[
os
.
path
.
join
(
self
.
conf
.
getMatlabPath
(),
"
bin
"
,
"
matlab
"
)]
cmd
=
[]
if
profiler
==
"
cuda
"
:
cmd
=
cmd
+
[
"
/usr/local/cuda/bin/nvprof
"
,
"
-f
"
,
"
-o
"
,
"
profile_cuda_matlab_script
"
]
#, "--analysis-metrics"
if
debugger
==
"
valgrind
"
:
cmd
=
cmd
+
[
"
valgrind
"
,
"
--log-file=memcheck_matlab_script
"
]
#, "--leak-check=yes"
cmd
=
cmd
+
[
os
.
path
.
join
(
self
.
conf
.
getMatlabPath
(),
"
bin
"
,
"
matlab
"
)]
cmd
=
cmd
+
self
.
conf
.
getMatlabOptions
()
cmd
=
cmd
+
self
.
args
...
...
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