  Important illustration to the principle ``partition functions in string
theory are $\tau$-functions of integrable equations'' is the fact that the
(dual) partition functions of $4d$ $\mathcal{N}=2$ gauge theories solve
Painlev\'e equations. In this paper we show a road to self-consistent proof of
the recently suggested generalization of this correspondence: partition
functions of topological string on local Calabi-Yau manifolds solve
$q$-difference equations of non-autonomous dynamics of the
``cluster-algebraic'' integrable systems.
  We explain in details the ``solutions'' side of the proposal. In the simplest
non-trivial example we show how $3d$ box-counting of topological string
partition function appears from the counting of dimers on bipartite graph with
the discrete gauge field of ``flux'' $q$. This is a new form of topological
string/spectral theory type correspondence, since the partition function of
dimers can be computed as determinant of the linear $q$-difference Kasteleyn
operator. Using WKB method in the ``melting'' $q\to 1$ limit we get a closed
integral formula for Seiberg-Witten prepotential of the corresponding $5d$
gauge theory. The ``equations'' side of the correspondence remains the
intriguing topic for the further studies.
