MPI处理器数量错误 [英] Wrong mpi number of processors

查看:137
本文介绍了MPI处理器数量错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我确定犯了一个愚蠢的错误,但没有解决.

Sorry, I'm sure making a silly mistake, but did not work out.

我正在编译一个简单的mpi hello世界:

I'm compiling a simple mpi hello world:

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

并且:

> mpicc -o hello_world_c hello_world.c
> mpirun -np 4 hello_world_c

但是返回:

Hello world from process 0 of 1
Hello world from process 0 of 1
Hello world from process 0 of 1
Hello world from process 0 of 1

但是我的计算机是具有4个核心的i7核心.一切似乎都还可以,即. cat/proc/cpuinfo显示了4个处理器

But my computer is a core i7 with 4 cores. And everything seems to be ok, ie. cat /proc/cpuinfo shows the 4 processors

发生了什么事??? 在此先感谢!!!

what's happening??? Thanks in advance!!!!

推荐答案

您的代码没有错. 唯一的问题可能是您的mpi安装.

There is nothing wrong with your code. The only problem that can be is with your mpi installation.

注意:

处理器与内核之间存在差异.不是同一回事.

There is a differences between processor to core. its not the same thing.

这篇关于MPI处理器数量错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆