Skip to content
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

scalars: commit chart changes in batch #4053

Merged
merged 11 commits into from
Aug 20, 2020
Merged

Conversation

wchargin
Copy link
Contributor

Summary:
In #3524, we defined a batch API for chart updates to avoid useless
paints that would be immediately overwritten. We now take further
advantage of this API to only paint charts once all data has been
loaded.

Test Plan:
On the hparams demo directory, this brings paint time (post-network)
for four charts rendering 50 trials each down from about 8 seconds to
under 1 second.

wchargin-branch: scalars-batch-commit

Summary:
The data loader behavior maintains a fine-grained cache of key-value
pairs. This is useful because when the set of requested keys expands,
only the new keys need to be fetched. But, until now, the behavior has
been hard-coded to fire a separate request for each key-value pair.
Clients can have either fine-grained cache invalidation or efficient
batched requests, but not both at the same time. This patch enriches the
behavior to support just that.

In a future change, the scalars dashboard will take advantage of this to
batch requests for multiple runs and a single tag.

In doing so, we need to shuffle around the API a bit. Instead of asking
clients to provide `getDataLoadUrl: (Item) => string` plus a separate
function `requestData: (url: string) => Promise<Data>` (where “`Item`”
and “`Data`” are the keys and values, respectively), clients now provide
a single function `requestData` that takes raw `Item`s (now plural),
performs the request(s), and returns the data. The function provides a
stream of key-value pairs, which is represented in callback style for
convenience. (We don’t want to drag Observable into this.)

The purpose of this approach, as opposed to a perhaps more natural
approach that simply adapts `getDataLoadUrl` to return some kind of
request struct with a callback to map a response into key-value pairs,
is to accommodate the variety of existing clients. The structures get
pretty wild: e.g., `tf-line-chart-data-loader` mixes in the behavior but
doesn’t actually provide the needed properties; they’re provided instead
by `tf-scalar-card`, but then `tf-hparams-session-group-details` further
overrides some of those properties of `tf-scalar-card` with an entirely
different backend. It’s a bit wordier for clients, but at least there
are fewer moving pieces to keep track of.

Test Plan:
The scalars, custom scalars, distributions, histograms, and hparams
dashboards all work. The fine-grained invalidation on the scalars
dashboard works: e.g., set the tag filter to `mnist` and then to
`mnist|hparams`, and watch only the hparams demo data load; then, set it
to `hparams` and watch the MNIST charts disappear without any repaints
to the hparams demo charts. The post-load callback properly causes
scalar charts’ domains to adjust. The refresh button in the dashboard UI
properly invalidates and re-fetches data.

(Make sure to run with `TB_POLYMER3=1` until that’s the default.)

wchargin-branch: dlb-batch-finegrained
wchargin-source: 14ec8abde36c4563a4922209d361fc5bd16b6061
Summary:
DO NOT SUBMIT until corresponding internal change is submitted.

Test Plan:
Manually tested; to be documented.

wchargin-branch: scalars-mux-runs
wchargin-source: 9459c8cc6bc0b041016dfc689306639a04080217
wchargin-branch: scalars-mux-runs
wchargin-source: 2e1bd5c8cd3393ac0a79c64b0c87ea43bf346b8a

# Conflicts:
#	tensorboard/plugins/scalar/polymer3/tf_scalar_dashboard/tf-scalar-card.ts
wchargin-branch: scalars-mux-runs
wchargin-source: 2e1bd5c8cd3393ac0a79c64b0c87ea43bf346b8a
Summary:
In #3524, we defined a batch API for chart updates to avoid useless
paints that would be immediately overwritten. We now take further
advantage of this API to only paint charts once all data has been
loaded.

Test Plan:
On the hparams demo directory, this brings paint time (post-network)
for four charts rendering 50 trials each down from about 8 seconds to
under 1 second.

wchargin-branch: scalars-batch-commit
wchargin-source: b0babe18b592f577803eebe6f4102c032fc9246f
@wchargin wchargin added plugin:scalars theme:performance Performance, scalability, large data sizes, slowness, etc. labels Aug 19, 2020
wchargin-branch: scalars-mux-runs
wchargin-source: 0484e726315d46c282c3d61994ffb9e4dc07c20b
wchargin-branch: scalars-batch-commit
wchargin-source: 0b1f5cd089e6fcfeeb1cf0744ce98d7a70bf4740
wchargin-branch: scalars-mux-runs
wchargin-source: f183c2962c3d464b6ac903b63d833f0c926fe162
wchargin-branch: scalars-mux-runs
wchargin-source: a4ca83ea5bf6b665052c076df835592105e5eefb
wchargin-branch: scalars-batch-commit
wchargin-source: b28108c936f43ba7cb072702e56a650e89d20c2f
Base automatically changed from wchargin-scalars-mux-runs to master August 20, 2020 22:05
wchargin-branch: scalars-batch-commit
wchargin-source: 86b429e4f04ee981ee42c508d1f8ed813a04a26c
@wchargin wchargin merged commit 19ce4f1 into master Aug 20, 2020
@wchargin wchargin deleted the wchargin-scalars-batch-commit branch August 20, 2020 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes plugin:scalars theme:performance Performance, scalability, large data sizes, slowness, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants