Jittor / jittor

Jittor is a high-performance deep learning framework based on JIT compiling and meta-operators.
https://cg.cs.tsinghua.edu.cn/jittor/
Apache License 2.0
3.08k stars 311 forks source link

第一次运行编译错误:error: redefinition of ‘jittor::JK& jittor::operator<<(jittor::JK&, long long int)’ #196

Open Jittor opened 3 years ago

Jittor commented 3 years ago

错误输出如下:

root@aleader-Default-string:/home/aleader# python3.7 -m jittor.test.test_example[i 0408 17:01:48.610401 68 compiler.py:851] Jittor(1.2.2.58) src: /usr/local/lib/python3.7/site-packages/jittor
[i 0408 17:01:48.610805 68 compiler.py:852] g++ at /usr/bin/g++
[i 0408 17:01:48.611103 68 compiler.py:853] cache_path: /root/.cache/jittor/default/g++
[i 0408 17:01:49.289223 68 __init__.py:257] Found gdb(7.11.1) at /usr/bin/gdb.
[i 0408 17:01:49.353260 68 __init__.py:257] Found addr2line(2.26.1) at /usr/bin/addr2line.
[i 0408 17:01:49.496356 68 compiler.py:893] pybind_include: -I/usr/local/include/python3.7m -I/usr/local/lib/python3.7/site-packages/pybind11/include
[i 0408 17:01:49.519939 68 compiler.py:895] extension_suffix: .cpython-37m-i386-linux-gnu.so
[i 0408 17:01:49.520221 68 compiler.py:29] Create cache dir: /root/.cache/jittor/default/g++/jit
[i 0408 17:01:49.520437 68 compiler.py:29] Create cache dir: /root/.cache/jittor/default/g++/obj_files
[i 0408 17:01:49.520714 68 compiler.py:29] Create cache dir: /root/.cache/jittor/default/g++/gen
[i 0408 17:01:49.520918 68 compiler.py:29] Create cache dir: /root/.cache/jittor/default/g++/checkpoints
[i 0408 17:02:12.528754 68 __init__.py:169] Total mem: 7.43GB, using 2 procs for compiling.
In file included from /usr/local/lib/python3.7/site-packages/jittor/src/op.h:10:0,

                 from /usr/local/lib/python3.7/site-packages/jittor/src/ops/op_register.cc:7:

/usr/local/lib/python3.7/site-packages/jittor/src/jit_key.h: In function ‘jittor::JK& jittor::operator<<(jittor::JK&, long long int)’:

/usr/local/lib/python3.7/site-packages/jittor/src/jit_key.h:169:12: error: redefinition of ‘jittor::JK& jittor::operator<<(jittor::JK&, long long int)’

 inline JK& operator<<(JK& jk, long long c) {

            ^

/usr/local/lib/python3.7/site-packages/jittor/src/jit_key.h:161:12: note: ‘jittor::JK& jittor::operator<<(jittor::JK&, jittor::int64)’ previously defined here

 inline JK& operator<<(JK& jk, int64 c) {

            ^

In file included from /usr/local/lib/python3.7/site-packages/jittor/src/op.h:10:0,

                 from /usr/local/lib/python3.7/site-packages/jittor/src/ops/array_op.h:8,

                 from /usr/local/lib/python3.7/site-packages/jittor/src/pyjt/numpy.h:11,

                 from /usr/local/lib/python3.7/site-packages/jittor/src/pyjt/py_converter.h:12,

                 from /root/.cache/jittor/default/g++/gen/pyjt_hash.cc:2:

/usr/local/lib/python3.7/site-packages/jittor/src/jit_key.h: In function ‘jittor::JK& jittor::operator<<(jittor::JK&, long long int)’:

/usr/local/lib/python3.7/site-packages/jittor/src/jit_key.h:169:12: error: redefinition of ‘jittor::JK& jittor::operator<<(jittor::JK&, long long int)’

 inline JK& operator<<(JK& jk, long long c) {

            ^

/usr/local/lib/python3.7/site-packages/jittor/src/jit_key.h:161:12: note: ‘jittor::JK& jittor::operator<<(jittor::JK&, jittor::int64)’ previously defined here

 inline JK& operator<<(JK& jk, int64 c) {

            ^

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/lib/python3.7/site-packages/jittor_utils/__init__.py", line 146, in do_compile
    return cc.cache_compile(cmd, cache_path, jittor_path)
RuntimeError: [f 0408 17:02:13.019612 68 log.cc:319] Check failed: ret>=0 && ret<256  Run cmd failed: cd /root/.cache/jittor/default/g++ && /usr/bin/g++ /usr/local/lib/python3.7/site-packages/jittor/src/ops/op_register.cc   -Wall -Werror -Wno-unknown-pragmas -std=c++14 -fPIC -march=native  -fdiagnostics-color=always  -I/usr/local/lib/python3.7/site-packages/jittor/src -I/usr/local/include/python3.7m -I/usr/local/lib/python3.7/site-packages/pybind11/include -I/root/.cache/jittor/default/g++  -O2  -c  -o /root/.cache/jittor/default/g++/obj_files/op_register.cc.o 
return -1. This might be an overcommit issue or out of memory. Try : sudo sysctl vm.overcommit_memory=1
"""

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/local/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/local/lib/python3.7/site-packages/jittor/__init__.py", line 17, in <module>
    from . import compiler
  File "/usr/local/lib/python3.7/site-packages/jittor/compiler.py", line 1002, in <module>
    compile(cc_path, cc_flags+opt_flags, files, 'jittor_core'+extension_suffix)
  File "/usr/local/lib/python3.7/site-packages/jittor/compiler.py", line 90, in compile
    jit_utils.run_cmds(cmds, cache_path, jittor_path, "Compiling "+base_output)
  File "/usr/local/lib/python3.7/site-packages/jittor_utils/__init__.py", line 178, in run_cmds
    for i,_ in enumerate(p.imap_unordered(do_compile, cmds)):
  File "/usr/local/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
RuntimeError: [f 0408 17:02:13.019612 68 log.cc:319] Check failed: ret>=0 && ret<256  Run cmd failed: cd /root/.cache/jittor/default/g++ && /usr/bin/g++ /usr/local/lib/python3.7/site-packages/jittor/src/ops/op_register.cc   -Wall -Werror -Wno-unknown-pragmas -std=c++14 -fPIC -march=native  -fdiagnostics-color=always  -I/usr/local/lib/python3.7/site-packages/jittor/src -I/usr/local/include/python3.7m -I/usr/local/lib/python3.7/site-packages/pybind11/include -I/root/.cache/jittor/default/g++  -O2  -c  -o /root/.cache/jittor/default/g++/obj_files/op_register.cc.o 
return -1. This might be an overcommit issue or out of memory. Try : sudo sysctl vm.overcommit_memory=1
Jittor commented 3 years ago

可能的解决方案:

  1. 前往文件/usr/local/lib/python3.7/site-packages/jittor/src/jit_key.h,删除函数定义inline JK& operator<<(JK& jk, long long c)
  2. 更新最新版本 1.2.2.59+
  3. 运行命令 sudo sysctl vm.overcommit_memory=1