Hi,
The error described above:
>> 833 /home/jinsookim/spack/opt/spack/linux-centos8-icelake/gcc-8.3.1/libxsmm-1.17-ism3t6ngf365gk5vs7wc5wmcdml2jfoc/lib/libxsmm.a: error adding symbols: File format not recognized
is caused by a broken build of the libxsmm library for small matrix multiplications. The build for libxsmm by spack breaks, because it is not using the right binutils.
See also:
https://github.com/libxsmm/libxsmm/issues/652https://github.com/spack/spack/issues/28404There are two workarounds to this:
1. install cp2k without libxsmm (using blas instead)
spack install cp2k smm=blas (add any other specification details and options)
Note, that this will likely cost you significant performance (depending on what you do with cp2k). In my case, compute times increase by a factor of 4.
2. Build with functional libxsmm (
not fully successful, see below)
First, uninstall the broken libxsmm library built by spack
spack uninstall libxsmmNow built binutils as specified in the link above (
https://github.com/libxsmm/libxsmm/issues/652)
spack install binutils+ld+gasNow make sure that these bintutils are used by your system in your next attempt to build libxsmm and cp2k.
A simple solution is to add the corresponding bin directory to the start of your PATH environment variable to make sure they are used. (this can be achieved in many other ways, too).
In my case:
export PATH=/home/mheyden/src/spack/opt/spack/linux-ubuntu18.04-zen/gcc-13.1.0/binutils-2.41-lm4zu5gvi5uj2kodjfrvwtmzadyaczq3/bin:$PATHNow built a functional libxsmm library:
spack install libxsmm blas=0Note: cp2k would not compile without the added blas=0 option. libxsmm seems to include fallback calls to blas otherwise, but this dependency doesn't seem to have been included in the spack package (speculation).
Now install cp2k:
spack install cp2k (add any other specification details and options)
Unsolved problem:During execution of cp2k this results in almost immediate crashes in my case (aiMD). If you are only using the classical MD part of cp2k, I suspect you'll be fine, but I did not test it.
Solution:I could not get the spack package for cp2k to work with libxsmm and gave up on it. I went on to compile cp2k using cp2k's own install_cp2k_toolchain. (cp2k-2023.2/tools/toolchain/install_cp2k_toolchain.sh). The latter is essentially doing what spack is supposed to do, but with a curated list of libraries and working compiler instructions (thanks cp2k). There a few minor dependencies I needed to take care of:
sudo apt-get install pkg-configsudo apt-get install zlib1g-devbut everything else went smoothly and the resulting cp2k binaries are working and fast.
Hope this is useful.