pghysels / STRUMPACK

Structured Matrix Package (LBNL)
http://portal.nersc.gov/project/sparse/strumpack/
Other
167 stars 41 forks source link

compile strumpack with mkl lapack and blas error #122

Open omgoooood opened 3 months ago

omgoooood commented 3 months ago

cmake ../ \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_COMPILER=g++-17 \ -DCMAKE_C_COMPILER=gcc-17 \ -DCMAKE_Fortran_COMPILER=gfortran-17 \ -DCMAKE_INSTALL_PREFIX=../install \ -DSTRUMPACK_USE_MPI=OFF \ -DSTRUMPACK_USE_OPENMP=ON \ -DTPL_ENABLE_ZFP=ON \ -DSTRUMPACK_USE_CUDA=OFF\ -DSTRUMPACK_USE_HIP=ON\ -DHIP_HIPCC_FLAGS=--amdgpu-target=fgx906\ -DSTRUMPACK_COUNT_FLOPS=ON \ -DTPL_BLAS_LIBRARIES= “${F95ROOT}/lib/libmkl_blas95_lp64.a;${MKLROOT}/lib/libmkl_gf_lp64.a;${MKLROOT}/lib/libmkl_gnu_thread.a;${MKLROOT}/lib/libmkl_core.a;gomp;pthread;m;dl” \ -DTPL_LAPACK_LIBRARIES=${F95ROOT}/lib/libmkl_lapack95_lp64.a;${MKLROOT}/lib/libmkl_gf_lp64.a;${MKLROOT}/lib/libmkl_gnu_thread.a;${MKLROOT}/lib/libmkl_core.a;gomp;pthread;m;dl" We use cmake config like this. The link line was got from intel Advisor like the pic show, but we got a error when compile strumpack like another pic. Could you help me to fix this error? Thanks very much. 1721293768614 image

pghysels commented 3 months ago

You can try to get CMake to find MKL as follows: cmake ../ \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_COMPILER=g++-17 \ -DCMAKE_C_COMPILER=gcc-17 \ -DCMAKE_Fortran_COMPILER=gfortran-17 \ -DCMAKE_INSTALL_PREFIX=../install \ -DSTRUMPACK_USE_MPI=OFF \ -DSTRUMPACK_USE_OPENMP=ON \ -DTPL_ENABLE_ZFP=ON \ -DSTRUMPACK_USE_CUDA=OFF\ -DSTRUMPACK_USE_HIP=ON\ -DHIP_HIPCC_FLAGS=--amdgpu-target=fgx906\ -DSTRUMPACK_COUNT_FLOPS=ON \ -DBLA_VENDOR=Intel10_64lp

Make sure to run the MKL environment script:

. /opt/intel/bin/compilervars.sh intel64

See here: https://cmake.org/cmake/help/latest/module/FindBLAS.html#intel-mkl

On my machine, it looks like mkl_lapack_slaeh2 in defined in either libmkl_gnu_thread.a, libmkl_intel_thread.a, libmkl_sequential.a, or libmkl_tbb_thread.a. You can check what symbols are in a library with the nm command. But I see you are already linking with libmkl_gnu_thread.a, so I'm not sure why that doesn't add those functions.

omgoooood commented 3 months ago

thanks.

You can try to get CMake to find MKL as follows: cmake ../ \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_COMPILER=g++-17 \ -DCMAKE_C_COMPILER=gcc-17 \ -DCMAKE_Fortran_COMPILER=gfortran-17 \ -DCMAKE_INSTALL_PREFIX=../install \ -DSTRUMPACK_USE_MPI=OFF \ -DSTRUMPACK_USE_OPENMP=ON \ -DTPL_ENABLE_ZFP=ON \ -DSTRUMPACK_USE_CUDA=OFF\ -DSTRUMPACK_USE_HIP=ON\ -DHIP_HIPCC_FLAGS=--amdgpu-target=fgx906\ -DSTRUMPACK_COUNT_FLOPS=ON \ -DBLA_VENDOR=Intel10_64lp

Make sure to run the MKL environment script:

. /opt/intel/bin/compilervars.sh intel64

See here: https://cmake.org/cmake/help/latest/module/FindBLAS.html#intel-mkl

On my machine, it looks like mkl_lapack_slaeh2 in defined in either libmkl_gnu_thread.a, libmkl_intel_thread.a, libmkl_sequential.a, or libmkl_tbb_thread.a. You can check what symbols are in a library with the nm command. But I see you are already linking with libmkl_gnu_thread.a, so I'm not sure why that doesn't add those functions.

Thanks. ReInstall mkl lib and config like you paste can solve the problem. But I have a question, why libstrumpack.a have no "mkl" symbol when I "objump -t libstrumpack.a". how to confirm the mkl lapack and blas will be used?

pghysels commented 3 months ago

I don't know why it doesn't show up in the output from objdump. But in the build folder there should be files called link.txt that show the link line, so you can check there that it is using MKL.