Praveen Chandrashekar

Centre for Applicable Mathematics, TIFR, Bangalore

[ People | News | Codes | Talks | Teaching | Publications | Calendar | Hiking | Contact ]

Firedrake

Firedrake is a finite element software.

Install inside a docker image

Firedrake does not provide a Docker image for arm, so we build it ourselves.

Pull Debian image

docker pull debian:stable

Start it

docker run -it --name debian debian:stable

Inside the container, run the commands given here to install firedrake and some other needed softwares.

Add some settings in ~/.bashrc file

PS1="$ "

# Git branch in prompt.
parse_git_branch() {
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

PROMPT_COMMAND='echo -ne "\033]0;@docker:${PWD/$HOME/\~}$(parse_git_branch)\007"'

export LS_OPTIONS='--color=auto'
alias ls='ls $LS_OPTIONS'
export OMP_NUM_THREADS=1
export VIRTUAL_ENV_DISABLE_PROMPT=1

Subsequently, if you exit the container, you can start and attach to it like this

docker start debian
docker attach debian

Activate the env

. /root/firedrake/bin/activate

Now you can run firedrake programs inside the container.

Create an image

Create an image called firedrake out of the debian container.

docker commit debian firedrake

cd to the directory you want to share with the container (dont do this from your HOME directory) and run the firedrake image (it likely has tag latest)

docker run -it --name firedrake -p 8888:8888 \
           -v $(pwd):/root/shared -w /root/shared \
           firedrake:latest

That directory will now be accessible inside the container at /root/shared.

You can start jupyter inside container

. /root/firedrake/bin/activate
jupyter-lab --ip 0.0.0.0 --port 8888 --no-browser --allow-root

and access it from the host at displayed url. Subsequently you can join this container

docker start firedrake
docker attach firedrake

You can also upload the firedrake image to your docker hub and you can use it from another computer and others can also use it

docker login
docker tag firedrake:latest cpraveen/firedrake:latest
docker push cpraveen/firedrake:latest

You can see the image in my docker hub. Since I have a free account, images may get deleted after some days.