Bureaucrats, cc_docs_admin, cc_staff
2,318
edits
No edit summary |
(Marked this version for translation) |
||
Line 1: | Line 1: | ||
<languages /> | <languages /> | ||
<translate> | <translate> | ||
= YT rendering on clusters = | = YT rendering on clusters = <!--T:1--> | ||
<!--T:2--> | |||
To install [http://yt-project.org YT] for CPU rendering on a cluster in your own directory, please do | To install [http://yt-project.org YT] for CPU rendering on a cluster in your own directory, please do | ||
$ module load python | <!--T:3--> | ||
$ module load python | |||
$ virtualenv astro # install Python tools in your $HOME/astro | $ virtualenv astro # install Python tools in your $HOME/astro | ||
$ source ~/astro/bin/activate | $ source ~/astro/bin/activate | ||
Line 13: | Line 15: | ||
$ pip install mpi4py | $ pip install mpi4py | ||
<!--T:4--> | |||
Then, in normal use, simply load the environment and start python | Then, in normal use, simply load the environment and start python | ||
$ source ~/astro/bin/activate # load the environment | <!--T:5--> | ||
$ source ~/astro/bin/activate # load the environment | |||
$ python | $ python | ||
... | ... | ||
$ deactivate | $ deactivate | ||
<!--T:6--> | |||
We assume that you have downloaded the sample dataset Enzo_64 from http://yt-project.org/data. Start with the following script `grids.py` to render 90 frames rotating the dataset around the vertical axis | We assume that you have downloaded the sample dataset Enzo_64 from http://yt-project.org/data. Start with the following script `grids.py` to render 90 frames rotating the dataset around the vertical axis | ||
import yt | <!--T:7--> | ||
import yt | |||
from numpy import pi | from numpy import pi | ||
yt.enable_parallelism() # turn on MPI parallelism via mpi4py | yt.enable_parallelism() # turn on MPI parallelism via mpi4py | ||
Line 36: | Line 42: | ||
sc.save('frame%04d.png' % (i+1), sigma_clip=4) | sc.save('frame%04d.png' % (i+1), sigma_clip=4) | ||
<!--T:8--> | |||
and the job submission script `yt-mpi.sh` | and the job submission script `yt-mpi.sh` | ||
#!/bin/bash | <!--T:9--> | ||
#!/bin/bash | |||
#SBATCH --time=0:30:00 # walltime in d-hh:mm or hh:mm:ss format | #SBATCH --time=0:30:00 # walltime in d-hh:mm or hh:mm:ss format | ||
#SBATCH --ntasks=4 # number of MPI processes | #SBATCH --ntasks=4 # number of MPI processes | ||
Line 46: | Line 54: | ||
srun python grids.py | srun python grids.py | ||
<!--T:10--> | |||
Then submit the job with `sbatch yt-mpi.sh`, wait for it to finish, and then create a movie at 30fps | Then submit the job with `sbatch yt-mpi.sh`, wait for it to finish, and then create a movie at 30fps | ||
$ 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 | <!--T:11--> | ||
$ 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 | |||
</translate> | </translate> |