本文整理汇总了Python中ufora.cumulus.test.InMemoryCumulusSimulation类的典型用法代码示例。如果您正苦于以下问题:Python InMemoryCumulusSimulation类的具体用法?Python InMemoryCumulusSimulation怎么用?Python InMemoryCumulusSimulation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InMemoryCumulusSimulation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_sortVecOfVec
def test_sortVecOfVec(self):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
text = """
let values = []
let ct = 500000
values = [(ix % 100, Vector.range(40)) for ix in sequence(ct)]
let res = cached`(#ExternalIoTask(#DistributedDataOperation(#Sort(values.paged))));
let firstAreSorted = true;
for ix in sequence(size(res)-1)
if (res[ix][0] > res[ix+1][0])
firstAreSorted = false;
size(res) == size(values) and firstAreSorted
"""
result = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
text,
s3,
1,
timeout=TIMEOUT,
memoryLimitMb=3000
)
self.assertTrue(result is not None)
self.assertTrue(result.isResult(), result)
self.assertTrue(result.asResult.result.pyval == True, result)
开发者ID:ufora,项目名称:ufora,代码行数:30,代码来源:DistributedDataTasks_test.py
示例2: test_transposeToColumnMajor
def test_transposeToColumnMajor(self):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
nRows = 100000
nColumns = 50
result, simulation = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
self.transposeSetupScript(nRows, nColumns),
s3, 1, timeout = 300, memoryLimitMb = 45 * 1024, threadCount = 30,
returnSimulation = True, useInMemoryCache = False)
try:
self.assertTrue(result.isResult())
rowMajor = result.asResult.result
t0 = time.time()
result = simulation.compute(
self.transposeRowMajorToColumnMajorScript(nRows, nColumns),
timeout = 500,
rowMajor = rowMajor
)
totalTimeToReturnResult = time.time() - t0
self.assertTrue(result.isResult())
PerformanceTestReporter.recordTest(
"algorithms.text.transposeRowMajorToColumnMajor.%srows_%scolumns" % (nRows, nColumns),
totalTimeToReturnResult, None)
finally:
simulation.teardown()
开发者ID:vishnur,项目名称:ufora,代码行数:32,代码来源:testTextManipulation.py
示例3: classSortingTest
def classSortingTest(self, sz, useClass = True, machines=1, memory=1000):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
text = """
let N = __size__;
let C = if (__use_class__) { class { member x; } } else { Int64 }
let values = Vector.range(N, C).paged;
let s1 = cached`(#ExternalIoTask(#DistributedDataOperation(#Sort(values))))
return size(s1) == N
""".replace("__size__", str(sz)).replace("__use_class__", '1' if useClass else '0')
result = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
text,
s3,
machines,
timeout=TIMEOUT,
memoryLimitMb=memory
)
self.assertTrue(result is not None)
self.assertTrue(result.isResult(), result)
self.assertTrue(result.asResult.result.pyval == True, result)
开发者ID:WantonSoup,项目名称:ufora,代码行数:26,代码来源:DistributedDataTasks_test.py
示例4: multiboxDataTasksSort
def multiboxDataTasksSort(self, ct, workers=2, memoryLimit=100, pageSizeOverrideMB=1):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
text = """
let N = __ct__;
let aPrime = 503
let toSort = Vector.range(N, { ((_ * _) % aPrime, _) }).paged;
let result = cached`(#ExternalIoTask(#DistributedDataOperation(#Sort(toSort))))
sorting.isSorted(result)
""".replace("__ct__", str(ct))
result = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
text,
s3,
workers,
timeout=TIMEOUT,
memoryLimitMb=memoryLimit,
pageSizeOverride=pageSizeOverrideMB*1024*1024
)
self.assertTrue(result is not None)
self.assertTrue(result.isResult(), result)
self.assertTrue(result.asResult.result.pyval == True, result)
开发者ID:WantonSoup,项目名称:ufora,代码行数:26,代码来源:DistributedDataTasks_test.py
示例5: test_sortHeterogeneous
def test_sortHeterogeneous(self):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
text = """
let values = []
let ct = 1000000
for ix in sequence(ct)
values = values :: ix :: Float64(ix)
let sortedVals = cached`(#ExternalIoTask(#DistributedDataOperation(#Sort(values.paged))))
let sortedAndHomogenous = fun(v) {
for ix in sequence(size(v)-1)
if (v[ix] >= v[ix+1] or `TypeJOV(v[ix]) is not `TypeJOV(v[ix+1]))
throw (ix, v[ix], v[ix+1])
return true;
}
if (size(sortedVals) != size(values))
throw "expected " + String(size(values)) + ", not " + String(size(sortedVals))
sortedAndHomogenous(sortedVals[,ct]) and
sortedAndHomogenous(sortedVals[ct,])
"""
result = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
text,
s3,
1,
timeout=TIMEOUT,
memoryLimitMb=1000
)
self.assertTrue(result is not None)
self.assertTrue(result.isResult(), result)
self.assertTrue(result.asResult.result.pyval == True, result)
开发者ID:WantonSoup,项目名称:ufora,代码行数:35,代码来源:DistributedDataTasks_test.py
示例6: test_multiboxDataTasksTake_1
def test_multiboxDataTasksTake_1(self):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
text = """
let N = 10000000;
let isPrime = fun(p) {
let x = 2
while (x*x <= p) {
if (p%x == 0)
return 0
x = x + 1
}
return x
}
let takeFrom = Vector.range(N, isPrime).paged;
let indices = Vector.range(N,fun(x) { (0, (x * 503) % N ) }).paged;
cached`(#ExternalIoTask(#DistributedDataOperation(#Take(indices, takeFrom)))) ==
indices ~~ { takeFrom[_[1]] }
"""
result = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
text,
s3,
2,
timeout=TIMEOUT,
memoryLimitMb=1000
)
self.assertTrue(result is not None)
self.assertTrue(result.isResult(), result)
self.assertTrue(result.asResult.result.pyval == True, result)
开发者ID:WantonSoup,项目名称:ufora,代码行数:33,代码来源:DistributedDataTasks_test.py
示例7: basic_gpu_works_helper
def basic_gpu_works_helper(self, function, onGPU=True):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
testingVectorText = "Vector.range(1024*4, {_+1000000})"
text = """
let f = fun(ct) {
let res = 0.0
let x = 1.0
while (x < ct)
{
x = x + 1.0
res = res + `""" + function + """(x)
}
res
}"""
if onGPU:
text += """`CUDAVectorApply(f,""" + testingVectorText + """)"""
else:
text += testingVectorText + """ ~~ f"""
res = InMemoryCumulusSimulation.computeUsingSeveralWorkers(text, s3, 1, timeout=120, threadCount=4)
self.assertIsNotNone(res)
self.assertTrue(res.isResult(), res)
开发者ID:Sandy4321,项目名称:ufora,代码行数:25,代码来源:GpuTestCases.py
示例8: test_takeFromLargeObjects
def test_takeFromLargeObjects(self):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
text = """
let N = 100;
//each string is 1 MB
let takeFrom = [" " * 100 * 100 * 10 * 10 + " " * ix for ix in sequence(N)].paged;
let indices = Vector.range(N,fun(x) { x }).paged;
cached`(#ExternalIoTask(#DistributedDataOperation(#Take(indices, takeFrom))))
"""
try:
result, simulation = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
text,
s3,
1,
timeout=TIMEOUT,
memoryLimitMb=1000,
returnSimulation = True,
pageSizeOverride = 1024 * 1024
)
self.assertTrue(result is not None)
self.assertTrue(result.isResult(), result)
for page in result.asResult.result.getVectorPageIds(simulation.getWorkerVdm(0)):
self.assertLess(page.bytecount / 1024.0 / 1024.0, 2.0)
finally:
simulation.teardown()
开发者ID:WantonSoup,项目名称:ufora,代码行数:31,代码来源:DistributedDataTasks_test.py
示例9: basicTaskPathwayTest
def basicTaskPathwayTest(self, sz, machines=1, memory=1000):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
text = """
let N = __size__;
//let values = Vector.range(N,fun(x) { ((x * 503) % N, x) }).paged;
let values = Vector.range(N).paged;
let s1 = cached`(#ExternalIoTask(#DistributedDataOperation(#Sort(values))))
let s2 = sorting.sort(values)
if (size(s1) != size(s2))
return 'wrong size: %s != %s'.format(size(s1), size(s2))
for ix in sequence(size(s1))
if (s1[ix] != s2[ix])
return 'not equal: index=%s. %s != %s'.format(ix, s1[ix], s2[ix])
return true
""".replace("__size__", str(sz))
result = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
text,
s3,
machines,
timeout=TIMEOUT,
memoryLimitMb=memory
)
self.assertTrue(result is not None)
self.assertTrue(result.isResult(), result)
self.assertTrue(result.asResult.result.pyval == True, result)
开发者ID:WantonSoup,项目名称:ufora,代码行数:31,代码来源:DistributedDataTasks_test.py
示例10: test_vector_string_apply
def test_vector_string_apply(self):
#verify that the compiler doesn't crap out during many runs.
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
InMemoryCumulusSimulation.computeUsingSeveralWorkers("""
let v = Vector.range(10000000)
let v2 = v.apply(String)
let v3 = v2.apply({_ + "a"})
v3.sum(size)
""",
s3,
4,
timeout=240
)
开发者ID:vishnur,项目名称:ufora,代码行数:17,代码来源:CumulusWorkerDatasetLoadServiceIntegrationTest_test.py
示例11: gbmRegressionFittingTest
def gbmRegressionFittingTest(self, nRows, nColumns, depth, nThreads, maxBoosts):
testName = self.getTestName(nRows, nColumns, depth, maxBoosts, nThreads)
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
result, simulation = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
self.dataGenerationScript(nRows, nColumns),
s3,
1,
timeout = 360,
memoryLimitMb = 30 * 1024,
threadCount = nThreads,
returnSimulation = True,
useInMemoryCache = False
)
try:
self.assertTrue(result.isResult())
dfPredictors, dfResponse = result.asResult.result
fitter = simulation.compute(
self.regressionScript(depth, 1),
timeout = 360,
dfResponse = dfResponse,
dfPredictors = dfPredictors
).asResult.result
t0 = time.time()
for nBoosts in range(1, maxBoosts):
testName = self.getTestName(nRows, nColumns, depth, nBoosts, nThreads)
predictions = simulation.compute(
"fitter.predictionsAndPseudoresiduals()",
timeout = 360,
fitter = fitter
).asResult.result
totalTimeToReturnResult = time.time() - t0
PerformanceTestReporter.recordTest(
testName + "_predict", totalTimeToReturnResult, None)
fitter = simulation.compute(
"fitter.nextGivenPredictions(predictions)",
timeout = 360,
fitter = fitter,
predictions = predictions
).asResult.result
totalTimeToReturnResult = time.time() - t0
PerformanceTestReporter.recordTest(
testName, totalTimeToReturnResult, None)
finally:
simulation.teardown()
开发者ID:Sandy4321,项目名称:ufora,代码行数:55,代码来源:testGbmRegression.py
示例12: test_disk_scans
def test_disk_scans(self):
s3 = ActualS3Interface.ActualS3InterfaceFactory()
objectStore = S3ObjectStore.S3ObjectStore(
s3,
Setup.config().userDataS3Bucket,
prefix="test_object_cache/"
)
_, simulation = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
"1+1",
s3,
1,
memoryLimitMb=1 * 1024,
threadCount=30,
returnSimulation=True,
ioTaskThreadOverride=8,
objectStore=objectStore,
useInMemoryCache=False #use an actual disk cache for this
)
try:
gigabytes = 8
t0 = time.time()
resultVectors = []
for ix in range(gigabytes):
result = simulation.compute("Vector.range(125000000 + %s)" % ix, timeout=120)
resultVectors.append(result.asResult.result)
t1 = time.time()
intResults = []
for vec in resultVectors:
result = simulation.compute("v.sum()", timeout = 120, v=vec)
intResults.append(result.asResult.result.pyval)
self.assertTrue(len(intResults) == gigabytes)
PerformanceTestReporter.recordTest(
"python.BigBox.Disk.Write.10GB",
t1 - t0,
None
)
PerformanceTestReporter.recordTest(
"python.BigBox.Disk.WriteAndScan.%sGB" % gigabytes,
time.time() - t0,
None
)
finally:
simulation.teardown()
开发者ID:Sandy4321,项目名称:ufora,代码行数:53,代码来源:testBigboxDiskPerf.py
示例13: takeTest
def takeTest(indexExpr):
result = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
takeText.replace("__indices__", indexExpr),
s3,
1,
timeout=TIMEOUT,
memoryLimitMb=1000
)
self.assertTrue(result is not None)
self.assertTrue(result.isResult(), result)
self.assertTrue(result.asResult.result.pyval == True, result)
开发者ID:WantonSoup,项目名称:ufora,代码行数:12,代码来源:DistributedDataTasks_test.py
示例14: largeDatasetJoinTest
def largeDatasetJoinTest(self, mbOfData, columns, threads, machineCount, ratio = .5):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
t0 = time.time()
result, simulation = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
self.dataGenerationScript(mbOfData, columns),
s3,
machineCount,
timeout = 360,
memoryLimitMb = mbOfData / ratio / machineCount,
#channelThroughputMBPerSecond = 100.0,
threadCount = threads,
returnSimulation = True,
useInMemoryCache = False,
disableEventHandler = True
)
try:
self.assertTrue(result.isResult())
data = result.asResult.result
joinScript = """
let leftDF = dataframe.DataFrame(data[,size(data)/2])
let rightDF = dataframe.DataFrame(data[size(data)/2,])
size(leftDF.join(rightDF, on: "C0", how: `outer, chunkSize: 1000000, areSorted:true))
"""
t0 = time.time()
result = simulation.compute(
joinScript,
timeout=1080,
data=data
)
totalTimeToReturnResult = time.time() - t0
logging.info("Total time to join: %s", totalTimeToReturnResult)
self.assertTrue(result.isResult(), result)
PerformanceTestReporter.recordTest(
"algorithms.Join.inMemory_%sMB_%scols_%sthreads_%smachines" %
(mbOfData, columns,threads,machineCount),
totalTimeToReturnResult,
None
)
finally:
dfResponse = None
dfPredictors = None
result = None
simulation.teardown()
开发者ID:WantonSoup,项目名称:ufora,代码行数:53,代码来源:MultimachineJoinSimulation_test.py
示例15: test_importanceSampling
def test_importanceSampling(self):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
result = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
importanceSampling,
s3,
4,
memoryLimitMb = 1000,
timeout=240,
useInMemoryCache = False
)
self.assertTrue(result.isResult())
开发者ID:WantonSoup,项目名称:ufora,代码行数:13,代码来源:InMemoryImportanceSamplingTest_test.py
示例16: test_bigLmOnDataframe
def test_bigLmOnDataframe(self):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
result = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
importanceSampling,
s3,
1,
memoryLimitMb = 4000,
threadCount = 4,
timeout=240,
useInMemoryCache = False
)
self.assertTrue(result.isResult(), result)
开发者ID:WantonSoup,项目名称:ufora,代码行数:14,代码来源:BigLmOnDataframeTest_test.py
示例17: check_precision_of_function_on_GPU
def check_precision_of_function_on_GPU(self, function, input):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
text = """
let f = fun(x) {
`""" + function + """(x)
}
`CUDAVectorApply(f, [""" + str(input) + """])[0]
"""
res = InMemoryCumulusSimulation.computeUsingSeveralWorkers(text, s3, 1, timeout=120, threadCount=4)
self.assertIsNotNone(res)
self.assertTrue(res.isResult(), res)
gpuValue = res.asResult.result.pyval
methodToCall = getattr(math, function)
pythonValue = methodToCall(input)
self.assertTrue(abs(gpuValue - pythonValue) < 1e-10)
开发者ID:Sandy4321,项目名称:ufora,代码行数:15,代码来源:GpuTestCases.py
示例18: largeDatasetBigLMTest
def largeDatasetBigLMTest(self, mbOfData, columns, threads, testName):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
t0 = time.time()
result, simulation = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
self.dataGenerationScript(mbOfData, columns),
s3,
1,
timeout = 360,
memoryLimitMb = 50 * 1024,
threadCount = threads,
returnSimulation = True,
useInMemoryCache = False
)
if testName is not None:
PerformanceTestReporter.recordTest(testName + "_create", time.time() - t0, None)
try:
self.assertTrue(result.isResult())
dfResponse, dfPredictors = result.asResult.result
regressionScript = """
let model = math.regression.LinearRegression(dfPredictors, dfResponse, fitIntercept: false);
let coefficients = model.coefficients();
coefficients[0]
"""
t0 = time.time()
result = simulation.compute(
regressionScript,
timeout=1080,
dfResponse=dfResponse,
dfPredictors=dfPredictors
)
totalTimeToReturnResult = time.time() - t0
self.assertTrue(result.isResult())
if testName is not None:
PerformanceTestReporter.recordTest(testName, totalTimeToReturnResult, None)
finally:
dfResponse = None
dfPredictors = None
result = None
simulation.teardown()
开发者ID:vishnur,项目名称:ufora,代码行数:48,代码来源:bigLM_test.py
示例19: test_vector_transpose
def test_vector_transpose(self):
#verify that the compiler doesn't crap out during many runs.
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
_, simulation = InMemoryCumulusSimulation.computeUsingSeveralWorkers("1+1",
s3,
2,
memoryLimitMb = 500,
timeout=10,
returnSimulation = True,
channelThroughputMBPerSecond = 50.0
)
try:
result = simulation.compute("""
let arrangedContiguously = fun (vecs) {
let res = vecs.sum().paged;
let tr = []
let low = 0
for v in vecs {
tr = tr :: res[low,low+size(v)]
low = low + size(v)
}
tr
};
let transpose = fun(vecOfIndexable) {
let vecs = arrangedContiguously(vecOfIndexable)
let n = size(vecs[0]);
[[vecs[jx][ix] for jx in sequence(size(vecs))] for ix in sequence(n)]
};
let vectors = Vector.range(5000, {Vector.range(300)})
transpose(vectors)
""",
timeout = 30.0
)
self.assertTrue(result.isResult())
finally:
simulation.teardown()
开发者ID:vishnur,项目名称:ufora,代码行数:47,代码来源:CumulusWorkerDatasetLoadServiceIntegrationTest_test.py
示例20: gbmRegressionFittingTest
def gbmRegressionFittingTest(self, nRows, nColumns, depth, nThreads, nBoosts, copies, report=True):
s3 = InMemoryS3Interface.InMemoryS3InterfaceFactory()
result, simulation = InMemoryCumulusSimulation.computeUsingSeveralWorkers(
self.dataGenerationScript(nRows, nColumns),
s3,
1,
timeout = 360,
memoryLimitMb = 30 * 1024,
threadCount = nThreads,
returnSimulation = True,
useInMemoryCache = False
)
try:
self.assertTrue(result.isResult())
dfPredictors, dfResponse = result.asResult.result
builder = simulation.compute(
self.regressionScript(depth, nBoosts),
timeout = 360,
dfResponse = dfResponse,
dfPredictors = dfPredictors
).asResult.result
t0 = time.time()
testName = self.getTestName(nRows, nColumns, depth, nBoosts, nThreads, copies)
result = simulation.compute(
"Vector.range(%s).apply(fun(x) { builder.fit(dfPredictors[,-x-1], dfResponse[,-x-1]) })"
% copies,
timeout = 360,
builder=builder,
dfPredictors=dfPredictors,
dfResponse=dfResponse,
).asResult.result
totalTimeToReturnResult = time.time() - t0
if report:
PerformanceTestReporter.recordTest(testName, totalTimeToReturnResult, None)
finally:
simulation.teardown()
开发者ID:Sandy4321,项目名称:ufora,代码行数:46,代码来源:testBigboxGbmSimultaneous.py
注:本文中的ufora.cumulus.test.InMemoryCumulusSimulation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论