# Using Julia with @parallel pmap or blank makes no difference in speed.

**URL:** https://discourse.julialang.org/t/using-julia-with-parallel-pmap-or-blank-makes-no-difference-in-speed/9885
**Category:** Julia at Scale
**Created:** [March 22, 2018, 10:00am UTC](https://discourse.julialang.org/t/using-julia-with-parallel-pmap-or-blank-makes-no-difference-in-speed/9885 "2018-03-22T10:00:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Tillie](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Tillie](https://discourse.julialang.org/u/Tillie)
#### Post date: [March 22, 2018, 10:00am UTC](https://discourse.julialang.org/t/using-julia-with-parallel-pmap-or-blank-makes-no-difference-in-speed/9885/1 "2018-03-22T10:00:37Z")

</div>

Hi,

the follwoing three test examples are minmal examples of my code.

I do not understand why the speed is always the same.

Moreover, Julia seems to use only one core.

The whole CPU usage is only around 30%.

If I use the minimal example from Julia docs, this works perfectly.

I get 90-100% CPU usage.

```julia
pmap(svd, collection of some matrices)

```

Can somebody help me?

```julia
function test1(a)
    for i in 1:a
        randn(10^8)
    end
end

@everywhere function test2(a)
    @parallel for i in 1:a
        randn(10^8)
    end
end

@everywhere function test3(a)
    for i in 1:a
        randn(10^8)
    end
end

@time test1(10)

@time test2(10)

@time pmap(test3, [1, 1, 1, 1, 1, 1, 1, 1, 1, 1])

```

Kind regards,  
Till

---

<div class="post-metadata">

### Author: ![bicycle1885](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bicycle1885/32/107_2.png) [@bicycle1885](https://discourse.julialang.org/u/bicycle1885)
#### Post date: [March 22, 2018, 10:26am UTC](https://discourse.julialang.org/t/using-julia-with-parallel-pmap-or-blank-makes-no-difference-in-speed/9885/2 "2018-03-22T10:26:09Z")

</div>

How did you start up your Julia process? `julia` has the `-p` option, which is used to start multiple processes for parallel computing. For example, if you have four physical cores, you may start four Julia workers with `julia -p 4`.

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [March 22, 2018, 12:40pm UTC](https://discourse.julialang.org/t/using-julia-with-parallel-pmap-or-blank-makes-no-difference-in-speed/9885/3 "2018-03-22T12:40:55Z")

</div>

SVD is already multithreaded. It’s probably better to just use it.

---

<div class="post-metadata">

### Author: ![Tillie](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Tillie](https://discourse.julialang.org/u/Tillie)
#### Post date: [March 22, 2018, 1:08pm UTC](https://discourse.julialang.org/t/using-julia-with-parallel-pmap-or-blank-makes-no-difference-in-speed/9885/4 "2018-03-22T13:08:23Z")

</div>

Thank you for your suggestions.

The answer is:

addprocs()

function bigfunc(iterator)  
function smallfunc(huhu)  
for i in 1:3  
randn(10^8);  
end  
end  
wp = CachingPool(workers())  
pmap(wp, smallfunc, iterator)  
end

@time bigfunc(1:10)

Kind regards,  
Till
