Skip to content

CUDA build improvements#645

Merged
NoureldinYosri merged 4 commits into
quantumlib:masterfrom
basnijholt:cuda-builds
Jan 31, 2024
Merged

CUDA build improvements#645
NoureldinYosri merged 4 commits into
quantumlib:masterfrom
basnijholt:cuda-builds

Conversation

@basnijholt
Copy link
Copy Markdown
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
Copy Markdown
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?

unsigned num_dblocks
) : ss_params{num_state_threads, num_dblocks} {}

) {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
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