Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 92a3c4a1 authored by Guillaume Sylvand's avatar Guillaume Sylvand
Browse files

Add a 'progress indicator' feature, that displays a percentage of completion

IT is OFF by default
It is activated with MORSE_Enable(MORSE_PROGRESS)
In the timing routines, it is activated with --progress
No progress is printed for tasks faster than 10 seconds
parent 994f1701
No related branches found
No related tags found
No related merge requests found
...@@ -77,11 +77,12 @@ MORSE_context_t *morse_context_create() ...@@ -77,11 +77,12 @@ MORSE_context_t *morse_context_create()
morse->ncudas = 0; morse->ncudas = 0;
morse->nthreads_per_worker= 1; morse->nthreads_per_worker= 1;
morse->errors_enabled = MORSE_FALSE; morse->errors_enabled = MORSE_FALSE;
morse->warnings_enabled = MORSE_FALSE; morse->warnings_enabled = MORSE_FALSE;
morse->autotuning_enabled = MORSE_TRUE; morse->autotuning_enabled = MORSE_TRUE;
morse->parallel_enabled = MORSE_FALSE; morse->parallel_enabled = MORSE_FALSE;
morse->profiling_enabled = MORSE_FALSE; morse->profiling_enabled = MORSE_FALSE;
morse->progress_enabled = MORSE_FALSE;
morse->householder = MORSE_FLAT_HOUSEHOLDER; morse->householder = MORSE_FLAT_HOUSEHOLDER;
morse->translation = MORSE_OUTOFPLACE; morse->translation = MORSE_OUTOFPLACE;
...@@ -130,6 +131,7 @@ int morse_context_destroy(){ ...@@ -130,6 +131,7 @@ int morse_context_destroy(){
* @arg MORSE_ERRORS printing of error messages, * @arg MORSE_ERRORS printing of error messages,
* @arg MORSE_AUTOTUNING autotuning for tile size and inner block size. * @arg MORSE_AUTOTUNING autotuning for tile size and inner block size.
* @arg MORSE_PROFILING_MODE activate profiling of kernels * @arg MORSE_PROFILING_MODE activate profiling of kernels
* @arg MORSE_PROGRESS activate progress indicator
* *
******************************************************************************* *******************************************************************************
* *
...@@ -161,6 +163,9 @@ int MORSE_Enable(MORSE_enum option) ...@@ -161,6 +163,9 @@ int MORSE_Enable(MORSE_enum option)
case MORSE_PROFILING_MODE: case MORSE_PROFILING_MODE:
morse->profiling_enabled = MORSE_TRUE; morse->profiling_enabled = MORSE_TRUE;
break; break;
case MORSE_PROGRESS:
morse->progress_enabled = MORSE_TRUE;
break;
/* case MORSE_PARALLEL: */ /* case MORSE_PARALLEL: */
/* morse->parallel_enabled = MORSE_TRUE; */ /* morse->parallel_enabled = MORSE_TRUE; */
/* break; */ /* break; */
...@@ -190,7 +195,8 @@ int MORSE_Enable(MORSE_enum option) ...@@ -190,7 +195,8 @@ int MORSE_Enable(MORSE_enum option)
* @arg MORSE_WARNINGS printing of warning messages, * @arg MORSE_WARNINGS printing of warning messages,
* @arg MORSE_ERRORS printing of error messages, * @arg MORSE_ERRORS printing of error messages,
* @arg MORSE_AUTOTUNING autotuning for tile size and inner block size. * @arg MORSE_AUTOTUNING autotuning for tile size and inner block size.
* @arg MORSE_PROFILING_MODE activate profiling of kernels * @arg MORSE_PROFILING_MODE deactivate profiling of kernels
* @arg MORSE_PROGRESS deactivate progress indicator
* *
******************************************************************************* *******************************************************************************
* *
...@@ -221,6 +227,9 @@ int MORSE_Disable(MORSE_enum option) ...@@ -221,6 +227,9 @@ int MORSE_Disable(MORSE_enum option)
case MORSE_PROFILING_MODE: case MORSE_PROFILING_MODE:
morse->profiling_enabled = MORSE_FALSE; morse->profiling_enabled = MORSE_FALSE;
break; break;
case MORSE_PROGRESS:
morse->progress_enabled = MORSE_FALSE;
break;
case MORSE_PARALLEL_MODE: case MORSE_PARALLEL_MODE:
morse->parallel_enabled = MORSE_FALSE; morse->parallel_enabled = MORSE_FALSE;
break; break;
......
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
#define MORSE_PROFILING_MODE 5 #define MORSE_PROFILING_MODE 5
#define MORSE_PARALLEL_MODE 6 #define MORSE_PARALLEL_MODE 6
#define MORSE_BOUND 7 #define MORSE_BOUND 7
#define MORSE_PROGRESS 8
/** **************************************************************************** /** ****************************************************************************
* MORSE constants - configuration parameters * MORSE constants - configuration parameters
......
...@@ -131,6 +131,7 @@ typedef struct morse_context_s { ...@@ -131,6 +131,7 @@ typedef struct morse_context_s {
MORSE_bool autotuning_enabled; MORSE_bool autotuning_enabled;
MORSE_bool parallel_enabled; MORSE_bool parallel_enabled;
MORSE_bool profiling_enabled; MORSE_bool profiling_enabled;
MORSE_bool progress_enabled;
MORSE_enum householder; // "domino" (flat) or tree-based (reduction) Householder MORSE_enum householder; // "domino" (flat) or tree-based (reduction) Householder
MORSE_enum translation; // In place or Out of place layout conversion MORSE_enum translation; // In place or Out of place layout conversion
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* *
**/ **/
#include <stdlib.h> #include <stdlib.h>
#include <limits.h>
#include "runtime/starpu/include/morse_starpu.h" #include "runtime/starpu/include/morse_starpu.h"
/******************************************************************************* /*******************************************************************************
...@@ -45,6 +46,60 @@ int RUNTIME_sequence_destroy( MORSE_context_t *morse, MORSE_sequence_t *sequence ...@@ -45,6 +46,60 @@ int RUNTIME_sequence_destroy( MORSE_context_t *morse, MORSE_sequence_t *sequence
return MORSE_SUCCESS; return MORSE_SUCCESS;
} }
void update_progress(int currentValue, int maximumValue) {
div_t res ;
static int progress = -1; /* varie de 0 a 100 au cours du calcul concerne */
if (maximumValue==0)
res.quot=100 ;
else {
if (currentValue<INT_MAX/100)
res=div(currentValue*100, maximumValue) ;
/* Calcule le quotient de la division */
else
res.quot=(int)( (long long) currentValue*100/maximumValue) ;
}
// Print the percentage
if (res.quot > progress)
printf("%3d%%\b\b\b\b", res.quot) ;
progress=res.quot ;
if (currentValue>=maximumValue) {
progress=-1 ;
}
fflush(stdout);
}
#define PROGRESS_MINIMUM_DURATION 10
/*******************************************************************************
* Display a progress information when executing the tasks
**/
int RUNTIME_progress( MORSE_context_t *morse)
{
#if defined(CHAMELEON_USE_MPI)
if (morse->my_mpi_rank!=0)
return MORSE_SUCCESS;
#endif
int tasksLeft, current, timer=0;
int max = starpu_task_nsubmitted();
if (max==0)
return MORSE_SUCCESS;
// update_progress(0, max);
while ((tasksLeft = starpu_task_nsubmitted()) > 0) {
current = max - tasksLeft;
if (timer > PROGRESS_MINIMUM_DURATION) // no progress indicator for algorithms faster than 'PROGRESS_MINIMUM_DURATION' seconds
update_progress(current, max);
sleep(1);
timer++;
}
if (timer > PROGRESS_MINIMUM_DURATION)
update_progress(max, max);
return MORSE_SUCCESS;
}
/******************************************************************************* /*******************************************************************************
* Wait for the completion of a sequence * Wait for the completion of a sequence
**/ **/
...@@ -52,6 +107,8 @@ int RUNTIME_sequence_wait( MORSE_context_t *morse, MORSE_sequence_t *sequence ) ...@@ -52,6 +107,8 @@ int RUNTIME_sequence_wait( MORSE_context_t *morse, MORSE_sequence_t *sequence )
{ {
(void)morse; (void)morse;
(void)sequence; (void)sequence;
if (morse->progress_enabled)
RUNTIME_progress(morse);
starpu_task_wait_for_all(); starpu_task_wait_for_all();
#if defined(CHAMELEON_USE_MPI) #if defined(CHAMELEON_USE_MPI)
starpu_mpi_barrier(MPI_COMM_WORLD); starpu_mpi_barrier(MPI_COMM_WORLD);
......
...@@ -348,6 +348,7 @@ show_help(char *prog_name) { ...@@ -348,6 +348,7 @@ show_help(char *prog_name) {
"\n" "\n"
" --[a]sync Enable/Disable synchronous calls in wrapper function such as POTRI. (default: async)\n" " --[a]sync Enable/Disable synchronous calls in wrapper function such as POTRI. (default: async)\n"
" --[no]check Check result (default: nocheck)\n" " --[no]check Check result (default: nocheck)\n"
" --[no]progress Display progress indicator (default: noprogress)\n"
" --[no]inv Check on inverse (default: noinv)\n" " --[no]inv Check on inverse (default: noinv)\n"
" --[no]warmup Perform a warmup run to pre-load libraries (default: warmup)\n" " --[no]warmup Perform a warmup run to pre-load libraries (default: warmup)\n"
" --[no]trace Enable/Disable trace generation (default: notrace)\n" " --[no]trace Enable/Disable trace generation (default: notrace)\n"
...@@ -486,6 +487,7 @@ main(int argc, char *argv[]) { ...@@ -486,6 +487,7 @@ main(int argc, char *argv[]) {
iparam[IPARAM_NMPI ] = 1; iparam[IPARAM_NMPI ] = 1;
iparam[IPARAM_P ] = 1; iparam[IPARAM_P ] = 1;
iparam[IPARAM_Q ] = 1; iparam[IPARAM_Q ] = 1;
iparam[IPARAM_PROGRESS ] = 0;
iparam[IPARAM_PROFILE ] = 0; iparam[IPARAM_PROFILE ] = 0;
iparam[IPARAM_PRINT_ERRORS ] = 0; iparam[IPARAM_PRINT_ERRORS ] = 0;
iparam[IPARAM_PEAK ] = 0; iparam[IPARAM_PEAK ] = 0;
...@@ -524,6 +526,10 @@ main(int argc, char *argv[]) { ...@@ -524,6 +526,10 @@ main(int argc, char *argv[]) {
iparam[IPARAM_TRACE] = 1; iparam[IPARAM_TRACE] = 1;
} else if (startswith( argv[i], "--notrace" )) { } else if (startswith( argv[i], "--notrace" )) {
iparam[IPARAM_TRACE] = 0; iparam[IPARAM_TRACE] = 0;
} else if (startswith( argv[i], "--progress" )) {
iparam[IPARAM_PROGRESS] = 1;
} else if (startswith( argv[i], "--noprogress" )) {
iparam[IPARAM_PROGRESS] = 0;
} else if (startswith( argv[i], "--dag" )) { } else if (startswith( argv[i], "--dag" )) {
iparam[IPARAM_DAG] = 1; iparam[IPARAM_DAG] = 1;
} else if (startswith( argv[i], "--nodag" )) { } else if (startswith( argv[i], "--nodag" )) {
...@@ -628,6 +634,9 @@ main(int argc, char *argv[]) { ...@@ -628,6 +634,9 @@ main(int argc, char *argv[]) {
if (iparam[IPARAM_PRINT_ERRORS] == 1) if (iparam[IPARAM_PRINT_ERRORS] == 1)
MORSE_Enable(MORSE_ERRORS); MORSE_Enable(MORSE_ERRORS);
if (iparam[IPARAM_PROGRESS] == 1)
MORSE_Enable(MORSE_PROGRESS);
#if defined(CHAMELEON_USE_MPI) #if defined(CHAMELEON_USE_MPI)
MORSE_Comm_size( &nbnode ); MORSE_Comm_size( &nbnode );
iparam[IPARAM_NMPI] = nbnode; iparam[IPARAM_NMPI] = nbnode;
......
...@@ -46,6 +46,8 @@ enum iparam_timing { ...@@ -46,6 +46,8 @@ enum iparam_timing {
IPARAM_NMPI, IPARAM_NMPI,
IPARAM_P, /* Parameter for 2D cyclic distribution */ IPARAM_P, /* Parameter for 2D cyclic distribution */
IPARAM_Q, /* Parameter for 2D cyclic distribution */ IPARAM_Q, /* Parameter for 2D cyclic distribution */
IPARAM_PROGRESS, /* Use a progress indicator during computations */
/* Added for StarPU version */ /* Added for StarPU version */
IPARAM_PROFILE, IPARAM_PROFILE,
IPARAM_PRINT_ERRORS, IPARAM_PRINT_ERRORS,
......
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