"git@developer.sourcefind.cn:OpenDAS/pytorch3d.git" did not exist on "909dc835050f84fc739fe75fd02884f305195afb"
Commit c3026977 authored by rusty1s's avatar rusty1s
Browse files

conditional OpenMP

parent d7a16f9a
#include "rw_cpu.h" #include "rw_cpu.h"
#include <ATen/ParallelOpenMP.h> #include <ATen/Parallel.h>
#include "utils.h" #include "utils.h"
......
...@@ -4,6 +4,7 @@ import glob ...@@ -4,6 +4,7 @@ import glob
from setuptools import setup, find_packages from setuptools import setup, find_packages
import torch import torch
from torch.__config__ import parallel_info
from torch.utils.cpp_extension import BuildExtension from torch.utils.cpp_extension import BuildExtension
from torch.utils.cpp_extension import CppExtension, CUDAExtension, CUDA_HOME from torch.utils.cpp_extension import CppExtension, CUDAExtension, CUDA_HOME
...@@ -19,8 +20,13 @@ BUILD_DOCS = os.getenv('BUILD_DOCS', '0') == '1' ...@@ -19,8 +20,13 @@ BUILD_DOCS = os.getenv('BUILD_DOCS', '0') == '1'
def get_extensions(): def get_extensions():
Extension = CppExtension Extension = CppExtension
define_macros = [] define_macros = []
extra_compile_args = {'cxx': ['-fopenmp']} extra_compile_args = {'cxx': []}
extra_link_args = ['-lgomp'] extra_link_args = []
info = parallel_info()
if 'parallel backend: OpenMP' in info and 'OpenMP not found' not in info:
print('Using OpenMP')
extra_compile_args['cxx'] += ['-DAT_PARALLEL_OPENMP', '-fopenmp']
if WITH_CUDA: if WITH_CUDA:
Extension = CUDAExtension Extension = CUDAExtension
......
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