运行JNeRF的demo时,报错error: no instance of overloaded function "atomicCAS" matches the argument list argument types are: (unsigned short *, unsigned short, unsigned short)

如果您使用 Jittor 时遇到了安装问题、运行错误、输出错误等问题,您可以在 “问答” 区提问。
为了更好地定位您的问题,建议包含以下内容:

  1. 错误信息、
    ubuntu20.04,gpu:1080ti,cuda11.1,g++9.4.0,jittor 1.3.8.5
    jittor的安装验证没问题,在执行jNeRF时出现问题
  1. Jittor 运行的完整 log(建议复制粘贴运行输出,如果可能请不要使用截图)、
    (base) lan@lan:~/JNeRF$ python tools/run_net.py --config-file ./projects/neus/configs/neus_wmask.py --type mesh --task train
    [i 0826 15:33:08.622981 08 compiler.py:956] Jittor(1.3.8.5) src: /home/lan/anaconda3/lib/python3.7/site-packages/jittor
    [i 0826 15:33:08.629539 08 compiler.py:957] g++ at /usr/bin/g++(9.4.0)
    [i 0826 15:33:08.629734 08 compiler.py:958] cache_path: /home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default
    [i 0826 15:33:08.702600 08 __init__.py:411] Found nvcc(11.1.105) at /usr/local/cuda-11.1/bin/nvcc.
    [i 0826 15:33:09.286934 08 __init__.py:411] Found gdb(20.04.1) at /usr/bin/gdb.
    [i 0826 15:33:09.374990 08 __init__.py:411] Found addr2line(2.34) at /usr/bin/addr2line.
    [i 0826 15:33:10.643899 08 compiler.py:1011] cuda key:cu11.1.105_sm_61
    [i 0826 15:33:11.486282 08 __init__.py:227] Total mem: 15.56GB, using 5 procs for compiling.
    [i 0826 15:33:12.581725 08 jit_compiler.cc:28] Load cc_path: /usr/bin/g++
    [i 0826 15:33:12.914337 08 init.cc:62] Found cuda archs: [61,]
    [w 0826 15:33:14.248257 08 compile_extern.py:203] CUDA related path found in LD_LIBRARY_PATH or PATH([‘/usr/local/cuda-11.1/lib64’, ‘/home/lan/anaconda3/bin’, ‘~/anaconda3/bin’, ‘/usr/local/cuda-11.1/bin’, ‘/home/lan/.local/bin’, ‘/usr/local/sbin’, ‘/usr/local/bin’, ‘/usr/sbin’, ‘/usr/bin’, ‘/sbin’, ‘/bin’, ‘/usr/games’, ‘/usr/local/games’, ‘/snap/bin’]), This path may cause jittor found the wrong libs, please unset LD_LIBRARY_PATH and remove cuda lib path in Path.
    Or you can let jittor install cuda for you: python3.x -m jittor_utils.install_cuda
    [i 0826 15:33:26.817279 08 __init__.py:6] JNeRF(0.1.3.0) at /home/lan/JNeRF/python/jnerf
    [i 0826 15:33:31.795117 08 cuda_flags.cc:49] CUDA enabled.
    Loading config from: ./projects/neus/configs/neus_wmask.py
    Load data: Begin
    Load data: End
    0%| | 0/100000 [00:00<?, ?it/s]/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(138): error: no instance of overloaded function “atomicCAS” matches the argument list
    argument types are: (unsigned short *, unsigned short, unsigned short)

/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(153): error: no instance of overloaded function “atomicCAS” matches the argument list
argument types are: (unsigned short *, unsigned short, unsigned short)

2 errors detected in the compilation of “/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61/jit/__opkey0_binary__Tx_float32__Ty_float32__Tz_float32__OP_multiply__JIT_1__JIT_cuda_1__graph___hash_516210b35f224f46_op.cc”.
/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(138): error: no instance of overloaded function “atomicCAS” matches the argument list
argument types are: (unsigned short *, unsigned short, unsigned short)

/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(153): error: no instance of overloaded function “atomicCAS” matches the argument list
argument types are: (unsigned short *, unsigned short, unsigned short)

2 errors detected in the compilation of “/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61/jit/__opkey0_array__T_float32__o_3f800000__opkey1_array__T_float32__o_0__opkey2_index__T_int32___hash_55b944a7a1a53585_op.cc”.
/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(138): error: no instance of overloaded function “atomicCAS” matches the argument list
argument types are: (unsigned short *, unsigned short, unsigned short)

/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(153): error: no instance of overloaded function “atomicCAS” matches the argument list
argument types are: (unsigned short *, unsigned short, unsigned short)

2 errors detected in the compilation of “/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61/jit/__opkey0_array__T_float32__opkey1_array__T_float32__opkey2_broadcast_to__Tx_float32__DIM_1___hash_e2fbda6034f2f677_op.cc”.
/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(138): error: no instance of overloaded function “atomicCAS” matches the argument list
argument types are: (unsigned short *, unsigned short, unsigned short)

/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(153): error: no instance of overloaded function “atomicCAS” matches the argument list
argument types are: (unsigned short *, unsigned short, unsigned short)

2 errors detected in the compilation of “/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61/jit/__opkey0_binary__Tx_float32__Ty_float32__Tz_float32__OP_add__JIT_1__JIT_cuda_1__graph_0100___hash_bb80ad89748cdfd5_op.cc”.
/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(138): error: no instance of overloaded function “atomicCAS” matches the argument list
argument types are: (unsigned short *, unsigned short, unsigned short)

/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src/misc/cuda_atomic.h(153): error: no instance of overloaded function “atomicCAS” matches the argument list
argument types are: (unsigned short *, unsigned short, unsigned short)

2 errors detected in the compilation of “/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61/jit/__opkey0_array__T_float32__opkey1_array__T_float32__opkey2_broadcast_to__Tx_float32__DIM_2___hash_b281e7e21c9adf10_op.cc”.
Traceback (most recent call last):
File “tools/run_net.py”, line 75, in
main()
File “tools/run_net.py”, line 66, in main
runner.train()
File “/home/lan/JNeRF/python/jnerf/runner/neus_runner.py”, line 120, in train
self.optimizer.backward(loss)
File “/home/lan/anaconda3/lib/python3.7/site-packages/jittor/optim.py”, line 170, in backward
jt.sync(params_has_grad)
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.sync)).

Types of your inputs are:
self = module,
args = (list, ),

The function declarations are:
void sync(const vector<VarHolder*>& vh=vector<VarHolder*>(), bool device_sync=false, bool weak_sync=true)

Failed reason:[f 0826 15:33:42.540043 08 parallel_compiler.cc:331] Error happend during compilation:
[Error] source file location:/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61/jit/__opkey0_array__T_float32__o_3f800000__opkey1_array__T_float32__o_0__opkey2_index__T_int32___hash_55b944a7a1a53585_op.cc
Compile fused operator(3/18)failed:[Op(1311:0:1:1:i0:o1:s0,array->1312),Op(1319:0:1:1:i0:o1:s0,array->1320),Op(1309:0:1:1:i0:o1:s0,index->1310),Op(1327:0:1:1:i0:o1:s0,array->1328),Op(1315:0:1:1:i1:o1:s0,broadcast_to->1316),Op(1323:0:1:1:i1:o1:s0,broadcast_to->1324),Op(1330:0:1:1:i1:o1:s0,broadcast_to->1331),Op(1317:0:1:1:i2:o1:s0,binary.multiply->1318),Op(1325:0:1:1:i2:o1:s0,binary.add->1326),Op(1333:0:1:1:i2:o1:s0,binary.pow->1334),]

Reason: [f 0826 15:33:41.617048 60:C4 log.cc:608] Check failed ret(256) == 0(0) Run cmd failed: “/usr/local/cuda-11.1/bin/nvcc” “/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61/jit/__opkey0_array__T_float32__o_3f800000__opkey1_array__T_float32__o_0__opkey2_index__T_int32___hash_55b944a7a1a53585_op.cc” -std=c++14 -Xcompiler -fPIC -Xcompiler -march=native -Xcompiler -fdiagnostics-color=always -lstdc++ -ldl -shared -I"/home/lan/anaconda3/lib/python3.7/site-packages/jittor/src" -I/home/lan/anaconda3/include/python3.7m -I/home/lan/anaconda3/include/python3.7m -DHAS_CUDA -DIS_CUDA -I"/usr/local/cuda-11.1/include" -I"/home/lan/anaconda3/lib/python3.7/site-packages/jittor/extern/cuda/inc" -lcudart -L"/usr/local/cuda-11.1/lib64" -Xlinker -rpath=“/usr/local/cuda-11.1/lib64” -I"/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61" -L"/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61" -Xlinker -rpath=“/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61” -L"/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default" -Xlinker -rpath=“/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default” -l:“jit_utils_core.cpython-37m-x86_64-linux-gnu”.so -l:“jittor_core.cpython-37m-x86_64-linux-gnu”.so -x cu --cudart=shared -ccbin=“/usr/bin/g++” --use_fast_math -w -I"/home/lan/anaconda3/lib/python3.7/site-packages/jittor/extern/cuda/inc" -arch=compute_61 -code=sm_61 -o “/home/lan/.cache/jittor/jt1.3.8/g++9.4.0/py3.7.0/Linux-5.15.0-7xea/IntelRCoreTMi7x7c/default/cu11.1.105_sm_61/jit/__opkey0_array__T_float32__o_3f800000__opkey1_array__T_float32__o_0__opkey2_index__T_int32___hash_55b944a7a1a53585_op.so”

  1. 复现此问题的代码或者描述、
    https://github.com/Jittor/JNeRF/tree/master/projects/neus
    在这里执行 Train步骤中的 ```
    python tools/run_net.py --config-file ./projects/neus/configs/neus_wmask.py --type mesh --task train

> 4. 您认为正确结果应当如何、
正常训练

> 5. 其他必要信息
> 
> 这有一个 [参考模板](https://github.com/Jittor/jittor/issues/238)

我也遇到了这个问题. 可能是GPU不支持64位浮点数的原子操作(atomic那些
我把程序里面 jittor.float64 改成 jittor.float32 就行了. 我用的是jittor 3.6.5