Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajay tripathy fix gpucost #2523

Merged
merged 2 commits into from Feb 14, 2024
Merged

Ajay tripathy fix gpucost #2523

merged 2 commits into from Feb 14, 2024

Conversation

AjayTripathy
Copy link
Contributor

@AjayTripathy AjayTripathy commented Feb 12, 2024

What does this PR change?

  • This needs to be a per-unit GPUcost, not a total

Does this PR relate to any other PRs?

How will this PR impact users?

  • Fix GPU overcharging for nodes with multiple GPU

Does this PR address any GitHub or Zendesk issues?

  • Closes ...

How was this PR tested?

  • Manually

Does this PR require changes to documentation?

  • No

Have you labeled this PR and its corresponding Issue as "next release" if it should be part of the next OpenCost release? If not, why not?

  • Yes, should be in next release and cherrypicked back

Copy link

vercel bot commented Feb 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
opencost ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2024 3:22pm

@@ -279,7 +279,7 @@ func (c *CSVProvider) NodePricing(key models.Key) (*models.Node, models.PricingM
}
}
totalCost := hourly * float64(count)
node.GPUCost = fmt.Sprintf("%f", totalCost)
node.GPUCost = fmt.Sprintf("%f", hourly)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this has to be modified, doesn't the line a little below

node.Cost = fmt.Sprintf("%f", nc+totalCost)

have to be modified?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don't understand why this isn't totalCost -- if there are multiple GPUs, shouldn't the cost be multiplied? Or is this because GPUClassPricing contains prices that total the GPUs on a node, rather than breaking them out individually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, don't think so. node.GPUCost is unit cost of a GPU; node.Cost is totalCost

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the field that gets transformed into node_gpu_hourly_cost . Its sister queries are node_cpu_hourly_cost and node_ram_hourly_cost which are unit prices per 1cpu and 1GB RAM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, don't think so. node.GPUCost is unit cost of a GPU; node.Cost is totalCost

Oh, huh, that's a little confusing; sorry I think I thought we were in a different part of the Opencost codebase. Now that I see we're in provider land, this makes more sense.

This is the field that gets transformed into node_gpu_hourly_cost . Its sister queries are node_cpu_hourly_cost and node_ram_hourly_cost which are unit prices per 1cpu and 1GB RAM.

Perfect, this makes way more sense now.

Copy link

sonarcloud bot commented Feb 14, 2024

@cliffcolvin cliffcolvin merged commit 067659f into develop Feb 14, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants