Skip to content

Add CUDA Vital#58059

Closed
bitfort wants to merge 1 commit intopytorch:masterfrom
bitfort:export-D28357615
Closed

Add CUDA Vital#58059
bitfort wants to merge 1 commit intopytorch:masterfrom
bitfort:export-D28357615

Conversation

@bitfort
Copy link
Copy Markdown

@bitfort bitfort commented May 11, 2021

Summary: Add CUDA.used vital sign which is true only if CUDA was "used" which technically means the context was created.

Test Plan: buck test mode/dbg caffe2/test:torch -- --regex basic_vitals

Differential Revision: D28357615

@facebook-github-bot
Copy link
Copy Markdown
Contributor

facebook-github-bot commented May 11, 2021

💊 CI failures summary and remediations

As of commit bb7409c (more details on the Dr. CI page and at hud.pytorch.org/pr/58059):


  • 1/2 failures possibly* introduced in this PR
    • 1/1 non-scanned failure(s)
  • 1/2 broken upstream at merge base f2f2f5b from Jun 23 until Jun 24

🚧 1 fixed upstream failure:

These were probably caused by upstream breakages that were already fixed.

Please rebase on the viable/strict branch (expand for instructions)

If your commit is older than viable/strict, run these commands:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase FETCH_HEAD

This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D28357615

1 similar comment
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D28357615

@bitfort bitfort force-pushed the export-D28357615 branch from 458dab9 to 2d6235f Compare May 18, 2021 16:23
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2021

Codecov Report

Merging #58059 (2d6235f) into master (ccd7141) will increase coverage by 0.02%.
The diff coverage is 78.71%.

❗ Current head 2d6235f differs from pull request most recent head f00af20. Consider uploading reports for the commit f00af20 to get more accurate results

@@            Coverage Diff             @@
##           master   #58059      +/-   ##
==========================================
+ Coverage   76.44%   76.46%   +0.02%     
==========================================
  Files        1990     1992       +2     
  Lines      199690   199960     +270     
==========================================
+ Hits       152651   152900     +249     
- Misses      47039    47060      +21     

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D28357615

@bitfort bitfort force-pushed the export-D28357615 branch from 2d6235f to f00af20 Compare May 24, 2021 18:47
@bitfort bitfort requested review from bwasti, ngimel, robieta and xuzhao9 May 24, 2021 19:01
Copy link
Copy Markdown
Contributor

@xuzhao9 xuzhao9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not familiar with the Vitals project, so just adding a few questions here.

Comment thread aten/src/ATen/core/Vitals.cpp Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we are only returning the "second" values here, but not "first"? In the test below, it looks like both the name and the value should be returned, say 'CUDA.used\t\t true'.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe second calls toString() which has both the name and value in it and concatenates the two. So first is actually also inside second :)

Comment thread aten/src/ATen/cuda/detail/CUDAHooks.cpp Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask what is the field of "force" doing here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is making sure the vital data is updated, even if the TORCHVITAL env variable is not set. This is to enable testing because the env variable isn't always set when the test is being done - and we no easy workaround.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D28357615

@bitfort bitfort force-pushed the export-D28357615 branch from f00af20 to a081618 Compare June 3, 2021 18:27
@bitfort bitfort requested review from xuzhao9 June 4, 2021 18:28
Copy link
Copy Markdown
Contributor

@xuzhao9 xuzhao9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, having two comments inlined

Comment thread aten/src/ATen/core/Vitals.h Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do you need an extra API, or is it enough to have setVital with default force=false arg?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check, not sure.

Comment thread aten/src/ATen/core/Vitals.cpp Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here conditional also seems like unnecessary complication - if you had write(value, force) you could have avoided conditional

Comment thread aten/src/ATen/core/Vitals.h Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there 2 functions instead of write(const T& t, bool force)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea :)

Comment thread aten/src/ATen/core/Vitals.h Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why toString function instead of redefining << so that you can directly call std::cout << this ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably because I have python semantics on my mind instead of c++ semantics :)

I implemented a << operator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D28357615

@bitfort bitfort force-pushed the export-D28357615 branch from a081618 to 4679bdf Compare June 21, 2021 23:06
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D28357615

@bitfort bitfort force-pushed the export-D28357615 branch from 4679bdf to 27a06bf Compare June 22, 2021 03:07
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D28357615

Summary:
Pull Request resolved: pytorch#58059

Add CUDA.used vital sign which is true only if CUDA was "used" which technically means the context was created.

Also adds the following features:
- Force vitals to be written even if vitals are disabled, to enable testing when the env variable is not set from the start of execution
- Add a read_vitals call for python to read existing vital signs.

Test Plan: buck test mode/dbg caffe2/test:torch -- --regex basic_vitals

Reviewed By: xuzhao9

Differential Revision: D28357615

fbshipit-source-id: 78a8755801b11ccc7e33a9eac669ebb7a83ddb87
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D28357615

@bitfort bitfort force-pushed the export-D28357615 branch from 1e5e092 to bb7409c Compare June 24, 2021 17:34
Copy link
Copy Markdown
Contributor

@xuzhao9 xuzhao9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 8b6487c.

asuhan pushed a commit to asuhan/pytorch that referenced this pull request Jun 28, 2021
Summary:
Pull Request resolved: pytorch#58059

Add CUDA.used vital sign which is true only if CUDA was "used" which technically means the context was created.

Also adds the following features:
- Force vitals to be written even if vitals are disabled, to enable testing when the env variable is not set from the start of execution
- Add a read_vitals call for python to read existing vital signs.

Test Plan: buck test mode/dbg caffe2/test:torch -- --regex basic_vitals

Reviewed By: xuzhao9

Differential Revision: D28357615

fbshipit-source-id: 681bf9ef63cb1458df9f1c241d301a3ddf1e5252
asuhan pushed a commit that referenced this pull request Jun 30, 2021
Summary:
Pull Request resolved: #58059

Add CUDA.used vital sign which is true only if CUDA was "used" which technically means the context was created.

Also adds the following features:
- Force vitals to be written even if vitals are disabled, to enable testing when the env variable is not set from the start of execution
- Add a read_vitals call for python to read existing vital signs.

Test Plan: buck test mode/dbg caffe2/test:torch -- --regex basic_vitals

Reviewed By: xuzhao9

Differential Revision: D28357615

fbshipit-source-id: 681bf9ef63cb1458df9f1c241d301a3ddf1e5252
@malfet malfet mentioned this pull request Mar 26, 2026
malfet added a commit that referenced this pull request Mar 26, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ghstack-source-id: b56228f
Pull-Request: #178479
malfet added a commit that referenced this pull request Mar 26, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ghstack-source-id: 372adae
Pull-Request: #178479
malfet added a commit that referenced this pull request Mar 26, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ghstack-source-id: 1c33462
Pull-Request: #178479
malfet added a commit that referenced this pull request Mar 26, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ghstack-source-id: 65c136a
Pull-Request: #178479
malfet added a commit that referenced this pull request Mar 26, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ghstack-source-id: 160ae2f
Pull-Request: #178479
pytorchmergebot pushed a commit that referenced this pull request Mar 26, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: #178479
Approved by: https://github.com/msaroufim, https://github.com/albanD
Copilot AI pushed a commit that referenced this pull request Mar 27, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: #178479
Approved by: https://github.com/msaroufim, https://github.com/albanD

Co-authored-by: Xia-Weiwen <12522207+Xia-Weiwen@users.noreply.github.com>
AaronWang04 pushed a commit to AaronWang04/pytorch that referenced this pull request Mar 31, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR pytorch#51047 (Jan 2021), with a Python API in pytorch#53238
and a CUDA vital in pytorch#58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: pytorch#178479
Approved by: https://github.com/msaroufim, https://github.com/albanD
pytorch-bot Bot pushed a commit that referenced this pull request Apr 2, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: #178479
Approved by: https://github.com/msaroufim, https://github.com/albanD
malfet added a commit that referenced this pull request Apr 2, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ghstack-source-id: 46b1a3d
Pull-Request: #178479
malfet added a commit that referenced this pull request Apr 2, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238
and a CUDA vital in #58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ghstack-source-id: 46b1a3d
Pull-Request: #178479
pytorchmergebot pushed a commit that referenced this pull request Apr 3, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital signs" (e.g. whether CUDA or DataLoader was used). It was never documented and the test itself had a "FIXME: document or deprecate" comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238 and a CUDA vital in #58059. There have been no feature changes since June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

Update: `torch.set_vital` was used from TorchData (see meta-pytorch/data#1537 ) so will keep the dummy API around

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: #178479
Approved by: https://github.com/msaroufim, https://github.com/albanD, https://github.com/mlazos
IvanKobzarev pushed a commit to IvanKobzarev/pytorch that referenced this pull request Apr 3, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR pytorch#51047 (Jan 2021), with a Python API in pytorch#53238
and a CUDA vital in pytorch#58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: pytorch#178479
Approved by: https://github.com/msaroufim, https://github.com/albanD
weifengpy pushed a commit that referenced this pull request Apr 7, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital signs" (e.g. whether CUDA or DataLoader was used). It was never documented and the test itself had a "FIXME: document or deprecate" comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238 and a CUDA vital in #58059. There have been no feature changes since June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

Update: `torch.set_vital` was used from TorchData (see meta-pytorch/data#1537 ) so will keep the dummy API around

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: #178479
Approved by: https://github.com/msaroufim, https://github.com/albanD, https://github.com/mlazos
nklshy-aws pushed a commit to nklshy-aws/pytorch that referenced this pull request Apr 7, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital
signs" (e.g. whether CUDA or DataLoader was used). It was never
documented and the test itself had a "FIXME: document or deprecate"
comment.

Originally added in PR pytorch#51047 (Jan 2021), with a Python API in pytorch#53238
and a CUDA vital in pytorch#58059. There have been no feature changes since
June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

A search on cs.github.com and general web search confirmed no external
projects depend on torch.set_vital, torch.read_vitals, or
torch.vitals_enabled — usage was limited to pytorch/pytorch itself.

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: pytorch#178479
Approved by: https://github.com/msaroufim, https://github.com/albanD
nklshy-aws pushed a commit to nklshy-aws/pytorch that referenced this pull request Apr 7, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital signs" (e.g. whether CUDA or DataLoader was used). It was never documented and the test itself had a "FIXME: document or deprecate" comment.

Originally added in PR pytorch#51047 (Jan 2021), with a Python API in pytorch#53238 and a CUDA vital in pytorch#58059. There have been no feature changes since June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

Update: `torch.set_vital` was used from TorchData (see meta-pytorch/data#1537 ) so will keep the dummy API around

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: pytorch#178479
Approved by: https://github.com/msaroufim, https://github.com/albanD, https://github.com/mlazos
pytorch-bot Bot pushed a commit that referenced this pull request Apr 10, 2026
TorchVitals was an undocumented feature gated behind the TORCH_VITAL
environment variable that allowed setting and reading key-value "vital signs" (e.g. whether CUDA or DataLoader was used). It was never documented and the test itself had a "FIXME: document or deprecate" comment.

Originally added in PR #51047 (Jan 2021), with a Python API in #53238 and a CUDA vital in #58059. There have been no feature changes since June 2021 — all subsequent commits were mechanical cleanups (clang-tidy,
thread-safe getenv, etc.).

Update: `torch.set_vital` was used from TorchData (see meta-pytorch/data#1537 ) so will keep the dummy API around

Authored with Claude.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Pull Request resolved: #178479
Approved by: https://github.com/msaroufim, https://github.com/albanD, https://github.com/mlazos
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 25, 2026
Summary:
Pull Request resolved: pytorch#58059

Add CUDA.used vital sign which is true only if CUDA was "used" which technically means the context was created.

Also adds the following features:
- Force vitals to be written even if vitals are disabled, to enable testing when the env variable is not set from the start of execution
- Add a read_vitals call for python to read existing vital signs.

Test Plan: buck test mode/dbg caffe2/test:torch -- --regex basic_vitals

Reviewed By: xuzhao9

Differential Revision: D28357615

fbshipit-source-id: 681bf9ef63cb1458df9f1c241d301a3ddf1e5252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants