Support building with headers from nvidia wheels (#2623)
* Support building with headers from nvidia wheels
There are two changes:
1. `import nvidia` returns a namespace package with `__file__` equal to `None`
2. Add the way to force headers from nvidia wheels. Without that envvar, it's practically impossible with CUDA installed system-wide.
I successfully built the package with torch using the following `uv` configuration:
```
[tool.uv.extra-build-dependencies]
"transformer-engine-torch" = [
"ninja",
"nvidia-cuda-crt==13.0.88",
"nvidia-cuda-cccl==13.0.85",
{ requirement = "torch", match-runtime = true },
{ requirement = "pytorch-triton", match-runtime = true },
{ requirement = "nvidia-cusolver", match-runtime = true },
{ requirement = "nvidia-curand", match-runtime = true },
{ requirement = "nvidia-cublas", match-runtime = true },
{ requirement = "nvidia-cusparse", match-runtime = true },
{ requirement = "nvidia-cudnn-cu13", match-runtime = true },
{ requirement = "nvidia-nvtx", match-runtime = true },
{ requirement = "nvidia-cuda-nvrtc", match-runtime = true },
{ requirement = "nvidia-cuda-runtime", match-runtime = true },
]
```
Signed-off-by:
Vadim Markovtsev <vadim@poolside.ai>
* Apply suggestion from @ksivaman
Signed-off-by:
Kirthi Shankar Sivamani <ksivamani@nvidia.com>
Signed-off-by:
Kirthi Shankar Sivamani <ksivamani@nvidia.com>
---------
Signed-off-by:
Vadim Markovtsev <vadim@poolside.ai>
Signed-off-by:
Kirthi Shankar Sivamani <ksivamani@nvidia.com>
Co-authored-by:
Kirthi Shankar Sivamani <ksivamani@nvidia.com>
Showing
Please register or sign in to comment