Search in sources :

Example 6 with Long2LongOpenHashMap

use of it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap in project angel by Tencent.

the class PushPathTail method partitionUpdate.

@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
    PushPathTailPartitionParam pparam = (PushPathTailPartitionParam) partParam;
    PartitionKey partKey = pparam.getPartKey();
    ServerLongAnyRow row = (ServerLongAnyRow) psContext.getMatrixStorageManager().getRow(pparam.getPartKey(), 0);
    Long2LongOpenHashMap pathTail = pparam.getPathTail();
    PathQueue.pushBatch(partKey.getPartitionId(), row, pathTail);
// int completeCount = 0;
// ArrayList<WalkPath> paths = new ArrayList<>(pathTail.size());
// 
// row.startWrite();
// try {
// ObjectIterator<Map.Entry<Long, Long>> iter = pathTail.entrySet().iterator();
// while (iter.hasNext()) {
// Map.Entry<Long, Long> entry = iter.next();
// long key = entry.getKey();
// long tail = entry.getValue();
// 
// WalkPath wPath = (WalkPath) row.get(key);
// wPath.add2Path(tail);
// 
// if (wPath.isComplete()) {
// completeCount += 1;
// } else {
// paths.add(wPath);
// }
// }
// } finally {
// row.endWrite();
// }
// 
// if (completeCount != 0) {
// PathQueue.progress(partKey.getPartitionId(), completeCount);
// }
// 
// if (!paths.isEmpty()) {
// PathQueue.pushBatch(partKey.getPartitionId(), paths);
// }
}
Also used : Long2LongOpenHashMap(it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap) PartitionKey(com.tencent.angel.PartitionKey) ServerLongAnyRow(com.tencent.angel.ps.storage.vector.ServerLongAnyRow)

Example 7 with Long2LongOpenHashMap

use of it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap in project angel by Tencent.

the class PushPathTailPartitionParam method deserialize.

@Override
public void deserialize(ByteBuf buf) {
    super.deserialize(buf);
    this.startIdx = 0;
    this.endIdx = buf.readInt();
    int size = endIdx - startIdx;
    // System.out.println(Thread.currentThread().getId() + "\t deserialize -> " + size);
    pathTail = new Long2LongOpenHashMap(size);
    for (int i = 0; i < size; i++) {
        long key = buf.readLong();
        long value = buf.readLong();
        pathTail.put(key, value);
    }
}
Also used : Long2LongOpenHashMap(it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap)

Aggregations

Long2LongOpenHashMap (it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap)7 PartitionKey (com.tencent.angel.PartitionKey)1 WalkPath (com.tencent.angel.graph.client.node2vec.data.WalkPath)1 ServerLongAnyRow (com.tencent.angel.ps.storage.vector.ServerLongAnyRow)1 Int2IntOpenHashMap (it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap)1 Int2ObjectArrayMap (it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap)1 Int2ObjectOpenHashMap (it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap)1 Long2LongMap (it.unimi.dsi.fastutil.longs.Long2LongMap)1 Long2ObjectOpenHashMap (it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap)1 Map (java.util.Map)1 ReentrantLock (java.util.concurrent.locks.ReentrantLock)1