aws / studio-lab-examples

Example notebooks for working with SageMaker Studio Lab. Sign up for an account at the link below!
https://studiolab.sagemaker.aws
Apache License 2.0
609 stars 178 forks source link

cublas.h and cublas_v2.h are missing in /usr/local/cuda-11.2/include/ #224

Closed bobqianic closed 11 months ago

bobqianic commented 11 months ago

Describe the bug I opened a GPU machine and attempted to compile a C++ project. When I ran CMake, an error occurred.

-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Unable to find cublas_v2.h in either "/usr/local/cuda/include" or "/usr/math_libs/include"
-- Found CUDAToolkit: /usr/local/cuda/include (found version "11.2.152") 
-- cuBLAS found
-- The CUDA compiler identification is NVIDIA 11.2.152
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- GGML CUDA sources found, configuring CUDA architecture
-- Configuring done (2.5s)
CMake Error at CMakeLists.txt:358 (target_link_libraries):
  Target "test" links to:

    CUDA::cublas

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

To Reproduce Steps to reproduce the behavior:

  1. cmake any project using cublas
  2. See error

Expected behavior No error.

Screenshots

image

Desktop (please complete the following information):

icoxfog417 commented 11 months ago

Thank you for using Studio Lab! As error message CMakeLists.txt:358 suggests, could please refer the CMakeLists file? If you find out this error is caused by Studio Lab environment, please raise a new issue.

HyunggyuJang commented 9 months ago

I suspect that

Unable to find cublas_v2.h in either "/usr/local/cuda/include" or "/usr/math_libs/include"

is the source of error. I myself met this error also. @icoxfog417 can you open it? As this is on going issue.

icoxfog417 commented 9 months ago

@HyunggyuJang We sincerely appreciate your effort in reporting the issue. Could you kindly provide us with the reproducible steps? It would be immensely helpful for us to gain a better understanding of the specific libraries or tools you are attempting to install. We would like to suggest considering the use of conda for package installation, installing by manual will cause unexpected errors.

HyunggyuJang commented 9 months ago

Sure, since I’m out of office, I’ll rather write briefly, and will augment later if you find necessary.

Reproduction step

  1. Clone llama.cpp
  2. follows the instruction to build cublas supported version: https://github.com/ggerganov/llama.cpp#cublas
  3. Then will see an error, basically the same one as the issue content of this, originated from https://github.com/ggerganov/llama.cpp/blob/master/CMakeLists.txt#L316

Rather simple step to reproduce

CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python

will trigger the exact steps as I described in above reproduction step section.

icoxfog417 commented 9 months ago

Thank you. Did you install cmake and cuda-toolkit (11.4) before installing llama.cpp? (conda-forge version seems not include cuBLAS and cuda-toolkit includes it).

HyunggyuJang commented 9 months ago

I believe I tried. Let me check it again ASAP!

Edit: Still is an issue, yet rather different error message,

      -- Found CUDAToolkit: /home/studio-lab-user/.conda/envs/textgen/include (found version "11.4.48")
      -- cuBLAS found
      CMake Error at /tmp/pip-build-env-bkzhlka1/overlay/lib/python3.10/site-packages/cmake/data/share/cmake-3.27/Modules/CMakeDetermineCompilerId.cmake:753 (message):
        Compiling the CUDA compiler identification source file
        "CMakeCUDACompilerId.cu" failed.

        Compiler: /home/studio-lab-user/.conda/envs/textgen/bin/nvcc

        Build flags:

        Id flags: --keep;--keep-dir;tmp -v

        The output was:

        1

        gcc: fatal error: cannot execute 'cc1plus': execvp: No such file or
        directory

        compilation terminated.

        nvcc fatal : Failed to preprocess host compiler properties.

I'd better to experiment with it from clean state later. As I've tried on custom conda env where python version is 3.10. I'll try with default (studiolab) env.