FlashSinkhorn 2: Block-Sparse Entropic Optimal Transport
Organizations: Department of Mathematics & Statistics, University at Albany, Albany, NY, USA · IBM T. J. Watson Research Center, Yorktown Heights, NY, USA
Abstract
Streaming GPU solvers for entropic optimal transport (EOT), such as FlashSinkhorn, avoid storing the dense kernel but still evaluate all point pairs in every Sinkhorn iteration. We present FlashSinkhorn~2 (FS2), a solver for squared-Euclidean cost on low-dimensional point clouds that solves large discrete EOT problems to a prescribed marginal residual on a single GPU by coupling two stages. A coarse stage solves on cell centroids, lifts the potentials to every point and, when a sampled marginal check rejects the lift, continues on the centroids, replacing most point-level updates. A block-sparse fine stage then removes the centroid error that coarse updates cannot. Its Morton-ordered blocks support screening and fused tensor-core execution, and a threshold set by the block masses bounds each omitted tile's contribution to every row and column. On synthetic benchmarks, FS2 reaches the target residual on all 32 problems and GeomLoss multiscale on 10. On one A100, FS2 solves discrete EOT between two -particle measures from a cosmological -body simulation, at an entropic blur equal to the mean interparticle distance, to an all-particle marginal residual below 0.01 in under 2.5 hours. To our knowledge, it is the largest discrete EOT problem solved to this accuracy within hours. For reproducibility, we release an open-source implementation at https://github.com/ot-triton-lab/flash-sinkhorn
Figures & tables
| FS2 | GL | GL + | FS | |
| Time (s) | 15.44 | 21.45 | 421.10 | 311.98 |
| coarse stage | 2.94 | 0.005 | 0.022 | – |
| fine stage | 12.30 | 21.40 | 420.67 | 311.98 |
| Fine updates | 18 | 12 | 225 | 44 |
| per update (s) | 0.68 | 1.78 | 1.87 | 7.09 |
| Memory (GiB) | 2.09 | 0.26 | 0.26 | 0.20 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| over | Gradient | ||||||
|---|---|---|---|---|---|---|---|
| Cloud | factor | Admitted | Max | Thm. 1 bound | Max error | over | rel. |
| Clustered | 6.33% | 0.005 | 0.48 | ||||
| Clustered | 5.32% | 0.005 | 0.48 | ||||
| Heterog. | 60.54% | 0.023 | 0.23 | ||||
| Heterog. | 49.24% | 0.038 | 0.23 |
| FS2 time (s) | FS2 | GL time (s) | GL | ||
| Clustered | |||||
| 0.001 | 5.638 | 0.004879 | 1.521 | 0.054122 † | |
| 0.01 | 0.290 | 0.002918 | 0.026 | 0.072730 † | |
| 0.001 | 4.176 | 0.004791 | 5.500 | 0.053802 † | |
| 0.01 | 0.275 | 0.003245 | 0.027 | 0.071918 † | |
| 0.001 | 15.593 | 0.004828 | 21.448 | 0.054161 † | |
| Clustered, | Heterogeneous, | ||||
|---|---|---|---|---|---|
| Solver | Cells | Time (s) | Time (s) | ||
| FS2 | auto | 15.37 | .00483 | 0.273 | .00095 |
| GL, scaling .90 | default | 21.46 | .0542 | 57.80 | .00084 |
| GL, scaling .95 | default | 39.48 | .0310 | 86.59 | .00094 |
| GL, scaling .99 | default | 200.38 | .00687 | 404.03 | .00020 |
| GL, scaling .90 | matched | 0.361 | .0597 | 0.391 | .00076 |
| Continued at the target | |||||
|---|---|---|---|---|---|
| Problem | GL setting | Time (s) | |||
| .90, default | .0542 | – | – | .0203 at | |
| .99, default | .00687 | 118 | 421.10 | .004997 | |
| .90, matched | .0597 | – | – | .0160 at | |
| .90, default | .0731 | – | – | .0372 at | |
| .99, default | .0373 | – | – | .0372 at | |
| Problem | Mask | |||||||
|---|---|---|---|---|---|---|---|---|
| Clustered | 0.001 | 0.005 | sparse | 0.004879 | 0.004879 | 0.004884 | ||
| Clustered | 0.01 | 0.005 | sparse | 0.002918 | 0.002918 | 0.002945 | ||
| Clustered | 0.001 | 0.005 | sparse | 0.004791 | 0.004791 | 0.004796 | ||
| Clustered | 0.01 | 0.005 | sparse | 0.003245 | 0.003246 | 0.003271 | ||
| Clustered | 0.001 | 0.005 | sparse | 0.004828 | 0.004828 | 0.004833 | ||
| Clustered | 0.002 | 0.005 | sparse | 0.004094 | 0.004094 | 0.004101 |
| Case | Control | FS2 (s) | Control (s) | Full | Ratio | State |
|---|---|---|---|---|---|---|
| C, 0.001 | No coarse stage | 4.165 | 153.330 | 0.02135 | – | misses target |
| Dense fine | 4.165 | 33.327 | 0.00479 | 8.001 | qualified | |
| Box only | 4.167 | 4.335 | 0.00479 | 1.040 | qualified | |
| C, 0.01 | No coarse stage | 0.275 | 183.132 | 0.00477 | 664.818 | qualified |
| Dense fine | 0.276 | 0.275 | 0.00325 | – | inactive | |
| Box only | 0.276 | 0.275 | 0.00325 | – | inactive |
| (a) Extra coarse updates, clustered | |||||
| Extra coarse | Fine cap | Fine updates | Time (s) | Ratio | |
| 2048 (native) | 128 | 13 + 2 | 4.169 | 0.00479 | 1 |
| 64 | 128 | 128 + 3 | 24.355 | 0.01896 | – |
| 256 | 128 | 128 + 3 | 24.817 | 0.01421 | – |
| 64 | 8192 | 1267 + 38 | 250.235 | 0.00478 | 60.0 |
| 256 | 8192 | 1077 + 38 | 215.674 | 0.00477 | 51.6 |
| Metric | FS (dense) | GL (KeOps, FP32) | FS2 (TF32) |
|---|---|---|---|
| Point pairs per direction | |||
| NCU time per direction (ms) | 3,600 | 393.957 | 251.435 |
| Warm update, both directions (ms) | – | 791.073 | 504.392 |
| Warp instructions / pair | 0.34 | 0.628315 | 0.278530 |
| Shared-load wavefronts / pair | – | 0.0625001 | 0.0246587 |
| Shared-store wavefronts / pair | – | 0.0009806 | 0.0053709 |
| Cloud | FS2 s | GL s | FS2 decrease | GL decrease | ||
|---|---|---|---|---|---|---|
| Heterogeneous | .001 | .004297 | 52.80 | 3215.67 | .5829% | .5826% |
| Heterogeneous | .01 | .01501 | 51.66 | 1290.01 | .2551% | .2550% |
| Clustered | .001 | .05230 | 79.81 | 453.22 | .3064% | .2906% |
| Clustered | .01 | .08166 | 42.58 | 0.80 | .1756% | .1682% |
| method | configuration | time (s) | peak (GiB) | light validation | full max | ||
|---|---|---|---|---|---|---|---|
| FS2 | .05 | 146.905 W | 12.053 | .046836 [.048531] | .046631 ✓ | ||
| FS2 | .05 | 374.839 W | 19.472 | .049304 [.049758] | — | ||
| FS2 | .05 | 694.630 W | 33.131 | .048340 [.048783] | — | ||
| FS2 | .05 | 1351.589 W | 64.129 | .049009 [.050797] | .048965 ✓ | ||
| FS2 | .01 | 736.393 W | — | .009538 [.009924] | .009433 ✓ | ||
| FS2 | .01 | 8832.994 F | — | .009585 [.009954] | .009154 ✓ |
| Predictor | Particles | RMSE (Mpc/ ) | Normalized RMSE | 95% interval |
|---|---|---|---|---|
| Zero displacement | 4096 | 10.064 | 1.000 | – |
| FS2 barycentric displacement | 4096 | 6.473 | 0.643 | [0.625, 0.662] |
| no periodic-face crossing | 4034 | 6.333 | – | – |
| periodic-face crossing | 62 | 12.603 | – | – |
Optimal Transport
Optimal transport compares and transforms probability distributions by finding low-cost ways to move mass between them.
See all 284 papers