SyFi
0.3
|
Inherits TempDirTestBase.
Public Member Functions | |
def | __init__ |
def | setUp |
def | tearDown |
def | test_cache |
Definition at line 16 of file test_cache.py.
def test_sfc.test_cache.TestCache.__init__ | ( | self, | |
args, | |||
kwargs | |||
) |
Definition at line 17 of file test_cache.py.
def test_sfc.test_cache.TestCache.setUp | ( | self | ) |
Definition at line 20 of file test_cache.py.
References test_sfc.test_tempdir_base.TempDirTestBase.options.
def test_sfc.test_cache.TestCache.tearDown | ( | self | ) |
Definition at line 24 of file test_cache.py.
def test_sfc.test_cache.TestCache.test_cache | ( | self | ) |
Definition at line 27 of file test_cache.py.
References test_sfc::test_cache.info().
00027 00028 def test_cache(self): 00029 cells = (interval, triangle, tetrahedron) #, quadrilateral, hexahedron) 00030 times = [] 00031 for take in range(3): 00032 info("="*40, "Take", take) 00033 avg, n = 0.0, 0 00034 for cell in cells: 00035 for degree in range(1, 3): 00036 U1 = FiniteElement("CG", cell, degree) 00037 U2 = FiniteElement("CG", cell, degree+1) 00038 V1 = TensorElement("CG", cell, degree) 00039 V2 = VectorElement("CG", cell, degree+1) 00040 V3 = FiniteElement("CG", cell, degree+2) 00041 00042 inputs = [U1, [U1], 00043 U1 * U2, 00044 V1 * V2 * V3] 00045 00046 for input in inputs: 00047 t1 = time() 00048 sfc.jit(input) # FIXME: Use local cache, clear before test 00049 t2 = time() 00050 t = t2 - t1 00051 info("Time for %s: %.4f s" % (repr(input), t)) 00052 avg += t 00053 n += 1 00054 avg /= n 00055 info("Average for take", take, "is", avg) 00056 times.append(avg) 00057 #self.assertLess(times[-1], times[0])