Python torch.utils.cpp_extension.CUDAExtension() Examples
The following are 18
code examples of torch.utils.cpp_extension.CUDAExtension().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
torch.utils.cpp_extension
, or try the search function
.
Example #1
Source File: setup.py From mmskeleton with Apache License 2.0 | 6 votes |
def make_cuda_ext(name, module, sources, include_dirs=[]): define_macros = [] if torch.cuda.is_available() or os.getenv('FORCE_CUDA', '0') == '1': define_macros += [("WITH_CUDA", None)] else: raise EnvironmentError('CUDA is required to compile MMSkeleton!') return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], define_macros=define_macros, include_dirs=include_dirs, extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #2
Source File: setup.py From Det3D with Apache License 2.0 | 6 votes |
def make_cuda_ext(name, module, sources, extra_compile_args={}): if "cxx" not in extra_compile_args: extra_compile_args["cxx"] = [] nvcc_flags = [ "-D__CUDA_NO_HALF_OPERATORS__", "-D__CUDA_NO_HALF_CONVERSIONS__", "-D__CUDA_NO_HALF2_OPERATORS__", ] if "nvcc" not in extra_compile_args: extra_compile_args["nvcc"] = nvcc_flags else: extra_compile_args["nvcc"] += nvcc_flags return CUDAExtension( name="{}.{}".format(module, name), sources=[os.path.join(*module.split("."), p) for p in sources], extra_compile_args=copy.deepcopy(extra_compile_args), )
Example #3
Source File: setup.py From FasterRCNN.pytorch with MIT License | 6 votes |
def make_cuda_ext(name, module, sources): define_macros = [] if torch.cuda.is_available() or os.getenv('FORCE_CUDA', '0') == '1': define_macros += [("WITH_CUDA", None)] else: raise EnvironmentError('CUDA is required to compile Faster RCNN!') return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], define_macros=define_macros, extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #4
Source File: setup.py From L3C-PyTorch with GNU General Public License v3.0 | 6 votes |
def get_extension(cuda_support): # dir of this file setup_dir = os.path.dirname(os.path.realpath(__file__)) # Where the cpp and cu files are prefix = os.path.join(setup_dir, MODULE_BASE_NAME) if not os.path.isdir(prefix): raise ValueError('Did not find backend foler: {}'.format(prefix)) if cuda_support: nvcc_avaible, nvcc_version = supported_nvcc_available() if not nvcc_avaible: print(_bold_warn_str('***WARN') + ': Found untested nvcc {}'.format(nvcc_version)) return CUDAExtension( MODULE_BASE_NAME + '_gpu', prefixed(prefix, ['torchac.cpp', 'torchac_kernel.cu']), define_macros=[('COMPILE_CUDA', '1')]) else: return CppExtension( MODULE_BASE_NAME + '_cpu', prefixed(prefix, ['torchac.cpp'])) # TODO: # Add further supported version as specified in readme
Example #5
Source File: setup.py From PolarMask with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #6
Source File: setup.py From kaggle-kuzushiji-recognition with MIT License | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #7
Source File: setup.py From RDSNet with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #8
Source File: setup.py From IoU-Uniform-R-CNN with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #9
Source File: setup.py From EDVR with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, sources): return CUDAExtension( name='{}'.format(name), sources=[p for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #10
Source File: setup.py From mmdetection-annotated with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #11
Source File: setup.py From FoveaBox with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #12
Source File: setup.py From Cascade-RPN with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #13
Source File: setup.py From Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #14
Source File: setup.py From CenterNet with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #15
Source File: setup.py From mmsr with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, sources): return CUDAExtension( name='{}'.format(name), sources=[p for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #16
Source File: setup.py From seamseg with BSD 3-Clause "New" or "Revised" License | 5 votes |
def make_extension(name, package): return CUDAExtension( name="{}.{}._backend".format(package, name), sources=find_sources(path.join("src", name)), extra_compile_args={ "cxx": ["-O3"], "nvcc": ["--expt-extended-lambda"], }, include_dirs=["include/"], )
Example #17
Source File: setup.py From ttfnet with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, module, sources): return CUDAExtension( name='{}.{}'.format(module, name), sources=[os.path.join(*module.split('.'), p) for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })
Example #18
Source File: setup.py From PoseWarper with Apache License 2.0 | 5 votes |
def make_cuda_ext(name, sources): return CUDAExtension( name=name, sources=[p for p in sources], extra_compile_args={ 'cxx': [], 'nvcc': [ '-D__CUDA_NO_HALF_OPERATORS__', '-D__CUDA_NO_HALF_CONVERSIONS__', '-D__CUDA_NO_HALF2_OPERATORS__', ] })