Escape fraction of ionizing photons from high-redshift galaxies in cosmological SPH simulations