-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Iainmon/no-remote-vars
Remove and reimplement remote variables to support CPU and GPU operations.
- Loading branch information
Showing
58 changed files
with
2,150 additions
and
1,535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"avg": 1.203106, "stddev": 0.008578116576498592, "times": [1.21923, 1.19135, 1.20671, 1.19214, 1.20526, 1.20393, 1.2009, 1.2122, 1.2063, 1.19304]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"avg": 1.2119130000000002, "stddev": 0.005646131507501363, "times": [1.22538, 1.21134, 1.21124, 1.20609, 1.2136, 1.21643, 1.2142, 1.20709, 1.20729, 1.20647]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"avg": 1.9952400000000001, "stddev": 0.005532747961004563, "times": [2.00349, 2.00492, 1.99984, 1.99339, 1.98599, 1.99134, 1.99441, 1.99439, 1.9928, 1.99183]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"avg": 2.000039, "stddev": 0.024113097042893505, "times": [1.99821, 2.0665, 1.9849, 1.98276, 1.98553, 1.99033, 1.99006, 2.01721, 1.99753, 1.98736]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
use Tensor; | ||
|
||
use Network; | ||
|
||
use BlockDist; | ||
|
||
import Time; | ||
|
||
config const detach = true; | ||
|
||
Tensor.detachMode(detach); | ||
|
||
type dtype = real(32); | ||
|
||
// Load an array of images. | ||
config const numImages = 1; | ||
|
||
// Create distributed domain for images. | ||
const imagesD = blockDist.createDomain({0..<numImages}); | ||
|
||
// Load distributed array of images. | ||
var images = forall i in imagesD do | ||
Tensor.load("data/datasets/mnist/image_idx_" + i:string + ".chdata") : dtype; | ||
|
||
// Create distributed domain for models. | ||
const localeModelsD = blockDist.createDomain(Locales.domain); | ||
|
||
// Load distributed array of models. | ||
var localeModels = forall li in localeModelsD do | ||
loadModel(specFile="scripts/models/cnn/specification.json", | ||
weightsFolder="scripts/models/cnn/", | ||
dtype=dtype); | ||
|
||
// Create distributed array of output results. | ||
var preds: [imagesD] int; | ||
|
||
|
||
config const numTries = 1; | ||
|
||
var totalTime: real; | ||
|
||
for i in 0..<numTries { | ||
|
||
var st = new Time.stopwatch(); | ||
st.start(); | ||
|
||
// coforall loc in Locales { | ||
// on loc { | ||
// const myAD = A.domain.localIndices(); | ||
// forall i in myAD; | ||
// } | ||
// } | ||
forall (image,pred) in zip(images,preds) { | ||
var model = localeModels[here.id].borrow(); | ||
pred = model(image).argmax(); | ||
} | ||
|
||
st.stop(); | ||
const tm = st.elapsed(); | ||
totalTime += tm; | ||
|
||
writeln("Trial ", i + 1, " of ", numTries," took ", tm, " seconds for ", numImages, " images on ", Locales.size, " nodes."); | ||
} | ||
|
||
const averageTime = totalTime / numTries; | ||
|
||
|
||
config const printResults = false; | ||
if printResults { | ||
for i in images.domain { | ||
writeln((i, preds[i])); | ||
} | ||
} | ||
|
||
writeln("The average inference time for batch of size ", numImages, " was ", averageTime, " seconds on ", Locales.size, " nodes."); | ||
writeln("The total inference time for batch of size ", numImages, " was ", totalTime, " seconds on ", Locales.size, " nodes."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// proc myWarning(param s, type t = string) { | ||
// compilerWarning(s); | ||
// } | ||
|
||
proc somethingElse(x1) { | ||
compilerWarning("idx"); | ||
} | ||
// somethingElse(1); | ||
somethingElse(true); | ||
|
||
somethingElse(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
use Reflection; | ||
|
||
|
||
proc (class).defaultInit(args...?nargs) { | ||
param numFields = getNumFields(this.type); | ||
if numFields != nargs then compilerError("Fields must match args"); | ||
|
||
for param i in 0..<numFields { | ||
getField(this, i) = args(i); | ||
} | ||
} | ||
|
||
|
||
|
||
class C { | ||
var x: int; | ||
var y: bool; | ||
|
||
proc init() { | ||
this.defaultInit(1,true); | ||
} | ||
} | ||
|
||
var c = new owned C(); | ||
writeln(c); |
Oops, something went wrong.