Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Gaudi
Gaudi
Commits
4ccf4836
Commit
4ccf4836
authored
2 years ago
by
Marco Clemencic
Browse files
Options
Downloads
Plain Diff
Add output dependency checks to AvalancheSchedulerSvc
See merge request
!1384
parents
0d3e0ffb
9f5c44f9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1384
Add output dependency checks to AvalancheSchedulerSvc
Pipeline
#4759547
passed
2 years ago
Stage: pre-build-checks
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GaudiHive/src/AvalancheSchedulerSvc.cpp
+63
-11
63 additions, 11 deletions
GaudiHive/src/AvalancheSchedulerSvc.cpp
GaudiHive/src/AvalancheSchedulerSvc.h
+10
-1
10 additions, 1 deletion
GaudiHive/src/AvalancheSchedulerSvc.h
with
73 additions
and
12 deletions
GaudiHive/src/AvalancheSchedulerSvc.cpp
+
63
−
11
View file @
4ccf4836
...
...
@@ -162,19 +162,26 @@ StatusCode AvalancheSchedulerSvc::initialize() {
DataObjIDColl
globalInp
,
globalOutp
;
// figure out all outputs
std
::
map
<
std
::
string
,
DataObjIDColl
>
algosOutputDependenciesMap
;
for
(
IAlgorithm
*
ialgoPtr
:
algos
)
{
Gaudi
::
Algorithm
*
algoPtr
=
dynamic_cast
<
Gaudi
::
Algorithm
*>
(
ialgoPtr
);
if
(
!
algoPtr
)
{
fatal
()
<<
"Could not convert IAlgorithm into Gaudi::Algorithm: this will result in a crash."
<<
endmsg
;
return
StatusCode
::
FAILURE
;
}
for
(
auto
id
:
algoPtr
->
outputDataObjs
()
)
globalOutp
.
insert
(
id
);
DataObjIDColl
algoOutputs
;
for
(
auto
id
:
algoPtr
->
outputDataObjs
()
)
{
globalOutp
.
insert
(
id
);
algoOutputs
.
insert
(
id
);
}
algosOutputDependenciesMap
[
algoPtr
->
name
()]
=
algoOutputs
;
}
std
::
ostringstream
ostdd
;
ostdd
<<
"Data Dependencies for Algorithms:"
;
std
::
map
<
std
::
string
,
DataObjIDColl
>
algosDependenciesMap
;
std
::
map
<
std
::
string
,
DataObjIDColl
>
algos
Input
DependenciesMap
;
for
(
IAlgorithm
*
ialgoPtr
:
algos
)
{
Gaudi
::
Algorithm
*
algoPtr
=
dynamic_cast
<
Gaudi
::
Algorithm
*>
(
ialgoPtr
);
if
(
nullptr
==
algoPtr
)
{
...
...
@@ -219,25 +226,50 @@ StatusCode AvalancheSchedulerSvc::initialize() {
}
else
{
ostdd
<<
"
\n
none"
;
}
algosDependenciesMap
[
algoPtr
->
name
()]
=
algoDependencies
;
algos
Input
DependenciesMap
[
algoPtr
->
name
()]
=
algoDependencies
;
}
if
(
m_showDataDeps
)
{
info
()
<<
ostdd
.
str
()
<<
endmsg
;
}
// Check if we have unmet global input dependencies, and, optionally, heal them
// WARNING: this step must be done BEFORE the Precedence Service is initialized
if
(
m_checkDeps
)
{
DataObjIDColl
unmetDep
;
for
(
auto
o
:
globalInp
)
if
(
globalOutp
.
find
(
o
)
==
globalOutp
.
end
()
)
unmetDep
.
insert
(
o
);
DataObjIDColl
unmetDepInp
,
unusedOutp
;
if
(
m_checkDeps
||
m_checkOutput
)
{
std
::
set
<
std
::
string
>
requiredInputKeys
;
for
(
auto
o
:
globalInp
)
{
// track aliases
// (assuming there should be no items with different class and same key corresponding to different objects)
requiredInputKeys
.
insert
(
o
.
key
()
);
if
(
globalOutp
.
find
(
o
)
==
globalOutp
.
end
()
)
unmetDepInp
.
insert
(
o
);
}
if
(
m_checkOutput
)
{
for
(
auto
o
:
globalOutp
)
{
if
(
globalInp
.
find
(
o
)
==
globalInp
.
end
()
&&
requiredInputKeys
.
find
(
o
.
key
()
)
==
requiredInputKeys
.
end
()
)
{
// check ignores
bool
ignored
{};
for
(
const
std
::
string
&
algoName
:
m_checkOutputIgnoreList
)
{
auto
it
=
algosOutputDependenciesMap
.
find
(
algoName
);
if
(
it
!=
algosOutputDependenciesMap
.
end
()
)
{
if
(
it
->
second
.
find
(
o
)
!=
it
->
second
.
end
()
)
{
ignored
=
true
;
break
;
}
}
}
if
(
!
ignored
)
{
unusedOutp
.
insert
(
o
);
}
}
}
}
}
if
(
unmetDep
.
size
()
>
0
)
{
if
(
m_checkDeps
)
{
if
(
unmetDepInp
.
size
()
>
0
)
{
auto
printUnmet
=
[
&
](
auto
msg
)
{
for
(
const
DataObjID
*
o
:
sortedDataObjIDColl
(
unmetDep
)
)
{
for
(
const
DataObjID
*
o
:
sortedDataObjIDColl
(
unmetDep
Inp
)
)
{
msg
<<
" o "
<<
*
o
<<
" required by Algorithm: "
<<
endmsg
;
for
(
const
auto
&
p
:
algosDependenciesMap
)
for
(
const
auto
&
p
:
algos
Input
DependenciesMap
)
if
(
p
.
second
.
find
(
*
o
)
!=
p
.
second
.
end
()
)
msg
<<
" * "
<<
p
.
first
<<
endmsg
;
}
};
...
...
@@ -272,7 +304,7 @@ StatusCode AvalancheSchedulerSvc::initialize() {
return
StatusCode
::
FAILURE
;
}
for
(
auto
&
id
:
unmetDep
)
{
for
(
auto
&
id
:
unmetDep
Inp
)
{
ON_DEBUG
debug
()
<<
"adding OUTPUT dep
\"
"
<<
id
<<
"
\"
to "
<<
dataLoaderAlg
->
type
()
<<
"/"
<<
dataLoaderAlg
->
name
()
<<
endmsg
;
dataAlg
->
addDependency
(
id
,
Gaudi
::
DataHandle
::
Writer
);
...
...
@@ -290,6 +322,26 @@ StatusCode AvalancheSchedulerSvc::initialize() {
}
}
if
(
m_checkOutput
)
{
if
(
unusedOutp
.
size
()
>
0
)
{
auto
printUnusedOutp
=
[
&
](
auto
msg
)
{
for
(
const
DataObjID
*
o
:
sortedDataObjIDColl
(
unusedOutp
)
)
{
msg
<<
" o "
<<
*
o
<<
" produced by Algorithm: "
<<
endmsg
;
for
(
const
auto
&
p
:
algosOutputDependenciesMap
)
if
(
p
.
second
.
find
(
*
o
)
!=
p
.
second
.
end
()
)
msg
<<
" * "
<<
p
.
first
<<
endmsg
;
}
};
fatal
()
<<
"The following unused OUTPUT items were found:"
<<
endmsg
;
printUnusedOutp
(
fatal
()
);
return
StatusCode
::
FAILURE
;
}
else
{
info
()
<<
"No unused OUTPUT items were found"
<<
endmsg
;
}
}
// Get the precedence service
m_precSvc
=
serviceLocator
()
->
service
(
"PrecedenceSvc"
);
if
(
!
m_precSvc
.
isValid
()
)
{
...
...
This diff is collapsed.
Click to expand it.
GaudiHive/src/AvalancheSchedulerSvc.h
+
10
−
1
View file @
4ccf4836
...
...
@@ -180,7 +180,16 @@ private:
Gaudi
::
Property
<
bool
>
m_enablePreemptiveBlockingTasks
{
this
,
"PreemptiveBlockingTasks"
,
false
,
"Enable preemptive scheduling of CPU-blocking algorithms. Blocking algorithms must be flagged accordingly."
};
Gaudi
::
Property
<
bool
>
m_checkDeps
{
this
,
"CheckDependencies"
,
false
,
"Runtime check of Algorithm Data Dependencies"
};
Gaudi
::
Property
<
bool
>
m_checkDeps
{
this
,
"CheckDependencies"
,
false
,
"Runtime check of Algorithm Input Data Dependencies"
};
Gaudi
::
Property
<
bool
>
m_checkOutput
{
this
,
"CheckOutputUsage"
,
false
,
"Runtime check of Algorithm Output Data usage"
};
Gaudi
::
Property
<
std
::
vector
<
std
::
string
>>
m_checkOutputIgnoreList
{
this
,
"CheckOutputUsageIgnoreList"
,
{},
"Ignore outputs of the Algorithms of this name when doing the check"
,
"OrderedSet<std::string>"
};
Gaudi
::
Property
<
std
::
string
>
m_useDataLoader
{
this
,
"DataLoaderAlg"
,
""
,
"Attribute unmet input dependencies to this DataLoader Algorithm"
};
...
...
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