November 2017
Beginner
316 pages
6h 40m
English
Consider a function fib, which is a very basic function that prints out a Fibonacci number:
julia> function fib(n)
if n <= 1
return 1
else
return fib(n-1) + fib(n-2)
end
end
fib (generic function with 1 method)
# small test
julia> fib(10)
89
Fairly simple! Next up, we check the number of active processes available in our current Julia REPL:
julia> workers()
2-element Array{Int64,1}:
3
4
So we see that two processes are available apart from the main process ID (which is 1). We then try to run the fib function over these available processes as well. Wondering how we would do that? Well, again, it's simple. Just use the @everywhere macro, which does the job of running an operation over every single process available ...
Read now
Unlock full access