Skip to content

Commit ff0410b

Browse files
authored
Merge pull request #19 from codegithubka/kimon
Kimon
2 parents 1369f14 + 1f6b450 commit ff0410b

17 files changed

Lines changed: 946 additions & 77 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ results/
1010
.ipynb_checkpoints/
1111
# Data files
1212
data/
13-
.pytest_cache/
13+
.pytest_cache/
14+
15+
.DS_Store

docs/HPC_GUIDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ssh kanagnostopoul@snellius.surf.nl
66
# On a separate terminal run the following
77
88
# Upload the entire project directory (including your models/ folder)
9+
910
rsync -avz --progress --exclude-from='.rsync-exclude' \
1011
~/CSS_Project/ kanagnostopoul@snellius.surf.nl:~/CSS_Project/
1112
@@ -38,7 +39,7 @@ scancel <JOBID>
3839
3940
# Monitoring live progress
4041
41-
tail -f logs_<JOBID>.err
42+
tail -f logs_18702594.err
4243
4344
# Watch task completetion
4445
@@ -47,7 +48,7 @@ watch -n 10 "ls -1 results_JOBID | wc -l"
4748
4849
# Fetching the results once the job is done
4950
50-
scp -r kanagnostopoul@snellius.surf.nl:~/CSS_Project/results/phase1_ 18682575/ ./results/
51+
scp -r kanagnostopoul@snellius.surf.nl:~/CSS_Project/results/phase3_18698382/ ./results/
5152
```
5253

5354
The jobscript template can be found in ```run_analysis.sh``` (default rome paritition).

docs/kimon_updates.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,14 @@ Refactored ```experiments.py``` according to ```experiments.md```. Phase 4 and P
284284

285285
- Phase 6: Will implement if all the other phases pass successfully.
286286

287-
TODO: We need to start drafting a proper version of the analyis (```analysis.py```) for postprocessing of all the data we are currenlty collecting and plotting utilities to visualize them.
287+
TODO: We need to start drafting a proper version of the analyis (```analysis.py```) for postprocessing of all the data we are currenlty collecting and plotting utilities to visualize them.
288+
289+
290+
## Updates (26/1)
291+
292+
Under ```hpc_data``` folder you can find:
293+
294+
- ```../hpc_data/phase1_18677015```
295+
- ```../hpc_data/phase1.5_18682575``` (finer grid but ow same as phase 1)
296+
- ```../hpc_data/phase2_18693004```
297+
- ```../hpc_data/phase3_18698382```

hpc/run_phase2.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
#SBATCH --ntasks=1
66
#SBATCH --cpus-per-task=32
77
#SBATCH --time=04:00:00
8-
#SBATCH --mem=16G
9-
#SBATCH --output=pp_phase2_%j.out
10-
#SBATCH --error=pp_phase2_%j.err
8+
#SBATCH --mem=64G
9+
#SBATCH --output=/home/kanagnostopoul/CSS_Project/pp_phase2_%j.out
10+
#SBATCH --error=/home/kanagnostopoul/CSS_Project/pp_phase2_%j.err
1111

1212
# =============================================================================
1313
# PP Hydra Effect - Phase 2: Self-Organization (SOC Test)

hpc/run_phase3.sh

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/bash
2+
#SBATCH --job-name=pp_phase3
3+
#SBATCH --partition=genoa
4+
#SBATCH --nodes=1
5+
#SBATCH --ntasks=1
6+
#SBATCH --cpus-per-task=64
7+
#SBATCH --time=02:00:00
8+
#SBATCH --mem=64G
9+
#SBATCH --output=/home/kanagnostopoul/CSS_Project/pp_phase3_%j.out
10+
#SBATCH --error=/home/kanagnostopoul/CSS_Project/pp_phase3_%j.err
11+
12+
# =============================================================================
13+
# PP Hydra Effect - Phase 3: Finite-Size Scaling
14+
# =============================================================================
15+
#
16+
# PHASE 3: Test finite-size scaling at critical point
17+
# - Grid sizes: 50, 100, 250, 500, 1000
18+
# - 20 replicates per size = 100 simulations
19+
# - Cluster size distributions for power-law analysis
20+
#
21+
# SUBMIT: sbatch run_phase3.sh
22+
# MONITOR: squeue -u $USER
23+
# CANCEL: scancel <job_id>
24+
#
25+
# =============================================================================
26+
27+
cd /home/kanagnostopoul/CSS_Project || exit 1
28+
29+
echo "========================================"
30+
echo "PP Hydra Effect - Phase 3"
31+
echo "========================================"
32+
echo "Job ID: $SLURM_JOB_ID"
33+
echo "Node: $(hostname)"
34+
echo "CPUs: $SLURM_CPUS_PER_TASK"
35+
echo "Start: $(date)"
36+
echo "Working dir: $(pwd)"
37+
echo "========================================"
38+
# -----------------------------------------------------------------------------
39+
# Environment Setup
40+
# -----------------------------------------------------------------------------
41+
source ~/snellius_venv/bin/activate
42+
43+
# Prevent numpy/scipy from spawning extra threads (joblib handles parallelism)
44+
export OMP_NUM_THREADS=1
45+
export OPENBLAS_NUM_THREADS=1
46+
export MKL_NUM_THREADS=1
47+
export NUMEXPR_NUM_THREADS=1
48+
49+
# -----------------------------------------------------------------------------
50+
# Run Phase 3
51+
# -----------------------------------------------------------------------------
52+
OUTPUT_DIR="results/phase3_${SLURM_JOB_ID}"
53+
mkdir -p $OUTPUT_DIR
54+
55+
echo ""
56+
echo "Output directory: $OUTPUT_DIR"
57+
echo ""
58+
59+
# Dry run first to verify setup
60+
echo "Dry run check:"
61+
python3 -u scripts/experiments.py \
62+
--phase 3 \
63+
--output $OUTPUT_DIR \
64+
--cores $SLURM_CPUS_PER_TASK \
65+
--dry-run
66+
67+
echo ""
68+
echo "Starting Phase 3..."
69+
echo ""
70+
71+
# Run phase 3
72+
python3 -u scripts/experiments.py \
73+
--phase 3 \
74+
--output $OUTPUT_DIR \
75+
--cores $SLURM_CPUS_PER_TASK
76+
77+
# -----------------------------------------------------------------------------
78+
# Completion
79+
# -----------------------------------------------------------------------------
80+
echo ""
81+
echo "========================================"
82+
echo "Phase 3 Complete"
83+
echo "========================================"
84+
echo "End time: $(date)"
85+
echo "Results in: $OUTPUT_DIR/"
86+
echo ""
87+
echo "Output files:"
88+
ls -lh $OUTPUT_DIR/
89+
echo ""
90+
echo "Next steps:"
91+
echo " 1. Download phase3_results.jsonl"
92+
echo " 2. Analyze cluster size distributions P(s) for each grid size"
93+
echo " 3. Fit power-law exponent tau from P(s) ~ s^(-tau)"
94+
echo " 4. Check finite-size cutoff s_max ~ L^D (fractal dimension)"
95+
echo "========================================"

hpc/run_phase4.sh

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/bin/bash
2+
#SBATCH --job-name=pp_phase4
3+
#SBATCH --partition=rome
4+
#SBATCH --nodes=1
5+
#SBATCH --ntasks=1
6+
#SBATCH --cpus-per-task=64
7+
#SBATCH --time=08:00:00
8+
#SBATCH --mem=16G
9+
#SBATCH --output=/home/kanagnostopoul/CSS_Project/pp_phase4_%j.out
10+
#SBATCH --error=/home/kanagnostopoul/CSS_Project/pp_phase4_%j.err
11+
12+
# =============================================================================
13+
# PP Hydra Effect - Phase 4: Global Sensitivity Analysis
14+
# =============================================================================
15+
#
16+
# PHASE 4: Full 4D Parameter Sweep (Global Sensitivity)
17+
# - Parameters: prey_birth, prey_death, pred_birth, pred_death
18+
# - Sweep: 0.0 to 1.0 (11 values each) = 14,641 combinations
19+
# - Replicates: 10 per combination
20+
# - Total Simulations: ~146,410
21+
# - Grid Size: 250x250
22+
#
23+
# SUBMIT: sbatch run_phase4.sh
24+
# MONITOR: squeue -u $USER
25+
# CANCEL: scancel <job_id>
26+
#
27+
# =============================================================================
28+
29+
cd /home/kanagnostopoul/CSS_Project || exit 1
30+
31+
echo "========================================"
32+
echo "PP Hydra Effect - Phase 4"
33+
echo "========================================"
34+
echo "Job ID: $SLURM_JOB_ID"
35+
echo "Node: $(hostname)"
36+
echo "CPUs: $SLURM_CPUS_PER_TASK"
37+
echo "Start: $(date)"
38+
echo "Working dir: $(pwd)"
39+
echo "========================================"
40+
41+
# -----------------------------------------------------------------------------
42+
# Environment Setup
43+
# -----------------------------------------------------------------------------
44+
source ~/snellius_venv/bin/activate
45+
46+
# Prevent numpy/scipy from spawning extra threads (joblib handles parallelism)
47+
export OMP_NUM_THREADS=1
48+
export OPENBLAS_NUM_THREADS=1
49+
export MKL_NUM_THREADS=1
50+
export NUMEXPR_NUM_THREADS=1
51+
52+
# -----------------------------------------------------------------------------
53+
# Run Phase 4
54+
# -----------------------------------------------------------------------------
55+
OUTPUT_DIR="results/phase4_${SLURM_JOB_ID}"
56+
mkdir -p $OUTPUT_DIR
57+
58+
echo ""
59+
echo "Output directory: $OUTPUT_DIR"
60+
echo ""
61+
62+
# Dry run first to verify setup and runtime estimate
63+
echo "Dry run check:"
64+
python3 -u scripts/experiments.py \
65+
--phase 4 \
66+
--output $OUTPUT_DIR \
67+
--cores $SLURM_CPUS_PER_TASK \
68+
--dry-run
69+
70+
echo ""
71+
echo "Starting Phase 4 (4D Sweep)..."
72+
echo ""
73+
74+
# Run phase 4
75+
python3 -u scripts/experiments.py \
76+
--phase 4 \
77+
--output $OUTPUT_DIR \
78+
--cores $SLURM_CPUS_PER_TASK
79+
80+
# -----------------------------------------------------------------------------
81+
# Completion
82+
# -----------------------------------------------------------------------------
83+
echo ""
84+
echo "========================================"
85+
echo "Phase 4 Complete"
86+
echo "========================================"
87+
echo "End time: $(date)"
88+
echo "Results in: $OUTPUT_DIR/"
89+
echo ""
90+
echo "Output files:"
91+
ls -lh $OUTPUT_DIR/
92+
echo ""
93+
echo "Next steps:"
94+
echo " 1. Download phase4_results.jsonl"
95+
echo " 2. Perform Global Sensitivity Analysis (Sobol Indices)"
96+
echo " 3. Identify parameter dominance for extinction events"
97+
echo " 4. Plot parameter heatmaps for predator/prey survival"
98+
echo "========================================"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2026-01-26 15:14:41,338 [INFO] ============================================================
2+
2026-01-26 15:14:41,338 [INFO] PREDATOR-PREY HYDRA EFFECT EXPERIMENTS
3+
2026-01-26 15:14:41,338 [INFO] ============================================================
4+
2026-01-26 15:14:41,338 [INFO] Phases: [2]
5+
2026-01-26 15:14:41,338 [INFO] Output: results/phase2_18693004
6+
2026-01-26 15:14:41,338 [INFO] Cores: 32
7+
2026-01-26 15:14:41,338 [INFO] Numba: ENABLED
8+
2026-01-26 15:14:41,338 [INFO]
9+
2026-01-26 15:14:41,338 [INFO] ============================================================
10+
2026-01-26 15:14:41,339 [INFO] PHASE 2
11+
2026-01-26 15:14:41,339 [INFO] ============================================================
12+
2026-01-26 15:14:41,339 [INFO] Estimated: 100 sims, ~0.4h on 32 cores (~14 core-hours)
13+
2026-01-26 15:14:41,339 [INFO] Dry run - skipping execution
14+
2026-01-26 15:14:41,339 [INFO]
15+
2026-01-26 15:14:41,339 [INFO] ============================================================
16+
2026-01-26 15:14:41,339 [INFO] EXPERIMENTS COMPLETE
17+
2026-01-26 15:14:41,339 [INFO] ============================================================
18+
2026-01-26 15:14:42,518 [INFO] ============================================================
19+
2026-01-26 15:14:42,518 [INFO] PREDATOR-PREY HYDRA EFFECT EXPERIMENTS
20+
2026-01-26 15:14:42,518 [INFO] ============================================================
21+
2026-01-26 15:14:42,518 [INFO] Phases: [2]
22+
2026-01-26 15:14:42,518 [INFO] Output: results/phase2_18693004
23+
2026-01-26 15:14:42,518 [INFO] Cores: 32
24+
2026-01-26 15:14:42,518 [INFO] Numba: ENABLED
25+
2026-01-26 15:14:42,518 [INFO]
26+
2026-01-26 15:14:42,518 [INFO] ============================================================
27+
2026-01-26 15:14:42,518 [INFO] PHASE 2
28+
2026-01-26 15:14:42,518 [INFO] ============================================================
29+
2026-01-26 15:14:42,518 [INFO] Estimated: 100 sims, ~0.4h on 32 cores (~14 core-hours)
30+
2026-01-26 15:14:48,474 [INFO] Phase 2: 200 simulations
31+
2026-01-26 15:14:48,475 [INFO] prey_birth value: 0.2
32+
2026-01-26 15:14:48,475 [INFO] initial prey_death values: 20
33+
2026-01-26 15:14:48,475 [INFO] Replicates: 10
34+
2026-01-26 15:49:17,385 [INFO] Phase 2 complete. Results: results/phase2_18693004/phase2_results.jsonl
35+
2026-01-26 15:49:17,403 [INFO] Phase 2 runtime: 34.6 minutes
36+
2026-01-26 15:49:17,403 [INFO]
37+
2026-01-26 15:49:17,403 [INFO] ============================================================
38+
2026-01-26 15:49:17,403 [INFO] EXPERIMENTS COMPLETE
39+
2026-01-26 15:49:17,403 [INFO] ============================================================
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"grid_size": 1000,
3+
"densities": [
4+
0.3,
5+
0.15
6+
],
7+
"grid_sizes": [
8+
50,
9+
100,
10+
250,
11+
500,
12+
1000,
13+
2500
14+
],
15+
"prey_birth": 0.2,
16+
"prey_death": 0.05,
17+
"predator_birth": 0.8,
18+
"predator_death": 0.05,
19+
"critical_prey_birth": 0.2,
20+
"critical_prey_death": 0.0963,
21+
"prey_death_range": [
22+
0.0,
23+
0.2
24+
],
25+
"n_prey_birth": 1,
26+
"n_prey_death": 5,
27+
"predator_birth_values": [
28+
0.15,
29+
0.2,
30+
0.25,
31+
0.3
32+
],
33+
"predator_death_values": [
34+
0.05,
35+
0.1,
36+
0.15,
37+
0.2
38+
],
39+
"prey_death_offsets": [
40+
-0.02,
41+
-0.01,
42+
0.0,
43+
0.01,
44+
0.02
45+
],
46+
"n_replicates": 10,
47+
"warmup_steps": 1000,
48+
"measurement_steps": 5000,
49+
"with_evolution": true,
50+
"evolve_sd": 0.01,
51+
"evolve_min": 0.0,
52+
"evolve_max": 0.2,
53+
"sensitivity_sd_values": [
54+
0.02,
55+
0.05,
56+
0.1,
57+
0.15,
58+
0.2
59+
],
60+
"synchronous": false,
61+
"directed_hunting": false,
62+
"directed_hunting_values": [
63+
false,
64+
true
65+
],
66+
"save_timeseries": false,
67+
"timeseries_subsample": 10,
68+
"collect_pcf": false,
69+
"pcf_sample_rate": 0.2,
70+
"pcf_max_distance": 20.0,
71+
"pcf_n_bins": 20,
72+
"min_density_for_analysis": 0.002,
73+
"perturbation_magnitude": 0.1,
74+
"n_jobs": 32
75+
}

0 commit comments

Comments
 (0)