/[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 153 - (hide annotations)
Tue Oct 25 01:51:20 2005 UTC (13 years, 11 months ago) by jgs
Original Path: trunk/esys2/escript/test/python/TimingTests.py
File MIME type: text/x-python
File size: 1513 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-10-25

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     "abs",
26     "maxval",
27     "minval",
28     "mindp",
29     "length",
30     "trace",
31     "sign",
32     "exp",
33     "sqrt",
34     "neg",
35     "pos",
36     "sin",
37     "cos",
38     "tan",
39     "log",
40     "ln",
41     "Lsup",
42     "Linf",
43     "sup",
44 jgs 153 "inf"
45 jgs 149 ]
46 jgs 148
47 jgs 149 #
48     # ================== method definitions =========================
49    
50 jgs 148 def prepareArg(val,ex,wh):
51 jgs 149 if ex=="Expanded":
52     exx=True
53     else:
54     exx=False
55     out=Data(val,what=wh,expand=exx)
56     return out
57 jgs 148
58 jgs 149 def getStartTime():
59     return time.clock()
60 jgs 148
61 jgs 149 def calcElapsedTime(starttime):
62     stoptime = time.clock()
63     elapsed = stoptime - starttime
64 jgs 153 print "\t\t", elapsed
65 jgs 148
66 jgs 149 def runTest(arg,test):
67 jgs 153 print "\t\t", test,
68 jgs 149 result = arg.__getattribute__(test)()
69     del result
70 jgs 148
71     #
72 jgs 149 # ===================== main ==============================
73 jgs 148
74 jgs 153 msh=bruce.Rectangle(1000,1000)
75 jgs 148
76 jgs 153 for wh in [Function(msh),ContinuousFunction(msh)]:
77 jgs 148
78 jgs 153 print "\n", wh, ":"
79 jgs 148
80     for ex in ["Expanded"]:
81    
82     for a in arglist:
83    
84 jgs 153 print "\n\t", ex, a, "==>"
85     print "\n\t\tFunction\tElapsed time"
86     print "\t\t--------\t------------"
87 jgs 148
88     arg=prepareArg(a,ex,wh)
89    
90 jgs 149 for test in testlist:
91 jgs 148
92 jgs 149 starttime = getStartTime()
93 jgs 148
94 jgs 149 runTest(arg,test)
95 jgs 148
96 jgs 149 calcElapsedTime(starttime)
97 jgs 148
98     sys.exit(0)
99     # end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26