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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 570 - (hide annotations)
Tue Feb 28 06:51:25 2006 UTC (13 years, 8 months ago) by jgs
File MIME type: text/x-python
File size: 1712 byte(s)
extend these tests to test DataTagged objecrs also
1 jgs 123 """
2    
3     Load tests for escript/Data.
4    
5     Version $Id$
6    
7     """
8    
9     import sys
10     import unittest
11     import os
12    
13     import time
14    
15 jgs 149 from esys.escript import *
16 jgs 153 from esys import bruce
17 jgs 123
18     # ==============================================================
19    
20     arglist = [ \
21 jgs 570 3.0, \
22 jgs 123 [3,4], \
23     [[1,2],[3,4]], \
24     [[[15,8],[12,8]],[[-9,9],[13,8]]], \
25 jgs 570 [[[[35,9],[82,1]],[[-3,5],[33,8]]],[[[95,8],[-18,2]],[[-2,7],[113,-8]]]] \
26 jgs 123 ]
27    
28     # ==============================================================
29    
30     def prepareArg(val,ex,wh):
31     if ex=="Expanded":
32     exx=True
33     else:
34     exx=False
35     out=Data(val,what=wh,expand=exx)
36 jgs 570 if ex=="Tagged":
37     out.tag()
38 jgs 123 return out
39    
40 jgs 570 def doTest(arg,ex,wh):
41 jgs 123
42 jgs 315 arg._wherePositive()
43     arg._whereZero()
44     arg._trace()
45     arg._log()
46 jgs 570 arg._sin()
47     arg._acosh()
48 jgs 315 arg._Lsup()
49     arg._maxval()
50     arg._sign()
51 jgs 123
52     arg+=arg
53     arg-=arg
54     arg*=arg
55     arg/=arg
56    
57     # ==============================================================
58    
59     testNum = 0
60    
61     totalTime = 0
62    
63 jgs 570 for x0 in [10, 100, 1000]:
64     for x1 in [10, 100, 1000]:
65 jgs 123
66     print "#### x0:", x0, "#### x1:", x1, "####"
67 jgs 570
68 jgs 153 msh=bruce.Rectangle(x0,x1)
69 jgs 123 for wh in [ContinuousFunction(msh),Function(msh)]:
70    
71 jgs 570 print wh
72 jgs 123
73 jgs 570 for ex in ["Constant","Tagged","Expanded"]:
74    
75 jgs 123 for a in arglist:
76    
77 jgs 570 arg=prepareArg(a,ex,wh)
78    
79 jgs 123 testNum+=1
80 jgs 570 print "Test", testNum, ": ----------------------------------------------"
81     print ex, "Rank", arg.getRank()
82 jgs 123
83 jgs 570 starttime = time.clock()
84 jgs 123
85 jgs 570 for i in range(1000):
86 jgs 123
87 jgs 570 doTest(arg,ex,wh)
88 jgs 123
89 jgs 570 stoptime = time.clock()
90     testElapsed = stoptime - starttime
91     totalTime += testElapsed
92 jgs 123
93     print "Test elapsed time: ", testElapsed
94    
95     print "Total elapsed time: ", totalTime
96    
97     # end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26