-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept const session in TF interface. #40161
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40161/33164
|
A new Pull Request was created by @riga (Marcel R.) for master. It involves the following packages:
@cmsbuild, @mandrenguyen, @clacaputo can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
const std::vector<std::string>& outputNames, | ||
std::vector<Tensor>* outputs, | ||
const thread::ThreadPoolOptions& threadPoolOptions) { | ||
run(const_cast<Session*>(session), inputs, outputNames, outputs, threadPoolOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to add a comment (either general, or copied to every const_cast
) that the Session::Run()
itself is thread safe (and logically const
), but is (unfortunately) non-const
in the TensorFlow interface and therefore the const_cast
is needed but is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in b83516c.
@cmsbuild, please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-526732/29305/summary.html Comparison SummarySummary:
|
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40161/33181
|
Pull request #40161 was updated. @cmsbuild, @mandrenguyen, @clacaputo can you please check and sign again. |
@cmsbuild, please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-526732/29326/summary.html Comparison SummarySummary:
|
Hi @riga , thanks a lot. I would suggest using a "per-subsystem" approach for the next PRs |
@clacaputo Ok, will do. Shall I also adjust the files in the third list? In these files, it seems like there is only one session used without concurrency (*), and the change would only consist of making it |
We could directly ping the relevant POG/DPG, or open an issue |
+reconstruction
|
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description
This PR adds five new functions to the TensorFlow interface in PhysicsTools that accept
const
sessions, four of which are related to performing model inference and one function handles the session deletion. There's also an additional test case that covers the handling of const sessions.With this PR, there is no need for them to be stored once per stream module instance, but they can rather be moved to global caches (as is the case for tf graphs at the moment), reducing copies in memory.
The latter changes are not contained in this PR, but are subject to a future one(s). For completeness, in the following there are three lists of files where they'd need to happen (with the latter one being optional) and I can open a dedicated PR for them once this one is merged (or a separate PR per subsystem, depending on what's easier to sign off on).
Move sessions to global cache
Remove now obsolete
const_cast
'sUse const session (only if needed)
PR validation
I added test cases for handling const sessions.
@valsdav @yongbinfeng @jeongeun @jpata @clacaputo