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

predict_single_npy_array() on newest version is slower than before on CPU #2690

Open
MoraruCristian opened this issue Feb 4, 2025 · 0 comments
Assignees

Comments

@MoraruCristian
Copy link

Hello,

I've been using version 2.1.1 for training and inference and wanted to switch to 2.5.1 to get the newest fixes.

For my use case I need to run the prediction using predict_single_npy_array() function on CPU (image is aleady loaded into memory).
By comparing the two versions, there was a big performance difference on both lowres and fullres using all fold on CPU.
On GPU, however, I don't have the same problem, the prediction times lie in the same range.

I saw that in 2.5.1, in predict_logits_from_preprocessed_data() is the following piece of code:

 n_threads = torch.get_num_threads()
 torch.set_num_threads(default_num_processes if default_num_processes < n_threads else n_threads)

This limits the default_num_processes to 8, while in 2.1.1, this line of code does not exist, implying that Pytorh can use however many processes are available. And so, for me, the newest version is 4 to 5 times slower.
I changed default_num_processes to the same number of processed that the old version would've used, but it still got 2 to 3 times slower.

Which could be the reason for this big time difference?

Thank you.

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

No branches or pull requests

2 participants