parallel SGD implementation