-
Notifications
You must be signed in to change notification settings - Fork 1
/
compile_py_module.sh
40 lines (34 loc) · 1.18 KB
/
compile_py_module.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# (c) 2016 - Ilya Prokin - [email protected] - https://sites.google.com/site/ilyaprokin
# INRIA Rhone-Alpes
# STDP model : script to compile model with gfortran and f2py
LODEFOLDER='./odepack'
F2PY='python2 f2py2.py'
NAME="solve_py"
#compile odepack
cd $LODEFOLDER
for FILE in `ls -1 *.f`; do
gfortran -c -Ofast -fPIC $FILE
if [ $? -ne 0 ]; then
echo "Errors compiling " $FILE
exit
fi
done
ar qc libodepack.a *.o
rm *.o
cd -
#compile python module linking it with lodepack
$F2PY -L$LODEFOLDER -lodepack -c --f90flags='-ffree-form -ffree-line-length-none' --fcompiler=gnu95 --opt='-Ofast' solve_py.pyf general_math.f95 statevars_mod.f95 pars_mod.f95 ghk_flux.f95 caL13.f95 TRPV1.f95 subcellular.f95 CaMKII_plast.f95 AMPA.f95 NMDA.f95 CB1R.f95 qsort_c_module.f95 stims.f95 comp_part.f95 solve_py.f95 > mp.txt 2>&1
#remove libodepack after it is linked
rm $LODEFOLDER/libodepack.a
echo "----------------------"
echo "Checking for errors..."
echo "----------------------"
ERRS=`grep -i "err" -C 1 mp.txt`
if [ -z "$ERRS" ]; then
echo "no errors found"
else
echo $ERRS
echo '- - - - - - - - - - - - - - -'
echo 'for details check file mp.txt'
fi