在单台计算机上执行MPI并行程序 [英] MPI parallel program execution on single computer

查看:354
本文介绍了在单台计算机上执行MPI并行程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在具有i7核心CPU的单台计算机上运行并行代码,我可以编译我的代码,但是我在运行它时遇到问题.

I want to run parallel codes on single pc with core i7 cpu I can compile my code but I have problem with running it.

我用mpicxx编译我的代码,当我通过"mpirun -np 8 ./a.out"运行它时,只有一个进程.我的操作系统是linux ubuntu 11.04.

I compile my code with mpicxx and when I run it by " mpirun -np 8 ./a.out" only one process is. My operating system is linux ubuntu 11.04.

我必须做什么?

例如,我想运行以下代码:

For example I want to run this code:

#include <iostream>
#include <mpi.h>
using namespace std;

int main(int argc, char **argv)
{
    int mynode, totalnodes;
    MPI_Init(&argc,&argv);
    MPI_Comm_size(MPI_COMM_WORLD, &totalnodes);
    MPI_Comm_rank(MPI_COMM_WORLD, &mynode);
    cout << "Hello world from process " << mynode;
    cout << " of " << totalnodes << endl;
    MPI_Finalize();
}

我将mpich2与mpirun --version:1.3.1一起使用

I use mpich2 with mpirun --version:1.3.1

推荐答案

如果使用ubuntu操作系统,则也可以使用mpiexec -n 8/path/to/application执行代码,并且不需要任何机器文件,只需确保您已正确安装了mpich库以执行此操作,则可以使用突触软件包管理器来安装库.

If you use ubuntu operating system you can execute your codes with mpiexec -n 8 /path/to/application too and no machine file is required just be sure that you installed mpich library properly for doing this you can use synaptic package manager for installing library.

这篇关于在单台计算机上执行MPI并行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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