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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 149 - (show annotations)
Thu Sep 1 03:31:39 2005 UTC (14 years, 2 months ago) by jgs
File MIME type: text/x-python
File size: 1402 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-01

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26