Skip to content

Commit

Permalink
Merge branch 'master' of github.com:computationalmodelling/fidimag
Browse files Browse the repository at this point in the history
  • Loading branch information
fangohr committed Jul 8, 2016
2 parents a56166f + 49a4d00 commit 607aad3
Show file tree
Hide file tree
Showing 24 changed files with 494 additions and 215 deletions.
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,13 @@ vtks


# ignore *.so created by cython
fidimag/extensions/baryakhtar_clib.so
fidimag/extensions/clib.so
fidimag/extensions/cvode.so
fidimag/extensions/dipolar.so
fidimag/extensions/micro_clib.so
fidimag/extensions/neb_clib.so

fidimag/extensions/*.so

# ignore output from coverage
htmlcov

# ignore junit test output
test-reports

# ignore notebook checkpoint directory
.ipynb_checkpoints/
7 changes: 5 additions & 2 deletions install/docker/Dockerfile → docker/minimal-py2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ RUN useradd -m -s /bin/bash -G sudo fidimag && \
echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN chown -R fidimag $FIDIMAG_HOME

# For bind mounts from host
RUN mkdir /io
RUN chown -R fidimag /io

USER fidimag
RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful

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



WORKDIR $FIDIMAG_HOME
WORKDIR /io
CMD ["/bin/bash","-i"]
File renamed without changes.
15 changes: 6 additions & 9 deletions install/docker/Makefile → docker/minimal-py2/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# to build a new docker image
build:
time docker build -t fangohr/fidimag:latest .
time docker build -t fidimag/minimal-py2:latest .

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

login:
docker login

# to push the new docker image to dockerhub (need to login first)
push:
docker push fangohr/fidimag:latest
push: build
docker push fidimag/minimal-py2:latest

# to fetch image to local machine
pull:
docker pull fangohr/fidimag:latest
docker pull fidimag/minimal-py2:latest
31 changes: 31 additions & 0 deletions docker/minimal-py2/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Docker

Run fidimag with Python 2 under Docker.

## Using the docker container

There is a fidimag container available under `fidimag/minimal-py2`.

To use it, you can try this:

1. Install docker

2. Pull the container onto your machine using

docker pull fidimag/minimal-py2

3. Start the container using

docker run -ti fidimag/minimal-py2

This command should show a bash prompt inside the docker container:

<pre>
bin:docker fangohr$ docker run -v `pwd`:/io -ti fidimag/minimal-py2
fidimag@38fdd2a0feb4:/io$
</pre>

## Creating the docker container

The `Makefile` in this directory shows the relevant targets (build, login, push)
to create a new container and push it to the the cloud.
64 changes: 64 additions & 0 deletions docker/minimal-py3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
FROM ubuntu:14.04

# packages we need to run fidimag
RUN apt-get -y update
RUN apt-get -y install python3-numpy python3-dev python3-scipy
RUN apt-get -y install python3-pytest ipython3 python3-matplotlib python3-pip
# standard tools for compilation
RUN apt-get -y install wget make git

# where to install source
ENV FIDIMAG_HOME /home/fidimag

RUN mkdir -p $FIDIMAG_HOME
WORKDIR $FIDIMAG_HOME
RUN git clone https://github.com/computationalmodelling/fidimag.git
WORKDIR $FIDIMAG_HOME/fidimag/bin

# install third party libraries from source
RUN bash install-fftw.sh
RUN bash install-sundials-2.5.sh

# for pip
RUN python3 -m pip install --user --upgrade setuptools pip
# install pyvtk
RUN python3 -m pip install pyvtk
# install cython
RUN python3 -m pip install cython --upgrade
WORKDIR $FIDIMAG_HOME/fidimag

# compile fidimag
RUN python3 setup.py build_ext --inplace
env PYTHONPATH=$FIDIMAG_HOME/fidimag
env LD_LIBRARY_PATH=$FIDIMAG_HOME/fidimag/local/lib
WORKDIR $FIDIMAG_HOME/fidimag/tests

# check that tests run okay
RUN py.test-3 -v


# install Jupyter, port exposing doesn't work yet
#RUN pip install jupyter

# expose jupyter port - not working yet
#EXPOSE 8888 8888


# Set up user so that we do not run as root
RUN useradd -m -s /bin/bash -G sudo fidimag && \
echo "fidimag:docker" | chpasswd && \
echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN chown -R fidimag $FIDIMAG_HOME

# For bind mounts from host
RUN mkdir /io
RUN chown -R fidimag /io

USER fidimag
RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful

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

WORKDIR /io
CMD ["/bin/bash","-i"]
16 changes: 16 additions & 0 deletions docker/minimal-py3/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# to build a new docker image
build:
time docker build -t fidimag/minimal-py3:latest .

# to run new image
run: build
docker run -v `pwd`:/io -ti fidimag/minimal-py3
# try 'ipython3' and then 'import fidimag'

# to push the new docker image to dockerhub (need to login first)
push: build
docker push fidimag/minimal-py3:latest

# to fetch image to local machine
pull:
docker pull fidimag/minimal-py3:latest
31 changes: 31 additions & 0 deletions docker/minimal-py3/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Docker

Run fidimag with Python 3 under Docker.

## Using the docker container

There is a fidimag container available under `fidimag/minimal-py3`.

To use it, you can try this:

1. Install docker

2. Pull the container onto your machine using

docker pull fidimag/minimal-py3

3. Start the container using

docker run -ti fidimag/minimal-py3

This command should show a bash prompt inside the docker container:

<pre>
bin:docker fangohr$ docker run -v `pwd`:/io -ti fidimag/minimal-py3
fidimag@38fdd2a0feb4:/io$
</pre>

## Creating the docker container

The `Makefile` in this directory shows the relevant targets (build, login, push)
to create a new container and push it to the the cloud.
37 changes: 37 additions & 0 deletions docker/notebook/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM jupyter/scipy-notebook

# where to install source
ENV FIDIMAG_DIR $HOME/work/fidimag

RUN git clone https://github.com/computationalmodelling/fidimag.git
WORKDIR $FIDIMAG_DIR

# install third party libraries from source
RUN bash bin/install-fftw.sh
RUN bash bin/install-sundials-2.5.sh

# install pyvtk
RUN pip install pyvtk
# install cython
RUN pip install cython --upgrade

# compile fidimag
RUN python3 setup.py build_ext --inplace
ENV PYTHONPATH=$FIDIMAG_DIR
ENV LD_LIBRARY_PATH=$FIDIMAG_DIR/local/lib
WORKDIR $FIDIMAG_DIR/tests

# https://github.com/conda-forge/matplotlib-feedstock/issues/36
RUN conda install --quiet --yes icu

# check that tests run okay
RUN conda install --quiet --yes pytest
RUN py.test -v

# /io will be mounted from the host system
USER root
RUN mkdir /io
RUN chown -R $NB_USER /io
USER $NB_USER

WORKDIR /io
15 changes: 15 additions & 0 deletions docker/notebook/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# to build a new docker image
build:
time docker build -t fidimag/notebook:latest .

# to run new image
run: build
docker run -v `pwd`:/io -d -p 30008:8888 fidimag/notebook

# to push the new docker image to dockerhub (need to login first)
push: build
docker push fidimag/notebook:latest

# to fetch image to local machine
pull:
docker pull fidimag/notebook:latest
42 changes: 42 additions & 0 deletions docker/notebook/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Docker

First steps towards running fidimag through Docker.

## Using the docker container

There is a fidimag container available under `fangohr/fidimag`.

To use it, you can try this:

1. Install docker

2. Pull the container onto your machine using

docker pull fidimag/notebook

3. Start the container using

docker run -v `pwd`:/io -d -p 30008:8888 fidimag/notebook

This will start a notebook server. You can see it in your browser at
http://localhost:30008/ on Linux, or http://192.168.99.100:30008/ on Mac (you may
need to change this IP address if your docker VM is at a different address).

To run a shell instead of the notebook server, run:

docker run -v `pwd`:/io -ti fidimag/notebook bash

## Shortcomings

- need to share directory between host and container (MOUNT or VOLUME)


## Creating the docker container

The `Makefile` in this directory shows the relevant targets (build, login, push)
to create a new container and push it to the the cloud.





2 changes: 1 addition & 1 deletion fidimag/atomistic/anisotropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Anisotropy(Energy):
"""

def __init__(self, Ku, axis=(1, 0, 0), name='anis'):
def __init__(self, Ku, axis=(1, 0, 0), name='Anisotropy'):
self.Ku = Ku
self.name = name
self.axis = axis
Expand Down
2 changes: 1 addition & 1 deletion fidimag/atomistic/demag.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Demag(object):
"""

def __init__(self, name='demag'):
def __init__(self, name='Demag'):
self.name = name
self.jac = True

Expand Down
2 changes: 1 addition & 1 deletion fidimag/atomistic/demag_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DemagFull(Energy):
the energy density.
"""

def __init__(self, name='demag_full'):
def __init__(self, name='DemagFull'):
self.name = name
self.jac = True

Expand Down
2 changes: 1 addition & 1 deletion fidimag/atomistic/demag_hexagonal.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DemagHexagonal(object):
"""

def __init__(self, name='demag_hex'):
def __init__(self, name='DemagHexagonal'):
self.name = name
self.jac = True

Expand Down
4 changes: 2 additions & 2 deletions fidimag/atomistic/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class UniformExchange(Energy):
"""

def __init__(self, J=0, name='exch'):
def __init__(self, J=0, name='UniformExchange'):
self.J = J
self.name = name

Expand Down Expand Up @@ -142,7 +142,7 @@ def my_exchange(pos):
"""

def __init__(self, J_fun, name='exch'):
def __init__(self, J_fun, name='Exchange'):
self.J_fun = J_fun
self.name = name
self.jac = False
Expand Down
Loading

0 comments on commit 607aad3

Please sign in to comment.