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

Annotation of /trunk/escript/test/python/TimingTests.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 149 - (hide annotations)
Thu Sep 1 03:31:39 2005 UTC (14 years, 1 month ago) by jgs
Original Path: trunk/esys2/escript/test/python/TimingTests.py
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 jgs 149 """
2     Miscellaneous escript/Data timing tests.
3    
4     Version $Id$
5     """
6    
7 jgs 148 import sys
8     import os
9     import time
10    
11 jgs 149 from esys.escript import *
12     from esys import finley
13 jgs 148
14 jgs 149 #
15     # ================== data values to test with =========================
16 jgs 148
17     arglist = [ \
18     3.0, \
19 jgs 149 [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 jgs 148 ]
23    
24 jgs 149 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 jgs 148
48 jgs 149 #
49     # ================== method definitions =========================
50    
51 jgs 148 def prepareArg(val,ex,wh):
52 jgs 149 if ex=="Expanded":
53     exx=True
54     else:
55     exx=False
56     out=Data(val,what=wh,expand=exx)
57     return out
58 jgs 148
59 jgs 149 def getStartTime():
60     return time.clock()
61 jgs 148
62 jgs 149 def calcElapsedTime(starttime):
63     stoptime = time.clock()
64     elapsed = stoptime - starttime
65     print elapsed
66 jgs 148
67 jgs 149 def runTest(arg,test):
68     print "\n", test
69     result = arg.__getattribute__(test)()
70     del result
71 jgs 148
72     #
73 jgs 149 # ===================== main ==============================
74 jgs 148
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 jgs 149 for test in testlist:
90 jgs 148
91 jgs 149 starttime = getStartTime()
92 jgs 148
93 jgs 149 runTest(arg,test)
94 jgs 148
95 jgs 149 calcElapsedTime(starttime)
96 jgs 148
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