Example #1
0
 def testPolyCompModel2Cost(self):
     points = [SimpleDataPoint(cpuCount=1, cpu=1, time=100, probSize=35, totalMemory=100), 
               SimpleDataPoint(cpuCount=2, cpu=2, time=30, probSize=35, totalMemory=100), 
               SimpleDataPoint(cpuCount=1, cpu=1, time=200, probSize=70, totalMemory=100)]
     
     model = GustafsonCompModel(dataPoints=points, scaleFunction='linear')
     
     cloud = EC2Cloud(None, 
                     name="Ec2", 
                     serviceURL="",
                     storageURL="",
                     botoModule=None,
                     ec2Cert="",
                     instanceTypes=[
                                    InstanceType('m1.small', 2, 1, 256, 2, None, 1.0),
                                    InstanceType('m1.large', 2, 2, 1792, 15, None, 2.0),
                                    InstanceType('m1.xlarge', 2, 1, 1792, 20, None, 3.0),
                                    InstanceType('c1.medium', 2, 2, 512, 5, None, 2.0),
                                    InstanceType('c1.xlarge', 2, 4, 1792, 20, None, 3.0)
                                    ]
                                    )
     
     costModel = model.costModel(cloud)
     self.assertNotEquals(None, costModel)
     
     ''' Small problems will go for single cheapest instance'''
     self.assertEquals(1.0, costModel(1))
     self.assertEquals(1.0, costModel(0.1))
     
     self.assertAlmostEquals(2642.8571428574, model.modelFunc(probSize=25 * 37 * 2, cpu=2, count=1 ))
     
     ''' Should run on single m1.small for  1hr< time <2hr'''
     self.assertEquals(2.0, costModel(35 * 37 * 2))
     self.assertEquals(2.0, costModel(35 * 38 * 2))
Example #2
0
 def testPolyCompModel2Simple2(self):
     points = [SimpleDataPoint(cpuCount=1, cpu=1, time=1100, probSize=35, totalMemory=100), 
               SimpleDataPoint(cpuCount=2, cpu=2, time=300, probSize=35, totalMemory=100), 
               SimpleDataPoint(cpuCount=1, cpu=1, time=2000, probSize=70, totalMemory=100),
               SimpleDataPoint(cpuCount=1, cpu=1, time=3100, probSize=105, totalMemory=100)]
     
     model = GustafsonCompModel(dataPoints=points, scaleFunction='linear')
     
     ''' Assert speed up func matches observation '''
     self.assertAlmostEquals(1.83333333, model.speedUpFunc(2))
     
     ''' Assert speed up func matches expectation'''
     self.assertAlmostEquals(2.666666666, model.speedUpFunc(3))
     
     
     
     ''' Test that the single proc line fits between the observations '''
     self.assertAlmostEquals(1066.66666666, model.time_1_func(35))
     self.assertAlmostEquals(2066.66666666, model.time_1_func(70))
     self.assertAlmostEquals(3066.66666666, model.time_1_func(105))
     
     self.assertAlmostEquals(400.0000, model.modelFunc(probSize=35, cpu=1, count=3))