Skip to content

Commit

Permalink
Serializing a small computation to trade-off space for time.
Browse files Browse the repository at this point in the history
Also updating sbt script.
  • Loading branch information
Pankaj Gupta committed Nov 4, 2015
1 parent 91c5c5a commit db87d55
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,18 +227,14 @@ object SharedArrayBasedDirectedGraph {
}
shardsInfo foreach { shardInfo =>
shardInfo.idsMapped = new Array[Int](shardInfo.numIdsMapped)
shardInfo.nextFreeEdgeIndex.set(0) //reusing a variable
shardInfo.numIdsMapped = 0 //reusing this variable
}
val futures = nodeCollection.iterator.grouped(1 + numNodes / parallelismLimit).toSeq map { ids =>
futurePool {
var shard: PerShardInfo = shardsInfo(0)
ids foreach { id =>
shard = shardsInfo(EdgeShards.hash(id))
shard.idsMapped(shard.nextFreeEdgeIndex.getAndIncrement()) = id
}
}
// fill out the array per shard by binning nodeCollection's ids into each shard
nodeCollection foreach { id =>
val shard = shardsInfo(EdgeShards.hash(id))
shard.idsMapped(shard.numIdsMapped) = id
shard.numIdsMapped += 1
}
Future.join(futures)
}

// do function f(shardNum, id, idIndex) for all nodes, divided into EdgeShards.numShards futures
Expand Down Expand Up @@ -327,8 +323,8 @@ object SharedArrayBasedDirectedGraph {

// main set of steps to build incoming edges in the graph
log.info("Now building the reverse direction representation")
partitionNodeIdsPerShard()
for {
_ <- partitionNodeIdsPerShard()
_ <- findInEdgesSizes()
_ <- findInShardSizes()
sharedInEdges = instantiateSharedArray(reverseShardsInfo)
Expand Down
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import xerial.sbt.Sonatype._

object Cassovary extends Build {

val CassovaryLibraryVersion = "6.3.0"
val CassovaryLibraryVersion = "6.3.1"

val utilVersion = "6.28.0"
val fastUtilsDependency = "it.unimi.dsi" % "fastutil" % "7.0.7"
Expand Down
14 changes: 9 additions & 5 deletions sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ root=$(
/bin/pwd
)

sbtjar=sbt-launch.jar
sbtver=0.13.9
SBTURL=http://dl.bintray.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/$sbtver/$sbtjar

rawsbtjar=sbt-launch.jar
sbtdir=$HOME/.sbt/launchers/$sbtver
sbtjar=$sbtdir/$rawsbtjar
SBTURL=http://dl.bintray.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/$sbtver/$rawsbtjar
JARMD5=767d963ed266459aa8bf32184599786d

if [ ! -f $sbtjar ]; then
echo "downloading $sbtjar" 1>&2
echo "downloading $rawsbtjar" 1>&2
curl --location --remote-name $SBTURL
echo "copying to $HOME/.sbt/launchers/$sbtver/$sbtjar"
cp $sbtjar $HOME/.sbt/launchers/$sbtver/
echo "copying to $sbtdir "
mkdir -p $sbtdir
cp $rawsbtjar $sbtdir
fi

test -f $sbtjar || exit 1
Expand Down

0 comments on commit db87d55

Please sign in to comment.