Search:  
Gentoo Wiki

HOWTO_MPI_Programming

This page is a candidate for deletion 
Reason given: has nothing to do with Gentoo - doesn't belong on Gentoo Wiki.
If you disagree with its deletion, please explain why on its discussion page.
If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Make sure no other pages link here and check the page's history before deleting.
This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

This is a work in progress.

Essentially I want to put some very simple "hello world" type of programs here, so people with absolutely no clue of parallel computing can start from here and write/compile/run his/her first parallel program!

Example of a MPI - helloWorld


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

int main(int argc, char *argv[]) {
    int rank, size;
    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    printf("Hello, world! I am %d of %d \n", rank, size);
    MPI_Finalize();
    return 0;
}

A rank identifies a "execution unit".
Size identifies the amount of "execution units" the mpi application has.

Retrieved from "http://www.gentoo-wiki.info/HOWTO_MPI_Programming"

Last modified: Fri, 08 Aug 2008 10:55:00 +0000 Hits: 9,768