diff --git a/control/control.c b/control/control.c
index 8098178bbbff8b127ba82c4019b78469ecb8c63d..9fa06b7811bdbd3bcff345ff6df39c664dfb2da2 100644
--- a/control/control.c
+++ b/control/control.c
@@ -283,3 +283,21 @@ int MORSE_Comm_rank( int *rank )
     RUNTIME_comm_rank (rank);
     return MORSE_SUCCESS;
 }
+
+/** ***************************************************************************
+ *
+ * @ingroup Control
+ *
+ *  MORSE_GetThreadNbr - Return the number of CPU workers initialized by the
+ *  runtime
+ *
+ ******************************************************************************
+ *
+ * @return
+ *          \retval The number of CPU workers started
+ *
+ *****************************************************************************/
+int MORSE_GetThreadNbr( )
+{
+    return RUNTIME_get_thread_nbr();
+}
diff --git a/include/morse.h.in b/include/morse.h.in
index 1a01deb60182d79bb17222834705f0e8bc37a572..9473b6e1cb8754b10e636f725ce5a550fae62586 100644
--- a/include/morse.h.in
+++ b/include/morse.h.in
@@ -61,23 +61,24 @@ extern "C" {
 #endif
 
 /* Auxiliary */
-int MORSE_Version        (int *ver_major, int *ver_minor, int *ver_micro);
-int MORSE_My_Mpi_Rank    (void);
-int MORSE_Init           (int nworkers, int ncudas);
-int MORSE_InitPar        (int nworkers, int ncudas, int nthreads_per_worker);
-int MORSE_Finalize       (void);
-int MORSE_Pause          (void);
-int MORSE_Resume         (void);
+int MORSE_Version           (int *ver_major, int *ver_minor, int *ver_micro);
+int MORSE_My_Mpi_Rank       (void);
+int MORSE_Init              (int nworkers, int ncudas);
+int MORSE_InitPar           (int nworkers, int ncudas, int nthreads_per_worker);
+int MORSE_Finalize          (void);
+int MORSE_Pause             (void);
+int MORSE_Resume            (void);
 int MORSE_Distributed_start (void);
 int MORSE_Distributed_stop  (void);
-int MORSE_Comm_size         ( int *size );
-int MORSE_Comm_rank         ( int *rank );
-int MORSE_Lapack_to_Tile (void *Af77, int LDA, MORSE_desc_t *A);
-int MORSE_Tile_to_Lapack (MORSE_desc_t *A, void *Af77, int LDA);
-int MORSE_Distributed_start(void);
-int MORSE_Distributed_stop (void);
-int MORSE_Distributed_size (int*size);
-int MORSE_Distributed_rank (int*rank);
+int MORSE_Comm_size         (int *size);
+int MORSE_Comm_rank         (int *rank);
+int MORSE_Lapack_to_Tile    (void *Af77, int LDA, MORSE_desc_t *A);
+int MORSE_Tile_to_Lapack    (MORSE_desc_t *A, void *Af77, int LDA);
+int MORSE_Distributed_start (void);
+int MORSE_Distributed_stop  (void);
+int MORSE_Distributed_size  (int *size);
+int MORSE_Distributed_rank  (int *rank);
+int MORSE_GetThreadNbr      (void);
 
 /* Descriptor */
 int MORSE_Element_Size(int type);
diff --git a/include/runtime.h b/include/runtime.h
index 95cf19b75674623160da018bda60c1cbd65ef413..3316f39dba60d0aa40ed88b996bbd7db7cac9f30 100644
--- a/include/runtime.h
+++ b/include/runtime.h
@@ -56,6 +56,7 @@ void  RUNTIME_pause              (MORSE_context_t*);
 void  RUNTIME_resume             (MORSE_context_t*);
 void  RUNTIME_comm_rank          (int*);
 void  RUNTIME_comm_size          (int*);
+int   RUNTIME_get_thread_nbr     (void);
 
 /*******************************************************************************
  * RUNTIME Descriptor
diff --git a/runtime/parsec/control/runtime_control.c b/runtime/parsec/control/runtime_control.c
index edaafbfbef13114d85d66d3e18523b05a68973da..57b5d33f741ae01e0597ee6f9cc62284d715f0cb 100644
--- a/runtime/parsec/control/runtime_control.c
+++ b/runtime/parsec/control/runtime_control.c
@@ -111,3 +111,11 @@ void RUNTIME_comm_size( int *size )
 #endif
     return;
 }
+
+/*******************************************************************************
+ *  This returns the number of workers
+ **/
+int RUNTIME_get_thread_nbr()
+{
+    return vpmap_get_nb_total_threads();
+}
diff --git a/runtime/quark/control/runtime_control.c b/runtime/quark/control/runtime_control.c
index 2ca4d060ce7177339bfc926edfee89be3526d7d0..8457b91da1e7ec2fc7a743dbb8f04d3ae30e26d4 100644
--- a/runtime/quark/control/runtime_control.c
+++ b/runtime/quark/control/runtime_control.c
@@ -104,3 +104,15 @@ void RUNTIME_comm_size( int *size )
     *size = 1;
     return;
 }
+
+/*******************************************************************************
+ *  This returns the number of workers
+ **/
+int RUNTIME_get_thread_nbr()
+{
+    /*
+     * TODO: should add a function to Quark to get the number of thread from the
+     * data structure and not from the system function
+     */
+    return quark_get_numthreads();
+}
diff --git a/runtime/starpu/control/runtime_control.c b/runtime/starpu/control/runtime_control.c
index eb1cbb646c25a237d594bade6b64b74fadfd60dc..23013fdd45cc0367727d6c2c460fbdc858dee881 100644
--- a/runtime/starpu/control/runtime_control.c
+++ b/runtime/starpu/control/runtime_control.c
@@ -229,3 +229,11 @@ void RUNTIME_comm_size( int *size )
 #endif
     return;
 }
+
+/*******************************************************************************
+ *  This returns the number of workers
+ **/
+int RUNTIME_get_thread_nbr()
+{
+    return starpu_worker_get_count_by_type( STARPU_CPU );
+}
diff --git a/timing/timing.c b/timing/timing.c
index 533fc41c1a582a0f41a1de5ad79c1f304f82a2dd..6d97a60db70b8f610e368d3524e94cb3c018d464 100644
--- a/timing/timing.c
+++ b/timing/timing.c
@@ -440,15 +440,6 @@ print_header(char *prog_name, int * iparam) {
     return;
 }
 
-static void
-get_thread_count(int *thrdnbr) {
-#if defined WIN32 || defined WIN64
-    sscanf( getenv( "NUMBER_OF_PROCESSORS" ), "%d", thrdnbr );
-#else
-    *thrdnbr = sysconf(_SC_NPROCESSORS_ONLN);
-#endif
-}
-
 int
 main(int argc, char *argv[]) {
     int i, m, mx, nx;
@@ -632,11 +623,6 @@ main(int argc, char *argv[]) {
     }
 #endif
 
-    if ( iparam[IPARAM_THRDNBR] == -1 ) {
-      get_thread_count( &(iparam[IPARAM_THRDNBR]) );
-      iparam[IPARAM_THRDNBR] -= iparam[IPARAM_NCUDAS];
-    }
-
     m  = iparam[IPARAM_M];
     mx = iparam[IPARAM_MX];
     nx = iparam[IPARAM_NX];
@@ -645,6 +631,9 @@ main(int argc, char *argv[]) {
     MORSE_Init( iparam[IPARAM_THRDNBR],
                 iparam[IPARAM_NCUDAS] );
 
+    /* Get thenumber of thread set by the runtime */
+    iparam[IPARAM_THRDNBR] = MORSE_GetThreadNbr();
+
     /* Stops profiling here to avoid profiling uninteresting routines.
        It will be reactivated in the time_*.c routines with the macro START_TIMING() */
     RUNTIME_stop_profiling();