Search in sources :

Example 26 with IntOpenHashSet

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());
}
Also used : IntOpenHashSet(it.unimi.dsi.fastutil.ints.IntOpenHashSet) IntSet(it.unimi.dsi.fastutil.ints.IntSet) ClassAnalysis(org.gradle.api.internal.tasks.compile.incremental.deps.ClassAnalysis)

Example 27 with IntOpenHashSet

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;
}
Also used : IntOpenHashSet(it.unimi.dsi.fastutil.ints.IntOpenHashSet) IntSet(it.unimi.dsi.fastutil.ints.IntSet)

Example 28 with IntOpenHashSet

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);
}
Also used : IntOpenHashSet(it.unimi.dsi.fastutil.ints.IntOpenHashSet) IntSet(it.unimi.dsi.fastutil.ints.IntSet)

Example 29 with IntOpenHashSet

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);
}
Also used : IntOpenHashSet(it.unimi.dsi.fastutil.ints.IntOpenHashSet) IntIterator(it.unimi.dsi.fastutil.ints.IntIterator)

Example 30 with IntOpenHashSet

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;
        }
    }
}
Also used : GetRowsResult(com.tencent.angel.psagent.matrix.transport.adapter.GetRowsResult) ArrayList(java.util.ArrayList) IOException(java.io.IOException) IntOpenHashSet(it.unimi.dsi.fastutil.ints.IntOpenHashSet) GetRowsParam(com.tencent.angel.ml.matrix.psf.get.multi.GetRowsParam) GetRowsFunc(com.tencent.angel.ml.matrix.psf.get.multi.GetRowsFunc) TVector(com.tencent.angel.ml.math.TVector)

Aggregations

IntOpenHashSet (it.unimi.dsi.fastutil.ints.IntOpenHashSet)32 IntSet (it.unimi.dsi.fastutil.ints.IntSet)11 IntIterator (it.unimi.dsi.fastutil.ints.IntIterator)4 PartitionKey (com.tencent.angel.PartitionKey)3 ArrayList (java.util.ArrayList)3 Random (java.util.Random)3 Supplier (com.google.common.base.Supplier)2 FieldSpec (com.linkedin.pinot.common.data.FieldSpec)2 IntArrayList (it.unimi.dsi.fastutil.ints.IntArrayList)2 IAE (org.apache.druid.java.util.common.IAE)2 BitmapBackedSelection (tech.tablesaw.selection.BitmapBackedSelection)2 Selection (tech.tablesaw.selection.Selection)2 JsonCreator (com.fasterxml.jackson.annotation.JsonCreator)1 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)1 JsonInclude (com.fasterxml.jackson.annotation.JsonInclude)1 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Joiner (com.google.common.base.Joiner)1 Preconditions (com.google.common.base.Preconditions)1 Predicate (com.google.common.base.Predicate)1