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

fix(cuda): fix multi-GPU implementation when there are few inputs #149

Merged
merged 1 commit into from
Sep 2, 2022

Conversation

agnesLeroy
Copy link
Collaborator

@agnesLeroy agnesLeroy commented Aug 31, 2022

Resolves: https://github.com/zama-ai/concrete-core-internal/issues/382 and https://github.com/zama-ai/concrete-core-internal/issues/389

Description

  • Fix multi GPU when there are few inputs: in case the number of GPUs is lower than the number of inputs, restrict the number of GPUs used to the number of inputs.
  • Also, change some types so that it feels more natural to use them.

Checklist

(Use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • The PR description links to the related issue (to link an issue, use '#XXX'.)
  • The tests on AWS have been launched and are successful (comment with @slab-ci cpu_test and/or @slab-ci gpu_test to trigger the tests)
  • The draft release description has been updated
  • Check for breaking changes (including serialization changes) and add them to commit message following the conventional commit specification

@cla-bot cla-bot bot added the cla-signed label Aug 31, 2022
@agnesLeroy
Copy link
Collaborator Author

@slab-ci gpu_test

@agnesLeroy
Copy link
Collaborator Author

@slab-ci cpu_test

@agnesLeroy
Copy link
Collaborator Author

@slab-ci cpu_test

@agnesLeroy
Copy link
Collaborator Author

@slab-ci gpu_test

@agnesLeroy
Copy link
Collaborator Author

@slab-ci cpu_test

@agnesLeroy
Copy link
Collaborator Author

@slab-ci gpu_test

Comment on lines +76 to +81
let data_per_gpu = input.glwe_dimension().to_glwe_size().0
* input.glwe_dimension().to_glwe_size().0
* input.input_lwe_dimension().0
* input.decomposition_level_count().0
* input.polynomial_size().0;
let size = data_per_gpu as u64 * std::mem::size_of::<u32>() as u64;
Copy link
Member

Choose a reason for hiding this comment

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

there already is the need for the compiler in practice https://github.com/zama-ai/concrete-core-internal/issues/188

@pdroalves
Copy link
Contributor

Impressive work refactoring the CUDA backend, @agnesLeroy !

Copy link
Member

@IceTDrinker IceTDrinker left a comment

Choose a reason for hiding this comment

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

Generally looks good 🙂 great effort !

@agnesLeroy
Copy link
Collaborator Author

@slab-ci gpu_test

@agnesLeroy
Copy link
Collaborator Author

@slab-ci gpu_test

Copy link
Member

@IceTDrinker IceTDrinker left a comment

Choose a reason for hiding this comment

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

A few things still (sorry)

- also, change some types so that it feels more natural to use them
- refactor the whole backend to reduce the probability of bugs
@agnesLeroy
Copy link
Collaborator Author

@slab-ci gpu_test

@agnesLeroy
Copy link
Collaborator Author

@IceTDrinker normally I took all the comments into account, GPU tests are green! 🙂

Copy link
Member

@IceTDrinker IceTDrinker left a comment

Choose a reason for hiding this comment

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

Looks good as far as I can tell !

For the twiddle thing can it be something that the fft does by itself ?

@agnesLeroy
Copy link
Collaborator Author

Looks good as far as I can tell !

For the twiddle thing can it be something that the fft does by itself ?

Maybe, we need to do some benchmarking to check the effect on performance.

@agnesLeroy agnesLeroy merged commit fe1f719 into main Sep 2, 2022
@agnesLeroy agnesLeroy deleted the fix/multi_gpu branch September 2, 2022 13:33
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.

None yet

3 participants