Skip to content

handist/mpi-junit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpi-junit

This project contains a Junit4 Runner implementation which allows you to run Junit tests for Java programs that use MPI calls. Simply add this project as a dependency and annotate your test class with the @RunWith and @MpiConfig annotations:

@RunWith(MpiRunner.class)  // Use the MpiRunner to run the test
@MpiConfig(ranks=4)        // Specify how many ranks you want your test to run with
public class MyTestClass {
	@Test
	public void testMultipleHosts() {
		assertTrue(MPI.COMM_WORLD.Size() > 1);
	}
}

In normal Junit test execution, the test methods are only run once. With the MpiRunner however, each mpi process execute the test methods. You will therefore obtain as many test results as there are ranks for each of your test methods.

How it works

To run the tests with MPI, the MpiRunner spawns a mpirun process with the user-specified number of ranks. Each mpi process will write the results of its test methods to a dedicated file. When the mpirun process terminates, the MpiRunner will parse these files, aggregate the results and return them to the "normal" Junit runtime.

As the use of custom Runners is an integral feature of the Junit4 framework, using the MpiRunner should integrate seamlessly with the system you use to run your tests, whether it be the Eclipse Junit launchers / Maven ...

Dependencies

All the dependencies for this project are included with the "provided" maven scope, meaning that when you use this project, it will use your Junit and MPI for Java dependencies.

As of now, the MpiRunner supports two MPI implementations:

Be aware that some runtime environment cannot use the MPJ-Express "multicore" configuration. This is the case when mixing the APGAS for Java runtime with MPI for instance. However, if your programs can run with the MPJ-Express "multicore" implementation, you should be able to use this project to run tests.

These projects use mpi-junit to run their tests