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

compile strumpack with mkl lapack and blas error #122

Open
omgoooood opened this issue Jul 18, 2024 · 3 comments
Open

compile strumpack with mkl lapack and blas error #122

omgoooood opened this issue Jul 18, 2024 · 3 comments

Comments

@omgoooood
Copy link

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants