Optimal implementation of quantum channels on noisy hardware