use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class ArrayAggrParam method split.
@Override
public List<PartitionGetParam> split() {
List<PartitionKey> parts = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId);
int size = parts.size();
List<PartitionGetParam> partParams = new ArrayList<PartitionGetParam>(size);
for (PartitionKey part : parts) {
if (Utils.withinPart(part, new int[] { rowId })) {
long startCol = part.getStartCol();
long endCol = part.getEndCol();
ArrayList<Long> partCols = new ArrayList<>();
for (long col : this.cols) {
if (col >= startCol && col < endCol) {
partCols.add(col);
}
}
if (partCols.size() > 0) {
partParams.add(new ArrayPartitionAggrParam(matrixId, part, rowId, Utils.longListToArray(partCols)));
}
}
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class SampleNeighborWithFilterParam method split.
@Override
public List<PartitionGetParam> split() {
// Get matrix meta
MatrixMeta meta = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId);
PartitionKey[] partitions = meta.getPartitionKeys();
// Split nodeIds
KeyValuePart[] splits = RouterUtils.split(meta, 0, nodeIds, filterWithNeighKeys);
assert partitions.length == splits.length;
// Generate node ids
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 PartSampleNeighborWithFilterParam(matrixId, partitions[i], count, sampleType, splits[i], filterWithoutNeighKeys));
}
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class SampleNeighborWithTypeParam 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 node ids
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 PartSampleNeighborWithTypeParam(matrixId, partitions[i], splits[i], count, sampleType));
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class SampleNeighborParam 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 PartSampleNeighborParam(matrixId, partitions[i], splits[i], count));
}
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.get.base.PartitionGetParam in project angel by Tencent.
the class GetParamWithKeyIds method split.
@Override
public List<PartitionGetParam> split() {
List<PartitionKey> parts = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId);
int size = parts.size();
List<PartitionGetParam> partParams = new ArrayList<>(size);
int nodeIndex = 0;
for (PartitionKey part : parts) {
// include start
int start = nodeIndex;
while (nodeIndex < keyIds.length && keyIds[nodeIndex] < part.getEndCol()) {
nodeIndex++;
}
// exclude end
int end = nodeIndex;
if (end - start > 0) {
partParams.add(getPartitionParam(part, start, end));
}
}
return partParams;
}
Aggregations