created custom function for each gpu iteration