Skip to content

[BUG] import deepspeed, MissingCUDAException #5497

@zsaladin

Description

@zsaladin

Describe the bug

It seems that deepspeed doesn't use cuda installed in virtual environment.

To Reproduce
Steps to reproduce the behavior:

  1. Remove your nvcc installed globally.

  2. Create new virtual environment and activate it.

  3. Install deepspeed==0.14.2

  4. Write codes below and run it.

    source code

    import deepspeed

    error log

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/.venv/lib/python3.9/site-packages/deepspeed/__init__.py", line 25, in <module>
        from . import ops
      File "/.venv/lib/python3.9/site-packages/deepspeed/ops/__init__.py", line 15, in <module>
        from ..git_version_info import compatible_ops as __compatible_ops__
      File "/.venv/lib/python3.9/site-packages/deepspeed/git_version_info.py", line 29, in <module>
        op_compatible = builder.is_compatible()
      File "/.venv/lib/python3.9/site-packages/deepspeed/ops/op_builder/fp_quantizer.py", line 29, in is_compatible
        sys_cuda_major, _ = installed_cuda_version()
      File "/.venv/lib/python3.9/site-packages/deepspeed/ops/op_builder/builder.py", line 50, in installed_cuda_version
        raise MissingCUDAException("CUDA_HOME does not exist, unable to compile CUDA op(s)")
    deepspeed.ops.op_builder.builder.MissingCUDAException: CUDA_HOME does not exist, unable to compile CUDA op(s)
    

    But cuda is located in virtual environment.

    ls .venv/lib/python3.9/site-packages/nvidia | grep cuda
    
    cuda_cupti
    cuda_nvrtc
    cuda_runtime

Expected behavior

  1. It might be better if deepspeed uses cuda installed in virtual environment.

    Assume that cuda runtime is installed globally 11.6 and torch uses cuda runtime 12.1. In this case deepspeed and pytorch don't use same version of cuda. It can cause confusion.

    deepspeed requires cuda installed globally and torch install cuda in virtual environment. It increases docker image size.

  2. nvcc might be unnecessary to check cuda version. nvcc is a compiler. To minimize docker images I don't want to install nvcc. But deepspeed uses it to check cuda version. We can use torch and print torch.cuda.version without nvcc.

System info (please complete the following information):

  • OS: centos 7
  • GPU count and types single machine with x8 V100s each]
  • Python 3.9.17

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingbuildImprovements to the build and testing systems.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions