Mentions légales du service

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

control/desc: Add a print function to debug descriptors and an associated...

control/desc: Add a print function to debug descriptors and an associated testing mainly for debug purpose
parent f4b6e9fd
No related branches found
No related tags found
1 merge request!256Update on descriptors
...@@ -976,3 +976,48 @@ void CHAMELEON_user_tag_size(int user_tag_width, int user_tag_sep) { ...@@ -976,3 +976,48 @@ void CHAMELEON_user_tag_size(int user_tag_width, int user_tag_sep) {
RUNTIME_comm_set_tag_sizes( user_tag_width, user_tag_sep ); RUNTIME_comm_set_tag_sizes( user_tag_width, user_tag_sep );
return; return;
} }
static void
chameleon_desc_print( const CHAM_desc_t *desc, int shift )
{
intptr_t base = (intptr_t)desc->mat;
int m, n;
for ( n=0; n<desc->nt; n++ ) {
for ( m=0; m<desc->mt; m++ ) {
const CHAM_tile_t *tile;
const CHAM_desc_t *tiledesc;
intptr_t ptr;
tile = desc->get_blktile( desc, m, n );
tiledesc = tile->mat;
ptr = ( tile->format == CHAMELEON_TILE_DESC ) ? (intptr_t)(tiledesc->mat) : (intptr_t)(tile->mat);
fprintf( stdout, "%*s%s(%3d,%3d): %d * %d / ld = %d / offset= %ld\n",
shift, " ", desc->name, m, n, tile->m, tile->n, tile->ld, ptr - base );
if ( tile->format == CHAMELEON_TILE_DESC ) {
chameleon_desc_print( tiledesc, shift+2 );
}
}
}
}
/**
*****************************************************************************
*
* @ingroup Descriptor
*
* @brief Print descriptor structure for debug purpose
*
******************************************************************************
*
* @param[in] desc
* The input desc for which to describe to print the tile structure
*/
void
CHAMELEON_Desc_Print( const CHAM_desc_t *desc )
{
chameleon_desc_print( desc, 2 );
}
...@@ -140,6 +140,7 @@ int CHAMELEON_Desc_Acquire( const CHAM_desc_t *desc ); ...@@ -140,6 +140,7 @@ int CHAMELEON_Desc_Acquire( const CHAM_desc_t *desc );
int CHAMELEON_Desc_Release( const CHAM_desc_t *desc ); int CHAMELEON_Desc_Release( const CHAM_desc_t *desc );
int CHAMELEON_Desc_Flush ( const CHAM_desc_t *desc, int CHAMELEON_Desc_Flush ( const CHAM_desc_t *desc,
const RUNTIME_sequence_t *sequence ); const RUNTIME_sequence_t *sequence );
void CHAMELEON_Desc_Print( const CHAM_desc_t *desc );
/* Workspaces */ /* Workspaces */
int CHAMELEON_Dealloc_Workspace (CHAM_desc_t **desc); int CHAMELEON_Dealloc_Workspace (CHAM_desc_t **desc);
......
...@@ -45,6 +45,7 @@ set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};testing_include" CAC ...@@ -45,6 +45,7 @@ set(CHAMELEON_SOURCES_TARGETS "${CHAMELEON_SOURCES_TARGETS};testing_include" CAC
set(ZSRC set(ZSRC
chameleon_ztesting.c chameleon_ztesting.c
testing_zcheck.c testing_zcheck.c
testing_zprint.c
################## ##################
# LAPACK # LAPACK
################## ##################
......
...@@ -26,7 +26,7 @@ if (NOT CHAMELEON_SIMULATION) ...@@ -26,7 +26,7 @@ if (NOT CHAMELEON_SIMULATION)
# #
# Create the list of test based on precision and runtime # Create the list of test based on precision and runtime
# #
set( TESTS lacpy lange lantr lansy plrnk ) set( TESTS print lacpy lange lantr lansy plrnk )
if ( ${prec} STREQUAL c OR ${prec} STREQUAL z ) if ( ${prec} STREQUAL c OR ${prec} STREQUAL z )
set( TESTS ${TESTS} lanhe ) set( TESTS ${TESTS} lanhe )
endif() endif()
......
# You can enumerate each parameter's values as an explicit list separated by commas or by a range start:end[:step]
# Not given parameters will receive default values
# LACPY
# nb: Tile size
# ib: Inner tile size
# uplo: Part of the matrix to be copied (0 for Upper, 1 for Lower and 2 for UpperLower)
# M: Number of rows of matrices A and C
# N: Number of columns of matrices B and C
# LDA: Leading dimension of matrix A
# LDB: Leading dimension of matrix B
op = print
nb = 16, 17
ib = 8
m = 13:45:16
n = 15:52:16
lda = 65
/**
*
* @file testing_zprint.c
*
* @copyright 2019-2021 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon zprint testing
*
* @version 1.1.0
* @author Lucas Barros de Assis
* @author Mathieu Faverge
* @date 2020-11-19
* @precisions normal z -> c d s
*
*/
#include <chameleon.h>
#include "testings.h"
#include "testing_zcheck.h"
#include <chameleon/flops.h>
/**
* Internal function to return address of block (m,n) with m,n = block indices
*/
inline static void *chameleon_getaddr_cm(const CHAM_desc_t *A, int m, int n)
{
size_t mm = m + A->i / A->mb;
size_t nn = n + A->j / A->nb;
size_t eltsize = CHAMELEON_Element_Size(A->dtyp);
size_t offset = 0;
#if defined(CHAMELEON_USE_MPI)
assert( A->myrank == A->get_rankof( A, mm, nn) );
mm = mm / A->p;
nn = nn / A->q;
#endif
offset = (size_t)(A->llm * A->nb) * nn + (size_t)(A->mb) * mm;
return (void*)((intptr_t)A->mat + (offset*eltsize) );
}
inline static int chameleon_getblkldd_cm(const CHAM_desc_t *A, int m) {
(void)m;
return A->llm;
}
int
testing_zprint( run_arg_list_t *args, int check )
{
int hres = 0;
CHAM_desc_t *descA;
/* Reads arguments */
intptr_t mtxfmt = parameters_getvalue_int( "mtxfmt" );
int nb = run_arg_get_int( args, "nb", 320 );
int P = parameters_getvalue_int( "P" );
int N = run_arg_get_int( args, "N", 1000 );
int M = run_arg_get_int( args, "M", N );
int LDA = run_arg_get_int( args, "LDA", M );
int l1 = run_arg_get_int( args, "l1", nb / 2 );
int l2 = run_arg_get_int( args, "l2", l1 / 3 );
int l3 = run_arg_get_int( args, "l3", l2 / 2 );
int Q = parameters_compute_q( P );
int list_nb[] = { nb, l1, l2, l3, 0 };
CHAMELEON_Set( CHAMELEON_TILE_SIZE, nb );
fprintf( stdout, "--- Tile layout ---\n" );
CHAMELEON_Desc_Create(
&descA, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDA, N, 0, 0, M, N, P, Q );
CHAMELEON_Desc_Print( descA );
CHAMELEON_Desc_Destroy( &descA );
fprintf( stdout, "--- Lapacke layout ---\n" );
CHAMELEON_Desc_Create_User(
&descA, (void*)(-mtxfmt), ChamComplexDouble, nb, nb, nb * nb, LDA, N, 0, 0, M, N, P, Q,
chameleon_getaddr_cm, chameleon_getblkldd_cm, NULL );
CHAMELEON_Desc_Print( descA );
CHAMELEON_Desc_Destroy( &descA );
fprintf( stdout, "--- Recursive layout (Tile)---\n" );
CHAMELEON_Recursive_Desc_Create(
&descA, CHAMELEON_MAT_ALLOC_GLOBAL, ChamComplexDouble,
list_nb, list_nb, LDA, N, M, N, P, Q,
NULL, NULL, NULL );
CHAMELEON_Desc_Print( descA );
CHAMELEON_Desc_Destroy( &descA );
fprintf( stdout, "--- Recursive layout (Lapack) ---\n" );
CHAMELEON_Recursive_Desc_Create(
&descA, CHAMELEON_MAT_ALLOC_GLOBAL, ChamComplexDouble,
list_nb, list_nb, LDA, N, M, N, P, Q,
chameleon_getaddr_cm, chameleon_getblkldd_cm, NULL );
CHAMELEON_Desc_Print( descA );
CHAMELEON_Desc_Destroy( &descA );
run_arg_add_fixdbl( args, "time", 1. );
run_arg_add_fixdbl( args, "gflops", 1. );
return hres;
}
testing_t test_zprint;
const char *zprint_params[] = { "mtxfmt", "nb", "l1", "l2", "l3", "m", "n", "lda", NULL };
const char *zprint_output[] = { NULL };
const char *zprint_outchk[] = { "RETURN", NULL };
/**
* @brief Testing registration function
*/
void testing_zprint_init( void ) __attribute__( ( constructor ) );
void
testing_zprint_init( void )
{
test_zprint.name = "zprint";
test_zprint.helper = "Print descriptors";
test_zprint.params = zprint_params;
test_zprint.output = zprint_output;
test_zprint.outchk = zprint_outchk;
test_zprint.fptr = testing_zprint;
test_zprint.next = NULL;
testing_register( &test_zprint );
}
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