use of it.unimi.dsi.fastutil.ints.IntOpenHashSet in project gradle by gradle.
the class ClassDependenciesVisitor method analyze.
public static ClassAnalysis analyze(String className, ClassReader reader) {
IntSet constants = new IntOpenHashSet(2);
Set<String> classDependencies = Sets.newHashSet();
ClassDependenciesVisitor visitor = new ClassDependenciesVisitor(constants, classDependencies, new ClassRelevancyFilter(className), reader);
reader.accept(visitor, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
return new ClassAnalysis(className, classDependencies, visitor.isDependencyToAll(), constants, visitor.getSuperTypes());
}
use of it.unimi.dsi.fastutil.ints.IntOpenHashSet in project gradle by gradle.
the class JarSnapshot method getRelevantConstants.
public IntSet getRelevantConstants(JarSnapshot other, Set<String> affectedClasses) {
IntSet result = new IntOpenHashSet();
for (String affectedClass : affectedClasses) {
IntSet difference = new IntOpenHashSet(other.getData().data.getConstants(affectedClass));
difference.removeAll(data.data.getConstants(affectedClass));
result.addAll(difference);
}
return result;
}
use of it.unimi.dsi.fastutil.ints.IntOpenHashSet in project gradle by gradle.
the class PreviousCompilation method getDependents.
public DependentsSet getDependents(String className, IntSet newConstants) {
IntSet constants = new IntOpenHashSet(analysis.getData().getConstants(className));
constants.removeAll(newConstants);
return analysis.getRelevantDependents(className, constants);
}
use of it.unimi.dsi.fastutil.ints.IntOpenHashSet in project angel by Tencent.
the class MatrixClientAdapter method findNewRows.
private RowIndex findNewRows(RowIndex rowIndex) {
IntOpenHashSet need = new IntOpenHashSet();
IntOpenHashSet fetchingRowIds = fetchingRowSets.get(rowIndex.getMatrixId());
IntIterator iter = rowIndex.getRowIds().iterator();
while (iter.hasNext()) {
int rowId = iter.nextInt();
if (!fetchingRowIds.contains(rowId)) {
need.add(rowId);
fetchingRowIds.add(rowId);
}
}
return new RowIndex(rowIndex.getMatrixId(), need, rowIndex);
}
use of it.unimi.dsi.fastutil.ints.IntOpenHashSet in project angel by Tencent.
the class ConsistencyController method getRowsFlow.
/**
* Get a batch of row from storage/cache or pss.
*
* @param taskContext task context
* @param rowIndex row indexes
* @param rpcBatchSize fetch row number in one rpc request
* @return GetRowsResult rows
* @throws Exception
*/
public GetRowsResult getRowsFlow(TaskContext taskContext, RowIndex rowIndex, int rpcBatchSize) throws Exception {
GetRowsResult result = new GetRowsResult();
if (rowIndex.getRowsNumber() == 0) {
LOG.error("need get rowId set is empty, just return");
result.fetchOver();
return result;
}
int staleness = getStaleness(rowIndex.getMatrixId());
if (staleness >= 0) {
// For BSP/SSP, get rows from storage/cache first
int stalnessClock = taskContext.getMatrixClock(rowIndex.getMatrixId()) - staleness;
findRowsInStorage(taskContext, result, rowIndex, stalnessClock);
if (!result.isFetchOver()) {
LOG.debug("need fetch from parameterserver");
// Get from ps.
PSAgentContext.get().getMatrixClientAdapter().getRowsFlow(result, rowIndex, rpcBatchSize, stalnessClock);
}
return result;
} else {
// For ASYNC, just get rows from pss.
IntOpenHashSet rowIdSet = rowIndex.getRowIds();
List<Integer> rowIndexes = new ArrayList<Integer>(rowIdSet.size());
rowIndexes.addAll(rowIdSet);
GetRowsFunc func = new GetRowsFunc(new GetRowsParam(rowIndex.getMatrixId(), rowIndexes));
com.tencent.angel.ml.matrix.psf.get.multi.GetRowsResult funcResult = ((com.tencent.angel.ml.matrix.psf.get.multi.GetRowsResult) PSAgentContext.get().getMatrixClientAdapter().get(func));
if (funcResult.getResponseType() == ResponseType.FAILED) {
throw new IOException("get rows from ps failed.");
} else {
Map<Integer, TVector> rows = funcResult.getRows();
for (Entry<Integer, TVector> rowEntry : rows.entrySet()) {
result.put(rowEntry.getValue());
}
result.fetchOver();
return result;
}
}
}
Aggregations