Skip to content

Commit 5556fff

Browse files
committed
full progress update from my end under docs
1 parent 2e0a6d0 commit 5556fff

1 file changed

Lines changed: 71 additions & 1 deletion

File tree

docs/kimon_updates.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The hypothesis for the prey hydra effect is that increased mortality forces prey
9999

100100
### HPC Script Functionality (```pp_analysis.py```)
101101

102-
Class: ```Config``
102+
Class: ```Config```
103103

104104
Central configuration for analysis. Set grid dimensions, intial densities, resolution, death rate range, replications, warmup period, measurement window, stationarity, PCF sampling rates, mutation rate, fine size scaling grid sizes, and equilibrium scaling
105105

@@ -118,6 +118,7 @@ Structural Reconstruction: ```load_sweep_binary```
118118
Performs the inverse operatiion taking flat binary files and rebuilding the Python list of dictionaries required for plotting.
119119

120120
We use ```np.savez_compressed``` to reduce disk footprint for large arrays such as PCF results.
121+
121122
---
122123

123124

@@ -147,4 +148,73 @@ Since larger systems usually take longer to each SS, we scale the warmup and mea
147148

148149
Phase Space Utility: ```run_2d_sweep```
149150

151+
This is a high-throuput pipeline to generate raw data for boundary identification of the hydra effect and evo advantages.
152+
153+
We construct a massive list of individual sim jobs (tasks) to be executed in parallel.
154+
Iterate through each combination of ```prey_births``` and ```prey_deaths``1.
155+
156+
For each parameter coordinate, we create two jobs:
157+
1. Baseline (no evo)
158+
2. Experimental (with evo)
159+
160+
Before launchng the parallel threads, we warm up the kernels to avoid JIT (Just in Time) Numba Compilation overhead.
161+
162+
Each task calls ```run_single_simulation``` indepdendetly and returns a dict of results collected into a master list.
163+
164+
We compress the results efficiently using ```save_sweep_binary``` to keep a managable output size. We log the metatdat by generating a ```sweep_metadat.json```.
165+
166+
---
167+
168+
169+
Plotting Utility: ```generate_plots```
170+
171+
We resahpe the flat list of results into a grid based on the ```prey_birth``` and ```prey_death``` parameters. We get the mean population across replicates for eevry point and filter out random noise of individual runs. To get derivatives effectively, we use a Gaussian filter to make the Hydra calculation reliable.
172+
173+
The Hydra effect is quantified as follows:
174+
- Use a numerical gradient acorss the smoothed population grid
175+
- Idenitfy the region where the derivative is positive that marks counter-intuitive ecosystem dynamics.
176+
- Compare evo with no-evo sets.
177+
178+
The function also computes spatial and criticality analysis as follows:
179+
- Plot the power law exponent to show near phase transition regime
180+
- Visualize PCF results. A low segregation index indicates predator and prey spatial separation, which indicates the Hydra effect in the CA model
181+
- Overlay the Hydra boundary on top of the segreation heatmap to show correlation between spatial structure and population response (if existing)
182+
183+
184+
We also calculate a relative advantage score to quantify the benifit of adaptation. We highlight regions where the baseline population went extinct but the evo population survived to show "evolutionary rescue".
185+
186+
----
187+
Usage of the analysis script is recommended as follows:
188+
189+
bash
190+
```
191+
python pp_analysis.py --mode full # Run everything
192+
python pp_analysis.py --mode sweep # Only 2D sweep
193+
python pp_analysis.py --mode sensitivity # Only evolution sensitivity
194+
python pp_analysis.py --mode fss # Only finite-size scaling
195+
python pp_analysis.py --mode plot # Only generate plots from saved data
196+
python pp_analysis.py --mode debug # Interactive visualization (local only)
197+
python scripts/pp_analysis.py --dry-run # Estimate runtime without running
198+
```
199+
200+
201+
### Benchmark Results
202+
203+
The HPC script was optimized using JIT compilation.
204+
205+
Numba Kernel Accelaration:
206+
207+
- Speedup: 58.7x performance increase for a 50x50 grid
208+
- Throughput: 1,216 steps per second
209+
210+
Spatial Metrics Refactoring:
211+
212+
- PCF: The cell-list algorithm resulted in a 562.5 speedup on a 75x75 grid
213+
- Cluster metrics: Numba flood-fill algo gave us 24.6x speedup
214+
215+
Directed Hunting Overhead
216+
- Negative ovderhead for larger grids (30-56% less!)
217+
218+
As a resultl, we can probably use a 1000x1000 grid for our HPC simulation!
219+
150220
### Tests

0 commit comments

Comments
 (0)