BGD allreduce interface code