The Density Functional Theory has been used to analyze an inter-granular segregation of Cu and Mg. The stability of Cu and Mg atoms in the aluminum matrix, intermetallic phases and symmetric twist grain boundaries has been compared. The quantitative description of solubility of Cu and Mg atoms in the nano-crystalline aluminum has been proposed. The calculations have been carried out to investigate the properties of symmetric twist boundaries in aluminum with and without Cu/Mg atoms. The phenomena of are discussed and its effect on the stability of precipitates containing these elements.