  We establish the precise relation between the Nekrasov-Shatashvili (NS)
quantization scheme and Grassi-Hatsuda-Marino conjecture for the mirror curve
of arbitrary toric Calabi-Yau threefold. For a mirror curve of genus $g$, the
NS quantization scheme leads to $g$ quantization conditions for the
corresponding integrable system. The exact NS quantization conditions enjoy a
self S-duality with respect to Planck constant $\hbar$ and can be derived from
the Lockhart-Vafa partition function of nonperturbative topological string.
Based on a recent observation on the correspondence between spectral theory and
topological string, another quantization scheme was proposed by
Grassi-Hatsuda-Marino, in which there is a single quantization condition and
the spectra are encoded in the vanishing of a quantum Riemann theta function.
We demonstrate that there actually exist at least $g$ nonequivalent quantum
Riemann theta functions and the intersections of their theta divisors coincide
with the spectra determined by the exact NS quantization conditions. This
highly nontrivial coincidence between the two quantization schemes requires
infinite constraints among the refined Gopakumar-Vafa invariants. The
equivalence for mirror curves of genus one has been verified for some local del
Pezzo surfaces. In this paper, we generalize the correspondence to higher
genus, and analyze in detail the resolved $\mathbb{C}^3/\mathbb{Z}_5$ orbifold
and several $SU(N)$ geometries. We also give a proof for some models at
$\hbar=2\pi/k$.
