Profiling a Java* Application in a Singularity* Container

This recipe guides you through the configuration of a Singularity container for the Intel® VTune™ Amplifier analysis to identify hotspots in a Java application running in the isolated container environment.

Ingredients

This section lists the hardware and software tools used for the performance analysis scenario.

  • Application: MatrixMultiplication

    The application is used as a demo and not available for download.

  • Tools: Intel® VTune™ Amplifier 2018

    Note

    • For trial VTune Amplifier downloads and product support, visit https://software.intel.com/en-us/vtune.

    • All the Cookbook recipes are scalable and can be applied to VTune Amplifier 2018 and higher. Slight version-specific configuration changes are possible.

  • Linux container runtime: singularity

  • Operating system: Ubuntu* 16.04

  • CPU: Intel® microarchitecture code named Skylake with 8 logical CPUs

Install and Configure a Singularity* Container

  1. Install the Singularity software (for example, version 2.4.5):

    host> VERSION=2.4.5
    host> wget https://github.com/singularityware/singularity/releases/download/$VERSION/singularity-$VERSION.tar.gz
    host> tar xvf singularity-$VERSION.tar.gz
    host> cd singularity-$VERSION
    host>./configure --prefix=/usr/local
    host> make
    host> sudo make install
    

    Note

    For detailed installation instructions, see https://singularity.lbl.gov/install-linux.

  2. Create a Singularity container, for example, using the Docker Hub:

    host> singularity build ubuntu.img docker://ubuntu:latest
    Docker image path: index.docker.io/library/ubuntu:latest
    Cache folder set to /root/.singularity/docker
    Importing: base Singularity environment
    Importing: /root/.singularity/docker/sha256:d3938036b19cfa369e1081a6776b07b54be9612bc4c8fed7f139370c8142b79f.tar.gz
    Importing: /root/.singularity/docker/sha256:a9b30c108bda615dc10e402f62d712f413214ea92c7ec4354cd1cc0f3450bc58.tar.gz
    Importing: /root/.singularity/docker/sha256:67de21feec183fcd009a5eddc4de8c346ee0f4369a20047f1a302a90716fc741.tar.gz
    Importing: /root/.singularity/docker/sha256:817da545be2ba4bac8f6b4da584bca0fb4844938ecc462b9feab1001b5df7405.tar.gz
    Importing: /root/.singularity/docker/sha256:d967c497ce230b63996a7b1fc6ec95b741aea9348118d3328c676f13be789fa7.tar.gz
    Importing: /root/.singularity/metadata/sha256:c6a9ef4b9995d615851d7786fbc2fe72f72321bee1a87d66919b881a0336525a.tar.gz
    Building Singularity image...
    Singularity container built: ubuntu.img
    Cleaning up...
    

    Note

    Make sure the ubuntu.img file is created in the current directory.

  3. Run the container.

    Singularity allows you to map directories on your host system to directories within your container. This enables read and write data on the host system with ease. For example, if you have a host folder /tmp/vtune with the VTune Amplifier and a Java application, you need to run the container and map /tmp/vtune to /local/vtune within the container.

    host> singularity shell --bind /tmp/vtune:/local/vtune ./ubuntu.img
    Singularity: Invoking an interactive shell within container...
    Singularity ubuntu.img:~>
    

Run Analysis inside the Container

From the Singularity container, launch the command line interface of the VTune Amplifier, amplxe-cl, and run an analysis for your Java application. For example, to run Advanced Hotspots analysis for the MatrixMultiplication application, enter:

Singularity ubuntu.img:~> cd /local/vtune/matrix/ 
Singularity ubuntu.img:/local/vtune/matrix> /local/vtune/bin64/amplxe-cl -collect advanced-hotspots -- /local/vtune/jdk9.0.1-x64/bin/java -cp . MatrixMultiplication 2000 2000 2000 2000

Note

  • To profile a target application running in the Singularity container, make sure to launch the VTune Amplifier from the same container. Running the VTune Amplifier outside the container for Singularity profiling is not supported.

  • Advanced Hotspots analysis was integrated into the generic Hotspots analysis starting with VTune Amplifier 2019, and is available via the Hardware Event-based Sampling collection mode.

When the analysis result is collected, you may open it with the GUI version of the VTune Amplifier installed on the host system and follow a traditional analysis flow starting with the Summary window that provides an overview of the application performance:

Note

If you need to re-finalize an analysis result outside the Singularity container (for example, in the GUI version of the VTune Amplifier installed on the host system), make sure all binary and source files required for module resolution are accessible outside the container.

For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)