Skip to content

Commit 76442ca

Browse files
committed
Merge branch 'master' of github.com:computationalmodelling/fidimag
2 parents d231be6 + e71d895 commit 76442ca

File tree

14 files changed

+767
-101
lines changed

14 files changed

+767
-101
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ before_install:
1818
- export PATH=/home/travis/miniconda/bin:$PATH
1919

2020
install:
21-
- conda create -q -y -n fidimag-test python=$TRAVIS_PYTHON_VERSION cython matplotlib pytest scipy pytest-cov gcc
21+
- conda create -q -y -n fidimag-test python=$TRAVIS_PYTHON_VERSION cython matplotlib pytest scipy pytest-cov cmake
2222
- source activate fidimag-test
2323
- pip install pyvtk six nbval ipywidgets
2424
# Download and compile FFTW & Sundials locally
25-
- bash bin/install-sundials-2.5.sh
25+
- bash bin/install-sundials.sh
2626
- bash bin/install-fftw.sh
2727

2828
before_script:

bin/install-sundials.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,8 @@ set -e
88
SUNDIALS=sundials-2.6.2
99

1010
# 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
11+
type cmake >/dev/null 2>&1 || { printf "CMake required to build SUNDIALS. You can install it by typing: \nsudo apt install cmake\n"; exit 1;}
12+
1913

2014
HERE_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
2115
FIDIMAG_DIR="$(dirname "$HERE_DIR")"

doc/install.rst

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ for example, suppose fidimag is in the directory of ~/work, then::
4343

4444
export PYTHONPATH=~/work/fidimag:$PYTHONPATH
4545

46-
Add the library path to LD_LIBRARY_PATH
47-
---------------------------------------
48-
49-
By default, the libraries are installed in fidimag/local, so in order
50-
to run fidimag we need to include the libs path in LD_LIBRARY_PATH, so
51-
please add the following to your .bashrc file::
52-
53-
export LD_LIBRARY_PATH=/path/to/fidimag/local/lib:$LD_LIBRARY_PATH
54-
55-
for instance::
56-
57-
export LD_LIBRARY_PATH=~/work/fidimag/local/lib:$LD_LIBRARY_PATH
46+
.. Add the library path to LD_LIBRARY_PATH
47+
.. -----------------------------------------
48+
..
49+
.. By default, the libraries are installed in fidimag/local, so in order
50+
.. to run fidimag we need to include the libs path in LD_LIBRARY_PATH, so
51+
.. please add the following to your .bashrc file::
52+
..
53+
.. export LD_LIBRARY_PATH=/path/to/fidimag/local/lib:$LD_LIBRARY_PATH
54+
..
55+
.. for instance::
56+
..
57+
.. export LD_LIBRARY_PATH=~/work/fidimag/local/lib:$LD_LIBRARY_PATH
5858
5959
6060
Adding OOMMF path to the system
@@ -217,7 +217,7 @@ Notes:
217217
failed without a working X server).
218218

219219
Install on OS X
220-
=================
220+
==================
221221

222222
The inbuilt OS X gcc compiler (actually clang) doesn't have OpenMP support. A workaround is to
223223

@@ -236,3 +236,38 @@ Also install pytest (``conda install pytest`` if using conda) and
236236
Then run ``make``.
237237

238238
Set the Pythonpath so that the fidimag source is in the path.
239+
240+
241+
Possible Issues on Mac OS
242+
=============================
243+
ImportErrors may arise when loading fidimag if the version of sundials is 2.6, ::
244+
245+
ImportError: dlopen(/Users/ww1g11/Softwares/fidimag/fidimag/extensions/clib.so, 2): Library not loaded: libsundials_cvodes.2.dylib
246+
Referenced from: /Users/ww1g11/Softwares/fidimag/fidimag/extensions/clib.so
247+
Reason: image not found
248+
249+
this is because the sundials library (libsundials_cvodes.2.dylib) in clib.so doesn't have a full path,
250+
which can be seen by using ``otool -L fidimag/extensions/clib.so``, ::
251+
252+
fidimag/extensions/clib.so:
253+
/Users/ww1g11/Softwares/fidimag/local/lib/libfftw3_omp.3.dylib (compatibility version 8.0.0, current version 8.4.0)
254+
/opt/local/lib/libfftw3.3.dylib (compatibility version 8.0.0, current version 8.4.0)
255+
libsundials_cvodes.2.dylib (compatibility version 2.0.0, current version 2.0.0)
256+
libsundials_nvecserial.0.dylib (compatibility version 0.0.0, current version 0.0.2)
257+
libsundials_nvecopenmp.0.dylib (compatibility version 0.0.0, current version 0.0.2)
258+
/opt/local/lib/libgcc/libgomp.1.dylib (compatibility version 2.0.0, current version 2.0.0)
259+
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
260+
/opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
261+
262+
A solution is to change these path manually with ``install_name_tool``, so we have provided a python script (``fix_load_path_mac.py``) to do this.
263+
After run the script, the library path is fixed, for example, the output of the cmd ``otool -L fidimag/extensions/clib.so`` gives ::
264+
265+
fidimag/extensions/neb_clib.so:
266+
/Users/ww1g11/Softwares/fidimag/local/lib/libfftw3_omp.3.dylib (compatibility version 8.0.0, current version 8.4.0)
267+
/opt/local/lib/libfftw3.3.dylib (compatibility version 8.0.0, current version 8.4.0)
268+
/Users/ww1g11/Softwares/fidimag/local/lib/libsundials_cvodes.2.dylib (compatibility version 2.0.0, current version 2.0.0)
269+
/Users/ww1g11/Softwares/fidimag/local/lib/libsundials_nvecserial.0.dylib (compatibility version 0.0.0, current version 0.0.2)
270+
/Users/ww1g11/Softwares/fidimag/local/lib/libsundials_nvecopenmp.0.dylib (compatibility version 0.0.0, current version 0.0.2)
271+
/opt/local/lib/libgcc/libgomp.1.dylib (compatibility version 2.0.0, current version 2.0.0)
272+
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
273+
/opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

fidimag/common/integrators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
"""
55
from scipy.integrate import ode
6-
from fidimag.extensions.cvode import CvodeSolver as SundialsIntegrator
6+
from fidimag.extensions.cvode import CvodeSolver, CvodeSolver_OpenMP
77

88
EPSILON = 1e-16
99

fidimag/common/sundials/cvode.pxd

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,33 @@ cdef extern from "sundials/sundials_nvector.h":
99

1010
ctypedef _generic_N_Vector *N_Vector
1111
N_Vector N_VNew_Serial(long int vec_length)
12+
N_Vector N_VNew_OpenMP(long int vec_length)
1213
void N_VDestroy_Serial(N_Vector v)
14+
void N_VDestroy_OpenMP(N_Vector v)
1315
void N_VPrint_Serial(N_Vector v)
16+
void N_VPrint_OpenMP(N_Vector v)
1417

1518
cdef extern from "nvector/nvector_serial.h":
16-
cdef N_Vector N_VMake_Serial(long int vec_length, realtype *v_data)
17-
19+
cdef N_Vector N_VMake_Serial(long int vec_length, realtype *v_data)
1820
cdef struct _N_VectorContent_Serial:
1921
long int length
2022
realtype *data
23+
booleantype own_data
2124

2225
ctypedef _N_VectorContent_Serial *N_VectorContent_Serial
2326

27+
28+
cdef extern from "nvector/nvector_openmp.h":
29+
cdef N_Vector N_VMake_OpenMP(long int vec_length, realtype *v_data, int num_threads)
30+
31+
cdef struct _N_VectorContent_OpenMP:
32+
long int length
33+
realtype *data
34+
booleantype own_data
35+
int num_threads
36+
37+
ctypedef _N_VectorContent_OpenMP *N_VectorContent_OpenMP
38+
2439

2540

2641
cdef extern from "cvode/cvode.h":

0 commit comments

Comments
 (0)