use of com.tencent.angel.PartitionKey in project angel by Tencent.
the class CompIntIntVectorSplitter method split.
@Override
public Map<PartitionKey, RowUpdateSplit> split(Vector vector, List<PartitionKey> parts) {
IntIntVector[] vecParts = ((CompIntIntVector) vector).getPartitions();
assert vecParts.length == parts.size();
Map<PartitionKey, RowUpdateSplit> updateSplitMap = new HashMap<>(parts.size());
for (int i = 0; i < vecParts.length; i++) {
updateSplitMap.put(parts.get(i), new CompIntIntRowUpdateSplit(vector.getRowId(), vecParts[i], (int) (parts.get(i).getEndCol() - parts.get(i).getStartCol())));
}
return updateSplitMap;
}
use of com.tencent.angel.PartitionKey in project angel by Tencent.
the class CompLongIntVectorSplitter method split.
@Override
public Map<PartitionKey, RowUpdateSplit> split(Vector vector, List<PartitionKey> parts) {
LongIntVector[] vecParts = ((CompLongIntVector) vector).getPartitions();
assert vecParts.length == parts.size();
Map<PartitionKey, RowUpdateSplit> updateSplitMap = new HashMap<>(parts.size());
for (int i = 0; i < vecParts.length; i++) {
updateSplitMap.put(parts.get(i), new CompLongIntRowUpdateSplit(vector.getRowId(), vecParts[i]));
}
return updateSplitMap;
}
use of com.tencent.angel.PartitionKey in project angel by Tencent.
the class GetColumnParam method split.
@Override
public List<PartitionGetParam> split() {
List<PartitionKey> pkeys = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId);
List<PartitionGetParam> partParams = new ArrayList<PartitionGetParam>(pkeys.size());
for (PartitionKey entry : pkeys) {
partParams.add(new PartitionGetRowsParam(matrixId, entry, columns));
}
return partParams;
}
use of com.tencent.angel.PartitionKey in project angel by Tencent.
the class GetPartFunc method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
if (partParam instanceof PartitionGetRowsParam) {
PartitionGetRowsParam param = (PartitionGetRowsParam) partParam;
PartitionKey pkey = param.getPartKey();
pkey = psContext.getMatrixMetaManager().getMatrixMeta(pkey.getMatrixId()).getPartitionMeta(pkey.getPartitionId()).getPartitionKey();
int ws = pkey.getStartRow();
int es = pkey.getEndRow();
List<Integer> reqRows = param.getRowIndexes();
MatrixStorageManager manager = psContext.getMatrixStorageManager();
List<ServerRow> rows = new ArrayList<>();
for (int w : reqRows) rows.add(manager.getRow(pkey, w));
PartCSRResult csr = new PartCSRResult(rows);
return csr;
} else {
return null;
}
}
use of com.tencent.angel.PartitionKey in project angel by Tencent.
the class LikelihoodParam method split.
@Override
public List<PartitionGetParam> split() {
List<PartitionGetParam> params = new ArrayList<>();
List<PartitionKey> pkeys = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId);
for (PartitionKey pkey : pkeys) {
params.add(new LikelihoodPartParam(matrixId, pkey, beta));
}
return params;
}
Aggregations