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.
- Generic "exchange messages with neighbors" program,
contrasting different types of communication:
- Program to compute pi by numerical integration:
- Program for heat diffusion example:
- Generic master/worker program:
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.
- Simple example of synchronization among threads:
- Program to compute pi by numerical integration:
- Program for heat diffusion example:
- Generic master/worker program:
Java
- "Hello, world" program:
- Simple example of synchronization among threads:
HelloSynch.java.
- "Bounded buffer" class and test program, showing use of
wait/notify synchronization and interrupts:
BoundedBuffer.java,
TestBoundedBuffer.java.
- Program 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").