Unverified Commit 2bb2a134 authored by msbaines's avatar msbaines Committed by GitHub
Browse files

[chore] do not build cuda extensions by default (#634)

parent a5594032
...@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ...@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## NEXT - TBD ## NEXT - TBD
### Fixed
- setup.py: hide CUDA extensions behind BUILD_CUDA_EXTENSIONS envvar
### Added ### Added
- FSDP: better memory usage for reduce bucket ([#633](https://github.com/facebookresearch/fairscale/pull/633)) - FSDP: better memory usage for reduce bucket ([#633](https://github.com/facebookresearch/fairscale/pull/633))
......
[build-system] [build-system]
requires = [ requires = [
"setuptools >= 40.6.2", "setuptools >= 40.6.2",
"torch >= 1.4.0",
"wheel >= 0.30.0" "wheel >= 0.30.0"
] ]
build-backend = "setuptools.build_meta:__legacy__" build-backend = "setuptools.build_meta:__legacy__"
......
...@@ -7,11 +7,8 @@ ...@@ -7,11 +7,8 @@
import os import os
import re import re
import warnings
import setuptools import setuptools
import torch
from torch.utils.cpp_extension import CUDA_HOME, BuildExtension, CUDAExtension
this_dir = os.path.dirname(os.path.abspath(__file__)) this_dir = os.path.dirname(os.path.abspath(__file__))
...@@ -34,8 +31,9 @@ def find_version(version_file_path): ...@@ -34,8 +31,9 @@ def find_version(version_file_path):
extensions = [] extensions = []
cmdclass = {} cmdclass = {}
force_cuda = os.getenv("FORCE_CUDA", "0") == "1" if os.getenv("BUILD_CUDA_EXTENSIONS", "0") == "1":
if (torch.cuda.is_available() and CUDA_HOME is not None) or force_cuda: from torch.utils.cpp_extension import BuildExtension, CUDAExtension
extensions.extend( extensions.extend(
[ [
CUDAExtension( CUDAExtension(
...@@ -51,8 +49,6 @@ if (torch.cuda.is_available() and CUDA_HOME is not None) or force_cuda: ...@@ -51,8 +49,6 @@ if (torch.cuda.is_available() and CUDA_HOME is not None) or force_cuda:
) )
cmdclass["build_ext"] = BuildExtension cmdclass["build_ext"] = BuildExtension
else:
warnings.warn("Cannot install FusedAdam cuda.")
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment