/[escript]/trunk/escript/test/python/TimingTests.py
ViewVC logotype

Annotation of /trunk/escript/test/python/TimingTests.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 613 - (hide annotations)
Wed Mar 22 01:12:32 2006 UTC (13 years, 6 months ago) by elspeth
File MIME type: text/x-python
File size: 2479 byte(s)
More copyright information inserted.

1 jgs 149 """
2     Miscellaneous escript/Data timing tests.
3    
4     Version $Id$
5     """
6    
7 elspeth 613 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
8     http://www.access.edu.au
9     Primary Business: Queensland, Australia"""
10     __licence__="""Licensed under the Open Software License version 3.0
11     http://www.opensource.org/licences/osl-3.0.php"""
12 jgs 148 import sys
13     import os
14     import time
15    
16 jgs 149 from esys.escript import *
17 jgs 153 from esys import bruce
18 jgs 148
19 jgs 149 #
20     # ================== data values to test with =========================
21 jgs 148
22     arglist = [ \
23     3.0, \
24 jgs 149 [3.0,4.0], \
25     [[1.0,2.0],[3.0,4.0]], \
26 jgs 570 [[[15.0,8.0],[12.0,8.0]],[[-9.0,9.0],[13.0,8.0]]], \
27     [[[[14.0,7.0],[11.0,8.5]],[[-970,9.2],[18.0,8.0]]],[[[-4.4,7.0],[93.0,8.0]],[[-1.0,9.4],[12.0,9.0]]]] \
28 jgs 148 ]
29    
30 jgs 149 testlist = [
31 jgs 570 "_trace ",
32     "_maxval ",
33     "_minval ",
34     "_wherePositive ",
35     "_whereNegative ",
36     "_whereNonNegative",
37     "_whereNonPositive",
38     "_whereZero ",
39     "_whereNonZero ",
40     "_sin ",
41     "_cos ",
42     "_tan ",
43     "_asin ",
44     "_acos ",
45     "_atan ",
46     "_sinh ",
47     "_cosh ",
48     "_tanh ",
49     "_asinh ",
50     "_acosh ",
51     "_atanh ",
52     "_exp ",
53     "_sqrt ",
54     "_log10 ",
55     "_log ",
56     "_sign ",
57     "_Lsup ",
58     "_sup ",
59     "_inf "
60 jgs 149 ]
61 jgs 148
62 jgs 149 #
63     # ================== method definitions =========================
64    
65 jgs 148 def prepareArg(val,ex,wh):
66 jgs 149 if ex=="Expanded":
67     exx=True
68     else:
69     exx=False
70     out=Data(val,what=wh,expand=exx)
71 jgs 570 if ex=="Tagged":
72     out.tag()
73 jgs 149 return out
74 jgs 148
75 jgs 149 def getStartTime():
76     return time.clock()
77 jgs 148
78 jgs 149 def calcElapsedTime(starttime):
79     stoptime = time.clock()
80     elapsed = stoptime - starttime
81 jgs 153 print "\t\t", elapsed
82 jgs 148
83 jgs 149 def runTest(arg,test):
84 jgs 153 print "\t\t", test,
85 jgs 570 test_name = test.rstrip()
86     result = arg.__getattribute__(test_name)()
87 jgs 149 del result
88 jgs 148
89     #
90 jgs 149 # ===================== main ==============================
91 jgs 148
92 jgs 153 msh=bruce.Rectangle(1000,1000)
93 jgs 148
94 jgs 153 for wh in [Function(msh),ContinuousFunction(msh)]:
95 jgs 148
96 jgs 153 print "\n", wh, ":"
97 jgs 148
98 jgs 570 for ex in ["Constant", "Tagged", "Expanded"]:
99 jgs 148
100     for a in arglist:
101    
102 jgs 570 arg=prepareArg(a,ex,wh)
103    
104     print "\n\t", ex, "Rank", arg.getRank(), "==>"
105 jgs 375 print "\n\t\tFunction\t\tElapsed time"
106     print "\t\t--------\t\t------------"
107 jgs 148
108 jgs 149 for test in testlist:
109 jgs 148
110 jgs 149 starttime = getStartTime()
111 jgs 148
112 jgs 149 runTest(arg,test)
113 jgs 148
114 jgs 149 calcElapsedTime(starttime)
115 jgs 148
116     sys.exit(0)
117     # end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26