CSCI 3366 (Introduction to Parallel and Distributed Processing):
Sample Programs
Sample programs (some presented in class).
Message-passing programs (using MPI)
Also see
Tips for Using MPI on the CS Linux Machines.
- Sample makefile Makefile
for compiling MPI programs.
- "Hello, world" program (January 18):
- Trivial example of send/receive (January 18):
- Trivial example of send/receive with timing:
- Program to solve 1D heat-distribution problem (1D version
of problem in 6.3.2 of textbook):
Multi-threaded programs (using POSIX threads in C++)
- Sample makefile Makefile.threads
for compiling programs with POSIX threads.
- "Hello, world" program, several versions (see comments in
each file for differences):
- Program to compute sum of 1 through N, two versions
(see comments in each file for differences):
- Program to solve 1D heat-distribution problem (1D version
of problem in 6.3.2 of textbook):
- A simple approach (creating a new set of threads
for each pass through the main loop):
threads-heat-eqn-1.cc.
- A not-so-simple approach (creating a new set of
threads just once and using barrier synchronization
to keep them in synch):
threads-heat-eqn-2.cc.
- Bounded-buffer class and program demonstrating its use,
two versions (see comments in each file for differences):
- Using condition variables:
- Using semaphores:
- Supporting functions and classes:
Multi-threaded programs (in Java)
Also see
Tips for using Java on the CS Linux machines, and
Useful links for Java.
- "Hello, world" program, two versions (see comments in
each file for differences):
- Program to compute sum of 1 through N:
- Bounded-buffer class and program demonstrating its use:
- Supporting functions and classes: