/[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 155 - (show annotations)
Wed Nov 9 02:02:19 2005 UTC (13 years, 10 months ago) by jgs
File MIME type: text/x-python
File size: 1513 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

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 "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 "inf"
45 ]
46
47 #
48 # ================== method definitions =========================
49
50 def prepareArg(val,ex,wh):
51 if ex=="Expanded":
52 exx=True
53 else:
54 exx=False
55 out=Data(val,what=wh,expand=exx)
56 return out
57
58 def getStartTime():
59 return time.clock()
60
61 def calcElapsedTime(starttime):
62 stoptime = time.clock()
63 elapsed = stoptime - starttime
64 print "\t\t", elapsed
65
66 def runTest(arg,test):
67 print "\t\t", test,
68 result = arg.__getattribute__(test)()
69 del result
70
71 #
72 # ===================== main ==============================
73
74 msh=bruce.Rectangle(1000,1000)
75
76 for wh in [Function(msh),ContinuousFunction(msh)]:
77
78 print "\n", wh, ":"
79
80 for ex in ["Expanded"]:
81
82 for a in arglist:
83
84 print "\n\t", ex, a, "==>"
85 print "\n\t\tFunction\tElapsed time"
86 print "\t\t--------\t------------"
87
88 arg=prepareArg(a,ex,wh)
89
90 for test in testlist:
91
92 starttime = getStartTime()
93
94 runTest(arg,test)
95
96 calcElapsedTime(starttime)
97
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