Sha256: 64399f6fea5e111cc2a72c3af47efe23f33ff009e5b3052e27d913efa518f042

Contents?: true

Size: 387 Bytes

Versions: 1

Compression:

Stored size: 387 Bytes

Contents

require "mpi"

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

1 entries across 1 versions & 1 rubygems

Version Path
ruby-mpi-0.3.0 samples/narray_offset.rb