示例#1
0
                threadCount=threadCount,
                returnSimulation=True,
                ioTaskThreadOverride=8,
                useInMemoryCache=False,
                timeout=30,
                objectStore=self.createObjectStore(s3),
                pageSizeOverride=pageSizeOverride)

            result = simulation.executeExternalIoTask(
                CumulusNative.ExternalIoTask.WriteCharBigvecToS3(
                    setupResults.asResult.result.getVectorBigvecGuid(),
                    CumulusNative.S3KeyAndCredentials(self.getTestDataBucket(),
                                                      keyGuid, "", "", "")),
                timeout=60)

            self.assertTrue(result.isSuccess(), result)

            assert s3().getKeySize(self.getTestDataBucket(),
                                   keyGuid) == bytecount
        finally:
            try:
                s3().deleteKey(self.getTestDataBucket(), keyGuid)
            except:
                logging.warn("Failed to cleanup the test key: %s",
                             traceback.format_exc())


if __name__ == "__main__":
    import ufora.config.Mainline as Mainline
    Mainline.UnitTestMainline([FORA, Runtime])
示例#2
0
            f,
            maxNToSearch=20,
            timeoutInSec=20.0)

    def test_vector_dot_product_large(self):
        self.vector_dot_product(1000000.0)

    def test_vector_dot_product_small(self):
        self.vector_dot_product(1000.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)


if __name__ == '__main__':
    import ufora.config.Mainline as Mainline
    Mainline.UnitTestMainline([])
示例#3
0
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import unittest
import pyfora
import ufora.config.Setup as Setup
import ufora.FORA.CUDA.test.GpuPerformanceTestCases as GpuPerformanceTestCases
import ufora.FORA.CUDA.test.GpuTestUtil as GpuTestUtil
import ufora.FORA.python.FORA as FORA

class GpuPythonPerformanceTests(
        unittest.TestCase,
        GpuTestUtil.GpuTestUtil,
        GpuPerformanceTestCases.GpuPerformanceTestCases
        ):
    pass

if __name__ == '__main__':
    import ufora.config.Mainline as Mainline
    Mainline.UnitTestMainline([FORA])

示例#4
0
                    testMessage, {
                        "DEBUG":
                        testMessage if loggingLevel <= logging.DEBUG else None,
                        "INFO":
                        testMessage if loggingLevel <= logging.INFO else None,
                        "WARN":
                        testMessage if loggingLevel <= logging.WARN else None,
                        "ERROR":
                        testMessage if loggingLevel <= logging.ERROR else None,
                        "CRITICAL":
                        testMessage
                        if loggingLevel <= logging.CRITICAL else None
                    })
            except:
                traceback.print_exc()
                raise
                pass

    def test_logging_basic(self):
        for level in levels:
            loggingLevel = getattr(logging, level)
            NativeLogging.setLogLevel(loggingLevel)
            for testLevel in levels:
                self.assertEqual(
                    NativeLogging.shouldLog(getattr(logging, testLevel)), True
                    if loggingLevel <= getattr(logging, testLevel) else False)


if __name__ == '__main__':
    Mainline.UnitTestMainline([], disableLogCapture=True)
示例#5
0
        for t in threads:
            t.start()

        for t in threads:
            t.join()

        expectedDict = {}
        for ix in range(threadcount):
            expectedDict[ix] = True

        self.assertEqual(expectedDict, worked)

    def testWithTcp(self):
        self.stressMultipleSharedStateReadWrites(True, 200)

    def testWithRelay(self):
        self.stressMultipleSharedStateReadWrites(False, 200)

    @classmethod
    def tearDownClass(cls):
        cls.simulator.stopService()


if __name__ == '__main__':
    import ufora.config.Mainline as Mainline
    import ufora.config.LoginConfiguration as LoginConfiguration
    Mainline.UnitTestMainline(
        loginConfiguration=LoginConfiguration.LoginConfiguration(
            "test_admin", "asdfasdf", True, {}))
示例#6
0
                FORA.eval(
                    "fun(){ let f = fun() { throw 1 }; try { f() } catch(...) { throw 2 } }"
                )), FORANative.symbol_Call)))

        context.compute()
        self.assertTrue(context.getFinishedResult().isException())

    def stringAllocShouldFailFun(self, ct):
        return FORA.extractImplValContainer(
            FORA.eval("""fun()
                    {
                    let s = "*";
                    let i = 0;
                    while (i < 100000)
                        {
                        s = s + "%s" + s + "%s";
                        i = i + 1;
                        }
                    }
                """ % (" ", " " * ct)))

    def test_large_string_alloc_fails_and_raises_foravalue_error(self):
        for ix in range(10):
            val = ForaValue.FORAValue(self.stringAllocShouldFailFun(ix))
            self.assertRaises(ForaValue.FORAFailure, val)


if __name__ == "__main__":
    import ufora.config.Mainline as Mainline
    Mainline.UnitTestMainline([ExecutionContext, Evaluator])