-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation of the profiling examples
- Loading branch information
Showing
6 changed files
with
152 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Standardized profiling setups for i-PI | ||
====================================== | ||
|
||
This folder contains a few inputs designed to stress-test the i-PI implementation, and determine internal bottlenecks. | ||
To emphasize the overhead associated with the Python implementation and the socket communication, these examples | ||
use dummy drivers that do not compute actual forces, or skip altogether the force evaluation. | ||
|
||
The inputs provided are for very small systems with 8 atoms (so the focus is on the constant overhead of the simulation) | ||
but it's possible to perform runs with an arbitrary number of atoms using `run_profiling.sh natoms`. | ||
The -p option activates wall-clock-time profiling using `yappi`. | ||
|
||
Examples include: | ||
|
||
`classical_md_gas` runs a simple NVE dynamics using an ideal-gas driver | ||
|
||
`classical_md_noff` runs a simple NVE dynamics. sets force weights to zero so there is no forcefield evaluation | ||
|
||
`remd_scpimd_gas` runs a super-duper calculation with replica exchange, constant-pressure NpT ensemble and Suzuki-Chin high-order path integrals | ||
|
||
`remd_scpimd_noff` as above, but without forcefield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
8 | ||
# CELL(abcABC): 50.0 50.0 50.0 90.00000 90.00000 90.00000 | ||
H 0 0 0 | ||
H 0 0 1 | ||
H 0 0 2 | ||
H 0 0 3 | ||
H 0 0 4 | ||
H 0 0 5 | ||
H 0 0 6 | ||
H 0 0 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<simulation verbosity='low' threading='true' safe_stride='100'> | ||
<ffsocket mode='unix' name='dummy.1' pbc='false'> | ||
<latency> 1.00000000e-04</latency> | ||
<address> gas </address> | ||
<exit_on_disconnect> False </exit_on_disconnect> | ||
</ffsocket> | ||
<fflj name='dummy.2' pbc='False'> | ||
<parameters>{eps: 0.0, sigma: 1.0}</parameters> | ||
</fflj> | ||
<total_steps>2000</total_steps> | ||
<output prefix='simulation'> | ||
<trajectory stride='2000' filename='pos'> positions </trajectory> | ||
<properties stride='2000'> [ step, time, conserved, temperature, kinetic_md, potential, pressure_md, volume ] </properties> | ||
</output> | ||
<prng> | ||
<seed>18885</seed> | ||
</prng> | ||
<system_template> | ||
<labels> [ PREFIX, FILENAME, TEMPERATURE, PRESSURE ] </labels> | ||
<instance> [ REF00, init.xyz, 300, 1 ] </instance> | ||
<instance> [ REF01, init.xyz, 310, 1 ] </instance> | ||
<instance> [ REF02, init.xyz, 320, 1 ] </instance> | ||
<instance> [ REF10, init.xyz, 300, 10 ] </instance> | ||
<instance> [ REF11, init.xyz, 310, 10 ] </instance> | ||
<instance> [ REF12, init.xyz, 320, 10 ] </instance> | ||
<template> | ||
<system prefix="PREFIX"> | ||
<initialize nbeads="4"> | ||
<file mode="xyz"> FILENAME </file> | ||
<cell> [10.0, 0, 0, 0, 10.0, 0, 0, 0, 10.0] </cell> | ||
<masses mode='manual'> [1.0] </masses> | ||
<velocities mode="thermal" units="kelvin"> TEMPERATURE </velocities> | ||
</initialize> | ||
<forces> | ||
<force forcefield ="dummy.1" weight='1.0'/> | ||
<force forcefield ="dummy.2" nbeads='2' weight='1.0'/> | ||
</forces> | ||
<motion mode="dynamics"> | ||
<dynamics mode="scnpt"> | ||
<barostat mode='sc-isotropic'> | ||
<tau units='femtosecond'> 200</tau> | ||
<thermostat mode='langevin'> | ||
<tau units='femtosecond'> 100</tau> | ||
</thermostat> | ||
<h0> [ 32.84024, 0, 0, 0, 32.84024, 0, 0, 0, 32.84024 ]</h0> | ||
</barostat> | ||
<thermostat mode='langevin'> | ||
<tau units='femtosecond'> 100 </tau> | ||
</thermostat> | ||
<timestep units="femtosecond"> 1.0 </timestep> | ||
</dynamics> | ||
</motion> | ||
<ensemble> | ||
<temperature units="kelvin"> TEMPERATURE </temperature> | ||
<pressure units="megapascal"> PRESSURE </pressure> | ||
<bias> <force forcefield="dummy.2"/> </bias> | ||
<bias_weights> [0.0] </bias_weights> | ||
</ensemble> | ||
</system> | ||
</template> | ||
</system_template> | ||
<smotion mode="remd"> | ||
<remd> | ||
<stride> 2 </stride> | ||
</remd> | ||
</smotion> | ||
</simulation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
# usage: run_profile.sh [-p] natoms | ||
# run a mock simulation using an natoms box, -p activates yappi profiling | ||
|
||
# Default value for natoms | ||
natoms=8 | ||
# Default profiler options | ||
profiler_options="" | ||
|
||
# Process command-line arguments | ||
while getopts ":p" opt; do | ||
case $opt in | ||
p) | ||
profiler_flag=true | ||
;; | ||
\?) | ||
echo "Invalid option: -$OPTARG" >&2 | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
|
||
# Set natoms if provided as an argument | ||
if [ $# -gt 0 ]; then | ||
natoms=$1 | ||
fi | ||
|
||
# Set profiler options if -p flag was used | ||
if [ "$profiler_flag" = true ]; then | ||
profiler_options="-p --profiler-clock=wall --profiler-output=test-$natoms" | ||
fi | ||
|
||
# Create test.xyz file | ||
echo $natoms > test-$natoms.xyz | ||
echo "# dummy input structure" >> test-$natoms.xyz | ||
for (( i=0; i<natoms; i++ )) | ||
do | ||
echo "H 0 0 0" >> test-$natoms.xyz | ||
done | ||
|
||
# Replace init.xyz with test.xyz in input.xml and save as test.xml | ||
sed 's/init\.xyz/test-'$natoms'\.xyz/g' input.xml > test-$natoms.xml | ||
|
||
# Run i-pi and i-pi-driver in the background | ||
time i-pi test-$natoms.xml $profiler_options &> test-$natoms.log & | ||
sleep 1 | ||
i-pi-driver -m gas -u -a gas & | ||
|
||
# Wait for all background processes to finish | ||
wait | ||
|