Skip to content

Commit

Permalink
added little test
Browse files Browse the repository at this point in the history
  • Loading branch information
clementfarabet committed Jan 23, 2012
1 parent 9cc19d3 commit cbfdad8
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test.lua
@@ -0,0 +1,31 @@

require 'lab'
require 'allreduce'

torch.setdefaulttensortype('torch.FloatTensor')

if #arg == 0 then
error('please provide job number')
end

jobid = tonumber(arg[1])
jobtotal = tonumber(arg[2] or 1)

if jobid == 1 then
x = lab.zeros(10)
else
x = lab.ones(10)
end

allreduce.init('localhost', jobid, jobtotal)

print('job ' .. jobid .. ' - sending vector:')
print(x)

-- 3 different reduce types:
allreduce.average(x)
--red = allreduce.accumulate(x)
--red = allreduce.best(x, score)

print('job ' .. jobid .. ' - reduced vector is:')
print(x)

0 comments on commit cbfdad8

Please sign in to comment.