use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class GetHyperLogLogParam method split.
@Override
public List<PartitionGetParam> split() {
MatrixMeta matrixMeta = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId);
PartitionKey[] parts = matrixMeta.getPartitionKeys();
KeyPart[] keyParts = RouterUtils.split(matrixMeta, 0, nodes);
List<PartitionGetParam> params = new ArrayList<>(parts.length);
for (int i = 0; i < parts.length; i++) {
if (keyParts[i] != null && keyParts[i].size() > 0) {
params.add(new GetHyperLogLogPartParam(matrixId, parts[i], keyParts[i], n, isDirected));
}
}
return params;
}
use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class PullPathTailParam method split.
@Override
public List<PartitionGetParam> split() {
List<PartitionKey> parts = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId);
List<PartitionGetParam> partParams = new ArrayList<PartitionGetParam>(parts.size());
for (PartitionKey part : parts) {
partParams.add(new PullPathTailPartitionParam(matrixId, part, partitionId, batchSize));
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class GetNodeAttrs method merge.
@Override
public GetResult merge(List<PartitionGetResult> partResults) {
Int2ObjectArrayMap<PartitionGetResult> partIdToResultMap = new Int2ObjectArrayMap<>(partResults.size());
for (PartitionGetResult result : partResults) {
partIdToResultMap.put(((PartGetNodeAttrsResult) result).getPartId(), result);
}
GetNodeAttrsParam param = (GetNodeAttrsParam) getParam();
long[] nodeIds = param.getNodeIds();
List<PartitionGetParam> partParams = param.getPartParams();
Long2ObjectOpenHashMap<float[]> nodeIdToAttrs = new Long2ObjectOpenHashMap<>(nodeIds.length);
for (PartitionGetParam partParam : partParams) {
int start = ((PartGetNodeAttrsParam) partParam).getStartIndex();
int end = ((PartGetNodeAttrsParam) partParam).getEndIndex();
PartGetNodeAttrsResult partResult = (PartGetNodeAttrsResult) (partIdToResultMap.get(partParam.getPartKey().getPartitionId()));
float[][] results = partResult.getNodeIdToAttrs();
for (int i = start; i < end; i++) {
nodeIdToAttrs.put(nodeIds[i], results[i - start]);
}
}
return new GetNodeAttrsResult(nodeIdToAttrs);
}
use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class GetNodeAttrsParam method split.
@Override
public List<PartitionGetParam> split() {
// Get matrix meta
MatrixMeta meta = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId);
PartitionKey[] parts = meta.getPartitionKeys();
// Split
KeyPart[] nodeIdsParts = RouterUtils.split(meta, 0, nodeIds, false);
// Generate Part psf get param
List<PartitionGetParam> partParams = new ArrayList<>(parts.length);
assert parts.length == nodeIdsParts.length;
for (int i = 0; i < parts.length; i++) {
if (nodeIdsParts[i] != null && nodeIdsParts[i].size() > 0) {
partParams.add(new GeneralPartGetParam(matrixId, parts[i], nodeIdsParts[i]));
}
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class SampleEdgeFeatParam method split.
@Override
public List<PartitionGetParam> split() {
// Get matrix meta
MatrixMeta meta = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId);
PartitionKey[] partitions = meta.getPartitionKeys();
// Split nodeIds
KeyPart[] splits = RouterUtils.split(meta, 0, nodeIds);
assert partitions.length == splits.length;
// Generate rpc params
List<PartitionGetParam> partParams = new ArrayList<>(partitions.length);
for (int i = 0; i < partitions.length; i++) {
if (splits[i] != null && splits[i].size() > 0) {
partParams.add(new PartSampleEdgeFeatParam(matrixId, partitions[i], splits[i], count));
}
}
return partParams;
}
Aggregations