The CHT-MPI library implementation

CHT-MPI: an MPI-based Chunks and Tasks library implementation

This is the page of the CHT-MPI library implementation.

CHT-MPI uses the Message Passing Interface (MPI) for communication between worker processes. Different worker processes may run on separate compute nodes in a cluster. Within each node, the CHT-MPI implementation parallelizes the work using pthreads.

For an example of a commonly used MPI implementation that can be used with CHT-MPI, see Open MPI: http://www.open-mpi.org/

CHT-MPI distributes tasks across the worker processes using work stealing. Chunks are by default stored on the same worker process where they were created, and a chunk cache mechanism is used to reduce the need for communication. See section 3 in the original Chunks and Tasks article for further details.

Compiling and running a Chunks and Tasks program using CHT-MPI

Because CHT-MPI is based on MPI, you need to compile your code using an MPI wrapper compiler like mpiCC or mpicxx.

You compile and link your code into two executable files: the main executable (parent program) and a worker program. When the parent program is executed, it can spawn new processes each of which will execute the worker program. Both parent and worker programs are linked with the CHT-MPI library file "libcht.a".

To run the program, use mpirun. Since CHT-MPI uses dynamic process creation by default, you only start one process, the parent process, and the worker processes will be created dynamically while the program is running. So, you use "mpirun -np 1", like this:

mpirun -np 1 ./your_program [your_program arguments]

An advantage of dynamic process management is that it in principle allows for dynamically adapting the amount of resources used while the program is running.

Compiling and running a sample program

As a specific example, here follows a description of how to compile and run the Fibonacci sample code using CHT-MPI. We assume here that the CHT-MPI and Fibonacci sample source code packages cht-mpi-2.0.tar.gz and sample-fibonacci.tar.gz are placed in the user's home directory, in this example /home/elias/. First, unpack and build the CHT-MPI library: tar -xzf cht-mpi-2.0.tar.gz cd cht-mpi-2.0/ make Now, the CHT-MPI library file /home/elias/cht-mpi-2.0/source/libcht.a has been created. Unpack the Fibonacci sample and rename Makefile.parallel to Makefile: cd ~ tar -xzf sample-fibonacci.tar.gz cd sample-fibonacci/ mv Makefile.parallel Makefile Edit the first line of the Makefile so that CHTPATH points to the directory containing the CHT-MPI library files: CHTPATH=/home/elias/cht-mpi-2.0/source Now you can compile using make: make Now the executable files test_fibonacci_manager and cht_worker have been created. Run the program using mpirun: mpirun -np 1 ./test_fibonacci_manager Note that although cht_worker is not directly invoked from the command line, it is still essential since the test_fibonacci_manager program will spawn worker processes that run the cht_worker executable.

Source code

To download CHT-MPI source code, please follow this link: source code download

Click here to return to the Library implementations page.