File: narray.rb

package info (click to toggle)
ruby-mpi 0.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 408 kB
  • sloc: ansic: 1,500; ruby: 808; makefile: 8
file content (29 lines) | stat: -rw-r--r-- 353 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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

if rank == 0
  (world.size-1).times do |i|
    a = NArray.float(2)
    world.Recv(a, i+1, 1)
    p a
  end
else
  world.Send(NArray[1.0,2], 0, 1)
end


MPI.Finalize