setup.py 797 Bytes
Newer Older
Rick Ho's avatar
Rick Ho committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
import os

CUDA_HELPER = os.environ.get('CUDA_HELPER', '/usr/local/cuda/samples/common/inc')
cxx_flags = [
        '-I{}'.format(CUDA_HELPER)
        ]
if os.environ.get('USE_NCCL', '0') == '1':
    cxx_flags.append('-DMOE_USE_NCCL')

setup(
    name='moe_cuda',
    ext_modules=[
        CUDAExtension(
            name='moe_cuda', 
            sources=[
                'cuda/moe.cpp',
                'cuda/cuda_stream_manager.cpp',
                'cuda/moe_cuda_kernel.cu',
                ],
            extra_compile_args={
                'cxx': cxx_flags,
                'nvcc': cxx_flags
                }
            )
        ],
    cmdclass={
        'build_ext': BuildExtension
    })