Generic master/worker programs:
MPI
- Sample makefile Makefile
for compiling C and C++ programs.
(See the Note About
Makefiles below.)
- Sample list-of-machines file
MPIhosts.
- Script mpirun-on-upmachines
to run MPI program on selected machines.
To use, copy into a directory in your search path
(current directory will probably work) and make executable
with chmod u+x mpirun-on-upmachines.
Executing with no arguments gives a usage message.
- 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:
- Programs for heat diffusion example:
- Programs for Mandelbrot example:
- Programs for matrix multiplication example:
- Generic master/worker programs:
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.
- Programs to test/time mergesort:
- Generic master/worker programs:
- Supporting code:
FakeTasks.java.
- Sequential version:
MasterWorkerSeq.java.
- Multi-threaded versions:
- Client-server versions using sockets:
To execute: Compile everything, then run either
MasterWorkerSocketsParMaster or
MasterWorkerSocketsDistribMaster as the master,
plus one or more workers.
The start-workers script below may be useful.
- Client-server version using RMI:
To execute: Compile everything, start an instance of
the registry with the command "rmiregistry",
then run one master and one or more workers.
The start-workers script below may be useful.
- Script start-workers
to start "worker" processes on selected machines.
(Somewhat preliminary version.)
To use, copy into a directory in your search path
(current directory will probably work) and make executable
with chmod u+x start-workers.
Executing with no arguments gives a usage message.
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").