8000 Fix core simulation and modernize PyG environment by GeminiLight · Pull Request #52 · GeminiLight/virne · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
F438
19 changes: 11 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,29 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11']
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[pyg-cpu]
pip install pytest
pip install hydra-core
python -m pip install torch==2.11.0 --index-url https://download.pytorch.org/whl/cpu
python -m pip install --editable . pytest
python -m pip check

- name: Test CLI (help)
run: |
python -m virne --help || true
- name: Test installed package
working-directory: /tmp
run: python -c "import torch, torch_geometric, virne; assert torch.__version__.startswith('2.11.'); assert torch_geometric.__version__ == '2.8.0.post1'"

- name: Run all tests
run: |
pytest tests
python -m pytest tests
3 changes: 2 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ build:
jobs:
post_install:
- python -m pip install --upgrade pip setuptools
- python -m pip install torch==2.11.0 --index-url https://download.pytorch.org/whl/cpu
- python -m pip install --no-build-isolation --editable .
- python -m pip install -r docs/requirements.txt

Expand All @@ -19,4 +20,4 @@ sphinx:

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf
# - pdf
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,30 +95,35 @@ Virne offers a unified and comprehensive framework for NFV-RA, with the followin

### Installation

The installation script targets Linux and Python 3.10. Clone the repository,
then create and activate a Conda environment:
The installation script supports CPU environments on Linux and macOS, plus
CUDA 12.6, 12.8, and 13.0 on Linux. Clone the repository, then create and
activate a Python 3.10 or 3.11 environment:

```bash
git clone https://github.com/GeminiLight/virne.git
cd virne
conda create -n virne python=3.10
conda activate virne
python3 -m venv .venv
source .venv/bin/activate
```

Install either the CPU or CUDA 12.4 build:
Install either the CPU build or a supported CUDA build. The script defaults to
CPU and installs PyTorch 2.11.0 with PyG 2.8.0.post1. It also installs the
matching optional PyG acceleration wheels without hard-coding the operating
system or Python ABI:

```bash
# CPU-only PyTorch and PyG
bash install.sh -c cpu

# CUDA 12.4 with PyTorch 2.6.0
bash install.sh -c 12.4
# CUDA 12.6 (use 12.8 or 13.0 when appropriate for your driver and GPU)
bash install.sh -c 12.6
```

Verify the installation from the repository root:
The script installs Virne in editable mode and prints all three versions. You
can verify them again with:

```bash
python -c "import virne; print(virne.__version__)"
python -c "import torch, torch_geometric, virne; print(virne.__version__, torch.__version__, torch_geometric.__version__)"
```

### Run a Small Experiment
Expand Down
27 changes: 27 additions & 0 deletions docs/source/evaluation/metrics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ Virne records both per-event data and run-level summaries. This page connects
the benchmark definitions to the fields that users will find in
``summary.csv``.

Metric Schema Versions
----------------------

New runs use ``metrics.schema_version: 2``. In schema 2, node demand, revenue,
and cost are the sum of every configured node-resource dimension, matching the
link-resource aggregation and the physical resources consumed during
deployment. Historical configurations that omit ``metrics.schema_version``
continue to use schema 1, which divides the node-resource sum by the number of
node-resource attributes. Both per-event records and ``summary.csv`` include
``metric_schema_version`` so results with different semantics are not compared
silently.

Core Metrics
------------

Expand Down Expand Up @@ -95,6 +107,17 @@ Summary Field Reference
* - End-to-end runtime
- ``clock_running_time``
- Wall-clock seconds for the complete run; not solver-only AST.
* - Metric schema
- ``metric_schema_version``
- Resource aggregation semantics used by the run (1 or 2).
* - Failed requests
- ``failure_count``
- Arrived requests that were not accepted.
* - Failure breakdown
- ``early_rejection_count``, ``constraint_failure_count``,
``place_failure_count``, ``route_failure_count``, and
``unknown_failure_count``
- Mutually exclusive categories whose sum equals ``failure_count``.

Output Files
------------
Expand All @@ -107,6 +130,10 @@ Each run normally contains:
* ``records/*.csv``: per-event state, solution, feasibility, resource, and
reward fields.

When an existing aggregate ``solver_summary.csv`` or ``global_summary.csv``
uses an older column layout, Virne preserves it and writes the new rows to a
``-metrics-vN.csv`` file instead of mixing incompatible schemas.

The :doc:`Quickstart <../start/running>` shows the default output
layout. For fair comparisons, keep the PN/VN settings and seeds fixed, report
whether ratios are lifetime weighted, and distinguish simulated time from
Expand Down
36 changes: 21 additions & 15 deletions docs/source/start/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ Installation

.. important::

The installation script currently targets Linux and Python 3.10. Virne
depends on ``gym==0.22.0`` and is not yet compatible with newer Gym APIs.
Virne currently depends on ``gym==0.22.0`` and is not yet compatible with
newer Gym APIs. This constraint is independent of the upgraded PyTorch and
PyG stack. NumPy therefore remains capped below 2.0 until the Gymnasium
migration is complete.

Get the Source
--------------
Expand All @@ -14,38 +16,42 @@ Get the Source
git clone https://github.com/GeminiLight/virne.git
cd virne

Create a Conda Environment
--------------------------
Create a Virtual Environment
----------------------------

.. code-block:: bash

conda create -n virne python=3.10
conda activate virne
python3 -m venv .venv
source .venv/bin/activate

Install with the Script
-----------------------

The installation script currently targets Linux with Python 3.10. It supports a CPU-only environment or CUDA 12.4. Run it from the repository root after activating the Conda environment.
The script supports CPU environments on Linux and macOS, plus CUDA 12.6, 12.8,
and 13.0 on Linux. It installs PyTorch 2.11.0, PyG 2.8.0.post1, and Virne itself
in editable mode. Matching PyG acceleration wheels are selected for the active
platform and Python ABI. Run it from the repository root after activating a
Python 3.10 or 3.11 environment.

.. code-block:: bash

# CPU-only PyTorch and PyG
bash install.sh -c cpu

# CUDA 12.4 with PyTorch 2.6.0
bash install.sh -c 12.4
# CUDA 12.6; 12.8 and 13.0 are also supported
bash install.sh -c 12.6

If ``-c`` is omitted, the script detects an NVIDIA GPU and otherwise installs the CPU build.
If ``-c`` is omitted, the script installs the CPU build. This explicit default
avoids selecting a CUDA runtime that is incompatible with the host driver.

Verify the Installation
-----------------------

Keep the ``virne`` Conda environment active and run this command from the
repository root:
Keep the virtual environment active and run:

.. code-block:: bash

python -c "import virne; print(virne.__version__)"
python -c "import torch, torch_geometric, virne; print(virne.__version__, torch.__version__, torch_geometric.__version__)"

The command should print the installed Virne version. You can then continue to
the :doc:`Quickstart <running>`.
The command should print the installed Virne, PyTorch, and PyG versions. You can
then continue to the :doc:`Quickstart <running>`.
Loading
Loading
0