/[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 155 - (show annotations)
Wed Nov 9 02:02:19 2005 UTC (13 years, 11 months ago) by jgs
File MIME type: text/x-python
File size: 1616 byte(s)
move all directories from trunk/esys2 into trunk and remove esys2

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,4], \
22 [[1,2],[3,4]], \
23 [[15,8],[12,8]], \
24 [[[15,8],[12,8]],[[-9,9],[13,8]]], \
25 3.0 \
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 return out
37
38 def doTest(a,ex,wh):
39
40 arg=prepareArg(a,ex,wh)
41
42 arg.wherePositive()
43 arg.whereZero()
44 arg.trace()
45 arg.log()
46 arg.Linf()
47 arg.maxval()
48 arg.sign()
49
50 arg+=arg
51 arg-=arg
52 arg*=arg
53 arg/=arg
54
55 # ==============================================================
56
57 testNum = 0
58
59 totalTime = 0
60
61 for x0 in [1, 10, 100]:
62 for x1 in [1, 10, 100]:
63
64 print "#### x0:", x0, "#### x1:", x1, "####"
65 msh=bruce.Rectangle(x0,x1)
66
67 for wh in [ContinuousFunction(msh),Function(msh)]:
68
69 for ex in ["Constant","Expanded"]:
70
71 for a in arglist:
72
73 testNum+=1
74 print testNum, ": ----------------------------------------------"
75
76 testElapsed = 0
77
78 for j in range(10):
79
80 starttime = time.clock()
81
82 for i in range(1000):
83
84 doTest(a,ex,wh)
85
86 stoptime = time.clock()
87 elapsed = stoptime - starttime
88 testElapsed += elapsed
89 totalTime += elapsed
90
91 print elapsed
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