[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

pl.comp.programming

[MPI] problem poczatkujacego

mateusz

5/22/2007 12:26:00 PM

Witam

Postanowi3em pobawia sie bibliotek? MPI. Zainstalowa3em biblioteke MPI
linuxie:
# ./configure --prefix=/usr/local/mpi
# make
# make install

skompilowa3em przyk3adowy program z strony
http://www-users.mat.uni.torun.pl/~bala/sem_mgr_200...
mpicc -o example example.c

i przy probie uruchamiania np.
"mpirun -np 2 hello" program zawiesza sie na funkcji MPI_Init je?eli
liczba procesów("-np") jest wieksza ni? jeden. Program odpalam na
komputerze z pojedynczym procesorem. Pytanie: Co nale?y zrobia aby
program zadzia3a3 z wieksz? liczb? procesów ni? jeden? Wiem ?e
rozwi?zanie prawdobodobnie wynika ?e co? przeoczy3em w nauce ale nie
moge znalezc rozwiazania.

Kod zród3owy programu poni?ej. Opis programiku "Dla procesu 0 czekamy na
(n-1) komunikatów i wy?wietlamy ich tre?a na ekranie. Pozosta3e procesy
wysy3aj? po jednym komunikacie do procesu 0."

kod zrod3owy:
#include <stdio.h>
#include "mpi.h"

main(int argc, char **argv)
{
int my_rank;
int p;
int source;
int dest;
int tag=50;
char message[100];
MPI_Status status;

MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
MPI_Comm_size(MPI_COMM_WORLD, &p);

if (my_rank != 0)
{
sprintf(message, "Hello from process %d.", my_rank);
dest = 0;
MPI_Send(message, strlen(message)+1, MPI_CHAR, dest,
tag, MPI_COMM_WORLD);
}
else
for (source=1; source<p; source++)
{
MPI_Recv(message, 100, MPI_CHAR, source, tag,
MPI_COMM_WORLD, &status);
printf("%s\n", message);
}

MPI_Finalize();
}

1 Answer

Buster Norris

7/28/2011 1:26:00 AM

0

The DemocRAT Hall Of Shame http://www.democrathallof... asks
"Why do you always LIE?"

[Courtesy of Buster Norris]

On Mon, 18 Jul 2011 10:54:14 -0700, Bible Studies with Satan
<bible@hotmail.com> wrote:
>George Plimpton wrote:
>> Half of the population pays no tax, and
>> sucks benefits out of the other half.
>Not so. Even the poor pay lots of taxes.

LIAR!!!!!!!!!!!!!!!!!

2011 federal income tax bracket:
Tax Bracket
Married Filing Jointly Single
10% Bracket $0 ? $17,000 $0 ? $8,500

http://www.fivecentnickel.com/2010/02/15/2011-federal-income-tax-brackets-irs-income-...

Posted from:
The DemocRATs Hall of Shame!
http://www.democrathallof...