question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cupy.RawModule error: "AttributeError: 'NoneType' object has no attribute 'split'"

See original GitHub issue
  • Conditions (you can just paste the output of python -c 'import cupy; cupy.show_config()')
OS                           : Linux-5.9.10-1-MANJARO-x86_64-with-glibc2.10
CuPy Version                 : 8.1.0
NumPy Version                : 1.19.4
SciPy Version                : None
CUDA Root                    : /opt/cuda-10.1
CUDA Build Version           : 10010
CUDA Driver Version          : 11010
CUDA Runtime Version         : 10010
cuBLAS Version               : 10201
cuFFT Version                : 10101
cuRAND Version               : 10101
cuSOLVER Version             : (10, 2, 0)
cuSPARSE Version             : 10300
NVRTC Version                : (10, 1)
Thrust Version               : 100906
CUB Build Version            : 100800
cuDNN Build Version          : None
cuDNN Version                : None
NCCL Build Version           : 2708
NCCL Runtime Version         : 2708
cuTENSOR Version             : None
Device 0 Name                : GeForce GTX 1080 Ti
Device 0 Compute Capability  : 61
import cupy
N = 100
code = """
#include <thrust/count.h>

extern "C" __global__
void xyzw_frequency_thrust_device(int *count, char *text, int n)
{
  const char letters[] { 'x','y','z','w' };

  *count = thrust::count_if(thrust::device, text, text+n, [=](char c) {
    for (const auto x : letters) 
      if (c == x) return true;
    return false;
  });
}"""
kernel=cupy.RawModule(code=code,backend='nvcc')
code = kernel.get_function("xyzw_frequency_thrust_device")
  • Error messages, stack traces, or logs
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-32-9903428f9696> in <module>
     16 }"""
     17 kernel=cupy.RawModule(code=code,backend='nvcc')
---> 18 code = kernel.get_function("xyzw_frequency_thrust_device")

cupy/core/raw.pyx in cupy.core.raw.RawModule.get_function()

cupy/core/raw.pyx in cupy.core.raw.RawKernel.kernel.__get__()

cupy/core/raw.pyx in cupy.core.raw.RawKernel._kernel()

cupy/_util.pyx in cupy._util.memoize.decorator.ret()

cupy/core/raw.pyx in cupy.core.raw._get_raw_module()

cupy/core/core.pyx in cupy.core.core.compile_with_cache()

cupy/core/core.pyx in cupy.core.core.compile_with_cache()

/opt/miniconda3/lib/python3.8/site-packages/cupy/cuda/compiler.py in compile_with_cache(source, options, arch, cache_dir, extra_source, backend, enable_cooperative_groups, name_expressions, log_stream)
    333             name_expressions, log_stream, cache_in_memory)
    334     else:
--> 335         return _compile_with_cache_cuda(
    336             source, options, arch, cache_dir, extra_source, backend,
    337             enable_cooperative_groups, name_expressions, log_stream,

/opt/miniconda3/lib/python3.8/site-packages/cupy/cuda/compiler.py in _compile_with_cache_cuda(source, options, arch, cache_dir, extra_source, backend, enable_cooperative_groups, name_expressions, log_stream, cache_in_memory)
    365     if base is None:
    366         # This is checking of NVRTC compiler internal version
--> 367         base = _preprocess('', options, arch, backend)
    368         _empty_file_preprocess_cache[env] = base
    369 

/opt/miniconda3/lib/python3.8/site-packages/cupy/cuda/compiler.py in _preprocess(source, options, arch, backend)
    280     elif backend == 'nvcc':
    281         try:
--> 282             result = compile_using_nvcc(source, options, arch, 'preprocess.cu',
    283                                         code_type='ptx')
    284         except CompileException as e:

/opt/miniconda3/lib/python3.8/site-packages/cupy/cuda/compiler.py in compile_using_nvcc(source, options, arch, filename, code_type, separate_compilation, log_stream)
    194     _nvcc = get_nvcc_path()
    195     # split() is needed because _nvcc could come from the env var NVCC
--> 196     cmd = _nvcc.split()
    197     cmd.append(arch_str)
    198 

AttributeError: 'NoneType' object has no attribute 'split'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
lucasrodescommented, Nov 24, 2020

Hi @leofang, indeed the code from the first example is working, thanks a lot.

Your 2nd example is illegal code. Only kernels and device functions can be compiled and loaded by RawModule, not host functions.

Now I see what you mean. I am new to CUDA programming, so all these issues are new to me.

Once again, thanks for your time & help.

1reaction
leofangcommented, Nov 24, 2020

Glad it worked! Welcome to the GPU wonderland!

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'NoneType' object has no attribute 'split'
It can happen, that the string has nothing inside, than it is "None" type, so what I can suppose is to check first...
Read more >
CuPy Documentation
CuPy is a NumPy/SciPy-compatible array library for GPU-accelerated computing with Python. CuPy acts as a drop-in.
Read more >
cupy.RawKernel — CuPy 11.4.0 documentation
Any attribute not existing in the present CUDA toolkit version will have the value -1. Returns. A dictionary containing the kernel's attributes. Return...
Read more >
Cx_Freeze + Curses: 'Nonetype' Object Has No Attribute ' ...
RawModule error : AttributeError: 'NoneType' object has no attribute 'split' # RawModule I was trying to reproduce the example from #3728 comment. import ......
Read more >
attributeerror: 'int' object has no attribute 'count'
figure[i].x += dx AttributeError: 'int' object has no attribute 'x'. Not sure where I went wrong here! Help please! import pygame from copy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found