diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2025-07-22 15:47:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-22 15:47:44 +0200 |
| commit | e22c97dcca7478d6941b78bdf7cd873bc0d23cdc (patch) | |
| tree | f1859c16f4c7973d8b16ed693caad4c749d42331 /opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base | |
| parent | 0c0cf25616771cd40a9e401edcba4a5e5016f76e (diff) | |
Updated workload schema (#360)
Diffstat (limited to 'opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base')
11 files changed, 687 insertions, 542 deletions
diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/BatteryTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/BatteryTest.kt index a85c84f3..f2ab32d3 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/BatteryTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/BatteryTest.kt @@ -42,10 +42,10 @@ class BatteryTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), submissionTime = "2022-01-01T00:00", ), @@ -68,10 +68,10 @@ class BatteryTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), submissionTime = "2022-01-01T00:00", ), @@ -95,10 +95,10 @@ class BatteryTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(20 * 60 * 1000, 1000.0, 1), + TraceFragment(20 * 60 * 1000, 1000.0), ), submissionTime = "2022-01-01T00:00", ), @@ -123,10 +123,10 @@ class BatteryTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(30 * 60 * 1000, 1000.0, 1), + TraceFragment(30 * 60 * 1000, 1000.0), ), submissionTime = "2022-01-01T00:00", ), @@ -150,10 +150,10 @@ class BatteryTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(30 * 60 * 1000, 1000.0, 1), + TraceFragment(30 * 60 * 1000, 1000.0), ), submissionTime = "2022-01-01T00:00", ), @@ -193,9 +193,9 @@ class BatteryTest { repeat(numTasks) { this.add( createTestTask( - name = "0", + id = 0, fragments = - arrayListOf(TraceFragment(10 * 60 * 1000, 1000.0, 1)), + arrayListOf(TraceFragment(10 * 60 * 1000, 1000.0)), submissionTime = "2022-01-01T00:00", ), ) @@ -218,10 +218,10 @@ class BatteryTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), submissionTime = "2022-01-01T00:00", ), @@ -251,10 +251,10 @@ class BatteryTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), checkpointInterval = 60 * 1000L, checkpointDuration = 1000L, diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/CarbonTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/CarbonTest.kt index a0f5978f..f2ee3b53 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/CarbonTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/CarbonTest.kt @@ -46,10 +46,10 @@ class CarbonTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(120 * 60 * 1000, 1000.0, 1), + TraceFragment(120 * 60 * 1000, 1000.0), ), submissionTime = "2022-01-01T00:00", ), @@ -93,17 +93,17 @@ class CarbonTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(40 * 60 * 1000, 1000.0, 1), - TraceFragment(40 * 60 * 1000, 2000.0, 1), - TraceFragment(40 * 60 * 1000, 1000.0, 1), - TraceFragment(40 * 60 * 1000, 2000.0, 1), - TraceFragment(40 * 60 * 1000, 1000.0, 1), - TraceFragment(40 * 60 * 1000, 2000.0, 1), - TraceFragment(40 * 60 * 1000, 1000.0, 1), - TraceFragment(40 * 60 * 1000, 2000.0, 1), + TraceFragment(40 * 60 * 1000, 1000.0), + TraceFragment(40 * 60 * 1000, 2000.0), + TraceFragment(40 * 60 * 1000, 1000.0), + TraceFragment(40 * 60 * 1000, 2000.0), + TraceFragment(40 * 60 * 1000, 1000.0), + TraceFragment(40 * 60 * 1000, 2000.0), + TraceFragment(40 * 60 * 1000, 1000.0), + TraceFragment(40 * 60 * 1000, 2000.0), ), submissionTime = "2022-01-01T00:00", ), @@ -162,10 +162,10 @@ class CarbonTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(60 * 60 * 1000, 1000.0, 1), + TraceFragment(60 * 60 * 1000, 1000.0), ), submissionTime = "2022-01-01T00:00", ), diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/DistributionPoliciesTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/DistributionPoliciesTest.kt index 68111bc1..256c067d 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/DistributionPoliciesTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/DistributionPoliciesTest.kt @@ -89,11 +89,13 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 2000.0), ), + cpuCount = 0, + gpuCount = 1, ), ) @@ -105,8 +107,8 @@ class DistributionPoliciesTest { assertAll( // single gpu - { assertEquals(2000.0, singleMonitor.taskGpuDemands["0"]?.get(1), "Single GPU demand in task \"0\" should be 2000.0") }, - { assertEquals(4000.0, singleMonitor.taskGpuSupplied["0"]?.get(1), "Single GPU demand in task \"0\" should be 2000.0") }, + { assertEquals(2000.0, singleMonitor.taskGpuDemands[0]?.get(1), "Single GPU demand in task \"0\" should be 2000.0") }, + { assertEquals(4000.0, singleMonitor.taskGpuSupplied[0]?.get(1), "Single GPU demand in task \"0\" should be 2000.0") }, { assertEquals( 4000.0, @@ -122,8 +124,8 @@ class DistributionPoliciesTest { ) }, // double gpu - { assertEquals(2000.0, doubleMonitor.taskGpuDemands["0"]?.get(1), "Double GPU demand in task \"0\" should be 2000.0") }, - { assertEquals(4000.0, doubleMonitor.taskGpuSupplied["0"]?.get(1), "Double GPU supplied in task \"0\" should be 4000.0") }, + { assertEquals(2000.0, doubleMonitor.taskGpuDemands[0]?.get(1), "Double GPU demand in task \"0\" should be 2000.0") }, + { assertEquals(4000.0, doubleMonitor.taskGpuSupplied[0]?.get(1), "Double GPU supplied in task \"0\" should be 4000.0") }, { assertEquals( 2000.0, @@ -164,18 +166,22 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 4000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 4000.0), ), + cpuCount = 0, + gpuCount = 2, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 4000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 4000.0), ), + cpuCount = 0, + gpuCount = 2, ), ) @@ -188,11 +194,11 @@ class DistributionPoliciesTest { assertAll( // single gpu // task 0 - { assertEquals(4000.0, singleMonitor.taskGpuDemands["0"]?.get(1), "Single GPU demand in task \"0\" should be 4000.0") }, - { assertEquals(2000.0, singleMonitor.taskGpuSupplied["0"]?.get(1), "Single GPU supplied in task \"0\" should be 2000.0") }, + { assertEquals(4000.0, singleMonitor.taskGpuDemands[0]?.get(1), "Single GPU demand in task \"0\" should be 4000.0") }, + { assertEquals(2000.0, singleMonitor.taskGpuSupplied[0]?.get(1), "Single GPU supplied in task \"0\" should be 2000.0") }, // task 1 - { assertEquals(4000.0, singleMonitor.taskGpuDemands["1"]?.get(1), "Single GPU demand in task \"0\" should be 4000.0") }, - { assertEquals(2000.0, singleMonitor.taskGpuSupplied["1"]?.get(1), "Single GPU supplied in task \"0\" should be 2000.0") }, + { assertEquals(4000.0, singleMonitor.taskGpuDemands[1]?.get(1), "Single GPU demand in task \"0\" should be 4000.0") }, + { assertEquals(2000.0, singleMonitor.taskGpuSupplied[1]?.get(1), "Single GPU supplied in task \"0\" should be 2000.0") }, // host { assertEquals( @@ -210,11 +216,11 @@ class DistributionPoliciesTest { }, // double gpu // task 0 - { assertEquals(4000.0, doubleMonitor.taskGpuDemands["0"]?.get(1), "Double GPU demand in task \"0\" should be 4000.0") }, - { assertEquals(2000.0, doubleMonitor.taskGpuSupplied["0"]?.get(1), "Double GPU supply in task \"0\" should be 2000.0") }, + { assertEquals(4000.0, doubleMonitor.taskGpuDemands[0]?.get(1), "Double GPU demand in task \"0\" should be 4000.0") }, + { assertEquals(2000.0, doubleMonitor.taskGpuSupplied[0]?.get(1), "Double GPU supply in task \"0\" should be 2000.0") }, // task 1 - { assertEquals(4000.0, doubleMonitor.taskGpuDemands["1"]?.get(1), "Double GPU demand in task \"0\" should be 4000.0") }, - { assertEquals(2000.0, doubleMonitor.taskGpuSupplied["1"]?.get(1), "Double GPU supply in task \"0\" should be 2000.0") }, + { assertEquals(4000.0, doubleMonitor.taskGpuDemands[1]?.get(1), "Double GPU demand in task \"0\" should be 4000.0") }, + { assertEquals(2000.0, doubleMonitor.taskGpuSupplied[1]?.get(1), "Double GPU supply in task \"0\" should be 2000.0") }, // host { assertEquals( @@ -256,11 +262,13 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 4000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 4000.0), ), + cpuCount = 0, + gpuCount = 2, ), ) @@ -269,8 +277,8 @@ class DistributionPoliciesTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(4000.0, monitor.taskGpuDemands["0"]?.get(1), "Task GPU demand should be 4000.0") }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task GPU supplied should be 1000.0") }, + { assertEquals(4000.0, monitor.taskGpuDemands[0]?.get(1), "Task GPU demand should be 4000.0") }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(1), "Task GPU supplied should be 1000.0") }, // Host { assertEquals( @@ -300,11 +308,13 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 6000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 6000.0), ), + cpuCount = 0, + gpuCount = 2, ), ) @@ -316,8 +326,8 @@ class DistributionPoliciesTest { // Fixed share ratio of 0.5 means each GPU gets 50% of available capacity = 2000.0 each // Total supplied should be 4000.0 (limited by total capacity) assertAll( - { assertEquals(6000.0, monitor.taskGpuDemands["0"]?.get(1), "Task GPU demand should be 6000.0") }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task GPU supplied should be 1000.0 (limited by the capacity)") }, + { assertEquals(6000.0, monitor.taskGpuDemands[0]?.get(1), "Task GPU demand should be 6000.0") }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(1), "Task GPU supplied should be 1000.0 (limited by the capacity)") }, // Host { assertEquals( @@ -359,18 +369,22 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 3000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 3000.0), ), + cpuCount = 0, + gpuCount = 2, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 3000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 3000.0), ), + cpuCount = 0, + gpuCount = 2, ), ) @@ -383,11 +397,11 @@ class DistributionPoliciesTest { // So each task gets 1000.0, distributed as 1000.0 per GPU (50% share ratio) assertAll( // Task 0 - { assertEquals(3000.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 GPU demand should be 3000.0") }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task 0 GPU supplied should be 1000.0") }, + { assertEquals(3000.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 GPU demand should be 3000.0") }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(1), "Task 0 GPU supplied should be 1000.0") }, // Task 1 - { assertEquals(3000.0, monitor.taskGpuDemands["1"]?.get(1), "Task 1 GPU demand should be 3000.0") }, - { assertEquals(1000.0, monitor.taskGpuSupplied["1"]?.get(1), "Task 1 GPU supplied should be 1000.0") }, + { assertEquals(3000.0, monitor.taskGpuDemands[1]?.get(1), "Task 1 GPU demand should be 3000.0") }, + { assertEquals(1000.0, monitor.taskGpuSupplied[1]?.get(1), "Task 1 GPU supplied should be 1000.0") }, // Host { assertEquals(1000.0, monitor.hostGpuDemands["DualGpuHost"]?.get(1)?.get(0), "GPU 0 total demand at host should be 1000.0") }, { @@ -417,11 +431,13 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1500.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1500.0), ), + cpuCount = 0, + gpuCount = 1, ), ) @@ -433,8 +449,8 @@ class DistributionPoliciesTest { assertAll( // single gpu - should satisfy demand and utilize remaining capacity - { assertEquals(1500.0, singleMonitor.taskGpuDemands["0"]?.get(1), "Single GPU demand in task \"0\" should be 1500.0") }, - { assertEquals(1500.0, singleMonitor.taskGpuSupplied["0"]?.get(1)) { "Single GPU should supply the demanded 1500.0" } }, + { assertEquals(1500.0, singleMonitor.taskGpuDemands[0]?.get(1), "Single GPU demand in task \"0\" should be 1500.0") }, + { assertEquals(1500.0, singleMonitor.taskGpuSupplied[0]?.get(1)) { "Single GPU should supply the demanded 1500.0" } }, // Host { assertEquals( @@ -451,8 +467,8 @@ class DistributionPoliciesTest { ) }, // double gpu - should distribute across both GPUs and utilize remaining capacity - { assertEquals(1500.0, doubleMonitor.taskGpuDemands["0"]?.get(1), "Double GPU demand in task \"0\" should be 1500.0") }, - { assertEquals(1500.0, doubleMonitor.taskGpuSupplied["0"]?.get(1), "Double GPU should supply the demanded 1500.0") }, + { assertEquals(1500.0, doubleMonitor.taskGpuDemands[0]?.get(1), "Double GPU demand in task \"0\" should be 1500.0") }, + { assertEquals(1500.0, doubleMonitor.taskGpuSupplied[0]?.get(1), "Double GPU should supply the demanded 1500.0") }, // Host { assertEquals( @@ -494,18 +510,22 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 3000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 3000.0), ), + cpuCount = 0, + gpuCount = 2, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 2500.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 2500.0), ), + cpuCount = 0, + gpuCount = 2, ), ) @@ -517,11 +537,11 @@ class DistributionPoliciesTest { // Best effort should distribute proportionally based on demand while using round-robin assertAll( // Task 0 - { assertEquals(3000.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 GPU demand should be 3000.0") }, - { assertEquals(3000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task 0 GPU supply should be 1000.0") }, + { assertEquals(3000.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 GPU demand should be 3000.0") }, + { assertEquals(3000.0, monitor.taskGpuSupplied[0]?.get(1), "Task 0 GPU supply should be 1000.0") }, // Task 1 - { assertEquals(2500.0, monitor.taskGpuDemands["1"]?.get(1), "Task 1 GPU demand should be 2500.0") }, - { assertEquals(1000.0, monitor.taskGpuSupplied["1"]?.get(1), "Task 0 GPU supply should be 1000.0") }, + { assertEquals(2500.0, monitor.taskGpuDemands[1]?.get(1), "Task 1 GPU demand should be 2500.0") }, + { assertEquals(1000.0, monitor.taskGpuSupplied[1]?.get(1), "Task 0 GPU supply should be 1000.0") }, // Host { assertEquals(2750.0, monitor.hostGpuDemands["DualGpuHost"]?.get(1)?.get(0), "GPU 0 demand at host should be 2000.0") }, { assertEquals(2000.0, monitor.hostGpuSupplied["DualGpuHost"]?.get(1)?.get(0), "GPU 0 supplied at host should be 2000.0") }, @@ -539,11 +559,13 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 1, ), ) @@ -554,8 +576,8 @@ class DistributionPoliciesTest { // 1. Satisfy the demand // 2. Utilize remaining capacity efficiently assertAll( - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(1), "Task GPU demand should be 1000.0") }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task GPU supplied should be 1000.0") }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(1), "Task GPU demand should be 1000.0") }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(1), "Task GPU supplied should be 1000.0") }, // host { assertEquals(1000.0, monitor.hostGpuDemands["DualGpuHost"]?.get(1)?.get(0), "GPU 0 demand at host should be 1000.0") }, { assertEquals(1000.0, monitor.hostGpuSupplied["DualGpuHost"]?.get(1)?.get(0), "GPU 0 supplied at host should be 1000.0") }, @@ -573,18 +595,22 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 3500.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 3500.0), ), + cpuCount = 0, + gpuCount = 2, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 500.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 500.0), ), + cpuCount = 0, + gpuCount = 2, ), ) @@ -595,10 +621,10 @@ class DistributionPoliciesTest { // Best effort should prioritize the high-demand task differently than equal share assertAll( // Best effort should allocate more to high-demand task compared to equal share - { assertEquals(3500.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 demand should be 3500.0") }, - { assertEquals(3500.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 supply should be 3500.0") }, - { assertEquals(500.0, monitor.taskGpuDemands["1"]?.get(1), "Task 1 demand should be 500.0") }, - { assertEquals(500.0, monitor.taskGpuSupplied["1"]?.get(1), "Task 1 supply should be 500.0") }, + { assertEquals(3500.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 demand should be 3500.0") }, + { assertEquals(3500.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 supply should be 3500.0") }, + { assertEquals(500.0, monitor.taskGpuDemands[1]?.get(1), "Task 1 demand should be 500.0") }, + { assertEquals(500.0, monitor.taskGpuSupplied[1]?.get(1), "Task 1 supply should be 500.0") }, // Host { assertEquals(2000.0, monitor.hostGpuDemands["DualGpuHost"]?.get(1)?.get(0), "GPU 0 demand at host should be 2000.0") }, { assertEquals(2000.0, monitor.hostGpuSupplied["DualGpuHost"]?.get(1)?.get(0), "GPU 0 supplied at host should be 2000.0") }, @@ -616,25 +642,31 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 2000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 2000.0), ), + cpuCount = 0, + gpuCount = 2, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 2000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 2000.0), ), + cpuCount = 0, + gpuCount = 2, ), createTestTask( - name = "2", + id = 2, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 2000.0, 2), + TraceFragment(10 * 60 * 1000, 0.0, 2000.0), ), + cpuCount = 0, + gpuCount = 2, ), ) @@ -645,21 +677,21 @@ class DistributionPoliciesTest { // Best effort should distribute fairly among all tasks in a round-robin manner assertAll( // Task Demands at start - { assertEquals(2000.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 demand should be 2000.0") }, - { assertEquals(2000.0, monitor.taskGpuDemands["1"]?.get(1), "Task 1 demand should be 2000.0") }, - { assertEquals(2000.0, monitor.taskGpuDemands["2"]?.get(1), "Task 2 demand should be 2000.0") }, + { assertEquals(2000.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 demand should be 2000.0") }, + { assertEquals(2000.0, monitor.taskGpuDemands[1]?.get(1), "Task 1 demand should be 2000.0") }, + { assertEquals(2000.0, monitor.taskGpuDemands[2]?.get(1), "Task 2 demand should be 2000.0") }, // Task supplies at start - { assertEquals(2000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task 0 supply at the start should be 2000.0") }, - { assertEquals(0.0, monitor.taskGpuSupplied["1"]?.get(1), "Task 1 supply at the start should be 2000.0") }, - { assertEquals(2000.0, monitor.taskGpuSupplied["2"]?.get(1), "Task 2 supply at the start should be 0.0") }, + { assertEquals(2000.0, monitor.taskGpuSupplied[0]?.get(1), "Task 0 supply at the start should be 2000.0") }, + { assertEquals(0.0, monitor.taskGpuSupplied[1]?.get(1), "Task 1 supply at the start should be 2000.0") }, + { assertEquals(2000.0, monitor.taskGpuSupplied[2]?.get(1), "Task 2 supply at the start should be 0.0") }, // Task supplies second step - { assertEquals(0.0, monitor.taskGpuSupplied["0"]?.get(2), "Task 0 supply at the second step should be 2000.0") }, - { assertEquals(2000.0, monitor.taskGpuSupplied["1"]?.get(2), "Task 1 supply at the second step should be 0.0") }, - { assertEquals(2000.0, monitor.taskGpuSupplied["2"]?.get(2), "Task 2 supply at the second step should be 2000.0") }, + { assertEquals(0.0, monitor.taskGpuSupplied[0]?.get(2), "Task 0 supply at the second step should be 2000.0") }, + { assertEquals(2000.0, monitor.taskGpuSupplied[1]?.get(2), "Task 1 supply at the second step should be 0.0") }, + { assertEquals(2000.0, monitor.taskGpuSupplied[2]?.get(2), "Task 2 supply at the second step should be 2000.0") }, // Task supplies third step - { assertEquals(2000.0, monitor.taskGpuSupplied["0"]?.get(3), "Task 0 supply at the third step should be 2000.0") }, - { assertEquals(2000.0, monitor.taskGpuSupplied["1"]?.get(3), "Task 1 supply at the third step should be 2000.0") }, - { assertEquals(0.0, monitor.taskGpuSupplied["2"]?.get(3), "Task 2 supply at the third step should be 0.0") }, + { assertEquals(2000.0, monitor.taskGpuSupplied[0]?.get(3), "Task 0 supply at the third step should be 2000.0") }, + { assertEquals(2000.0, monitor.taskGpuSupplied[1]?.get(3), "Task 1 supply at the third step should be 2000.0") }, + { assertEquals(0.0, monitor.taskGpuSupplied[2]?.get(3), "Task 2 supply at the third step should be 0.0") }, // Host // At start { assertEquals(3000.0, monitor.hostGpuDemands["DualGpuHost"]?.get(1)?.get(0), "GPU 0 demand at host should be 2000.0") }, @@ -689,18 +721,22 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1500.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1500.0), ), + cpuCount = 0, + gpuCount = 2, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 2, ), ) @@ -711,11 +747,11 @@ class DistributionPoliciesTest { // Total demand (2500.0) is less than total capacity (4000.0), so all should be satisfied assertAll( // Task demands should remain as requested - { assertEquals(1500.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 GPU demand should be 1500.0") }, - { assertEquals(1000.0, monitor.taskGpuDemands["1"]?.get(1), "Task 1 GPU demand should be 1000.0") }, + { assertEquals(1500.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 GPU demand should be 1500.0") }, + { assertEquals(1000.0, monitor.taskGpuDemands[1]?.get(1), "Task 1 GPU demand should be 1000.0") }, // All tasks should be fully satisfied - { assertEquals(1500.0, monitor.taskGpuSupplied["0"]?.get(1), "Task 0 GPU supply should be 1500.0") }, - { assertEquals(1000.0, monitor.taskGpuSupplied["1"]?.get(1), "Task 1 GPU supply should be 1000.0") }, + { assertEquals(1500.0, monitor.taskGpuSupplied[0]?.get(1), "Task 0 GPU supply should be 1500.0") }, + { assertEquals(1000.0, monitor.taskGpuSupplied[1]?.get(1), "Task 1 GPU supply should be 1000.0") }, // First GPU should handle both tasks (total 2500.0, within its 2000.0 capacity limit per task) { assertEquals(2000.0, monitor.hostGpuDemands["DualGpuHost"]?.get(1)?.get(0), "GPU 0 demand should be 2000.0") }, { assertEquals(2000.0, monitor.hostGpuSupplied["DualGpuHost"]?.get(1)?.get(0), "GPU 0 supply should be 2000.0") }, @@ -735,25 +771,31 @@ class DistributionPoliciesTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 2000.0), ), + cpuCount = 0, + gpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 2000.0), ), + cpuCount = 0, + gpuCount = 1, ), createTestTask( - name = "2", + id = 2, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1500.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1500.0), ), + cpuCount = 0, + gpuCount = 1, ), ) @@ -764,14 +806,14 @@ class DistributionPoliciesTest { // only tasks that can fit on individual GPUs should be satisfied assertAll( // Task demands should remain as requested - { assertEquals(2000.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 GPU demand should be 2000.0") }, - { assertEquals(2000.0, monitor.taskGpuDemands["1"]?.get(1), "Task 1 GPU demand should be 2000.0") }, - { assertEquals(1500.0, monitor.taskGpuDemands["2"]?.get(1), "Task 2 GPU demand should be 1500.0") }, + { assertEquals(2000.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 GPU demand should be 2000.0") }, + { assertEquals(2000.0, monitor.taskGpuDemands[1]?.get(1), "Task 1 GPU demand should be 2000.0") }, + { assertEquals(1500.0, monitor.taskGpuDemands[2]?.get(1), "Task 2 GPU demand should be 1500.0") }, // First two tasks should be satisfied (each fits on one GPU) - { assertEquals(2000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task 0 should be fully satisfied") }, - { assertEquals(2000.0, monitor.taskGpuSupplied["1"]?.get(1), "Task 1 should be fully satisfied") }, + { assertEquals(2000.0, monitor.taskGpuSupplied[0]?.get(1), "Task 0 should be fully satisfied") }, + { assertEquals(2000.0, monitor.taskGpuSupplied[1]?.get(1), "Task 1 should be fully satisfied") }, // Third task should receive no supply as no single GPU can satisfy it after first two are allocated - { assertEquals(0.0, monitor.taskGpuSupplied["2"]?.get(1), "Task 2 should receive no supply") }, + { assertEquals(0.0, monitor.taskGpuSupplied[2]?.get(1), "Task 2 should receive no supply") }, // Both GPUs should be fully utilized by the first two tasks { assertEquals(2000.0, monitor.hostGpuDemands["DualGpuHost"]?.get(1)?.get(0), "GPU 0 should have 2000.0 demand") }, { assertEquals(2000.0, monitor.hostGpuSupplied["DualGpuHost"]?.get(1)?.get(0), "GPU 0 should supply 2000.0") }, diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ExperimentTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ExperimentTest.kt index 582fdbee..28096bb8 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ExperimentTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ExperimentTest.kt @@ -52,11 +52,12 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), ) @@ -88,18 +89,20 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(5 * 60 * 1000, 2000.0, 1), + TraceFragment(5 * 60 * 1000, 2000.0), ), + cpuCount = 1, ), ) @@ -139,18 +142,20 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), ) @@ -182,18 +187,20 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(5 * 60 * 1000, 2000.0, 1), + TraceFragment(5 * 60 * 1000, 2000.0), ), + cpuCount = 1, submissionTime = "1970-01-01T00:20", ), ) @@ -226,11 +233,13 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 1, ), ) @@ -272,11 +281,13 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, + gpuCount = 1, ), ) @@ -317,11 +328,13 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 2000.0), ), + cpuCount = 1, + gpuCount = 1, ), ) @@ -361,11 +374,13 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 2000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 2000.0, 1000.0), ), + cpuCount = 1, + gpuCount = 1, ), ) val topology = createTopology("Gpus/single_gpu_no_vendor_no_memory.json") @@ -404,18 +419,22 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, + gpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, + gpuCount = 1, ), ) @@ -455,18 +474,22 @@ class ExperimentTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 0.0, 0), + TraceFragment(10 * 60 * 1000, 1000.0, 0.0), ), + cpuCount = 1, + gpuCount = 0, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 1, ), ) diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FailuresAndCheckpointingTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FailuresAndCheckpointingTest.kt index 4278ca41..892ea1c1 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FailuresAndCheckpointingTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FailuresAndCheckpointingTest.kt @@ -50,11 +50,12 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), ) @@ -90,11 +91,12 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), ) @@ -133,11 +135,12 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), ) @@ -178,11 +181,12 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), ) @@ -237,11 +241,12 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, checkpointInterval = 60 * 1000L, checkpointDuration = 1000L, ), @@ -291,12 +296,13 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 2000.0, 1), - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 2000.0), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, checkpointInterval = 60 * 1000L, checkpointDuration = 1000L, ), @@ -344,12 +350,13 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), - TraceFragment(10 * 60 * 1000, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), + TraceFragment(10 * 60 * 1000, 2000.0), ), + cpuCount = 1, checkpointInterval = 60 * 1000L, checkpointDuration = 1000L, ), @@ -393,11 +400,12 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, checkpointInterval = 60 * 1000L, checkpointDuration = 1000L, checkpointIntervalScaling = 1.5, @@ -435,11 +443,12 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, checkpointInterval = 60 * 1000L, checkpointDuration = 1000L, ), @@ -477,11 +486,12 @@ class FailuresAndCheckpointingTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, checkpointInterval = 60 * 1000L, checkpointDuration = 1000L, ), diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FlowDistributorTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FlowDistributorTest.kt index 606ba571..53ff068e 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FlowDistributorTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FlowDistributorTest.kt @@ -43,12 +43,13 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), - TraceFragment(10 * 60 * 1000, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), + TraceFragment(10 * 60 * 1000, 2000.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_1_2000.json") @@ -56,10 +57,10 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuDemands["0"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuDemands[0]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(10)) { "The cpu used by task 0 is incorrect" } }, { assertEquals(1000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(2000.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(1000.0, monitor.hostCpuSupplied["H01"]?.get(1)) { "The cpu used by the host is incorrect" } }, @@ -78,12 +79,13 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 3000.0, 1), - TraceFragment(10 * 60 * 1000, 4000.0, 1), + TraceFragment(10 * 60 * 1000, 3000.0), + TraceFragment(10 * 60 * 1000, 4000.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_1_2000.json") @@ -91,10 +93,10 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(3000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(4000.0, monitor.taskCpuDemands["0"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(4000.0, monitor.taskCpuDemands[0]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(10)) { "The cpu used by task 0 is incorrect" } }, { assertEquals(3000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(2000.0, monitor.hostCpuSupplied["H01"]?.get(1)) { "The cpu used by the host is incorrect" } }, @@ -113,12 +115,13 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), - TraceFragment(10 * 60 * 1000, 4000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), + TraceFragment(10 * 60 * 1000, 4000.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_1_2000.json") @@ -126,10 +129,10 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(4000.0, monitor.taskCpuDemands["0"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(4000.0, monitor.taskCpuDemands[0]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(10)) { "The cpu used by task 0 is incorrect" } }, { assertEquals(1000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(1000.0, monitor.hostCpuSupplied["H01"]?.get(1)) { "The cpu used by the host is incorrect" } }, @@ -148,12 +151,13 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 4000.0, 1), - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 4000.0), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_1_2000.json") @@ -161,10 +165,10 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(4000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(4000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(10)) { "The cpu used by task 0 is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(1000.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(2000.0, monitor.hostCpuSupplied["H01"]?.get(1)) { "The cpu used by the host is incorrect" } }, @@ -183,12 +187,13 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 4000.0, 1), - TraceFragment(10 * 60 * 1000, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 4000.0), + TraceFragment(10 * 60 * 1000, 2000.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_1_2000.json") @@ -196,10 +201,10 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(4000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuDemands["0"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(4000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuDemands[0]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(10)) { "The cpu used by task 0 is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(2000.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(2000.0, monitor.hostCpuSupplied["H01"]?.get(1)) { "The cpu used by the host is incorrect" } }, @@ -218,20 +223,22 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), - TraceFragment(10 * 60 * 1000, 3000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), + TraceFragment(10 * 60 * 1000, 3000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 3000.0, 1), - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 3000.0), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_2_2000.json") @@ -239,14 +246,14 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuDemands["0"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuSupplied["0"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuDemands["1"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuDemands["1"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuSupplied["1"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["1"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[0]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuSupplied[0]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[1]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[1]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuSupplied[1]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[1]?.get(10)) { "The cpu used by task 0 is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuSupplied["H01"]?.get(1)) { "The cpu used by the host is incorrect" } }, @@ -265,20 +272,22 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 6000.0, 1), - TraceFragment(10 * 60 * 1000, 5000.0, 1), + TraceFragment(10 * 60 * 1000, 6000.0), + TraceFragment(10 * 60 * 1000, 5000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 5000.0, 1), - TraceFragment(10 * 60 * 1000, 6000.0, 1), + TraceFragment(10 * 60 * 1000, 5000.0), + TraceFragment(10 * 60 * 1000, 6000.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_2_2000.json") @@ -286,14 +295,14 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(6000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(5000.0, monitor.taskCpuDemands["0"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(5000.0, monitor.taskCpuDemands["1"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(6000.0, monitor.taskCpuDemands["1"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["1"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["1"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(6000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(5000.0, monitor.taskCpuDemands[0]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(5000.0, monitor.taskCpuDemands[1]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(6000.0, monitor.taskCpuDemands[1]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[1]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[1]?.get(10)) { "The cpu used by task 0 is incorrect" } }, { assertEquals(11000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(11000.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuSupplied["H01"]?.get(1)) { "The cpu used by the host is incorrect" } }, @@ -311,21 +320,23 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, submissionTime = "2024-02-01T10:00", fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), - TraceFragment(10 * 60 * 1000, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), + TraceFragment(10 * 60 * 1000, 2000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, submissionTime = "2024-02-01T10:05", fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 2000.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_2_2000.json") @@ -333,18 +344,18 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(5)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuDemands["0"]?.get(14)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(5)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(9)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(14)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuDemands["1"]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuDemands["1"]?.get(6)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["1"]?.get(1)) { "The cpu used by task 1 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["1"]?.get(6)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(5)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuDemands[0]?.get(14)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(5)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(9)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(14)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuDemands[1]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuDemands[1]?.get(6)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[1]?.get(1)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[1]?.get(6)) { "The cpu used by task 1 is incorrect" } }, { assertEquals(1000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(3000.0, monitor.hostCpuDemands["H01"]?.get(5)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuDemands["H01"]?.get(9)) { "The cpu demanded by the host is incorrect" } }, @@ -369,20 +380,22 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, submissionTime = "2024-02-01T10:00", fragments = arrayListOf( - TraceFragment(20 * 60 * 1000, 3000.0, 1), + TraceFragment(20 * 60 * 1000, 3000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, submissionTime = "2024-02-01T10:05", fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1500.0, 1), + TraceFragment(10 * 60 * 1000, 1500.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_2_2000.json") @@ -390,18 +403,18 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(3000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuDemands["0"]?.get(5)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuDemands["0"]?.get(14)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2500.0, monitor.taskCpuSupplied["0"]?.get(5)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2500.0, monitor.taskCpuSupplied["0"]?.get(9)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuSupplied["0"]?.get(14)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(1500.0, monitor.taskCpuDemands["1"]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(1500.0, monitor.taskCpuDemands["1"]?.get(6)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(1500.0, monitor.taskCpuSupplied["1"]?.get(1)) { "The cpu used by task 1 is incorrect" } }, - { assertEquals(1500.0, monitor.taskCpuSupplied["1"]?.get(6)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[0]?.get(5)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[0]?.get(14)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2500.0, monitor.taskCpuSupplied[0]?.get(5)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2500.0, monitor.taskCpuSupplied[0]?.get(9)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuSupplied[0]?.get(14)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1500.0, monitor.taskCpuDemands[1]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(1500.0, monitor.taskCpuDemands[1]?.get(6)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(1500.0, monitor.taskCpuSupplied[1]?.get(1)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(1500.0, monitor.taskCpuSupplied[1]?.get(6)) { "The cpu used by task 1 is incorrect" } }, { assertEquals(3000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(4500.0, monitor.hostCpuDemands["H01"]?.get(5)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(3000.0, monitor.hostCpuDemands["H01"]?.get(14)) { "The cpu demanded by the host is incorrect" } }, @@ -423,21 +436,23 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(5 * 60 * 1000, 1000.0, 1), - TraceFragment(5 * 60 * 1000, 1500.0, 1), - TraceFragment(5 * 60 * 1000, 2500.0, 1), - TraceFragment(5 * 60 * 1000, 1000.0, 1), + TraceFragment(5 * 60 * 1000, 1000.0), + TraceFragment(5 * 60 * 1000, 1500.0), + TraceFragment(5 * 60 * 1000, 2500.0), + TraceFragment(5 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(20 * 60 * 1000, 3000.0, 1), + TraceFragment(20 * 60 * 1000, 3000.0), ), + cpuCount = 1, ), ) val topology = createTopology("single_2_2000.json") @@ -445,22 +460,22 @@ class FlowDistributorTest { val monitor = runTest(topology, workload) assertAll( - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1500.0, monitor.taskCpuDemands["0"]?.get(5)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2500.0, monitor.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(14)) { "The cpu demanded is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(1500.0, monitor.taskCpuSupplied["0"]?.get(5)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(9)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(14)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuDemands["1"]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuDemands["1"]?.get(5)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuDemands["1"]?.get(9)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuDemands["1"]?.get(14)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuSupplied["1"]?.get(1)) { "The cpu used by task 1 is incorrect" } }, - { assertEquals(2500.0, monitor.taskCpuSupplied["1"]?.get(5)) { "The cpu used by task 1 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["1"]?.get(9)) { "The cpu used by task 1 is incorrect" } }, - { assertEquals(3000.0, monitor.taskCpuSupplied["1"]?.get(14)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1500.0, monitor.taskCpuDemands[0]?.get(5)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2500.0, monitor.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(14)) { "The cpu demanded is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1500.0, monitor.taskCpuSupplied[0]?.get(5)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(9)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(14)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[1]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[1]?.get(5)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[1]?.get(9)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuDemands[1]?.get(14)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuSupplied[1]?.get(1)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(2500.0, monitor.taskCpuSupplied[1]?.get(5)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[1]?.get(9)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(3000.0, monitor.taskCpuSupplied[1]?.get(14)) { "The cpu used by task 1 is incorrect" } }, { assertEquals(4000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(4500.0, monitor.hostCpuDemands["H01"]?.get(5)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(5500.0, monitor.hostCpuDemands["H01"]?.get(9)) { "The cpu demanded by the host is incorrect" } }, @@ -484,11 +499,12 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf<TraceFragment>().apply { - repeat(1) { this.add(TraceFragment(10 * 60 * 1000, 3000.0, 1)) } + repeat(1) { this.add(TraceFragment(10 * 60 * 1000, 3000.0)) } }, + cpuCount = 1, ), ) val topology = createTopology("single_5000_2000.json") @@ -512,11 +528,12 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf<TraceFragment>().apply { - repeat(1000) { this.add(TraceFragment(10 * 60 * 1000, 2000.0, 1)) } + repeat(1000) { this.add(TraceFragment(10 * 60 * 1000, 2000.0)) } }, + cpuCount = 1, ), ) val topology = createTopology("single_1_2000.json") @@ -542,9 +559,10 @@ class FlowDistributorTest { repeat(1000) { this.add( createTestTask( - name = "0", + id = 0, fragments = - arrayListOf(TraceFragment(10 * 60 * 1000, 2000.0, 1)), + arrayListOf(TraceFragment(10 * 60 * 1000, 2000.0)), + cpuCount = 1, ), ) } @@ -568,12 +586,13 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), - TraceFragment(10 * 60 * 1000, 0.0, 0, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), + TraceFragment(10 * 60 * 1000, 0.0, 2000.0), ), + cpuCount = 1, ), ) @@ -584,10 +603,10 @@ class FlowDistributorTest { assertAll( // CPU // task - { assertEquals(0.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuDemands["0"]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["0"]?.get(10)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[0]?.get(10)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[0]?.get(10)) { "The cpu used by task 0 is incorrect" } }, // host { assertEquals(0.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(0.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, @@ -595,10 +614,10 @@ class FlowDistributorTest { { assertEquals(0.0, monitor.hostCpuSupplied["H01"]?.get(10)) { "The cpu used by the host is incorrect" } }, // GPU // task - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(1)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuDemands["0"]?.get(10)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(1)) { "The gpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuSupplied["0"]?.get(10)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(1)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuDemands[0]?.get(10)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(1)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuSupplied[0]?.get(10)) { "The gpu used by task 0 is incorrect" } }, // host { assertEquals(1000.0, monitor.hostGpuDemands["H01"]?.get(1)?.get(0)) { "The gpu demanded by the host is incorrect" } }, { assertEquals(2000.0, monitor.hostGpuDemands["H01"]?.get(10)?.get(0)) { "The gpu demanded by the host is incorrect" } }, @@ -617,11 +636,12 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, ), ) @@ -632,10 +652,10 @@ class FlowDistributorTest { assertAll( // CPU // task - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(0)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["0"]?.get(9)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(0)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[0]?.get(9)) { "The cpu used by task 0 is incorrect" } }, // host { assertEquals(1000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(0.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, @@ -643,10 +663,10 @@ class FlowDistributorTest { { assertEquals(0.0, monitor.hostCpuSupplied["H01"]?.get(10)) { "The cpu used by the host is incorrect" } }, // GPU // task - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(0)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(0)) { "The gpu used by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(9)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(0)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(0)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(9)) { "The gpu used by task 0 is incorrect" } }, // host { assertEquals(1000.0, monitor.hostGpuDemands["H01"]?.get(1)?.get(0)) { "The gpu demanded by the host is incorrect" } }, { assertEquals(1000.0, monitor.hostGpuSupplied["H01"]?.get(1)?.get(0)) { "The gpu used by the host is incorrect" } }, @@ -665,11 +685,12 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 2000.0), ), + cpuCount = 1, ), ) @@ -680,10 +701,10 @@ class FlowDistributorTest { assertAll( // CPU // task - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(0)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["0"]?.get(9)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(0)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[0]?.get(9)) { "The cpu used by task 0 is incorrect" } }, // host { assertEquals(1000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(0.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, @@ -691,10 +712,10 @@ class FlowDistributorTest { { assertEquals(0.0, monitor.hostCpuSupplied["H01"]?.get(10)) { "The cpu used by the host is incorrect" } }, // GPU // task - { assertEquals(2000.0, monitor.taskGpuDemands["0"]?.get(0)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuDemands["0"]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuSupplied["0"]?.get(0)) { "The gpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuSupplied["0"]?.get(9)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuDemands[0]?.get(0)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuDemands[0]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuSupplied[0]?.get(0)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuSupplied[0]?.get(9)) { "The gpu used by task 0 is incorrect" } }, // host { assertEquals(2000.0, monitor.hostGpuDemands["H01"]?.get(1)?.get(0)) { "The gpu demanded by the host is incorrect" } }, { assertEquals(0.0, monitor.hostGpuDemands["H01"]?.get(10)?.get(0)) { "The gpu demanded by the host is incorrect" } }, @@ -713,11 +734,12 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 2000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 2000.0, 1000.0), ), + cpuCount = 1, ), ) val topology = createTopology("Gpus/single_gpu_no_vendor_no_memory.json") @@ -726,10 +748,10 @@ class FlowDistributorTest { assertAll( // CPU // task - { assertEquals(2000.0, monitor.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskCpuSupplied["0"]?.get(0)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["0"]?.get(9)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskCpuSupplied[0]?.get(0)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[0]?.get(9)) { "The cpu used by task 0 is incorrect" } }, // host { assertEquals(2000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(0.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, @@ -737,10 +759,10 @@ class FlowDistributorTest { { assertEquals(0.0, monitor.hostCpuSupplied["H01"]?.get(10)) { "The cpu used by the host is incorrect" } }, // GPU // task - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(1)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(1)) { "The gpu used by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(9)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(1)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(1)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(9)) { "The gpu used by task 0 is incorrect" } }, // host { assertEquals(1000.0, monitor.hostGpuDemands["H01"]?.get(1)?.get(0)) { "The gpu demanded by the host is incorrect" } }, { assertEquals(0.0, monitor.hostGpuDemands["H01"]?.get(10)?.get(0)) { "The gpu demanded by the host is incorrect" } }, @@ -761,18 +783,20 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, ), ) @@ -781,17 +805,17 @@ class FlowDistributorTest { assertAll( // CPU // task 0 - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(0)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["0"]?.get(9)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(0)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[0]?.get(9)) { "The cpu used by task 0 is incorrect" } }, // task 1 - { assertEquals(0.0, monitor.taskCpuDemands["1"]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuDemands["1"]?.get(10)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuDemands["1"]?.get(19)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["1"]?.get(1)) { "The cpu used by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["1"]?.get(10)) { "The cpu used by task 1 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["1"]?.get(19)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[1]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[1]?.get(10)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[1]?.get(19)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[1]?.get(1)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[1]?.get(10)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[1]?.get(19)) { "The cpu used by task 1 is incorrect" } }, // host { assertEquals(1000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(1000.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, @@ -799,17 +823,17 @@ class FlowDistributorTest { { assertEquals(1000.0, monitor.hostCpuSupplied["H01"]?.get(10)) { "The cpu used by the host is incorrect" } }, // GPU // task 0 - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(0)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(0)) { "The gpu used by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(9)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(0)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(0)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(9)) { "The gpu used by task 0 is incorrect" } }, // task 1 - { assertEquals(0.0, monitor.taskGpuDemands["1"]?.get(0)) { "The gpu demanded by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuDemands["1"]?.get(10)) { "The gpu demanded by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuDemands["1"]?.get(19)) { "The gpu used by task 1 is incorrect" } }, - { assertEquals(0.0, monitor.taskGpuSupplied["1"]?.get(0)) { "The gpu used by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["1"]?.get(10)) { "The gpu used by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["1"]?.get(19)) { "The gpu used by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskGpuDemands[1]?.get(0)) { "The gpu demanded by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[1]?.get(10)) { "The gpu demanded by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[1]?.get(19)) { "The gpu used by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskGpuSupplied[1]?.get(0)) { "The gpu used by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[1]?.get(10)) { "The gpu used by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[1]?.get(19)) { "The gpu used by task 1 is incorrect" } }, // host { assertEquals(1000.0, monitor.hostGpuDemands["H01"]?.get(1)?.get(0)) { "The gpu demanded by the host is incorrect" } }, { assertEquals(1000.0, monitor.hostGpuDemands["H01"]?.get(10)?.get(0)) { "The gpu demanded by the host is incorrect" } }, @@ -828,18 +852,21 @@ class FlowDistributorTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 0.0, 0), + TraceFragment(10 * 60 * 1000, 1000.0, 0.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 1, ), ) @@ -849,15 +876,15 @@ class FlowDistributorTest { assertAll( // CPU // task 0 - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(0)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["0"]?.get(9)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(0)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[0]?.get(9)) { "The cpu used by task 0 is incorrect" } }, // task 1 - { assertEquals(0.0, monitor.taskCpuDemands["1"]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuDemands["1"]?.get(9)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["1"]?.get(0)) { "The cpu used by task 1 is incorrect" } }, - { assertEquals(0.0, monitor.taskCpuSupplied["1"]?.get(9)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[1]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuDemands[1]?.get(9)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[1]?.get(0)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(0.0, monitor.taskCpuSupplied[1]?.get(9)) { "The cpu used by task 1 is incorrect" } }, // host { assertEquals(1000.0, monitor.hostCpuDemands["H01"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(0.0, monitor.hostCpuDemands["H01"]?.get(10)) { "The cpu demanded by the host is incorrect" } }, @@ -865,15 +892,15 @@ class FlowDistributorTest { { assertEquals(0.0, monitor.hostCpuSupplied["H01"]?.get(10)) { "The cpu used by the host is incorrect" } }, // GPU // task 0 - { assertEquals(0.0, monitor.taskGpuDemands["0"]?.get(0)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskGpuDemands["0"]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskGpuSupplied["0"]?.get(0)) { "The gpu used by task 0 is incorrect" } }, - { assertEquals(0.0, monitor.taskGpuSupplied["0"]?.get(9)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskGpuDemands[0]?.get(0)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskGpuDemands[0]?.get(9)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskGpuSupplied[0]?.get(0)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(0.0, monitor.taskGpuSupplied[0]?.get(9)) { "The gpu used by task 0 is incorrect" } }, // task 1 - { assertEquals(1000.0, monitor.taskGpuDemands["1"]?.get(0)) { "The gpu demanded by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuDemands["1"]?.get(9)) { "The gpu demanded by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["1"]?.get(0)) { "The gpu used by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskGpuSupplied["1"]?.get(9)) { "The gpu used by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[1]?.get(0)) { "The gpu demanded by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuDemands[1]?.get(9)) { "The gpu demanded by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[1]?.get(0)) { "The gpu used by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskGpuSupplied[1]?.get(9)) { "The gpu used by task 1 is incorrect" } }, // host { assertEquals(1000.0, monitor.hostGpuDemands["H01"]?.get(1)?.get(0)) { "The gpu demanded by the host is incorrect" } }, { assertEquals(0.0, monitor.hostGpuDemands["H01"]?.get(10)?.get(0)) { "The gpu demanded by the host is incorrect" } }, diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FragmentScalingTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FragmentScalingTest.kt index b0aa3555..ce26cc3a 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FragmentScalingTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/FragmentScalingTest.kt @@ -45,12 +45,13 @@ class FragmentScalingTest { val workloadNoDelay: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 2000.0, 1), - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 2000.0), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, scalingPolicy = NoDelayScaling(), ), ) @@ -58,12 +59,13 @@ class FragmentScalingTest { val workloadPerfect: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 2000.0, 1), - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 2000.0), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, scalingPolicy = PerfectScaling(), ), ) @@ -75,14 +77,14 @@ class FragmentScalingTest { assertAll( { assertEquals(1200000, monitorNoDelay.maxTimestamp) { "The workload took longer to finish than expected." } }, { assertEquals(1200000, monitorPerfect.maxTimestamp) { "The workload took longer to finish than expected." } }, - { assertEquals(2000.0, monitorNoDelay.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitorPerfect.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitorNoDelay.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(2000.0, monitorPerfect.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(1000.0, monitorNoDelay.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitorPerfect.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitorNoDelay.taskCpuSupplied["0"]?.get(9)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(1000.0, monitorPerfect.taskCpuSupplied["0"]?.get(9)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(2000.0, monitorNoDelay.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitorPerfect.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitorNoDelay.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(2000.0, monitorPerfect.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(1000.0, monitorNoDelay.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitorPerfect.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitorNoDelay.taskCpuSupplied[0]?.get(9)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(1000.0, monitorPerfect.taskCpuSupplied[0]?.get(9)) { "The cpu supplied to task 0 is incorrect" } }, ) } @@ -99,11 +101,12 @@ class FragmentScalingTest { val workloadNoDelay: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 4000.0, 1), + TraceFragment(10 * 60 * 1000, 4000.0), ), + cpuCount = 1, scalingPolicy = NoDelayScaling(), ), ) @@ -111,11 +114,12 @@ class FragmentScalingTest { val workloadPerfect: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 4000.0, 1), + TraceFragment(10 * 60 * 1000, 4000.0), ), + cpuCount = 1, scalingPolicy = PerfectScaling(), ), ) @@ -127,10 +131,10 @@ class FragmentScalingTest { assertAll( { assertEquals(600000, monitorNoDelay.maxTimestamp) { "The workload took longer to finish than expected." } }, { assertEquals(1200000, monitorPerfect.maxTimestamp) { "The workload took longer to finish than expected." } }, - { assertEquals(4000.0, monitorNoDelay.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(4000.0, monitorPerfect.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitorNoDelay.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(2000.0, monitorPerfect.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(4000.0, monitorNoDelay.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(4000.0, monitorPerfect.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitorNoDelay.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(2000.0, monitorPerfect.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, ) } @@ -148,13 +152,14 @@ class FragmentScalingTest { val workloadNoDelay: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), - TraceFragment(10 * 60 * 1000, 4000.0, 1), - TraceFragment(10 * 60 * 1000, 1500.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), + TraceFragment(10 * 60 * 1000, 4000.0), + TraceFragment(10 * 60 * 1000, 1500.0), ), + cpuCount = 1, scalingPolicy = NoDelayScaling(), ), ) @@ -162,13 +167,14 @@ class FragmentScalingTest { val workloadPerfect: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), - TraceFragment(10 * 60 * 1000, 4000.0, 1), - TraceFragment(10 * 60 * 1000, 1500.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), + TraceFragment(10 * 60 * 1000, 4000.0), + TraceFragment(10 * 60 * 1000, 1500.0), ), + cpuCount = 1, scalingPolicy = PerfectScaling(), ), ) @@ -180,20 +186,20 @@ class FragmentScalingTest { assertAll( { assertEquals(1800000, monitorNoDelay.maxTimestamp) { "The workload took longer to finish than expected." } }, { assertEquals(2400000, monitorPerfect.maxTimestamp) { "The workload took longer to finish than expected." } }, - { assertEquals(1000.0, monitorNoDelay.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitorPerfect.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitorNoDelay.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(1000.0, monitorPerfect.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(4000.0, monitorNoDelay.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(4000.0, monitorPerfect.taskCpuDemands["0"]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitorNoDelay.taskCpuSupplied["0"]?.get(9)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(2000.0, monitorPerfect.taskCpuSupplied["0"]?.get(9)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(1500.0, monitorNoDelay.taskCpuDemands["0"]?.get(19)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(4000.0, monitorPerfect.taskCpuDemands["0"]?.get(19)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1500.0, monitorNoDelay.taskCpuSupplied["0"]?.get(19)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitorPerfect.taskCpuSupplied["0"]?.get(19)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(1500.0, monitorPerfect.taskCpuDemands["0"]?.get(29)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1500.0, monitorPerfect.taskCpuSupplied["0"]?.get(29)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(1000.0, monitorNoDelay.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitorPerfect.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitorNoDelay.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(1000.0, monitorPerfect.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(4000.0, monitorNoDelay.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(4000.0, monitorPerfect.taskCpuDemands[0]?.get(9)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitorNoDelay.taskCpuSupplied[0]?.get(9)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(2000.0, monitorPerfect.taskCpuSupplied[0]?.get(9)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(1500.0, monitorNoDelay.taskCpuDemands[0]?.get(19)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(4000.0, monitorPerfect.taskCpuDemands[0]?.get(19)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1500.0, monitorNoDelay.taskCpuSupplied[0]?.get(19)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitorPerfect.taskCpuSupplied[0]?.get(19)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(1500.0, monitorPerfect.taskCpuDemands[0]?.get(29)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1500.0, monitorPerfect.taskCpuSupplied[0]?.get(29)) { "The cpu supplied to task 0 is incorrect" } }, ) } @@ -208,19 +214,21 @@ class FragmentScalingTest { val workloadNoDelay: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, scalingPolicy = NoDelayScaling(), ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 3000.0, 1), + TraceFragment(10 * 60 * 1000, 3000.0), ), + cpuCount = 1, scalingPolicy = NoDelayScaling(), ), ) @@ -228,19 +236,21 @@ class FragmentScalingTest { val workloadPerfect: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, scalingPolicy = PerfectScaling(), ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 3000.0, 1), + TraceFragment(10 * 60 * 1000, 3000.0), ), + cpuCount = 1, scalingPolicy = PerfectScaling(), ), ) @@ -252,14 +262,14 @@ class FragmentScalingTest { assertAll( { assertEquals(600000, monitorNoDelay.maxTimestamp) { "The workload took longer to finish than expected." } }, { assertEquals(600000, monitorPerfect.maxTimestamp) { "The workload took longer to finish than expected." } }, - { assertEquals(1000.0, monitorNoDelay.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(3000.0, monitorNoDelay.taskCpuDemands["1"]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(1000.0, monitorPerfect.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(3000.0, monitorPerfect.taskCpuDemands["1"]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(1000.0, monitorNoDelay.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(3000.0, monitorNoDelay.taskCpuSupplied["1"]?.get(0)) { "The cpu supplied to task 1 is incorrect" } }, - { assertEquals(1000.0, monitorPerfect.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, - { assertEquals(3000.0, monitorPerfect.taskCpuSupplied["1"]?.get(0)) { "The cpu supplied to task 1 is incorrect" } }, + { assertEquals(1000.0, monitorNoDelay.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(3000.0, monitorNoDelay.taskCpuDemands[1]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(1000.0, monitorPerfect.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(3000.0, monitorPerfect.taskCpuDemands[1]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(1000.0, monitorNoDelay.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(3000.0, monitorNoDelay.taskCpuSupplied[1]?.get(0)) { "The cpu supplied to task 1 is incorrect" } }, + { assertEquals(1000.0, monitorPerfect.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, + { assertEquals(3000.0, monitorPerfect.taskCpuSupplied[1]?.get(0)) { "The cpu supplied to task 1 is incorrect" } }, ) } @@ -278,19 +288,21 @@ class FragmentScalingTest { val workloadNoDelay: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 2000.0), ), + cpuCount = 1, scalingPolicy = NoDelayScaling(), ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 4000.0, 1), + TraceFragment(10 * 60 * 1000, 4000.0), ), + cpuCount = 1, scalingPolicy = NoDelayScaling(), ), ) @@ -298,19 +310,21 @@ class FragmentScalingTest { val workloadPerfect: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 2000.0), ), + cpuCount = 1, scalingPolicy = PerfectScaling(), ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 4000.0, 1), + TraceFragment(10 * 60 * 1000, 4000.0), ), + cpuCount = 1, scalingPolicy = PerfectScaling(), ), ) @@ -323,15 +337,15 @@ class FragmentScalingTest { // { assertEquals(600000, monitorNoDelay.maxTimestamp) { "The workload took longer to finish than expected." } }, // { assertEquals(900000, monitorPerfect.maxTimestamp) { "The workload took longer to finish than expected." } }, // -// { assertEquals(1000.0, monitorNoDelay.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, -// { assertEquals(3000.0, monitorNoDelay.taskCpuDemands["1"]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, -// { assertEquals(1000.0, monitorPerfect.taskCpuDemands["0"]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, -// { assertEquals(3000.0, monitorPerfect.taskCpuDemands["1"]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, +// { assertEquals(1000.0, monitorNoDelay.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, +// { assertEquals(3000.0, monitorNoDelay.taskCpuDemands[1]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, +// { assertEquals(1000.0, monitorPerfect.taskCpuDemands[0]?.get(0)) { "The cpu demanded by task 0 is incorrect" } }, +// { assertEquals(3000.0, monitorPerfect.taskCpuDemands[1]?.get(0)) { "The cpu demanded by task 1 is incorrect" } }, // -// { assertEquals(1000.0, monitorNoDelay.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, -// { assertEquals(3000.0, monitorNoDelay.taskCpuSupplied["1"]?.get(0)) { "The cpu supplied to task 1 is incorrect" } }, -// { assertEquals(1000.0, monitorPerfect.taskCpuSupplied["0"]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, -// { assertEquals(3000.0, monitorPerfect.taskCpuSupplied["1"]?.get(0)) { "The cpu supplied to task 1 is incorrect" } }, +// { assertEquals(1000.0, monitorNoDelay.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, +// { assertEquals(3000.0, monitorNoDelay.taskCpuSupplied[1]?.get(0)) { "The cpu supplied to task 1 is incorrect" } }, +// { assertEquals(1000.0, monitorPerfect.taskCpuSupplied[0]?.get(0)) { "The cpu supplied to task 0 is incorrect" } }, +// { assertEquals(3000.0, monitorPerfect.taskCpuSupplied[1]?.get(0)) { "The cpu supplied to task 1 is incorrect" } }, // ) } } diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/GpuTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/GpuTest.kt index 2778e613..35da6944 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/GpuTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/GpuTest.kt @@ -178,7 +178,6 @@ class GpuTest { fun testGpuHostCreationMultiWithMemoryWithVendor() { val topology = createTopology("Gpus/multi_gpu_full.json") // temporary implementation, to account for GPU concatenation - val count = 5 assertGpuConfiguration( topology, // cuda cores @@ -203,18 +202,22 @@ class GpuTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 2000.0), ), + cpuCount = 1, + gpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 2000.0), ), + cpuCount = 1, + gpuCount = 1, ), ) val topology = createTopology("Gpus/multi_gpu_host.json") @@ -225,15 +228,15 @@ class GpuTest { { assertEquals(10 * 60 * 1000, monitor.maxTimestamp) { "The expected runtime is exceeded" } }, // CPU // task 0 - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuDemands["0"]?.get(8)) { "The cpu demanded by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(1)) { "The cpu used by task 0 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["0"]?.get(8)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(1)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[0]?.get(8)) { "The cpu demanded by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(1)) { "The cpu used by task 0 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[0]?.get(8)) { "The cpu used by task 0 is incorrect" } }, // task 1 - { assertEquals(1000.0, monitor.taskCpuDemands["1"]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuDemands["1"]?.get(8)) { "The cpu demanded by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["1"]?.get(1)) { "The cpu used by task 1 is incorrect" } }, - { assertEquals(1000.0, monitor.taskCpuSupplied["1"]?.get(8)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[1]?.get(1)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuDemands[1]?.get(8)) { "The cpu demanded by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[1]?.get(1)) { "The cpu used by task 1 is incorrect" } }, + { assertEquals(1000.0, monitor.taskCpuSupplied[1]?.get(8)) { "The cpu used by task 1 is incorrect" } }, // host { assertEquals(2000.0, monitor.hostCpuDemands["DualGpuHost"]?.get(1)) { "The cpu demanded by the host is incorrect" } }, { assertEquals(2000.0, monitor.hostCpuDemands["DualGpuHost"]?.get(9)) { "The cpu demanded by the host is incorrect" } }, @@ -241,15 +244,15 @@ class GpuTest { { assertEquals(2000.0, monitor.hostCpuSupplied["DualGpuHost"]?.get(9)) { "The cpu used by the host is incorrect" } }, // GPU // task 0 - { assertEquals(2000.0, monitor.taskGpuDemands["0"]?.get(1)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuDemands["0"]?.get(8)) { "The gpu demanded by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuSupplied["0"]?.get(1)) { "The gpu used by task 0 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuSupplied["0"]?.get(8)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuDemands[0]?.get(1)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuDemands[0]?.get(8)) { "The gpu demanded by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuSupplied[0]?.get(1)) { "The gpu used by task 0 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuSupplied[0]?.get(8)) { "The gpu used by task 0 is incorrect" } }, // task 1 - { assertEquals(2000.0, monitor.taskGpuDemands["1"]?.get(1)) { "The gpu demanded by task 1 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuDemands["1"]?.get(8)) { "The gpu demanded by task 1 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuSupplied["1"]?.get(1)) { "The gpu used by task 1 is incorrect" } }, - { assertEquals(2000.0, monitor.taskGpuSupplied["1"]?.get(8)) { "The gpu used by task 1 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuDemands[1]?.get(1)) { "The gpu demanded by task 1 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuDemands[1]?.get(8)) { "The gpu demanded by task 1 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuSupplied[1]?.get(1)) { "The gpu used by task 1 is incorrect" } }, + { assertEquals(2000.0, monitor.taskGpuSupplied[1]?.get(8)) { "The gpu used by task 1 is incorrect" } }, // host // GPU 0 { assertEquals(2000.0, monitor.hostGpuDemands["DualGpuHost"]?.get(1)?.get(0)) { "The gpu demanded by the host is incorrect" } }, diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/SchedulerTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/SchedulerTest.kt index efb83814..c7d32828 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/SchedulerTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/SchedulerTest.kt @@ -43,18 +43,20 @@ class SchedulerTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0), ), + cpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(5 * 60 * 1000, 2000.0, 1), + TraceFragment(5 * 60 * 1000, 2000.0), ), + cpuCount = 1, submissionTime = "1970-01-01T00:20", ), ) @@ -92,18 +94,22 @@ class SchedulerTest { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 2000.0), ), + cpuCount = 1, + gpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 2000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 2000.0), ), + cpuCount = 1, + gpuCount = 1, submissionTime = "1970-01-01T00:20", ), ) diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/TestingUtils.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/TestingUtils.kt index c5411179..f34160f7 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/TestingUtils.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/TestingUtils.kt @@ -52,7 +52,6 @@ import org.opendc.simulator.kotlin.runSimulation import java.time.Duration import java.time.LocalDateTime import java.time.ZoneOffset -import java.util.UUID import kotlin.collections.ArrayList /** @@ -64,10 +63,13 @@ fun createTopology(name: String): List<ClusterSpec> { } fun createTestTask( - name: String, + id: Int, + name: String = "", memCapacity: Long = 0L, submissionTime: String = "1970-01-01T00:00", duration: Long = 0L, + cpuCount: Int = 1, + gpuCount: Int = 0, fragments: ArrayList<TraceFragment>, checkpointInterval: Long = 0L, checkpointDuration: Long = 0L, @@ -83,19 +85,19 @@ fun createTestTask( } return Task( - UUID.nameUUIDFromBytes(name.toByteArray()), + id, name, LocalDateTime.parse(submissionTime).toInstant(ZoneOffset.UTC).toEpochMilli(), duration, emptySet(), emptySet(), - fragments.maxOf { it.cpuCoreCount() }, + cpuCount, fragments.maxOf { it.cpuUsage }, 1800000.0, memCapacity, - gpuCount = fragments.maxOfOrNull { it.gpuCoreCount() } ?: 0, + gpuCount = gpuCount, gpuCapacity = fragments.maxOfOrNull { it.gpuUsage } ?: 0.0, - gpuMemCapacity = fragments.maxOfOrNull { it.gpuMemoryUsage } ?: 0L, + gpuMemCapacity = 0L, "", -1, TraceWorkload( @@ -104,7 +106,7 @@ fun createTestTask( checkpointDuration, checkpointIntervalScaling, scalingPolicy, - name, + id, usedResources, ), ) @@ -147,13 +149,13 @@ fun runTest( } class TestComputeMonitor : ComputeMonitor { - var taskCpuDemands = mutableMapOf<String, ArrayList<Double>>() - var taskCpuSupplied = mutableMapOf<String, ArrayList<Double>>() - var taskGpuDemands = mutableMapOf<String, ArrayList<Double?>?>() - var taskGpuSupplied = mutableMapOf<String, ArrayList<Double?>?>() + var taskCpuDemands = mutableMapOf<Int, ArrayList<Double>>() + var taskCpuSupplied = mutableMapOf<Int, ArrayList<Double>>() + var taskGpuDemands = mutableMapOf<Int, ArrayList<Double?>?>() + var taskGpuSupplied = mutableMapOf<Int, ArrayList<Double?>?>() override fun record(reader: TaskTableReader) { - val taskName: String = reader.taskInfo.name + val taskName: Int = reader.taskInfo.id if (taskName in taskCpuDemands) { taskCpuDemands[taskName]?.add(reader.cpuDemand) diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/VirtualizationOverheadTests.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/VirtualizationOverheadTests.kt index 18936a15..3aa6c354 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/VirtualizationOverheadTests.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/VirtualizationOverheadTests.kt @@ -117,17 +117,19 @@ class VirtualizationOverheadTests { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, + gpuCount = 1, ), ) val monitor = runTest(topology, workload) - assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 should have gpu demand 1000.0") - assertEquals(1000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task 0 should have gpu supplied 1000.0 ") + assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 should have gpu demand 1000.0") + assertEquals(1000.0, monitor.taskGpuSupplied[0]?.get(1), "Task 0 should have gpu supplied 1000.0 ") assertEquals(1000.0, monitor.hostGpuDemands["H01"]?.get(1)?.get(0), "Host H01 should have gpu demand 1000.0") assertEquals(1000.0, monitor.hostGpuSupplied["H01"]?.get(1)?.get(0), "Host H01 should have gpu supply 1000.0") } @@ -141,18 +143,20 @@ class VirtualizationOverheadTests { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, + gpuCount = 1, ), ) val monitor = runTest(topology, workload) assertAll( - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 should have gpu demand 1000.0") }, - { assertEquals(0.95 * 1000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task 0 should have gpu supplied 950.0 ") }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 should have gpu demand 1000.0") }, + { assertEquals(0.95 * 1000.0, monitor.taskGpuSupplied[0]?.get(1), "Task 0 should have gpu supplied 950.0 ") }, { assertEquals(1000.0, monitor.hostGpuDemands["H01"]?.get(1)?.get(0), "Host H01 should have gpu demand 1000.0") }, { assertEquals(0.95 * 1000.0, monitor.hostGpuSupplied["H01"]?.get(1)?.get(0), "Host H01 should have gpu supply 950.0") }, ) @@ -167,18 +171,20 @@ class VirtualizationOverheadTests { val workload: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, + gpuCount = 1, ), ) val monitor = runTest(topology, workload) assertAll( - { assertEquals(1000.0, monitor.taskGpuDemands["0"]?.get(1), "Task 0 should have gpu demand 1000.0") }, - { assertEquals(0.75 * 1000.0, monitor.taskGpuSupplied["0"]?.get(1), "Task 0 should have gpu supplied 750.0 ") }, + { assertEquals(1000.0, monitor.taskGpuDemands[0]?.get(1), "Task 0 should have gpu demand 1000.0") }, + { assertEquals(0.75 * 1000.0, monitor.taskGpuSupplied[0]?.get(1), "Task 0 should have gpu supplied 750.0 ") }, { assertEquals(1000.0, monitor.hostGpuDemands["H01"]?.get(1)?.get(0), "Host H01 should have gpu demand 1000.0") }, { assertEquals(0.75 * 1000.0, monitor.hostGpuSupplied["H01"]?.get(1)?.get(0), "Host H01 should have gpu supply 750.0") }, ) @@ -193,54 +199,66 @@ class VirtualizationOverheadTests { val workload1: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 1000.0, 1, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 1000.0, 1000.0), ), + cpuCount = 1, + gpuCount = 1, ), ) val workload2: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 1, ), ) val workload3: ArrayList<Task> = arrayListOf( createTestTask( - name = "0", + id = 0, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 1, ), createTestTask( - name = "1", + id = 1, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 1, ), createTestTask( - name = "2", + id = 2, fragments = arrayListOf( - TraceFragment(10 * 60 * 1000, 0.0, 0, 1000.0, 1), + TraceFragment(10 * 60 * 1000, 0.0, 1000.0), ), + cpuCount = 0, + gpuCount = 1, ), ) @@ -250,24 +268,24 @@ class VirtualizationOverheadTests { assertAll( // Test with one VM - { assertEquals(1000.0, monitor1.taskGpuDemands["0"]?.get(1), "Task 0 should have gpu demand 1000.0") }, - { assertEquals(1000.0, monitor1.taskGpuSupplied["0"]?.get(1), "Task 0 should have gpu supplied 1000.0 ") }, + { assertEquals(1000.0, monitor1.taskGpuDemands[0]?.get(1), "Task 0 should have gpu demand 1000.0") }, + { assertEquals(1000.0, monitor1.taskGpuSupplied[0]?.get(1), "Task 0 should have gpu supplied 1000.0 ") }, { assertEquals(1000.0, monitor1.hostGpuDemands["H01"]?.get(1)?.get(0), "Host H01 should have gpu demand 1000.0") }, { assertEquals(1000.0, monitor1.hostGpuSupplied["H01"]?.get(1)?.get(0), "Host H01 should have gpu supply 1000.0") }, // Test with two VMs - { assertEquals(1000.0, monitor2.taskGpuDemands["0"]?.get(1), "Task 0 should have gpu demand 1000.0") }, - { assertEquals(500.0, monitor2.taskGpuSupplied["0"]?.get(1), "Task 0 should have gpu supplied 500.0") }, - { assertEquals(1000.0, monitor2.taskGpuDemands["1"]?.get(1), "Task 0 should have gpu demand 1000.0") }, - { assertEquals(500.0, monitor2.taskGpuSupplied["1"]?.get(1), "Task 0 should have gpu supplied 500.0") }, + { assertEquals(1000.0, monitor2.taskGpuDemands[0]?.get(1), "Task 0 should have gpu demand 1000.0") }, + { assertEquals(500.0, monitor2.taskGpuSupplied[0]?.get(1), "Task 0 should have gpu supplied 500.0") }, + { assertEquals(1000.0, monitor2.taskGpuDemands[1]?.get(1), "Task 0 should have gpu demand 1000.0") }, + { assertEquals(500.0, monitor2.taskGpuSupplied[1]?.get(1), "Task 0 should have gpu supplied 500.0") }, { assertEquals(2000.0, monitor2.hostGpuDemands["H01"]?.get(1)?.get(0), "Host H01 should have gpu demand 2000.0") }, { assertEquals(1000.0, monitor2.hostGpuSupplied["H01"]?.get(1)?.get(0), "Host H01 should have gpu supply 1000.0") }, // Test with three VMs - { assertEquals(1000.0, monitor3.taskGpuDemands["0"]?.get(1), "Task 0 should have gpu demand 1000.0") }, - { assertEquals(333.3, monitor3.taskGpuSupplied["0"]?.get(1) ?: 0.0, 0.05, "Task 0 should have gpu supplied 333.3 ") }, - { assertEquals(1000.0, monitor3.taskGpuDemands["1"]?.get(1), "Task 0 should have gpu demand 1000.0") }, - { assertEquals(333.3, monitor3.taskGpuSupplied["1"]?.get(1) ?: 0.0, 0.05, "Task 0 should have gpu supplied 333.3 ") }, - { assertEquals(1000.0, monitor3.taskGpuDemands["2"]?.get(1), "Task 0 should have gpu demand 1000.0") }, - { assertEquals(333.3, monitor3.taskGpuSupplied["2"]?.get(1) ?: 0.0, 0.05, "Task 0 should have gpu supplied 333.3 ") }, + { assertEquals(1000.0, monitor3.taskGpuDemands[0]?.get(1), "Task 0 should have gpu demand 1000.0") }, + { assertEquals(333.3, monitor3.taskGpuSupplied[0]?.get(1) ?: 0.0, 0.05, "Task 0 should have gpu supplied 333.3 ") }, + { assertEquals(1000.0, monitor3.taskGpuDemands[1]?.get(1), "Task 0 should have gpu demand 1000.0") }, + { assertEquals(333.3, monitor3.taskGpuSupplied[1]?.get(1) ?: 0.0, 0.05, "Task 0 should have gpu supplied 333.3 ") }, + { assertEquals(1000.0, monitor3.taskGpuDemands[2]?.get(1), "Task 0 should have gpu demand 1000.0") }, + { assertEquals(333.3, monitor3.taskGpuSupplied[2]?.get(1) ?: 0.0, 0.05, "Task 0 should have gpu supplied 333.3 ") }, { assertEquals(3000.0, monitor3.hostGpuDemands["H01"]?.get(1)?.get(0), "Host H01 should have gpu demand 3000.0") }, { assertEquals(1000.0, monitor3.hostGpuSupplied["H01"]?.get(1)?.get(0), "Host H01 should have gpu supply 700.0") }, ) |
