




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: S-Gen Purpose Cmptn-GPU; Subject: Computer Science; University: University of Massachusetts - Amherst; Term: Spring 2006;
Typology: Study notes
1 / 28
This page cannot be seen from the preview
Don't miss anything!





















U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
some material adapted from slides by Kathy Yelick
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
From Pat Worley, ORNL
Scaling Limits ^
^
^
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
interconnect
P
memory
NI
...
P
memory
NI
Pn memory
NI
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
^
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
^
Bus
,^ star
,^ hypercube
, ...
^
^
SMP
boxes
^
Beowulf
clusters
^
Supercomputers
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
#include <stdio.h>#include <mpi.h>int main(int argc, char * argv[]) {
int rank, size; MPI_Init
(&argc, &argv );
MPI_Comm_size
( MPI_COMM_WORLD
, &size);
MPI_Comm_rank
( MPI_COMM_WORLD
, &rank);
printf("Hello world from process %d of %d\n",
rank, size);
MPI_Finalize
();
return 0; }
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
#include <stdio.h>#include <mpi.h>int main(int argc, char * argv[]) {
int rank, size; MPI_Init
(&argc, &argv );
MPI_Comm_size
( MPI_COMM_WORLD
, &size);
MPI_Comm_rank
( MPI_COMM_WORLD
, &rank);
printf("Hello world from process %d of %d\n",
rank, size);
MPI_Finalize
();
return 0; }
returns # ofprocessors in
“world”
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
#include <stdio.h>#include <mpi.h>int main(int argc, char * argv[]) {
int rank, size; MPI_Init
(&argc, &argv );
MPI_Comm_size
( MPI_COMM_WORLD
, &size);
MPI_Comm_rank
( MPI_COMM_WORLD
, &rank);
printf("Hello world from process %d of %d\n",
rank, size);
MPI_Finalize
();
return 0; }
which processor am
I?
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
Repeatedly broadcast input (one integer) to all
#include <stdio.h>#include <mpi.h>int main(int argc, char * argv[]) {
int rank, value; MPI_Init
( &argc, &argv );
MPI_Comm_rank
(
MPI_COMM_WORLD
, &rank );
do {
if (rank == 0)
scanf( "%d", &value ); MPI_Bcast
( &value, 1,
MPI_INT
, ^0
,
MPI_COMM_WORLD
);
printf( "Process %d got %d\n", rank, value ); } while (value >= 0); MPI_Finalize
( );
return 0; }
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
Repeatedly broadcast input (one integer) to all
#include <stdio.h>#include <mpi.h>int main(int argc, char * argv[]) {
int rank, value; MPI_Init
( &argc, &argv );
MPI_Comm_rank
(
MPI_COMM_WORLD
, &rank );
do {
if (rank == 0)
scanf( "%d", &value ); MPI_Bcast
( &value, 1,
MPI_INT
,
0 ,^
MPI_COMM_WORLD
);
printf( "Process %d got %d\n", rank, value );
} while (value >= 0); MPI_Finalize
( );
return 0; }
how many tosend/receive?
U^ NIVERSITY OFUNIVERSITY OF
MM
ASSACHUSETTSASSACHUSETTS
AA
MHERST •MHERST
-^ Department of Computer ScienceDepartment of Computer Science
Repeatedly broadcast input (one integer) to all
#include <stdio.h>#include <mpi.h>int main(int argc, char * argv[]) {
int rank, value; MPI_Init
( &argc, &argv );
MPI_Comm_rank
(
MPI_COMM_WORLD
, &rank );
do {
if (rank == 0)
scanf( "%d", &value ); MPI_Bcast
( &value, 1,
MPI_INT
,
0 ,^
MPI_COMM_WORLD
);
printf( "Process %d got %d\n", rank, value );
} while (value >= 0); MPI_Finalize
( );
return 0; }
what’s thedatatype?