Skip to content

Commit

Permalink
BLD: only compile fixed_interpolator.cpp once
Browse files Browse the repository at this point in the history
Avoid a race condition on fixed_interpolator.o during parallel builds by
building it only once and storing it in a static library.

Hopefully fixes yt-project#4278.
  • Loading branch information
yut23 authored and henrynjones committed May 13, 2024
1 parent b176901 commit 3880a61
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ def has_ext_modules(self):
{
"sources": ["yt/utilities/lib/fixed_interpolator.cpp"],
"include_dirs": clib_include_dirs,
<<<<<<< HEAD
"define_macros": NUMPY_MACROS,
=======
>>>>>>> 8a11260ad (BLD: only compile fixed_interpolator.cpp once)
},
)

Expand Down
7 changes: 7 additions & 0 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,11 @@ def _compile(


def get_python_include_dirs():
<<<<<<< HEAD
"""Extracted from distutils.command.build_ext.build_ext.finalize_options(),
=======
"""Extracted from distutils.command.build_ext.build_ext#finalize_options(),
>>>>>>> 8a11260ad (BLD: only compile fixed_interpolator.cpp once)
https://github.com/python/cpython/blob/812245ecce2d8344c3748228047bab456816180a/Lib/distutils/command/build_ext.py#L148-L167
"""
include_dirs = []
Expand All @@ -394,13 +398,16 @@ def get_python_include_dirs():
return include_dirs


<<<<<<< HEAD
NUMPY_MACROS = [
("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION"),
# keep in sync with runtime requirements (pyproject.toml)
("NPY_TARGET_VERSION", "NPY_1_19_API_VERSION"),
]


=======
>>>>>>> 8a11260ad (BLD: only compile fixed_interpolator.cpp once)
def create_build_ext(lib_exts, cythonize_aliases):
class build_ext(_build_ext):
# subclass setuptools extension builder to avoid importing cython and numpy
Expand Down
4 changes: 4 additions & 0 deletions yt/utilities/lib/grid_traversal.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# distutils: include_dirs = LIB_DIR
<<<<<<< HEAD
# distutils: libraries = STD_LIBS
=======
# distutils: libraries = STD_LIBS FIXED_INTERP
>>>>>>> 8a11260ad (BLD: only compile fixed_interpolator.cpp once)
# distutils: language = c++
# distutils: extra_compile_args = CPP14_FLAG
# distutils: extra_link_args = CPP14_FLAG
Expand Down

0 comments on commit 3880a61

Please sign in to comment.