ULTRA icon indicating copy to clipboard operation
ULTRA copied to clipboard

Failing to build extension 'rspmm' while running example command

Open cora-hai opened this issue 3 months ago • 0 comments

Hi, I am trying to run the example command for an inductive dataset on CPU and seemingly have a problem with building the extension 'rspmm'. I get the below error message. I have the hypothesis that the problem lies somewhere in my system configuration, which I am new to myself. I am very lost with this problem and would appreciate any ideas on how I could resolve it. I am ultimately looking to use ULTRA on a new knowledge graph, but wanted to try it out on a known dataset first.

Thanks in advance!

Traceback (most recent call last):
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\utils\cpp_extension.py", line 2506, in _run_ninja_build
    subprocess.run(
    ~~~~~~~~~~~~~~^
        command,
        ^^^^^^^^
    ...<3 lines>...
        check=True,
        ^^^^^^^^^^^
        env=env)
        ^^^^^^^^
  File "C:\Users\corah\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 2.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\corah\project\ULTRA\script\run.py", line 297, in <module>
    test(cfg, model, valid_data, filtered_data=val_filtered_data, device=device, logger=logger)
    ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "C:\Users\corah\project\ULTRA\script\run.py", line 136, in test
    t_pred = model(test_data, t_batch)
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1751, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1762, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\corah\project\ULTRA\ultra\models.py", line 23, in forward
    relation_representations = self.relation_model(data.relation_graph, query=query_rels)
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1751, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1762, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\corah\project\ULTRA\ultra\models.py", line 100, in forward
    output = self.bellmanford(rel_graph, h_index=query)["node_feature"]  # (batch_size, num_nodes, hidden_dim)
             ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\corah\project\ULTRA\ultra\models.py", line 76, in bellmanford
    hidden = layer(layer_input, query, boundary, data.edge_index, data.edge_type, size, edge_weight)
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1751, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\nn\modules\module.py", line 1762, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\Users\corah\project\ULTRA\ultra\layers.py", line 86, in forward
    output = self.propagate(input=input, relation=relation, boundary=boundary, edge_index=edge_index,
                            edge_type=edge_type, size=size, edge_weight=edge_weight)
  File "C:\Users\corah\project\ULTRA\ultra\layers.py", line 118, in propagate
    out = self.message_and_aggregate(edge_index, **msg_aggr_kwargs)
  File "C:\Users\corah\project\ULTRA\ultra\layers.py", line 187, in message_and_aggregate
    from .rspmm import generalized_rspmm
  File "C:\Users\corah\project\ULTRA\ultra\rspmm\__init__.py", line 1, in <module>
    from .rspmm import generalized_rspmm
  File "C:\Users\corah\project\ULTRA\ultra\rspmm\rspmm.py", line 209, in <module>
    rspmm = load_extension("rspmm", [os.path.join(path, "rspmm.cpp"), os.path.join(path, "rspmm.cu")])
  File "C:\Users\corah\project\ULTRA\ultra\rspmm\rspmm.py", line 204, in load_extension
    return cpp_extension.load(name, sources, extra_cflags, extra_cuda_cflags, **kwargs)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\utils\cpp_extension.py", line 1623, in load
    return _jit_compile(
        name,
    ...<11 lines>...
        is_standalone,
        keep_intermediates=keep_intermediates)
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\utils\cpp_extension.py", line 2076, in _jit_compile
    _write_ninja_file_and_build_library(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        name=name,
        ^^^^^^^^^^
    ...<9 lines>...
        with_sycl=with_sycl,
        ^^^^^^^^^^^^^^^^^^^^
        is_standalone=is_standalone)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\utils\cpp_extension.py", line 2222, in _write_ninja_file_and_build_library
    _run_ninja_build(
    ~~~~~~~~~~~~~~~~^
        build_directory,
        ^^^^^^^^^^^^^^^^
        verbose,
        ^^^^^^^^
        error_prefix=f"Error building extension '{name}'")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\utils\cpp_extension.py", line 2522, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'rspmm': [1/2] cl /showIncludes -DTORCH_EXTENSION_NAME=rspmm -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\include -IC:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\corah\AppData\Local\Programs\Python\Python313\Include -D_GLIBCXX_USE_CXX11_ABI=0 /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc /std:c++17 -Ofast -fopenmp -DAT_PARALLEL_OPENMP -c C:\Users\corah\project\ULTRA\ultra\rspmm\source\rspmm.cpp /Forspmm.o
FAILED: [code=2] rspmm.o
cl /showIncludes -DTORCH_EXTENSION_NAME=rspmm -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\include -IC:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\corah\AppData\Local\Programs\Python\Python313\Include -D_GLIBCXX_USE_CXX11_ABI=0 /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /wd4624 /wd4067 /wd4068 /EHsc /std:c++17 -Ofast -fopenmp -DAT_PARALLEL_OPENMP -c C:\Users\corah\project\ULTRA\ultra\rspmm\source\rspmm.cpp /Forspmm.o
Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35217 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9025 : overriding '/Os' with '/Ot'
cl : Command line warning D9002 : ignoring unknown option '-Of'
cl : Command line warning D9002 : ignoring unknown option '-Oa'
cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
C:\Users\corah\project\ULTRA\.venv\Lib\site-packages\torch\include\c10/util/safe_numerics.h(23): error C3861: '_addcarry_u64': identifier not found
ninja: build stopped: subcommand failed.

The command I used is the example command with the full path to the checkpoint as instructed: py script/run.py -c config/inductive/inference.yaml --dataset FB15k237Inductive --version v1 --epochs 0 --bpe null --gpus null --ckpt "C:\Users\corah\project\ULTRA\ckpts\ultra_3g.pth"

I am working with the following versions in a venv to avoid any conflicts:

  • python 3.13.7
  • torch 2.7.0+cpu
  • torch_scatter 2.1.2+pt27cpu
  • torch_geometric 2.6.1
  • ninja 1.13.0
  • easydict 1.13
  • pyyaml 6.0.2

Further system configurations:

  • Processor: Snapdragon(R) X Elite - X1E78100 - Qualcomm(R) Oryon(TM) CPU (3.42 GHz)
  • System type: 64-bit operating system, ARM-based processor
  • [Qualcomm(R) Adreano(TM) X1-85 GPU]

cora-hai avatar Sep 19 '25 16:09 cora-hai