Commit b406a054 authored by PRUVOST Florent's avatar PRUVOST Florent

add MORSE_Pause/Resume function to avoid CPU consumption when no tasks have to...

add MORSE_Pause/Resume function to avoid CPU consumption when no tasks have to be executed - call starpu_pause/resume, do nothing for quark (no need)
parent 8be371c9
......@@ -105,7 +105,7 @@ int morse_context_destroy(){
RUNTIME_context_destroy(morse_ctxt);
free(morse_ctxt);
morse_ctxt = NULL;
return MORSE_SUCCESS;
}
......@@ -163,7 +163,7 @@ int MORSE_Enable(MORSE_enum option)
case MORSE_BOUND:
break;
}
/* Enable at the lower level if required */
RUNTIME_enable( option );
......@@ -221,7 +221,7 @@ int MORSE_Disable(MORSE_enum option)
morse_error("MORSE_Disable", "illegal parameter value");
return MORSE_ERR_ILLEGAL_VALUE;
}
/* Disable at the lower level if required */
RUNTIME_disable( option );
......
......@@ -192,6 +192,53 @@ int MORSE_My_Mpi_Rank(void)
}
return MORSE_MPI_RANK;
#else
return 0;
return MORSE_SUCCESS;
#endif
}
/*******************************************************************************
*
* @ingroup Auxiliary
*
* MORSE_Pause - Suspend MORSE runtime to poll for new tasks.
*
*******************************************************************************
*
* @return
* \retval MORSE_SUCCESS successful exit
*
******************************************************************************/
int MORSE_Pause(void)
{
MORSE_context_t *morse = morse_context_self();
if (morse == NULL) {
morse_error("MORSE_Pause()", "MORSE not initialized");
return MORSE_ERR_NOT_INITIALIZED;
}
RUNTIME_pause(morse);
return MORSE_SUCCESS;
}
/*******************************************************************************
*
* @ingroup Auxiliary
*
* MORSE_Resume - Symmetrical call to MORSE_Pause,
* used to resume the workers polling for new tasks.
*
*******************************************************************************
*
* @return
* \retval MORSE_SUCCESS successful exit
*
******************************************************************************/
int MORSE_Resume(void)
{
MORSE_context_t *morse = morse_context_self();
if (morse == NULL) {
morse_error("MORSE_Resume()", "MORSE not initialized");
return MORSE_ERR_NOT_INITIALIZED;
}
RUNTIME_resume(morse);
return MORSE_SUCCESS;
}
......@@ -742,6 +742,17 @@ Return the MPI rank of the calling process.
int MORSE_My_Mpi_Rank (void);
@end verbatim
Suspend MORSE runtime to poll for new tasks, to avoid useless CPU consumption when
no tasks have to be executed by MORSE runtime system.
@verbatim
int MORSE_Pause (void);
@end verbatim
Symmetrical call to MORSE_Pause, used to resume the workers polling for new tasks.
@verbatim
int MORSE_Resume (void);
@end verbatim
Conversion from LAPACK layout to tile layout.
@verbatim
int MORSE_Lapack_to_Tile (void *Af77, int LDA, MORSE_desc_t *A);
......@@ -834,7 +845,7 @@ Create a sequence.
int MORSE_Sequence_Create (MORSE_sequence_t **sequence);
@end verbatim
Destroy a squence.
Destroy a sequence.
@verbatim
int MORSE_Sequence_Destroy (MORSE_sequence_t *sequence);
@end verbatim
......
......@@ -77,6 +77,8 @@ int MORSE_Init (int nworkers, int ncudas);
int MORSE_InitPar (int nworkers, int ncudas, int nthreads_per_worker);
int MORSE_Finalize (void);
int MORSE_My_Mpi_Rank (void);
int MORSE_Pause (void);
int MORSE_Resume (void);
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);
......
......@@ -52,6 +52,8 @@ int RUNTIME_rank (MORSE_context_t*);
int RUNTIME_init_scheduler (MORSE_context_t*, int, int, int);
void RUNTIME_finalize_scheduler (MORSE_context_t*);
void RUNTIME_barrier (MORSE_context_t*);
void RUNTIME_pause (MORSE_context_t*);
void RUNTIME_resume (MORSE_context_t*);
/*******************************************************************************
* RUNTIME Descriptor
......@@ -77,12 +79,6 @@ int RUNTIME_options_ws_free (MORSE_option_t*);
/* int RUNTIME_options_ws_gethost (MORSE_option_t*); */
/* int RUNTIME_options_ws_getdevice (MORSE_option_t*); */
/*******************************************************************************
* RUNTIME Profiling
**/
void RUNTIME_schedprofile_display ();
void RUNTIME_kernelprofile_display();
/*******************************************************************************
* RUNTIME Locality
**/
......@@ -110,6 +106,8 @@ void RUNTIME_slocality_onerestore (MORSE_kernel_t);
/*******************************************************************************
* RUNTIME Profiling
**/
void RUNTIME_schedprofile_display ();
void RUNTIME_kernelprofile_display();
double RUNTIME_get_time();
void RUNTIME_start_profiling();
......
......@@ -67,3 +67,22 @@ void RUNTIME_finalize_scheduler(MORSE_context_t *morse)
QUARK_Delete((Quark*)(morse->schedopt));
return;
}
/*******************************************************************************
* To suspend the processing of new tasks by workers
**/
void RUNTIME_pause( MORSE_context_t *morse )
{
(void)morse;
return;
}
/*******************************************************************************
* This is the symmetrical call to RUNTIME_pause,
* used to resume the workers polling for new tasks.
**/
void RUNTIME_resume( MORSE_context_t *morse )
{
(void)morse;
return;
}
......@@ -144,3 +144,24 @@ void RUNTIME_barrier( MORSE_context_t *morse )
starpu_mpi_barrier(MPI_COMM_WORLD);
#endif
}
/*******************************************************************************
* To suspend the processing of new tasks by workers
**/
void RUNTIME_pause( MORSE_context_t *morse )
{
(void)morse;
starpu_pause();
return;
}
/*******************************************************************************
* This is the symmetrical call to RUNTIME_pause,
* used to resume the workers polling for new tasks.
**/
void RUNTIME_resume( MORSE_context_t *morse )
{
(void)morse;
starpu_resume();
return;
}
......@@ -43,7 +43,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
* the function we want to trace
*/
MORSE_zplghe_Tile( (double)N, descA, 51 );
/* MORSE ZPOTRF / ZTRTRI / ZLAUUM */
/*
* Example of the different way to combine several asynchonous calls
......@@ -51,23 +51,23 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
#if defined(TRACE_BY_SEQUENCE)
{
MORSE_sequence_t *sequence[3];
MORSE_request_t request[3] = { MORSE_REQUEST_INITIALIZER,
MORSE_REQUEST_INITIALIZER,
MORSE_REQUEST_INITIALIZER };
MORSE_request_t request[3] = { MORSE_REQUEST_INITIALIZER,
MORSE_REQUEST_INITIALIZER,
MORSE_REQUEST_INITIALIZER };
MORSE_Sequence_Create(&sequence[0]);
MORSE_Sequence_Create(&sequence[1]);
MORSE_Sequence_Create(&sequence[2]);
if ( ! iparam[IPARAM_ASYNC] ) {
START_TIMING();
MORSE_zpotrf_Tile_Async(uplo, descA, sequence[0], &request[0]);
MORSE_Sequence_Wait(sequence[0]);
MORSE_ztrtri_Tile_Async(uplo, MorseNonUnit, descA, sequence[1], &request[1]);
MORSE_Sequence_Wait(sequence[1]);
MORSE_zlauum_Tile_Async(uplo, descA, sequence[2], &request[2]);
MORSE_Sequence_Wait(sequence[2]);
MORSE_Desc_Getoncpu( descA );
......@@ -86,11 +86,11 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
MORSE_Desc_Getoncpu( descA );
STOP_TIMING();
}
MORSE_Sequence_Destroy(sequence[0]);
MORSE_Sequence_Destroy(sequence[1]);
MORSE_Sequence_Destroy(sequence[2]);
}
}
#else
{
if ( ! iparam[IPARAM_ASYNC] ) {
......@@ -105,9 +105,9 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
/* Default: we use Asynchonous call with only one sequence */
MORSE_sequence_t *sequence;
MORSE_request_t request[2] = { MORSE_REQUEST_INITIALIZER,
MORSE_REQUEST_INITIALIZER };
MORSE_request_t request[2] = { MORSE_REQUEST_INITIALIZER,
MORSE_REQUEST_INITIALIZER };
START_TIMING();
MORSE_Sequence_Create(&sequence);
MORSE_zpotrf_Tile_Async(uplo, descA, sequence, &request[0]);
......@@ -115,12 +115,12 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_)
MORSE_Sequence_Wait(sequence);
MORSE_Desc_Getoncpu( descA );
STOP_TIMING();
MORSE_Sequence_Destroy(sequence);
MORSE_Sequence_Destroy(sequence);
}
}
#endif
/* Check the solution */
if ( check )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment