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

pthreads not found #497

Closed
csccva opened this issue May 23, 2024 · 6 comments
Closed

pthreads not found #497

csccva opened this issue May 23, 2024 · 6 comments
Assignees
Labels
documentation A request to change/fix/improve the documentation question A request for more information or clarification

Comments

@csccva
Copy link

csccva commented May 23, 2024

Hello,

I tried to compile the interfaces with the rocrand back end. I keep getting this error:

intel/oneapi/compiler/2024.0/bin/icpx  -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_87608.dir/CheckFunctionExists.cxx.o -o cmTC_87608  -lpthreads 
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lpthreads: No such file or directory

How can I fix this?

Apart from may I comment that the building instructions seems a little outdated. It was a little bit of a struggle to get to compile the interfaces on rocm architectures with the oneAPI + codeplay plugin.

Thank you in advance,

Cristian AChim

@csccva csccva added the question A request for more information or clarification label May 23, 2024
@aelizaro
Copy link
Contributor

Hello, @csccva, I see that you are trying to build Rocrand backend with Intel oneAPI compiler (icpx), but it works only with open source compiler oneAPI DPC++ Compiler or
AdaptiveCpp Compiler (formerly known as hipSYCL). Could you, please, try to take intel/llvm compiler with hip amd support and build with -DCMAKE_CXX_COMPILER=clang++ (or as alternative use AdaptiveCPP compiler)?

Thank you for pointing out on outdated rocm build info, we will check and update it.

@aelizaro aelizaro added the documentation A request to change/fix/improve the documentation label May 23, 2024
@csccva
Copy link
Author

csccva commented May 24, 2024

Hello, @csccva, I see that you are trying to build Rocrand backend with Intel oneAPI compiler (icpx), but it works only with open source compiler oneAPI DPC++ Compiler or AdaptiveCpp Compiler (formerly known as hipSYCL). Could you, please, try to take intel/llvm compiler with hip amd support and build with -DCMAKE_CXX_COMPILER=clang++ (or as alternative use AdaptiveCPP compiler)?

Thank you for pointing out on outdated rocm build info, we will check and update it.

Hello,

Thank you for your reply.

I just tried the same with the clang from the intel llvm project and get similar error (related to pthreads)

cmake .. -DCMAKE_CXX_COMPILER=/scratch/project_462000007/cristian/NEW/apps/sycl_workspace/llvm/build/bin/clang++  -DCMAKE_C_COMPILER=/scratch/project_462000007/cristian/NEW/apps/sycl_workspace/llvm/build/bin/clang -DENABLE_ROCRAND_BACKEND=True -DENABLE_MKLCPU_BACKEND=False -DENABLE_MKLGPU_BACKEND=False -DHIP_TARGETS=gfx90a
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/cmTC_6d7b1.dir/src.cxx.o: in function `main':
src.cxx:(.text+0x25): undefined reference to `pthread_create'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: src.cxx:(.text+0x2e): undefined reference to `pthread_detach'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: src.cxx:(.text+0x37): undefined reference to `pthread_cancel'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: src.cxx:(.text+0x44): undefined reference to `pthread_join'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

....

Building CXX object CMakeFiles/cmTC_371cc.dir/CheckFunctionExists.cxx.o
/scratch/project_462000007/cristian/NEW/apps/sycl_workspace/llvm/build/bin/clang++   -DCHECK_FUNCTION_EXISTS=pthread_create -MD -MT CMakeFiles/cmTC_371cc.dir/CheckFunctionExists.cxx.o -MF CMakeFiles/cmTC_371cc.dir/CheckFunctionExists.cxx.o.d -o CMakeFiles/cmTC_371cc.dir/CheckFunctionExists.cxx.o -c /scratch/project_462000007/cristian/NEW/oneMKL/build/CMakeFiles/CheckLibraryExists/CheckFunctionExists.cxx
Linking CXX executable cmTC_371cc
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_371cc.dir/link.txt --verbose=1
/scratch/project_462000007/cristian/NEW/apps/sycl_workspace/llvm/build/bin/clang++  -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_371cc.dir/CheckFunctionExists.cxx.o -o cmTC_371cc  -lpthreads 
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lpthreads: No such file or directory

@hjabird
Copy link
Contributor

hjabird commented May 27, 2024

Though it isn't strictly supported by oneMKL Interface Library, the oneAPI base toolkit with Codeplay's plugins for AMD seems to be able to build the rocRAND backend fine for me.

The CMake for rocRAND does import the threads package as find_package(Threads REQUIRED). To me it looks as if you're having the issue at configure time, not when actually trying to build oneMKL Interface library, and that this issue occurs in find_package(Threads REQUIRED). Is that right? In which case, this isn't an issue with the rocRAND backend. To confirm this, it might be worth using the --debug-output and --trace cmake flags. Its also worth noting that the linking error appears to come from /usr/x86_64-suse-linux/bin/ld, not part of the oneAPI base toolkit.

The stupid questions can be worth asking: is pthreads installed? Is it installed somewhere that the compiler would be looking for it? On Ubuntu I think it is at /lib/x86_64-linux-gnu/libpthread.so - I don't know about SUSE.

We're aware that the build documentation could do with improvement. There is an issue for it here. I've started rewriting some of the documentation, although it isn't ready for a PR yet.

@csccva
Copy link
Author

csccva commented Jun 5, 2024

Though it isn't strictly supported by oneMKL Interface Library, the oneAPI base toolkit with Codeplay's plugins for AMD seems to be able to build the rocRAND backend fine for me.

The CMake for rocRAND does import the threads package as find_package(Threads REQUIRED). To me it looks as if you're having the issue at configure time, not when actually trying to build oneMKL Interface library, and that this issue occurs in find_package(Threads REQUIRED). Is that right? In which case, this isn't an issue with the rocRAND backend. To confirm this, it might be worth using the --debug-output and --trace cmake flags. Its also worth noting that the linking error appears to come from /usr/x86_64-suse-linux/bin/ld, not part of the oneAPI base toolkit.

The stupid questions can be worth asking: is pthreads installed? Is it installed somewhere that the compiler would be looking for it? On Ubuntu I think it is at /lib/x86_64-linux-gnu/libpthread.so - I don't know about SUSE.

We're aware that the build documentation could do with improvement. There is an issue for it here. I've started rewriting some of the documentation, although it isn't ready for a PR yet.

Hello,

Thank you for your reply. And thank you for trying to improve the documentation. I am trying to compile it on a supercomputer and in general the system libraries are not suitable for hpc, so I have to figure out what modules are needed to be loaded

@Rbiessy
Copy link
Contributor

Rbiessy commented Jul 11, 2024

Hey @csccva, do you need more help with this issue?
We have updated the build documentation if that helps.

@Rbiessy Rbiessy self-assigned this Jul 11, 2024
@csccva
Copy link
Author

csccva commented Jul 11, 2024

Hello,

I thnk it i sok to close it. I will try again to compile it and test it and we will how it goes.

@csccva csccva closed this as completed Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation A request to change/fix/improve the documentation question A request for more information or clarification
Projects
None yet
Development

No branches or pull requests

4 participants