Skip to content

Instantly share code, notes, and snippets.

@jpata
Created November 24, 2022 09:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpata/c86622546dc13457c1bf6cd218d7a8f4 to your computer and use it in GitHub Desktop.
Save jpata/c86622546dc13457c1bf6cd218d7a8f4 to your computer and use it in GitHub Desktop.
pkdgrav3 compilation
import pynbody
import matplotlib.pyplot as plt
import numpy as np
s = pynbody.load("./pkdgrav3/examples/example.00140")
plt.figure(figsize=(6,5))
b = np.linspace(-0.5, 0.5, 256)
plt.hist2d(s["pos"][:, 0], s["pos"][:, 1], bins=(b, b), cmap="Blues");
plt.colorbar()
#build the software
rm -Rf build
mkdir build
cd build
singularity exec base.simg cmake -DFFTW_INCLUDES=/usr/include/ .. &> log
singularity exec base.simg make -j16
#Run the simulation on GPU
chmod +x run_sim.sh
singularity exec --nv base.simg ./run_sim.sh
#Check the output
singularity exec --nv python3 example.py
#!/bin/bash
#https://github.com/open-mpi/ompi/issues/7701#issuecomment-932587086
export HWLOC_COMPONENTS=-gl
lstopo
cd examples
mpirun --display-topo ../build/pkdgrav3 cosmology.par
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment