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

CUDA build improvements #645

Merged
merged 4 commits into from
Jan 31, 2024
Merged

Conversation

basnijholt
Copy link
Contributor

@basnijholt basnijholt commented Nov 29, 2023

This makes it possible to properly compile with CUDA support with a variety of compiler versions and modern CMake.

These changes are based on the following patches that were used to build qsim with CUDA support on conda-forge:

@basnijholt basnijholt marked this pull request as ready for review November 30, 2023 22:56
Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

My CMake knowledge is rusty enough at this point that I can't really parse this change. @basnijholt, how would we go about testing that this works as intended? Is it feasible to add such a test to CI, both in terms of human effort and keeping CI runs short?

@@ -27,8 +27,10 @@ namespace qsim {
unsigned num_sim_threads,
unsigned num_state_threads,
unsigned num_dblocks
) : ss_params{num_state_threads, num_dblocks} {}

) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What motivates this change? AFAICT the two should behave identically.

Copy link
Contributor Author

@basnijholt basnijholt Dec 1, 2023

Choose a reason for hiding this comment

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

They should be the same but not all compilers can solve the ambiguity.

Locally on my Linux box, as well as on the conda-forge building infrastructure the build will fail with:

./pybind_interface/cuda/pybind_main_cuda.cpp(30): error: no instance of constructor "qsim::StateSpaceCUDA<FP>::Parameter::Parameter [with FP=float]" matches the argument list

@basnijholt
Copy link
Contributor Author

Marking this as draft because it want to make sure it includes all patches that were required to get the conda-forge builds to work.

@basnijholt basnijholt marked this pull request as draft January 26, 2024 01:15
…:Parameter [with FP=float]" matches the argument list'

Full error:
./pybind_interface/cuda/pybind_main_cuda.cpp(30): error: no instance of constructor "qsim::StateSpaceCUDA<FP>::Parameter::Parameter [with FP=float]" matches the argument list
basnijholt added a commit to basnijholt/qsimcirq-feedstock that referenced this pull request Jan 30, 2024
@basnijholt basnijholt marked this pull request as ready for review January 30, 2024 23:53
@basnijholt
Copy link
Contributor Author

basnijholt commented Jan 30, 2024

OK I made sure that these changes align with what happens in the conda-forge repo.

These changes are based on the following patches

To give these changes some weight, @leofang helped with the CUDA builds, who works on cuQuantum at NVIDIA.

@basnijholt
Copy link
Contributor Author

@95-martin-orion I don't have the bandwidth currently to set up a CI pipeline here to build the CUDA versions of qsim. Testing it will also be hard because GitHub doesn't provide and runners with GPUs (yet).

@leofang
Copy link

leofang commented Jan 31, 2024

To be clear, Bas alone came up with all the patches. My involvement there was mainly to offer consultation for general CUDA + conda-forge matters, and to ensure cuQuantum's conda packages can be consumed by downstream. But these patches look fine to me. I think as long as we can ensure it builds fine after applying the patch, from the conda-forge perspective I suggest to merge this PR, so that package maintainers (Bas and I) do not have to maintain the patches indefinitely.

@95-martin-orion 95-martin-orion added the kokoro:run Trigger Kokoro builds for this PR. label Jan 31, 2024
Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

Thanks for the clarification - these patches look good to me.

@qsim-qsimh-bot qsim-qsimh-bot removed the kokoro:run Trigger Kokoro builds for this PR. label Jan 31, 2024
@NoureldinYosri NoureldinYosri merged commit 5416d95 into quantumlib:master Jan 31, 2024
17 checks passed
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.

5 participants