2014-02-24 71 views
0

方案:錯誤而在openSUSE編譯MPI的Hello World程序用C

#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; 
} 

錯誤:編譯

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

命令:mpicc hello.c -o ./hello。 我正在嘗試構建一個openSUSE節點的集羣。 因此,我正在測試mpich2程序是否在每個節點上運行。

+0

檢查這些鏈接,看起來你的系統配置錯誤(例如你缺少一些軟件包)http://www.lam-mp​​i.org/MailArchives/lam/2010/04/14195.php,http:// www .lam-mp​​i.org/MailArchives/lam/2010/04/14196.php – Oz123

+0

這是一個鏈接器錯誤;你缺少一個關鍵的庫('libopen-rte.so')。 –

+0

k謝謝...我會解決這個問題.....也在其他節點m得到這個錯誤:mpi.h沒有這樣的文件或目錄 – user3136546

回答

1

libopen-rte.so指的是OpenMPI,而不是MPICH2。使用mpi-selector工具檢查默認的MPI實現。我個人更喜歡OpenMPI。

0

看起來您同時安裝了兩個MPI庫。雖然這是可能的,但如果您不太小心,配置和使用通常很痛苦。我建議卸載Open MPI或MPICH。這應該照顧你的問題。