/usr/lib/neuron/bin/mkthreadsafe is in neuron-dev 7.5-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #!/bin/bash
if test $# = 0 ; then
files="`ls *.mod`"
else
files="$*"
fi
echo $files
t=temp
words="EXTERNAL discontinuity LINEAR DISCRETE PARTIAL ERROR"
for i in $files ; do
f="`echo $i | sed 's/\.mod//'`"
nocmodl $f.mod 2>&1 | sed '/^Translating/d' > $t
nline=`wc -l $t`
rm $f.c
thread_safe=""
for word in $words ; do
if grep -q "$word"' is not thread safe' $t ; then
thread_safe=no
fi
done
if grep -q 'Complain to hines' $t ; then
thread_safe=no
fi
echo "
$f.mod:"
if test "$nline" = "0 temp" ; then
echo "$f.mod is Thread Safe"
elif grep -q '^Thread Safe$' $t ; then
echo "$f.mod is Thread Safe"
elif test "$thread_safe" = "no" ; then
cat $t
echo -n "Continue:"
read a
elif grep -q 'POINTER is not thread safe' $t ; then
cat $t
echo "$f.mod should be examined and if, in fact, it is
or can be modified to be thread safe, the THREADSAFE keyword can be
prepended to the NEURON block."
echo -n "Continue:"
read a
elif grep -q 'Assignment to the GLOBAL' $t ; then
sed -n '/NEURON *{/,/}/p' $f.mod
sed -n '/VERBATIM/,/ENDVERBATIM/p' $f.mod
cat $t
a="n"
echo "If you know that this model is in fact thread safe when
the GLOBAL variables that are written to are promoted to thread instance
variables, and therefore it is ok to add the THREADSAFE keyword, then ..."
echo "Add THREADSAFE? [y][n]: $a"
read a
if test "$a" = "y" ; then
sed '/NEURON *{/a \
THREADSAFE
' $f.mod > $t
cp $t $f.mod
fi
elif grep -q 'VERBATIM' $t ; then
sed -n '/VERBATIM/,/ENDVERBATIM/p' $f.mod
cat $t
a="n"
echo "If you know that this model is in fact thread safe so
that it is ok to add the THREADSAFE keyword, then ..."
echo "Add THREADSAFE? [y][n]: $a"
read a
if test "$a" = "y" ; then
sed '/NEURON *{/a \
THREADSAFE
' $f.mod > $t
cp $t $f.mod
fi
else
cat $t
echo -n "Continue:"
read a
fi
rm $t
done
|