CP2K 2026.2 on ubuntu 22.04 + oneAPI: The MPI_Comm_c2f() function was called before MPI_INIT was invoked.

37 views
Skip to first unread message

Martin Konôpka

unread,
Aug 20, 2026, 8:30:49 AM (5 days ago) Aug 20
to cp2k
Dear CP2K experts,

I have  built CP2K 2026.2 on  several Linux workstations and I am  trying to run it. In each case I used the Intel oneAPI 2026.1 compilers and libraries installed in the same way. Also the  CP2K was built on each of the workstations in the same way with one minor excpetion - see below. I used the toolchain. The results are different however:

Ubuntu 26.04:  My CP2K build works.
Linux Mint Zena (based on ubuntu 24.04): My CP2K build works.
Ubuntu 22.04: My CP2K build fails with the message

*** The MPI_Comm_c2f() function was called before MPI_INIT was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.
[oslik:116792] Local abort before MPI_INIT completed completed successfully, but am not able to aggregate error messages, and not able to guarantee that all other processes were killed!

There is no error message in the usual output file. I attach it, as  well  as my script used to launch  the CP2K executable. As for the input file, it is the  same as in my recent post here:

To configure the CP2K on the two  newer OSs, I issued the command

./install_cp2k_toolchain.sh  --mpi-mode=intelmpi  --math-mode=mkl  --libint-lmax=6  --with-ifx=yes  --with-cmake=system  --with-eigen=install  --with-dftd4=install

On ubuntu 22.04 I used the  same with the exception of cmake; I used install instead of system, because the system cmake was too old.

As for the oneAPI environment one the ubuntu 22.04, I successfully used it to build Quantum Espresso 7.5 (and  it works with the Intel MPI), so I really do not know what is the cause of the problem with the CP2K and would greatly appreciate your opinions and advices.

Best regards
Martin Konôpka
cp2k.out
launch_cp2k_2026.2_Intel_np01_nt06.sh

Frederick Stein

unread,
Aug 20, 2026, 9:56:02 AM (5 days ago) Aug 20
to cp2k
Dear Martin,
Do you have log files from the build process? If you have a different MPI implementation on your system, it could be that one of those were picked up somewhere.
Best,
Frederick

Martin Konôpka

unread,
Aug 20, 2026, 10:54:24 AM (5 days ago) Aug 20
to cp2k
Dear Frederick,

Thank you for the response. Yes, at the moment I have at hand all such  files from my builds on the Linux Mint Zena and  on the Ubuntu 22.04. I attach them, also the log files from  cmake and the files (or only parts of them) which I created by copy-pasting my commands and  their standard outputs printed on the terminal.

If needed, I can later send such  files form my build on Ubuntu 26.04 (which is a notebook that I do not have at hand  at the  moment).

BTW,  the toolchain script on 22.04 recommended to build the binaries with the  command
   ./build_cp2k.sh -j 18
In my actual build I used only 16 (not 18). I hope this is not the source of the reported problem.

Best,
Martin.
Dátum: štvrtok 20. augusta 2026, čas: 15:56:02 UTC+2, odosielateľ: Frederick Stein
cmd_stdout_from_build_LinuxMint_Zena
cmd_stdout_from_build_cp2k_Ubuntu_22.04
build.log_Ubuntu_22.04
cmd_stdout_from_install_cp2k_toolchain_Ubuntu_22.04
cmd_stdout_from_install_cp2k_toolchain_LinuxMint_Zena
build.log_LinuxMint_Zena
cmake.log_LinuxMint_Zena
cmake.log_Ubuntu_22.04

Frederick Stein

unread,
Aug 20, 2026, 11:26:13 AM (5 days ago) Aug 20
to cp2k
Dear Martin,
I guess, CP2K picked up the system-provided OpenMPI-implementation in some places (see the end of the cmake.log_Ubuntu_22.04.). Please double-check with your Spack-log files. Have you tried to run the regression tests beforehand? Without any further information it is hard to tell which library picked up the wrong MPI-installation. You can add the TRACE keyword to the &GLOBAL section of your input file and check where CP2K fails. If you are lucky, you may even see where it fails because a routine wasn't left.
Best,
Frederick

Martin Konôpka

unread,
Aug 20, 2026, 12:58:24 PM (5 days ago) Aug 20
to cp2k
Dear Frederick,

Yes, you are right. Despite trying to be VERY careful, I perhaps (?) forgot to run the script
   /opt/intel/oneapi/2026.1/oneapi-vars.sh
in the shell in which I subsequently launched  the toolchain script etc. (Possibly I ran the intel script in a different shell mistakenly.) I now clearly see the problems when  I look at the output of the
    ldd /dalsie/cp2k-2026.2/install/bin/cp2k.psmp
commands.
I attach two ldd outputs, one with the correct build (Linux Mint Zena) , the  other with the incorrect build (Ubuntu 22.04).
I stress that I issued the ldd commands AFTER sourcing the scripts
     /opt/intel/oneapi/2026.1/oneapi-vars.sh
     /dalsie/cp2k-2026.2/install/cp2k_env

I will rebuild the CP2K on  the ubuntu 22.04 and then I will do the regression tests. (I have  not tried them yet.) As for  Spack, I have  not used it for the CP2K 2026.2 build process. If possible to use,  I prefer the toolchain to Spack.

Once more thank you very much for helping me.

Best,
Martin.
Dátum: štvrtok 20. augusta 2026, čas: 17:26:13 UTC+2, odosielateľ: Frederick Stein
ldd_cp2k_Ubuntu_22.04
ldd_cp2k_LinuxMint_Zena

Johann Pototschnig

unread,
Aug 21, 2026, 10:06:53 AM (4 days ago) Aug 21
to cp2k
The linker links to two mpi libraries, the oneapi one and 
libmpi.so.40 => /lib/x86_64-linux-gnu/libmpi.so.40 (0x00007fa2f60c9000)

This probably causes the problems. You need to remove the system mpi from the linker, so it only links the oneapi one. 

Martin Konôpka

unread,
Aug 21, 2026, 12:35:50 PM (4 days ago) Aug 21
to cp2k
Dear Johann,

Thanks for your comment. Yes, it is so. And my yesterday's suspicion  that I omitted to source the
    /opt/intel/oneapi/2026.1/oneapi-vars.sh
script was not true; I did source the script. Later I even  repeated the  whole toolchain + build procedure and the result was again a binary with links to multiple MPI libraries. And not only MPI. I can see also a non-oneAPI LAPACK and ScaLAPACK there. The mis-linked libraries are at least these:

   libscalapack-openmpi.so.2.1 => /lib/x86_64-linux-gnu/libscalapack-openmpi.so.2.1
   liblapack.so.3 => /lib/x86_64-linux-gnu/liblapack.so.3
   libmpi.so.40 => /lib/x86_64-linux-gnu/libmpi.so.40

I do now know where is a central config file in which I could disable linking the undesired libraries. It will perhaps be  simpler for me to uninstall the undesired MPI, LAPACK, etc libraries from the system. In the past I needed them because I was using a CP2K version  installed from a standard  ubuntu repository, similarly also a Quantum Espresso version. I will no more need the old versions from the ubuntu repository so that I can unistall them,  also the undesired libraries.

Best,
Martin.

Dátum: piatok 21. augusta 2026, čas: 16:06:53 UTC+2, odosielateľ: Johann Pototschnig

Johann Pototschnig

unread,
Aug 21, 2026, 12:52:52 PM (4 days ago) Aug 21
to cp2k
The Linker uses environment variables. So you can de-install the other MPI or modify the environment variables. 

on is LD_LIBRARY_PATH

best
johann

Martin Konôpka

unread,
Aug 24, 2026, 7:06:04 AM (22 hours ago) Aug 24
to cp2k
Greetings,

I did as I have  written (on  the Ubuntu 22.04): uninstalled the non-oneAPI software and I built CP2K 2026.2 again using the toolchain. The resulting CP2K binary works better but still unsatisfactorily. A simple single-point calculation ran succesfully. A more involved task crashed. I used also the TRACE keyword. It told me that some library (or perhaps two libraries) was not configured. I remember that (one of) the  mentioned libs was libxsmm. I somehow lost or cannot find the files from  that run so that I cannot attach them. I however did the regression tests and they also showed errors. I attach the error summary.

I will likely give up my toolchain efforts and will try to use Spack to get CP2K 2026.2 working on the Ubuntu 22.04 workstation.

Best,
Martin.
Dátum: piatok 21. augusta 2026, čas: 18:52:52 UTC+2, odosielateľ: Johann Pototschnig
error_summary

Johann Pototschnig

unread,
Aug 24, 2026, 2:36:04 PM (14 hours ago) Aug 24
to cp2k
You don't need spack if you use the toolchain. libxsmm is one option for small matrix matrix multiplication. One possibility is to set in the cp2k input not to use it. 
It uses specific kernels for different machines. 

Martin Konôpka

unread,
Aug 24, 2026, 3:35:49 PM (13 hours ago) Aug 24
to cp2k
Dear Johann,

To my surprise, the CP2K 2026.2 binary (the one that initially crashed and did not pass the regression tests) works now on the ubuntu 22.04 at least for the particular systems that I am calculating now. I do now know what exactly happened. I am not going to investigate it until it eventually starts crashing again. I will occasionally do comparisons of results between two different installations of CP2K 2026.2.

Thanks for your advices anyway.

Best,
Martin.
Dátum: pondelok 24. augusta 2026, čas: 20:36:04 UTC+2, odosielateľ: Johann Pototschnig
Reply all
Reply to author
Forward
0 new messages