Sha256: 6e6db895c9acad10986f6f5572a1e3407544aff28e87a27fbc5d8bb301f6b063

Contents?: true

Size: 434 Bytes

Versions: 3

Compression:

Stored size: 434 Bytes

Contents

require "mpi"
if defined?(NumRu::NArray)
  include NumRu
end

MPI.Init


world = MPI::Comm::WORLD

if world.size == 1
  print "Size is one, so do nothing\n"
  exit
end

rank = world.rank
size = world.size

length = 2
if rank == 0
  a = NArray.float(length,size-1)
  (size-1).times do |i|
    world.Recv(a, i+1, 1, length, i*length)
  end
  p a
else
  a = NArray.float(length).indgen + rank*10
  world.Send(a, 0, 1)
end


MPI.Finalize

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-mpi-0.4.0 samples/narray_offset.rb
ruby-mpi-0.3.2 samples/narray_offset.rb
ruby-mpi-0.3.1 samples/narray_offset.rb