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

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

Parent Directory Parent Directory | Revision Log Revision Log


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