Compiling UDX Source Files
After creating and registering one or more new UDXs, you need to compile your C++ or JVM source files and its registration metadata into a single shared object file, or in a JVM environment, build the extension classes into a JAR file you can load into AnzoGraph. This topic provides details of tools that are available and how you can compile UDXs to create and install the files needed to run the new extensions in AnzoGraph

AnzoGraph provides a azg_extfn_compile
utility that you can use to compile a single CPP file into a shared object. To compile multiple CPP files (containing individual extension definitions) into a single shared object, you can use the CMake
utility. See the following procedures for information about configuring CMake to compile extensions included in one or more separate CPP files.
AnzoGraph UDX CMake Configuration
In the parent CMakeLists.txt
configuration file, specify the following compiler and compilation flags to use for compiling user-defined extensions:
cmake_minimum_required(VERSION 3.13.2) if (NOT DEFINED ENV{AZG}) message("missing environment variable AZG:") message("defaulting to AZG=install_dir") set(AZG install_dir) else() set(AZG $ENV{AZG}) endif() set(CMAKE_CXX_COMPILER ${AZG}/tools/bin/x86_64-pc-linux-gnu-g++-7.2.0) add_compile_options(-O3 -Wall -m64 -std=c++17)
For example, the following CMakeLists.txt
configures CMake in a Docker environment:
cmake_minimum_required(VERSION 3.13.2) if (NOT DEFINED ENV{AZG}) message("missing environment variable AZG:") message("defaulting to AZG=/opt/anzograph") set(AZG /opt/anzograph) else() set(AZG $ENV{AZG}) endif() set(CMAKE_CXX_COMPILER ${AZG}/tools/bin/x86_64-pc-linux-gnu-g++-7.2.0) add_compile_options(-O3 -Wall -m64 -std=c++17)
Compiling a UDX to Create a Shared Object File
Run the following command to use the AnzoGraph extension compilation utility (azg_extfn_compile
) to compile a single CPP file and generate the shared object (.so
) file. The utility invokes the g++ compiler to compile the C++ file.
root_AnzoGraph_dir/bin/azg_extfn_compile /path/file_name
After compiling a C++ UDX file, you need to copy the the shared object file along with any other files or libraries on which the UDX is dependent, to a common extension directory on your AnzoGraph Server (or leader node in a cluster). When executing the UDX specified in a query, AnzoGraph copies the UDX, along with any dependent files or libraries, to all the compute nodes or slices in your system for execution on their respective portions of loaded data.
For example, the following command compiles a divReg.cpp
file and generates divReg.so
.
./opt/anzograph/bin/azg_extfn_compile /home/user/cpp/divReg.cpp
After generating the shared object files for new extensions, see Loading UDXs into AnzoGraph for instructions on loading shared object files into AnzoGraph, to register new extensions and make them available from within AnzoGraph.
After starting up AnzoGraph, you can examine the boot log file to see what extensions have been scanned and registered.

Work in progress...