The power to grant pardons is granted to the President in Article II, Section 2, Clause 1 of the United States Constitution; the relevant part of which reads:
[H]e shall have Power to Grant Reprieves and Pardons for Offences against the United States, except in Cases of Impeachment.
It does not explicitly grant the power to perform general large-scale general pardons, but it does not prohibit it either.
Some have argued that an overly broad pardon could be against Section 3 of Article II of the Constitution, which states that "he shall take Care that the Laws be faithfully executed". This scenario has never been tested in court though.
So yes, the United States President could issue such a pardon. There are several well-known examples of such pardons:
In 1868 President Andrew Johnson pardoned all ex-confederates:
[H]ereby proclaim and declare unconditionally and without reservation, to all and to every person who, directly or indirectly, participated in the late insurrection or rebellion a full pardon and amnesty for the offense of treason against the United States or of adhering to their enemies during the late civil war, with restoration of all rights, privileges, and immunities under the Constitution and the laws which have been made in pursuance thereof.
In 1893 President Benjamin Harrison pardoned all members of the The Church of Jesus Christ of Latter-day Saints ("The Mormon Church") for polygamy:
[H]ereby declare and grant a full amnesty and pardon to all persons liable to the penalties of said act by reason of unlawful cohabitation under the color of polygamous or plural marriage who have since November 1, 1890, abstained from such unlawful cohabitation, but upon the express condition that they shall in the future faithfully obey the laws of the United States hereinbefore named, and not otherwise. Those who shall fail to avail themselves of the clemency hereby offered will be vigorously prosecuted.
In 1977 President Jimmy Carter pardoned Vietnam draft dodgers:
[H]ereby grant a full, complete and unconditional pardon to: (1) all persons who may have committed any offense between August 4, 1964 and March 28, 1973 in violation of the Military Selective Service Act or any rule or regulation promulgated thereunder; and (2) all persons heretofore convicted, irrespective of the date of conviction, of any offense committed between August 4, 1964 and March 28, 1973 in violation of the Military Selective Service Act, or any rule or regulation promulgated thereunder, restoring to them full political, civil and other rights.
If you look at the language of the orders you see they're very broad and that there are no individuals mentioned. More examples can be found here; I didn't check the language of every case.
However, it's important to realize that the President cannot pardon a state criminal offense. At the time of writing only about 82,000 people are in federal custody for "Drug Offenses", and many of them are probably not due weed-related offences.
So such a hypothetical pardon would affect several tens of thousands of people at most, rather than the hundreds of thousands of people across the nation who are currently jailed for such offences.