Dongyq815 / VirRep

MIT License
1 stars 1 forks source link

CppCompileError: C++ compile error #2

Closed Asa12138 closed 3 months ago

Asa12138 commented 4 months ago

When I use the default gpu mode:

python VirRep.py -i ../test/test.fasta -o vr_out -w 2 --use-amp --min-score 1000-5000:0.9,5001-10000:0.8,10001-Inf:0.7

It got RuntimeError: No CUDA GPUs are available, but I already get the CUDA GPUs.

So I try cpu mode:

python VirRep.py -i ../test/test.fasta -o vr_out -w 2 --use-amp --min-score 1000-5000:0.9,5001-10000:0.8,10001-Inf:0.7 --cpu

However, it still raised error:

Segment seqs...
100%|██████████| 20/20 [00:00<00:00, 329.72seqs/s]
Scoring segments...
  0%|          | 0/3 [00:18<?, ?batch/s]
Traceback (most recent call last):
  File "VirRep.py", line 284, in <module>
    pred_df = predict(
  File "/share/home/jianglab/pengchen/biosoft/VirRep/src/predict.py", line 377, in predict
    headers_dict, seqlen_dict, scores_dict, positions_dict = score_segment(
  File "/share/home/jianglab/pengchen/biosoft/VirRep/src/predict.py", line 64, in score_segment
    scores = model(
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
    return forward_call(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/eval_frame.py", line 451, in _fn
    return fn(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1532, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1541, in _call_impl
    return forward_call(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/convert_frame.py", line 921, in catch_errors
    return callback(frame, cache_entry, hooks, frame_state, skip=1)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/convert_frame.py", line 786, in _convert_frame
    result = inner_convert(
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/convert_frame.py", line 400, in _convert_frame_assert
    return _compile(
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/convert_frame.py", line 676, in _compile
    guarded_code = compile_inner(code, one_graph, hooks, transform)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/convert_frame.py", line 535, in compile_inner
    out_code = transform_code_object(code, transform)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/bytecode_transformation.py", line 1036, in transform_code_object
    transformations(instructions, code_options)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/convert_frame.py", line 165, in _fn
    return fn(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/convert_frame.py", line 500, in transform
    tracer.run()
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/symbolic_convert.py", line 2149, in run
    super().run()
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/symbolic_convert.py", line 810, in run
    and self.step()
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/symbolic_convert.py", line 773, in step
    getattr(self, inst.opname)(inst)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/symbolic_convert.py", line 484, in wrapper
    return handle_graph_break(self, inst, speculation.reason)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/symbolic_convert.py", line 548, in handle_graph_break
    self.output.compile_subgraph(self, reason=reason)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/output_graph.py", line 1001, in compile_subgraph
    self.compile_and_call_fx_graph(tx, pass2.graph_output_vars(), root)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/output_graph.py", line 1178, in compile_and_call_fx_graph
    compiled_fn = self.call_user_compiler(gm)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/output_graph.py", line 1251, in call_user_compiler
    raise BackendCompilerFailed(self.compiler_fn, e).with_traceback(
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/output_graph.py", line 1232, in call_user_compiler
    compiled_fn = compiler_fn(gm, self.example_inputs())
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/repro/after_dynamo.py", line 117, in debug_wrapper
    compiled_gm = compiler_fn(gm, example_inputs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/__init__.py", line 1731, in __call__
    return compile_fx(model_, inputs_, config_patches=self.config)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/compile_fx.py", line 1330, in compile_fx
    return aot_autograd(
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/backends/common.py", line 58, in compiler_fn
    cg = aot_module_simplified(gm, example_inputs, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_functorch/aot_autograd.py", line 903, in aot_module_simplified
    compiled_fn = create_aot_dispatcher_function(
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_functorch/aot_autograd.py", line 628, in create_aot_dispatcher_function
    compiled_fn = compiler_fn(flat_fn, fake_flat_args, aot_config, fw_metadata=fw_metadata)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/runtime_wrappers.py", line 443, in aot_wrapper_dedupe
    return compiler_fn(flat_fn, leaf_flat_args, aot_config, fw_metadata=fw_metadata)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/runtime_wrappers.py", line 648, in aot_wrapper_synthetic_base
    return compiler_fn(flat_fn, flat_args, aot_config, fw_metadata=fw_metadata)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_functorch/_aot_autograd/jit_compile_runtime_wrappers.py", line 119, in aot_dispatch_base
    compiled_fw = compiler(fw_module, updated_flat_args)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/compile_fx.py", line 1257, in fw_compiler_base
    return inner_compile(
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/repro/after_aot.py", line 83, in debug_wrapper
    inner_compiled_fn = compiler_fn(gm, example_inputs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/debug.py", line 304, in inner
    return fn(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/compile_fx.py", line 438, in compile_fx_inner
    compiled_graph = fx_codegen_and_compile(
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/compile_fx.py", line 714, in fx_codegen_and_compile
    compiled_fn = graph.compile_to_fn()
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/graph.py", line 1307, in compile_to_fn
    return self.compile_to_module().call
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/graph.py", line 1254, in compile_to_module
    mod = PyCodeCache.load_by_key_path(
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/codecache.py", line 2160, in load_by_key_path
    exec(code, mod.__dict__, mod.__dict__)
  File "/tmp/torchinductor_pengchen/ir/cirr3erkv6aauuk6q75umz52veo35v6zwboh6qjiv74pt5kufwqh.py", line 6068, in <module>
    async_compile.wait(globals())
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/codecache.py", line 2715, in wait
    scope[key] = result.result()
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/codecache.py", line 2074, in load_pybinding
    result = cls.load(source_code + suffix, cuda)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/codecache.py", line 1948, in load
    compile_file(input_path, output_path, cmd)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_dynamo/utils.py", line 262, in time_wrapper
    r = func(*args, **kwargs)
  File "/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/_inductor/codecache.py", line 1888, in compile_file
    raise exc.CppCompileError(cmd, output) from e
torch._dynamo.exc.BackendCompilerFailed: backend='inductor' raised:
CppCompileError: C++ compile error

Command:
g++ /tmp/torchinductor_pengchen/a5/ca5mb7toe54fzxzww3mqhicdnvcba2qdpina3lzrhhs4d62uxjo2.cpp -shared -fPIC -Wall -std=c++17 -Wno-unused-variable -Wno-unknown-pragmas -D_GLIBCXX_USE_CXX11_ABI=0 -I/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/include -I/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/include/TH -I/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/include/THC -I/share/home/jianglab/pengchen/miniconda3/envs/rgi/include/python3.8 -L/share/home/jianglab/pengchen/miniconda3/envs/rgi/lib/python3.8/site-packages/torch/lib -lgomp -lc10 -O3 -DNDEBUG -ffast-math -fno-finite-math-only -fno-unsafe-math-optimizations -ffp-contract=off -march=native -fopenmp -D C10_USING_CUSTOM_GENERATED_MACROS -o /tmp/torchinductor_pengchen/a5/ca5mb7toe54fzxzww3mqhicdnvcba2qdpina3lzrhhs4d62uxjo2.so

Output:
g++: error: unrecognized command line option ‘-std=c++17’

Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information

You can suppress this exception and fall back to eager by setting:
    import torch._dynamo
    torch._dynamo.config.suppress_errors = True

My pip list is followed, Python 3.8.6:

Package                      Version
---------------------------- -----------
absl-py                      2.1.0
appdirs                      1.4.4
archspec                     0.2.4
astunparse                   1.6.3
attrs                        21.2.0
beautifulsoup4               4.9.3
biopython                    1.78
brotlipy                     0.7.0
cachetools                   5.3.3
certifi                      2021.10.8
cffi                         1.14.4
chardet                      3.0.4
checkv                       1.0.3
click                        8.1.7
cryptography                 35.0.0
cycler                       0.10.0
deepbgc                      0.1.12
filelock                     3.15.4
filetype                     1.0.7
flatbuffers                  24.3.25
fsspec                       2024.6.1
gast                         0.4.0
genomad                      1.8.0
google-auth                  2.29.0
google-auth-oauthlib         1.0.0
google-pasta                 0.2.0
grpcio                       1.63.0
h5py                         3.11.0
idna                         2.10
importlib_metadata           7.1.0
importlib_resources          6.4.0
iniconfig                    1.1.1
Jinja2                       3.1.4
joblib                       1.4.2
kcounter                     0.1.1
keras                        2.13.1
kiwisolver                   1.3.2
libclang                     18.1.1
llvmlite                     0.41.1
lxml                         4.6.1
Markdown                     3.6
markdown-it-py               3.0.0
MarkupSafe                   2.1.5
matplotlib                   3.4.3
mdurl                        0.1.2
more-itertools               8.10.0
mpmath                       1.3.0
networkx                     3.1
numba                        0.58.1
numpy                        1.22.4
nvidia-cublas-cu11           11.11.3.6
nvidia-cuda-cupti-cu11       11.8.87
nvidia-cuda-nvrtc-cu11       11.8.89
nvidia-cuda-runtime-cu11     11.8.89
nvidia-cudnn-cu11            8.7.0.84
nvidia-cufft-cu11            10.9.0.58
nvidia-curand-cu11           10.3.0.86
nvidia-cusolver-cu11         11.4.1.48
nvidia-cusparse-cu11         11.7.5.86
nvidia-nccl-cu11             2.20.5
nvidia-nvtx-cu11             11.8.86
oauthlib                     3.2.2
olefile                      0.46
opt-einsum                   3.3.0
packaging                    21.0
pandas                       1.3.4
patsy                        0.5.2
Pillow                       8.2.0
pip                          24.0
pluggy                       1.0.0
protobuf                     4.25.3
psutil                       6.0.0
py                           1.10.0
pyahocorasick                1.4.0
pyasn1                       0.6.0
pyasn1_modules               0.4.0
pycparser                    2.20
pyfaidx                      0.6.2
Pygments                     2.18.0
pyOpenSSL                    21.0.0
pyparsing                    2.4.7
PyQt5                        5.12.3
PyQt5_sip                    4.19.18
PyQtChart                    5.12
PyQtWebEngine                5.12.1
pyrodigal                    3.4.1
pyrodigal-gv                 0.3.1
pysam                        0.16.0.1
PySocks                      1.7.1
pytest                       6.2.5
python-crfsuite              0.9.10
python-dateutil              2.8.2
pytz                         2021.3
requests                     2.24.0
requests-oauthlib            2.0.0
RGI                          5.2.1
rich                         13.7.1
rich-click                   1.8.3
rsa                          4.9
scikit-learn                 1.3.2
scipy                        1.7.1
seaborn                      0.11.2
setuptools                   58.2.0
six                          1.16.0
soupsieve                    2.0.1
statsmodels                  0.13.0
sympy                        1.12.1
taxopy                       0.12.0
tensorboard                  2.13.0
tensorboard-data-server      0.7.2
tensorflow                   2.13.1
tensorflow-estimator         2.13.0
tensorflow-io-gcs-filesystem 0.34.0
termcolor                    2.4.0
threadpoolctl                3.5.0
toml                         0.10.2
torch                        2.3.1+cu118
tornado                      6.1
tqdm                         4.66.4
triton                       2.3.1
typing_extensions            4.12.2
urllib3                      1.25.11
Werkzeug                     3.0.2
wheel                        0.37.0
wrapt                        1.16.0
xgboost                      2.0.3
zipp                         3.18.1

Look forward to your reply

wen1112 commented 4 months ago

I had this poblem too, if you solved it already, could you tell me how to deal with it? Thank you.

Dongyq815 commented 4 months ago

The issue you're encountering is due to the compiler not supporting the -std=c++17 option, likely because your version of g++ is too old to support the C++17 standard. You may upgrade your g++ version to support C++17.