By definition, a mole of a pure substance (element or compound) is 6.02x 10^23 molecules of that substance. The gram molecular mass is the mass of that many molecules of the substance in grams, which corresponds to the sum of the atomic masses in the formula of the substance. An atomic mass unit is that which is used as the basis for these numbers. Referring to the Periodic Table of the Elements, and using a simplified example, the atomic mass of Hydrogen is 1, the atomic mass of Oxygen is 16, and the molecular mass of water, H2O, would be 2+16=18 atomic mass units. The gram molecular mass would be 18 grams, which is the actual mass of one mole of water.
Some compounds don't form molecules, but rather combine in set ratios in ionic form. So, instead of having a gram molecular mass, they would have a gram formula mass. In practical terms, they work the same way. Also, metals in the Periodic Table come as single atoms, so their gram atomic mass would be the same as their gram molecular mass. Elements like Oxygen, Nitrogen, and Chlorine, however, come as diatomic molecules, so their gram molecular masses will just be double that of their gram atomic masses, and one mole of each of them would consist of 6.02x10^23 molecules, but 12.04x10^23 atoms.