Twister2 developers are mainly working on Ubuntu 16.04, Ubuntu 18.04, RHEL7 and MacOS. So it is recommended to use those platforms with the early versions and we would like to expand our system to different platforms in the future.
Refer the specific guides for details on different platforms.
General Build Instructions
Twister2 can be compiled with the following command
bazel build --config=<platform> twister2/...
Here platform argument can be ubuntu or darwin (for macos).
In order to run twister2 jobs, we need to create a tar package. To create the tar package we can use the following command.
bazel build --config=<platform> //scripts/package:tarpkgs
This command builds a tar file inside the directory with the current version.
We need to extract this package to run a twister2 job.
Running unit test cases
We can run twister2 test cases with the following command
bazel test --config=ubuntu twister2/...
In order to run a specific test we can use the following command, where we need to specify a target.
bazel test --config=ubuntu //twister2/comms/tests/java:BinaryTreeTest
When you compile Twister2 it will automatically download and compile OpenMPI 4.0.1 with it. If you don't like this version of OpenMPI and wants to use your own version, you can compile OpenMPI using following instructions.
We recommend using
Download OpenMPI 4.0.1 from https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.1.tar.gz
Extract the archive to a folder named
Also create a directory named
buildin some location. We will use this to install OpenMPI
Set the following environment variables
OMPI_401= PATH=$BUILD/bin:$PATH LD_LIBRARY_PATH=$BUILD/lib:$LD_LIBRARY_PATH export BUILD OMPI_401 PATH LD_LIBRARY_PATH
The instructions to build OpenMPI depend on the platform. Therefore, we highly recommend looking into the
$OMPI_401/INSTALLfile. Platform specific build files are available in
In general, please specify
--enable-mpi-javaas arguments to
configurescript. If Infiniband is available (highly recommended) specify
--with-verbs=<path-to-verbs-installation>. Usually, the path to verbs installation is
/usr. In summary, the following commands will build OpenMPI for a Linux system.
cd $OMPI_401 ./configure --prefix=$BUILD --enable-mpi-java make -j 8;make install
If everything goes well
mpirun --versionwill show
mpirun (Open MPI) 4.0.1. Execute the following command to instal
$OMPI_401/ompi/mpi/java/java/mpi.jaras a Maven artifact.
mvn install:install-file -DcreateChecksum=true -Dpackaging=jar -Dfile=$OMPI_401/ompi/mpi/java/java/mpi.jar -DgroupId=ompi -DartifactId=ompijavabinding -Dversion=4.0.1
Generating Maven Artifacts
Although twister2 uses bazel as its build system, it has an option to generate maven artifacts for each twister2 module.
To generate and install maven artifacts to your local repository, run following command at the root of twister2 source.
For more details refer the section Generate Maven Artifacts.
Twister2 dashboard has two components.
- Front End Web application; A ReactJS based web application
- Web server; A spring boot application, which exposes a RESTful Web Service (JAX-RS)
Even though (2) Embedded web server, has been included in the main bazel build, (1) Front End Web application should be build separately.
Prerequisites to build web application
Compiling web application
Having all above prerequisites ready, navigate to the root folder of dashboard client.
Now build SCSS files to produce CSS files with following command
npm run build-css
Building React app
Use below command to build the react application.
npm run build
This will create an optimized production build in
As the final step, run the main twister2 build, to generate all the binaries including dashboard.
- Build fails with ompi java binding errors
Try to do one of these things
Note: If you get an error while compiling or building Twister2 saying "Java bindings requested but no Java support found" please execute the following command to install Java using apt-get command
sudo apt install openjdk-8-jdk
Or change line 385 of
'./configure --prefix=$$INSTALL_DIR --enable-mpi-java'
'./configure --prefix=$$INSTALL_DIR --enable-mpi-java --with-jdk-bindir=<path-to-jdk>/bin --with-jdk-headers=<path-to-jdk>/include',
Please replace 'path-to-jdk' with your jdk location.