Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AGULLO Emmanuel
Chameleon
Commits
a66b21dc
Commit
a66b21dc
authored
Jan 12, 2018
by
Mathieu Faverge
Browse files
Factorize timer
parent
32181183
Changes
16
Hide whitespace changes
Inline
Side-by-side
example/lapack_to_morse/lapack_to_morse.h
View file @
a66b21dc
...
...
@@ -47,9 +47,7 @@
#include <sys/resource.h>
#endif
/* Common functions for all steps of the tutorial */
static
void
get_thread_count
(
int
*
thrdnbr
)
{
#if defined WIN32 || defined WIN64
sscanf
(
getenv
(
"NUMBER_OF_PROCESSORS"
),
"%d"
,
thrdnbr
);
...
...
@@ -65,7 +63,6 @@ static int startswith(const char *s, const char *prefix) {
return
1
;
}
/* define complexity of algorithms - see Lawn 41 page 120 */
#define FMULS_POTRF(__n) ((double)(__n) * (((1. / 6.) * (double)(__n) + 0.5) * (double)(__n) + (1. / 3.)))
#define FADDS_POTRF(__n) ((double)(__n) * (((1. / 6.) * (double)(__n) ) * (double)(__n) - (1. / 6.)))
...
...
@@ -73,68 +70,6 @@ static int startswith(const char *s, const char *prefix) {
#define FADDS_TRSM(__m, __n) (0.5 * (double)(__n) * (double)(__m) * ((double)(__m)-1.))
/* define some tools to time the program */
#if defined( _WIN32 ) || defined( _WIN64 )
#include <windows.h>
#include <time.h>
#include <sys/timeb.h>
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
struct
timezone
{
int
tz_minuteswest
;
/* minutes W of Greenwich */
int
tz_dsttime
;
/* type of dst correction */
};
int
gettimeofday
(
struct
timeval
*
tv
,
struct
timezone
*
tz
)
{
FILETIME
ft
;
unsigned
__int64
tmpres
=
0
;
static
int
tzflag
;
if
(
NULL
!=
tv
)
{
GetSystemTimeAsFileTime
(
&
ft
);
tmpres
|=
ft
.
dwHighDateTime
;
tmpres
<<=
32
;
tmpres
|=
ft
.
dwLowDateTime
;
/*converting file time to unix epoch*/
tmpres
/=
10
;
/*convert into microseconds*/
tmpres
-=
DELTA_EPOCH_IN_MICROSECS
;
tv
->
tv_sec
=
(
long
)(
tmpres
/
1000000UL
);
tv
->
tv_usec
=
(
long
)(
tmpres
%
1000000UL
);
}
if
(
NULL
!=
tz
)
{
if
(
!
tzflag
)
{
_tzset
();
tzflag
++
;
}
tz
->
tz_minuteswest
=
_timezone
/
60
;
tz
->
tz_dsttime
=
_daylight
;
}
return
0
;
}
#else
/* Non-Windows */
#include <sys/time.h>
#endif
/*
* struct timeval {time_t tv_sec; suseconds_t tv_usec;};
*/
double
cWtime
(
void
)
{
struct
timeval
tp
;
gettimeofday
(
&
tp
,
NULL
);
return
tp
.
tv_sec
+
1e-6
*
tp
.
tv_usec
;
}
#include <chameleon/chameleon_timer.h>
#endif
/* LAPACK_TO_MORSE_H */
example/lapack_to_morse/step0.c
View file @
a66b21dc
...
...
@@ -98,7 +98,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
/* Cholesky factorization:
* A is replaced by its factorization L or L^T depending on uplo */
...
...
@@ -124,7 +124,7 @@ int main(int argc, char *argv[]) {
CblasNonUnit
,
N
,
NRHS
,
1
.
0
,
A
,
N
,
X
,
N
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/lapack_to_morse/step1.c
View file @
a66b21dc
...
...
@@ -120,7 +120,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
/* Cholesky factorization:
* A is replaced by its factorization L or L^T depending on uplo */
...
...
@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) {
*/
MORSE_dpotrs
(
UPLO
,
N
,
NRHS
,
A
,
N
,
X
,
N
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/lapack_to_morse/step2.c
View file @
a66b21dc
...
...
@@ -164,7 +164,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
/* Cholesky factorization:
* A is replaced by its factorization L or L^T depending on uplo */
...
...
@@ -176,7 +176,7 @@ int main(int argc, char *argv[]) {
*/
MORSE_dpotrs_Tile
(
UPLO
,
descA
,
descX
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/lapack_to_morse/step3.c
View file @
a66b21dc
...
...
@@ -147,7 +147,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
/* Cholesky factorization:
* A is replaced by its factorization L or L^T depending on uplo */
...
...
@@ -159,7 +159,7 @@ int main(int argc, char *argv[]) {
*/
MORSE_dpotrs_Tile
(
UPLO
,
descA
,
descX
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/lapack_to_morse/step4.c
View file @
a66b21dc
...
...
@@ -127,7 +127,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
MORSE_Sequence_Create
(
&
sequence
);
...
...
@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
}
MORSE_Sequence_Destroy
(
sequence
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/lapack_to_morse/step5.c
View file @
a66b21dc
...
...
@@ -131,7 +131,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
MORSE_Sequence_Create
(
&
sequence
);
...
...
@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) {
}
MORSE_Sequence_Destroy
(
sequence
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/lapack_to_morse/step6.c
View file @
a66b21dc
...
...
@@ -153,7 +153,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
MORSE_Sequence_Create
(
&
sequence
);
...
...
@@ -183,7 +183,7 @@ int main(int argc, char *argv[]) {
}
MORSE_Sequence_Destroy
(
sequence
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/lapack_to_morse/step7.c
View file @
a66b21dc
...
...
@@ -161,7 +161,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
MORSE_Sequence_Create
(
&
sequence
);
...
...
@@ -191,7 +191,7 @@ int main(int argc, char *argv[]) {
}
MORSE_Sequence_Destroy
(
sequence
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/link_chameleon/link_chameleon.c
View file @
a66b21dc
...
...
@@ -37,69 +37,6 @@ static int startswith(const char *s, const char *prefix) {
#define FMULS_TRSM(__m, __n) (0.5 * (double)(__n) * (double)(__m) * ((double)(__m)+1.))
#define FADDS_TRSM(__m, __n) (0.5 * (double)(__n) * (double)(__m) * ((double)(__m)-1.))
/* define some tools to time the program */
#if defined( _WIN32 ) || defined( _WIN64 )
#include <windows.h>
#include <time.h>
#include <sys/timeb.h>
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
struct
timezone
{
int
tz_minuteswest
;
/* minutes W of Greenwich */
int
tz_dsttime
;
/* type of dst correction */
};
int
gettimeofday
(
struct
timeval
*
tv
,
struct
timezone
*
tz
)
{
FILETIME
ft
;
unsigned
__int64
tmpres
=
0
;
static
int
tzflag
;
if
(
NULL
!=
tv
)
{
GetSystemTimeAsFileTime
(
&
ft
);
tmpres
|=
ft
.
dwHighDateTime
;
tmpres
<<=
32
;
tmpres
|=
ft
.
dwLowDateTime
;
/*converting file time to unix epoch*/
tmpres
/=
10
;
/*convert into microseconds*/
tmpres
-=
DELTA_EPOCH_IN_MICROSECS
;
tv
->
tv_sec
=
(
long
)(
tmpres
/
1000000UL
);
tv
->
tv_usec
=
(
long
)(
tmpres
%
1000000UL
);
}
if
(
NULL
!=
tz
)
{
if
(
!
tzflag
)
{
_tzset
();
tzflag
++
;
}
tz
->
tz_minuteswest
=
_timezone
/
60
;
tz
->
tz_dsttime
=
_daylight
;
}
return
0
;
}
#else
/* Non-Windows */
#include <sys/time.h>
#endif
/*
* struct timeval {time_t tv_sec; suseconds_t tv_usec;};
*/
double
cWtime
(
void
)
{
struct
timeval
tp
;
gettimeofday
(
&
tp
,
NULL
);
return
tp
.
tv_sec
+
1e-6
*
tp
.
tv_usec
;
}
#include <coreblas/lapacke.h>
#include <morse.h>
...
...
@@ -288,7 +225,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
/* Cholesky facorization:
* A is replaced by its factorization L or L^T depending on uplo */
...
...
@@ -300,7 +237,7 @@ int main(int argc, char *argv[]) {
*/
MORSE_dpotrs
(
UPLO
,
N
,
NRHS
,
A
,
N
,
X
,
N
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/out_of_core/out_of_core.c
View file @
a66b21dc
...
...
@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) {
/* solve the system AX = B using the Cholesky factorization */
/************************************************************/
cpu_time
=
-
cW
time
();
cpu_time
=
-
CHAMELEON_
time
r
();
/* Cholesky factorization:
* A is replaced by its factorization L or L^T depending on uplo */
...
...
@@ -144,7 +144,7 @@ int main(int argc, char *argv[]) {
*/
MORSE_dpotrs_Tile
(
UPLO
,
descA
,
descX
);
cpu_time
+=
cW
time
();
cpu_time
+=
CHAMELEON_
time
r
();
/* print informations to user */
gflops
=
flops
/
cpu_time
;
...
...
example/out_of_core/out_of_core.h
View file @
a66b21dc
...
...
@@ -77,68 +77,7 @@ static int startswith(const char *s, const char *prefix) {
#define FADDS_TRSM(__m, __n) (0.5 * (double)(__n) * (double)(__m) * ((double)(__m)-1.))
/* define some tools to time the program */
#if defined( _WIN32 ) || defined( _WIN64 )
#include <windows.h>
#include <time.h>
#include <sys/timeb.h>
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
struct
timezone
{
int
tz_minuteswest
;
/* minutes W of Greenwich */
int
tz_dsttime
;
/* type of dst correction */
};
int
gettimeofday
(
struct
timeval
*
tv
,
struct
timezone
*
tz
)
{
FILETIME
ft
;
unsigned
__int64
tmpres
=
0
;
static
int
tzflag
;
if
(
NULL
!=
tv
)
{
GetSystemTimeAsFileTime
(
&
ft
);
tmpres
|=
ft
.
dwHighDateTime
;
tmpres
<<=
32
;
tmpres
|=
ft
.
dwLowDateTime
;
/*converting file time to unix epoch*/
tmpres
/=
10
;
/*convert into microseconds*/
tmpres
-=
DELTA_EPOCH_IN_MICROSECS
;
tv
->
tv_sec
=
(
long
)(
tmpres
/
1000000UL
);
tv
->
tv_usec
=
(
long
)(
tmpres
%
1000000UL
);
}
if
(
NULL
!=
tz
)
{
if
(
!
tzflag
)
{
_tzset
();
tzflag
++
;
}
tz
->
tz_minuteswest
=
_timezone
/
60
;
tz
->
tz_dsttime
=
_daylight
;
}
return
0
;
}
#else
/* Non-Windows */
#include <sys/time.h>
#endif
/*
* struct timeval {time_t tv_sec; suseconds_t tv_usec;};
*/
double
cWtime
(
void
)
{
struct
timeval
tp
;
gettimeofday
(
&
tp
,
NULL
);
return
tp
.
tv_sec
+
1e-6
*
tp
.
tv_usec
;
}
#include <chameleon/chameleon_timer.h>
/* Integer parameters */
enum
iparam_ooc
{
...
...
include/chameleon/chameleon_timer.h
0 → 100644
View file @
a66b21dc
/**
*
* @copyright 2009-2014 The University of Tennessee and The University of
* Tennessee Research Foundation. All rights reserved.
* @copyright 2012-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
* @file chameleon_timer.h
*
* Provide a simple timer for examples and runtimes which do not provide their
* own timer.
*
**/
#ifndef _chameleon_timer_h_
#define _chameleon_timer_h_
#if defined( _WIN32 ) || defined( _WIN64 )
#include <windows.h>
#include <time.h>
#include <sys/timeb.h>
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
struct
timezone
{
int
tz_minuteswest
;
/* minutes W of Greenwich */
int
tz_dsttime
;
/* type of dst correction */
};
static
inline
int
gettimeofday
(
struct
timeval
*
tv
,
struct
timezone
*
tz
)
{
FILETIME
ft
;
unsigned
__int64
tmpres
=
0
;
static
int
tzflag
;
if
(
NULL
!=
tv
)
{
GetSystemTimeAsFileTime
(
&
ft
);
tmpres
|=
ft
.
dwHighDateTime
;
tmpres
<<=
32
;
tmpres
|=
ft
.
dwLowDateTime
;
/*converting file time to unix epoch*/
tmpres
/=
10
;
/*convert into microseconds*/
tmpres
-=
DELTA_EPOCH_IN_MICROSECS
;
tv
->
tv_sec
=
(
long
)(
tmpres
/
1000000UL
);
tv
->
tv_usec
=
(
long
)(
tmpres
%
1000000UL
);
}
if
(
NULL
!=
tz
)
{
if
(
!
tzflag
)
{
_tzset
();
tzflag
++
;
}
tz
->
tz_minuteswest
=
_timezone
/
60
;
tz
->
tz_dsttime
=
_daylight
;
}
return
0
;
}
#else
/* Non-Windows */
#include <sys/time.h>
#endif
/**
* @brief Return a simple timestamp in s.
*
* @return The timestamp in s without any barriers.
*/
static
inline
double
CHAMELEON_timer
(
void
)
{
struct
timeval
tp
;
gettimeofday
(
&
tp
,
NULL
);
return
tp
.
tv_sec
+
1e-6
*
tp
.
tv_usec
;
}
#endif
/* _chameleon_timer_h_ */
runtime/parsec/control/runtime_profiling.c
View file @
a66b21dc
...
...
@@ -8,74 +8,10 @@
*
**/
#include "chameleon_parsec.h"
#if defined( _WIN32 ) || defined( _WIN64 )
#include <windows.h>
#include <time.h>
#include <sys/timeb.h>
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
struct
timezone
{
int
tz_minuteswest
;
/* minutes W of Greenwich */
int
tz_dsttime
;
/* type of dst correction */
};
int
gettimeofday
(
struct
timeval
*
tv
,
struct
timezone
*
tz
)
{
FILETIME
ft
;
unsigned
__int64
tmpres
=
0
;
static
int
tzflag
;
if
(
NULL
!=
tv
)
{
GetSystemTimeAsFileTime
(
&
ft
);
tmpres
|=
ft
.
dwHighDateTime
;
tmpres
<<=
32
;
tmpres
|=
ft
.
dwLowDateTime
;
/*converting file time to unix epoch*/
tmpres
/=
10
;
/*convert into microseconds*/
tmpres
-=
DELTA_EPOCH_IN_MICROSECS
;
tv
->
tv_sec
=
(
long
)(
tmpres
/
1000000UL
);
tv
->
tv_usec
=
(
long
)(
tmpres
%
1000000UL
);
}
if
(
NULL
!=
tz
)
{
if
(
!
tzflag
)
{
_tzset
();
tzflag
++
;
}
tz
->
tz_minuteswest
=
_timezone
/
60
;
tz
->
tz_dsttime
=
_daylight
;
}
return
0
;
}
#else
/* Non-Windows */
#include <sys/time.h>
#endif
double
cWtime
(
void
);
/*
* struct timeval {time_t tv_sec; suseconds_t tv_usec;};
*/
double
cWtime
(
void
)
{
struct
timeval
tp
;
gettimeofday
(
&
tp
,
NULL
);
return
tp
.
tv_sec
+
1e-6
*
tp
.
tv_usec
;
}
#include "chameleon_timer.h"
double
RUNTIME_get_time
(){
return
cW
time
();
return
CHAMELEON_
time
r
();
}
void
RUNTIME_start_profiling
()
...
...
runtime/quark/codelets/codelet_ztile_zero.c
View file @
a66b21dc
...
...
@@ -47,9 +47,9 @@ void CORE_ztile_zero_quark(Quark *quark)
}
void
MORSE_TASK_ztile_zero
(
const
MORSE_option_t
*
options
,
int
X1
,
int
X2
,
int
Y1
,
int
Y2
,
const
MORSE_desc_t
*
A
,
int
Am
,
int
An
,
int
lda
)
void
MORSE_TASK_ztile_zero
(
const
MORSE_option_t
*
options
,
int
X1
,
int
X2
,
int
Y1
,
int
Y2
,
const
MORSE_desc_t
*
A
,
int
Am
,
int
An
,
int
lda
)
{
quark_option_t
*
opt
=
(
quark_option_t
*
)(
options
->
schedopt
);
QUARK_Insert_Task
(
opt
->
quark
,
CORE_ztile_zero_quark
,
(
Quark_Task_Flags
*
)
opt
,
...
...
runtime/quark/control/runtime_profiling.c
View file @
a66b21dc
...
...
@@ -18,74 +18,10 @@
*
**/
#include "chameleon_quark.h"
#if defined( _WIN32 ) || defined( _WIN64 )
#include <windows.h>
#include <time.h>
#include <sys/timeb.h>
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
struct
timezone
{
int
tz_minuteswest
;
/* minutes W of Greenwich */
int
tz_dsttime
;
/* type of dst correction */
};
int
gettimeofday
(
struct
timeval
*
tv
,
struct
timezone
*
tz
)
{
FILETIME
ft
;
unsigned
__int64
tmpres
=
0
;
static
int
tzflag
;
if
(
NULL
!=
tv
)
{
GetSystemTimeAsFileTime
(
&
ft
);
tmpres
|=
ft
.
dwHighDateTime
;
tmpres
<<=
32
;
tmpres
|=
ft
.
dwLowDateTime
;
/*converting file time to unix epoch*/