gpuCost computation error #2657
Labels
E2
Estimated level of Effort (1 is easiest, 4 is hardest)
kubecost
Relevant to Kubecost's downstream project
needs-follow-up
opencost
OpenCost issues vs. external/downstream
P1
Estimated Priority (P0 is highest, P4 is lowest)
Describe the bug
gpuCost in /costDataModel is not computed correctly.
To Reproduce
I'm using g5.2xlarge instance on AWS with nvidia GPU operator v23.9.1.
Hourly instance cost is 1.3529600000
Specs:
Node has the following status.capacity:
and the following labels:
The default.json (cost model ratio) are the following:
/costDataModel is giving:
Expected behavior
gpuCost is 3.345316 (greater than the instance cost) instead of 0.96028296.
Potential solution
GPU cost is computed in this part: https://github.com/opencost/opencost/blob/v1.109.0/pkg/costmodel/costmodel.go#L1172
According to the cost I get it acts as gpuc is 0.
It seems that given the node labels, we enter in this case: https://github.com/opencost/opencost/blob/v1.109.0/pkg/costmodel/costmodel.go#L1087 and gpuc is never set.
Adding
gpuc = float64(q.Value())
at https://github.com/opencost/opencost/blob/v1.109.0/pkg/costmodel/costmodel.go#L1098 does solve the problem.Which version of OpenCost are you using?
v1.109.0
Additional context
Add any other context about the problem here. Kubernetes versions and which public clouds you are working with are especially important.
The text was updated successfully, but these errors were encountered: