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

Ginkgo linear solver not instantiated in hybrid mode #573

Open
pelesh opened this issue Dec 2, 2022 · 3 comments
Open

Ginkgo linear solver not instantiated in hybrid mode #573

pelesh opened this issue Dec 2, 2022 · 3 comments
Labels
bug question solver options deals with options for the algorithm and solver

Comments

@pelesh
Copy link
Collaborator

pelesh commented Dec 2, 2022

The HiOp function, which instantiates linear solver, hiopKKTLinSysCompressedSparseXDYcYd::determineAndCreateLinsys, does not have an option to create Ginkgo linear solver when HiOp hybrid mode is selected (i.e. when linear solver runs on GPU and everything else on CPU). See relevant section of the code.

As a result, when Ginkgo linear solver is selected in hybrid mode, HiOp will hit the assertion checking for GPU-enabled linear solver, and segfault. Ginkgo will happily run on GPU when cpu mode is selected, though.

Workaround: Just run Ginkgo in cpu mode and select CPU or GPU backend in Ginkgo configuration.

Fix: Add Ginkgo stanza to the hybrid mode in determineAndCreateLinsys function.

Question: Do linear solvers need to care about hybrid mode at all? All linear solver cares about is if their data is on the device (GPU) or on the host (CPU). As far as I can see, linear solver does not need to distinguish between cpu and hybrid mode.

CC @nychiang @kswirydo @cnpetra @fritzgoebel @nkoukpaizan

@pelesh pelesh added bug question solver options deals with options for the algorithm and solver labels Dec 2, 2022
@fritzgoebel
Copy link
Contributor

Am I correct in assuming that no matter if we are in cpu or hybrid mode, the data for the linear solver will in the beginning be on the CPU? If we get the matrix and vectors already on the GPU, that would need some work for the hybrid mode for the Ginkgo solver I think.

@pelesh
Copy link
Collaborator Author

pelesh commented Dec 6, 2022

Am I correct in assuming that no matter if we are in cpu or hybrid mode, the data for the linear solver will in the beginning be on the CPU? If we get the matrix and vectors already on the GPU, that would need some work for the hybrid mode for the Ginkgo solver I think.

HiOp has three modes defined: cpu, hybrid and gpu. Only the gpu mode delivers data on the device to the linear solver. The difference between hybrid and cpu mode is that the former tries to select linear solver that runs on the device, if available. The interface for GPU-enabled solver should move the data to the device at each HiOp iteration. I believe this is what Ginkgo interface already does in cpu mode.

@cnpetra
Copy link
Collaborator

cnpetra commented Dec 7, 2022

Just to make sure there is no confusion, cpu mode for HiOp is supposed to run the linear solver on cpu, but I am not opposed of running ginkgo on gpu as long as can run on cpu when a device is not available (or hiop is not built with gpu support). hybrid should run the linear solver on gpu (and, yes, data for the linear solver is going to be on cpu).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug question solver options deals with options for the algorithm and solver
Projects
None yet
Development

No branches or pull requests

3 participants