diff --git a/measurements/A.py b/measurements/A.py index b7d0fb6e..0db49368 100644 --- a/measurements/A.py +++ b/measurements/A.py @@ -5,6 +5,23 @@ import psutil import sys +# --- Fallback Definitions for Direct Execution --- +# These values are normally injected by copy_with_port_portname.py during study generation. +# When running this script directly, safe defaults are used instead. +_STANDALONE_MODE = False + +if 'PORT_NAME_F1_F2' not in globals(): + PORT_NAME_F1_F2 = "F1_F2" + _STANDALONE_MODE = True + +if 'PORT_F1_F2' not in globals(): + PORT_F1_F2 = "5555" + _STANDALONE_MODE = True + +if _STANDALONE_MODE: + print("Warning: Port variables not injected. Running in standalone mode with default values.") + print(" For full study behavior, run via study generation (makestudy).") + # --- ZMQ Initialization --- # This REQ socket connects to Node B concore.init_zmq_port( diff --git a/measurements/B.py b/measurements/B.py index 8ab05d09..595f3d8b 100644 --- a/measurements/B.py +++ b/measurements/B.py @@ -2,6 +2,31 @@ import concore import time +# --- Fallback Definitions for Direct Execution --- +# These values are normally injected by copy_with_port_portname.py during study generation. +# When running this script directly, safe defaults are used instead. +_STANDALONE_MODE = False + +if 'PORT_NAME_F1_F2' not in globals(): + PORT_NAME_F1_F2 = "F1_F2" + _STANDALONE_MODE = True + +if 'PORT_F1_F2' not in globals(): + PORT_F1_F2 = "5555" + _STANDALONE_MODE = True + +if 'PORT_NAME_F2_F3' not in globals(): + PORT_NAME_F2_F3 = "F2_F3" + _STANDALONE_MODE = True + +if 'PORT_F2_F3' not in globals(): + PORT_F2_F3 = "5556" + _STANDALONE_MODE = True + +if _STANDALONE_MODE: + print("Warning: Port variables not injected. Running in standalone mode with default values.") + print(" For full study behavior, run via study generation (makestudy).") + # --- ZMQ Initialization --- # This REP socket binds and waits for requests from Node A concore.init_zmq_port( diff --git a/measurements/C.py b/measurements/C.py index 1448069d..03337657 100644 --- a/measurements/C.py +++ b/measurements/C.py @@ -5,6 +5,23 @@ import os import sys +# --- Fallback Definitions for Direct Execution --- +# These values are normally injected by copy_with_port_portname.py during study generation. +# When running this script directly, safe defaults are used instead. +_STANDALONE_MODE = False + +if 'PORT_NAME_F2_F3' not in globals(): + PORT_NAME_F2_F3 = "F2_F3" + _STANDALONE_MODE = True + +if 'PORT_F2_F3' not in globals(): + PORT_F2_F3 = "5556" + _STANDALONE_MODE = True + +if _STANDALONE_MODE: + print("Warning: Port variables not injected. Running in standalone mode with default values.") + print(" For full study behavior, run via study generation (makestudy).") + # --- ZMQ Initialization --- # This REP socket binds and waits for requests from Node B concore.init_zmq_port( diff --git a/measurements/readme.md b/measurements/readme.md index f22f9f46..621a296e 100644 --- a/measurements/readme.md +++ b/measurements/readme.md @@ -32,4 +32,7 @@ This folder contains studies and source code specifically for measuring communic Here you will find studies and source code focused on measuring communication times using ZeroMQ within a single system setup. # Network Communication Measurements (Two Systems Required) -For the Latency, Throughput, and CPU Usage measurements, two different systems are required. These systems should be connected over the same network to ensure efficient and accurate communication measurements between them. This setup is crucial for evaluating network-dependent performance metrics effectively. \ No newline at end of file +For the Latency, Throughput, and CPU Usage measurements, two different systems are required. These systems should be connected to the same network to ensure efficient, accurate communication between them. This setup is crucial for effectively evaluating network-dependent performance metrics. + +# Important Note on Port Variables +The measurement benchmark scripts (A.py, B.py, C.py) expect port variables such as `PORT_NAME_F1_F2`, `PORT_F1_F2`, `PORT_NAME_F2_F3`, and `PORT_F2_F3` to be injected by `copy_with_port_portname.py` during study generation. Running these scripts directly will use safe fallback defaults and may not reflect full study behavior. For accurate results, always run measurements through the study generation workflow (e.g., `makestudy`).