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
sudo apt-get update
sudo apt install nvidia-driver-550
Unfortunately, a reboot is required for the driver to be fully loaded.
sudo reboot
Optional hardware check
Install hwinfo
:
sudo apt install hwinfo
To display GPU information:
hwinfo --gfxcard
You should see something like this:
Running simpleapexrender
First upload simpleapexrender
and a test file (e.g., Cover Girl.pdf
) to the VM.
Ensure it’s executable:
chmod +x simpleapexrender
Now run it:
./simpleapexrender 01_Cover\ Girl.pdf 01_Cover\ Girl-apex.tif
You should see output similar to this:
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?
./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:
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