- Set the initial state of the universe in
initial_state.txt(see next section for format).- You can generate a random initial state by running
python3 input.py > initial_state.txt. Set the number of objects withininput.py(the variable is calledn).
- You can generate a random initial state by running
- Set the desired parameters at the top of
gravity.cpp.- Set all to
falseto accurately evaluate runtime, which is printed in the.errfile. - Set
OUTPUT_VIDEO_FRAMEStotrueif you want to see the video (see Step 4). - Set
CHECK_MOMENTUMtotrueto calculate momentum and print it in.err. - Set
BENCHMARK_PAPItotrueto use PAPI, and setPAPI_TYPE_DESCRIPTION. The result is printed in the.errfile.
- Set all to
- Run using
sbatch job.sh.- You can change the number of nodes and ranks there.
- If
OUTPUT_VIDEO_FRAMESistrue, the.outfile will contain pixel data corresponding to video frames. Useffmpegto generate the video.- Download the
.outfile. - Run
cat <name of .out file> | ffmpeg -y -f rawvideo -pixel_format gbrp -video_size 1024x768 -i - -c:v h264 -pix_fmt yuv420p video.mov. - Open
video.movwith a video player. - The version of
ffmpegin the repository is for Windows. Visit https://ffmpeg.org/download.html for other versions. - You may need to add
.../ffmpeg/bin/to thePATHenvironment variable.
- Download the
Syntax:
- First line:
num_time_stepsnum_objects - Next
num_objectslines:massradiuspos.xpos.ypos.zvel.xvel.yvel.z
Meaning:
num_time_steps: Number of time steps for which to run the simulationnum_objects: Number of objects in the initial state of the universe- Each of the lines after the first line gives the initial state of one object
mass: Mass of objectradius: Radius of objectpos.x,pos.y,pos.z: x-, y-, and z-components of the object's initial positionvel.x,vel.y,vel.z: x-, y-, and z-components of the object's initial velocity