Repository: pytorch
Issue: test_jit_cuda_fuser fails on non-CUDA node for 1.11.0rc3
Labels: oncall: jit

## Issue description

I've build PyTorch with CUDA support, but am cross-compiling on a node that does not have GPUs. I've hit a failing test there:

```
Running test_jit_cuda_fuser ... [2022-02-24 21:36:44.639460]
Executing ['/sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/bin/python', 'test_jit_cuda_fuser.py', '-v'] ... [2022-02-24 21:36:44.639672]
CUDA not available, skipping tests
monkeytype is not installed. Skipping tests for Profile-Directed Typing
Traceback (most recent call last):
  File "/scratch/casparl/PyTorch/1.11.0rc3/foss-2021a-CUDA-11.3.1/pytorch/test/test_jit_cuda_fuser.py", line 63, in <module>
    TEST_BF16 = torch.cuda.is_bf16_supported()
  File "/scratch/casparl/eb-UkykCV/tmpkM3zKG/lib/python3.9/site-packages/torch/cuda/__init__.py", line 92, in is_bf16_supported
    return torch.cuda.get_device_properties(torch.cuda.current_device()).major >= 8 and cuda_maj_decide
  File "/scratch/casparl/eb-UkykCV/tmpkM3zKG/lib/python3.9/site-packages/torch/cuda/__init__.py", line 481, in current_device
    _lazy_init()
  File "/scratch/casparl/eb-UkykCV/tmpkM3zKG/lib/python3.9/site-packages/torch/cuda/__init__.py", line 216, in _lazy_init
    torch._C._cuda_init()
RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx
test_jit_cuda_fuser failed!
Running test_jit_disabled ... [2022-02-24 21:36:45.910597]
```

## Expected behaviour
Expected behaviour is that all tests that require CUDA are skipped and therefore do not lead to errors/failures. The correct if-statements are there to skip the tests, e.g. [this one](https://github.com/pytorch/pytorch/blob/e4944871c8c59f75b5a71d26316fb58423e4ae5f/test/test_jit_cuda_fuser.py#L191), but the problem is that the `test_jit_cuda_fuser.py` checks unconditionally for bfloat16 support by calling `TEST_BF16 = torch.cuda.is_bf16_supported()` [here](https://github.com/pytorch/pytorch/blob/e4944871c8c59f75b5a71d26316fb58423e4ae5f/test/test_jit_cuda_fuser.py#L63).

## Proposed solution
I haven't tested yet, but I think this should be wrapped with an statement that first checks if CUDA support exists, and if not, just set TEST_BF16 to false. E.g. the line in `test_jit_cuda_fuser.py` should be replaced by this block:

```
if RUN_CUDA:
    TEST_BF16 = torch.cuda.is_bf16_supported()
else:
    TEST_BF16 = false
```
If you're open to this, I can test this solution and make a PR for it.

## System Info

- PyTorch or Caffe2: PyTorch
- How you installed PyTorch (conda, pip, source): source
- Build command you used (if compiling from source): 
```
export PYTHONPATH=/scratch/casparl/eb-UkykCV/tmpkM3zKG/lib/python3.9/site-packages:$PYTHONPATH &&  USE_CUPTI_SO=1 PYTORCH_BUILD_VERSION=1.11.0rc3 PYTORCH_BUILD_NUMBER=1 MAX_JOBS=16 BLAS=Eigen WITH_BLAS=open USE_
FFMPEG=1 BUILD_CUSTOM_PROTOBUF=0 USE_IBVERBS=1 USE_CUDA=1 CUDNN_LIB_DIR=/sw/arch/Debian10/EB_production/2021/software/cuDNN/8.2.1.32-CUDA-11.3.1/lib64 CUDNN_INCLUDE_DIR=/sw/arch/Debian10/EB_production/2021/software/cuDNN/8.2.1.32-CUDA-11.3.1/include USE_SYSTEM_NCCL=1 NCCL_INCLUDE_DIR=/sw/arch
/Debian10/EB_production/2021/software/NCCL/2.10.3-GCCcore-10.3.0-CUDA-11.3.1/include USE_METAL=0   /sw/arch/Debian10/EB_production/2021/software/Python/3.9.5-GCCcore-10.3.0/bin/python setup.py install --prefix=/scratch/casparl/eb-UkykCV/tmpkM3zKG
```
- OS: Debian 10
- PyTorch version: 1.11.0-rc3
- Python version: 3.9.5
- CUDA/cuDNN version: 11.3.1/8.2.1.32
- GPU models and configuration: ?
- GCC version (if compiling from source): 10.3.0
- CMake version: 3.20.1
- Versions of any other relevant libraries: N/A