We establish the precise relation between the Nekrasov-Shatashvili (NS) quantization scheme and Grassi-Hatsuda-Mariño 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 constanth and can be derived from the Lockhart-Vafa partition function of non-perturbative topological string. Based on a recent observation on the correspondence between spectral theory and topological string, another quantization scheme was proposed by Grassi-Hatsuda-Mariño, 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 C 3 /Z 5 orbifold and several SU (N ) geometries. We also give a proof for some models ath = 2π/k. arXiv:1606.07330v2 [hep-th]