# computerhistory/alexnet-source-code architecture

> Architecture diagram of the GitHub repository computerhistory/alexnet-source-code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/computerhistory/alexnet-source-code
- Repository: https://github.com/computerhistory/alexnet-source-code

## Overview

This is the original 2012 AlexNet/CUDA-convnet codebase: a GPU convolutional-network system for training and evaluating image classifiers. The principal workflow is to configure a model and data provider, prepare image batches, run training or testing through the ConvNet orchestration layer and native backend, and inspect or score predictions. Separate provider implementations cover ImageNet, CIFAR, Flickr, and JPEG inputs; model-layer parsing and prediction inspection are distinct capabilities. Edges are limited to relationships visible in the excerpts or source index; native engine internals are represented without asserting unsampled call paths.

Main entry points: [`convnet.py`](https://github.com/computerhistory/alexnet-source-code/blob/main/convnet.py) (ConvNet runner), [`src/convnet.cu`](https://github.com/computerhistory/alexnet-source-code/blob/main/src/convnet.cu) (CUDA model engine), [`src/worker.cu`](https://github.com/computerhistory/alexnet-source-code/blob/main/src/worker.cu) (GPU workers), [`shownet.py`](https://github.com/computerhistory/alexnet-source-code/blob/main/shownet.py) (Prediction inspector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Image data"]
  node_imagenet["ImageNet provider<br/>[convdata.py]"]
  node_cifar["CIFAR provider<br/>[convdata_cifar.py]"]
  node_flickr["Flickr provider<br/>[convdata_flickr.py]"]
  node_jpeg["JPEG provider<br/>[convdata_jpeg.py]"]
end

subgraph group_model["Model orchestration"]
  node_convnet["ConvNet runner<br/>[convnet.py]"]
  node_layers["Layer definitions<br/>[layer.py]"]
  node_configs["Network configurations"]
end

subgraph group_engine["Native compute"]
  node_gpu["CUDA model engine<br/>[convnet.cu]"]
  node_workers["GPU workers<br/>[worker.cu]"]
  node_kernels["Layer kernels<br/>[layer_kernels.cu]"]
  node_costs["Training costs<br/>[cost.cu]"]
  node_weights["Weights<br/>[weights.cu]"]
  node_neurons["Neuron operations<br/>[neuron.cu]"]
  node_learning["Learning rates<br/>[lr.cu]"]
  node_quantizer["Quantization<br/>[quantizer.cu]"]
  node_tree["Tree softmax<br/>[softmaxtree.cu]"]
  node_multisoft["Multi-softmax<br/>[multisoftmax.cpp]"]
end

subgraph group_analysis["Evaluation and inspection"]
  node_viewer["Prediction inspector<br/>[shownet.py]"]
  node_averager["Validation averaging<br/>[avg-valid.py]"]
end

node_user(("Researcher"))

node_user -.->|"configures and runs"| node_convnet
node_convnet -->|"parses layers"| node_layers
node_convnet -->|"registers provider"| node_imagenet
node_convnet -->|"imports provider"| node_cifar
node_convnet -->|"imports provider"| node_flickr
node_convnet -->|"imports provider"| node_jpeg
node_convnet -->|"loads backend"| node_gpu
node_user -.->|"selects configuration"| node_configs
node_convnet -.->|"dispatches batches"| node_workers
node_workers -.->|"runs operations"| node_kernels
node_gpu -.->|"computes objectives"| node_costs
node_gpu -.->|"updates parameters"| node_weights
node_gpu -.->|"computes activations"| node_neurons
node_gpu -.->|"uses schedules"| node_learning
node_gpu -.->|"uses quantization"| node_quantizer
node_gpu -.->|"uses tree objective"| node_tree
node_gpu -.->|"uses multi-softmax"| node_multisoft
node_viewer -->|"uses model API"| node_convnet
node_user -.->|"inspects predictions"| node_viewer
node_user -.->|"scores predictions"| node_averager

click node_convnet "https://github.com/computerhistory/alexnet-source-code/blob/main/convnet.py"
click node_layers "https://github.com/computerhistory/alexnet-source-code/blob/main/layer.py"
click node_imagenet "https://github.com/computerhistory/alexnet-source-code/blob/main/convdata.py"
click node_cifar "https://github.com/computerhistory/alexnet-source-code/blob/main/convdata_cifar.py"
click node_flickr "https://github.com/computerhistory/alexnet-source-code/blob/main/convdata_flickr.py"
click node_jpeg "https://github.com/computerhistory/alexnet-source-code/blob/main/convdata_jpeg.py"
click node_gpu "https://github.com/computerhistory/alexnet-source-code/blob/main/src/convnet.cu"
click node_workers "https://github.com/computerhistory/alexnet-source-code/blob/main/src/worker.cu"
click node_kernels "https://github.com/computerhistory/alexnet-source-code/blob/main/src/layer_kernels.cu"
click node_costs "https://github.com/computerhistory/alexnet-source-code/blob/main/src/cost.cu"
click node_weights "https://github.com/computerhistory/alexnet-source-code/blob/main/src/weights.cu"
click node_neurons "https://github.com/computerhistory/alexnet-source-code/blob/main/src/neuron.cu"
click node_learning "https://github.com/computerhistory/alexnet-source-code/blob/main/src/lr.cu"
click node_quantizer "https://github.com/computerhistory/alexnet-source-code/blob/main/src/quantizer.cu"
click node_tree "https://github.com/computerhistory/alexnet-source-code/blob/main/src/softmaxtree.cu"
click node_multisoft "https://github.com/computerhistory/alexnet-source-code/blob/main/src/multisoftmax.cpp"
click node_viewer "https://github.com/computerhistory/alexnet-source-code/blob/main/shownet.py"
click node_averager "https://github.com/computerhistory/alexnet-source-code/blob/main/avg-valid.py"
click node_configs "https://github.com/computerhistory/alexnet-source-code/tree/main/layers"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_imagenet,node_cifar,node_flickr,node_jpeg toneBlue
class node_convnet,node_layers,node_configs toneAmber
class node_gpu,node_workers,node_kernels,node_costs,node_weights,node_neurons,node_learning,node_quantizer,node_tree,node_multisoft toneMint
class node_viewer,node_averager toneRose
class node_user toneIndigo
```

## Components

### Image data

- [ImageNet provider](https://github.com/computerhistory/alexnet-source-code/blob/main/convdata.py): `convdata.py`
- [CIFAR provider](https://github.com/computerhistory/alexnet-source-code/blob/main/convdata_cifar.py): `convdata_cifar.py`
- [Flickr provider](https://github.com/computerhistory/alexnet-source-code/blob/main/convdata_flickr.py): `convdata_flickr.py`
- [JPEG provider](https://github.com/computerhistory/alexnet-source-code/blob/main/convdata_jpeg.py): `convdata_jpeg.py`

### Model orchestration

- [ConvNet runner](https://github.com/computerhistory/alexnet-source-code/blob/main/convnet.py): `convnet.py`
- [Layer definitions](https://github.com/computerhistory/alexnet-source-code/blob/main/layer.py): `layer.py`
- [Network configurations](https://github.com/computerhistory/alexnet-source-code/tree/main/layers): `layers`

### Native compute

- [CUDA model engine](https://github.com/computerhistory/alexnet-source-code/blob/main/src/convnet.cu): `src/convnet.cu`
- [GPU workers](https://github.com/computerhistory/alexnet-source-code/blob/main/src/worker.cu): `src/worker.cu`
- [Layer kernels](https://github.com/computerhistory/alexnet-source-code/blob/main/src/layer_kernels.cu): `src/layer_kernels.cu`
- [Training costs](https://github.com/computerhistory/alexnet-source-code/blob/main/src/cost.cu): `src/cost.cu`
- [Weights](https://github.com/computerhistory/alexnet-source-code/blob/main/src/weights.cu): `src/weights.cu`
- [Neuron operations](https://github.com/computerhistory/alexnet-source-code/blob/main/src/neuron.cu): `src/neuron.cu`
- [Learning rates](https://github.com/computerhistory/alexnet-source-code/blob/main/src/lr.cu): `src/lr.cu`
- [Quantization](https://github.com/computerhistory/alexnet-source-code/blob/main/src/quantizer.cu): `src/quantizer.cu`
- [Tree softmax](https://github.com/computerhistory/alexnet-source-code/blob/main/src/softmaxtree.cu): `src/softmaxtree.cu`
- [Multi-softmax](https://github.com/computerhistory/alexnet-source-code/blob/main/src/multisoftmax.cpp): `src/multisoftmax.cpp`

### Evaluation and inspection

- [Prediction inspector](https://github.com/computerhistory/alexnet-source-code/blob/main/shownet.py): `shownet.py`
- [Validation averaging](https://github.com/computerhistory/alexnet-source-code/blob/main/avg-valid.py): `avg-valid.py`

### Other components

- **Researcher**

## Connections

- Researcher → ConvNet runner: configures and runs
- ConvNet runner → Layer definitions: parses layers (evidence: `convnet.py`)
- ConvNet runner → ImageNet provider: registers provider (evidence: `convnet.py`)
- ConvNet runner → CIFAR provider: imports provider (evidence: `convnet.py`)
- ConvNet runner → Flickr provider: imports provider (evidence: `convnet.py`)
- ConvNet runner → JPEG provider: imports provider (evidence: `convnet.py`)
- ConvNet runner → CUDA model engine: loads backend (evidence: `convnet.py`)
- Researcher → Network configurations: selects configuration
- ConvNet runner → GPU workers: dispatches batches
- GPU workers → Layer kernels: runs operations
- CUDA model engine → Training costs: computes objectives
- CUDA model engine → Weights: updates parameters
- CUDA model engine → Neuron operations: computes activations
- CUDA model engine → Learning rates: uses schedules
- CUDA model engine → Quantization: uses quantization
- CUDA model engine → Tree softmax: uses tree objective
- CUDA model engine → Multi-softmax: uses multi-softmax
- Prediction inspector → ConvNet runner: uses model API (evidence: `shownet.py`)
- Researcher → Prediction inspector: inspects predictions
- Researcher → Validation averaging: scores predictions
