This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
setup.py
55 lines (49 loc) · 1.52 KB
/
setup.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import setuptools
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
import os
cxx_flags = []
ext_libs = []
authors = [
'Jiaao He',
'Jiezhong Qiu',
'Aohan Zeng',
'Tiago Antunes',
'Jinjun Peng',
'Qin Li',
]
if os.environ.get('USE_NCCL', '0') == '1':
cxx_flags.append('-DFMOE_USE_NCCL')
ext_libs.append('nccl')
if __name__ == '__main__':
setuptools.setup(
name='fastmoe',
version='0.2.0',
description='An efficient Mixture-of-Experts system for PyTorch',
author=', '.join(authors),
author_email='[email protected]',
license='Apache-2',
url='https://github.com/laekov/fastmoe',
packages=['fmoe', 'fmoe.megatron', 'fmoe.gates'],
ext_modules=[
CUDAExtension(
name='fmoe_cuda',
sources=[
'cuda/stream_manager.cpp',
'cuda/local_exchange.cu',
'cuda/balancing.cu',
'cuda/fused_compute.cu',
'cuda/global_exchange.cu',
'cuda/parallel_linear.cu',
'cuda/balanced_assignment.cpp',
'cuda/fmoe_cuda.cpp',
],
extra_compile_args={
'cxx': cxx_flags,
'nvcc': cxx_flags
},
libraries=ext_libs
)
],
cmdclass={
'build_ext': BuildExtension
})