Skip to content

Best practices for using CvxpyLayer with GPU-based models #173

@autumnwt

Description

@autumnwt

Hello cvxpylayers developers, first, thank you very much for developing and maintaining this powerful library!
In practice, I have a key question about GPU usage that I'd like to ask:
I have read your original NeurIPS 2019 paper ("Differentiable Convex Optimization Layers"), which mentions that the implementation at the time ran on the CPU. As the software has likely evolved significantly since then, I'd like to understand the current best practices. My entire model and training data will be on the GPU. If I insert a CvxpyLayer into this model:Can the current version of cvxpylayers seamlessly handle input tensors located on the GPU and offload the core solver computation to a GPU-accelerated solver? Or, do I still need to manually move the data from the GPU to the CPU (.to('cpu')) before calling the CvxpyLayer, and then manually move the result back to the GPU? Regarding this GPU-CPU data interaction, are there any known performance bottlenecks or recommended practices to be aware of?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions