# How to use a single-threaded scheduler

**URL:** <https://www.ruby-forum.com/t/how-to-use-a-single-threaded-scheduler/240171>\
**Category:** GNU Radio\
**Created:** [March 31, 2014, 6:36pm UTC](https://www.ruby-forum.com/t/how-to-use-a-single-threaded-scheduler/240171 "2014-03-31T18:36:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [March 31, 2014, 6:36pm UTC](https://www.ruby-forum.com/t/how-to-use-a-single-threaded-scheduler/240171/1 "2014-03-31T18:36:38Z")

</div>

* * *

Discuss-gnuradio mailing list  
removed\_email\_address@domain.invalid  
[https://lists.gnu.org/mailman/listinfo/discuss-gnuradio](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

---

<div class="post-metadata">

**Author:** ![Tommy\_TSII](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e56c9b/32.png) [@Tommy\_TSII](https://www.ruby-forum.com/u/Tommy_TSII)\
**Post date:** [March 31, 2014, 6:50pm UTC](https://www.ruby-forum.com/t/how-to-use-a-single-threaded-scheduler/240171/2 "2014-03-31T18:50:40Z")

</div>

On older gnuradio releases there was an environment variable to set so  
that it will switch to single threaded scheduler. Cannot remember the  
name, though.

Bogdan

On Monday, March 31, 2014 7:35 PM, Tommy T. II [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

Dear list,

Is there any way to use the single-threaded scheduler over the  
thread-per-block scheduler without rebuilding Gnu Radio?

Sincerely,

Tommy James Tracy II  
Ph.D Student  
High Performance Low Power Lab  
University of Virginia  
Phone: 913-775-2241

---

<div class="post-metadata">

**Author:** ![Tommy\_TSII](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e56c9b/32.png) [@Tommy\_TSII](https://www.ruby-forum.com/u/Tommy_TSII)\
**Post date:** [March 31, 2014, 7:16pm UTC](https://www.ruby-forum.com/t/how-to-use-a-single-threaded-scheduler/240171/3 "2014-03-31T19:16:57Z")

</div>

* * *

Discuss-gnuradio mailing list  
removed\_email\_address@domain.invalid  
[https://lists.gnu.org/mailman/listinfo/discuss-gnuradio](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

---

<div class="post-metadata">

**Author:** ![Tommy\_TSII](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e56c9b/32.png) [@Tommy\_TSII](https://www.ruby-forum.com/u/Tommy_TSII)\
**Post date:** [March 31, 2014, 9:33pm UTC](https://www.ruby-forum.com/t/how-to-use-a-single-threaded-scheduler/240171/4 "2014-03-31T21:33:11Z")

</div>

Interesting results at least for situations when the queue is  
before/after FFT. It is like the queue is starving the FFT. You could  
try to see what is the actual data that the scheduler passes to the FFT  
and the other blocks in each cases. From my experience, the smaller the  
chunks are the slower the flowgraph is (I guess an obvious discovery 🙂  
)

Bogdan

On Monday, March 31, 2014 10:07 PM, Marcus M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

That environment variable is “GR\_SCHEDULER”:

> git grep getenv  
> …  
> gnuradio-runtime/lib/top\_block\_impl.cc:char \*v = getenv(“GR\_SCHEDULER”);  
> …

and you need to set it to “STS”:

export GR\_SCHEDULER=STS  
./my\_gr\_flowgraph.py

Greetings,  
Marcus

On 31.03.2014 18:49, Bogdan D. wrote:

> On Monday, March 31, 2014 7:35 PM, Tommy T. II  
> University of Virginia Phone: 913-775-2241

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1  
Comment: Using GnuPG with Thunderbird - [http://www.enigmail.net/](http://www.enigmail.net/)

iQEcBAEBAgAGBQJTObyIAAoJEBQ6EdjyzlHt/xMIAJ2i7VuA1p/u4o5zrChBWWzw  
PHRplQArGVZKev1B1zSjlUI8l7q3RnMhzNJmp05auDNRM5GwsBreJ/4S8I8LZhHP  
krILWrj+bPZ2QPjSy30iomIP/u7NoWZpOFXQWxt+egVd7WpEDyQVFEeN/5El22p9  
iD3prgkSHAZ2YjSpPphxcGH251PSQPj5in3x0woE191AddaREXxbjx2YieZ6xupQ  
k5tQuEkUU+HqpzAfhbNVTumNFHQrx4BRGXS4UYzpqFLCLWAGHsvg4xfm98MGhOBi  
3zjXYTf1pkciivKcZDQHCci8/7kDWuDc1b/ngUCB1xsF795QdgP/lOYRD+6IJBQ=  
=y96K  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Tommy\_TSII](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e56c9b/32.png) [@Tommy\_TSII](https://www.ruby-forum.com/u/Tommy_TSII)\
**Post date:** [March 31, 2014, 9:06pm UTC](https://www.ruby-forum.com/t/how-to-use-a-single-threaded-scheduler/240171/5 "2014-03-31T21:06:53Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

That environment variable is “GR\_SCHEDULER”:

> git grep getenv  
> …  
> gnuradio-runtime/lib/top\_block\_impl.cc:char \*v = getenv(“GR\_SCHEDULER”);  
> …

and you need to set it to “STS”:

export GR\_SCHEDULER=STS  
./my\_gr\_flowgraph.py

Greetings,  
Marcus

On 31.03.2014 18:49, Bogdan D. wrote:

> On Monday, March 31, 2014 7:35 PM, Tommy T. II  
> University of Virginia Phone: 913-775-2241

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1  
Comment: Using GnuPG with Thunderbird - [http://www.enigmail.net/](http://www.enigmail.net/)

iQEcBAEBAgAGBQJTObyIAAoJEBQ6EdjyzlHt/xMIAJ2i7VuA1p/u4o5zrChBWWzw  
PHRplQArGVZKev1B1zSjlUI8l7q3RnMhzNJmp05auDNRM5GwsBreJ/4S8I8LZhHP  
krILWrj+bPZ2QPjSy30iomIP/u7NoWZpOFXQWxt+egVd7WpEDyQVFEeN/5El22p9  
iD3prgkSHAZ2YjSpPphxcGH251PSQPj5in3x0woE191AddaREXxbjx2YieZ6xupQ  
k5tQuEkUU+HqpzAfhbNVTumNFHQrx4BRGXS4UYzpqFLCLWAGHsvg4xfm98MGhOBi  
3zjXYTf1pkciivKcZDQHCci8/7kDWuDc1b/ngUCB1xsF795QdgP/lOYRD+6IJBQ=  
=y96K  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Tommy\_TSII](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e56c9b/32.png) [@Tommy\_TSII](https://www.ruby-forum.com/u/Tommy_TSII)\
**Post date:** [April 1, 2014, 9:43am UTC](https://www.ruby-forum.com/t/how-to-use-a-single-threaded-scheduler/240171/6 "2014-04-01T09:43:24Z")

</div>

On 03/31/2014 09:05 PM, Marcus M. wrote:

> ./my\_gr\_flowgraph.py  
> Please note that the STS hasn’t been touched in a while, whereas the TPB  
> scheduler has had significant changes. Tags, in particular, won’t work  
> with the STS.

M

---

<div class="post-metadata">

**Author:** ![Tommy\_TSII](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e56c9b/32.png) [@Tommy\_TSII](https://www.ruby-forum.com/u/Tommy_TSII)\
**Post date:** [June 10, 2014, 11:40am UTC](https://www.ruby-forum.com/t/how-to-use-a-single-threaded-scheduler/240171/7 "2014-06-10T11:40:18Z")

</div>

Hi!

--------------------\> RetardoSat:  
1.Come three samples (method work)

- X: X position of receiver.
- Y: Y position of receiver.
- Z: Z position of receiver.
- ClK: seconds.

1. With Kepler paremeters calculates the satellite position, the  
distance between the satellite and the receiver and the signal delay.

2. Send to the output (t) the calculated delay.

float _out = (float_)output\_items[0];  
const float \*inx = (const float \*) input\_items[0];  
const float \*iny = (const float \*) input\_items[1];  
const float \*inz = (const float \*) input\_items[2];  
const float \*inTOW = (const float \*) input\_items[3];

```
     for(int i=0;i<noutput_items;++i){
         ...
         ...

```

}

--------------------\> Reloj:

\*Precision = tiempo inicial  
\*\*Tasa = sample rate

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

namespace gr {  
namespace howto {

```
 reloj_ff::sptr
 reloj_ff::make(int tasa, int precision)
 {
   return gnuradio::get_initial_sptr
     (new reloj_ff_impl(tasa, precision));
 }

 /*
  * The private constructor
  */
 reloj_ff_impl::reloj_ff_impl(int tasa, int precision)
   : gr::block("reloj_ff",
       gr::io_signature::make(1,1,sizeof(float)),
       gr::io_signature::make(1, 1, sizeof(float)))
 {
     this->d_tasa=tasa;
     this->d_precision=(float)precision;
     this->posicion=0;
 }

 /*
  * Our virtual destructor.
  */
 reloj_ff_impl::~reloj_ff_impl()
 {
 }

 void
 reloj_ff_impl::forecast (int noutput_items, gr_vector_int

```

&ninput\_items\_required)  
{  
ninput\_items\_required[0] = noutput\_items;  
}

```
 int
 reloj_ff_impl::general_work (int noutput_items,
                    gr_vector_int &ninput_items,
                    gr_vector_const_void_star &input_items,
                    gr_vector_void_star &output_items)
 {
float *out = (float*)output_items[0];
const float *in = (const float *) input_items[0];

     for(int i=0;i<noutput_items;++i){
         if(posicion!=d_tasa){
             out[i]=d_precision;
             ++posicion;
         }
         else{
             d_precision=d_precision+1;
             posicion=0;
             out[i]=d_precision;
         }
     }

     return noutput_items;
 }

```

} /\* namespace howto _/  
} /_ namespace gr \*/

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#ifndef INCLUDED\_HOWTO\_RELOJ\_FF\_IMPL\_H  
#define INCLUDED\_HOWTO\_RELOJ\_FF\_IMPL\_H

#include \<howto/reloj\_ff.h\>

namespace gr {  
namespace howto {

```
 class reloj_ff_impl : public reloj_ff
 {
  private:
   // Nothing to declare in this block.

  public:
   reloj_ff_impl(int tasa, int precision);
   ~reloj_ff_impl();

     int d_tasa;
     float d_precision;
     int posicion;

   // Where all the action really happens
   void forecast (int noutput_items, gr_vector_int

```

&ninput\_items\_required);

```
   int general_work(int noutput_items,
       gr_vector_int &ninput_items,
       gr_vector_const_void_star &input_items,
       gr_vector_void_star &output_items);
 };

```

} // namespace howto  
} // namespace gr

#endif /\* INCLUDED\_HOWTO\_RELOJ\_FF\_IMPL\_H \*/

😉
