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

better document debug macros #393

Open
fantasma13 opened this issue Apr 22, 2022 · 13 comments
Open

better document debug macros #393

fantasma13 opened this issue Apr 22, 2022 · 13 comments
Labels

Comments

@fantasma13
Copy link
Contributor

As discussed with Ed, please add using debugging macros to the documents.

@mohawk2 mohawk2 added the cat:doc label May 4, 2022
@mohawk2
Copy link
Member

mohawk2 commented May 6, 2022

This needs to be in an updated "developer's guide":

To generate a stack-trace to help us debug a problem, please first of all do make realclean, ensure you have the latest released PDL, then if it is still happening, please follow this process:

  • Rerun perl Makefile.PL (this will update the timestamps on Makefiles, prompting a full rebuild)
  • Edit your generated top-level Makefile to add -g to the OPTIMIZE = line to generate debug symbols (this gets propagated to subdirs by EUMM’s PASTHRU_* mechanism)
  • Run: make
  • Run: gdb perl -ex 'run -Mblib t/tracking.t'
  • In gdb, run: bt
  • Copy-paste the backtrace output which should show where the segfault originated

Then please open an issue on whichever repo is relevant (possibly PDL, possibly in this context PDL-OpenCV) with your perl -V output and PDL version, together with the stack-trace created above. When you do paste such output into a GitHub issue, please surround such blocks with ``` on their own lines. You can check out it will render with the "Preview" button above the issue-editing box.

@mohawk2
Copy link
Member

mohawk2 commented May 8, 2022

Techniques to be discussed should include the new PDL_IF_BAD, and recommend starting any design by thinking about complex values first, together with how to handle badvalues. An example of creative use of badvalues is mentioned in https://perlmonks.org/?node_id=11143676

Also to be discussed: code generation; cf PDL::Slatec, PDL::LinearAlgebra::Complex, and now PDL::OpenCV.

@mohawk2
Copy link
Member

mohawk2 commented May 8, 2022

Also in design thinking: broadcasting from the start (and pthreading, where relevant).

@mohawk2
Copy link
Member

mohawk2 commented Mar 28, 2023

To see how PP processes one operation's pp_def, put before its pp_def:

$::PP_VERBOSE = 1;

and after:

$::PP_VERBOSE = 0;

Also, for "core" modules, the Makefile has e.g.. the coretest target for rapid iteration, which is made up of sub-targets like Basic_Slices_pm_to_blib_dynamic, for finer-grained rapid iteration.

Additionally, it can be useful to inspect e.g. Basic/Slices/pp-rangeb.c to see what is actually generated.

@mohawk2
Copy link
Member

mohawk2 commented Jan 31, 2024

Include techniques shown in #457, and the new graphviz stuff as shown in https://sourceforge.net/p/pdl/mailman/message/58730063/

@mohawk2
Copy link
Member

mohawk2 commented Feb 10, 2024

Include techniques of Example/address-pseudonymise including -x mode to help spot old vs new behaviour.

@mohawk2
Copy link
Member

mohawk2 commented Feb 15, 2024

The fancy loop() and OtherPars stuff in https://www.perlmonks.org/?node_id=11157717 should probably be captured.

@mohawk2
Copy link
Member

mohawk2 commented Feb 16, 2024

The discussion of internals and dataflow in moocow-the-bovine/PDL-CCS#5 should be extracted from.

@mohawk2
Copy link
Member

mohawk2 commented Feb 25, 2024

See #463 for notes on doc-pp.

@mohawk2
Copy link
Member

mohawk2 commented Feb 26, 2024

This is a good example of good array-programming practice (f5ac428), credit to @wlmb and Photonic for the technique including the commenting style.

@mohawk2
Copy link
Member

mohawk2 commented Mar 31, 2024

#451 has performance-analysing stuff, cachegrind in particular. #421 discusses other performance/implementation stuff.

HaraldJoerg added a commit to HaraldJoerg/pdl that referenced this issue Jun 27, 2024
* Basic/Pod/DeveloperGuide.pod:
  Delete the sections "Access to PDL's configuration" and
  "Ingesting an external PDL module".
  Document $::PP_VERBOSE and $PDL::Graphics::TriD::verbose.
  Add a section "Generating a Stack Trace" taken from GitHub issue PDLPorters#393.
  Add some more mappings to the package->source file table.

* Basic/PDL.pm: Link to the Developer Guide under LANGUAGE
  DOCUMENTATION.

* Basic/Pod/FAQ.pod: Link to the Developer Guide in Q: 3.5.

* Basic/Pod/QuickStart.pod: Link to the Developer Guide. Also
  remove a phrase "until recently" which was recent ... in 1998, and
  don't mention HTML copies of the documentation which are no longer
  generated (and https://perldoc.perl.org exists).
@HaraldJoerg
Copy link
Contributor

The recipe to create a stack trace and documentation of $::PP_VERBOSE will be included in the DeveloperGuide as parts of Pull Request #486.

HaraldJoerg added a commit to HaraldJoerg/pdl that referenced this issue Aug 1, 2024
adjusted after review:

* Basic/Pod/DeveloperGuide.pod:
  Delete the sections "Access to PDL's configuration" and
  "Ingesting an external PDL module".
  Document $::PP_VERBOSE and $PDL::Graphics::TriD::verbose.
  Add a section "Generating a Stack Trace" taken from GitHub issue PDLPorters#393.
  Add some more mappings to the package->source file table.

* Basic/PDL.pm: Link to the Developer Guide under LANGUAGE
  DOCUMENTATION.

* Basic/Pod/FAQ.pod: Link to the Developer Guide in Q: 3.5.

* Basic/Pod/QuickStart.pod: Link to the Developer Guide. Also
  remove a phrase "until recently" which was recent ... in 1998, and
  don't mention HTML copies of the documentation which are no longer
  generated (and https://perldoc.perl.org exists).

Changes according to mohawk2's review:

* Mention $PDL::verbose and PDL::debug.
* Adapt the section to organize commit to current best practice
  "one commit per small, meaningfil change"
* Delete modules outside the repository from the module->file table
* Add a line describing pdldoc
mohawk2 pushed a commit that referenced this issue Aug 1, 2024
adjusted after review:

* Basic/Pod/DeveloperGuide.pod:
  Delete the sections "Access to PDL's configuration" and
  "Ingesting an external PDL module".
  Document $::PP_VERBOSE and $PDL::Graphics::TriD::verbose.
  Add a section "Generating a Stack Trace" taken from GitHub issue #393.
  Add some more mappings to the package->source file table.

* Basic/PDL.pm: Link to the Developer Guide under LANGUAGE
  DOCUMENTATION.

* Basic/Pod/FAQ.pod: Link to the Developer Guide in Q: 3.5.

* Basic/Pod/QuickStart.pod: Link to the Developer Guide. Also
  remove a phrase "until recently" which was recent ... in 1998, and
  don't mention HTML copies of the documentation which are no longer
  generated (and https://perldoc.perl.org exists).

Changes according to mohawk2's review:

* Mention $PDL::verbose and PDL::debug.
* Adapt the section to organize commit to current best practice
  "one commit per small, meaningfil change"
* Delete modules outside the repository from the module->file table
* Add a line describing pdldoc
@mohawk2
Copy link
Member

mohawk2 commented Sep 27, 2024

On adding badvalue-awareness; I believe fd41378 is a nice demonstration (for matmult) of how to do this, needing the addition of 4 lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants