Synecdoche, where a specific part of something is taken to refer to the whole, is usually understood as a specific kind of metonymy. Sometimes, however, people make an absolute distinction between a metonymy and a synecdoche, treating metonymy as different from rather than inclusive of synecdoche. There is a similar problem with the usage of simile and metaphor.
When the distinction is made, it is the following: when A is used to refer to B, it is a synecdoche if A is a part of B and a metonym if A is commonly associated with B but not a part of it.
Thus, "The White House said" would be a metonymy for the president and his staff, because the White House (A) is not part of the president or his staff (B), it is merely closely associated with them because of physical proximity. On the other hand, asking for "All hands on deck" is a synecdoche because hands (A) are actually a part of the men (B) to whom they refer.
Sources: http://en.wikipedia.org/wiki/Metonymy