Skip to content

Add progress bars for MCMC sampling using cli's C API#642

Draft
Copilot wants to merge 7 commits intomasterfrom
copilot/add-progress-bars-mcmc-sampling
Draft

Add progress bars for MCMC sampling using cli's C API#642
Copilot wants to merge 7 commits intomasterfrom
copilot/add-progress-bars-mcmc-sampling

Conversation

Copy link

Copilot AI commented Jan 31, 2026

Plan: Add Progress Bars for MCMC Sampling

  • Add cli package to DESCRIPTION as an Import and LinkingTo
  • Create C API implementation using cli's native C API
  • Add progress bar to MCMC.c.template main sampling loop
  • Add progress bar to SAN.c.template main sampling loop
  • Add progress bar to CD.c.template main sampling loop
  • Add progress bar to MPLE.c dyad iteration loop
  • Add progress bar to MCMC.c.template Phase 1/2 adaptive algorithm loops
  • Use cli's C API directly (not R callbacks)
  • Show progress bars always (not conditional on verbose)
  • Revert documentation changes (will be handled manually)

Summary of Changes

Implementation complete using cli's C API:

  • Added LinkingTo: cli to DESCRIPTION
  • Created src/ergm_progress.h using #include <cli/progress.h> and cli C functions
  • Updated all C templates to use new API with ergm_progress_bar structure
  • Progress bars always show (controlled by cli's CLI_SHOULD_TICK)
  • Documentation changes reverted per request (will be handled manually)
Original prompt

This section details on the original issue you should resolve

<issue_title>Add progress bars for MCMC sampling?</issue_title>
<issue_description>{cli} has a C API: https://cli.r-lib.org/reference/progress-c.html , and it should be pretty straightforward, giving the user an idea of the progress of the current MCMC run.

We already depend on {cli} indirectly.</issue_description>

Comments on the Issue (you are @copilot in this section)

@krivit Specifically, the code that would benefit from this the most would be in src/MCMC.c.template.do_not_include_directly.h, src/SAN.c.template.do_not_include_directly.h, src/CD.c.template.do_not_include_directly.h, and src/MPLE.c.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 31, 2026 23:58
Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
@krivit
Copy link
Member

krivit commented Feb 1, 2026

@copilot use cli's C API instead.

Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
@krivit
Copy link
Member

krivit commented Feb 1, 2026

@copilot use progress bars regardless of verbosity.

Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
Copilot AI changed the title [WIP] Add progress bars for MCMC sampling Add progress bars for MCMC sampling using cli package Feb 1, 2026
Copilot AI requested a review from krivit February 1, 2026 00:15
Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 1, 2026

@copilot use cli's C API instead.

Done in commit 7b1122a. Now using cli's C API directly via #include <cli/progress.h> instead of calling R functions from C. The implementation uses cli's native C functions (cli_progress_bar, cli_progress_set, cli_progress_done) and checks CLI_SHOULD_TICK to respect cli's progress bar settings.

@copilot use progress bars regardless of verbosity.

Done in commit 7b1122a. Progress bars now show regardless of verbosity level. The cli C API's CLI_SHOULD_TICK macro controls whether progress bars are displayed, which respects cli's global settings and user preferences.

Copilot AI changed the title Add progress bars for MCMC sampling using cli package Add progress bars for MCMC sampling using cli's C API Feb 1, 2026
@krivit
Copy link
Member

krivit commented Feb 1, 2026

@copilot Revert verbose.R and NEWS.Rd: documentation will be handled manually.

Co-authored-by: krivit <15682462+krivit@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 1, 2026

@copilot Revert verbose.R and NEWS.Rd: documentation will be handled manually.

Done in commit 1e6594e. Reverted both man-roxygen/verbose.R and inst/NEWS.Rd to their original state before any documentation changes were made.

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 progress bars for MCMC sampling?

2 participants