Skip to content

Commit 607aad3

Browse files
committedJul 8, 2016
Merge branch 'master' of github.com:computationalmodelling/fidimag
2 parents a56166f + 49a4d00 commit 607aad3

24 files changed

+494
-215
lines changed
 

‎.gitignore

+3-7
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,13 @@ vtks
2525

2626

2727
# ignore *.so created by cython
28-
fidimag/extensions/baryakhtar_clib.so
29-
fidimag/extensions/clib.so
30-
fidimag/extensions/cvode.so
31-
fidimag/extensions/dipolar.so
32-
fidimag/extensions/micro_clib.so
33-
fidimag/extensions/neb_clib.so
34-
28+
fidimag/extensions/*.so
3529

3630
# ignore output from coverage
3731
htmlcov
3832

3933
# ignore junit test output
4034
test-reports
4135

36+
# ignore notebook checkpoint directory
37+
.ipynb_checkpoints/

‎install/docker/Dockerfile ‎docker/minimal-py2/Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,16 @@ RUN useradd -m -s /bin/bash -G sudo fidimag && \
4949
echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
5050
RUN chown -R fidimag $FIDIMAG_HOME
5151

52+
# For bind mounts from host
53+
RUN mkdir /io
54+
RUN chown -R fidimag /io
55+
5256
USER fidimag
5357
RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful
5458

5559
# Print something nice on entry.
5660
#COPY WELCOME $FIDIMAG_HOME/WELCOME
5761

5862

59-
60-
WORKDIR $FIDIMAG_HOME
63+
WORKDIR /io
6164
CMD ["/bin/bash","-i"]
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
# to build a new docker image
22
build:
3-
time docker build -t fangohr/fidimag:latest .
3+
time docker build -t fidimag/minimal-py2:latest .
44

55
# to run new image
6-
run:
7-
docker run -ti fangohr/fidimag bash
6+
run: build
7+
docker run -v `pwd`:/io -ti fidimag/minimal-py2
88
# try 'ipython' and then 'import fidimag'
99

10-
login:
11-
docker login
12-
1310
# to push the new docker image to dockerhub (need to login first)
14-
push:
15-
docker push fangohr/fidimag:latest
11+
push: build
12+
docker push fidimag/minimal-py2:latest
1613

1714
# to fetch image to local machine
1815
pull:
19-
docker pull fangohr/fidimag:latest
16+
docker pull fidimag/minimal-py2:latest

‎docker/minimal-py2/Readme.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Docker
2+
3+
Run fidimag with Python 2 under Docker.
4+
5+
## Using the docker container
6+
7+
There is a fidimag container available under `fidimag/minimal-py2`.
8+
9+
To use it, you can try this:
10+
11+
1. Install docker
12+
13+
2. Pull the container onto your machine using
14+
15+
docker pull fidimag/minimal-py2
16+
17+
3. Start the container using
18+
19+
docker run -ti fidimag/minimal-py2
20+
21+
This command should show a bash prompt inside the docker container:
22+
23+
<pre>
24+
bin:docker fangohr$ docker run -v `pwd`:/io -ti fidimag/minimal-py2
25+
fidimag@38fdd2a0feb4:/io$
26+
</pre>
27+
28+
## Creating the docker container
29+
30+
The `Makefile` in this directory shows the relevant targets (build, login, push)
31+
to create a new container and push it to the the cloud.

‎docker/minimal-py3/Dockerfile

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
FROM ubuntu:14.04
2+
3+
# packages we need to run fidimag
4+
RUN apt-get -y update
5+
RUN apt-get -y install python3-numpy python3-dev python3-scipy
6+
RUN apt-get -y install python3-pytest ipython3 python3-matplotlib python3-pip
7+
# standard tools for compilation
8+
RUN apt-get -y install wget make git
9+
10+
# where to install source
11+
ENV FIDIMAG_HOME /home/fidimag
12+
13+
RUN mkdir -p $FIDIMAG_HOME
14+
WORKDIR $FIDIMAG_HOME
15+
RUN git clone https://github.com/computationalmodelling/fidimag.git
16+
WORKDIR $FIDIMAG_HOME/fidimag/bin
17+
18+
# install third party libraries from source
19+
RUN bash install-fftw.sh
20+
RUN bash install-sundials-2.5.sh
21+
22+
# for pip
23+
RUN python3 -m pip install --user --upgrade setuptools pip
24+
# install pyvtk
25+
RUN python3 -m pip install pyvtk
26+
# install cython
27+
RUN python3 -m pip install cython --upgrade
28+
WORKDIR $FIDIMAG_HOME/fidimag
29+
30+
# compile fidimag
31+
RUN python3 setup.py build_ext --inplace
32+
env PYTHONPATH=$FIDIMAG_HOME/fidimag
33+
env LD_LIBRARY_PATH=$FIDIMAG_HOME/fidimag/local/lib
34+
WORKDIR $FIDIMAG_HOME/fidimag/tests
35+
36+
# check that tests run okay
37+
RUN py.test-3 -v
38+
39+
40+
# install Jupyter, port exposing doesn't work yet
41+
#RUN pip install jupyter
42+
43+
# expose jupyter port - not working yet
44+
#EXPOSE 8888 8888
45+
46+
47+
# Set up user so that we do not run as root
48+
RUN useradd -m -s /bin/bash -G sudo fidimag && \
49+
echo "fidimag:docker" | chpasswd && \
50+
echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
51+
RUN chown -R fidimag $FIDIMAG_HOME
52+
53+
# For bind mounts from host
54+
RUN mkdir /io
55+
RUN chown -R fidimag /io
56+
57+
USER fidimag
58+
RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful
59+
60+
# Print something nice on entry.
61+
#COPY WELCOME $FIDIMAG_HOME/WELCOME
62+
63+
WORKDIR /io
64+
CMD ["/bin/bash","-i"]

‎docker/minimal-py3/Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# to build a new docker image
2+
build:
3+
time docker build -t fidimag/minimal-py3:latest .
4+
5+
# to run new image
6+
run: build
7+
docker run -v `pwd`:/io -ti fidimag/minimal-py3
8+
# try 'ipython3' and then 'import fidimag'
9+
10+
# to push the new docker image to dockerhub (need to login first)
11+
push: build
12+
docker push fidimag/minimal-py3:latest
13+
14+
# to fetch image to local machine
15+
pull:
16+
docker pull fidimag/minimal-py3:latest

‎docker/minimal-py3/Readme.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Docker
2+
3+
Run fidimag with Python 3 under Docker.
4+
5+
## Using the docker container
6+
7+
There is a fidimag container available under `fidimag/minimal-py3`.
8+
9+
To use it, you can try this:
10+
11+
1. Install docker
12+
13+
2. Pull the container onto your machine using
14+
15+
docker pull fidimag/minimal-py3
16+
17+
3. Start the container using
18+
19+
docker run -ti fidimag/minimal-py3
20+
21+
This command should show a bash prompt inside the docker container:
22+
23+
<pre>
24+
bin:docker fangohr$ docker run -v `pwd`:/io -ti fidimag/minimal-py3
25+
fidimag@38fdd2a0feb4:/io$
26+
</pre>
27+
28+
## Creating the docker container
29+
30+
The `Makefile` in this directory shows the relevant targets (build, login, push)
31+
to create a new container and push it to the the cloud.

‎docker/notebook/Dockerfile

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM jupyter/scipy-notebook
2+
3+
# where to install source
4+
ENV FIDIMAG_DIR $HOME/work/fidimag
5+
6+
RUN git clone https://github.com/computationalmodelling/fidimag.git
7+
WORKDIR $FIDIMAG_DIR
8+
9+
# install third party libraries from source
10+
RUN bash bin/install-fftw.sh
11+
RUN bash bin/install-sundials-2.5.sh
12+
13+
# install pyvtk
14+
RUN pip install pyvtk
15+
# install cython
16+
RUN pip install cython --upgrade
17+
18+
# compile fidimag
19+
RUN python3 setup.py build_ext --inplace
20+
ENV PYTHONPATH=$FIDIMAG_DIR
21+
ENV LD_LIBRARY_PATH=$FIDIMAG_DIR/local/lib
22+
WORKDIR $FIDIMAG_DIR/tests
23+
24+
# https://github.com/conda-forge/matplotlib-feedstock/issues/36
25+
RUN conda install --quiet --yes icu
26+
27+
# check that tests run okay
28+
RUN conda install --quiet --yes pytest
29+
RUN py.test -v
30+
31+
# /io will be mounted from the host system
32+
USER root
33+
RUN mkdir /io
34+
RUN chown -R $NB_USER /io
35+
USER $NB_USER
36+
37+
WORKDIR /io

‎docker/notebook/Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# to build a new docker image
2+
build:
3+
time docker build -t fidimag/notebook:latest .
4+
5+
# to run new image
6+
run: build
7+
docker run -v `pwd`:/io -d -p 30008:8888 fidimag/notebook
8+
9+
# to push the new docker image to dockerhub (need to login first)
10+
push: build
11+
docker push fidimag/notebook:latest
12+
13+
# to fetch image to local machine
14+
pull:
15+
docker pull fidimag/notebook:latest

‎docker/notebook/Readme.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Docker
2+
3+
First steps towards running fidimag through Docker.
4+
5+
## Using the docker container
6+
7+
There is a fidimag container available under `fangohr/fidimag`.
8+
9+
To use it, you can try this:
10+
11+
1. Install docker
12+
13+
2. Pull the container onto your machine using
14+
15+
docker pull fidimag/notebook
16+
17+
3. Start the container using
18+
19+
docker run -v `pwd`:/io -d -p 30008:8888 fidimag/notebook
20+
21+
This will start a notebook server. You can see it in your browser at
22+
http://localhost:30008/ on Linux, or http://192.168.99.100:30008/ on Mac (you may
23+
need to change this IP address if your docker VM is at a different address).
24+
25+
To run a shell instead of the notebook server, run:
26+
27+
docker run -v `pwd`:/io -ti fidimag/notebook bash
28+
29+
## Shortcomings
30+
31+
- need to share directory between host and container (MOUNT or VOLUME)
32+
33+
34+
## Creating the docker container
35+
36+
The `Makefile` in this directory shows the relevant targets (build, login, push)
37+
to create a new container and push it to the the cloud.
38+
39+
40+
41+
42+

‎fidimag/atomistic/anisotropy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Anisotropy(Energy):
4444
4545
"""
4646

47-
def __init__(self, Ku, axis=(1, 0, 0), name='anis'):
47+
def __init__(self, Ku, axis=(1, 0, 0), name='Anisotropy'):
4848
self.Ku = Ku
4949
self.name = name
5050
self.axis = axis

‎fidimag/atomistic/demag.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Demag(object):
3333
3434
"""
3535

36-
def __init__(self, name='demag'):
36+
def __init__(self, name='Demag'):
3737
self.name = name
3838
self.jac = True
3939

‎fidimag/atomistic/demag_full.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DemagFull(Energy):
1414
the energy density.
1515
"""
1616

17-
def __init__(self, name='demag_full'):
17+
def __init__(self, name='DemagFull'):
1818
self.name = name
1919
self.jac = True
2020

‎fidimag/atomistic/demag_hexagonal.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class DemagHexagonal(object):
4747
4848
"""
4949

50-
def __init__(self, name='demag_hex'):
50+
def __init__(self, name='DemagHexagonal'):
5151
self.name = name
5252
self.jac = True
5353

‎fidimag/atomistic/exchange.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class UniformExchange(Energy):
4141
4242
"""
4343

44-
def __init__(self, J=0, name='exch'):
44+
def __init__(self, J=0, name='UniformExchange'):
4545
self.J = J
4646
self.name = name
4747

@@ -142,7 +142,7 @@ def my_exchange(pos):
142142
143143
"""
144144

145-
def __init__(self, J_fun, name='exch'):
145+
def __init__(self, J_fun, name='Exchange'):
146146
self.J_fun = J_fun
147147
self.name = name
148148
self.jac = False

0 commit comments

Comments
 (0)
Please sign in to comment.