ToolTech Software
CorTeXA ToolTech Software libraryC++ / MODELS / LEARNING

CORTeX / ONLINE MANUAL

Programmer’s manual

Core concepts and entry points for building with CorTeX.

1. The library

CorTeX is ToolTech Software’s C++ library for computational models, neural networks and genetic learning. It is built on GizmoSDK foundation types, containers and reference ownership.

The central workflow is to describe a model, bind its application data, generate the required programs and then evaluate or train it. Model structure, runtime state and learning strategy have separate responsibilities.

  1. Author the graph
  2. Build the model
  3. Compile CAL
  4. Evaluate or train

Include ctxLibrary.h as the public entry header. Use the class reference for exact overloads and types; the excerpts below explain composition rather than forming a complete application.

2. Graphs and expressions

Generation 2 provides explicit graph construction through ctxGraph and operator-based composition using ctxLayer and ctxGraf. Both author supported model structure. The expression is evaluated while constructing that structure; it does not replace the compiled runtime.

Compose layers

ctxGraf layers =
    Dense(64).activation(Tanh()).named("hidden/0")
  + Dense(32).activation(Tanh()).named("hidden/1");

ctxGraph graph;
graph = layers;

Dense(...) describes a layer, activation(...) selects its activation, and named(...) gives it a semantic name. Sequential + composes the layer occurrences into a graph. Reusing a layer description does not implicitly share trainable parameters; sharing is an explicit choice.

Construct the graph explicitly

ctxGraph graph;
if (!graph.addDense("hidden/0", 64, CTX_NEURON_TYPE_TANH)
 || !graph.addDense("hidden/1", 32, CTX_NEURON_TYPE_TANH))
{
    // Report graph.getError() to the application.
    return FALSE;
}

These two fragments describe the same sequence of hidden layers. Choose the style that suits the application’s authoring workflow. Inputs, target data and output bindings are prepared separately when the model is built.

The maintained Simple example uses both styles and compares their canonical graph signatures. The Convolution example demonstrates the same authoring/training separation for an image-oriented model.

3. Model lifecycle

ctxModel connects the authored graph to runtime execution. A typical application follows these steps:

  1. Construct and validate the graph.
  2. Prepare input and output bindings for the application’s data.
  3. Call build(...) to realize the graph and bindings.
  4. Choose a compile profile and execution mode, then call compile(...).
  5. Evaluate the model or install and prepare a trainer.
  6. Read results and save the appropriate parameters or checkpoint.

Each operation can fail. Check the returned status and the corresponding error before advancing. Preserve the distinction between graph identity, model parameters and backend-specific execution state.

The API also exposes explicit build, compile and propagation request/result objects. Propagation concerns derivative and update programs; it is distinct from generating forward evaluation programs. Consult the selected overload and profile rather than assuming every workflow uses the same sequence.

4. Learning

CorTeX supports both backpropagation and genetic parameter learning. A model owns one installed ctxTrainer strategy. The common lifecycle supports preparation, bounded training steps, completion and checkpoints.

Backpropagation

ctxBackpropTrainer updates parameters using derivatives of the selected objective. Configure learning rate, batching and the relevant training policy through typed options.

Genetic learning

ctxGeneticTrainer evaluates candidate parameter sets through the model’s evaluation program. Population selection and variation explore the parameter space without requiring a gradient-based update for each candidate.

The implemented genetic path works with a fixed, already-authored topology. Automatic topology evolution and automatic switching between genetic and gradient training are separate development directions, not implied by selecting a genetic trainer.

Continue deliberately

Distinguish a fresh run, parameter loading and checkpoint continuation. A checkpoint can include optimizer or population state and training progress. Changing the data or learning policy requires an explicit compatibility decision; a parameter file alone does not reproduce a training session.

5. Execution and CAL

Supported model descriptions are lowered into CorTeX Assembler Language (CAL). ctxContext provides the runtime contract: programs, register banks, parameters and execution state.

The virtual machine is the semantic reference. Compiler/backend implementations include CPU-oriented paths, C++ export, OpenCL and CUDA. Their availability and supported profiles depend on the build and selected operation set; the existence of a backend class is not an all-platform compatibility guarantee.

Keep backend synchronization explicit when reading results. Code should use the documented result-access and memory ownership contracts rather than assuming that device execution has already made every buffer available to the host.

6. Data and persistence

The data API separates datasets, splits, batches and model bindings. ctxDataLoader prepares batches from a dataset and split. Input and target bindings connect those batches to a model.

Keep training and validation data separate, and record the sample ordering when reproducibility matters. Paired input and target values must refer to the same sample.

Graph/topology
The supported structural description and semantic identity of the model.
Parameters
Learned values belonging to a compatible model.
Checkpoint
The state needed to continue a compatible training session.

Graph XML, parameter files and trainer checkpoints serve different purposes. Supported persistence depends on the operation types and schema involved. Validate compatibility before loading into a changed model.

7. Integration and extensions

CorTeX uses GizmoSDK’s object model, scalar types, containers and reference-counted ownership. Establish ownership of reference-counted model, trainer and data objects before passing them to APIs that retain them.

Application data can be integrated through the input/output and dataset interfaces. More advanced integration includes registered operation contracts and ctxCompiler backends. Use the documented extension point and preserve the distinction between model semantics and acceleration.

The maintained Windows workspace families are Visual Studio 17 and 18. Confirm the required GizmoSDK checkout, compiler, CUDA/OpenCL dependencies and operation/profile support for the intended build. Runtime selection of the VM does not automatically remove build-time accelerator dependencies.

8. Generation 2 scope

Generation 2 modernizes authoring and model realization while preserving the shared CAL/runtime boundary. Current examples exercise graph and expression construction with backpropagation or genetic trainers.

The broader architecture also explores richer layer lowering, extensible data pipelines, recurrent execution, topology evolution and cross-layer observability. These capabilities have different implementation status and should not be treated as one completed feature set.

For exact interfaces, consult the class reference. For changes and compatibility notes, consult the change history.