use of com.tencent.angel.ml.matrix.MatrixMeta in project angel by Tencent.
the class IntKeysGetParam 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.MatrixMeta in project angel by Tencent.
the class SampleNodeFeatParam method split.
@Override
public List<PartitionGetParam> split() {
// Get matrix meta
MatrixMeta meta = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId);
PartitionKey[] partitions = meta.getPartitionKeys();
// sample (count / partNum + 1) in every partition randomly
int eachSize = count / partitions.length + 1;
// Generate rpc params
List<PartitionGetParam> partParams = new ArrayList<>(partitions.length);
for (int i = 0; i < partitions.length; i++) {
partParams.add(new PartSampleNodeFeatParam(matrixId, partitions[i], eachSize));
}
return partParams;
}
use of com.tencent.angel.ml.matrix.MatrixMeta 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;
}
use of com.tencent.angel.ml.matrix.MatrixMeta 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.MatrixMeta in project angel by Tencent.
the class GetNodesParam method split.
@Override
public List<PartitionGetParam> split() {
// Get matrix meta
MatrixMeta meta = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId);
PartitionKey[] partitions = meta.getPartitionKeys();
isHash = meta.isHash();
List<PartitionGetParam> params = new ArrayList<>();
Map<Integer, PartitionKey> pkeys = new HashMap<>();
for (PartitionKey pkey : partitions) {
pkeys.put(pkey.getPartitionId(), pkey);
}
for (int i = 0; i < partitionIds.length; i++) {
params.add(new PartGetNodesParam(matrixId, pkeys.get(partitionIds[i]), isHash));
}
return params;
}
Aggregations