Skip to main content
Skip table of contents

Apex on AWS

Introduction

Apex is a technology that enables Mako DOM content, typically loaded from PDF, to be rendered at high speed on a GPU.

This article describes how to run executables on AWS that have been built with the Apex-enabled Mako Core SDK.

Vulkan SDK

Apex uses the Vulkan API layer to queue data and commands to a GPU. Development of Mako projects that make use of the IApexRenderer class will require the Vulkan SDK to be installed. However, the ready built samples such as simpleapexrenderer have Vulkan statically linked, so they can be run on a system with a GPU, providing a suitable driver is installed.

Linux version

Apex is currently only supported on Ubuntu and Alpine.

AWS AMI

The image that’s needed to test Apex is Ubuntu 24.04 with GPU provision:

  • EC2 instance type: g4dn.xlarge

  • AMI ID: ami-0df368112825f8d8f (ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-20250305)

Installing the driver

BASH
sudo apt-get update
sudo apt install nvidia-driver-550

Unfortunately, a reboot is required for the driver to be fully loaded.

BASH
sudo reboot

Optional hardware check

Install hwinfo:

BASH
sudo apt install hwinfo

To display GPU information:

BASH
hwinfo --gfxcard

You should see something like this:

Hardware info for NVidia Tesla GPU
BASH
09: PCI 1e.0: 0302 3D controller
  [Created at pci.386]
  Unique ID: 6NW+.mB2eVJcyjY5
  SysFS ID: /devices/pci0000:00/0000:00:1e.0
  SysFS BusID: 0000:00:1e.0
  Hardware Class: graphics card
  Model: "nVidia TU104GL [Tesla T4]"
  Vendor: pci 0x10de "nVidia Corporation"
  Device: pci 0x1eb8 "TU104GL [Tesla T4]"
  SubVendor: pci 0x10de "nVidia Corporation"
  SubDevice: pci 0x12a2
  Revision: 0xa1
  Memory Range: 0xc0000000-0xc0ffffff (rw,non-prefetchable)
  Memory Range: 0x440000000-0x44fffffff (ro,non-prefetchable)
  Memory Range: 0x450000000-0x451ffffff (ro,non-prefetchable)
  IRQ: 10 (no events)
  Module Alias: "pci:v000010DEd00001EB8sv000010DEsd000012A2bc03sc02i00"
  Driver Info #0:
    Driver Status: nvidiafb is not active
    Driver Activation Cmd: "modprobe nvidiafb"
  Driver Info #1:
    Driver Status: nvidia_drm is not active
    Driver Activation Cmd: "modprobe nvidia_drm"
  Driver Info #2:
    Driver Status: nvidia is not active
    Driver Activation Cmd: "modprobe nvidia"
  Config Status: cfg=new, avail=yes, need=no, active=unknown

12: PCI 03.0: 0300 VGA compatible controller (VGA)
  [Created at pci.386]
  Unique ID: 3hqH.3Jqbvc2JlmE
  SysFS ID: /devices/pci0000:00/0000:00:03.0
  SysFS BusID: 0000:00:03.0
  Hardware Class: graphics card
  Model: "Amazon.com VGA compatible controller"
  Vendor: pci 0x1d0f "Amazon.com, Inc."
  Device: pci 0x1111
  Memory Range: 0xc1000000-0xc13fffff (ro,non-prefetchable)
  Memory Range: 0x000c0000-0x000dffff (rw,non-prefetchable,disabled)
  Module Alias: "pci:v00001D0Fd00001111sv00000000sd00000000bc03sc00i00"
  Config Status: cfg=new, avail=yes, need=no, active=unknown

Primary display adapter: #12

Running simpleapexrender

First upload simpleapexrender and a test file (e.g., Cover Girl.pdf) to the VM.

Ensure it’s executable:

BASH
chmod +x simpleapexrender

Now run it:

CODE
./simpleapexrender 01_Cover\ Girl.pdf 01_Cover\ Girl-apex.tif

You should see output similar to this:

NONE
ElapsedTime::Fetch page  0.136946
ElapsedTime::Render page 0.927338
ElapsedTime::Render Total::AVG  1.499014
ElapsedTime::Render Total::TPUT 0.667105
ElapsedTime::Render Total 1.499014

What happens when the GPU driver is not available?

BASH
 ./simpleapexrender 01_Cover\ Girl.pdf 01_Cover\ Girl-apex.tif
Exception thrown: [jawsmako/vulkan/vulkanif.cpp:699] No suitable Vulkan devices available

Installing Vulkan SDK on Ubuntu

Installing the Vulkan SDK is not required to run a pre-built application such as simpleapexrender, but if you are developing Apex-enabled applications, besides the development tools required for Mako you will need to install the Vulkan SDK. Instructions can be found on the LunarG web site, but in summary, the commands you need are these:

BASH
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-noble.list http://packages.lunarg.com/vulkan/lunarg-vulkan-noble.list
sudo apt update
sudo apt install vulkan-sdk

If you are planning to develop an Apex-enabled Mako application, you will also need some headers and development tools

BASH
sudo apt-get -y install vulkan-headers vulkan-tools glslc libshaderc-dev libvulkan-dev libsm-dev

You may also want Mesa 3D, which is an open-source implementation of the OpenGL, Vulkan, and other graphics APIs. It allows graphics rendering on systems that either don’t have GPU drivers or need software-based rendering. We use it internally for Mako development, as it enables us to unit-test Apex code on VMs that do not have GPU provision.

CODE
sudo apt-get -y install mesa-utils mesa-vulkan-drivers

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.