Producers of metals, grains and other raw materials rose as the U.S. dollar gave back some of its gains and deal activity picked up in the building-materials sphere.