Thanks Larry. FEniCS is running fine in Docker. That's a Docker question, but how do I run a local script? I tried to mount a local directory, but...

$ sudo docker run -v /home/USER1/FEniCS:/opt/data lzlarryli/fenics:test
2014/06/13 12:38:01 Error: No command specified

Cheers,

Essi


Le jeu 12 jun 2014 à 1:39, Lizao Li <[email protected]> a écrit :
I made a dockerized version of FEniCS (to be defined below). I would like to hear some comments and see if there is interest in adding this as yet another way of deploying FEniCS.

Docker (http://www.docker.com/) is an open source lightweight virtual machine, popular among the cloud computing community. It has many advanced features but the only thing that matters here is that it is easy, fast, and runs almost everywhere (win, mac, linux, google cloud, amazon ec2, etc, but no, not yet android~). The result is a "FEniCS-in-a-box" with the following objectives achieved: - Get FEniCS running with <5 lines of command on most computers (I get FEniCS with 3 lines on ArchLinux). - Preferrably not compiling for hours. If it has to be compiled, it is guaranteed to succeed (even on a cluster with weird toolchains). - FEniCS is properly contained in a stable environment (unaffected by things like boost, gcc updates) and can be shared between computers (for checking and comparison).
- Minimal loss of performance.

To test it:
1. Go to http://docs.docker.com, find out how to install docker on your system (1 line command in ArchLinux, similar for most linux distros). 2. Deploy the FEniCS 1.4 image (1 line, download ~4GB, pretty fast, no compiling)
    sudo docker pull lzlarryli/fenics:test
2'. Alternatively, you can build FEniCS against a minimum Ubuntu (2 lines, ~1Gb download, ~30 min compiling):
    wget http://www.math.umn.edu/~lixx1445/fenics_docker/Dockerfile
    sudo docker build -t="lzlarryli/fenics:test" .
3. Run FEniCS (1 line):
sudo docker run -t -i --name fenics -v /tmp:/tmp lzlarryli/fenics:test /bin/bash The above creates a virtual machine instance based on the FEniCS image:
             -t  means attach a terminal
             -i  means interactive
             --name  gives a name to the machine
-v /tmp:/tmp mounts the local /tmp to the /tmp in the virtual machine so files can be shared. After running that line, you end up in the FEniCS demo directory and can go ahead and run some demos (fenics.conf is souced already).
4. Once done, run exit. It is the same as ssh into another computer.
To use FEniCS again, just run sudo docker start fenics
    sudo docker attach fenics
    [ctrl+c]

Clean up
    Remove this virtual machine instance:
       sudo docker rm fenics
    Remove the downloaded image:
       sudo docker rmi lzlarryli/fenics:test
    Uninstall docker.

How is this build?
It is built from a simple Dockerfile (http://www.math.umn.edu/~lixx1445/fenics_docker/Dockerfile), which basically downloads a minimal Ubuntu (~80Mb) and then use Dorsal to compile a FEniCS in it. In fact with the same file, DockerHub (also free) can link repositories to Bitbucket, which completely automates the process of building images. DockerHub is free for binary repositoreis of arbitrary size, as long as it is public. This is one of Docker's advantage over other virtual machines, where images have to be produced by hand and hosted somewhere.

Sudo?
It is annoying that sudo is used all the time. This undesirable effect can be dealt with by installing sshd in the virtual machine and expose the port to the local machine (2 lines, see Docker docs). Then administrators (who not necessarily know how to compile FEniCS) can use sudo to install docker, FEniCS, and run the virtual machine as a daemon. Users can then ssh into it without sudo or anything else. The users are contained in the virtual machine, so it is safe.

Performance?
This is the part I was not able to test in a reasonable way. I have FEniCS 1.3 on various systems (none of them runs ubuntu) and FEniCS 1.4 on the virtual Ubuntu machine. The dockerized version runs enlarged FEniCS demo problems faster than the native on the same computer, which is ridiculous. I can only say that probably 1.4 is faster than 1.3 (good job, btw). Most modern (reads non-graduate-student-office) computers have virtualization, which makes the virtual machine performance comparable to the native one. You are welcome to test and show benchmark results.

​Trade-offs?
Precompiled binaries or binaries compiled against standard libraries certainly performs worse than those compiled against hardware-specific optimized libraries. Yet there are quite many cases where performance is not critical but easy deployment is: (1) students, (2) new users, (3) code developement and testing, (4) cluster/system admins who are not familar with numerical software, (5) theoretical numerical analysts (use cluster only when memory outflows), (6) people who have to run FEniCS on many different platforms. Personally, I am (5)(6) and sometimes (4) breaks FEniCS on machines I want to use. This at least makes my life quite easier.


More info about docker (can be interesting):
http://www.docker.com/tryit/
https://docs.docker.com/userguide/


--
Lizao (Larry) Li
Univeristy of Minnesota
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to