Accelerated ts.static + added scaling scripts
Summary
Changes
- Optimized the memory scaler and split operations, providing a substantial speedup for ts.static (up to 48% for batches larger than 5000).
- Added scaling scripts for ts.static, ts.relax, and ts.integrate (NVE, NVT) to analyze scaling performance.
- Added tests for memory scaler values for non periodic systems.
- Updated unit tests and tutorials for the batched version of calculate memory scaler.
Results
The figure below shows the speedup achieved for static evaluations, 10-step atomic relaxation, 10-step NVE MD, and 10-step NVT MD. The test is performed for a 8-atom cubic supercell of MgO using the mace-mpa model. Prior results are shown in blue, while new results are shown in red. The speedup is calculated as
speedup (%) = (baseline_time / current_time − 1) × 100. We observe that:
ts.staticachieves a 52.6% speedup for 100,000 structurests.relaxachieves a 4.8% speedup for 1,500 structurests.integrate(NVE) achieves a 0.9% speedup for 10,000 structurests.integrate(NVT) achieves a 1.4% speedup for 10,000 structures
Profiling
The figure below shows a detailed performance profile. Additional optimization can be achieved by disabling the trajectory reporter when not needed, which will be addressed in a separate PR.
Comments
From the scaling plots, we can see that the timings of ts.static and ts.integrate are all consistent with each other. Indeed:
ts.static→ 85s for 100'000 evaluationsts.integrateNVE → 87s for 10'000 structures (10 MD steps each) → 87s for 100'000 evaluationsts.integrateNVT → 89s for 10'000 structures (10 MD steps each) → 89s for 100'000 evaluations
However, when looking at the relaxation:
ts.relax→ 63s for 1'000 structures (10 relax steps each) → 63s for 10'000 evaluations → ~630s for 100'000 evaluations
So ts.relax is about 7x slower than ts.static or ts.integrate. The unbatched FrechetCellFilter clearly contributes to that, and will be the focus on a separate PR.