Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Precise GPU solvers? #500

Unanswered
Yura52 asked this question in Q&A
Discussion options

Hi! I am looking for replacements for the OpenCV solver.

My requirements are:
(1) precise solver (i.e. Sinkhorn-like solvers is not an option)
(2) GPU-acceleration
(3) it is possible to pass custom cost matrix (or EMD is hardcoded)
(4) ideally, with batched calculation

As far as I can see, ot.gpu offers only approximate solvers, right? If so, are you aware of any other projects that are relevant to my query? I realize that this is not a "POT issue", sorry for that, just don't know where to ask (Google doesn't help).

You must be logged in to vote

Replies: 4 comments

Comment options

Hello,

I have a start of implementation that uses the fast exact solver on cpu but with a seamless cpu/gpu wrapper for torch. The actual solving is not done on GPU but i have found that the overhead is quite small in practice.

https://github.com/PythonOT/POT/tree/torch

I am not a aware of a true GPU opens source exact OT solver for the general emd problem (general cost function). Please tell us if you find one.

You must be logged in to vote
0 replies
Comment options

https://github.com/PythonOT/POT/tree/torch

Thank you, I'll take a look.

for the general emd problem (general cost function)

I'd like to clarify (sorry for ambiguity): by "EMD" I mean the general Optimal Transport problem with a specific cost matrix that is formed by euclidean (not squared) distances (I refer to the terminology suggested somewhere by the author of [geomloss](https://www.kernel-operations.io/geomloss/api/pytorch-api.html; in terms of their APIs, I am looking for solvers with p=1). This is why "EMD is hardcoded" will also work for me.

P.S. Probably worth mentioning that gradients is also not a requirement, I am just looking for fast ways of optimal plans calculation.

You must be logged in to vote
0 replies
Comment options

Hi @Yura52 , sorry for delay. EMD can be solved with any type of cost matrix. As for mini-batch, I do not think it is possible to solve the exact OT problem in a batch setting. You can do batch (with stochastic descent) if you add some regularizations to the problem (thus leading to 'smoother' solutions) or consider a mini-batch strategy such as in this paper https://arxiv.org/pdf/1910.04091.pdf, but again the result will not be the exact OT distance/coupling....

You must be logged in to vote
0 replies
Comment options

I mean a batch of independent optimal transport problems with inputs of the same dimensions.

As for EMD terminology, I still encounter different definitions, but I got your point :)

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Converted from issue

This discussion was converted from issue #211 on August 08, 2023 14:22.

AltStyle によって変換されたページ (->オリジナル) /