Dedalus Workshop - Geoff Vasil (U. Sydney)

Date & time

1–3pm 24 August 2018

Location

Hales Room, Jaeger 7, Research School of Earth Sciences, ANU

Speakers

Geoffrey Vasil

Contacts

 Taimoor Sohail

Join us for a very special Seminar and Workshop exploring Dedalus - A flexible framework for spectrally solving differential equations. Dedalus is used for fluid dynamics research, but can be applied to any initial-value, boundary-value, and eigenvalue problems involving nearly arbitrary equations sets. 

1 - 2 PM: Seminar on Dedalus by Geoff Vasil

2 - 3 PM: Hands-on workshop with Dedalus by Geoff Vasil

—————————————————————————————————————————————————————————————————

For anyone who would like to follow along with the tutorial it would help greatly if they could attempt to install Dedalus before hand. There are several ways to do this.  

0) If you already have Dedalus installed, there is nothing to do. You might want to pull any latests changes. But everything should work fine. 

1) We have a number of different kinds of instructions on our website regarding installation on different platforms: https://dedalus-project.readthedocs.io/en/latest/installation.html 

    I don’t recommend this option. It was our default until recently. But we are currently working on a much easier method. I’ll outline how this works below.

2) We (by this I mean smart Dedalus people other than me) are working on installing Dedalus with Anaconda Python distribution. We are still working on getting everything 100% as easy as possible. But at this point, it seems that it’s the easiest and most reliable way to install everything you need for Dedalus. 

    I provide some step-by-step instructions for getting everything working. I can address any questions about this on Friday. But It would be most efficient if we can just jump right in. 

    The actual commands you need to type are in italics. 

To install dedalus using conda, here are some instructions

1. Install miniconda by visiting: https://conda.io/miniconda.html

    Choose your OS. And Python 3.6. Everything should work for Mac and Linux. Caveat emptor for Windows. 

    This will download a script called something like “Miniconda_something_something.sh”. 

    On Mac, the file is called "Miniconda3-latest-MacOSX-x86_64.sh” and lands in the ~/Downloads directory.

    Run the script and following the instructions. It will put a new directory in your home directory.  

    bash Miniconda_something_something.sh    

2. Add the miniconda path to your PATH. Eg

    export PATH=“~/miniconda3/bin:$PATH"

    The installer will ask you if it can update your PATH in your .bash_profile, or something similar. Say yes only if the file it suggests is the same name as the one you use to set environmental variables. 

    Otherwise, just update the PATH by hand in the file of your choice. 

    The instructions will say at this point: "For this change to become active, you have to open a new terminal."

3. Create a conda installation

    conda update -n base conda
    conda create -n dedalus-conda python=3.6

    The “dedalus-conda” name is your choice. You can change this to whatever you like as long as you change it everywhere below. 

4. Activate your conda installation

    source activate dedalus-conda

    This will put you in an isolated “environment” where everything is separated fro the rest of your system. 

    It won’t interfere if you have other Python stuff scattered around on your OS.

    If you want to delete everything you can and nothing else in your system will be affected. 

    You will see your terminal prompt change letting you know you are in the new environment. 

    In the future, you will need to do this every time you want to run Dedalus. It’s how the system knows where everything is. 

5. Install the preliminary packages. It will guide you with some simple instructions. 

    pip install --upgrade pip

    conda install -c cryoem fftw-mpi

conda install -c conda-forge hdf5
    conda install -c conda-forge numpy
    conda install -c conda-forge scipy

    If any of these fail for some reason, it’s likely the result of a dropped internet connection, try again. 

6. Clone Dedaus. If you don't have mercurial, install it.

    We use https://www.mercurial-scm.org for getting Dedalus from the repository. It’s easy to install if you don’t have it. 

    hg clone https://bitbucket.org/dedalus-project/dedalus ~/dedalus_conda

    Again, the directory "~/dedalus_conda” is an optional name. You can call the Dedalus files anything you like as long as it’s consistent. 

7. Setup several environment variables

    These are only needed once at the setup, and can be entered into the command line:

    export FFTW_PATH=$CONDA_PREFIX
    export MPI_PATH=$CONDA_PREFIX
    export LD_LIBRARY_PATH=$CONDA_PREFIX/lib

    This is needed at runtime and should always be in the environment:
    export PYTHONPATH=~/dedalus_conda:$PATH

    You can do this in the same “.bash_profile” file equivalent that you put export PATH=“~/miniconda3/bin:$PATH" into earlier. 

    To make these work in the current terminal window:

    source ~/.bash_profile

    Or the equivalent. 

8. Build dedalus

    cd ~/dedalus_conda

    python3 -m pip install -r requirements.txt

    python3 setup.py build_ext --inplace --force

9. Test dedalus

    You can make sure things work by running the following example script: 

    cd ~/dedalus_conda/examples/ivp/2d_rayleigh_benard

    You can see instruction at the top of the rayleigh_benard.py file explaining how to run the simulation and process the data. 

    Most laptops these days have at least 2 cores. You can test Dedalus, Python and MPI all at once by running:

    mpiexec -n 2 python3 rayleigh_benard.py

    You can process the data with the following two commands:

    mpiexec -n 4 python3 merge.py snapshots --cleanup

    mpiexec -n 4 python3 plot_2d_series.py snapshots/*.h5

    This should make a directory called frames. Your test pictures should be in there as .png files. 

    You can stitch these into a movie. We like ffmpeg quite a lot: https://www.ffmpeg.org. But it’s up to you. 

10. Exiting. 

    If you source deactivate you will exit the conda environment. If you want to get back in, you’ll have to simply type 

    source activate dedalus-conda

    Each time. But that’s not much. 

That’s about it. This *should* all work relatively easily. But it’s still a little bit of a prototype method for installation. If you have any trouble with this please send a message to 

    jsoishi@gmail.com 

    keaton.burns@gmail.com

    geoffrey.m.vasil@gmail.com

Also, remember that you might have good luck with the other options on our website. These methods can be a little tricky with environment variables, but will definitely work.

Updated:  11 December 2018/Responsible Officer:  RSES Webmaster/Page Contact:  RSES Webmaster