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
wget https://uk.download.nvidia.com/tesla/550.90.07/nvidia-driver-local-repo-ubuntu2404-550.90.07_1.0-1_amd64.deb
sudo apt install nvidia-driver-550
?? sudo apt install ./nvidia-driver-local-repo-ubuntu2404-550.90.07_1.0-1_amd64.deb
Unfortunately, a reboot is required for the driver to be fully loaded.
sudo reboot
Installing Vulkan SDK on Ubuntu
Instructions can be found on the LunarG web site, but in summary, the commands you need are these:
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
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.
sudo apt-get -y install mesa-utils mesa-vulkan-drivers
What happens when the Vulkan libraries are not available?
./simpleapexrender 01_Cover\ Girl.pdf 01_Cover\ Girl-apex.tif
Exception thrown: [jawsmako/vulkan/vulkanif.cpp:259] Failed to load Vulkan loader library libvulkan.so.1
What happens when the GPU driver is not available?
./simpleapexrender 01_Cover\ Girl.pdf 01_Cover\ Girl-apex.tif
Exception thrown: [jawsmako/vulkan/vulkanif.cpp:699] No suitable Vulkan devices available
Hardware check
Install hwinfo:
sudo apt install hwinfo
To display GPU information:
hwinfo --gfxcard
You should see something like this (click to open):
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