From 3eb8a86a3d1f9ecb2db89e612df06662ba82c26f Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Tue, 6 Feb 2018 16:20:59 +0100 Subject: [PATCH] Remove lapacke timing --- timing/CMakeLists.txt | 27 -------- timing/time_zgeqrf_hqr.c | 1 + timing/time_zgeqrf_hqr_tile.c | 1 + timing/time_zgeqrf_lapacke.c | 127 ---------------------------------- timing/timing.c | 55 +++++---------- 5 files changed, 19 insertions(+), 192 deletions(-) delete mode 100644 timing/time_zgeqrf_lapacke.c diff --git a/timing/CMakeLists.txt b/timing/CMakeLists.txt index e6621eb6d..19f3a16f7 100644 --- a/timing/CMakeLists.txt +++ b/timing/CMakeLists.txt @@ -229,33 +229,6 @@ endforeach() #-------- Tests --------- include(CTestLists.cmake) -# Add BLAS/LAPACK timings -set(ZSRC_LAPACKE - time_zgeqrf_lapacke.c - ) - -precisions_rules_py(TIMINGS_LAPACKE "${ZSRC_LAPACKE}" - PRECISIONS "${CHAMELEON_PRECISION}") - -foreach(_timing ${TIMINGS_LAPACKE}) - get_filename_component(_name_exe ${_timing} NAME_WE) - add_executable(${_name_exe} ${_timing}) - add_dependencies(${_name_exe} timing_include) - set_property(TARGET ${_name_exe} PROPERTY LINKER_LANGUAGE Fortran) - target_compile_definitions(${_name_exe} PRIVATE TIMING_LAPACKE) - target_link_libraries(${_name_exe} - coreblas - ${LAPACKE_LIBRARIES} - ${TMG_LIBRARIES} - ${CBLAS_LIBRARIES} - ${LAPACK_MT_LIBRARIES} - ${BLAS_MT_LIBRARIES} - ${EXTRA_LIBRARIES} - ) - install(TARGETS ${_name_exe} - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/chameleon/timing) -endforeach() - ### ### END CMakeLists.txt ### diff --git a/timing/time_zgeqrf_hqr.c b/timing/time_zgeqrf_hqr.c index c9eba5f1e..0bb4afb4f 100644 --- a/timing/time_zgeqrf_hqr.c +++ b/timing/time_zgeqrf_hqr.c @@ -69,6 +69,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_) llvl = iparam[IPARAM_LOWLVL_TREE]; qr_a = iparam[IPARAM_RHBLK]; domino = iparam[IPARAM_QR_DOMINO]; + libhqr_init_hqr( &qrtree, ( M >= N ) ? LIBHQR_QR : LIBHQR_LQ, &matrix, llvl, hlvl, qr_a, P, domino, 0); diff --git a/timing/time_zgeqrf_hqr_tile.c b/timing/time_zgeqrf_hqr_tile.c index 2b1a6dcfe..5f5cbf74f 100644 --- a/timing/time_zgeqrf_hqr_tile.c +++ b/timing/time_zgeqrf_hqr_tile.c @@ -73,6 +73,7 @@ RunTest(int *iparam, double *dparam, morse_time_t *t_) llvl = iparam[IPARAM_LOWLVL_TREE]; qr_a = iparam[IPARAM_RHBLK]; domino = iparam[IPARAM_QR_DOMINO]; + libhqr_init_hqr( &qrtree, ( M >= N ) ? LIBHQR_QR : LIBHQR_LQ, &matrix, llvl, hlvl, qr_a, P, domino, 0); diff --git a/timing/time_zgeqrf_lapacke.c b/timing/time_zgeqrf_lapacke.c deleted file mode 100644 index 1753a6958..000000000 --- a/timing/time_zgeqrf_lapacke.c +++ /dev/null @@ -1,127 +0,0 @@ -/** - * - * @copyright (c) 2009-2014 The University of Tennessee and The University - * of Tennessee Research Foundation. - * All rights reserved. - * @copyright (c) 2012-2014 Inria. All rights reserved. - * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved. - * - **/ - -/** - * - * @precisions normal z -> c d s - * - **/ -#define _TYPE MORSE_Complex64_t -#define _PREC double -#define _LAMCH LAPACKE_dlamch_work - -#define _NAME "MORSE_zgeqrf" -/* See Lawn 41 page 120 */ -#define _FMULS FMULS_GEQRF(M, N) -#define _FADDS FADDS_GEQRF(M, N) - -#include "./timing.c" -#include "timing_zauxiliary.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 - -/* - * 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; -} - -static int -RunTest(int *iparam, double *dparam, morse_time_t *t_) -{ - MORSE_Complex64_t *tau; - PASTE_CODE_IPARAM_LOCALS( iparam ); - - if ( M != N && check ) { - fprintf(stderr, "Check cannot be perfomed with M != N\n"); - check = 0; - } - - /* Allocate Data */ - PASTE_CODE_ALLOCATE_MATRIX( A, 1, MORSE_Complex64_t, LDA, N ); - - /* Initialize Data */ - CORE_zplrnt(M, N, A, LDA, - M, 0, 0, 3456); - - /* Allocate Workspace */ - tau = malloc( chameleon_min( M, N ) * sizeof(MORSE_Complex64_t) ); - - t = - cWtime(); - LAPACKE_zgeqrf( LAPACK_COL_MAJOR, M, N, A, LDA, tau ); - t += cWtime(); - *t_ = t; - - /* Check the solution */ - if ( check ) - { - } - - /* Free Workspace */ - free( tau ); - free( A ); - - return 0; -} diff --git a/timing/timing.c b/timing/timing.c index e7b335f81..ca5f3d1b7 100644 --- a/timing/timing.c +++ b/timing/timing.c @@ -63,10 +63,6 @@ #include <getopt.h> #endif /* defined(CHAMELEON_HAVE_GETOPT_H) */ -#ifdef TIMING_LAPACKE -int MORSE_My_Mpi_Rank() { return 0; } -#endif - static int RunTest(int *iparam, _PREC *dparam, double *t_); static inline void* morse_getaddr_null(const MORSE_desc_t *A, int m, int n) { @@ -112,9 +108,7 @@ Test(int64_t n, int *iparam) { thrdnbr = iparam[IPARAM_THRDNBR]; niter = iparam[IPARAM_NITER]; -#ifdef TIMING_LAPACKE - thrdnbr = 1; //otherwise the following test is negative and we can't test lapacke -#endif /* TIMING_LAPACKE */ + M = iparam[IPARAM_M]; N = iparam[IPARAM_N]; K = iparam[IPARAM_K]; @@ -204,7 +198,6 @@ Test(int64_t n, int *iparam) { } gflops = flops / t[iter]; -#ifndef TIMING_LAPACKE #if defined (CHAMELEON_SCHED_STARPU) /* TODO: create chameleon interface encapsulating this instead */ if (iparam[IPARAM_BOUND]) @@ -216,7 +209,6 @@ Test(int64_t n, int *iparam) { upper_gflops = (flops / (tmin / 1000.0)); sumgf_upper += upper_gflops; } -#endif #endif sumt += t[iter]; sumgf += gflops; @@ -504,7 +496,7 @@ set_iparam_default(int *iparam){ iparam[IPARAM_THRDNBR ] = -1; iparam[IPARAM_THRDNBR_SUBGRP] = 1; iparam[IPARAM_M ] = -1; - iparam[IPARAM_N ] = -1; + iparam[IPARAM_N ] = 500; iparam[IPARAM_K ] = 1; iparam[IPARAM_LDA ] = -1; iparam[IPARAM_LDB ] = -1; @@ -632,8 +624,7 @@ parse_arguments(int *_argc, char ***_argv, int *iparam, int *start, int *stop, i int main(int argc, char *argv[]) { - int i, m, n, mx, nx; - int status; + int i, m, mx, nx; int nbnode = 1; int start = 500; int stop = 5000; @@ -653,12 +644,10 @@ main(int argc, char *argv[]) { } #endif - n = iparam[IPARAM_N]; m = iparam[IPARAM_M]; mx = iparam[IPARAM_MX]; nx = iparam[IPARAM_NX]; -#ifndef TIMING_LAPACKE /* Initialize MORSE */ MORSE_Init( iparam[IPARAM_THRDNBR], iparam[IPARAM_NCUDAS] ); @@ -720,37 +709,27 @@ main(int argc, char *argv[]) { if (step < 1) step = 1; - status = Test( -1, iparam ); /* print header */ + int status = Test( -1, iparam ); /* print header */ if (status != MORSE_SUCCESS) return status; - if ( n == -1 ){ - for (i = start; i <= stop; i += step) - { - if ( nx > 0 ) { - iparam[IPARAM_M] = i; + for (i = start; i <= stop; i += step) + { + if ( nx > 0 ) { + iparam[IPARAM_M] = i; iparam[IPARAM_N] = chameleon_max(1, i/nx); - } else if ( mx > 0 ) { - iparam[IPARAM_M] = chameleon_max(1, i/mx); - iparam[IPARAM_N] = i; - } else { - if ( m == -1 ) - iparam[IPARAM_M] = i; - iparam[IPARAM_N] = i; - } - status = Test( iparam[IPARAM_N], iparam ); - if (status != MORSE_SUCCESS) return status; - success += status; + } else if ( mx > 0 ) { + iparam[IPARAM_M] = chameleon_max(1, i/mx); + iparam[IPARAM_N] = i; + } else { + if ( m == -1 ) + iparam[IPARAM_M] = i; + iparam[IPARAM_N] = i; } - } else{ - if ( m == -1 ) - iparam[IPARAM_M] = n; - iparam[IPARAM_N] = n; - status = Test( iparam[IPARAM_N], iparam ); + int status = Test( iparam[IPARAM_N], iparam ); if (status != MORSE_SUCCESS) return status; success += status; } -#ifndef TIMING_LAPACKE + MORSE_Finalize(); -#endif return success; } -- GitLab