Skip to content

Improve performance of strict transform under toric blowups#4484

Merged
HereAround merged 2 commits intooscar-system:masterfrom
paemurru:ep/fast_toric_strict_transform
Jan 18, 2025
Merged

Improve performance of strict transform under toric blowups#4484
HereAround merged 2 commits intooscar-system:masterfrom
paemurru:ep/fast_toric_strict_transform

Conversation

@paemurru
Copy link
Copy Markdown
Collaborator

@paemurru paemurru commented Jan 17, 2025

I improved the speed of strict_transform for an arbitrary toric blowup. More precisely, I improved cox_ring_module_homomorphism, which is used for strict_transform, total_transform and strict_transform_with_index. The main time-saving techniques:

  • using MPolyBuildCtx to create the polynomial, instead of iteratively adding terms to a polynomial,
  • using Vector{Rational{Int64}} instead of Vector{QQFieldElem} for the vector ps,
  • using Vector{Int64} for the vector ps in the special case where the denominators are 1.

Some small other improvements in the core loop:

  • using first(exponents(g)) instead of collect(exponents(g))[1],
  • using exps = [exps; exceptional_exp] instead of push!(exps, exceptional_exp) reduces allocated memory by about 35% --- I am puzzled why there is a difference here.

The function strict_transform now seems to be faster than the specialized _strict_transform in FTheoryTools that could compute strict transform only under blowups along smooth cones. So I removed the specialized function.

Also, I added a test for computing the strict transform when blowing up along an existing ray.

Benchmarks

I used the F-Theory computations from @HereAround . Namely, I first commented out lines 797--803 of experimental/FTheoryTools/src/AbstractFTheoryModels/methods.jl

  # For model 1511.03209 and resolution_index = 1, a particular resolution is available from an artifact
#   if has_attribute(m, :arxiv_id)
#     if resolution_index == 1 && arxiv_id(m) == "1511.03209"
#       model_data_path = artifact"FTM-1511-03209/1511-03209-resolved.mrdi"
#       return load(model_data_path)
#     end
#   end

and edited line 821 of the same file from for k in 1:nr_blowups to for k in 1:5 to have a faster test.

Then ran

h = literature_model(arxiv_id = "1511.03209")
@btime h_5 = resolve(h, 1)

Results

Previously:

julia> @btime h_5 = resolve(h, 1)
  190.106 s (44395903 allocations: 10.13 GiB)
Partially resolved global Tate model over a concrete base -- The F-theory geometry with most flux vacua based on arXiv paper 1511.03209 Eq. (2.11)

Now:

julia> @btime h_5 = resolve(h, 1)
  188.573 s (38064085 allocations: 6.42 GiB)
Partially resolved global Tate model over a concrete base -- The F-theory geometry with most flux vacua based on arXiv paper 1511.03209 Eq. (2.11)

Improvements

  • time is roughly the same (the exact time changes by a few seconds every run),
  • there are now 14% fewer allocation instances compared to the specialized function in FTheoryTools,
  • 37% less memory used for allocations than the specialized function in FTheoryTools.

@paemurru paemurru changed the title Ep/fast toric strict transform Ep/fast strict transform under toric blowups Jan 17, 2025
@paemurru paemurru changed the title Ep/fast strict transform under toric blowups Fast strict transform under toric blowups Jan 17, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.39%. Comparing base (1f7ded1) to head (46ad165).
Report is 123 commits behind head on master.

Files with missing lines Patch % Lines
experimental/FTheoryTools/src/auxiliary.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4484      +/-   ##
==========================================
+ Coverage   84.37%   84.39%   +0.01%     
==========================================
  Files         672      672              
  Lines       88717    88690      -27     
==========================================
- Hits        74855    74847       -8     
+ Misses      13862    13843      -19     
Files with missing lines Coverage Δ
.../FTheoryTools/src/AbstractFTheoryModels/methods.jl 78.00% <100.00%> (ø)
experimental/Schemes/src/ToricBlowups/methods.jl 96.07% <100.00%> (+0.24%) ⬆️
experimental/FTheoryTools/src/auxiliary.jl 79.83% <0.00%> (+3.83%) ⬆️

... and 4 files with indirect coverage changes

Copy link
Copy Markdown
Member

@HereAround HereAround left a comment

Choose a reason for hiding this comment

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

Wow! That is cool! Thank you @paemurru I am very content with your changes!

@HereAround HereAround merged commit 767415a into oscar-system:master Jan 18, 2025
@paemurru paemurru deleted the ep/fast_toric_strict_transform branch January 18, 2025 11:35
paemurru added a commit to paemurru/Oscar.jl that referenced this pull request Jan 27, 2025
Fixes a bug in FTheoryTools instroduced by
oscar-system#4484
Namely, it previously computed the total transform, not the strict
transform.

Even with the speed improvements of
oscar-system#4485
computing the strict transform with ideals is slower than operating on
polynomials. Therefore, I added a strict transform function on
polynomials.
@aaruni96 aaruni96 added the release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes label Jan 30, 2025
@HereAround HereAround changed the title Fast strict transform under toric blowups Improve performance of strict transform under toric blowups Feb 27, 2025
@HereAround HereAround added release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: toric geometry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants