Skip to content

Commit 3a9f63d

Browse files
committed
mod phase 2 experiment and new shell script for phase 2
1 parent ea08074 commit 3a9f63d

10 files changed

Lines changed: 261 additions & 827 deletions

File tree

File renamed without changes.

hpc/run_phase2.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/bin/bash
2+
#SBATCH --job-name=pp_phase2
3+
#SBATCH --partition=rome
4+
#SBATCH --nodes=1
5+
#SBATCH --ntasks=1
6+
#SBATCH --cpus-per-task=32
7+
#SBATCH --time=04:00:00
8+
#SBATCH --mem=16G
9+
#SBATCH --output=pp_phase2_%j.out
10+
#SBATCH --error=pp_phase2_%j.err
11+
12+
# =============================================================================
13+
# PP Hydra Effect - Phase 2: Self-Organization (SOC Test)
14+
# =============================================================================
15+
#
16+
# PHASE 2: Test if prey_death evolves toward critical point
17+
# - 6 initial prey_death values × 30 reps = 180 simulations
18+
# - Longer runs (5000 steps) for evolution to equilibrate
19+
# - Tracks evolved_prey_death_timeseries
20+
#
21+
# SUBMIT: sbatch run_phase2.sh
22+
# MONITOR: squeue -u $USER
23+
# CANCEL: scancel <job_id>
24+
#
25+
# =============================================================================
26+
27+
echo "========================================"
28+
echo "PP Hydra Effect - Phase 2"
29+
echo "========================================"
30+
echo "Job ID: $SLURM_JOB_ID"
31+
echo "Node: $(hostname)"
32+
echo "CPUs: $SLURM_CPUS_PER_TASK"
33+
echo "Start: $(date)"
34+
echo "Working dir: $(pwd)"
35+
echo "========================================"
36+
37+
# -----------------------------------------------------------------------------
38+
# Environment Setup
39+
# -----------------------------------------------------------------------------
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 2
51+
# -----------------------------------------------------------------------------
52+
53+
OUTPUT_DIR="results/phase2_${SLURM_JOB_ID}"
54+
mkdir -p $OUTPUT_DIR
55+
56+
echo ""
57+
echo "Output directory: $OUTPUT_DIR"
58+
echo ""
59+
60+
# Dry run first to verify setup
61+
echo "Dry run check:"
62+
python3 -u scripts/experiments.py \
63+
--phase 2 \
64+
--output $OUTPUT_DIR \
65+
--cores $SLURM_CPUS_PER_TASK \
66+
--dry-run
67+
68+
echo ""
69+
echo "Starting Phase 2..."
70+
echo ""
71+
72+
# Run phase 2
73+
python3 -u scripts/experiments.py \
74+
--phase 2 \
75+
--output $OUTPUT_DIR \
76+
--cores $SLURM_CPUS_PER_TASK
77+
78+
# -----------------------------------------------------------------------------
79+
# Completion
80+
# -----------------------------------------------------------------------------
81+
82+
echo ""
83+
echo "========================================"
84+
echo "Phase 2 Complete"
85+
echo "========================================"
86+
echo "End time: $(date)"
87+
echo "Results in: $OUTPUT_DIR/"
88+
echo ""
89+
echo "Output files:"
90+
ls -lh $OUTPUT_DIR/
91+
echo ""
92+
echo "Next steps:"
93+
echo " 1. Download phase2_results.jsonl"
94+
echo " 2. Plot evolved_prey_death_final vs initial prey_death"
95+
echo " 3. Check if all runs converge to ~0.095-0.105 (critical point)"
96+
echo " 4. If SOC confirmed, proceed to Phase 3 (finite-size scaling)"
97+
echo "========================================"

models/config.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Config:
6666
"""Central configuration for all experiments."""
6767

6868
# Grid settings
69-
grid_size: int = 100 #FIXME: Decide default configuration
69+
grid_size: int = 1000 #FIXME: Decide default configuration
7070
densities: Tuple[float, float] = (0.30, 0.15) # (prey, predator) #FIXME: Default densities
7171

7272
# For FSS experiments: multiple grid sizes
@@ -207,16 +207,21 @@ def estimate_runtime(self, n_cores: int = 32) -> str:
207207

208208
# Phase 2: Self-organization (evolution toward criticality)
209209
PHASE2_CONFIG = Config(
210-
grid_size=100,
211-
n_prey_birth=10,
210+
grid_size=1000,
211+
n_prey_birth=1, # Fixed at cfg.prey_birth (0.2)
212212
n_replicates=30,
213-
warmup_steps=1000,
214-
measurement_steps=1000,
213+
warmup_steps=1000, # Shorter warmup (evolution starts immediately)
214+
measurement_steps=3000, # Longer measurement to see convergence
215+
216+
# Evolution settings
215217
with_evolution=True,
216-
evolve_sd=0.10,
217-
collect_pcf=False, # Not needed for SOC analysis
218+
evolve_sd=0.01, # Smaller mutation rate for smoother convergence
219+
evolve_min=0.001,
220+
evolve_max=0.20, # Allow full range
221+
222+
collect_pcf=False,
218223
save_timeseries=True,
219-
timeseries_subsample=10,
224+
timeseries_subsample=10, # Track evolution trajectory
220225
)
221226

222227
# Phase 3: Finite-size scaling at critical point
153 KB
Loading

notebooks/phase1.ipynb

Lines changed: 118 additions & 1 deletion
Large diffs are not rendered by default.

phase1_18676818/experiments.log

Lines changed: 0 additions & 37 deletions
This file was deleted.

phase1_18676818/phase1_config.json

Lines changed: 0 additions & 77 deletions
This file was deleted.

phase1_18676818/phase1_metadata.json

Lines changed: 0 additions & 83 deletions
This file was deleted.

phase1_18676818/phase1_results.jsonl

Lines changed: 0 additions & 600 deletions
This file was deleted.

0 commit comments

Comments
 (0)