Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions python/paddle/utils/cpp_extension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from .cpp_extension import (
CUDA_HOME, # noqa: F401
IS_WINDOWS, # noqa: F401
BuildExtension, # noqa: F401
CppExtension,
CUDAExtension,
Expand Down
5 changes: 4 additions & 1 deletion python/paddle/utils/cpp_extension/extension_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ def normalize_extension_kwargs(kwargs, use_cuda=False):

# append necessary include dir path of paddle
include_dirs = list(kwargs.get('include_dirs', []))
include_dirs = [os.fsdecode(include_dir) for include_dir in include_dirs]
include_dirs.extend(compile_include_dirs)
include_dirs.extend(find_paddle_includes(use_cuda))
include_dirs.extend(find_python_includes())
Expand Down Expand Up @@ -821,7 +822,9 @@ def find_rocm_includes():
return [os.path.join(rocm_home, 'include')]


def _get_all_paddle_includes_from_include_root(include_root: str) -> list[str]:
def _get_all_paddle_includes_from_include_root(
include_root: os.PathLike[str] | str,
) -> list[str]:
"""
Get all paddle include directories from include root (packaged in wheel)
"""
Expand Down
2 changes: 1 addition & 1 deletion test/cpp_extension/cpp_extension_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
for site_packages_path in getsitepackages():
paddle_include_dir = Path(site_packages_path) / "paddle/include"
paddle_includes.extend(
_get_all_paddle_includes_from_include_root(str(paddle_include_dir))
_get_all_paddle_includes_from_include_root(paddle_include_dir)
)

# Add current dir, search custom_power.h
Expand Down
4 changes: 2 additions & 2 deletions test/cpp_extension/mix_relu_and_extension_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
from pathlib import Path

from utils import paddle_includes

Expand All @@ -24,7 +24,7 @@
sources=["mix_relu_and_extension.cc"],
include_dirs=[
*paddle_includes,
os.path.dirname(os.path.abspath(__file__)),
Path(__file__).parent.resolve(),
],
extra_compile_args={'cc': ['-w', '-g']},
verbose=True,
Expand Down
2 changes: 1 addition & 1 deletion test/custom_op/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
_get_all_paddle_includes_from_include_root(str(paddle_include_dir))
)

paddle_libraries.append(str(Path(site_packages_path) / 'paddle' / 'libs'))
paddle_libraries.append(Path(site_packages_path) / 'paddle' / 'libs')

# Test for extra compile args
extra_cc_args = ['-w', '-g'] if not IS_WINDOWS else ['/w']
Expand Down
Loading