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

Use of threads in library. #68

Open
kako-f opened this issue Dec 30, 2022 · 3 comments
Open

Use of threads in library. #68

kako-f opened this issue Dec 30, 2022 · 3 comments

Comments

@kako-f
Copy link

kako-f commented Dec 30, 2022

Hi! It's possible to specify the number of threads to use in the calculations?
the original library allows to modify this value, I was wondering if the python binding is able to do this.

Thanks!

@jeffdaily
Copy link
Owner

The parasail_aligner application that comes with the C library does allow you to specify the number of threads to use. The Python bindings are only for the C APIs and not the full parasail_aligner application. The alignment functions were always single-threaded, for C or Python. If you want to align sequences in parallel using threads in python, you would need to use one of the Python built in threading modules in such a way that each thread does one or more pairwise alignments. I do not have any sample code for that, sorry.

@kako-f
Copy link
Author

kako-f commented Jan 3, 2023

Hey! no worries, thanks for your insight. I can manage to create a snippet of code to utilize parasail with threads in python! 👍

Appreciated! 😄

@Yaakov-Belch
Copy link

When trying to parallelize computations with python threads, be aware of the Global Interpreter Lock (GIL): The effect of this lock is that, at any time, only one python thread can actually make computations. This means, you do not gain any CPU performance by using python threads.

This does not make sense for applications that want to use multiple CPUs for CPU-bound applications. Still it was the right decision for python. You can learn more about this in this video: PyCon 2015-Pythons Infamous GIL by Larry Hastings.

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

3 participants