@@ -19,13 +19,14 @@ package regressor
19
19
import (
20
20
. "github.com/onsi/ginkgo/v2"
21
21
. "github.com/onsi/gomega"
22
+ "k8s.io/klog/v2"
22
23
23
24
"github.com/sustainable-computing-io/kepler/pkg/model/types"
24
25
)
25
26
26
- var _ = Describe ("Test Regressor Weight Unit (logarithm model from URL)" , func () {
27
- It ("Get Node Components Power By Logarithmic Regression with model from URL" , func () {
28
- modelURL := "https://raw.githubusercontent.com/sustainable-computing-io/kepler-model-db/refs/heads/main/models/v0.7/ec2-0.7.11/rapl-sysfs/AbsPower/BPFOnly/LogarithmicRegressionTrainer_0 .json"
27
+ var _ = Describe ("Test Regressor Weight Unit (SGD model from URL)" , func () {
28
+ It ("Get Node Components Power By SGD Regression with model from URL" , func () {
29
+ modelURL := "https://raw.githubusercontent.com/sustainable-computing-io/kepler-model-db/refs/heads/main/models/v0.7/ec2-0.7.11/rapl-sysfs/AbsPower/BPFOnly/SGDRegressorTrainer_0 .json"
29
30
30
31
// Initialize the regressor with the URL
31
32
r := genRegressor (types .AbsPower , types .ComponentEnergySource , "" , modelURL , "" , types .LogarithmicTrainer )
@@ -40,12 +41,12 @@ var _ = Describe("Test Regressor Weight Unit (logarithm model from URL)", func()
40
41
Expect (len (powers )).Should (Equal (1 ))
41
42
42
43
// Test power calculation. The results should match those from estimator
43
- // Expect(powers[0].Core).Should(BeNumerically("=", 0))
44
- // Expect(powers[0].DRAM).Should(BeNumerically("=", 0))
45
- // Expect( powers[0].Pkg).Should(BeNumerically("=", 0))
46
-
47
- idlePowers , err := r . GetComponentsPower ( true )
48
- Expect (err ). NotTo ( HaveOccurred ( ))
49
- Expect (len ( idlePowers )) .Should (Equal ( 1 ))
44
+ // The following results are from kepler-model-server tests/estimator_power_request_test.py
45
+ // {"trainer_name": "SGDRegressorTrainer_0", "metrics": ["bpf_cpu_time_ms", "bpf_page_cache_hit"], "system_features": ["node_info", "cpu_scaling_frequency_hertz"], "system_values": ["1", "1GHz"], "values": [[1.0, 1.0], [1.0, 1.0]], "output_type": "AbsPower", "source": "rapl-sysfs"}
46
+ // {' powers': {'package': [143.81524594970784, 143.81524594970784], 'core': [0.0, 0.0], 'uncore': [0.0, 0.0], 'dram': [18.616373449562538, 18.616373449562538]}, 'msg': '', 'core_ratio': 0.16666666666666666}
47
+ klog . Infof ( "Core: %v, DRAM: %v, Pkg: %v" , powers [ 0 ]. Core , powers [ 0 ]. DRAM , powers [ 0 ]. Pkg )
48
+ Expect ( powers [ 0 ]. Core ). Should ( BeEquivalentTo ( 143812 ) )
49
+ Expect (powers [ 0 ]. DRAM ). Should ( BeEquivalentTo ( 18616 ))
50
+ Expect (powers [ 0 ]. Pkg ) .Should (BeEquivalentTo ( 143812 ))
50
51
})
51
52
})
0 commit comments