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

detect_half2_vars test/vectorAdd.cu error #3

Open
evanlu14 opened this issue Apr 18, 2019 · 6 comments
Open

detect_half2_vars test/vectorAdd.cu error #3

evanlu14 opened this issue Apr 18, 2019 · 6 comments

Comments

@evanlu14
Copy link
Contributor

I was following the instruction in the README. But got this error:

➜  cuda-half2 git:(master) ✗ ./detect_half2_vars -extra-arg="-nocudalib" test/vectorAdd.cu 
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "test/vectorAdd.cu"
No compilation database found in /home/zlu24/cuda-half2/test or any parent directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
error: unable to handle compilation, expected exactly one compiler job in ' "clang-tool" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-aux-triple" "nvptx64-nvidia-cuda" "-fsyntax-only" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "vectorAdd.cu" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64" "-dwarf-column-info" "-debugger-tuning=gdb" "-resource-dir" "/home/zlu24/cuda-half2/../lib/clang/4.0.0" "-internal-isystem" "/home/zlu24/cuda-half2/../lib/clang/4.0.0/include/cuda_wrappers" "-internal-isystem" "/usr/local/cuda/include" "-include" "__clang_cuda_runtime_wrapper.h" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward" "-internal-isystem" "/usr/include/clang/4.0.0/include/" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward" "-internal-isystem" "/usr/include/clang/4.0.0/include/" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/home/zlu24/cuda-half2/../lib/clang/4.0.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/home/zlu24/cuda-half2/../lib/clang/4.0.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir" "/home/zlu24/cuda-half2" "-ferror-limit" "19" "-fmessage-length" "178" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "cuda" "/home/zlu24/cuda-half2/test/vectorAdd.cu";  "clang-tool" "-cc1" "-triple" "nvptx64-nvidia-cuda" "-aux-triple" "x86_64-pc-linux-gnu" "-fsyntax-only" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "vectorAdd.cu" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-no-integrated-as" "-fuse-init-array" "-fcuda-is-device" "-target-cpu" "sm_20" "-dwarf-column-info" "-debugger-tuning=gdb" "-resource-dir" "/home/zlu24/cuda-half2/../lib/clang/4.0.0" "-internal-isystem" "/home/zlu24/cuda-half2/../lib/clang/4.0.0/include/cuda_wrappers" "-internal-isystem" "/usr/local/cuda/include" "-include" "__clang_cuda_runtime_wrapper.h" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward" "-internal-isystem" "/usr/include/clang/4.0.0/include/" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward" "-internal-isystem" "/usr/include/clang/4.0.0/include/" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/home/zlu24/cuda-half2/../lib/clang/4.0.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/home/zlu24/cuda-half2/../lib/clang/4.0.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fno-dwarf-directory-asm" "-fdebug-compilation-dir" "/home/zlu24/cuda-half2" "-ferror-limit" "19" "-fmessage-length" "178" "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexceptions" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "cuda" "/home/zlu24/cuda-half2/test/vectorAdd.cu"; '
Error while processing /home/zlu24/cuda-half2/test/vectorAdd.cu.

Any idea about this?

@minhhn2910
Copy link
Owner

Can you run clang-check test/vectorAdd.cu -ast-dump -- --cuda-device-only if this one can run and the ./detect_half2_vars doesn't run then it's the error of this repo.

@minhhn2910
Copy link
Owner

minhhn2910 commented Apr 20, 2019

Update: did you try to run : ./detect_vars.sh test/vectorAdd.cu instead of your command above ?

@evanlu14
Copy link
Contributor Author

It solved my problem! Thanks.

@evanlu14
Copy link
Contributor Author

evanlu14 commented May 2, 2019

Sorry my bad, still have problem.

Here is the error output:

➜  cuda-half2 git:(master) ✗ ../clang-llvm/local/bin/clang-check test/vectorAdd.cu -ast-dump -- --cuda-device-only > output
error: cannot find libdevice for sm_20. Provide path to different CUDA installation via --cuda-path, or pass -nocudalib to build without linking with libdevice.
In file included from <built-in>:1:
/home/zlu24/clang-llvm/local/bin/../lib/clang/4.0.0/include/__clang_cuda_runtime_wrapper.h:66:2: error: "Unsupported CUDA version!"
#error "Unsupported CUDA version!"
 ^
In file included from <built-in>:1:
In file included from /home/zlu24/clang-llvm/local/bin/../lib/clang/4.0.0/include/__clang_cuda_runtime_wrapper.h:93:
/usr/local/cuda/include/host_config.h:54:2: warning: "host_config.h is an internal header file and must not be used directly. This file will be removed in a future CUDA release.
      Please use cuda_runtime_api.h or cuda_runtime.h instead." [-W#warnings]
#warning "host_config.h is an internal header file and must not be used directly.  This file will be removed in a future CUDA release.  Please use cuda_runtime_api.h or c...
 ^
In file included from <built-in>:1:
In file included from /home/zlu24/clang-llvm/local/bin/../lib/clang/4.0.0/include/__clang_cuda_runtime_wrapper.h:94:
/usr/local/cuda/include/host_defines.h:54:2: warning: "host_defines.h is an internal header file and must not be used directly. This file will be removed in a future CUDA
      release. Please use cuda_runtime_api.h or cuda_runtime.h instead." [-W#warnings]
#warning "host_defines.h is an internal header file and must not be used directly.  This file will be removed in a future CUDA release.  Please use cuda_runtime_api.h or ...
 ^
In file included from <built-in>:1:
/home/zlu24/clang-llvm/local/bin/../lib/clang/4.0.0/include/__clang_cuda_runtime_wrapper.h:108:10: fatal error: 'crt/device_runtime.h' file not found
#include "crt/device_runtime.h"
         ^~~~~~~~~~~~~~~~~~~~~~
2 warnings and 2 errors generated.
Error while processing /home/zlu24/cuda-half2/test/vectorAdd.cu.
➜  cuda-half2 git:(master) ✗ 

Seems the reason is cuda version mismatch. I have installed cuda 9, cuda 10, default is cuda 10. What version of cuda do you use? Do I need to install an older version of cuda or pass some additional arguments?

@evanlu14
Copy link
Contributor Author

evanlu14 commented May 2, 2019

By the way, do you mind reopening this issue? Since the problem has not been solved and we can discuss in the issue.

@minhhn2910
Copy link
Owner

Hi, it is likely the cuda version issues as reported by clang in your error message.
I cannot remember which version I used, which was between 7.5 and 9.0 .
Quoted directly from this document : https://releases.llvm.org/4.0.1/docs/CompileCudaWithLLVM.html :
"You will need CUDA 7.0, 7.5, or 8.0 to compile with clang."
Therefore I think cuda version is the problem you are facing.
I will reopen this issue. However, currently I dont have the bandwidth for upgrading & fixing this repo. Hope other users may help you for the time being.

I do notice that the very recent versions of cuda (10.0 and 10.1) has some degree of automatic vectorization for simple programs in their compiler nvcc. They also supports half precision conversion on CPU code, maybe you can give it a try.

@minhhn2910 minhhn2910 reopened this May 8, 2019
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

2 participants