Welcome to www.arepo-code.org Forums Arepo forum The code is not working compilation error – undefined reference to `ompi_mpi_comm_world’

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #499
    Konstantin Zuzik
    Participant

    Hi,

    I do have MPI installed, but still facing a blocking compilation error on Ubuntu 19 (partial dump below)

    kz@kz-MS-7978:~/arepo$ mpiexec –version
    mpiexec (OpenRTE) 3.1.3
    kz@kz-MS-7978:~/arepo$ mpirun –version
    mpirun (Open MPI) 3.1.3

    I had to replace in every source file

    #include </mpi.h>
    with
    #include </usr/lib/x86_64-linux-gnu/openmpi/include/mpi.h>

    otherwise i was seeing mpi.h not found errors. Maybe it’s related…

    Thanks in advance!

    Konstantin

    ===

    kz@kz-MS-7978:~/arepo$ make
    Build configuration:
    SYSTYPE: “MySystype”
    CONFIG: Config.sh
    EXEC: Arepo

    cc build/debug_md5/calc_checksum.o build/debug_md5/Md5.o build/domain/domain.o build/domain/domain_balance.o build/domain/domain_box.o build/domain/domain_counttogo.o build/domain/domain_DC_update.o build/domain/domain_exchange.o build/domain/domain_rearrange.o build/domain/domain_sort_kernels.o build/domain/domain_toplevel.o build/domain/domain_vars.o build/domain/peano.o build/gravity/accel.o build/gravity/forcetree.o build/gravity/forcetree_ewald.o build/gravity/forcetree_optimizebalance.o build/gravity/forcetree_walk.o build/gravity/grav_external.o build/gravity/grav_softening.o build/gravity/gravdirect.o build/gravity/gravtree.o build/gravity/gravtree_forcetest.o build/gravity/longrange.o build/gravity/pm/pm_periodic2d.o build/gravity/pm/pm_periodic.o build/gravity/pm/pm_mpi_fft.o build/gravity/pm/pm_nonperiodic.o build/hydro/finite_volume_solver.o build/hydro/gradients.o build/hydro/riemann.o build/hydro/riemann_hllc.o build/hydro/riemann_hlld.o build/hydro/scalars.o build/hydro/update_primitive_variables.o build/init/begrun.o build/init/density.o build/init/init.o build/io/global.o build/io/hdf5_util.o build/io/io.o build/io/io_fields.o build/io/logs.o build/io/parameters.o build/io/read_ic.o build/io/restart.o build/main/allvars.o build/main/main.o build/main/run.o build/mesh/criterion_derefinement.o build/mesh/criterion_refinement.o build/mesh/refinement.o build/mesh/set_vertex_velocities.o build/mesh/voronoi/voronoi.o build/mesh/voronoi/voronoi_1d.o build/mesh/voronoi/voronoi_1d_spherical.o build/mesh/voronoi/voronoi_3d.o build/mesh/voronoi/voronoi_check.o build/mesh/voronoi/voronoi_derefinement.o build/mesh/voronoi/voronoi_dynamic_update.o build/mesh/voronoi/voronoi_exchange.o build/mesh/voronoi/voronoi_ghost_search.o build/mesh/voronoi/voronoi_gradients_lsf.o build/mesh/voronoi/voronoi_gradients_onedims.o build/mesh/voronoi/voronoi_refinement.o build/mesh/voronoi/voronoi_utils.o build/mpi_utils/checksummed_sendrecv.o build/mpi_utils/hypercube_allgatherv.o build/mpi_utils/mpi_util.o build/mpi_utils/myalltoall.o build/mpi_utils/sizelimited_sendrecv.o build/mpi_utils/pinning.o build/ngbtree/ngbtree.o build/ngbtree/ngbtree_search.o build/ngbtree/ngbtree_walk.o build/star_formation/sfr_eEOS.o build/star_formation/starformation.o build/time_integration/darkenergy.o build/time_integration/do_gravity_hydro.o build/time_integration/driftfac.o build/time_integration/predict.o build/time_integration/timestep.o build/time_integration/timestep_treebased.o build/utils/allocate.o build/utils/debug.o build/utils/mpz_extension.o build/utils/mymalloc.o build/utils/parallel_sort.o build/utils/system.o build/compile_time_info.o build/compile_time_info_hdf5.o build/version.o -lgmp -lm -lstdc++ -lmpich -lgsl -lgslcblas -o Arepo
    /usr/bin/ld: build/debug_md5/calc_checksum.o: in function `calc_memory_checksum’:
    calc_checksum.c:(.text+0xb3): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: calc_checksum.c:(.text+0xba): undefined reference to `ompi_mpi_op_sum’
    /usr/bin/ld: calc_checksum.c:(.text+0xc1): undefined reference to `ompi_mpi_int’
    /usr/bin/ld: build/domain/domain.o: in function `domain_Decomposition’:
    domain.c:(.text+0x170): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: domain.c:(.text+0x25b): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: domain.c:(.text+0x4fb): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: domain.c:(.text+0x616): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: domain.c:(.text+0x77b): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: build/domain/domain.o:domain.c:(.text+0x866): more undefined references to `ompi_mpi_comm_world’ follow
    /usr/bin/ld: build/domain/domain.o: in function `domain_prepare_voronoi_dynamic_update’:
    domain.c:(.text+0x1279): undefined reference to `ompi_mpi_op_max’
    /usr/bin/ld: domain.c:(.text+0x1280): undefined reference to `ompi_mpi_int’
    /usr/bin/ld: build/domain/domain.o: in function `domain_preserve_relevant_topnode_data’:
    domain.c:(.text+0x181b): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: build/domain/domain.o: in function `domain_find_total_cost’:
    domain.c:(.text+0x1983): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: domain.c:(.text+0x1adf): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: domain.c:(.text+0x1ae6): undefined reference to `ompi_mpi_op_sum’
    /usr/bin/ld: domain.c:(.text+0x1aed): undefined reference to `ompi_mpi_double’
    /usr/bin/ld: domain.c:(.text+0x1df0): undefined reference to `ompi_mpi_comm_world’
    /usr/bin/ld: build/domain/domain.o: in function `domain_allocate’:
    domain.c:(.text+0x1f45): undefined reference to `ompi_mpi_comm_world’

    #500
    Konstantin Zuzik
    Participant

    i got this resolved by using MPICH (vs OpenMPI). Thank you

    #501

    Hi Konstantin,

    Great you found a way around it.
    I also just included a SYSTYPE=”Ubuntu” option in the Makefile, which should also solve your problem using OpenMPI.

    Best,

    Rainer

    The general solution to such a problem is the following (assuming the libraries are installed):

    If the compiler does not find e.g. the mpi.h file:

    locate mpi.h

    this should find the header of the library, like e.g.

    /usr/lib/x86_64-linux-gnu/openmpi/include/mpi.h

    Then, include the path in the compilation, adding it to one of the include options in the Makefile

    MPICH_INCL= -I/usr/lib/x86_64-linux-gnu/openmpi/include/

    If the compilation fails at linking, i.e. not finding a function of the library.
    E.g. for the mpi library, the library option -lmpi is used, which translates to the library libmpi.so or libmpi.a

    locate libmpi.*

    The resulting path needs to be included in one of the *_LIB variables in the Makefile

    MPICH_LIB = -L/usr/lib/x86_64-linux-gnu/openmpi/lib/ -lmpi

    instead of just

    MPICH_LIB = -lmpi

    #506
    Konstantin Zuzik
    Participant

    Rainer, thank you for such a detailed response! SYSTYPE=”Ubuntu” solved all compilation issues for me 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.