用kafka接收消息
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

setup.py 1.5KB

2 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  2. # !/usr/bin/env python
  3. # reference: https://github.com/facebookresearch/maskrcnn-benchmark/blob/90c226cf10e098263d1df28bda054a5f22513b4f/setup.py
  4. import os
  5. import glob
  6. import torch
  7. from setuptools import setup
  8. from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension, CUDA_HOME
  9. requirements = ["torch"]
  10. def get_extension():
  11. this_dir = os.path.dirname(os.path.abspath(__file__))
  12. extensions_dir = os.path.join(this_dir, "csrc")
  13. main_file = glob.glob(os.path.join(extensions_dir, "*.cpp"))
  14. source_cpu = glob.glob(os.path.join(extensions_dir, "cpu", "*.cpp"))
  15. source_cuda = glob.glob(os.path.join(extensions_dir, "cuda", "*.cu"))
  16. sources = main_file + source_cpu
  17. extension = CppExtension
  18. define_macros = []
  19. if (torch.cuda.is_available() and CUDA_HOME is not None) or os.getenv("FORCE_CUDA", "0") == "1":
  20. extension = CUDAExtension
  21. sources += source_cuda
  22. define_macros += [("WITH_CUDA", None)]
  23. sources = [os.path.join(extensions_dir, s) for s in sources]
  24. include_dirs = [extensions_dir]
  25. ext_modules = [
  26. extension(
  27. "._C",
  28. sources,
  29. include_dirs=include_dirs,
  30. define_macros=define_macros,
  31. )
  32. ]
  33. return ext_modules
  34. setup(
  35. name="semantic_segmentation",
  36. version="0.1",
  37. author="tramac",
  38. description="semantic segmentation in pytorch",
  39. ext_modules=get_extension(),
  40. cmdclass={"build_ext": BuildExtension}
  41. )