Skip to content

Ignore kmeans memory leak warning on Windows#100

Merged
wesleyjcole merged 1 commit into
mainfrom
wjc/suppress_kmeans_warning
May 20, 2026
Merged

Ignore kmeans memory leak warning on Windows#100
wesleyjcole merged 1 commit into
mainfrom
wjc/suppress_kmeans_warning

Conversation

@wesleyjcole
Copy link
Copy Markdown
Contributor

Summary

When running on Windows, WriteHintage.py prints the memory leak warning below 249 times in a USA_defaults case. This pull request suppressing that warning to give a cleaner log file on Windows. The warning says you can set OMP_NUM_THREADS=1, but given this is Windows only, I opted to not go that route so that we don't unintentionally impact performance on other systems, and because I've never seen any issues with a memory leak in the many years that we have been using this version of the kmeans function.

WriteHintage.py | 2026-05-19 17:09:44 | ERROR | C:\envs\reeds2\Lib\site-packages\sklearn\cluster\_kmeans.py:1382: UserWarning: KMeans is known to have a memory leak on Windows with MKL, when there are less chunks than available threads. You can avoid it by setting the environment variable OMP_NUM_THREADS=1.

Validation, testing, and comparison report(s)

I reran WriteHintage.py on Windows and verified that the error/warning is no longer printed to the log file.

Checklist for author

Details to double-check

  • Charge code provided to reviewers
  • [ ] Included comparison reports for appropriate test cases
  • [ ] Documentation updated if necessary

General information to guide review

  • Zero impact on results of default case
  • No large data file(s) added/modified
  • No substantive impact on runtime for full-US reference case
  • No substantive impact on folder size for full-US reference case
  • No change to process flow (runreeds.py, reeds/core/solve/solve.py)
  • No change to code organization
  • No change to package requirements (environment.yml or Project.toml)

Did you use LLM tools (chatbot or copilot) in the preparation of this PR? If so, describe how

Yes, I used an LLM to figure out how to suppress the warning message.

@wesleyjcole wesleyjcole merged commit b3bbeef into main May 20, 2026
10 checks passed
@wesleyjcole wesleyjcole deleted the wjc/suppress_kmeans_warning branch May 20, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants