Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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
            )
Пример #4
0
    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)
Пример #5
0
    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)
Пример #6
0
    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
            )
Пример #7
0
    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
            )
Пример #8
0
    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)
Пример #9
0
    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
            )
Пример #10
0
    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)