Remove the linkage to CUDA libraries when ROCM is used. (#29009)
Summary:
Currently when ROCM is used, CUDA libraries are still linked. There has
been no error because USE_CUDA is set to OFF upon a preliminary check in
tools/setup_helper/cuda.py, and no CUDA variable is set. Hence, these
lines can pass simply because those variables are always undefined, and thus expanded to empty strings. But this
cannot be safely relied on, and is causing https://github.com/pytorch/pytorch/issues/28617 to fail.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29009
Differential Revision: D18273472
Pulled By: ezyang
fbshipit-source-id: b8b6580e8a44d874ac678ed9073412d4d2e393ee