Closed balston closed 2 years ago
INSTALL NECESSARY LIBRARIES: sudo apt install make sudo apt install cmake sudo apt install clang sudo apt install libclang-6.0-dev sudo apt install opencl-headers sudo apt install llvm sudo apt install llvm-6.0-dev sudo apt install libltdl-dev sudo apt install libhwloc-dev sudo apt install pkg-config sudo apt install libboost-system1.62 sudo apt install libboost-system1.62-dev
POCL:
sudo mv Downloads/pocl-1.2 /usr/local/ cd /usr/local/pocl-1.2/ sudo mkdir build cd build/ sudo cmake .. sudo make && sudo make install
BOOST:
sudo mv Downloads/boost_1_64_0.tar.bz2 /usr/local/ cd /usr/local/ sudo tar --bzip2 -xf boost_1_64_0.tar.bz2 cd boost_1_64_0/ sudo ./bootstrap.sh sudo ./b2
VEXCL:
sudo mv ~/Downloads/vexcl-master /usr/local/ cd /usr/local/vexcl-master/ cmake . sudo cp -r vexcl/ ../include/ sudo cp -r CL/ ../include/
FIX BOOST BUG: In files /usr/local/boost_1_64_0/boost/numeric/ublas/storage.hpp /usr/local/boost_1_64_0/boost/numeric/ublas/matrix.hpp change the line
to
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NB: it is not enough to have a C compiler, pocl specifically requires LLVM/libclang to do OpenCL compilation.
Currently working on building dependency LLVM 8 -- complicated due to large build size (ran out of space in temporary storage ~6GB).
Have installed LLVM 8. Now POCL.
Hm. Trying to build POCL against the compiled and installed LLVM 8 gives an undefined symbol error:
$ make
[ 0%] Patching cl.hpp
[ 0%] Built target patched_cl_hpp
[ 0%] Built target sleef_config_ivybridge
[ 46%] Built target kernel_host_ivybridge
[ 46%] Built target kernellib_hash
[ 52%] Built target llvmpasses
[ 52%] Built target llvmopencl
[ 52%] Built target pocl-devices-pthread
[ 52%] Built target pocl_cache
[ 53%] Built target lib_cl_llvm
[ 79%] Built target libpocl_unlinked_objs
[ 80%] Built target pocl-devices-topology
[ 81%] Built target pocl-devices
[ 82%] Built target pocl-devices-basic
[ 82%] Built target OpenCL
[ 83%] Built target poclu
Linking C executable poclcc
../lib/CL/libOpenCL.so.2.3.0: undefined reference to `llvm::AnalysisManager<llvm::Function>::getResultImpl(llvm::AnalysisKey*, llvm::Function&)'
clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/poclcc] Error 1
make[1]: *** [bin/CMakeFiles/poclcc.dir/all] Error 2
make: *** [all] Error 2
Wiping and trying to build POCL against the binary distribution of LLVM 8.0.0 gives more, different undefined symbol errors (just a sample below, there are a lot of them):
`std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&)'
../lib/CL/libOpenCL.so.2.3.0: undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(unsigned long, unsigned long, char const*) const'
../lib/CL/libOpenCL.so.2.3.0: undefined reference to `std::__1::basic_streambuf<char, std::__1::char_traits<char> >::sync()'
../lib/CL/libOpenCL.so.2.3.0: undefined reference to `std::__1::basic_streambuf<char, std::__1::char_traits<char> >::basic_streambuf()'
../lib/CL/libOpenCL.so.2.3.0: undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
../lib/CL/libOpenCL.so.2.3.0: undefined reference to `llvm::sys::RemoveFileOnSignal(llvm::StringRef, std::string*)'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/poclcc] Error 1
make[1]: *** [bin/CMakeFiles/poclcc.dir/all] Error 2
make: *** [all] Error 2
Not sure what's up. :thinking:
There's some suggestion that the first problem might be something to do with GCC's symbol mangling. This may be resolvable by using GCC >5.1.0 to build LLVM, according to some documentation on what looks like the problem on the LLVM wiki.
Hello,
first thanks again for the effort you are making, this software is absolutely crucial to my project! I have no idea if the following can help, sorry but I am out of my depths here. It just rang the bell that the error you have is linked to non-defined symbols.
Cheers Gherardo
I encountered a symbol error when cmake POCL, the error message was
CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: C_LIBFILE_clangAST (.. and many other variables)
In my case I could remove this error by installing the same version of clang and llvm ( clang/llvm 6.0 in my case, it was 3.8 in my laptop mint installation) and cmake was then successful. Then I got other errors in make pocl and I got definitely stuck.
I'm just trying a bootstrap 2-stage build now, where you first build LLVM/clang with GCC, then build LLVM/clang with the LLVM/clang you just built. Hopefully that'll solve the problem and give us a better build of LLVM/clang too.
@gheraV I haven't had much luck trying to get POCL to link against a build of LLVM successfully on the cluster, but I have managed to build the binaries in an Ubuntu VM using a variation on the instructions you put at the top.
I could bundle them up with the libraries they need to work, and put them somewhere centrally on Myriad for now. Would that be suitable for your needs, even in the short term? I couldn't get a feel from the options.hpp
file whether altering those parameters was something you'd need to do regularly, when trying new things, or just once per platform.
@ikirker first, thank you very much for trying hard to install the code on the cluster. QSLsquasher is an analysis tool for numerical models of magnetic field. Unfortunately, the it needs to be recompiled for any change in the input data (typically, a different grid) or parameter (typically, higher precision in the analysis is required). Therefore, a preset binary will not be very useful.
I definitely need this software running, I just manged to have it installed on a recent Mint 19.1 installation (but again version 6.0 of llvm and clang) that works for very low resolutions (or 2D cases), which sort of patch up my immediate urgency. For the longer time I will have to try installing it on a more powerful machine than a desktop. Is there an alternative to grace that may result a bit less complicated installation procedure (eg with a pocl already installed even if on a earlier version of llvm than 8.0)?
Again, thanks for your attempts and your help
@gheraV All our clusters have the same software, as close as we can make it. And, from some more testing, the problem is the same with LLVM 6: there seems to be something we're missing that makes an installation of LLVM Pocl can link against. My current strategy is to look at how the Ubuntu package is built to try to work out what that is.
For numerical models of the solar atmosphere.
https://bitbucket.org/tassev/qsl_squasher/