CMake erorr building the library

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
edgarfblack
Posts: 4
Joined: Wed Jun 17, 2020 9:38 am

CMake erorr building the library

Post by edgarfblack » Wed Jun 17, 2020 11:49 am

Good morning,

I am trying to build magma-2.5.3 using cmake.
My system is an ubuntu type (linux mint). I am using cmake version 3.10.2

I am having a problem with pthread (which is installed on my system )
Here is the output from cmake and from the ~/magma-2.5.3/build/CMakeFiles/CMakeError.log file

Any ideas?

cmake output:

-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- The Fortran compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Performing Test COMPILER_SUPPORTS_C99
-- Performing Test COMPILER_SUPPORTS_C99 - Success
-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP_Fortran: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Found OpenMP
-- OpenMP_C_FLAGS -fopenmp
-- OpenMP_CXX_FLAGS -fopenmp
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "10.2")
-- Found CUDA 10.2
-- CUDA_INCLUDE_DIRS: /usr/local/cuda/include
-- CUDA_CUDART_LIBRARY: /usr/local/cuda/lib64/libcudart.so
-- compile for CUDA arch 3.0 (Kepler)
-- compile for CUDA arch 3.5 (Kepler)
-- compile for CUDA arch 5.0 (Maxwell)
-- compile for CUDA arch 6.0 (Pascal)
-- Define -DHAVE_CUBLAS -DMIN_CUDA_ARCH=300
-- Searching for BLAS and LAPACK. To override, set LAPACK_LIBRARIES using ccmake.
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- A library with BLAS API found.
-- Looking for Fortran cheev
-- Looking for Fortran cheev - not found
-- A library with LAPACK API not found. Please specify library location.
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- pkgconfig lib/pkgconfig/magma.pc
-- Flags
-- CMAKE_INSTALL_PREFIX: /usr/local/magma
-- CFLAGS: -std=c99 -fopenmp -Wall -Wno-unused-function
-- CXXFLAGS: -std=c++11 -fopenmp -Wall -Wno-unused-function
-- NVCCFLAGS: -Xcompiler;-fPIC;-DHAVE_CUBLAS;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_60,code=compute_60
-- FFLAGS: -Dmagma_devptr_t="integer(kind=8)"
-- LIBS: FALSE /usr/local/cuda/lib64/libcudart.so /usr/lib/x86_64-linux-gnu/libcublas.so CUDA_cublas_device_LIBRARY-NOTFOUND /usr/local/cuda/lib64/libcusparse.so
-- blas_fix: (MacOS Accelerate only)
-- LAPACK_LIBRARIES: FALSE
-- CUDA_CUDART_LIBRARY: /usr/local/cuda/lib64/libcudart.so
-- CUDA_CUBLAS_LIBRARIES: /usr/lib/x86_64-linux-gnu/libcublas.so;CUDA_cublas_device_LIBRARY-NOTFOUND
-- CUDA_cusparse_LIBRARY: /usr/local/cuda/lib64/libcusparse.so
-- Fortran modules: /home/efblack/Desktop/magma-2.5.3/build/magma_param.mod;/home/efblack/Desktop/magma-2.5.3/build/magma.mod;/home/efblack/Desktop/magma-2.5.3/build/magma_sfortran.mod;/home/efblack/Desktop/magma-2.5.3/build/magma_dfortran.mod;/home/efblack/Desktop/magma-2.5.3/build/magma_cfortran.mod;/home/efblack/Desktop/magma-2.5.3/build/magma_zfortran.mod;/home/efblack/Desktop/magma-2.5.3/build/magmablas_sfortran.mod;/home/efblack/Desktop/magma-2.5.3/build/magmablas_dfortran.mod;/home/efblack/Desktop/magma-2.5.3/build/magmablas_cfortran.mod;/home/efblack/Desktop/magma-2.5.3/build/magmablas_zfortran.mod
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:
CUDA_cublas_device_LIBRARY (ADVANCED)
linked by target "magma_sparse" in directory /home/efblack/Desktop/magma-2.5.3
linked by target "magma" in directory /home/efblack/Desktop/magma-2.5.3

-- Configuring incomplete, errors occurred!
See also "~/magma-2.5.3/build/CMakeFiles/CMakeOutput.log".
See also "~magma-2.5.3/build/CMakeFiles/CMakeError.log".


+++++++++++++++++++++++++++++++++++++++++++++++++
CMakeError.log output:

Determining if the pthread_create exist failed with the following output:
Change Dir: /home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_d121c/fast"
/usr/bin/make -f CMakeFiles/cmTC_d121c.dir/build.make CMakeFiles/cmTC_d121c.dir/build
make[1]: Entering directory '/home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_d121c.dir/CheckSymbolExists.c.o
/usr/bin/cc -fPIC -O3 -DNDEBUG -o CMakeFiles/cmTC_d121c.dir/CheckSymbolExists.c.o -c /home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_d121c
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d121c.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -O3 -DNDEBUG -rdynamic CMakeFiles/cmTC_d121c.dir/CheckSymbolExists.c.o -o cmTC_d121c
CMakeFiles/cmTC_d121c.dir/CheckSymbolExists.c.o: In function `main':
CheckSymbolExists.c:(.text.startup+0x3): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_d121c.dir/build.make:97: recipe for target 'cmTC_d121c' failed
make[1]: *** [cmTC_d121c] Error 1
make[1]: Leaving directory '/home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_d121c/fast' failed
make: *** [cmTC_d121c/fast] Error 2

File /home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_0aae7/fast"
/usr/bin/make -f CMakeFiles/cmTC_0aae7.dir/build.make CMakeFiles/cmTC_0aae7.dir/build
make[1]: Entering directory '/home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_0aae7.dir/CheckFunctionExists.c.o
/usr/bin/cc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -O3 -DNDEBUG -o CMakeFiles/cmTC_0aae7.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_0aae7
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0aae7.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -O3 -DNDEBUG -rdynamic CMakeFiles/cmTC_0aae7.dir/CheckFunctionExists.c.o -o cmTC_0aae7 -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_0aae7.dir/build.make:97: recipe for target 'cmTC_0aae7' failed
make[1]: *** [cmTC_0aae7] Error 1
make[1]: Leaving directory '/home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_0aae7/fast' failed
make: *** [cmTC_0aae7/fast] Error 2


Determining if the Fortran cheev exists failed with the following output:
Change Dir: /home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_42f1a/fast"
/usr/bin/make -f CMakeFiles/cmTC_42f1a.dir/build.make CMakeFiles/cmTC_42f1a.dir/build
make[1]: Entering directory '/home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp'
Building Fortran object CMakeFiles/cmTC_42f1a.dir/testFortranCompiler.f.o
/usr/bin/gfortran -O3 -DNDEBUG -O3 -c /home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTC_42f1a.dir/testFortranCompiler.f.o
Linking Fortran executable cmTC_42f1a
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_42f1a.dir/link.txt --verbose=1
/usr/bin/gfortran -O3 -DNDEBUG -O3 CMakeFiles/cmTC_42f1a.dir/testFortranCompiler.f.o -o cmTC_42f1a /usr/lib/x86_64-linux-gnu/libblas.so -lpthread -lm
CMakeFiles/cmTC_42f1a.dir/testFortranCompiler.f.o: In function `main':
testFortranCompiler.f:(.text.startup+0x1d): undefined reference to `cheev_'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_42f1a.dir/build.make:98: recipe for target 'cmTC_42f1a' failed
make[1]: *** [cmTC_42f1a] Error 1
make[1]: Leaving directory '/home/efblack/Desktop/magma-2.5.3/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_42f1a/fast' failed
make: *** [cmTC_42f1a/fast] Error 2

qhaas
Posts: 2
Joined: Wed Apr 15, 2020 1:26 pm

Re: CMake erorr building the library

Post by qhaas » Mon Jul 13, 2020 2:50 pm

I'm seeing the same error about pthread not being found (which is installed on my system too) in CentOS8 x86-64, CUDA 11, cmake 3.11 (stock), gcc 8.3 (stock).

Update: Like my previous issue, this was resolved by upgrading cmake to 3.14 (or above)

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: CMake erorr building the library

Post by mgates3 » Tue Jul 14, 2020 12:15 pm

Note that CUDA 11 deleted (not just deprecated) a number of functions, at least in cuSparse, breaking MAGMA sparse.

Mark

Post Reply