// stringprint.cpp : Defines the entry point for the console application.

#include "stdafx.h"
#include "mpi.h"

int _tmain(int argc, char* argv[])
    MPI_Status status;
    int numtasks, rank, rc;
    char ch;
    rc = MPI_Init(&argc,&argv);
    if (rc != MPI_SUCCESS) 
        printf ("Error starting MPI program. Terminating.\n");
        MPI_Abort(MPI_COMM_WORLD, rc);

            for (int i = 0; i < 10; i++)

        MPI_Recv(&ch, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, &status);
        for (int i=ch;i<91;i++) 

    return 0;

/// i collect this code from my class , but i dont know anything about MPI... how can i run this code without MPI .... please help me...and output will give the same....

MPI - Message Passing Interface. The link that AD provided is very good. The US national laboratories publish a lot of computer science stuff that is extremely useful. I like the CS pages of Oakridge National Lab (http://www.phy.ornl.gov/csep/) myself (great stuff on semi-numerical algorithms, random numbers, Monte Carlo routines, Finite Element Math, etc). MPI is used to help enable large-scale distributed computing. It supports distributing otherwise long-running computations over many systems. This is essential for modern physics research when they have to run the same computation against a gazillion (technical term for "a really large number") particles and observed interactions. FWIW, my wife is a particle physicist involved in computational physics at Fermi National Laboratory in Batavia, Illinois. She knows this stuff like nobody's business! Me? I can use it (I do large-scale distributed computing also), but it isn't essential for my work. :-)

Edited 3 Years Ago by rubberman

This article has been dead for over six months. Start a new discussion instead.