Mentions légales du service

Skip to content
Snippets Groups Projects
Commit bad63cc6 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Merge branch 'issue16/default_nbthreads' into 'master'

Fix issue 16

Closes #16

See merge request !24
parents 0d5537af 89f34f2c
No related branches found
No related tags found
1 merge request!24Fix issue 16
Pipeline #
......@@ -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();
}
......@@ -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);
......
......@@ -63,6 +63,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
......
......@@ -127,3 +127,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();
}
......@@ -120,3 +120,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();
}
......@@ -249,3 +249,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 );
}
......@@ -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 the number of threads 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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment