# princetonuniversity/psyneulink architecture

> Architecture diagram of the GitHub repository princetonuniversity/psyneulink, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/princetonuniversity/psyneulink
- Repository: https://github.com/princetonuniversity/psyneulink

## Overview

##### Main System Components

a) Core Layer
- Components (Mechanisms, Ports, Projections, Functions)
- Compositions (System organization and workflow)
- Scheduling & Control
- LLVM Integration (Compilation subsystem)

b) Library Layer
- Extended Components
- Pre-built Models
- Integration Interfaces (PyTorch, etc.)

c) Interface Layer
- API Surface
- Model Description Format (MDF)
- RPC Services

##### Component Details

Core Components Section:
**[Mechanisms]**
- Processing Mechanisms
- Modulatory Mechanisms
- Control Mechanisms

**[Ports]**
- Input Ports
- Output Ports
- Parameter Ports
- Modulatory Ports

**[Projections]**
- Pathway Projections
- Modulatory Projections

##### Integration Points

External system connections:
- PyTorch Integration
- LLVM Compilation Pipeline
- MDF Export/Import
- RPC Services

##### Specific Implementation Details

Specialized subsystems:
- Parameter Estimation
- Compilation Pipeline
- Scheduling System
- Learning Mechanisms

##### Data Flow Patterns

Highlight:
- Component interaction paths
- Control signal flow
- Learning signal propagation
- Compilation optimization paths

##### Key Design Patterns

Emphasize:
- Component composition pattern
- Modular architecture
- Plugin system for extensions
- Scheduling and execution flow

##### Implementation Notes

- Clear separation between core and extension components
- Modular nature of the system
- Demonstrate the compilation pipeline
- Integration capabilities

This system design should be implemented using a professional diagramming tool that supports:
- Nested components
- Multiple relationship types
- Custom styling
- Clear typography
- High resolution export

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#d0e1f9,stroke:#333
    classDef library fill:#d4edda,stroke:#333
    classDef interface fill:#fff3cd,stroke:#333
    classDef control fill:#e7d9f9,stroke:#333
    classDef external fill:#f8d7da,stroke:#333

    %% Core Layer
    subgraph CoreLayer
        BaseComponents["Base Components"]
        Mechanisms["Mechanisms"]
        Ports["Ports"]
        Projections["Projections"]
        Functions["Functions"]
        
        CompSystem["Composition System"]
        Scheduling["Scheduling"]
        Parameters["Parameter System"]
        
        LLVM["LLVM Core"]
        Compilation["Compilation"]
        JITEngine["JIT Engine"]
    end

    %% Library Layer
    subgraph LibraryLayer
        ExtComponents["Extended Components"]
        PrebuiltModels["Pre-built Models"]
        IntegrationInterfaces["Integration Interfaces"]
    end

    %% Interface Layer
    subgraph InterfaceLayer
        MDF["Model Description Format"]
        RPC["RPC Services"]
        API["API Surface"]
    end

    %% Control Systems
    subgraph ControlSystems
        ControlMech["Control Mechanisms"]
        LearningSystem["Learning Systems"]
        Gating["Gating"]
    end

    %% Core Infrastructure
    subgraph Infrastructure
        Context["Context Management"]
        Registry["Registry"]
        Preferences["Preferences"]
    end

    %% Relationships
    BaseComponents --> Mechanisms
    BaseComponents --> Ports
    BaseComponents --> Projections
    BaseComponents --> Functions
    
    CompSystem --> Scheduling
    CompSystem --> Parameters
    
    LLVM --> Compilation
    LLVM --> JITEngine
    
    ControlMech --> Gating
    ControlMech --> LearningSystem
    
    API --> MDF
    API --> RPC
    
    CompSystem --> LLVM
    Mechanisms --> ControlSystems
    BaseComponents --> ExtComponents
    ExtComponents --> PrebuiltModels
    PrebuiltModels --> IntegrationInterfaces
    
    Context --> Registry
    Registry --> Preferences
    
    %% Click Events
    click BaseComponents "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/components/"
    click Mechanisms "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/components/mechanisms/"
    click Ports "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/components/ports/"
    click Projections "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/components/projections/"
    click Functions "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/components/functions/"
    click CompSystem "https://github.com/PrincetonUniversity/PsyNeuLink/blob/master/psyneulink/core/compositions/composition.py"
    click Scheduling "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/scheduling/"
    click Parameters "https://github.com/PrincetonUniversity/PsyNeuLink/blob/master/psyneulink/core/globals/parameters.py"
    click LLVM "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/llvm/"
    click Compilation "https://github.com/PrincetonUniversity/PsyNeuLink/blob/master/psyneulink/core/llvm/codegen.py"
    click JITEngine "https://github.com/PrincetonUniversity/PsyNeuLink/blob/master/psyneulink/core/llvm/jit_engine.py"
    click ExtComponents "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/library/components/"
    click PrebuiltModels "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/library/models/"
    click IntegrationInterfaces "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/library/compositions/"
    click MDF "https://github.com/PrincetonUniversity/PsyNeuLink/blob/master/psyneulink/core/globals/mdf.py"
    click RPC "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/rpc/"
    click API "https://github.com/PrincetonUniversity/PsyNeuLink/blob/master/psyneulink/core/__init__.py"
    click ControlMech "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/components/mechanisms/modulatory/control/"
    click LearningSystem "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/components/mechanisms/modulatory/learning/"
    click Gating "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/components/mechanisms/modulatory/control/gating/"
    click Context "https://github.com/PrincetonUniversity/PsyNeuLink/blob/master/psyneulink/core/globals/context.py"
    click Registry "https://github.com/PrincetonUniversity/PsyNeuLink/blob/master/psyneulink/core/globals/registry.py"
    click Preferences "https://github.com/PrincetonUniversity/PsyNeuLink/tree/master/psyneulink/core/globals/preferences/"

    %% Style Applications
    class BaseComponents,Mechanisms,Ports,Projections,Functions,CompSystem,Scheduling,Parameters,LLVM,Compilation,JITEngine core
    class ExtComponents,PrebuiltModels,IntegrationInterfaces library
    class MDF,RPC,API interface
    class ControlMech,LearningSystem,Gating control
    class Context,Registry,Preferences core
```
