Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1a37c04c authored by Matthieu Kuhn's avatar Matthieu Kuhn Committed by Mathieu Faverge
Browse files

codelets: Add the ipiv_to_perm codelet

parent 6f6e41de
No related branches found
No related tags found
1 merge request!404GETRF: add panel permutation to get a full partial pivoting available
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
* @author Mathieu Faverge * @author Mathieu Faverge
* @author Cedric Augonnet * @author Cedric Augonnet
* @author Florent Pruvost * @author Florent Pruvost
* @date 2023-07-06 * @author Matthieu Kuhn
* @date 2023-08-31
* *
*/ */
#ifndef _chameleon_tasks_h_ #ifndef _chameleon_tasks_h_
...@@ -121,6 +122,10 @@ void INSERT_TASK_hgemm( const RUNTIME_option_t *options, ...@@ -121,6 +122,10 @@ void INSERT_TASK_hgemm( const RUNTIME_option_t *options,
const CHAM_desc_t *B, int Bm, int Bn, const CHAM_desc_t *B, int Bm, int Bn,
CHAMELEON_Real16_t beta, const CHAM_desc_t *C, int Cm, int Cn ); CHAMELEON_Real16_t beta, const CHAM_desc_t *C, int Cm, int Cn );
void INSERT_TASK_ipiv_to_perm( const RUNTIME_option_t *options,
int m0, int m, int k,
const CHAM_ipiv_t *ipivdesc, int ipivk );
#include "chameleon/tasks_z.h" #include "chameleon/tasks_z.h"
#include "chameleon/tasks_d.h" #include "chameleon/tasks_d.h"
#include "chameleon/tasks_c.h" #include "chameleon/tasks_c.h"
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
# @author Florent Pruvost # @author Florent Pruvost
# @author Philippe Virouleau # @author Philippe Virouleau
# @author Matthieu Kuhn # @author Matthieu Kuhn
# @date 2023-08-22 # @date 2023-08-31
# #
### ###
...@@ -124,6 +124,7 @@ set(CODELETS_ZSRC ...@@ -124,6 +124,7 @@ set(CODELETS_ZSRC
set(CODELETS_SRC set(CODELETS_SRC
codelets/codelet_map.c codelets/codelet_map.c
codelets/codelet_ipiv_to_perm.c
) )
# Check for the subdirectories # Check for the subdirectories
......
/**
*
* @file openmp/codelet_ipiv_to_perm.c
*
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon OpenMP codelets to convert pivot to permutations
*
* @version 1.3.0
* @author Mathieu Faverge
* @author Matthieu Kuhn
* @date 2023-08-31
*
*/
#include "chameleon_openmp.h"
#include "chameleon/tasks.h"
#include "coreblas.h"
void INSERT_TASK_ipiv_to_perm( const RUNTIME_option_t *options,
int m0, int m, int k,
const CHAM_ipiv_t *ipivdesc, int ipivk )
{
int *ipiv = NULL; // get pointer from ipivdesc
int *perm = NULL; // get pointer from ipivdesc
int *invp = NULL; // get pointer from ipivdesc
#pragma omp task firstprivate( m0, m, k ) depend( in:ipiv[0] ) depend( inout:perm[0] ) depend( inout:invp[0] )
{
CORE_ipiv_to_perm( m0, m, k, ipiv, perm, invp );
}
(void)options;
(void)ipivk;
}
/**
*
* @file parsec/codelet_ipiv_to_perm.c
*
* @copyright 2023-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon Parsec codelets to convert pivot to permutations
*
* @version 1.3.0
* @author Mathieu Faverge
* @author Matthieu Kuhn
* @date 2023-08-31
*
*/
#include "chameleon_parsec.h"
#include "chameleon/tasks.h"
#include "coreblas.h"
static inline int
CORE_ipiv_to_perm_parsec( parsec_execution_stream_t *context,
parsec_task_t *this_task )
{
int m0, m, k;
int *ipiv, *perm, *invp;
parsec_dtd_unpack_args(
this_task, &m0, &m, &k, &ipiv, &perm, &invp );
CORE_ipiv_to_perm( m0, m, k, ipiv, perm, invp );
}
void INSERT_TASK_ipiv_to_perm( const RUNTIME_option_t *options,
int m0, int m, int k,
const CHAM_ipiv_t *ipivdesc, int ipivk )
{
parsec_taskpool_t* PARSEC_dtd_taskpool = (parsec_taskpool_t *)(options->sequence->schedopt);
parsec_dtd_taskpool_insert_task(
PARSEC_dtd_taskpool, CORE_ipiv_to_perm_parsec, options->priority, "ipiv_to_perm",
sizeof(int), &m0, VALUE,
sizeof(int), &m, VALUE,
sizeof(int), &k, VALUE,
PASSED_BY_REF, RUNTIME_ipiv_getaddr( ipivdesc, ipivk ), chameleon_parsec_get_arena_index_ipiv( ipivdesc ) | INPUT,
PASSED_BY_REF, RUNTIME_perm_getaddr( ipivdesc, ipivk ), chameleon_parsec_get_arena_index_perm( ipivdesc ) | OUTPUT,
PASSED_BY_REF, RUNTIME_invp_getaddr( ipivdesc, ipivk ), chameleon_parsec_get_arena_index_invp( ipivdesc ) | OUTPUT,
PARSEC_DTD_ARG_END );
}
/**
*
* @file quark/codelet_ipiv_to_perm.c
*
* @copyright 2023-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon Quark codelets to convert pivot to permutations
*
* @version 1.3.0
* @author Mathieu Faverge
* @author Matthieu Kuhn
* @date 2023-08-31
*
*/
#include "chameleon_quark.h"
#include "chameleon/tasks.h"
#include "coreblas.h"
static inline void
CORE_ipiv_to_perm_quark( Quark *quark )
{
int m0, m, k;
int *ipiv, *perm, *invp;
quark_unpack_args_6( quark, m0, m, k, ipiv, perm, invp );
CORE_ipiv_to_perm( m0, m, k, ipiv, perm, invp );
}
void INSERT_TASK_ipiv_to_perm( const RUNTIME_option_t *options,
int m0, int m, int k,
const CHAM_ipiv_t *ipivdesc, int ipivk )
{
quark_option_t *opt = (quark_option_t*)(options->schedopt);
QUARK_Insert_Task(
opt->quark, CORE_ipiv_to_perm_quark, (Quark_Task_Flags*)opt,
sizeof(int), &m0, VALUE,
sizeof(int), &m, VALUE,
sizeof(int), &k, VALUE,
sizeof(int*), RUNTIME_ipiv_getaddr( ipivdesc, ipivk ), INPUT,
sizeof(int*), RUNTIME_perm_getaddr( ipivdesc, ipivk ), OUTPUT,
sizeof(int*), RUNTIME_invp_getaddr( ipivdesc, ipivk ), OUTPUT,
0 );
}
/**
*
* @file starpu/codelet_ipiv_to_perm.c
*
* @copyright 2012-2023 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
* Univ. Bordeaux. All rights reserved.
*
***
*
* @brief Chameleon StarPU codelets to convert pivot to permutations
*
* @version 1.3.0
* @author Mathieu Faverge
* @author Matthieu Kuhn
* @date 2023-08-31
*
*/
#include "chameleon_starpu.h"
#include "runtime_codelets.h"
#if !defined(CHAMELEON_SIMULATION)
static void cl_ipiv_to_perm_cpu_func( void *descr[], void *cl_arg )
{
int m0, m, k;
int *ipiv, *perm, *invp;
starpu_codelet_unpack_args( cl_arg, &m0, &m, &k );
ipiv = (int*)STARPU_VECTOR_GET_PTR(descr[0]);
perm = (int*)STARPU_VECTOR_GET_PTR(descr[1]);
invp = (int*)STARPU_VECTOR_GET_PTR(descr[2]);
CORE_ipiv_to_perm( m0, m, k, ipiv, perm, invp );
}
#endif /* !defined(CHAMELEON_SIMULATION) */
/*
* Codelet definition
*/
static struct starpu_codelet cl_ipiv_to_perm = {
.where = STARPU_CPU,
#if defined(CHAMELEON_SIMULATION)
.cpu_funcs[0] = (starpu_cpu_func_t)1,
#else
.cpu_funcs[0] = cl_ipiv_to_perm_cpu_func,
#endif
.nbuffers = 3,
.model = NULL,
.name = "ipiv_to_perm"
};
void INSERT_TASK_ipiv_to_perm( const RUNTIME_option_t *options,
int m0, int m, int k,
const CHAM_ipiv_t *ipivdesc, int ipivk )
{
struct starpu_codelet *codelet = &cl_ipiv_to_perm;
rt_starpu_insert_task(
codelet,
STARPU_VALUE, &m0, sizeof(int),
STARPU_VALUE, &m, sizeof(int),
STARPU_VALUE, &k, sizeof(int),
STARPU_R, RUNTIME_ipiv_getaddr( ipivdesc, ipivk ),
STARPU_W, RUNTIME_perm_getaddr( ipivdesc, ipivk ),
STARPU_W, RUNTIME_invp_getaddr( ipivdesc, ipivk ),
STARPU_PRIORITY, options->priority,
STARPU_EXECUTE_ON_WORKER, options->workerid,
0 );
}
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "runtime_codelet_profile.h" #include "runtime_codelet_profile.h"
#if !defined(CHAMELEON_SIMULATION) #if !defined(CHAMELEON_SIMULATION)
#include "coreblas.h"
#if defined(CHAMELEON_USE_CUDA) #if defined(CHAMELEON_USE_CUDA)
#include "gpucublas.h" #include "gpucublas.h"
#endif #endif
......
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