Mentions légales du service

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

Fix issue 16

parent ab62aa98
No related branches found
No related tags found
1 merge request!24Fix issue 16
...@@ -283,3 +283,21 @@ int MORSE_Comm_rank( int *rank ) ...@@ -283,3 +283,21 @@ int MORSE_Comm_rank( int *rank )
RUNTIME_comm_rank (rank); RUNTIME_comm_rank (rank);
return MORSE_SUCCESS; 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" { ...@@ -61,23 +61,24 @@ extern "C" {
#endif #endif
/* Auxiliary */ /* Auxiliary */
int MORSE_Version (int *ver_major, int *ver_minor, int *ver_micro); int MORSE_Version (int *ver_major, int *ver_minor, int *ver_micro);
int MORSE_My_Mpi_Rank (void); int MORSE_My_Mpi_Rank (void);
int MORSE_Init (int nworkers, int ncudas); int MORSE_Init (int nworkers, int ncudas);
int MORSE_InitPar (int nworkers, int ncudas, int nthreads_per_worker); int MORSE_InitPar (int nworkers, int ncudas, int nthreads_per_worker);
int MORSE_Finalize (void); int MORSE_Finalize (void);
int MORSE_Pause (void); int MORSE_Pause (void);
int MORSE_Resume (void); int MORSE_Resume (void);
int MORSE_Distributed_start (void); int MORSE_Distributed_start (void);
int MORSE_Distributed_stop (void); int MORSE_Distributed_stop (void);
int MORSE_Comm_size ( int *size ); int MORSE_Comm_size (int *size);
int MORSE_Comm_rank ( int *rank ); int MORSE_Comm_rank (int *rank);
int MORSE_Lapack_to_Tile (void *Af77, int LDA, MORSE_desc_t *A); 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_Tile_to_Lapack (MORSE_desc_t *A, void *Af77, int LDA);
int MORSE_Distributed_start(void); int MORSE_Distributed_start (void);
int MORSE_Distributed_stop (void); int MORSE_Distributed_stop (void);
int MORSE_Distributed_size (int*size); int MORSE_Distributed_size (int *size);
int MORSE_Distributed_rank (int*rank); int MORSE_Distributed_rank (int *rank);
int MORSE_GetThreadNbr (void);
/* Descriptor */ /* Descriptor */
int MORSE_Element_Size(int type); int MORSE_Element_Size(int type);
......
...@@ -56,6 +56,7 @@ void RUNTIME_pause (MORSE_context_t*); ...@@ -56,6 +56,7 @@ void RUNTIME_pause (MORSE_context_t*);
void RUNTIME_resume (MORSE_context_t*); void RUNTIME_resume (MORSE_context_t*);
void RUNTIME_comm_rank (int*); void RUNTIME_comm_rank (int*);
void RUNTIME_comm_size (int*); void RUNTIME_comm_size (int*);
int RUNTIME_get_thread_nbr (void);
/******************************************************************************* /*******************************************************************************
* RUNTIME Descriptor * RUNTIME Descriptor
......
...@@ -111,3 +111,11 @@ void RUNTIME_comm_size( int *size ) ...@@ -111,3 +111,11 @@ void RUNTIME_comm_size( int *size )
#endif #endif
return; return;
} }
/*******************************************************************************
* This returns the number of workers
**/
int RUNTIME_get_thread_nbr()
{
return vpmap_get_nb_total_threads();
}
...@@ -104,3 +104,15 @@ void RUNTIME_comm_size( int *size ) ...@@ -104,3 +104,15 @@ void RUNTIME_comm_size( int *size )
*size = 1; *size = 1;
return; 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();
}
...@@ -229,3 +229,11 @@ void RUNTIME_comm_size( int *size ) ...@@ -229,3 +229,11 @@ void RUNTIME_comm_size( int *size )
#endif #endif
return; 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) { ...@@ -440,15 +440,6 @@ print_header(char *prog_name, int * iparam) {
return; 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 int
main(int argc, char *argv[]) { main(int argc, char *argv[]) {
int i, m, mx, nx; int i, m, mx, nx;
...@@ -632,11 +623,6 @@ main(int argc, char *argv[]) { ...@@ -632,11 +623,6 @@ main(int argc, char *argv[]) {
} }
#endif #endif
if ( iparam[IPARAM_THRDNBR] == -1 ) {
get_thread_count( &(iparam[IPARAM_THRDNBR]) );
iparam[IPARAM_THRDNBR] -= iparam[IPARAM_NCUDAS];
}
m = iparam[IPARAM_M]; m = iparam[IPARAM_M];
mx = iparam[IPARAM_MX]; mx = iparam[IPARAM_MX];
nx = iparam[IPARAM_NX]; nx = iparam[IPARAM_NX];
...@@ -645,6 +631,9 @@ main(int argc, char *argv[]) { ...@@ -645,6 +631,9 @@ main(int argc, char *argv[]) {
MORSE_Init( iparam[IPARAM_THRDNBR], MORSE_Init( iparam[IPARAM_THRDNBR],
iparam[IPARAM_NCUDAS] ); iparam[IPARAM_NCUDAS] );
/* Get thenumber of thread set by the runtime */
iparam[IPARAM_THRDNBR] = MORSE_GetThreadNbr();
/* Stops profiling here to avoid profiling uninteresting routines. /* Stops profiling here to avoid profiling uninteresting routines.
It will be reactivated in the time_*.c routines with the macro START_TIMING() */ It will be reactivated in the time_*.c routines with the macro START_TIMING() */
RUNTIME_stop_profiling(); 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