Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
gpucloudsim
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LPDS
gpucloudsim
Commits
350e61ea
Commit
350e61ea
authored
Jan 05, 2012
by
Anton Beloglazov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the examples of the IRQ policy with a random workload
parent
c73c1838
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
172 deletions
+106
-172
Constants.java
.../java/org/cloudbus/cloudsim/examples/power/Constants.java
+1
-1
IqrMmt.java
...a/org/cloudbus/cloudsim/examples/power/random/IqrMmt.java
+35
-57
IqrMu.java
...va/org/cloudbus/cloudsim/examples/power/random/IqrMu.java
+35
-57
IqrRs.java
...va/org/cloudbus/cloudsim/examples/power/random/IqrRs.java
+35
-57
No files found.
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/Constants.java
View file @
350e61ea
...
@@ -10,7 +10,7 @@ public class Constants {
...
@@ -10,7 +10,7 @@ public class Constants {
public
final
static
boolean
OUTPUT_CSV
=
false
;
public
final
static
boolean
OUTPUT_CSV
=
false
;
public
final
static
double
SCHEDULING_INTERVAL
=
300
;
public
final
static
double
SCHEDULING_INTERVAL
=
300
;
public
final
static
double
SIMULATION_LIMIT
=
24
*
60
*
6
0
;
public
final
static
double
SIMULATION_LIMIT
=
24
*
60
*
1
0
;
public
final
static
int
CLOUDLET_LENGTH
=
2500
*
(
int
)
SIMULATION_LIMIT
;
public
final
static
int
CLOUDLET_LENGTH
=
2500
*
(
int
)
SIMULATION_LIMIT
;
public
final
static
int
CLOUDLET_PES
=
1
;
public
final
static
int
CLOUDLET_PES
=
1
;
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrMmt.java
View file @
350e61ea
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationInterQuartileRange
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumMigrationTime
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Inter Quartile Range
* the time.
* (IQR) VM allocation policy and Minimum Migration Time (MMT) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
IqrMmt
{
public
class
IqrMmt
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"iqr_mmt_1"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
try
{
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
vmSelectionPolicy
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationInterQuartileRange
(
parameter
);
hostList
,
new
PowerVmSelectionPolicyMinimumMigrationTime
(),
1
),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"Unwanted errors happen"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrMu.java
View file @
350e61ea
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationInterQuartileRange
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumUtilization
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Inter Quartile Range
* the time.
* (IQR) VM allocation policy and Minimum Utilization (MU) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
IqrMu
{
public
class
IqrMu
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"iqr_mu_1"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
try
{
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
vmSelectionPolicy
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationInterQuartileRange
(
parameter
);
hostList
,
new
PowerVmSelectionPolicyMinimumUtilization
(),
1
),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"Unwanted errors happen"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrRs.java
View file @
350e61ea
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationInterQuartileRange
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Inter Quartile Range
* the time.
* (IQR) VM allocation policy and Random Selection (RS) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
IqrRs
{
public
class
IqrRs
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"iqr_rs_1"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
try
{
String
vmSelectionPolicy
=
"rs"
;
// Random Selection VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
vmSelectionPolicy
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationInterQuartileRange
(
parameter
);
hostList
,
new
PowerVmSelectionPolicyRandomSelection
(),
1
),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"The simulation has been terminated due to an unexpected error"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment