Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/scala/apps/CifarApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ object CifarApp {
val broadcastWeights = sc.broadcast(netWeights)
logger.log("setting weights on workers", i)
workers.foreach(_ => workerStore.get[CaffeSolver]("solver").trainNet.setWeights(broadcastWeights.value))
// avoiding a memory leak:
broadcastWeights.unpersist()
broadcastWeights.destroy()

if (i % 5 == 0) {
logger.log("testing", i)
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/apps/FeaturizerApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ object FeaturizerApp {
val broadcastWeights = sc.broadcast(netWeights)
logger.log("setting weights on workers")
workers.foreach(_ => workerStore.get[CaffeNet]("net").setWeights(broadcastWeights.value))
// avoiding a memory leak:
broadcastWeights.unpersist()
broadcastWeights.destroy()

// featurize the images
val featurizedDF = trainDF.mapPartitions( it => {
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/apps/ImageNetApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ object ImageNetApp {
val broadcastWeights = sc.broadcast(netWeights)
logger.log("setting weights on workers", i)
workers.foreach(_ => workerStore.get[CaffeSolver]("solver").trainNet.setWeights(broadcastWeights.value))
// avoiding a memory leak:
broadcastWeights.unpersist()
broadcastWeights.destroy()

if (i % 10 == 0) {
logger.log("testing", i)
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/apps/MnistApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ object MnistApp {
val broadcastWeights = sc.broadcast(netWeights)
logger.log("setting weights on workers", i)
workers.foreach(_ => workerStore.get[TensorFlowNet]("net").setWeights(broadcastWeights.value))
// avoiding a memory leak:
broadcastWeights.unpersist()
broadcastWeights.destroy()

if (i % 5 == 0) {
logger.log("testing", i)
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/apps/TFImageNetApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ object TFImageNetApp {
val broadcastWeights = sc.broadcast(netWeights)
logger.log("setting weights on workers", i)
workers.foreach(_ => workerStore.get[TensorFlowNet]("net").setWeights(broadcastWeights.value))
// avoiding a memory leak
broadcastWeights.unpersist()
broadcastWeights.destroy()

if (i % 5 == 0) {
logger.log("testing", i)
Expand Down