Skip to content

Add a GPU tutorial #589

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

Merged
merged 2 commits into from
Apr 25, 2025
Merged

Add a GPU tutorial #589

merged 2 commits into from
Apr 25, 2025

Conversation

ChrisRackauckas
Copy link
Member

In this tutorial we will highlight both use cases in separate parts.

!!! note

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

u0 = cu(ones(1000))
p = cu(collect(1:1000))
prob = NonlinearProblem(f, u0, p)
sol = solve(prob, NewtonRaphson(), abstol=1f-4)
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
sol = solve(prob, NewtonRaphson(), abstol=1f-4)
sol = solve(prob, NewtonRaphson(), abstol = 1.0f-4)

The ith result is then this solution".

!!! note

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

out2 = sqrt(p[2]) * (x[3] - x[4])
out3 = (x[2] - p[3] * x[3])^2
out4 = sqrt(p[4]) * (x[1] - x[4]) * (x[1] - x[4])
SA[out1,out2,out3,out4]
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
SA[out1,out2,out3,out4]
SA[out1, out2, out3, out4]

end

p = @SVector [@SVector(rand(Float32, 4)) for _ in 1:1024]
u0 = SA[1f0, 2f0, 3f0, 4f0]
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
u0 = SA[1f0, 2f0, 3f0, 4f0]
u0 = SA[1.0f0, 2.0f0, 3.0f0, 4.0f0]

```

!!! note

Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change

```

!!! warn
The GPU-based calls will only work on your machine if you have a compatible GPU!
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
The GPU-based calls will only work on your machine if you have a compatible GPU!
The GPU-based calls will only work on your machine if you have a compatible GPU!

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@ChrisRackauckas ChrisRackauckas merged commit 93948e1 into master Apr 25, 2025
7 of 10 checks passed
@ChrisRackauckas ChrisRackauckas deleted the gpu branch April 25, 2025 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a tutorial on using SimpleNonlinearSolve inside kernels
1 participant