예제 #1
0
from paddle.utils.cpp_extension import CppExtension, setup

setup(name='custom_setup_ops',
      ext_modules=CppExtension(sources=['relu_cpu.cc']))
예제 #2
0
from paddle.utils.cpp_extension import CUDAExtension, setup

setup(
    name='custom_setup_ops',
    ext_modules=CUDAExtension(
        sources=['relu_cuda.cc', 'relu_cuda.cu']
    )
)

예제 #3
0
from paddle.utils.cpp_extension import CppExtension, CUDAExtension, BuildExtension, setup

setup(name='relu2_op_shared',
      ext_modules=[CUDAExtension(name='librelu2_op', sources=['relu_op.cc'])])
예제 #4
0
from paddle.utils.cpp_extension import CppExtension, CUDAExtension, BuildExtension, setup

# setup(
#     name='custom_relu_lib_rf',
#     ext_modules=[
#         CUDAExtension(
#             name='custom_relu_op_rf',
#             sources=['relu_op.cc', "relu_op.cu"])
#     ])

setup(
    name='custom_relu_lib_rf',
    ext_modules=[
        CppExtension(
            name='custom_relu_op_rf',
            sources=['relu_op.cc'])
    ])
예제 #5
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os

from utils import paddle_includes, extra_compile_args
from paddle.utils.cpp_extension import CppExtension, CUDAExtension, BuildExtension, setup
from paddle.utils.cpp_extension.extension_utils import use_new_custom_op_load_method

# switch to old custom op method
use_new_custom_op_load_method(False)

file_dir = os.path.dirname(os.path.abspath(__file__))

setup(
    name='librelu2_op_from_setup',
    ext_modules=[
        CUDAExtension(
            sources=['relu_op3.cc', 'relu_op3.cu', 'relu_op.cc',
                     'relu_op.cu'],  # test for multi ops
            include_dirs=paddle_includes,
            extra_compile_args=extra_compile_args)
    ],
    cmdclass={
        'build_ext':
        BuildExtension.with_options(no_python_abi_suffix=True,
                                    output_dir=file_dir)  # for unittest
    })
예제 #6
0
import paddle
from paddle.utils.cpp_extension import CppExtension, CUDAExtension, setup

if __name__ == "__main__":
    if paddle.device.is_compiled_with_cuda():
        setup(name='rbox_iou_ops',
              ext_modules=CUDAExtension(
                  sources=['rbox_iou_op.cc', 'rbox_iou_op.cu'],
                  extra_compile_args={'cxx': ['-DPADDLE_WITH_CUDA']}))
    else:
        setup(name='rbox_iou_ops',
              ext_modules=CppExtension(sources=['rbox_iou_op.cc']))
예제 #7
0
from paddle.utils.cpp_extension import CppExtension, setup

setup(name='dispatch_op',
      ext_modules=[
          CppExtension(name='dispatch_op', sources=['diapatch_test_op.cc'])
      ])
예제 #8
0
from paddle.utils.cpp_extension import CppExtension, CUDAExtension, setup

if __name__ == "__main__":
    setup(
        name='rbox_iou_ops',
        ext_modules=CUDAExtension(sources=['rbox_iou_op.cc', 'rbox_iou_op.cu']))
예제 #9
0
from paddle.utils.cpp_extension import CppExtension, CUDAExtension, BuildExtension, setup

setup(name='custom_relu_lib',
      ext_modules=[
          CUDAExtension(name='custom_relu_op',
                        sources=['relu_op.cc', "relu_op.cu"])
      ])
from utils import paddle_includes, extra_compile_args

if paddle.is_compiled_with_cuda():
    sources = ['custom_raw_op_kernel_op.cc', 'custom_raw_op_kernel_op.cu']
    extension = CUDAExtension
else:
    sources = ['custom_raw_op_kernel_op.cc']
    extension = CppExtension

cwd = os.path.dirname(os.path.abspath(__file__))
os.chdir(cwd)

if os.name == 'nt':
    compile_dir = os.path.join(os.environ['work_dir'], os.environ['BUILD_DIR'])
else:
    compile_dir = os.path.join(os.environ['PADDLE_ROOT'], 'build')

macros = []
if core.is_compiled_with_mkldnn():
    macros.append(("PADDLE_WITH_MKLDNN", None))
if core.is_compiled_with_nccl():
    macros.append(("PADDLE_WITH_NCCL", None))

include_dirs = list(paddle_includes) + [cwd]
setup(name=os.getenv("MODULE_NAME", "custom_raw_op_kernel_op_setup"),
      ext_modules=extension(sources=sources,
                            include_dirs=include_dirs,
                            extra_compile_args=extra_compile_args,
                            _compile_dir=compile_dir,
                            define_macros=macros))
예제 #11
0
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os

from utils import paddle_includes, extra_compile_args, IS_MAC
from paddle.utils.cpp_extension import CUDAExtension, setup, CppExtension

# Mac-CI don't support GPU
Extension = CppExtension if IS_MAC else CUDAExtension
sources = ['custom_relu_op.cc', 'custom_relu_op_dup.cc']
if not IS_MAC:
    sources.append('custom_relu_op.cu')

# custom_relu_op_dup.cc is only used for multi ops test,
# not a new op, if you want to test only one op, remove this
# source file
setup(
    name='custom_relu_module_setup',
    ext_modules=Extension(  # test for not specific name here.
        sources=sources,  # test for multi ops
        include_dirs=paddle_includes,
        extra_compile_args=extra_compile_args))
예제 #12
0
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os

from utils import paddle_includes, extra_compile_args
from paddle.utils.cpp_extension import CUDAExtension, setup
from paddle.utils.cpp_extension.extension_utils import use_new_custom_op_load_method

# switch to old custom op method
use_new_custom_op_load_method(False)

setup(
    name='custom_relu2',
    ext_modules=CUDAExtension(  # test for not specific name here.
        sources=['relu_op.cc', 'relu_op.cu', 'relu_op3.cc',
                 'relu_op3.cu'],  # test for multi ops
        include_dirs=paddle_includes,
        extra_compile_args=extra_compile_args))