# Running on a single cpu core?

**URL:** <https://pyfr.discourse.group/t/running-on-a-single-cpu-core/113>\
**Category:** Just Starting\
**Created:** [27 July 2016 05:55 UTC](https://pyfr.discourse.group/t/running-on-a-single-cpu-core/113 "2016-07-27T05:55:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arif\_Andira](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@Arif\_Andira](https://pyfr.discourse.group/u/Arif_Andira)\
**Post date:** [27 July 2016 05:55 UTC](https://pyfr.discourse.group/t/running-on-a-single-cpu-core/113/1 "2016-07-27T05:55:23Z")

</div>

First I want to say thank you for all of you who have developed this next generation CFD. I’m interesting with PyFR and I use it now for my internship program.

I have installed PyFR with OpenMP and CUDA Backend but i got this error:

`pyfr run -p euler_vortex_2d.pyfrm euler_vortex_2d.ini`

```auto
usage: pyfr run [-h] --backend {cuda,mic,opencl,openmp} [--progress] mesh cfg
pyfr run: error: the following arguments are required: --backend/-b

```

But when I type `pyfr run -b openmp -p euler_vortex2d.pyfrm euler_vortex_2d.ini`, PyFR works.

What’s wrong with this case?

Also I want to ask the meaning of serial and parallel in PyFR. Does the serial mean PyFR will run in a single CPU with its all core and parallel mean it runs in multi CPU? Can i just run in single core?

Btw, sorry for my dumb question. I’m a newbie in CFD, thank you 🙂

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [27 July 2016 18:06 UTC](https://pyfr.discourse.group/t/running-on-a-single-cpu-core/113/2 "2016-07-27T18:06:45Z")

</div>

Hi,

> What's wrong with this case?

Whenever you run PyFR you need to tell it what backend it should use.  
This is why when you do not specify a backend with -b you get an error.

> Also i want to ask the meaning of serial and parallel in PyFR. Does the  
> serial mean PyFR will run in a single CPU with its all core and parallel  
> mean it runs in multi CPU? Can i just run in single core?

Within the context of the OpenMP backend the configuration option:

```auto
[backend-openmp]
cblas-type = <serial or parallel>

```

determine who is responsible for parallelising BLAS calls over multiple  
threads. If the cblas-type is parallel (the default) then we leave it  
up to the BLAS library to determine how to break up the matrix  
multiplication operators. Otherwise, if it is serial then PyFR will  
take care of this. In both cases it is expected that the multiplication  
itself will be done in parallel. The only difference is who is  
responsible for taking care of this. Which value you want depends on  
your choice of BLAS library.

If you want to run PyFR on just a single core you should do:

`$ export OMP\_NUM\_THREADS=1`

although performance will, of course, suffer.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Arif\_Andira](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@Arif\_Andira](https://pyfr.discourse.group/u/Arif_Andira)\
**Post date:** [28 July 2016 01:52 UTC](https://pyfr.discourse.group/t/running-on-a-single-cpu-core/113/3 "2016-07-28T01:52:51Z")

</div>

Hi Freddie, thanks a lot for your answer

I have run Coutte Flow 2D with 3 calculation mode and it gives an unique result.

Case 1 : Run with all core in CPU ( 8 cores in 1 processor )

`pyfr run -b openmp -p coutte_flow_2d.pyfrm coutte_flow_2d.ini`

Calculation time : 00:08:40

Case 2 : Run with 1 core in CPU with CUDA Backend  
`pyfr run -b cuda -p couttle_flow_2d.pyfrm coutte_flow_2d.ini`

Calculation time : 00.05.57

Last, i’ve done your suggestion to do  
`$ export OMP_NUM_THREADS=1` to run the case in single core

Case 3 : `$ export OMP_NUM_THREADS=1`  
`pyfr run -b openmp -p coutte_flow_2d.pyfrm coutte_flow_2d.ini`

Calculation time : 00:04:24

Is it weird? The single core processing led to fastest calculation time. Is there a need to match the case with the backend? I mean some simple cases maybe are suitable with low hardware configuration while more complex cases are fit with high performance hardware configuration. Is it true?

Second question, how can i run PyFR in 1 CPU ( Intel Core i7) with all its cores ( 8 cores ) + 1 GPU ( Nvidia GeForce GTX460). What command do i have to write? Assume i have installed OpenMP,OpenCL,and CUDA Backend.

Thank you for giving attention to my questions, Freddie and all PyFR Developers.

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [29 July 2016 14:17 UTC](https://pyfr.discourse.group/t/running-on-a-single-cpu-core/113/4 "2016-07-29T14:17:53Z")

</div>

Hi,

> Is it weird? The single core processing led to fastest calculation time.  
> Is there a need to match the case with the backend? I mean some simple  
> cases maybe are suitable with low hardware configuration while more  
> complex cases are fit with high performance hardware configuration. Is  
> it true?

The Couette flow test case is somewhat pathological on account of it  
having relatively few elements. The run time is hence dominated by  
overheads as opposed to actual computation.

If you wish to compare and contrast the performance of various platforms  
you should look towards one of the larger three dimensional cases with a  
few thousand elements.

Regards, Freddie.
