# derious/cumpc architecture

> Architecture diagram of the GitHub repository derious/cumpc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/derious/cumpc
- Repository: https://github.com/derious/cumpc

## Overview

##### Main Components
a. MPC GPU Computation Module:
- Inside or next to this block, note that CUDA is the underlying technology driving these computations.
b. Key Management Module:
- A block for “mpc_keys” which defines keys and related interfaces (e.g. AES_PRG, FSS keygen, uint128 type etc.) that are crucial for the secure computation protocols.
c. Utility & Communication Layer:
- A component for “MPABY_util.” This module contains helper routines, network communication-related configurations (e.g. util_cmpc_config.h), and any additional support functions.
- That this utility layer is responsible for setting up and managing multi‑machine communication (for example, by reading/modifying the IP addressing in the configuration header).
d. Test/Validation Infrastructure:
- “test” (including folders like test/test_CORE and test/test_mpc) as a separate block. This module is used for compiling and running multiple protocols to validate both correctness and performance.
e. External Dependencies:
- Dependency blocks for external libraries:
– emp‑tool and emp‑ot (which are used for secure computation primitives)
– Eigen (for linear algebra operations required by protocols)
– OpenSSL (likely for cryptographic support)
– CUDA (for GPU acceleration)
- These can be depicted as external services or libraries that feed into your core modules.

##### Relationships & Data Flow
- That the “Utility/Communication Layer” connects to both the MPC module and the external network – this helps in managing communications between two parties (or machines).
- Link the “Test Suite” block to all modules, emphasizing that tests validate functionality and performance.
- External dependency blocks as inputs feeding into these modules, highlighting how empirical tools, Eigen, and OpenSSL are integrated.

## Diagram (Mermaid)

```mermaid
graph TD
    Sys["Secure Two Party Computation on GPU"]:::none

    subgraph "MPC GPU Computation Module"
        direction TB
        M1["MPC GPU Computation (mpc_cuda)"]:::gpu
        F1["fss_cuda.cu"]:::gpu
        F2["mpc_core.cu"]:::gpu
        M1 --> F1
        M1 --> F2
    end

    subgraph "Key Management Module"
        M2["Key Management (mpc_keys)"]:::key
    end

    subgraph "Utility/Communication Layer"
        M3["Utility/Communication Layer (MPABY_util)"]:::util
    end

    subgraph "Infrastructure"
        T["Test Infrastructure (test)"]:::test
        B["Build & Deployment (CMake)"]:::build
    end

    subgraph "External Dependencies"
        E1["emp-tool"]:::ext
        E2["emp-ot"]:::ext
        E3["Eigen"]:::ext
        E4["OpenSSL"]:::ext
        E5["CUDA"]:::ext
    end

    %% Core system connections
    Sys --> M1
    Sys --> M2
    Sys --> M3

    %% Internal module interaction
    M1 -->|"useskeys"| M2
    M3 -->|"managescomm"| M1

    %% Test and Build connectivity
    T --> M1
    T --> M2
    T --> M3
    B --> M1
    B --> M2
    B --> M3
    B --> T

    %% External dependencies feeding into modules
    E1 --> M1
    E2 --> M1
    E3 --> M1
    E5 --> M1
    E4 --> M2

    %% Styles
    classDef gpu fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef key fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef util fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef test fill:#FFFF99,stroke:#000,stroke-width:2px;
    classDef ext fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef build fill:#dda0dd,stroke:#000,stroke-width:2px;
    classDef none fill:#FFFFFF,stroke:#000,stroke-width:2px;

    %% Click Events
    click M1 "https://github.com/derious/cumpc/tree/main/mpc_cuda"
    click F1 "https://github.com/derious/cumpc/blob/main/mpc_cuda/fss_cuda.cu"
    click F2 "https://github.com/derious/cumpc/blob/main/mpc_cuda/mpc_core.cu"
    click M2 "https://github.com/derious/cumpc/tree/main/mpc_keys"
    click M3 "https://github.com/derious/cumpc/tree/main/MPABY_util"
    click T "https://github.com/derious/cumpc/tree/main/test"
    click E1 "https://github.com/derious/cumpc/tree/main/dependence/emp-tool"
    click E2 "https://github.com/derious/cumpc/tree/main/dependence/emp-ot"
    click E3 "https://github.com/derious/cumpc/blob/main/dependence/eigen-3.4.0"
    click B "https://github.com/derious/cumpc/tree/main/build/CMakeFiles"
    click E5 "https://github.com/derious/cumpc/tree/main/build/CMakeFiles"
```
