Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cupy.cuda.compile_with_cache deprecated #25

Open
ricshaw opened this issue Jul 2, 2024 · 3 comments
Open

cupy.cuda.compile_with_cache deprecated #25

ricshaw opened this issue Jul 2, 2024 · 3 comments

Comments

@ricshaw
Copy link

ricshaw commented Jul 2, 2024

Hi, thanks for the great work. I am trying to run the demo code.
The function cupy.cuda.compile_with_cache() is deprecated in cupy. How do we update this?

@m43
Copy link

m43 commented Jul 30, 2024

Maybe you can try using the cupy version reported in the requirements.txt, worked fine for me:

cupy==12.2.0

@thanhdat77
Copy link

Hi @ricshaw,

I tried cupy-cuda11x==12.2.0, and it worked for me. It seems that the auto setup in CuPy may incorrectly detect your CUDA version.

If you have CUDA Toolkit 12 installed, try using:

cupy-cuda12x==12.2.0

@junbangliang
Copy link

junbangliang commented Sep 27, 2024

I replaced the function that caused the error and ran successfully on cupy==13.3.0 with cuda 12.5:

@cupy.memoize(for_each_device=True)
def cuda_launch(strKey:str):
    if 'CUDA_HOME' not in os.environ:
        os.environ['CUDA_HOME'] = cupy.cuda.get_cuda_path()
    # end

    return cupy.cuda.compile_with_cache(objCudacache[strKey]['strKernel'], tuple(['-I ' + os.environ['CUDA_HOME'], '-I ' + os.environ['CUDA_HOME'] + '/include'])).get_function(objCudacache[strKey]['strFunction'])
# end

replaced with:

@cupy.memoize(for_each_device=True)
def cuda_launch(strKey: str):
    if 'CUDA_HOME' not in os.environ:
        os.environ['CUDA_HOME'] = cupy.cuda.get_cuda_path()

    # Compile the kernel using cupy.RawModule instead of compile_with_cache
    kernel_code = objCudacache[strKey]['strKernel']
    module = cupy.RawModule(code=kernel_code, options=('-I', os.environ['CUDA_HOME'], '-I', os.environ['CUDA_HOME'] + '/include'))
    
    # Get the kernel function from the compiled module
    kernel_function = module.get_function(objCudacache[strKey]['strFunction'])

    return kernel_function
# end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants