9
votes

While learning Julia from the manual, I wanted to see if I could get Julia to run a hard computation on all four of my CPU's cores at once. I launched Julia with this command;

julia -p 4

Then I defined the following function, just for the purpose of doing a lot of arithmetic. The mod 13 is there so that it doesn't print a huge number in the end.

@everywhere function hard_computation()         
  bigexp = BigInt(999)^99999999
  bigexp % 13
end

Then I tell Julia to do this in four separate processes.

for i in 1:4
  push!(r, remotecall(i, hard_computation))
end

When I fetched the values in r, I got [5, 6, 5, 5]. I tried it several more times, and got; 5, 5, 5, 5, 5, 1, 5, 5, 5, 2, 0, 5, 5, 5, 5, 7. The correct answer is 5.

So... what's going wrong?

System info;

  • Julia 0.2.1
  • Linux 3.5.0-17-generic (x86_64)
  • Intel Core i5-2430M
1
Using the HEAD of GitHub's master branch, I can't repeat this on my wimpy and old 32-bit 2-core laptop. All my answers (repeated 30 times) were 5. - rickhg12hs
If this is reproducible, it certainly seems like a bug. You may want to open an issue. - StefanKarpinski

1 Answers

0
votes

False alarm, everyone; turns out my RAM was corrupted.