deepmodeling / abacus-develop

An electronic structure package based on either plane wave basis or numerical atomic orbitals.
http://abacus.ustc.edu.cn
GNU Lesser General Public License v3.0
167 stars 129 forks source link

Compile error by gcc-toolchain with LibComm 0.1.1 #5033

Closed QuantumMisaka closed 3 weeks ago

QuantumMisaka commented 1 month ago

Describe the bug

When compile ABACUS by gcc-toolchain with LibComm 0.1.1, Error occurs:

In file included from /lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp:10,
                 from /lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.h:48,
                 from /lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/Comm_Keys_31-gather.hpp:9,
                 from /lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/Comm_Keys_31-gather.h:95,
                 from /lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/Comm_Assemble.h:8,
                 from /lustre/home/2201110432/lib/libri/0.2.0/include/RI/physics/../comm/mix/Communicate_Tensors_Map.h:10,
                 from /lustre/home/2201110432/lib/libri/0.2.0/include/RI/physics/../comm/mix/Communicate_Tensors_Map_Judge.h:8,
                 from /lustre/home/2201110432/lib/libri/0.2.0/include/RI/physics/Exx_Post_2D.hpp:9,
                 from /lustre/home/2201110432/lib/libri/0.2.0/include/RI/physics/Exx_Post_2D.h:58,
                 from /lustre/home/2201110432/lib/libri/0.2.0/include/RI/physics/Exx.h:8,
                 from /lustre/home/2201110432/apps/abacus/abacus-test/source/module_ri/Exx_LRI.h:13,
                 from /lustre/home/2201110432/apps/abacus/abacus-test/source/module_ri/Exx_LRI_interface.h:4,
                 from /lustre/home/2201110432/apps/abacus/abacus-test/source/module_esolver/esolver_ks_lcao.h:9,
                 from /lustre/home/2201110432/apps/abacus/abacus-test/source/module_hamilt_lcao/module_tddft/evolve_elec.h:6,
                 from /lustre/home/2201110432/apps/abacus/abacus-test/source/module_elecstate/potentials/H_TDDFT_pw.cpp:6:
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/MPI_Wrapper.h:85:49: error: the address of the ‘ompi_datatype_t’ subobject of ‘ompi_mpi_char’ is not a valid template argument
   85 |         static MPI_Type_Contiguous_Pool<MPI_CHAR> char_contiguous;
      |                                                 ^
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp: In function ‘std::size_t Comm::Cereal_Func::align_stringstream(std::stringstream&)’:
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp:37:45: error: ‘Comm::MPI_Wrapper::char_contiguous’ cannot be used as a function
   37 |                 MPI_Wrapper::char_contiguous(exponent_align);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp: In function ‘void Comm::Cereal_Func::mpi_send(const std::string&, std::size_t, int, int, ompi_communicator_t* const&)’:
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp:53:109: error: ‘Comm::MPI_Wrapper::char_contiguous’ cannot be used as a function
   53 |                 MPI_CHECK( MPI_Send  ( str.c_str(), str.size()>>exponent_align, MPI_Wrapper::char_contiguous(exponent_align), rank_recv, tag, mpi_comm ) );
      |                                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp:17:26: note: in definition of macro ‘MPI_CHECK’
   17 | #define MPI_CHECK(x) if((x)!=MPI_SUCCESS)       throw std::runtime_error(std::string(__FILE__)+" line "+std::to_string(__LINE__));
      |                          ^
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp: In function ‘void Comm::Cereal_Func::mpi_isend(const std::string&, std::size_t, int, int, ompi_communicator_t* const&, ompi_request_t*&)’:
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp:79:110: error: ‘Comm::MPI_Wrapper::char_contiguous’ cannot be used as a function
   79 |                 MPI_CHECK( MPI_Isend  ( str.c_str(), str.size()>>exponent_align, MPI_Wrapper::char_contiguous(exponent_align), rank_recv, tag, mpi_comm, &request ) );
      |                                                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp:17:26: note: in definition of macro ‘MPI_CHECK’
   17 | #define MPI_CHECK(x) if((x)!=MPI_SUCCESS)       throw std::runtime_error(std::string(__FILE__)+" line "+std::to_string(__LINE__));
      |                          ^
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp: In function ‘std::vector<char> Comm::Cereal_Func::mpi_recv(ompi_communicator_t* const&, MPI_Status&)’:
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp:105:83: error: ‘Comm::MPI_Wrapper::char_contiguous’ cannot be used as a function
  105 |                         const MPI_Datatype mpi_type = MPI_Wrapper::char_contiguous(exponent_align);
      |                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp: In function ‘std::vector<char> Comm::Cereal_Func::mpi_mrecv(ompi_message_t*&, const MPI_Status&)’:
/lustre/home/2201110432/lib/libcomm/0.1.1/include/Comm/Comm_Assemble/../Comm_Keys/../global/Cereal_Func.hpp:149:83: error: ‘Comm::MPI_Wrapper::char_contiguous’ cannot be used as a function
  149 |                         const MPI_Datatype mpi_type = MPI_Wrapper::char_contiguous(exponent_align);
      |                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
[ 41%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/deepks_hmat.cpp.o
[ 41%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/LCAO_deepks_interface.cpp.o
gmake[2]: *** [source/module_elecstate/CMakeFiles/elecstate.dir/build.make:468: source/module_elecstate/CMakeFiles/elecstate.dir/potentials/H_TDDFT_pw.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
[ 42%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/orbital_precalc.cpp.o
[ 42%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/orbital_precalc_k.cpp.o
[ 42%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/cal_gdmx.cpp.o
[ 42%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/cal_gdmx_k.cpp.o
[ 42%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/cal_gedm.cpp.o
[ 42%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/cal_gvx.cpp.o
gmake[1]: *** [CMakeFiles/Makefile2:1199: source/module_elecstate/CMakeFiles/elecstate.dir/all] Error 2
[ 43%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/cal_descriptor.cpp.o
[ 43%] Building CXX object source/module_hamilt_lcao/module_deepks/CMakeFiles/deepks.dir/v_delta_precalc.cpp.o
[ 43%] Built target deepks
gmake: *** [Makefile:136: all] Error 2

The compilation process is normal with LibComm 0.1.0 (last update: Nov 21 2023)

Expected behavior

No response

To Reproduce

compile ABACUS by gcc-toolchain with LibRI 0.2.0 and LibComm 0.1.1

Environment

gcc-toolchain

Additional Context

No response

Task list for Issue attackers (only for developers)

QuantumMisaka commented 3 weeks ago

I found that the problem is from the MPI variable of OpenMPI is different with MPICH/IntelMPI with the help of @PeizeLin , and gcc-toolchain with MPICH can smoothly compile ABACUS with LibComm 0.1.1.

I will change default MPI platform for gcc toolchain

QuantumMisaka commented 3 weeks ago

By change MPI to MPICH or compile with LibComm 0.1.0 (not recommended), this problem can be avoid. Intel OneAPI is more recommended.