这是indexloc提供的服务,不要输入任何密码
Skip to content

Fix OMP_NUM_THREADS bug #885

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

Merged
merged 4 commits into from
Mar 5, 2025

Conversation

RobertoDF
Copy link
Contributor

@RobertoDF RobertoDF commented Mar 5, 2025

Hi,

if OMP_NUM_THREADS is not set already it will be set to a string instead of a int here below.

with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="")
# Prevents memory leak for KMeans when using MKL on Windows
msg = 'KMeans is known to have a memory leak on Windows with MKL'
nthread = os.environ.get('OMP_NUM_THREADS', msg)
os.environ['OMP_NUM_THREADS'] = '7'
model = KMeans(n_clusters=ops['settings']['n_templates'], n_init = 10).fit(clips)
wTEMP = torch.from_numpy(model.cluster_centers_).to(device).float()
wTEMP = wTEMP / (wTEMP**2).sum(1).unsqueeze(1)**.5
os.environ['OMP_NUM_THREADS'] = nthread

This was happening on my windows machine and crashing the code.
7 seems to work fine, the msg text is currently unused, not sure it is important to keep it or not.

@codecov-commenter
Copy link

codecov-commenter commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (d8ba42f) to head (aca577f).
Report is 548 commits behind head on main.

Files with missing lines Patch % Lines
kilosort/spikedetect.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main    #885    +/-   ##
======================================
  Coverage   0.00%   0.00%            
======================================
  Files         32      33     +1     
  Lines       4649    5633   +984     
======================================
- Misses      4649    5633   +984     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

RobertoDF and others added 3 commits March 5, 2025 13:06
@jacobpennington
Copy link
Collaborator

Thanks for catching that. Changes have been corrected, waiting for tests before merging.

@jacobpennington jacobpennington merged commit 07980b2 into MouseLand:main Mar 5, 2025
7 checks passed
@RobertoDF RobertoDF deleted the Fix-OMP_NUM_THREADS branch March 5, 2025 19:31
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.

3 participants