Macaulay2 / Macaulay2/M2

Profiling Computations

Open
#2,260 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Interpreter
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

Following https://github.com/Macaulay2/M2/pull/2113#discussion_r673203511, and recent conversations with @MichaelABurr, this is a proposed profiling extension to the computation caching routines.

Here is the basic scenario: a piece of code might inadvertently be computing the same groebner basis multiple times, despite the fact that groebner bases are cached. This can happen, for instance, if the user redefines the ring or ideal or makes small adjustments that shouldn't change the groebner basis. We would like to know not just how many times `gb` is run, but specifically how many times _the same_ groebner basis is computed. A simple solution would be to have a global tally and make a unique hash of the groebner bases that are computed and count repeated ones.

Here is how I think we can generalize it to any routine that is computationally intensive enough to warrant caching: (e.g. gb, saturation, etc.)
- define a method `hash Computation` which takes a computation container and produces an integer. For instance, for a groebner basis this can compute `hash raw gens gb m`.
- when `debug Computation` is called, start keeping a tally of how many times that hash has occurred in `ComputationCacheStats`.
- when `status Computation` is called, print information about the collected hashes.
- define `breakpoint Computation`, which might cause an error next time the same hash occurs or when it hits a particular number so that it can be investigated.

update: some of these are now added in #3431

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the computation caching routines and the discussion linked from the issue, then review the related work noted in #3431. Determine which parts of hash Computation, ComputationCacheStats, debug/status Computation, and breakpoint Computation remain unresolved; done means the profiling extension has an agreed scope and behavior for repeated computation hashes.

Written by the indexing model from the issue text.

Assessment

Domain
performance, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.