Removed code duplication for GPU kernel invocation