/[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 613 - (show annotations)
Wed Mar 22 01:12:32 2006 UTC (13 years, 7 months ago) by elspeth
File MIME type: text/x-python
File size: 2479 byte(s)
More copyright information inserted.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26