简体   繁体   中英

Error while compiling hello world program in mpi in C on openSUSE

PROGRAM :

#include <stdio.h>
#include <mpi.h>


int main (argc, argv)
int argc;
char *argv[];
{
    int rank, size;

    MPI_Init (&argc, &argv);    /* starts MPI */
    MPI_Comm_rank (MPI_COMM_WORLD, &rank);  /* get current process id */
    MPI_Comm_size (MPI_COMM_WORLD, &size);  /* get number of processes */
    printf( "Hello world from process %d of %d\n", rank, size );
    MPI_Finalize();
    return 0;
}

ERROR :

/usr/lib/gcc/i586-suse-linux/4.4/../../../../i586-suse-linux/bin/ld: cannot find -lopen-rte
collect2: ld returned 1 exit status

command for compilation : mpicc hello.c -o ./hello . I am trying to build a cluster of openSUSE nodes. So I am testing if mpich2 programs run on every node.

libopen-rte.so refers to OpenMPI, not MPICH2. Check default MPI implementation using mpi-selector tool. I personally prefer OpenMPI.

It looks like you have two MPI libraries installed at the same time. While this is possible, it's usually a pain to configure and use if you're not very careful. I'd suggest uninstalling either Open MPI or MPICH. That should take care of your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM