SebWouters / CheMPS2

CheMPS2: a spin-adapted implementation of DMRG for ab initio quantum chemistry
GNU General Public License v2.0
68 stars 34 forks source link

undefined symbol: _ZN7CheMPS23FCI10FillRandomEjPd #67

Closed jamcas closed 5 years ago

jamcas commented 5 years ago

$ python test1.py Traceback (most recent call last): File "test1.py", line 22, in import PyCheMPS2 ImportError: /option3/lib/python3.6/site-packages/PyCheMPS2.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN7CheMPS23FCI10FillRandomEjPd

SebWouters commented 5 years ago

Can you check the linked libraries of /option3/lib/python3.6/site-packages/PyCheMPS2.cpython-36m-x86_64-linux-gnu.so?

ldd /option3/lib/python3.6/site-packages/PyCheMPS2.cpython-36m-x86_64-linux-gnu.so

Did you use the same compiler for libchemps2 and pychemps2?

jamcas commented 5 years ago

hello,SebWouters

I'm sorry that I reply you so late.

This ImportError may because the libchemps2.so can not be load correctly.Now, it works after i export LD_PRELOAD=/home/chenh/ly/sourcefolders/CheMPS2-1.8.8/lib64/libchemps2.so

But there is a new problem when i make PyCheMPS2/test:

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

And it works when i make /build/test

SebWouters commented 5 years ago

Hi @jamcas

The python test cases work at the present moment only for single process, optionally multi-threaded, regular compilations, i.e. without MPI. The reason is that the MPI-enabled library assumes that MPI has been initialized, which is done in the binary cpp [1] wrapper for the library or the cpp input files [2] as they wrap the sequence of called functions.

I haven't thought about it before, so I never checked whether it's possible to initialize MPI in python and use that with an MPI-enabled library. Perhaps @sunqm or @loriab has an idea about this? Another option (for me to implement) could be to include corresponding cpp functions in libchemps2, and call them from python.

If you want to use MPI with the present version of chemps2, you can use the binary, or the library with your own cpp inputs. You can start from the corresponding examples [3]. Note that there's also test14.input for the binary.

That all being said: typically you only want to use MPI for really large calculations, for which a single compute node is insufficient. The reason is that there is overhead associated with MPI, and that multi-threading beats MPI on single nodes, see Figure 1 of [4]. PyCheMPS2 is mainly available to wrap the libchemps2 solvers for development in other projects.

Best regards, Sebastian

[1] https://github.com/SebWouters/CheMPS2/blob/master/CheMPS2/executable.cpp#L409 [2] https://github.com/SebWouters/CheMPS2/blob/master/tests/test1.cpp.in#L64 [3] https://github.com/SebWouters/CheMPS2/tree/master/tests [4] https://aip.scitation.org/doi/abs/10.1063/1.4959817?journalCode=jcp or https://arxiv.org/abs/1605.05526

jamcas commented 5 years ago

Appreciating your help and your patience! I reinstall without mpi and it works now.

SebWouters commented 5 years ago

That's good!