Yt
Jump to navigation
Jump to search
This site replaces the former Compute Canada documentation site, and is now being managed by the Digital Research Alliance of Canada. Ce site remplace l'ancien site de documentation de Calcul Canada et est maintenant géré par l'Alliance de recherche numérique du Canada. |
Effectuer un rendu sur une grappe
Pour installer YT dans votre répertoire pour effectuer des rendus avec CPU, lancez les commandes
$ module load python mpi4py $ virtualenv astro # install Python tools in your $HOME/astro $ source ~/astro/bin/activate $ pip install cython $ pip install numpy $ pip install yt
Ensuite, chargez l'environnement et lancez Python.
$ source ~/astro/bin/activate # load the environment $ python ... $ deactivate
Nous supposons que vous avez téléchargé l'ensemble de données Enzo_64 à partir de http://yt-project.org/data. Soumettez d'abord le script grids.py ci-dessous pour obtenir un rendu de l'ensemble de données en 90 images, en rotation sur l'axe vertical
import yt
from numpy import pi
yt.enable_parallelism() # turn on MPI parallelism via mpi4py
ds = yt.load("Enzo_64/DD0043/data0043")
sc = yt.create_scene(ds, ('gas', 'density'))
cam = sc.camera
cam.resolution = (1024, 1024) # resolution of each frame
sc.annotate_domain(ds, color=[1, 1, 1, 0.005]) # draw the domain boundary [r,g,b,alpha]
sc.annotate_grids(ds, alpha=0.005) # draw the grid boundaries
sc.save('frame0000.png', sigma_clip=4)
nspin = 90
for i in cam.iter_rotate(pi, nspin): # rotate by 180 degrees over nspin frames
sc.save('frame%04d.png' % (i+1), sigma_clip=4)
et le script yt-mpi.sh
#!/bin/bash
#SBATCH --time=0:30:00 # walltime in d-hh:mm or hh:mm:ss format
#SBATCH --ntasks=4 # number of MPI processes
#SBATCH --mem-per-cpu=3800
#SBATCH --account=...
source $HOME/astro/bin/activate
srun python grids.py
Soumettez ensuite la tâche avec sbatch yt-mpi.sh. Une fois la tâche terminée, créez un film à 30 images par seconde.
$ ffmpeg -r 30 -i frame%04d.png -c:v libx264 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" grids.mp4