use of com.tencent.angel.ml.matrix.psf.update.enhance.PartitionUpdateParam in project angel by Tencent.
the class CommonParam method split.
@Override
public List<PartitionUpdateParam> split() {
List<PartitionKey> parts = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId);
int size = parts.size();
List<PartitionUpdateParam> partParams = new ArrayList<PartitionUpdateParam>(size);
for (PartitionKey part : parts) {
int[] ints = Utils.intListToArray(intArray);
long[] longs = Utils.longListToArray(longArray);
float[] floats = Utils.floatListToArray(floatArray);
double[] doubles = Utils.doubleListToArray(doubleArray);
PSFPartitionUpdateParam partParam = new PSFPartitionUpdateParam(matrixId, part, ints, longs, floats, doubles);
partParams.add(partParam);
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.PartitionUpdateParam in project angel by Tencent.
the class MatrixClientAdapter method update.
/**
* Update matrix use a udf.
*
* @param updateFunc update udf function
* @return Future<VoidResult> update future result
*/
public Future<VoidResult> update(UpdateFunc updateFunc) {
MatrixTransportClient matrixClient = PSAgentContext.get().getMatrixTransportClient();
UpdateParam param = updateFunc.getParam();
List<PartitionUpdateParam> partParams = param.split();
int size = partParams.size();
UpdaterRequest request = new UpdaterRequest(param);
UpdaterResponseCache cache = new UpdaterResponseCache(size);
for (int i = 0; i < size; i++) {
cache.addResult(matrixClient.update(updateFunc, partParams.get(i)));
}
requestToResponseMap.put(request, cache);
return cache.getMergedResult();
}
Aggregations