use of com.tencent.angel.PartitionKey in project angel by Tencent.
the class UpdatePartFunc method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
CSRPartUpdateParam param = (CSRPartUpdateParam) partParam;
PartitionKey pkey = partParam.getPartKey();
pkey = psContext.getMatrixMetaManager().getMatrixMeta(pkey.getMatrixId()).getPartitionMeta(pkey.getPartitionId()).getPartitionKey();
while (param.buf.isReadable()) {
int row = param.buf.readInt();
int len = param.buf.readShort();
ServerRow serverRow = psContext.getMatrixStorageManager().getRow(pkey, row);
serverRow.getLock().writeLock().lock();
ServerDenseIntRow denseIntRow = (ServerDenseIntRow) serverRow;
IntBuffer buffer = denseIntRow.getData();
for (int i = 0; i < len; i++) {
short key = param.buf.readShort();
int val = param.buf.readInt();
buffer.put(key, buffer.get(key) + val);
}
serverRow.getLock().writeLock().unlock();
}
param.buf.release();
}
use of com.tencent.angel.PartitionKey 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.PartitionKey in project angel by Tencent.
the class UnaryAggrParam 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) {
partParams.add(new UnaryPartitionAggrParam(matrixId, part, rowId));
}
return partParams;
}
use of com.tencent.angel.PartitionKey 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.PartitionKey in project angel by Tencent.
the class MFUpdateParam method split.
@Override
public List<PartitionUpdateParam> split() {
List<PartitionKey> partList = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId);
int size = partList.size();
List<PartitionUpdateParam> partParams = new ArrayList<PartitionUpdateParam>(size);
for (PartitionKey part : partList) {
if (Utils.withinPart(part, rowIds)) {
partParams.add(new MFPartitionUpdateParam(matrixId, part, rowIds, func));
}
}
if (partParams.isEmpty()) {
System.out.println("Rows must in same partition.");
}
return partParams;
}
Aggregations