Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
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
LHCb
Rec
Commits
f6967e9b
Commit
f6967e9b
authored
3 years ago
by
Christoph Hasse
Browse files
Options
Downloads
Patches
Plain Diff
replace header hash with hash of header+functor_jitter
parent
1691fac8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2699
FunctorFactory, replace CLING backend with native compiler
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Phys/FunctorCore/src/Components/Factory.cpp
+43
-4
43 additions, 4 deletions
Phys/FunctorCore/src/Components/Factory.cpp
with
43 additions
and
4 deletions
Phys/FunctorCore/src/Components/Factory.cpp
+
43
−
4
View file @
f6967e9b
...
...
@@ -98,6 +98,44 @@ struct FunctorFactory : public extends<Service, Functors::IFactory> {
StatusCode
initialize
()
override
{
auto
sc
=
Service
::
initialize
();
// we will fill this buffer with the content of functor_jitter and the
// preprocessed header to then calcuate a hash and write that value into
// m_header_hash which will be used to define a JIT library's filename
std
::
stringstream
buffer
;
// first we need to find the "functor_jitter" script on the runtime_path.
// That env var looks like "path1:path2:path3...."
auto
const
runtime_path
=
System
::
getEnv
(
"PATH"
);
auto
begin
=
0U
;
auto
end
=
runtime_path
.
find
(
':'
);
auto
found_functor_jitter
=
std
::
filesystem
::
path
{};
while
(
end
!=
std
::
string
::
npos
)
{
auto
path
=
std
::
filesystem
::
path
{
runtime_path
.
substr
(
begin
,
end
-
begin
)};
path
.
append
(
"functor_jitter"
);
if
(
std
::
filesystem
::
is_regular_file
(
path
)
)
{
found_functor_jitter
=
path
;
break
;
}
// move new begin to just after the ":"
begin
=
end
+
1
;
end
=
runtime_path
.
find
(
':'
,
begin
);
}
// if we didn't find anything and break out of the while loop, we need to
// check the last element
if
(
end
==
std
::
string
::
npos
)
{
auto
path
=
std
::
filesystem
::
path
{
runtime_path
.
substr
(
begin
,
end
-
begin
)};
path
.
append
(
"/functor_jitter"
);
if
(
std
::
filesystem
::
is_regular_file
(
path
)
)
{
found_functor_jitter
=
path
;
}
}
if
(
found_functor_jitter
.
empty
()
)
{
error
()
<<
"Could not find 'functor_jitter' executable on runtime path!"
<<
endmsg
;
return
StatusCode
::
FAILURE
;
}
debug
()
<<
"Calculating hash of: "
<<
found_functor_jitter
<<
endmsg
;
buffer
<<
std
::
ifstream
{
found_functor_jitter
}.
rdbuf
();
// runtime environment variable which points to the preprocessed header
auto
const
path_to_header
=
System
::
getEnv
(
"FUNCTORFACTORY_PREPROCESSED_HEADER"
);
if
(
path_to_header
==
"UNKNOWN"
)
{
...
...
@@ -106,10 +144,10 @@ struct FunctorFactory : public extends<Service, Functors::IFactory> {
return
StatusCode
::
FAILURE
;
}
std
::
stringstream
buffer
;
buffer
<<
std
::
ifstream
{
path_to_header
}.
rdbuf
();
m_header_hash
=
Functors
::
Cache
::
hashToStr
(
Functors
::
Cache
::
makeHash
(
buffer
.
str
()
)
);
debug
()
<<
"FunctorFactory initialized with header hash: "
<<
m_header_hash
<<
endmsg
;
m_dependencies_hash
=
Functors
::
Cache
::
hashToStr
(
Functors
::
Cache
::
makeHash
(
buffer
.
str
()
)
);
debug
()
<<
"Calculating hash of: "
<<
path_to_header
<<
endmsg
;
debug
()
<<
"FunctorFactory initialized with dependencies hash: "
<<
m_dependencies_hash
<<
endmsg
;
return
sc
;
}
...
...
@@ -129,7 +167,7 @@ struct FunctorFactory : public extends<Service, Functors::IFactory> {
for
(
auto
const
&
entry
:
m_all
)
{
full_lib_code
+=
entry
.
second
.
second
;
}
full_lib_code
+=
"}"
;
auto
const
file_prefix
=
"FunctorJitLib_"
+
m_
header
_hash
+
"_"
+
auto
const
file_prefix
=
"FunctorJitLib_"
+
m_
dependencies
_hash
+
"_"
+
Functors
::
Cache
::
hashToStr
(
Functors
::
Cache
::
makeHash
(
full_lib_code
)
);
auto
const
lib_filename
=
file_prefix
+
".so"
;
auto
const
lib_full_path
=
m_jit_lib_dir
+
lib_filename
;
...
...
@@ -245,6 +283,7 @@ private:
Gaudi
::
Details
::
Property
::
ImmediatelyInvokeHandler
{
true
}};
std
::
string
m_header_hash
{};
std
::
string
m_dependencies_hash
{};
LibHandle
m_lib_handle
{
nullptr
,
lib_closer
};
};
...
...
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