0 votes
asked by (190 points)

Hello Everyone
I installed Itensor and mpicxx ( by sudo apt-get .... ) in my own computer then
edited the Makefile as following:

ITENSORLIBRARYDIR=$(HOME)/Downloads/ITensor-master
MPICFLAGS=-I/usr/lib/x8664-linux-gnu/openmpi/include
MPILFLAGS= -pthread -I/usr/lib/x8664-linux-gnu/openmpi/include -L/usr//lib -L/usr/lib/x8664-linux-gnu/openmpi/lib -lmpicxx -lmpi

I still met bug informations by typing "make"

dmrg.o: In function main': pdmrg.cc:(.text.startup+0xa6e): undefined reference toMPIFinalize'
pdmrg.cc:(.text.startup+0xb1f): undefined reference to `MPI
Finalize'

Could someone tell me what I missed ?
Best wishes
Wanzhou

commented by (70.1k points)
Hi, so to get the correct include and linker flags, did you try using the command line program "mpicxx -showme" ? Or some other mpi frameworks offer similar commands. The "-showme" flag will print out the correct compiler flags for you to use. You should put the -llibname flags in the precise same order as in the printout.
commented by (190 points)
Hello Miles
Thank you for your comment.
I typed mpicxx -showme:compile  
then put the location  as  MPI_CFLAGS

MPI_CFLAGS=-I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include -I/usr/lib/x86_64-linux-gnu/openmpi/include -pthread

I used   mpicxx --showme:link and got the LFLAGS
MPI_LFLAGS=-pthread -L/usr//lib -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi_cxx -lmpi

then I make again, still  got bug informations.

Best Wishes
Wanzhou
commented by (70.1k points)
Hi Wanzhou, could you please say also what the bug information is?
commented by (190 points)
zhang@mlpxy:~/Downloads/parallelDMRG-master$ make
g++ -m64 -std=c++11 -pthread -L/usr//lib -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi_cxx -lmpi -I. -I/home/zhang/Downloads/ITensor-master  -O2 -DNDEBUG -Wall -DPLATFORM_lapack -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -Wno-unused-variable pdmrg.o -o pdmrg -L/home/zhang/Downloads/ITensor-master/lib -litensor -lpthread -L/usr/lib -lblas -llapack
pdmrg.o: In function `MPI::Comm::Get_rank() const':
pdmrg.cc:(.text._ZNK3MPI4Comm8Get_rankEv[_ZNK3MPI4Comm8Get_rankEv]+0x1e): undefined reference to `MPI_Comm_rank'
pdmrg.o: In function `MPI::Comm::Get_size() const':
 .........................
pdmrg.cc:(.text._ZN7itensor11pdmrgWorkerINS_8ITensorTINS_7IQIndexEEENS_8LocalMPOIS3_EEEEdRKNS_11EnvironmentERKNS_9PartitionERNS_4MPStIT_EERSt6vectorISD_SaISD_EERT0_RKNS_6SweepsERNS_8ObserverENS_4ArgsE[_ZN7itensor11pdmrgWorkerINS_8ITensorTINS_7IQIndexEEENS_8LocalMPOIS3_EEEEdRKNS_11EnvironmentERKNS_9PartitionERNS_4MPStIT_EERSt6vectorISD_SaISD_EERT0_RKNS_6SweepsERNS_8ObserverENS_4ArgsE]+0x28cd): undefined reference to `MPI_Send'
pdmrg.o: In function `main':
pdmrg.cc:(.text.startup+0xa6e): undefined reference to `MPI_Finalize'
pdmrg.cc:(.text.startup+0xb1f): undefined reference to `MPI_Finalize'
pdmrg.o:(.rodata._ZTVN3MPI8DatatypeE[_ZTVN3MPI8DatatypeE]+0x78): undefined reference to `MPI::Datatype::Free()'
pdmrg.o:(.rodata._ZTVN3MPI3WinE[_ZTVN3MPI3WinE]+0x48): undefined reference to `MPI::Win::Free()'
collect2: error: ld returned 1 exit status
Makefile:63: recipe for target 'pdmrg' failed
make: *** [pdmrg] Error 1
commented by (70.1k points)
Can you please try changing the compiler itself to mpicxx? That is, instead of g++? You can do this inside the Makefile by redefining the CCCOM variable
commented by (190 points)
Hi Miles
It is great.  Now 'make' works after modifying g++ as mpicxx in the Makefile.
Thank  you.
Best wishes
Wanzhou
commented by (70.1k points)
Nice to hear!
commented by (190 points)
Thank you for your help :)

1 Answer

0 votes
answered by (70.1k points)

To mark this question as answered, the solution that worked the best was to add the line:

CCCOM=mpicxx

in the Makefile to redefine the CCCOM (cc compiler) variable.

Or replace mpicxx with the appropriate C++ compiler frontend provided by your MPI distribution.

Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...