Hello, I am new to Julia and I found this code snippet online, were somebody calculated the fibonacci number with and without parallelism. I was wondering about this magic n < 40 statement were the person decides, if he uses the parallel implementation or the standard one. Is there a way without stepwise incrementing n to actually get the best value for situations like this?
I am a newby at parallel programming and I try to understand, when the usage of @parallel , @spawn and pmap becomes useful and which function calls are to small to calculate distributed.
@everywhere function parallel_fib_first(n) if(**n < 40**) fib(n) end x = @spawn parallel_fib_first(n - 1) y = parallel_fib_first(n - 2) fetch(x) + y end
I hope you can help me to get a deeper understandig of julia and parallel programming