Add check for cuda lazy init (#80912) (#80912) (#81970)
Summary:
Validate that no CUDA calls are made during `import torch` call, by
importing torch and limited visible devices to non-existing device
Should prevent regressions like ones reported in https://github.com/pytorch/pytorch/issues/80876
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80912
Approved by: https://github.com/ngimel, https://github.com/atalman
Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/1ad7ef3f21492c8b39cde4187198a032e7747c0c
Reviewed By: mehtanirav
Differential Revision: D37648899
Pulled By: malfet
fbshipit-source-id: a2947960d3d0d0e7e4775c37590b2e9fee38c4e9
Co-authored-by: Nikita Shulga (Meta Employee) <nshulga@fb.com>