Ab initio calculations of magnetotransport for magnetic multilayers