首页 > 解决方案 > 我正在尝试根据他们给定的指令运行“GrouPy”的代码,但它给了我错误。我正在使用 Python 3、Cuda 9 和 gcc6

问题描述

我已经执行了以下命令,就像在提供的 README 中询问的那样。主要代码是为 heaconv 给出的。当我尝试运行 GrouPy 的单个代码时也收到相同的错误。

python train_cifar.py --modelfn=experiments/CIFAR10/models/P4WideResNet.py --epoch 300 --save_freq=100 --gpu 0 --opt=MomentumSGD --lr_decay_factor=0.1 --lr_decay_schedule=50-100-150 --batchsize 125 --transformations='' --opt_kwargs="{'lr':0.05}" --datadir=/path/to/cifar10 --resultdir=/path/to/results

执行上述操作后,我收到以下错误:

{'datadir': '/workspace/hexaconv-master/experiments/CIFAR10/DataCifar', 'resultdir': '/workspace/hexaconv-master/experiments/CIFAR10/DataCifarResults', 'modelfn': '/workspace/hexaconv-master/experiments/CIFAR10/models/P4WideResNet.py', 'trainfn': 'train_all.npz', 'valfn': 'test.npz', 'epochs': 300, 'batchsize': 125, 'opt': 'MomentumSGD', 'opt_kwargs': {'lr': 0.05}, 'net_kwargs': {}, 'weight_decay': 0.001, 'lr_decay_schedule': '50-100-150', 'lr_decay_factor': 0.1, 'transformations': '', 'val_freq': 40, 'save_freq': 100, 'gpu': 0, 'seed': 0, 'hex_sampling': ''}
Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/cupy/cuda/compiler.py", line 241, in compile
    nvrtc.compileProgram(self.ptr, options)
  File "cupy/cuda/nvrtc.pyx", line 98, in cupy.cuda.nvrtc.compileProgram
  File "cupy/cuda/nvrtc.pyx", line 108, in cupy.cuda.nvrtc.compileProgram
  File "cupy/cuda/nvrtc.pyx", line 53, in cupy.cuda.nvrtc.check_status
cupy.cuda.nvrtc.NVRTCError: NVRTC_ERROR_COMPILATION (6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train_cifar.py", line 291, in <module>
    val_error, model = train(logme=vargs, **vargs)
  File "train_cifar.py", line 154, in train
    model, optimizer = get_model_and_optimizer(resultdir, modelfn, opt, opt_kwargs, net_kwargs, gpu)
  File "train_cifar.py", line 46, in get_model_and_optimizer
    module = imp.load_source(model_name, modelfn)
  File "/opt/conda/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/workspace/hexaconv-master/experiments/CIFAR10/models/P4WideResNet.py", line 8, in <module>
    from groupy.gconv.gconv_chainer.p4_conv import P4ConvZ2, P4ConvP4
  File "/workspace/hexaconv-master/groupy/gconv/gconv_chainer/p4_conv.py", line 1, in <module>
    from groupy.gconv.gconv_chainer.splitgconv2d import SplitGConv2D
  File "/workspace/hexaconv-master/groupy/gconv/gconv_chainer/splitgconv2d.py", line 10, in <module>
    from groupy.gconv.gconv_chainer.TransformFilter import TransformGFilter
  File "/workspace/hexaconv-master/groupy/gconv/gconv_chainer/TransformFilter.py", line 8, in <module>
    from groupy.gconv.gconv_chainer.kernels.integer_indexing_cuda_kernel import grad_index_group_func_kernel
  File "/workspace/hexaconv-master/groupy/gconv/gconv_chainer/kernels/integer_indexing_cuda_kernel.py", line 61, in <module>
    _index_group_func_kernel32 = compile_with_cache(_index_group_func_str.format('float')).get_function('indexing_kernel')
  File "cupy/core/carray.pxi", line 125, in cupy.core.core.compile_with_cache
  File "cupy/core/carray.pxi", line 146, in cupy.core.core.compile_with_cache
  File "/opt/conda/lib/python3.6/site-packages/cupy/cuda/compiler.py", line 164, in compile_with_cache
    ptx = compile_using_nvrtc(source, options, arch)
  File "/opt/conda/lib/python3.6/site-packages/cupy/cuda/compiler.py", line 82, in compile_using_nvrtc
    ptx = prog.compile(options)
  File "/opt/conda/lib/python3.6/site-packages/cupy/cuda/compiler.py", line 245, in compile
    raise CompileException(log, self.src, self.name, options)
cupy.cuda.compiler.CompileException: /tmp/tmp_vh4y1f6/kern.cu(14): error: a value of type "const ptrdiff_t *" cannot be used to initialize an entity of type "const int *"

/tmp/tmp_vh4y1f6/kern.cu(15): error: a value of type "const ptrdiff_t *" cannot be used to initialize an entity of type "const int *"

2 errors detected in the compilation of "/tmp/tmp_vh4y1f6/kern.cu".

标签: python-3.xgcccuba

解决方案


我认为这与https://github.com/tscohen/GrouPy/issues/13有关。请参阅底部的拉取请求。


推荐阅读