CSCI 3366 (Introduction to Parallel and Distributed Processing):
Sample Programs
MPI
- Sample makefile Makefile
for compiling C and C++ programs.
(See the Note About
Makefiles below.)
- Sample list-of-machines file
MPIhosts.
- Helpful hints:
Using MPI on the Linux Lab Machines.
- "Hello, world" program:
hello.c.
- "Hello, world" program with command-line arguments and
hostname:
fancy-hello.c.
- Trivial example of send/receive:
send-recv.c.
- Simple send/receive with timing:
time-msg.c.
- Programs to compute pi by numerical integration:
- Generic "exchange messages with neighbors" programs,
contrasting different types of communication:
- Generic master/worker programs:
- Programs for heat diffusion example:
- Programs for Mandelbrot example:
- Programs for matrix multiplication example:
OpenMP
- Sample makefile Makefile
for compiling C and C++ programs.
(See the Note About
Makefiles below.)
(A different Makefile
is needed for the Fedora Core 4 machines.)
- Helpful hints:
OpenMP on the Linux Lab Machines.
(These notes are for machines running Fedora Core 5.
See last year's version of
my notes
for instructions applicable to the remaining Fedora Core 4
machines -- Dione00 (4 processors), Dione01 and Dione02 (2 each).)
- "Hello, world" program:
hello.c.
- Programs to compute pi by numerical integration:
- Simple example of synchronization among threads:
- Generic master/worker programs:
- Programs for heat diffusion example:
- Programs for Mandelbrot example:
- Programs for matrix multiplication example:
Java
- "Hello, world" programs:
- Simple example of synchronization among threads:
- Programs to compute pi by numerical integration:
- "Bounded buffer" class and test program, showing use of
wait/notify synchronization and interrupts:
BoundedBuffer.java,
TestBoundedBuffer.java.
- Generic master/worker programs:
POSIX threads (pthreads)
- Sample makefile Makefile
for compiling C programs.
- "Hello, world" program:
hello.c.
- Simple example of synchronization among threads:
- Programs to compute pi by numerical integration:
To obtain a makefile, use your browser's download function;
cutting and pasting will likely turn the tabs in the makefile
into spaces and cause it to not work.
Put the makefile in the directory in which you want to
compile.
All the makefiles linked from this page begin with
brief documentation on their use (the "usage examples").