/[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 1809 - (show annotations)
Thu Sep 25 06:43:44 2008 UTC (11 years, 2 months ago) by ksteube
File MIME type: text/x-python
File size: 2942 byte(s)
Copyright updated in all python files

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 """
23 Miscellaneous escript/Data timing tests.
24 """
25
26 import sys
27 import os
28 import time
29
30 from esys.escript import *
31 from esys import bruce
32
33 #
34 # ================== data values to test with =========================
35
36 arglist = [ \
37 3.0, \
38 [3.0,4.0], \
39 [[1.0,2.0],[3.0,4.0]], \
40 [[[15.0,8.0],[12.0,8.0]],[[-9.0,9.0],[13.0,8.0]]], \
41 [[[[14.0,7.0],[11.0,8.5]],[[-970,9.2],[18.0,8.0]]],[[[-4.4,7.0],[93.0,8.0]],[[-1.0,9.4],[12.0,9.0]]]] \
42 ]
43
44 testlist = [
45 "_trace ",
46 "_maxval ",
47 "_minval ",
48 "_wherePositive ",
49 "_whereNegative ",
50 "_whereNonNegative",
51 "_whereNonPositive",
52 "_whereZero ",
53 "_whereNonZero ",
54 "_sin ",
55 "_cos ",
56 "_tan ",
57 "_asin ",
58 "_acos ",
59 "_atan ",
60 "_sinh ",
61 "_cosh ",
62 "_tanh ",
63 "_asinh ",
64 "_acosh ",
65 "_atanh ",
66 "_exp ",
67 "_sqrt ",
68 "_log10 ",
69 "_log ",
70 "_sign ",
71 "_Lsup ",
72 "_sup ",
73 "_inf "
74 ]
75
76 #
77 # ================== method definitions =========================
78
79 def prepareArg(val,ex,wh):
80 if ex=="Expanded":
81 exx=True
82 else:
83 exx=False
84 out=Data(val,what=wh,expand=exx)
85 if ex=="Tagged":
86 out.tag()
87 return out
88
89 def getStartTime():
90 return time.clock()
91
92 def calcElapsedTime(starttime):
93 stoptime = time.clock()
94 elapsed = stoptime - starttime
95 print "\t\t", elapsed
96
97 def runTest(arg,test):
98 print "\t\t", test,
99 test_name = test.rstrip()
100 result = arg.__getattribute__(test_name)()
101 del result
102
103 #
104 # ===================== main ==============================
105
106 msh=bruce.Rectangle(1000,1000)
107
108 for wh in [Function(msh),ContinuousFunction(msh)]:
109
110 print "\n", wh, ":"
111
112 for ex in ["Constant", "Tagged", "Expanded"]:
113
114 for a in arglist:
115
116 arg=prepareArg(a,ex,wh)
117
118 print "\n\t", ex, "Rank", arg.getRank(), "==>"
119 print "\n\t\tFunction\t\tElapsed time"
120 print "\t\t--------\t\t------------"
121
122 for test in testlist:
123
124 starttime = getStartTime()
125
126 runTest(arg,test)
127
128 calcElapsedTime(starttime)
129
130 sys.exit(0)
131 # end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26