We construct a global B-model for weighted homogeneous polynomials based on K. Saitos theory of primitive forms. Our main motivation is to give a rigorous statement of the so called global mirror symmetry conjecture relating Gromov-Witten invariants and Fan--Jarvis--Ruan--Witten invariants. Furthermore, our construction allows us to generalize the notion of a quasi-modular form and holomorphic anomaly equations. Finally, we prove the global mirror symmetry conjecture for the Fermat polynomials.