CSCI 3366 (Introduction to Parallel and Distributed Processing):
Sample Programs
OpenMP
- Sample makefile Makefile
for compiling C and C++ programs.
(See the Note About
Makefiles below.)
- Helpful hints:
OpenMP on the Linux Lab Machines.
- "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:
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:
Java
- Helpful hints:
Java Without an IDE.
- "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").