xuhuisheng / rocm-build

build scripts for ROCm
Apache License 2.0
181 stars 35 forks source link

rocBLAS build problem on Navi14 #5

Closed sgodey closed 3 years ago

sgodey commented 3 years ago

My rocBLAS build is not able to find the "Threads" library on my Ubuntu 20.4. Kernel version 5..4.0-66-generic. Any suggestions? Below is the transcript.

sgodey@sgodey-NPL:~/rocm-build$ bash navi14/22.rocblas.sh |====| |SLOW| |====| Reading package lists... Done Building dependency tree
Reading state information... Done gfortran is already the newest version (4:9.3.0-1ubuntu2). python3-venv is already the newest version (3.8.2-0ubuntu2). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~/rocm-build/build/rocblas ~/rocm-build/build/rocblas HEAD is now at cc18d25f update tensile-tag for SWDEV-257443 (#1176) patching file library/src/blas_ex/rocblas_gemm_ext2.hpp HEAD is now at ab44bf46 fix GSU bug: PostGSU kernel refer to Nan data of C matrix even when beta is zero (#1217) patching file Tensile/Common.py patching file Tensile/TensileCreateLibrary.py CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): Could NOT find Threads (missing: Threads_FOUND) Call Stack (most recent call first): /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.16/Modules/FindThreads.cmake:220 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:34 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/sgodey/rocm-build/build/rocblas/CMakeFiles/CMakeOutput.log". See also "/home/sgodey/rocm-build/build/rocblas/CMakeFiles/CMakeError.log". sgodey@sgodey-NPL:~/rocm-build$

I have the below pthread libraries installed:

libopenblas-pthread-dev/focal-updates,now 0.3.8+ds-1ubuntu0.20.04.1 amd64 [installed] Optimized BLAS (linear algebra) library (dev, pthread)

libopenblas0-pthread/focal-updates,now 0.3.8+ds-1ubuntu0.20.04.1 amd64 [installed,automatic] Optimized BLAS (linear algebra) library (shared lib, pthread)

libopenblas64-0-pthread/focal-updates,now 0.3.8+ds-1ubuntu0.20.04.1 amd64 [installed] Optimized BLAS (linear algebra) library (shared lib, 64bit, pthread)

libopenblas64-pthread-dev/focal-updates,now 0.3.8+ds-1ubuntu0.20.04.1 amd64 [installed] Optimized BLAS (linear algebra) library (dev, 64bit, pthread)

xuhuisheng commented 3 years ago

I re-create my ubuntu-20.04 docker. And find out after install libnuma-dev, there is threads.h in the /usr/include.

work@22112c8b0ecc:/usr/include$ sudo apt install -y libnuma-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libc-dev-bin libc6-dev libcrypt-dev libnuma1 linux-libc-dev manpages manpages-dev
Suggested packages:
  glibc-doc man-browser
The following NEW packages will be installed:
  libc-dev-bin libc6-dev libcrypt-dev libnuma-dev libnuma1 linux-libc-dev manpages manpages-dev
0 upgraded, 8 newly installed, 0 to remove and 1 not upgraded.
Need to get 7468 kB of archives.
work@22112c8b0ecc:/usr/include$ ll /usr/include/threads.h
-rw-r--r-- 1 root root 6661 Dec 16 19:04 /usr/include/threads.h

Further, sudo apt install libc6-dev could install /usr/includes/threads.h, you can try.

sgodey commented 3 years ago

I had both those libraries installed. and I also have /use/include/threads.h already installed. It is still failing.

sgodey@sgodey-NPL:~/rocm-build$ sudo apt install -y libnuma-dev Reading package lists... Done Building dependency tree
Reading state information... Done libnuma-dev is already the newest version (2.0.12-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. sgodey@sgodey-NPL:~/rocm-build$ sudo apt install libc6-dev Reading package lists... Done Building dependency tree
Reading state information... Done libc6-dev is already the newest version (2.31-0ubuntu9.2). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. sgodey@sgodey-NPL:~/rocm-build$ ls /usr/include/thread thread_db.h threads.h
sgodey@sgodey-NPL:~/rocm-build$ ls /usr/include/threads.h /usr/include/threads.h sgodey@sgodey-NPL:~/rocm-build$ source env.sh sgodey@sgodey-NPL:~/rocm-build$ bash navi14/ 22.rocblas.sh README.md tensile.patch
25.rocsparse.sh README_zh_CN.md
sgodey@sgodey-NPL:~/rocm-build$ bash navi14/22.rocblas.sh |====| |SLOW| |====| Reading package lists... Done Building dependency tree
Reading state information... Done gfortran is already the newest version (4:9.3.0-1ubuntu2). python3-venv is already the newest version (3.8.2-0ubuntu2). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~/rocm-build/build/rocblas ~/rocm-build/build/rocblas HEAD is now at cc18d25f update tensile-tag for SWDEV-257443 (#1176) patching file library/src/blas_ex/rocblas_gemm_ext2.hpp HEAD is now at ab44bf46 fix GSU bug: PostGSU kernel refer to Nan data of C matrix even when beta is zero (#1217) patching file Tensile/Common.py patching file Tensile/TensileCreateLibrary.py CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): Could NOT find Threads (missing: Threads_FOUND) Call Stack (most recent call first): /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.16/Modules/FindThreads.cmake:220 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:34 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/sgodey/rocm-build/build/rocblas/CMakeFiles/CMakeOutput.log". See also "/home/sgodey/rocm-build/build/rocblas/CMakeFiles/CMakeError.log". sgodey@sgodey-NPL:~/rocm-build$ echo $PATH /opt/rocm/bin:/opt/rocm/llvm/bin:/opt/rocm/hip/bin:/usr/include:/opt/rocm/bin:/opt/rocm/llvm/bin:/opt/rocm/hip/bin:/usr/include:/home/sgodey/.local/bin:/home/sgodey/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin sgodey@sgodey-NPL:~/rocm-build$

sgodey commented 3 years ago

Please ignore the strike-through in the above transcript. ~ is being interpreted as start and end of strike-through.

xuhuisheng commented 3 years ago

/usr/include/pthread.h is also included by libc6-dev. I re-create a new ubuntu-20.04 docker, and cannot reproduce you problem.

You can check the /home/sgodey/rocm-build/build/rocblas/CMakeFiles/CMakeOutput.log and /home/sgodey/rocm-build/build/rocblas/CMakeFiles/CMakeError.log, to see if there is any compiling problems.

CMake just create a small test code, and try to comile/link it, if no error happened, it will think that pthread.h is ok.

#include <pthread.h>

void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}

gcc -lpthread test.c should not throw errors.

sgodey commented 3 years ago

Looks like I don't have

-DHIP_CLANG_INCLUDE_PATH= $ROCM_INSTALL_DIR/llvm/include \

Cmake Error:

CMake Error: The source directory "/opt/rocm/llvm/include" does not exist.

Any thoughts?

Also I was not able to install rocm-dev as recommended by https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html#getting-the-rocm-source-code

sgodey@sgodey-NPL:~$ sudo apt install rocm-dev Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package rocm-dev sgodey@sgodey-NPL:~$

Did the name change? I could not find anything close in 'apt search'.

xuhuisheng commented 3 years ago

Please follow official installation guide: https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html#ubuntu

I will add this part to navi14 README later.

xuhuisheng commented 3 years ago

It's 31st May. I will close this issue. If you still have problems, please re-open it.