/[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 1312 - (hide annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years ago) by ksteube
File MIME type: text/x-python
File size: 2907 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

1 ksteube 1312 #
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 jgs 149 """
18     Miscellaneous escript/Data timing tests.
19    
20     Version $Id$
21     """
22    
23 elspeth 613 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
24     http://www.access.edu.au
25     Primary Business: Queensland, Australia"""
26 elspeth 614 __license__="""Licensed under the Open Software License version 3.0
27     http://www.opensource.org/licenses/osl-3.0.php"""
28 jgs 148 import sys
29     import os
30     import time
31    
32 jgs 149 from esys.escript import *
33 jgs 153 from esys import bruce
34 jgs 148
35 jgs 149 #
36     # ================== data values to test with =========================
37 jgs 148
38     arglist = [ \
39     3.0, \
40 jgs 149 [3.0,4.0], \
41     [[1.0,2.0],[3.0,4.0]], \
42 jgs 570 [[[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 jgs 148 ]
45    
46 jgs 149 testlist = [
47 jgs 570 "_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 jgs 149 ]
77 jgs 148
78 jgs 149 #
79     # ================== method definitions =========================
80    
81 jgs 148 def prepareArg(val,ex,wh):
82 jgs 149 if ex=="Expanded":
83     exx=True
84     else:
85     exx=False
86     out=Data(val,what=wh,expand=exx)
87 jgs 570 if ex=="Tagged":
88     out.tag()
89 jgs 149 return out
90 jgs 148
91 jgs 149 def getStartTime():
92     return time.clock()
93 jgs 148
94 jgs 149 def calcElapsedTime(starttime):
95     stoptime = time.clock()
96     elapsed = stoptime - starttime
97 jgs 153 print "\t\t", elapsed
98 jgs 148
99 jgs 149 def runTest(arg,test):
100 jgs 153 print "\t\t", test,
101 jgs 570 test_name = test.rstrip()
102     result = arg.__getattribute__(test_name)()
103 jgs 149 del result
104 jgs 148
105     #
106 jgs 149 # ===================== main ==============================
107 jgs 148
108 jgs 153 msh=bruce.Rectangle(1000,1000)
109 jgs 148
110 jgs 153 for wh in [Function(msh),ContinuousFunction(msh)]:
111 jgs 148
112 jgs 153 print "\n", wh, ":"
113 jgs 148
114 jgs 570 for ex in ["Constant", "Tagged", "Expanded"]:
115 jgs 148
116     for a in arglist:
117    
118 jgs 570 arg=prepareArg(a,ex,wh)
119    
120     print "\n\t", ex, "Rank", arg.getRank(), "==>"
121 jgs 375 print "\n\t\tFunction\t\tElapsed time"
122     print "\t\t--------\t\t------------"
123 jgs 148
124 jgs 149 for test in testlist:
125 jgs 148
126 jgs 149 starttime = getStartTime()
127 jgs 148
128 jgs 149 runTest(arg,test)
129 jgs 148
130 jgs 149 calcElapsedTime(starttime)
131 jgs 148
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