ROCm / HIPIFY

HIPIFY: Convert CUDA to Portable C++ Code
https://rocm.docs.amd.com/projects/HIPIFY/en/latest/
MIT License
503 stars 70 forks source link

[HIPIFY] link error to Clang-9 #219

Closed HWang-Summit closed 3 years ago

HWang-Summit commented 3 years ago

CMakeFiles/hipify-clang.dir/src/ArgParse.cpp.o: In function _GLOBAL__sub_I_ArgParse.cpp': ArgParse.cpp:(.text.startup+0xe8): undefined reference tovtable for llvm::cl::OptionValue' ArgParse.cpp:(.text.startup+0xf3): undefined reference to vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >' ArgParse.cpp:(.text.startup+0xfe): undefined reference tovtable for llvm::cl::parser' ArgParse.cpp:(.text.startup+0x224): undefined reference to vtable for llvm::cl::OptionValue<std::string>' ArgParse.cpp:(.text.startup+0x22f): undefined reference tovtable for llvm::cl::opt<std::string, false, llvm::cl::parser >' ArgParse.cpp:(.text.startup+0x23a): undefined reference to vtable for llvm::cl::parser<std::string>' ArgParse.cpp:(.text.startup+0x5b1): undefined reference tovtable for llvm::cl::OptionValue' ArgParse.cpp:(.text.startup+0x5bc): undefined reference to vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >' ArgParse.cpp:(.text.startup+0x5c7): undefined reference tovtable for llvm::cl::parser' ArgParse.cpp:(.text.startup+0x6d3): undefined reference to vtable for llvm::cl::OptionValue<std::string>' ArgParse.cpp:(.text.startup+0x6de): undefined reference tovtable for llvm::cl::opt<std::string, false, llvm::cl::parser >' ArgParse.cpp:(.text.startup+0x6e9): undefined reference to vtable for llvm::cl::parser<std::string>' ArgParse.cpp:(.text.startup+0x7f5): undefined reference tovtable for llvm::cl::OptionValue' ArgParse.cpp:(.text.startup+0x800): undefined reference to vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >' ArgParse.cpp:(.text.startup+0x80b): undefined reference tovtable for llvm::cl::parser' ArgParse.cpp:(.text.startup+0x917): undefined reference to vtable for llvm::cl::OptionValue<std::string>' ArgParse.cpp:(.text.startup+0x922): undefined reference tovtable for llvm::cl::opt<std::string, false, llvm::cl::parser >' ArgParse.cpp:(.text.startup+0x92d): undefined reference to vtable for llvm::cl::parser<std::string>' ArgParse.cpp:(.text.startup+0x1381): undefined reference tovtable for llvm::cl::OptionValue' ArgParse.cpp:(.text.startup+0x138c): undefined reference to vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >' ArgParse.cpp:(.text.startup+0x1397): undefined reference tovtable for llvm::cl::parser' ArgParse.cpp:(.text.startup+0x1707): undefined reference to vtable for llvm::cl::parser<std::string>' ArgParse.cpp:(.text.startup+0x185f): undefined reference tovtable for llvm::cl::parser' ArgParse.cpp:(.text.startup+0x1abb): undefined reference to vtable for llvm::cl::OptionValue<std::string>' ArgParse.cpp:(.text.startup+0x1ac6): undefined reference tovtable for llvm::cl::opt<std::string, false, llvm::cl::parser >' ArgParse.cpp:(.text.startup+0x1ad1): undefined reference to vtable for llvm::cl::parser<std::string>' CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o: In functionHipifyAction::cudaSharedIncompleteArrayVar(clang::ast_matchers::MatchFinder::MatchResult const&)': HipifyAction.cpp:(.text+0x2924): undefined reference to clang::QualType::getAsString() const' HipifyAction.cpp:(.text+0x2b4a): undefined reference toclang::DeclarationName::getAsString() const' CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o: In function HipifyAction::cudaDeviceFuncCall(clang::ast_matchers::MatchFinder::MatchResult const&)': HipifyAction.cpp:(.text+0x3181): undefined reference toclang::DeclarationName::getAsString() const' CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o: In function HipifyAction::cubNamespacePrefix(clang::ast_matchers::MatchFinder::MatchResult const&)': HipifyAction.cpp:(.text+0x32f3): undefined reference toclang::DeclarationName::getAsString() const' CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o: In function HipifyAction::cubUsingNamespaceDecl(clang::ast_matchers::MatchFinder::MatchResult const&)': HipifyAction.cpp:(.text+0x341c): undefined reference toclang::DeclarationName::getAsString() const' CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o: In function HipifyAction::cubFunctionTemplateDecl(clang::ast_matchers::MatchFinder::MatchResult const&)': HipifyAction.cpp:(.text+0x35c3): undefined reference toclang::DeclarationName::getAsString() const' CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o:HipifyAction.cpp:(.text+0x3765): more undefined references to clang::DeclarationName::getAsString() const' follow CMakeFiles/hipify-clang.dir/src/HipifyAction.cpp.o: In functionclang::ast_matchers::hasName(std::string const&)': HipifyAction.cpp:(.text._ZN5clang12ast_matchers7hasNameERKSs[_ZN5clang12ast_matchers7hasNameERKSs]+0x62): undefined reference to clang::ast_matchers::internal::HasNameMatcher::HasNameMatcher(std::vector<std::string, std::allocator<std::string> >)' CMakeFiles/hipify-clang.dir/src/LLVMCompat.cpp.o: In functionllcompat::getReplacements(clang::tooling::RefactoringTool&, llvm::StringRef)': LLVMCompat.cpp:(.text+0x20): undefined reference to clang::tooling::RefactoringTool::getReplacements()' CMakeFiles/hipify-clang.dir/src/main.cpp.o: In functionappendArgumentsAdjusters(clang::tooling::RefactoringTool&, std::string const&, char const)': main.cpp:(.text+0x1cd8): undefined reference to `clang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x1ce3): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x1d0c): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x1d17): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x1dd8): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x1de3): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x1e0c): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x1e17): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x1ea0): undefined reference tollvm::sys::fs::getMainExecutable(char const, void)' main.cpp:(.text+0x1f00): undefined reference to `clang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x1f0b): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x1f41): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x1f4c): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x1f82): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x1f8d): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x1fc3): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x1fce): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x2018): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x2023): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x2059): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x2064): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x209a): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x20a5): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x20db): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x20e6): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x2130): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x213b): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x21de): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x21e9): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x221d): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x2228): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x225e): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x2269): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x22a8): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x22b3): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x22e9): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x22f4): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x2377): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x2382): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x241c): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x2427): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x2474): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x247f): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x24b2): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x24bd): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x24f9): undefined reference toclang::tooling::getInsertArgumentAdjuster(char const, clang::tooling::ArgumentInsertPosition)' main.cpp:(.text+0x2504): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' main.cpp:(.text+0x252a): undefined reference toclang::tooling::getClangSyntaxOnlyAdjuster()' main.cpp:(.text+0x2535): undefined reference to clang::tooling::ClangTool::appendArgumentsAdjuster(std::function<std::vector<std::string, std::allocator<std::string> > (std::vector<std::string, std::allocator<std::string> > const&, llvm::StringRef)>)' CMakeFiles/hipify-clang.dir/src/main.cpp.o: In functionmain': main.cpp:(.text+0x2e1c): undefined reference to clang::tooling::CompilationDatabase::loadFromDirectory(llvm::StringRef, std::string&)' main.cpp:(.text+0x4a86): undefined reference toclang::tooling::RefactoringTool::RefactoringTool(clang::tooling::CompilationDatabase const&, llvm::ArrayRef, std::shared_ptr)' clang-9: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [hipify-clang] Error 1 make[1]: [CMakeFiles/hipify-clang.dir/all] Error 2 make: *** [all] Error 2

emankov commented 3 years ago

Could you please provide a command line for CMake? Clang is of 9.0.0 or 9.0.1 version? Was it built or installed from the package? What is the target OS?

HWang-Summit commented 3 years ago

Thank you for your reply! 1. On Centos 7, Clang is 9.0.1 version and CUDA si 10.1, the command line for llvm + clang as follows: cmake \ -DLLVM_ENABLE_PROJECTS=clang \ -DCMAKE_INSTALL_PREFIX=../dist \ -DLLVM_SOURCE_DIR=../llvm \ -DCMAKE_BUILD_TYPE=Release \ ../llvm

and for HIPIFY, the command line for CMake as follows: cmake \ -DHIPIFY_CLANG_TESTS=1 \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=../dist \ -DCMAKE_INSTALL_PREFIX=/home/summit/llvm-project/build/bin \ -DCMAKE_PREFIX_PATH=/home/summit/llvm-project/dist \ -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.1 \ -DLLVM_EXTERNAL_LIT=/home/summit/llvm-project/build/bin/llvm-lit \ ..

and when "make hipify-clang", The error (linker error) is as I described on Github.

Evgeny Mankov notifications@github.com 于2020年11月10日周二 下午5:39写道:

Could you please provide a command line for CMake? Clang is of 9.0.0 or 9.0.1 version? Was it built or installed from the package? What is the target OS?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ROCm-Developer-Tools/HIPIFY/issues/219#issuecomment-724585166, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKJ4BZRFQXF2T4DQ5BAWGU3SPEC4HANCNFSM4TPMBCUA .

emankov commented 3 years ago

-DLLVM_ENABLE_PROJECTS=clang shouldn't be used for building LLVM < 10 (in case of being used by hipify-clang). Please see https://github.com/ROCm-Developer-Tools/HIPIFY#-hipify-clang-testing, section LLVM 9.0.1 or older. I consider this is the root cause. I think that LLVM should be rebuilt from scratch.

To minimize the building time, please use -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" as only these targets are used by hipify-clang.

And, btw, in hipify-clang's cmake cmd. line the first -DCMAKE_INSTALL_PREFIX will be overwritten by the second one.

HWang-Summit commented 3 years ago

Thank you for your reply! According to your suggestion, I made changes to the relevant command line. However, it also failed. Details as follows:

1. In order to be exactly the same as the example in Github(the example of building hipify-clang with testing support on Ubuntu 20.04.1 at github), I changed my system environment to ubuntu 20.04;

2. The CUDA version is 11.0 and also make the LLVM + Clang 11.0, the CMame command line as follows:

cmake \ -DCMAKE_INSTALL_PREFIX=../dist \ -DLLVM_SOURCE_DIR=../llvm-project \ -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \ -DLLVM_ENABLE_PROJECTS="clang" \ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ -DCMAKE_BUILD_TYPE=Release \ ../llvm-project/llvm make -j install

3. Then, I have building hipify-clang with testing support on Ubuntu 20.04, the Cmake command line as follows:

cmake \ -DHIPIFY_CLANG_TESTS=1 \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=../dist \ -DCMAKE_PREFIX_PATH=/home/summit/llvm-project/dist \ -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.0 \ -DCUDA_DNN_ROOT_DIR=/usr/local/cuda-11.0 \ -DCUDA_CUB_ROOT_DIR=/home/summit/software/cub \ -DLLVM_EXTERNAL_LIT=/home/summit/llvm-project/build/bin/llvm-lit \ ..

At this point, the result shows is no problem. As follows:

4. while, when "make test-hipify ", It failed. The 66 test all failed, the output results are similar, as follows:

[100%] Running HIPIFY regression tests

CUDA 11.0 - will be used for testing LLVM 11.0.0 - will be used for testing x86_64 - Platform architecture Linux 5.4.0-52-generic - Platform OS 64 - hipify-clang binary bitness 64 - python 2.7.16 binary bitness

-- Testing: 66 tests, 8 workers -- FAIL: hipify :: unit_tests/headers/headers_test_02.cu (1 of 66) **** TEST 'hipify :: unit_tests/headers/headers_test_02.cu' FAILED **** Script:

: 'RUN: at line 1'; "/home/summit/HIPIFY/tests/run_test.sh" "/home/summit/HIPIFY/build/hipify-clang" "/home/summit/HIPIFY/tests/unit_tests/headers/headers_test_02.cu" "/home/summit/HIPIFY/build/unit_tests/headers/Output/headers_test_02.cu.tmp" "--cuda-path=/usr/local/cuda-11.0" -v -DTHRUST_IGNORE_CUB_VERSION_CHECK -isystem'/usr/local/cuda-11.0'/samples/common/inc -DLP64 -I'/usr/local/cuda-11.0'/include -I'/home/summit/software/cub'

Exit Code: 127

Command Output (stdout):

$ ":" "RUN: at line 1" $ "/home/summit/HIPIFY/tests/run_test.sh" "/home/summit/HIPIFY/build/hipify-clang" "/home/summit/HIPIFY/tests/unit_tests/headers/headers_test_02.cu" "/home/summit/HIPIFY/build/unit_tests/headers/Output/headers_test_02.cu.tmp" "--cuda-path=/usr/local/cuda-11.0" "-v" "-DTHRUST_IGNORE_CUB_VERSION_CHECK" "-isystem/usr/local/cuda-11.0/samples/common/inc" "-DLP64" "-I/usr/local/cuda-11.0/include" "-I/home/summit/software/cub"

command stderr:

clang version 11.0.0 Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/summit/HIPIFY/build Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Candidate multilib: x32;@mx32 Selected multilib: .;@m64 Found CUDA installation: /usr/local/cuda-11.0, version 11.0 warning: Unknown CUDA version 11.0. Assuming the latest supported version 10.1 [-Wunknown-cuda-version] clang Invocation: "/home/summit/HIPIFY/build/clang-tool" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-target-sdk-version=11.0" "-aux-triple" "nvptx64-nvidia-cuda" "-fsyntax-only" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "headers_test_02.cu-c61974.hip" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-fno-split-dwarf-inlining" "-debugger-tuning=gdb" "-v" "-resource-dir" "/home/summit/llvm-project/dist/lib/clang/11.0.0" "-internal-isystem" "/home/summit/llvm-project/dist/lib/clang/11.0.0/include/cuda_wrappers" "-internal-isystem" "/usr/local/cuda-11.0/include" "-include" "clang_cuda_runtime_wrapper.h" "-isystem" "/usr/local/cuda-11.0/samples/common/inc" "-I" "/home/summit/HIPIFY/tests/unit_tests/headers" "-D" "THRUST_IGNORE_CUB_VERSION_CHECK" "-D" "LP64__" "-I" "/usr/local/cuda-11.0/include" "-I" "/home/summit/software/cub" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/home/summit/llvm-project/dist/lib/clang/11.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/summit/llvm-project/dist/lib/clang/11.0.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-Wno-pragma-once-outside-header" "-std=c++11" "-fdeprecated-macro" "-fdebug-compilation-dir" "/home/summit/HIPIFY/build/unit_tests/headers" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-internal-isystem" "/home/summit/HIPIFY/build/include/cuda_wrappers" "-internal-isystem" "/home/summit/HIPIFY/build/include" "-faddrsig" "-x" "cuda" "/tmp/headers_test_02.cu-c61974.hip"

clang -cc1 version 11.0.0 based upon LLVM 11.0.0 default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/include" ignoring nonexistent directory "/include" ignoring nonexistent directory "/home/summit/HIPIFY/build/include/cuda_wrappers" ignoring nonexistent directory "/home/summit/HIPIFY/build/include" ignoring duplicate directory "/usr/local/cuda-11.0/include" as it is a non-system directory that duplicates a system directory ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9" ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9" ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9" ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9" ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward" ignoring duplicate directory "/usr/local/include" ignoring duplicate directory "/home/summit/llvm-project/dist/lib/clang/11.0.0/include" ignoring duplicate directory "/usr/include/x86_64-linux-gnu" ignoring duplicate directory "/usr/include"

include "..." search starts here:

include <...> search starts here:

/home/summit/HIPIFY/tests/unit_tests/headers /home/summit/software/cub /usr/local/cuda-11.0/samples/common/inc /home/summit/llvm-project/dist/lib/clang/11.0.0/include/cuda_wrappers /usr/local/cuda-11.0/include /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9 /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9 /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward /usr/local/include /home/summit/llvm-project/dist/lib/clang/11.0.0/include /usr/include/x86_64-linux-gnu /usr/include End of search list. /home/summit/HIPIFY/tests/run_test.sh: line 30: FileCheck: command not found sed: couldn't flush stdout: Broken pipe

error: command failed with exit status: 127

--

Evgeny Mankov notifications@github.com 于2020年11月11日周三 上午12:55写道:

-DLLVM_ENABLE_PROJECTS=clang shouldn't be used for building LLVM < 10 (in case of being used by hipify-clang). Please see https://github.com/ROCm-Developer-Tools/HIPIFY#-hipify-clang-testing, section LLVM 9.0.1 or older. I consider this is the root cause. I think that LLVM should be rebuilt from scratch.

To minimize the building time, please use -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" as only these targets are used by hipify-clang.

And, btw, in hipify-clang's cmake cmd. line the first -DCMAKE_INSTALL_PREFIX will be overwritten by the second one.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ROCm-Developer-Tools/HIPIFY/issues/219#issuecomment-724830643, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKJ4BZRU3CBSAUIPPPTEYL3SPFV73ANCNFSM4TPMBCUA .

emankov commented 3 years ago

Well, it is yet another story. You successfully built hipify-clang by GCC 9.3, but against clang 11. I believe with clang 9 all would also be successful with a correct cmake command line for building LLVM.

As for your new issue with FileCheck according to the README.md you should do one of the following:

Btw, for using hipify-clang with CUDA > 11.0, the patch for clang 11.0.0 should be applied to LLVM, and then LLVM should be rebuilt (not necessarily from scratch).

HWang-Summit commented 3 years ago

well, in fact, the file of "FileCheck" was found in step 3 , "-- Found FileCheck: /home/summit/HIPIFY/dist/bin/FileCheck", while when "make test-hipify", it report " FileCheck: command not found", this confused me.

Evgeny Mankov notifications@github.com 于2020年11月11日周三 下午6:57写道:

Well, it is yet another story. You successfully built hipify-clang by GCC 9.3, but against clang 11. I believe with clang 9 all would also be successful with a correct cmake command line for building LLVM.

As for your new issue with FileCheck according to the README.md https://github.com/ROCm-Developer-Tools/HIPIFY#-hipify-clang-testing you should do one of the following:

  • Linux: copy from /usr/llvm/11.0.0/build/bin/ to CMAKE_INSTALL_PREFIX/dist/bin
  • Or specify the path to FileCheck in CMAKE_INSTALL_PREFIX option

Btw, for using hipify-clang with CUDA > 11.0, the patch for clang 11.0.0 https://github.com/ROCm-Developer-Tools/HIPIFY/blob/master/patches/patch_for_clang_11.0.0_bug_47332.zip should be applied to LLVM, and then LLVM should be rebuilt (not necessarily from scratch).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ROCm-Developer-Tools/HIPIFY/issues/219#issuecomment-725355389, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKJ4BZTB3JYTE22NFGP67ZDSPJUZTANCNFSM4TPMBCUA .

emankov commented 3 years ago

Nonetheless, the fact is that "FileCheck: command not found". Please, check your FileCheck existence.

HWang-Summit commented 3 years ago

Thank you! It is true that the path of FileCheck is wrong. After I corrected it, I got the correct test result like the README. But for my project application, I need your help in three aspects:

  1. How to deal with the header files in the project during conversion, whether to add a path, can you give an example.
  2. I used the texture memory of NVIDIA in my project, and the thrust of CUDA, whether these two cases do not support conversion.
  3. Can the entire folder be converted as a whole? (The file in the folder includes C++ code and CUDA code).

Evgeny Mankov notifications@github.com 于2020年11月11日周三 下午11:48写道:

Nonetheless, the fact is that "FileCheck: command not found". Please, check your FileCheck existence.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ROCm-Developer-Tools/HIPIFY/issues/219#issuecomment-725498878, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKJ4BZT7YP5ABKNYDACBLSDSPKW3BANCNFSM4TPMBCUA .

emankov commented 3 years ago

If the issue is resolved, let's close it.

  1. To take into account header files set -I option to the containing folder.
  2. Which kind of conversions are not supported by HIP/hipify-clang? Please, file a different issue.
  3. Yes, it can be converted at once. Use hipconvertinplace-perl.sh script for that purpose.