abacus-develop icon indicating copy to clipboard operation
abacus-develop copied to clipboard

Compilation error with v3.7.0

Open scott-5 opened this issue 1 year ago • 5 comments

Describe the bug

When compiling v3.7.1, an error occurred regarding PEXSI, so in order to identify the issue, we attempted to compile v3.7.0 and v3.6.5. V3.6.5 can compile normally, but v3.7.0 has the following errors:

[ 72%] Building CXX object source/module_relax/CMakeFiles/relax.dir/relax_new/line_search.cpp.o
[ 72%] Building CXX object source/module_relax/CMakeFiles/relax.dir/relax_old/relax_old.cpp.o
[ 72%] Building CXX object source/module_esolver/CMakeFiles/esolver.dir/esolver_lj.cpp.o
[ 72%] Building CXX object source/module_hamilt_lcao/module_gint/CMakeFiles/gint.dir/gint_k_sparse1.cpp.o
/share/home/wwu/abacus-develop/source/module_hamilt_lcao/hamilt_lcaodft/fedm_gamma.cpp:55:52: error: no member named 'pexsi_edm' in 'elecstate::DensityMatrix<double, double>'; did you mean 'pexsi_EDM'?
            edm.set_DMK_pointer(ik, pes->get_DM()->pexsi_edm[ik]);
                                                   ^~~~~~~~~
                                                   pexsi_EDM
/share/home/wwu/abacus-develop/source/module_elecstate/module_dm/density_matrix.h:217:22: note: 'pexsi_EDM' declared here
    std::vector<TK*> pexsi_EDM;
                     ^
1 error generated.
gmake[2]: *** [source/module_hamilt_lcao/hamilt_lcaodft/CMakeFiles/hamilt_lcao.dir/fedm_gamma.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
[ 73%] Building CXX object source/module_relax/CMakeFiles/relax.dir/relax_old/bfgs_basic.cpp.o
gmake[1]: *** [source/module_hamilt_lcao/hamilt_lcaodft/CMakeFiles/hamilt_lcao.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
[ 74%] Building CXX object source/module_esolver/CMakeFiles/esolver.dir/esolver_dp.cpp.o
[ 74%] Building CXX object source/module_esolver/CMakeFiles/esolver.dir/esolver_of_interface.cpp.o
[ 74%] Building CXX object source/module_esolver/CMakeFiles/esolver.dir/esolver_of.cpp.o
[ 74%] Building CXX object source/module_esolver/CMakeFiles/esolver.dir/esolver_of_tool.cpp.o

Expected behavior

No response

To Reproduce

git clone https://github.com/deepmodeling/abacus-develop.git git checkout v3.7.0 export PREFIX=${HOME}/abacus

cmake -B build \
  -DCMAKE_INSTALL_PREFIX=${PREFIX} \
  -DCMAKE_CXX_COMPILER=icpx \
  -DMPI_CXX_COMPILER=mpiicpc \
  -DELPA_DIR=${PREFIX}/elpa \
  -DLibxc_DIR=${PREFIX}/libxc \
  -DCEREAL_INCLUDE_DIR=${PREFIX}/cereal/include \
  -DENABLE_LIBRI=ON \
  -DENABLE_PEXSI=ON \
  -DPEXSI_DIR=${PREFIX}/pexsi/pexsi_200 \
  -DParMETIS_DIR=${PREFIX}/pexsi/parmetis \
  -DSuperLU_DIST_DIR=${PREFIX}/pexsi/superlu_dist

The above configuration can be executed normally, but the error is caused by the following command: cmake --build build

Environment

gcc: 12.2.0 cmake: 3.26 intel oneapi: c++/mkl-2023.10 mpi-2021

Additional Context

No response

Task list for Issue attackers (only for developers)

  • [ ] Verify the issue is not a duplicate.
  • [ ] Describe the bug.
  • [ ] Steps to reproduce.
  • [ ] Expected behavior.
  • [ ] Error message.
  • [ ] Environment details.
  • [ ] Additional context.
  • [ ] Assign a priority level (low, medium, high, urgent).
  • [ ] Assign the issue to a team member.
  • [ ] Label the issue with relevant tags.
  • [ ] Identify possible related issues.
  • [ ] Create a unit test or automated test to reproduce the bug (if applicable).
  • [ ] Fix the bug.
  • [ ] Test the fix.
  • [ ] Update documentation (if necessary).
  • [ ] Close the issue and inform the reporter (if applicable).

scott-5 avatar Jul 21 '24 13:07 scott-5

Fixed by #4702

caic99 avatar Jul 23 '24 02:07 caic99

@scott-5 Would you try installling ABACUS on the latest branch? Sorry for missing this feedback.

caic99 avatar Jul 23 '24 03:07 caic99

Yes. I tried to install the latest branch, but there are still errors. It is still related to PEXSI:

[ 36%] Building CXX object source/module_base/module_container/CMakeFiles/container.dir/ATen/kernels/lapack.cpp.o
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:193:5: error: expected expression
    else if (this->method == "pexsi")
    ^
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:132:23: error: no viable conversion from 'DiagoPexsi<double> *' to 'DiagoPexsi<double>'
        DiagoPexsi<T> tem = dynamic_cast<DiagoPexsi<T>*>(this->pdiagh);
                      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...(note level info)
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:133:17: error: invalid operands to binary expression ('DiagoPexsi<double>' and 'std::nullptr_t')
        if (tem == nullptr)
            ~~~ ^  ~~~~~~~
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:137:30: error: member reference type 'DiagoPexsi<double>' is not a pointer; did you mean to use '.'?
        pes->f_en.eband = tem->totalFreeEnergy;
                          ~~~^~
                             .
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:139:26: error: member reference type 'DiagoPexsi<double>' is not a pointer; did you mean to use '.'?
        _pes->dmToRho(tem->DM, tem->EDM);
                      ~~~^~
                         .
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:139:35: error: member reference type 'DiagoPexsi<double>' is not a pointer; did you mean to use '.'?
        _pes->dmToRho(tem->DM, tem->EDM);
                               ~~~^~
                                  .
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:132:23: error: no viable conversion from 'DiagoPexsi<complex<double>> *' to 'DiagoPexsi<complex<double>>'
        DiagoPexsi<T> tem = dynamic_cast<DiagoPexsi<T>*>(this->pdiagh);
                      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...(note level info)
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:133:17: error: invalid operands to binary expression ('DiagoPexsi<complex<double>>' and 'std::nullptr_t')
        if (tem == nullptr)
            ~~~ ^  ~~~~~~~
...(note level info)
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:137:30: error: member reference type 'DiagoPexsi<complex<double>>' is not a pointer; did you mean to use '.'?
        pes->f_en.eband = tem->totalFreeEnergy;
                          ~~~^~
                             .
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:139:26: error: member reference type 'DiagoPexsi<complex<double>>' is not a pointer; did you mean to use '.'?
        _pes->dmToRho(tem->DM, tem->EDM);
                      ~~~^~
                         .
/share/home/wwu/abacus-develop/source/module_hsolver/hsolver_lcao.cpp:139:35: error: member reference type 'DiagoPexsi<complex<double>>' is not a pointer; did you mean to use '.'?
        _pes->dmToRho(tem->DM, tem->EDM);
                               ~~~^~

@caic99

scott-5 avatar Jul 23 '24 04:07 scott-5

@Flying-dragon-boxing could you have a look?

WHUweiqingzhou avatar Aug 01 '24 07:08 WHUweiqingzhou

This may be caused by recent refactors in hamiltonian solvers. For now you may use this repository: https://github.com/Flying-dragon-boxing/abacus-develop We will fix this soon

Flying-dragon-boxing avatar Aug 01 '24 08:08 Flying-dragon-boxing

@scott-5 you may try this again now

Flying-dragon-boxing avatar Aug 09 '24 03:08 Flying-dragon-boxing

@Flying-dragon-boxing Now I can successfully compile latest branch. I have another question, that is before this fix, how does it pass compilation tests? Why does compilation fail on my machine? Is this because the compilation test environment is different from that of my machine?

scott-5 avatar Aug 09 '24 09:08 scott-5

@Flying-dragon-boxing Now I can successfully compile latest branch. I have another question, that is before this fix, how does it pass compilation tests? Why does compilation fail on my machine? Is this because the compilation test environment is different from that of my machine?

@scott-5 currently abacus is compiled without pexsi in compilation tests, unit tests and integration tests. in the future we will add pexsi to the remote environment and enable the tests.

Flying-dragon-boxing avatar Aug 09 '24 10:08 Flying-dragon-boxing

Got it.

scott-5 avatar Aug 10 '24 06:08 scott-5