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

Use a dynamic sampler to speed-up weighted sampling #30

Merged
merged 52 commits into from
Nov 26, 2024

Conversation

Tortar
Copy link
Collaborator

@Tortar Tortar commented Nov 10, 2024

Still wip because https://github.com/Tortar/DynamicSampling.jl needs still to be released, but this speeds up big models more almost by an order of magnitude

Superseeds #20

@Tortar
Copy link
Collaborator Author

Tortar commented Nov 20, 2024

okay, I think this can be merged, it gives a quite cool speedup: from >1400 seconds of main to <85 seconds for one epoch of all austrian economy

@AldoGl
Copy link
Collaborator

AldoGl commented Nov 26, 2024

Thanks @Tortar, this looks good to me and we can merge the PR.
If you have it handy, you could add a reference for the dynamic sampling technique you implemented here. You could add this to the conversation even after we merge

@AldoGl AldoGl self-requested a review November 26, 2024 16:12
.github/workflows/documentation.yml Outdated Show resolved Hide resolved
@@ -6,8 +6,10 @@ version = "0.1.2"
[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DynamicSampling = "2083aeaf-6258-5d07-89fc-32cf5060c837"
Copy link
Collaborator

Choose a reason for hiding this comment

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

So, this PR is based on the use of this package. Would you have a paper that describes the technique implemented there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will add something to the package explaining the origin of the technique

b = C_d_h .* b_HH_g[g] .- pos!(@view(C_d_hg[1:H]) .- b_CFH_g[g] .* I_d_h)
c = C_d_h .* b_HH_g[g] .+ b_CFH_g[g] .* I_d_h .- @view(C_d_hg[1:H])
d = pos!(b_CFH_g[g] .* I_d_h .- @view(C_d_hg[1:H]))
b = @~ C_d_h .* b_HH_g[g] .- pos.(@view(C_d_hg[1:H]) .- b_CFH_g[g] .* I_d_h)
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you explain what @~ does?

Copy link
Collaborator Author

@Tortar Tortar Nov 27, 2024

Choose a reason for hiding this comment

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

@~ comes from LazyArrays.jl and allows us to "wait" until that operations are actually required to run, we can then fuse the operations, so that we don't need more passes over data

test/markets/search_and_matching.jl Show resolved Hide resolved
@Tortar Tortar merged commit 17fdcad into bancaditalia:main Nov 26, 2024
2 checks passed
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.

2 participants