本文整理汇总了Python中ufora.test.PerformanceTestReporter.testThroughput方法的典型用法代码示例。如果您正苦于以下问题:Python PerformanceTestReporter.testThroughput方法的具体用法?Python PerformanceTestReporter.testThroughput怎么用?Python PerformanceTestReporter.testThroughput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ufora.test.PerformanceTestReporter
的用法示例。
在下文中一共展示了PerformanceTestReporter.testThroughput方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_throughputThrowsIfNonePassed
# 需要导入模块: from ufora.test import PerformanceTestReporter [as 别名]
# 或者: from ufora.test.PerformanceTestReporter import testThroughput [as 别名]
def test_throughputThrowsIfNonePassed(self):
tempDir = tempfile.mkdtemp()
tempFile = os.path.join(tempDir, "data.json")
with SetEnv(
PerformanceTestReporter.TEST_DATA_LOCATION_ENVIRONMENT_VARIABLE,
tempFile
):
def testFunOfN(n):
raise PerformanceTestReporter.TimedOutException("timed out!!")
with self.assertRaises(AssertionError):
PerformanceTestReporter.testThroughput(
"test1", testFunOfN = testFunOfN)
示例2: test_some_throughput
# 需要导入模块: from ufora.test import PerformanceTestReporter [as 别名]
# 或者: from ufora.test.PerformanceTestReporter import testThroughput [as 别名]
def test_some_throughput(self):
def toTest(n):
FORA.eval("""let v = [0, 0.0]; let res = 0;
for ix in sequence(%s * 100000000) {
res = res + v[0] + v[1];
}
res""" % n)
PerformanceTestReporter.testThroughput(
"fora_lang.LangTestPerf.vector.heterogeneousVectorAccessThroughput_100mm",
toTest,
maxNToSearch=10,
timeoutInSec=5.0
)
示例3: array_binary_operation
# 需要导入模块: from ufora.test import PerformanceTestReporter [as 别名]
# 或者: from ufora.test.PerformanceTestReporter import testThroughput [as 别名]
def array_binary_operation(self, dimension, op, test_name):
with self.ufora.remotely:
a = np.arange(dimension)
b = np.arange(dimension)
def f(n):
with self.ufora.remotely:
for _ in xrange(n):
op(a, b)
PerformanceTestReporter.testThroughput(
"pyfora.numpy.%s_%d" % (test_name, dimension),
f,
maxNToSearch=20,
timeoutInSec=20.0
)
示例4: vector_dot_product
# 需要导入模块: from ufora.test import PerformanceTestReporter [as 别名]
# 或者: from ufora.test.PerformanceTestReporter import testThroughput [as 别名]
def vector_dot_product(self, dimension):
with self.ufora.remotely:
a = np.arange(dimension)
b = np.arange(dimension)
def f(n):
with self.ufora.remotely:
for _ in xrange(n):
np.dot(a, b)
PerformanceTestReporter.testThroughput(
"pyfora.numpy.vector_dot_product_%d" % dimension,
f,
maxNToSearch=20,
timeoutInSec=20.0
)
示例5: matrix_dot_product
# 需要导入模块: from ufora.test import PerformanceTestReporter [as 别名]
# 或者: from ufora.test.PerformanceTestReporter import testThroughput [as 别名]
def matrix_dot_product(self, dimension):
with self.ufora.remotely:
a = np.arange(dimension**2).reshape(
(int(dimension), int(dimension)))
b = np.arange(dimension**2).reshape(
(int(dimension), int(dimension)))
def f(n):
with self.ufora.remotely:
for _ in xrange(n):
np.dot(a, b)
PerformanceTestReporter.testThroughput(
"pyfora.numpy.matrix_dot_product_%dx%d" % (dimension, dimension),
f,
maxNToSearch=20,
timeoutInSec=20.0
)
示例6: test_throughputDoesNotFailOnTimeoutIfSomePassed
# 需要导入模块: from ufora.test import PerformanceTestReporter [as 别名]
# 或者: from ufora.test.PerformanceTestReporter import testThroughput [as 别名]
def test_throughputDoesNotFailOnTimeoutIfSomePassed(self):
tempDir = tempfile.mkdtemp()
tempFile = os.path.join(tempDir, "data.json")
with SetEnv(
PerformanceTestReporter.TEST_DATA_LOCATION_ENVIRONMENT_VARIABLE,
tempFile
):
def testFunOfN(n):
if n < 10:
pass
else:
raise PerformanceTestReporter.TimedOutException("timed out!!")
PerformanceTestReporter.testThroughput(
"test1", testFunOfN = testFunOfN)
testData = PerformanceTestReporter.loadTestsFromFile(tempFile)
self.assertEqual(len(testData), 1)