CentoOS |在编译过程中找不到mpi.h文件?

时间:2019-07-22 19:39:04

标签: c openmpi

使用OpenMP编译简单的Hello World脚本时,在编译过程中出现致命错误,指出未找到mpi.h。

当前,服务器已通过模块安装并加载了openmp 1.6.5。这是一些有用的信息:

which mpicc
/cm/shared/apps/openmpi/gcc/64/1.6.5/bin/mpicc

mpicc -showme
gcc -I/cm/shared/apps/openmpi/gcc/64/1.6.5/include -pthread -L/cm/shared/apps/openmpi/gcc/64/1.6.5/lib64 -lmpi -ldl -lm -lnuma -Wl,--export-dynamic -lrt -lnsl -lutil -lm -ldl

ls /cm/shared/apps/openmpi/gcc/64/1.6.5/include/
mpi-ext.h      mpif-config.h  mpif-mpi-io.h  mpi_portable_platform.h  vampirtrace
mpif-common.h  mpif.h         mpi.h          openmpi

这是Hello World C代码:

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

int main(int argc, char** argv) {
    // Initialize the MPI environment
    MPI_Init(NULL, NULL);

    // Get the number of processes
    int world_size;
    MPI_Comm_size(MPI_COMM_WORLD, &world_size);

    // Get the rank of the process
    int world_rank;
    MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);

    // Get the name of the processor
    char processor_name[MPI_MAX_PROCESSOR_NAME];
    int name_len;
    MPI_Get_processor_name(processor_name, &name_len);

    // Print off a hello world message
    printf("Hello world from processor %s, rank %d out of %d processors\n",
           processor_name, world_rank, world_size);

    // Finalize the MPI environment.
    MPI_Finalize();
}

mpicc mpi_hello.cpp -o $@
mpi_hello.cpp:1:17: fatal error: mpi.h: No such file or directory
 #include <mpi.h>
                 ^
compilation terminated.

0 个答案:

没有答案