/[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 375 - (hide annotations)
Fri Dec 16 01:44:11 2005 UTC (14 years ago) by jgs
File MIME type: text/x-python
File size: 1570 byte(s)
fix method names to match new scheme
1 jgs 149 """
2     Miscellaneous escript/Data timing tests.
3    
4     Version $Id$
5     """
6    
7 jgs 148 import sys
8     import os
9     import time
10    
11 jgs 149 from esys.escript import *
12 jgs 153 from esys import bruce
13 jgs 148
14 jgs 149 #
15     # ================== data values to test with =========================
16 jgs 148
17     arglist = [ \
18     3.0, \
19 jgs 149 [3.0,4.0], \
20     [[1.0,2.0],[3.0,4.0]], \
21     [[[15.0,8.0],[12.0,8.0]],[[-9.0,9.0],[13.0,8.0]]] \
22 jgs 148 ]
23    
24 jgs 149 testlist = [
25 jgs 375 "_maxval",
26     "_minval",
27     "_trace",
28     "_sign",
29     "_exp",
30     "_sqrt",
31     "_sin",
32     "_cos",
33     "_tan",
34     "_asin",
35     "_acos",
36     "_atan",
37     "_sinh",
38     "_cosh",
39     "_tanh",
40     "_asinh",
41     "_acosh",
42     "_atanh",
43     "_log10",
44     "_log",
45     "_Lsup",
46     "_sup",
47     "_inf"
48 jgs 149 ]
49 jgs 148
50 jgs 149 #
51     # ================== method definitions =========================
52    
53 jgs 148 def prepareArg(val,ex,wh):
54 jgs 149 if ex=="Expanded":
55     exx=True
56     else:
57     exx=False
58     out=Data(val,what=wh,expand=exx)
59     return out
60 jgs 148
61 jgs 149 def getStartTime():
62     return time.clock()
63 jgs 148
64 jgs 149 def calcElapsedTime(starttime):
65     stoptime = time.clock()
66     elapsed = stoptime - starttime
67 jgs 153 print "\t\t", elapsed
68 jgs 148
69 jgs 149 def runTest(arg,test):
70 jgs 153 print "\t\t", test,
71 jgs 149 result = arg.__getattribute__(test)()
72     del result
73 jgs 148
74     #
75 jgs 149 # ===================== main ==============================
76 jgs 148
77 jgs 153 msh=bruce.Rectangle(1000,1000)
78 jgs 148
79 jgs 153 for wh in [Function(msh),ContinuousFunction(msh)]:
80 jgs 148
81 jgs 153 print "\n", wh, ":"
82 jgs 148
83     for ex in ["Expanded"]:
84    
85     for a in arglist:
86    
87 jgs 153 print "\n\t", ex, a, "==>"
88 jgs 375 print "\n\t\tFunction\t\tElapsed time"
89     print "\t\t--------\t\t------------"
90 jgs 148
91     arg=prepareArg(a,ex,wh)
92    
93 jgs 149 for test in testlist:
94 jgs 148
95 jgs 149 starttime = getStartTime()
96 jgs 148
97 jgs 149 runTest(arg,test)
98 jgs 148
99 jgs 149 calcElapsedTime(starttime)
100 jgs 148
101     sys.exit(0)
102     # end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26