CIMFlow LogoCIMFlow

Quickstart

End-to-end pipeline tutorial

Before starting, ensure CIMFlow is installed and your virtual environment is activated.


Verify Installation

Confirm CIMFlow is installed correctly:

# Check version
cimflow --version

Expected output:

CIMFlow 0.1.0

Running a Pipeline

This section demonstrates running a complete compile-and-simulate pipeline with an example model.

cd /path/to/CIMFlow

Replace /path/to/CIMFlow with the actual installation directory.

Download Example Models

Example ONNX models are not included in the repository. Download them using the provided script:

./scripts/download_models.sh

This downloads ResNet-18 and MobileNetV2 models to data/models/.

Custom ONNX models exported from PyTorch, TensorFlow, or other frameworks are also supported.

Run Pipeline with Example Model

cimflow run pipeline \
    -m data/models/resnet18.onnx \
    -o output/quickstart \
    -t 8 \
    -k 16 \
    -b 16 \
    -c 64

This compiles ResNet-18 and simulates execution on a 64-core CIM accelerator.

View Results

After completion, check the output:

ls output/quickstart/

The output directory contains simulation results including performance metrics.


Understanding the Output

The simulation produces several key metrics:

MetricDescription
CyclesTotal clock cycles for inference
LatencyExecution time based on target clock frequency
EnergyEstimated energy consumption
ThroughputInferences per second

Detailed breakdowns are available in the output JSON files.


Running with Custom Parameters

Adjust hardware parameters via CLI flags:

cimflow run pipeline \
    -m data/models/mobilenetv2.onnx \
    -o output/mobilenet \
    -t 16 \
    -k 32 \
    -b 8 \
    -c 128 \
    --batch-size 4
FlagParameterDescription
-tTMacro group size
-kKMacro group number
-bBNoC flit size (bandwidth)
-cCCore number
--batch-size-Batch size

For the complete parameter reference, see CLI Reference.


Batch Processing

Run multiple configurations from a JSON file:

Copy template:

cp config_templates/batch.json config/batch.json

Run batch:

Edit config/batch.json with your models and parameters, then run:

cimflow run from-file config/batch.json

Example configuration (update model_path to point to your ONNX model):

config/batch.json
{
  "paths_cfg": "tool_paths.json",
  "output_dir": "output",
  "keep_ir": false,
  "run_name": "batch",
  "runs": [
    {
      "model_path": "path/to/your/model.onnx",
      "t": 8,
      "k": 16,
      "b": 16,
      "c": 64,
      "batch_size": 8,
      "strategy": "dp",
      "visualize": false
    }
  ]
}

Enabling Profiling

Enable profiling for performance breakdowns:

cimflow run pipeline \
    -m data/models/resnet18.onnx \
    -o output/profiled \
    --profile=from-config
Per-Layer Timing
Execution time breakdown for each layer
Memory Bandwidth
Utilization statistics for data movement
Core Activity
Per-core utilization and idle cycles
Energy Breakdown
Energy consumption by component type

Debugging Tips

These options are useful for troubleshooting compilation or simulation issues.

Keep Intermediate Files

cimflow run pipeline -m model.onnx -o output --keep-ir

Saves all IR files, ISA outputs, and logs in timestamped directories.

Enable Debug Mode

cimflow --debug run pipeline -m model.onnx -o output

Produces detailed tracebacks and debug-level logging.

Increase Log Verbosity

cimflow run pipeline -m model.onnx -o output -l VERBOSE

Log levels: TRACE | DEBUG | VERBOSE | INFO | WARNING | ERROR


CLI Quick Reference

CommandDescription
cimflow --helpView all commands
cimflow run pipeline --helpPipeline options
cimflow run from-file --helpBatch processing options
cimflow compile --helpCompile only
cimflow sim --helpSimulate only

Next Steps

Last updated on