Skip to content

Conversation

jshleap
Copy link

@jshleap jshleap commented Feb 7, 2022

Change requirements so that TF is both cpu and gpu enabled
Set a default for use_gpu_relax that would not fail in the run (False in this case)
Adding cpu in hhsearch, hhblits, jackhmmer and hmmersearch wrappers as well as in the main call, add n_cpu to pipeline.DataPipeline and pipeline_multimer and adjust jackhmmer and hhblits to accept said attribute

… in this case), Adding cpu in hhsearch, hhblits, jackhmmer and hmmersearch wrappers as well as in the main call, add n_cpu to pipeline.DataPipeline and pipeline_multimer and adjust jackhmmer and hhblits to accept said attribute
@ma595
Copy link

ma595 commented Mar 8, 2022

Thanks for the PR - I was looking to do something similar.

It looks like --cpus is not propagated to the hhblits step, i.e. line 377 of run_alphafold.py (so it's always the default of 4). On my system, I find that dedicating more cpus to this step brings significant improvements.

@Augustin-Zidek
Copy link
Collaborator

Augustin-Zidek commented Mar 8, 2022

Hi, thanks for this PR, I will take a look.

@jshleap I am wondering about the TF CPU -> GPU switch -- we use TF only in bits of the data pipeline where running on GPU doesn't really help, so actually switching to TF GPU should not make running AlphaFold any faster. Did you observe any speedups when changing it?

@ma595 What kind of speedups did you observe with n_cpu > 4 and what number did you use?

@jshleap
Copy link
Author

jshleap commented Mar 8, 2022

@Augustin-Zidek you mean in the requirements? newer versions of tensorflow don't need to be hardcoded. TF will check if a GPU is available and will use it and will default to CPU if not.

@Augustin-Zidek
Copy link
Collaborator

Yes, I mean in requirements.txt. What I am saying is that there is no need for GPU support in AlphaFold's TF installation since it is used only for the data pipeline.

@jshleap
Copy link
Author

jshleap commented Mar 8, 2022

Yeah, and what I am saying is that there is no need for the -cpu as TF will take advantage of GPU if one otherwise defaults to CPU. What I mean is that the tensortflow wheels ship now as generic wheels, so there is no need to add the -cpu. TF supports both cpu and gpu since v2.0.0 (https://www.tensorflow.org/install/pip#tensorflow-2-packages-are-available).

'Relax on GPU can be much faster than CPU, so it is '
'recommended to enable if possible. GPUs must be available'
' if this setting is enabled.')
flags.DEFINE_boolean('cpus', 8, 'Number of cpus/threads to use')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this can be a boolean. Should be integer right?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
flags.DEFINE_boolean('cpus', 8, 'Number of cpus/threads to use')
flags.DEFINE_integer('cpus', 8, 'Number of cpus/threads to use')

@phupe
Copy link

phupe commented Jan 12, 2024

What is the status of this PR that would be very useful?

Augustin-Zidek pushed a commit that referenced this pull request Sep 24, 2025
Addresses the following pull request:
*  #358

PiperOrigin-RevId: 810894445
Change-Id: Ib424b3f331c5168f4505edd154b860420e89237e
@Augustin-Zidek
Copy link
Collaborator

Augustin-Zidek commented Sep 24, 2025

This has been fixed in 4b81ad9. Thanks for reporting.

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.

6 participants