/[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 1387 - (show annotations)
Fri Jan 11 07:45:26 2008 UTC (11 years, 9 months ago) by trankine
Original Path: temp/escript/test/python/TimingTests.py
File MIME type: text/x-python
File size: 2907 byte(s)
Restore the trunk that existed before the windows changes were committed to the (now moved to branches) old trunk.
1 #
2 # $Id$
3 #
4 #######################################################
5 #
6 # Copyright 2003-2007 by ACceSS MNRF
7 # Copyright 2007 by University of Queensland
8 #
9 # http://esscc.uq.edu.au
10 # Primary Business: Queensland, Australia
11 # Licensed under the Open Software License version 3.0
12 # http://www.opensource.org/licenses/osl-3.0.php
13 #
14 #######################################################
15 #
16
17 """
18 Miscellaneous escript/Data timing tests.
19
20 Version $Id$
21 """
22
23 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
24 http://www.access.edu.au
25 Primary Business: Queensland, Australia"""
26 __license__="""Licensed under the Open Software License version 3.0
27 http://www.opensource.org/licenses/osl-3.0.php"""
28 import sys
29 import os
30 import time
31
32 from esys.escript import *
33 from esys import bruce
34
35 #
36 # ================== data values to test with =========================
37
38 arglist = [ \
39 3.0, \
40 [3.0,4.0], \
41 [[1.0,2.0],[3.0,4.0]], \
42 [[[15.0,8.0],[12.0,8.0]],[[-9.0,9.0],[13.0,8.0]]], \
43 [[[[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]]]] \
44 ]
45
46 testlist = [
47 "_trace ",
48 "_maxval ",
49 "_minval ",
50 "_wherePositive ",
51 "_whereNegative ",
52 "_whereNonNegative",
53 "_whereNonPositive",
54 "_whereZero ",
55 "_whereNonZero ",
56 "_sin ",
57 "_cos ",
58 "_tan ",
59 "_asin ",
60 "_acos ",
61 "_atan ",
62 "_sinh ",
63 "_cosh ",
64 "_tanh ",
65 "_asinh ",
66 "_acosh ",
67 "_atanh ",
68 "_exp ",
69 "_sqrt ",
70 "_log10 ",
71 "_log ",
72 "_sign ",
73 "_Lsup ",
74 "_sup ",
75 "_inf "
76 ]
77
78 #
79 # ================== method definitions =========================
80
81 def prepareArg(val,ex,wh):
82 if ex=="Expanded":
83 exx=True
84 else:
85 exx=False
86 out=Data(val,what=wh,expand=exx)
87 if ex=="Tagged":
88 out.tag()
89 return out
90
91 def getStartTime():
92 return time.clock()
93
94 def calcElapsedTime(starttime):
95 stoptime = time.clock()
96 elapsed = stoptime - starttime
97 print "\t\t", elapsed
98
99 def runTest(arg,test):
100 print "\t\t", test,
101 test_name = test.rstrip()
102 result = arg.__getattribute__(test_name)()
103 del result
104
105 #
106 # ===================== main ==============================
107
108 msh=bruce.Rectangle(1000,1000)
109
110 for wh in [Function(msh),ContinuousFunction(msh)]:
111
112 print "\n", wh, ":"
113
114 for ex in ["Constant", "Tagged", "Expanded"]:
115
116 for a in arglist:
117
118 arg=prepareArg(a,ex,wh)
119
120 print "\n\t", ex, "Rank", arg.getRank(), "==>"
121 print "\n\t\tFunction\t\tElapsed time"
122 print "\t\t--------\t\t------------"
123
124 for test in testlist:
125
126 starttime = getStartTime()
127
128 runTest(arg,test)
129
130 calcElapsedTime(starttime)
131
132 sys.exit(0)
133 # end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26