Skip to content

Commit ba2fa7b

Browse files
author
davidcorteso
committed
Merge branch 'master' of github.com:computationalmodelling/fidimag
2 parents f140fb6 + 09b5501 commit ba2fa7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2270
-3001
lines changed

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,41 @@
11
*.pyc
22
/local/
3+
4+
# ignore automatically generated cython files
5+
fidimag/atomistic/lib/clib.c
6+
fidimag/common/dipolar/dipolar.c
7+
fidimag/common/neb/neb_clib.c
8+
fidimag/common/sundials/cvode.c
9+
fidimag/micro/lib/baryakhtar/baryakhtar_clib.c
10+
fidimag/micro/lib/micro_clib.c
11+
12+
# ignore .cache from pytest
13+
.cache
14+
15+
# ignore simulation data
16+
*_npys
17+
*_vtks
18+
19+
# ignore output files from NEB method
20+
npys
21+
vtks
22+
23+
/build/
24+
/doc/build/
25+
26+
27+
# 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+
35+
36+
# ignore output from coverage
37+
htmlcov
38+
39+
# ignore junit test output
40+
test-reports
41+

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sudo: false
88
before_install:
99
# We do this conditionally because it saves us some downloading if the
1010
# version is the same.
11+
- deactivate # Deactivate virtualenv
1112
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
1213
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
1314
else
@@ -17,9 +18,9 @@ before_install:
1718
- export PATH=/home/travis/miniconda/bin:$PATH
1819

1920
install:
20-
- conda create -q -y -n fidimag-test python=$TRAVIS_PYTHON_VERSION cython matplotlib pytest scipy
21+
- conda create -q -y -n fidimag-test python=$TRAVIS_PYTHON_VERSION cython matplotlib pytest scipy pytest-cov
2122
- source activate fidimag-test
22-
- pip install pyvtk six
23+
- pip install pyvtk six nbval
2324
# Download and compile FFTW & Sundials locally
2425
- bash bin/install.sh
2526

@@ -36,6 +37,7 @@ before_script:
3637
# command to run tests
3738
script:
3839
- make test-without-run-oommf
40+
- make test-ipynb
3941

4042

4143
notifications:

Makefile

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,52 @@ EXTENSIONS_DIR = ${PROJECT_DIR}/fidimag/extensions
66
#####################
77

88

9-
build: extensions-directory
10-
python setup.py build_ext --build-lib ${EXTENSIONS_DIR}
11-
touch ${EXTENSIONS_DIR}/__init__.py
12-
rm -rf ${PROJECT_DIR}/build
13-
14-
extensions-directory:
15-
mkdir -p ${EXTENSIONS_DIR}
9+
build:
10+
python setup.py build_ext --inplace
1611

1712
clean:
18-
rm -rf ${EXTENSIONS_DIR}
13+
rm -rf ${EXTENSIONS_DIR}/*
14+
touch ${EXTENSIONS_DIR}/__init__.py
1915

2016
#########
2117
# Tests #
2218
#########
2319

24-
create-dirs:
25-
mkdir -p test-reports/junit
20+
# Quick tests, also not using OOMMF tests
21+
test:
22+
cd tests && py.test -v -m "not slow and not run_oommf"
23+
24+
test2:
25+
# like test, but run also outside the 'tests' directory.
26+
# Doesn't work on Hans laptop.
27+
py.test -v -m "not slow and not run_oommf"
2628

27-
test: create-dirs
29+
test-all: create-dirs
2830
py.test -v --junitxml=$(PROJECT_DIR)/test-reports/junit/test-pytest.xml
2931

3032
test-without-run-oommf: create-dirs
31-
py.test -v --junitxml=$(PROJECT_DIR)/test-reports/junit/test-pytest.xml -m "not run_oommf"
33+
py.test -v -m "not run_oommf" --cov=fidimag --cov-report=html --junitxml=$(PROJECT_DIR)/test-reports/junit/test-pytest.xml
3234

3335
test-basic:
3436
cd tests && py.test -v
3537

3638
# Convenience name for commonly used quick running of tests
3739
tq:
38-
make test-quick
39-
# Quick tests, also not using OOMMF tests
40+
$(error This target 'tq' has been removed, please update the code calling this)
41+
4042
test-quick:
41-
cd tests && py.test -v -m "not slow and not run_oommf"
43+
$(error This target 'test-quick' has been removed, please update the code calling this)
4244

4345

4446
test-ipynb: create-dirs
45-
cd doc/ipynb && py.test . -v --ipynb --sanitize-with sanitize_file --junitxml=$(PROJECT_DIR)/test-reports/junit/test-ipynb-pytest.xml
47+
cd doc/ipynb && py.test . -v --nbval --sanitize-with sanitize_file --junitxml=$(PROJECT_DIR)/test-reports/junit/test-ipynb-pytest.xml
48+
49+
test-oommf:
50+
py.test -v -m "oommf"
51+
52+
create-dirs:
53+
mkdir -p test-reports/junit
54+
4655

4756
#################
4857
# Documentation #

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ FIDIMAG
33

44
[![Build Status](https://travis-ci.org/computationalmodelling/fidimag.svg?branch=master)](https://travis-ci.org/computationalmodelling/fidimag)
55
[![Documentation Status](https://readthedocs.org/projects/fidimag/badge/?version=latest)](http://fidimag.readthedocs.org/en/latest/?badge=latest)
6+
[![codecov](https://codecov.io/gh/computationalmodelling/fidimag/branch/master/graph/badge.svg)](https://codecov.io/gh/computationalmodelling/fidimag)
7+
68

79
Fidimag solves finite-difference micromagnetic problems and also
810
does atomistic simulations.

bin/install-scikit-odes.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# This script installs the python bindings to SUNDIALS called scikit ODES.
5+
# It requires SUNDIALS 2.6.2 to be installed.
6+
7+
echo "Installing dependencies."
8+
sudo apt-get install python-dev
9+
sudo pip install scipy numpy cython enum34
10+
11+
HERE_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
12+
FIDIMAG_DIR="$(dirname "$HERE_DIR")"
13+
LIBS_DIR=${FIDIMAG_DIR}/local
14+
15+
echo "Downloading ODES to "${LIBS_DIR}"."
16+
mkdir -p ${LIBS_DIR}
17+
cd ${LIBS_DIR}
18+
19+
git clone git://github.com/bmcage/odes.git odes
20+
cd odes
21+
22+
# Paths to SUNDIALS are hardcoded in odes/scikits/odes/sundials/setup.py.
23+
# The README recommends to edit that file if you want to change the paths...
24+
25+
sed -i \
26+
"s|LIB_DIRS_SUNDIALS = \[base_path\,|LIB_DIRS_SUNDIALS = [base_path, '${LIBS_DIR}\/lib',|g" \
27+
scikits/odes/sundials/setup.py
28+
29+
python setup.py build
30+
sudo python setup.py install
31+
32+
cd ${HERE_DIR}

bin/install-sundials.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# This script installs any SUNDIALS version starting with version 2.6.0
5+
# when SUNDIALS moved to a CMake-based installation. Will install locally.
6+
# It may need environment variables to work, like `export CC=gcc` in ARCHER.
7+
8+
SUNDIALS=sundials-2.6.2
9+
10+
# Make sure CMake is installed, since SUNDIALS requires it.
11+
which cmake > /dev/null
12+
if [ $? -eq 0 ]
13+
then
14+
echo "Found CMake."
15+
else
16+
echo "CMake required to build SUNDIALS. Installing."
17+
sudo apt-get install cmake
18+
fi
19+
20+
HERE_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
21+
FIDIMAG_DIR="$(dirname "$HERE_DIR")"
22+
LIBS_DIR=${FIDIMAG_DIR}/local
23+
24+
echo "Will install SUNDIALS to "${LIBS_DIR}" using CC="${CC}"."
25+
mkdir -p ${LIBS_DIR}
26+
cd ${LIBS_DIR}
27+
28+
download_and_cmake_install() {
29+
# $1 name of the package
30+
# $2 URL where ${1}.tar.gz can be obtained
31+
# $3 configure options
32+
if [ ! -e ${1}.tar.gz ]; then
33+
echo "Downloading "${1}"."
34+
wget -q ${2}/${1}.tar.gz
35+
fi;
36+
37+
if [ ! -e ${1} ]; then
38+
tar -xzf ${1}.tar.gz
39+
40+
echo "Configuring "${1}"."
41+
mkdir ${1}_build
42+
cd ${1}_build
43+
cmake ${3} ../${1}
44+
45+
echo "Compiling and installing "${1}"."
46+
{
47+
make
48+
make install
49+
} > /dev/null
50+
51+
echo "Cleaning up."
52+
cd ..
53+
rm -rf ${1}
54+
rm -rf ${1}_build
55+
56+
cd ${HERE_DIR}
57+
echo "Done."
58+
fi;
59+
}
60+
61+
download_and_cmake_install \
62+
${SUNDIALS} \
63+
http://computation.llnl.gov/projects/sundials-suite-nonlinear-differential-algebraic-equation-solvers/download \
64+
"-DBUILD_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="${LIBS_DIR}" -DEXAMPLES_ENABLE=OFF -DLAPACK_ENABLE=ON -DOPENMP_ENABLE=ON"

0 commit comments

Comments
 (0)