psyplot / psy-simple

psy-simple: The psyplot plugin for simple visualizations
https://psyplot.github.io/psy-simple
1 stars 3 forks source link

"`<main>': uninitialized constant MPI (NameError)" in Ruby debian #19

Closed sourabhmet closed 3 years ago

sourabhmet commented 3 years ago

Code Sample, a copy-pastable example if possible

# Your code here

# Parallel computation of pi in Ruby
PI25DT = 3.141592653589793238462643
NINTERVALS = 10000

$rank = MPI::Comm::WORLD.rank()
$size = MPI::Comm::WORLD.size()
$startwtime = MPI.wtime()
$h = 1.0 / NINTERVALS
$sum = 0.0
($rank + 1).step(NINTERVALS, $size) do |i|
        x = $h * (i - 0.5)
        $sum += (4.0 / (1.0 + x**2))
end
mypi = $h * $sum

$pi = MPI::Comm::WORLD.reduce(mypi, MPI::Op::SUM, 0)

if $rank == 0 then
        printf "pi is ~= %.16f, error = %.16f\n", $pi, ($pi - PI25DT).abs
        $endwtime = MPI.wtime()
        puts "wallclock time = #{$endwtime-$startwtime}"
end

Problem description

I am trying to run ruby code, I am also importing MPI in it. but I am getting the error

Please help, It looks the problem is with MPI, how can I resolve it.

Chilipp commented 3 years ago

Dear @sourabhmet. How is this related to psy-simple?

P.S.: I am not an expert in Ruby, so maybe better ask the question on stackoverflow?

sourabhmet commented 3 years ago

Thanks @Chilipp