The problem is in the title. On the C++ side I’ve developed two functionalities and registered them via:
static auto registry = c10::RegisterOperators("rays::ray_cast", &ray_cast)
.op("rays::mesh_to_heightmap", &mesh_to_heightmap);
and on the python side, I’ve tried to load these extensions like so:
cpp_extension.load(name="mesh_to_heightmap", sources=[os.path.join(file_dir, "rays.cpp")],
is_python_module=False, build_directory=build_directory, extra_cflags=["/Zi"], extra_ldflags=["/DEBUG"])
cpp_extension.load(name="ray_cast", sources=[os.path.join(file_dir, "rays.cpp")],
is_python_module=False, build_directory=build_directory, extra_cflags=["/Zi"], extra_ldflags=["/DEBUG"])
However, this fails so long as both load statements are present, with the following:
Tests/models/physical/test_mesh.py:None (Tests/models/physical/test_mesh.py)
models\physical\test_mesh.py:4: in <module>
from awes.torch_extensions import rays
..\awes\torch_extensions\rays.py:20: in <module>
cpp_extension.load(name="ray_cast", sources=[os.path.join(file_dir, "rays.cpp")],
C:\Users\wneill\Miniconda3\envs\awes\lib\site-packages\torch\utils\cpp_extension.py:1080: in load
return _jit_compile(
C:\Users\wneill\Miniconda3\envs\awes\lib\site-packages\torch\utils\cpp_extension.py:1318: in _jit_compile
return _import_module_from_library(name, build_directory, is_python_module)
C:\Users\wneill\Miniconda3\envs\awes\lib\site-packages\torch\utils\cpp_extension.py:1706: in _import_module_from_library
torch.ops.load_library(filepath)
C:\Users\wneill\Miniconda3\envs\awes\lib\site-packages\torch\_ops.py:104: in load_library
ctypes.CDLL(path)
C:\Users\wneill\Miniconda3\envs\awes\lib\ctypes\__init__.py:373: in __init__
self._handle = _dlopen(self._name, mode)
E OSError: [WinError 1114] A dynamic link library (DLL) initialization routine failed
And sometimes it also fails with a message about “destructor implicitly defined as deleted”. On the C++ side one function calls the other, so I know that they are both working fine.