# Why does my parallel code behave the same as serial code？

**URL:** <https://discourse.haskell.org/t/why-does-my-parallel-code-behave-the-same-as-serial-code/4810>\
**Category:** Learn\
**Created:** [July 21, 2022, 2:55am UTC](https://discourse.haskell.org/t/why-does-my-parallel-code-behave-the-same-as-serial-code/4810 "2022-07-21T02:55:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wujilingfeng](https://avatars.discourse-cdn.com/v4/letter/w/278dde/32.png) [@wujilingfeng](https://discourse.haskell.org/u/wujilingfeng)\
**Post date:** [July 21, 2022, 2:55am UTC](https://discourse.haskell.org/t/why-does-my-parallel-code-behave-the-same-as-serial-code/4810/1 "2022-07-21T02:55:55Z")

</div>

Bellow is my code

```haskell
someFunc :: IO ()
someFunc = --print $ resultPar
    print$ runEval $ (do
        fib44<- rpar (force $fib 44) 
        fib45<- rpar (force $fib 45)
        fib46<- rpar (force $fib 46)
        fib47<- rpar (force$ fib 47)
        -- rseq fib44

        -- rseq fib45
        -- rseq fib46
        rseq fib47
        return [fib44,fib45,fib46,fib47]
    ) 

    where
        resultPlain=[fib 44,fib 45,fib 46 ,fib 47]
        resultPar= parMap rpar (force.fib) [44, 45, 46 , 47]
        resultSeq= parMap rseq (force.fib) [44, 45, 46 , 47]

```

I have add `-O2 -threaded` to the cabal file, and I run this program with command `cabal v2-run +RTS -N4`.  
No matter how I modify the code, it is always as slow as running line by line.  
Because I have run these code line by line.

---

<div class="post-metadata">

**Author:** ![wujilingfeng](https://avatars.discourse-cdn.com/v4/letter/w/278dde/32.png) [@wujilingfeng](https://discourse.haskell.org/u/wujilingfeng)\
**Post date:** [July 21, 2022, 7:07am UTC](https://discourse.haskell.org/t/why-does-my-parallel-code-behave-the-same-as-serial-code/4810/2 "2022-07-21T07:07:06Z")

</div>

I found the problem. The parameters`+RTS -N4`· of this command `cabal run +RTS -N4` did not work. So how to pass parameters `+RTS -N4` to cabal?

---

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [July 21, 2022, 7:14am UTC](https://discourse.haskell.org/t/why-does-my-parallel-code-behave-the-same-as-serial-code/4810/3 "2022-07-21T07:14:47Z")

</div>

You need to do:

```haskell
cabal run my-program -- +RTS -N4

```

---

<div class="post-metadata">

**Author:** ![wujilingfeng](https://avatars.discourse-cdn.com/v4/letter/w/278dde/32.png) [@wujilingfeng](https://discourse.haskell.org/u/wujilingfeng)\
**Post date:** [July 21, 2022, 7:19am UTC](https://discourse.haskell.org/t/why-does-my-parallel-code-behave-the-same-as-serial-code/4810/4 "2022-07-21T07:19:27Z")

</div>

Wow, it works! Thanks !  
😃
