/[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 614 - (show annotations)
Wed Mar 22 01:37:07 2006 UTC (13 years, 4 months ago) by elspeth
File MIME type: text/x-python
File size: 2000 byte(s)
Corrected spelling of 'license' in url so that the link actually points to the license.

1 """
2
3 Load tests for escript/Data.
4
5 Version $Id$
6
7 """
8
9 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
10 http://www.access.edu.au
11 Primary Business: Queensland, Australia"""
12 __license__="""Licensed under the Open Software License version 3.0
13 http://www.opensource.org/licenses/osl-3.0.php"""
14 import sys
15 import unittest
16 import os
17
18 import time
19
20 from esys.escript import *
21 from esys import bruce
22
23 # ==============================================================
24
25 arglist = [ \
26 3.0, \
27 [3,4], \
28 [[1,2],[3,4]], \
29 [[[15,8],[12,8]],[[-9,9],[13,8]]], \
30 [[[[35,9],[82,1]],[[-3,5],[33,8]]],[[[95,8],[-18,2]],[[-2,7],[113,-8]]]] \
31 ]
32
33 # ==============================================================
34
35 def prepareArg(val,ex,wh):
36 if ex=="Expanded":
37 exx=True
38 else:
39 exx=False
40 out=Data(val,what=wh,expand=exx)
41 if ex=="Tagged":
42 out.tag()
43 return out
44
45 def doTest(arg,ex,wh):
46
47 arg._wherePositive()
48 arg._whereZero()
49 arg._trace()
50 arg._log()
51 arg._sin()
52 arg._acosh()
53 arg._Lsup()
54 arg._maxval()
55 arg._sign()
56
57 arg+=arg
58 arg-=arg
59 arg*=arg
60 arg/=arg
61
62 # ==============================================================
63
64 testNum = 0
65
66 totalTime = 0
67
68 for x0 in [10, 100, 1000]:
69 for x1 in [10, 100, 1000]:
70
71 print "#### x0:", x0, "#### x1:", x1, "####"
72
73 msh=bruce.Rectangle(x0,x1)
74 for wh in [ContinuousFunction(msh),Function(msh)]:
75
76 print wh
77
78 for ex in ["Constant","Tagged","Expanded"]:
79
80 for a in arglist:
81
82 arg=prepareArg(a,ex,wh)
83
84 testNum+=1
85 print "Test", testNum, ": ----------------------------------------------"
86 print ex, "Rank", arg.getRank()
87
88 starttime = time.clock()
89
90 for i in range(1000):
91
92 doTest(arg,ex,wh)
93
94 stoptime = time.clock()
95 testElapsed = stoptime - starttime
96 totalTime += testElapsed
97
98 print "Test elapsed time: ", testElapsed
99
100 print "Total elapsed time: ", totalTime
101
102 # end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26