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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 375 - (show annotations)
Fri Dec 16 01:44:11 2005 UTC (13 years, 10 months ago) by jgs
File MIME type: text/x-python
File size: 1570 byte(s)
fix method names to match new scheme
1 """
2 Miscellaneous escript/Data timing tests.
3
4 Version $Id$
5 """
6
7 import sys
8 import os
9 import time
10
11 from esys.escript import *
12 from esys import bruce
13
14 #
15 # ================== data values to test with =========================
16
17 arglist = [ \
18 3.0, \
19 [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 ]
23
24 testlist = [
25 "_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 ]
49
50 #
51 # ================== method definitions =========================
52
53 def prepareArg(val,ex,wh):
54 if ex=="Expanded":
55 exx=True
56 else:
57 exx=False
58 out=Data(val,what=wh,expand=exx)
59 return out
60
61 def getStartTime():
62 return time.clock()
63
64 def calcElapsedTime(starttime):
65 stoptime = time.clock()
66 elapsed = stoptime - starttime
67 print "\t\t", elapsed
68
69 def runTest(arg,test):
70 print "\t\t", test,
71 result = arg.__getattribute__(test)()
72 del result
73
74 #
75 # ===================== main ==============================
76
77 msh=bruce.Rectangle(1000,1000)
78
79 for wh in [Function(msh),ContinuousFunction(msh)]:
80
81 print "\n", wh, ":"
82
83 for ex in ["Expanded"]:
84
85 for a in arglist:
86
87 print "\n\t", ex, a, "==>"
88 print "\n\t\tFunction\t\tElapsed time"
89 print "\t\t--------\t\t------------"
90
91 arg=prepareArg(a,ex,wh)
92
93 for test in testlist:
94
95 starttime = getStartTime()
96
97 runTest(arg,test)
98
99 calcElapsedTime(starttime)
100
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