source: trunk/bin/check_all.sh @ 3931

Last change on this file since 3931 was 3931, checked in by bradbell, 2 years ago

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: 30f30628dc80b751a4d72223a3ca3f10111b1a29
end hash code: f4ce6b2601ca057b41100ab6787a8d9cb178e945

commit f4ce6b2601ca057b41100ab6787a8d9cb178e945
Author: Brad Bell <bradbell@…>
Date: Fri May 19 04:52:28 2017 -0700

Move multi_thread -> example/multi_thread.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.1 KB
Line 
1#! /bin/bash -e
2# -----------------------------------------------------------------------------
3# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
4#
5# CppAD is distributed under multiple licenses. This distribution is under
6# the terms of the
7#                     Eclipse Public License Version 1.0.
8#
9# A copy of this license is included in the COPYING file of this distribution.
10# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
11# -----------------------------------------------------------------------------
12if [ ! -e "bin/check_all.sh" ]
13then
14        echo "bin/check_all.sh: must be executed from its parent directory"
15        exit 1
16fi
17echo_log_eval() {
18        echo $*
19        echo $* >> $top_srcdir/check_all.log
20        if ! eval $* >> $top_srcdir/check_all.log 2> $top_srcdir/check_all.err
21        then
22                cat $top_srcdir/check_all.err
23                echo 'Error: see check_all.log'
24                exit 1
25        fi
26        msg=`cat $top_srcdir/check_all.err`
27        if [ "$msg" != '' ]
28        then
29                echo "$msg"
30                echo 'Warning: see check_all.err'
31                exit 1
32        fi
33        rm $top_srcdir/check_all.err
34}
35log_eval() {
36        echo $* >> $top_srcdir/check_all.log
37        if ! eval $* >> $top_srcdir/check_all.log
38        then
39                echo "Error: check check_all.log"
40                exit 1
41        fi
42}
43if [ -e check_all.log ]
44then
45        echo "rm check_all.log"
46        rm check_all.log
47fi
48top_srcdir=`pwd`
49echo "top_srcdir = $top_srcdir"
50#
51if ! random_zero_one=`expr $RANDOM % 2`
52then
53        # expr exit status is 1 when the expression result is zero
54        # supress shell exit in this case
55        :
56fi
57echo "random_zero_one = $random_zero_one"
58# ---------------------------------------------------------------------------
59# circular shift program list and set program to first entry in list
60next_program() {
61        program_list=`echo "$program_list" | sed -e 's| *\([^ ]*\) *\(.*\)|\2 \1|'`
62        program=`echo "$program_list" | sed -e 's| *\([^ ]*\).*|\1|'`
63}
64# ---------------------------------------------------------------------------
65if [ -e "$HOME/prefix/cppad" ]
66then
67        echo_log_eval rm -r $HOME/prefix/cppad
68fi
69# ---------------------------------------------------------------------------
70# Create package to run test in
71echo "bin/package.sh"
72bin/package.sh
73# -----------------------------------------------------------------------------
74# choose which tarball to use for testing
75skip=''
76version=`bin/version.sh get`
77echo_log_eval cd build
78list=( `ls cppad-$version.*.tgz` )
79if [ "${#list[@]}" == '1' ]
80then
81        tarball="${list[0]}"
82        skip="$skip other_tarball"
83else
84        tarball="${list[$random_zero_one]}"
85fi
86echo_log_eval rm -rf cppad-$version
87echo_log_eval tar -xzf $tarball
88echo_log_eval cd cppad-$version
89# -----------------------------------------------------------------------------
90if [ "$random_zero_one" == '0' ]
91then
92        echo_log_eval bin/run_cmake.sh --boost_vector
93else
94        echo_log_eval bin/run_cmake.sh --eigen_vector
95fi
96echo_log_eval cd build
97# -----------------------------------------------------------------------------
98echo_log_eval make check
99# -----------------------------------------------------------------------------
100for package in adolc eigen ipopt fadbad sacado
101do
102        dir=$HOME/prefix/$package
103        if [ ! -d "$dir" ]
104        then
105                skip="$skip $package"
106        fi
107done
108#
109# extra speed tests not run with option specified
110for option in onetape colpack optimize atomic memory boolsparsity
111do
112        echo_eval speed/cppad/speed_cppad correct 432 $option
113done
114echo_eval speed/adolc/speed_adolc correct         432 onetape
115echo_eval speed/adolc/speed_adolc sparse_jacobian 432 onetape colpack
116echo_eval speed/adolc/speed_adolc sparse_hessian  432 onetape colpack
117#
118# ----------------------------------------------------------------------------
119# extra multi_thread tests
120program_list=''
121for threading in bthread openmp pthread
122do
123        program="example/multi_thread/${threading}/multi_thread_${threading}"
124        if [ ! -e $program ]
125        then
126                skip="$skip $program"
127        else
128                program_list="$program_list $program"
129                #
130                # fast cases, test for all programs
131                echo_log_eval ./$program a11c
132                echo_log_eval ./$program simple_ad
133                echo_log_eval ./$program team_example
134        fi
135done
136if [ "$program_list" != '' ]
137then
138        # test_time=1,max_thread=4,mega_sum=1
139        next_program
140        echo_log_eval ./$program harmonic 1 4 1
141        #
142        # test_time=2,max_thread=4,num_zero=20,num_sub=30,num_sum=500,use_ad=true
143        next_program
144        echo_log_eval ./$program multi_newton 2 4 20 30 500 true
145        #
146        # case that failed in the past
147        next_program
148        echo_log_eval ./$program multi_newton 1 1 100 700 1 true
149        #
150        # case that failed in the past
151        next_program
152        echo_log_eval ./$program multi_newton 1 2 3 12 1 true
153fi
154#
155# print_for test
156if [ ! -e 'example/print_for/print_for' ]
157then
158        skip="$skip example/print_for/print_for"
159else
160        echo_log_eval example/print_for/print_for
161        example/print_for/print_for | sed -e '/^Test passes/,$d' > junk.1.$$
162        example/print_for/print_for | sed -e '1,/^Test passes/d' > junk.2.$$
163        if diff junk.1.$$ junk.2.$$
164        then
165                rm junk.1.$$ junk.2.$$
166                echo_log_eval echo "print_for: OK"
167        else
168                echo_log_eval echo "print_for: Error"
169                exit 1
170        fi
171fi
172#
173echo_log_eval make install
174#
175if [ "$skip" != '' ]
176then
177        echo_log_eval echo "check_all.sh: skip = $skip"
178        exit 1
179fi
180# ----------------------------------------------------------------------------
181echo "$0: OK"
182exit 0
Note: See TracBrowser for help on using the repository browser.