Commit 39e82131 authored by Mathieu Faverge's avatar Mathieu Faverge

Update the parsec interface

parent 26f9fc70
......@@ -33,11 +33,13 @@ void MORSE_TASK_flush_data( const MORSE_option_t *options,
void MORSE_TASK_flush_desc( const MORSE_option_t *options,
MORSE_enum uplo, const MORSE_desc_t *A )
{
parsec_taskpool_t* PARSEC_dtd_taskpool = (parsec_taskpool_t *)(options->sequence->schedopt);
/* parsec_taskpool_t* PARSEC_dtd_taskpool = (parsec_taskpool_t *)(options->sequence->schedopt); */
parsec_dtd_data_flush_all( PARSEC_dtd_taskpool, (parsec_data_collection_t*)(A->schedopt) );
/* parsec_dtd_data_flush_all( PARSEC_dtd_taskpool, (parsec_data_collection_t*)(A->schedopt) ); */
(void)options;
(void)uplo;
(void)A;
}
void MORSE_TASK_flush_all()
......
/**
*
* @copyright (c) 2009-2015 The University of Tennessee and The University
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2015 Inria. All rights reserved.
* @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* @copyright 2012-2017 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 runtime_async.c
*
* @version 1.0.0
* @author Reazul Hoque
* @author Mathieu Faverge
* @date 2017-01-12
*
**/
#include <stdlib.h>
......@@ -13,7 +19,8 @@
/*******************************************************************************
* Create a sequence
**/
int RUNTIME_sequence_create(MORSE_context_t *morse, MORSE_sequence_t *sequence)
int RUNTIME_sequence_create( MORSE_context_t *morse,
MORSE_sequence_t *sequence )
{
parsec_context_t *parsec = (parsec_context_t *)morse->schedopt;
parsec_taskpool_t *parsec_dtd_tp = parsec_dtd_taskpool_new();
......@@ -29,7 +36,8 @@ int RUNTIME_sequence_create(MORSE_context_t *morse, MORSE_sequence_t *sequence)
/*******************************************************************************
* Destroy a sequence
**/
int RUNTIME_sequence_destroy(MORSE_context_t *morse, MORSE_sequence_t *sequence)
int RUNTIME_sequence_destroy( MORSE_context_t *morse,
MORSE_sequence_t *sequence )
{
parsec_context_t *parsec = (parsec_context_t *)morse->schedopt;
parsec_taskpool_t *parsec_dtd_tp = (parsec_taskpool_t *) sequence->schedopt;
......@@ -50,7 +58,8 @@ int RUNTIME_sequence_destroy(MORSE_context_t *morse, MORSE_sequence_t *sequence)
/*******************************************************************************
* Wait for the completion of a sequence
**/
int RUNTIME_sequence_wait(MORSE_context_t *morse, MORSE_sequence_t *sequence )
int RUNTIME_sequence_wait( MORSE_context_t *morse,
MORSE_sequence_t *sequence )
{
parsec_context_t *parsec = (parsec_context_t *)morse->schedopt;
parsec_taskpool_t *parsec_dtd_tp = (parsec_taskpool_t *) sequence->schedopt;
......@@ -65,13 +74,13 @@ int RUNTIME_sequence_wait(MORSE_context_t *morse, MORSE_sequence_t *sequence )
/*******************************************************************************
* Terminate a sequence
**/
void RUNTIME_sequence_flush(void *schedopt, MORSE_sequence_t *sequence, MORSE_request_t *request, int status)
void RUNTIME_sequence_flush( MORSE_context_t *morse,
MORSE_sequence_t *sequence,
MORSE_request_t *request,
int status )
{
parsec_context_t *parsec = (parsec_context_t *)schedopt;
(void)schedopt;
sequence->request = request;
sequence->status = status;
request->status = status;
return;
}
/**
*
* @copyright (c) 2009-2015 The University of Tennessee and The University
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2015 Inria. All rights reserved.
* @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* @copyright 2012-2017 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 runtime_context.c
*
* @version 1.0.0
* @author Reazul Hoque
* @author Mathieu Faverge
* @date 2017-01-12
*
**/
#include <stdlib.h>
......@@ -13,7 +19,7 @@
/*******************************************************************************
* Create new context
**/
void RUNTIME_context_create(MORSE_context_t *morse)
void RUNTIME_context_create( MORSE_context_t *morse )
{
/* In case of PaRSEC, this is done in init */
morse->scheduler = RUNTIME_SCHED_PARSEC;
......@@ -23,8 +29,7 @@ void RUNTIME_context_create(MORSE_context_t *morse)
/*******************************************************************************
* Clean the context
**/
void RUNTIME_context_destroy(MORSE_context_t *morse)
void RUNTIME_context_destroy( MORSE_context_t *morse )
{
(void)morse;
return;
......@@ -37,12 +42,10 @@ void RUNTIME_enable(MORSE_enum lever)
{
switch (lever)
{
case MORSE_PROFILING_MODE:
// TODO: check correctly for this
//dague_profiling_start();
break;
default:
return;
case MORSE_PROFILING_MODE:
break;
default:
return;
}
return;
}
......@@ -54,12 +57,10 @@ void RUNTIME_disable(MORSE_enum lever)
{
switch (lever)
{
case MORSE_PROFILING_MODE:
// TODO: check correctly for this
//dague_profiling_stop();
break;
default:
return;
case MORSE_PROFILING_MODE:
break;
default:
return;
}
return;
}
/**
*
* @copyright (c) 2009-2015 The University of Tennessee and The University
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2015 Inria. All rights reserved.
* @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* @copyright 2012-2017 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 runtime_control.c
*
* @version 1.0.0
* @author Reazul Hoque
* @author Mathieu Faverge
* @date 2017-01-12
*
**/
#include <stdio.h>
......@@ -15,32 +21,27 @@
#include <mpi.h>
#endif
/*******************************************************************************
* Thread rank.
**/
int RUNTIME_rank(MORSE_context_t *morse)
{
return 0;
}
/*******************************************************************************
* Initialize MORSE
**/
int RUNTIME_init_scheduler(MORSE_context_t *morse, int nworkers, int ncudas, int nthreads_per_worker)
int RUNTIME_init( MORSE_context_t *morse,
int ncpus,
int ncudas,
int nthreads_per_worker )
{
int hres = -1, default_ncores = -1;
int *argc = (int *)malloc(sizeof(int));
*argc = 0;
/* Initializing parsec context */
if( 0 < nworkers ) {
default_ncores = nworkers;
if( 0 < ncpus ) {
default_ncores = ncpus;
}
morse->parallel_enabled = MORSE_TRUE;
morse->schedopt = (void *)parsec_init(default_ncores, argc, NULL);
if(NULL != morse->schedopt) {
morse->nworkers = nworkers;
morse->nworkers = ncpus;
morse->nthreads_per_worker = nthreads_per_worker;
hres = 0;
}
......@@ -52,7 +53,7 @@ int RUNTIME_init_scheduler(MORSE_context_t *morse, int nworkers, int ncudas, int
/*******************************************************************************
* Finalize MORSE
*/
void RUNTIME_finalize_scheduler(MORSE_context_t *morse)
void RUNTIME_finalize( MORSE_context_t *morse )
{
parsec_context_t *parsec = (parsec_context_t*)morse->schedopt;
parsec_fini(&parsec);
......@@ -60,81 +61,86 @@ void RUNTIME_finalize_scheduler(MORSE_context_t *morse)
}
/*******************************************************************************
* Barrier MORSE.
* To suspend the processing of new tasks by workers
**/
void RUNTIME_barrier(MORSE_context_t *morse)
void RUNTIME_pause( MORSE_context_t *morse )
{
parsec_context_t *parsec = (parsec_context_t*)morse->schedopt;
// This will be a problem with the fake tasks inserted to detect end of DTD algorithms
//parsec_context_wait( parsec );
(void)morse;
return;
}
/*******************************************************************************
* Set iteration numbers for traces
* This is the symmetrical call to RUNTIME_pause,
* used to resume the workers polling for new tasks.
**/
void RUNTIME_iteration_push( MORSE_context_t *morse, unsigned long iteration )
void RUNTIME_resume( MORSE_context_t *morse )
{
(void)morse; (void)iteration;
(void)morse;
return;
}
void RUNTIME_iteration_pop( MORSE_context_t *morse )
/*******************************************************************************
* Barrier MORSE.
**/
void RUNTIME_barrier( MORSE_context_t *morse )
{
(void)morse;
parsec_context_t *parsec = (parsec_context_t*)morse->schedopt;
// This will be a problem with the fake tasks inserted to detect end of DTD algorithms
parsec_context_wait( parsec );
return;
}
/*******************************************************************************
* To suspend the processing of new tasks by workers
* Display a progress information when executing the tasks
**/
void RUNTIME_pause( MORSE_context_t *morse )
void RUNTIME_progress( MORSE_context_t *morse )
{
(void)morse;
return;
}
/*******************************************************************************
* This is the symmetrical call to RUNTIME_pause,
* used to resume the workers polling for new tasks.
* Thread rank.
**/
void RUNTIME_resume( MORSE_context_t *morse )
int RUNTIME_thread_rank( MORSE_context_t *morse )
{
(void)morse;
return;
return 0;
}
/*******************************************************************************
* This returns the rank of this process
* Thread rank.
**/
void RUNTIME_comm_rank( int *rank )
int RUNTIME_thread_size( MORSE_context_t *morse )
{
#if defined(CHAMELEON_USE_MPI)
MPI_Comm_rank(MPI_COMM_WORLD, rank);
#else
*rank = 0;
#endif
return;
// TODO: fixme
//return vpmap_get_nb_total_threads();
return 1;
}
/*******************************************************************************
* This returns the size of the distributed computation
* This returns the rank of this process
**/
void RUNTIME_comm_size( int *size )
int RUNTIME_comm_rank( MORSE_context_t *morse )
{
int rank = 0;
#if defined(CHAMELEON_USE_MPI)
MPI_Comm_size(MPI_COMM_WORLD, size);
#else
*size = 1;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
#endif
return;
(void)morse;
return rank;
}
/*******************************************************************************
* This returns the number of workers
* This returns the size of the distributed computation
**/
int RUNTIME_get_thread_nbr()
int RUNTIME_comm_size( MORSE_context_t *morse )
{
// TODO: fixme
//return vpmap_get_nb_total_threads();
return 0;
int size = 0;
#if defined(CHAMELEON_USE_MPI)
MPI_Comm_size(MPI_COMM_WORLD, &size);
#endif
(void)morse;
return size;
}
/**
*
* @copyright (c) 2009-2015 The University of Tennessee and The University
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2015 Inria. All rights reserved.
* @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* @copyright 2012-2017 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 runtime_descriptor.c
*
* @version 1.0.0
* @author Reazul Hoque
* @author Mathieu Faverge
* @date 2017-01-12
*
**/
#include <stdlib.h>
#include "chameleon_parsec.h"
#include <parsec/data.h>
#include <parsec/datatype.h>
#include <parsec/data_dist/matrix/matrix.h>
//#include <parsec/data_dist/matrix/matrix.h>
#include <parsec/arena.h>
static int parsec_global_arena_index = 0;
void RUNTIME_user_tag_size(int user_tag_width, int user_tag_sep) {
(void)user_tag_width;
(void)user_tag_sep;
void RUNTIME_comm_set_tag_sizes( int user_tag_width,
int user_tag_sep )
{
(void)user_tag_width;
(void)user_tag_sep;
}
void *RUNTIME_mat_alloc( size_t size)
void *RUNTIME_malloc( size_t size )
{
return malloc(size);
}
void RUNTIME_mat_free( void *mat, size_t size)
void RUNTIME_free( void *ptr, size_t size )
{
(void)size;
free(mat);
free(ptr);
return;
}
......@@ -40,11 +48,12 @@ struct morse_parsec_desc_s {
int arena_index;
};
int morse_parsec_get_arena_index(const MORSE_desc_t *desc) {
int
morse_parsec_get_arena_index(const MORSE_desc_t *desc) {
return ((morse_parsec_desc_t *)desc->schedopt)->arena_index;
}
static void
static inline void
morse_parsec_key_to_coordinates(parsec_data_collection_t *data_collection, parsec_data_key_t key,
int *m, int *n)
{
......@@ -58,7 +67,7 @@ morse_parsec_key_to_coordinates(parsec_data_collection_t *data_collection, parse
*n = _n - mdesc->j / mdesc->nb;
}
static parsec_data_key_t
static inline parsec_data_key_t
morse_parsec_data_key(parsec_data_collection_t *data_collection, ...)
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
......@@ -79,7 +88,7 @@ morse_parsec_data_key(parsec_data_collection_t *data_collection, ...)
return ((n * mdesc->lmt) + m);
}
static uint32_t
static inline uint32_t
morse_parsec_rank_of(parsec_data_collection_t *data_collection, ...)
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
......@@ -100,7 +109,7 @@ morse_parsec_rank_of(parsec_data_collection_t *data_collection, ...)
return mdesc->get_rankof( mdesc, m, n );
}
static uint32_t
static inline uint32_t
morse_parsec_rank_of_key(parsec_data_collection_t *data_collection, parsec_data_key_t key)
{
int m, n;
......@@ -108,13 +117,13 @@ morse_parsec_rank_of_key(parsec_data_collection_t *data_collection, parsec_data_
return morse_parsec_rank_of(data_collection, m, n);
}
static int32_t
static inline int32_t
morse_parsec_vpid_of(parsec_data_collection_t *data_collection, ...)
{
return 0;
}
static int32_t
static inline int32_t
morse_parsec_vpid_of_key(parsec_data_collection_t *data_collection, parsec_data_key_t key)
{
int m, n;
......@@ -122,7 +131,7 @@ morse_parsec_vpid_of_key(parsec_data_collection_t *data_collection, parsec_data_
return morse_parsec_vpid_of(data_collection, m, n);
}
static parsec_data_t*
static inline parsec_data_t*
morse_parsec_data_of(parsec_data_collection_t *data_collection, ...)
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
......@@ -145,12 +154,12 @@ morse_parsec_data_of(parsec_data_collection_t *data_collection, ...)
//assert( data_collection->nodes == 1 );
#endif
return parsec_data_create( pdesc->data_map + n * mdesc->lmt + m, data_collection,
morse_parsec_data_key( data_collection, m, n ),
mdesc->get_blkaddr( mdesc, m, n ),
mdesc->bsiz * MORSE_Element_Size(mdesc->dtyp) );
morse_parsec_data_key( data_collection, m, n ),
mdesc->get_blkaddr( mdesc, m, n ),
mdesc->bsiz * MORSE_Element_Size(mdesc->dtyp) );
}
static parsec_data_t*
static inline parsec_data_t*
morse_parsec_data_of_key(parsec_data_collection_t *data_collection, parsec_data_key_t key)
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
......@@ -163,12 +172,12 @@ morse_parsec_data_of_key(parsec_data_collection_t *data_collection, parsec_data_
//assert( data_collection->nodes == 1 );
#endif
return parsec_data_create( pdesc->data_map + key, data_collection, key,
mdesc->get_blkaddr( mdesc, m, n ),
mdesc->bsiz * MORSE_Element_Size(mdesc->dtyp) );
mdesc->get_blkaddr( mdesc, m, n ),
mdesc->bsiz * MORSE_Element_Size(mdesc->dtyp) );
}
#ifdef parsec_PROF_TRACE
static int
static inline int
morse_parsec_key_to_string(parsec_data_collection_t *data_collection, parsec_data_key_t key, char * buffer, uint32_t buffer_size)
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
......@@ -184,15 +193,12 @@ morse_parsec_key_to_string(parsec_data_collection_t *data_collection, parsec_dat
}
#endif
void RUNTIME_desc_init( MORSE_desc_t *mdesc )
{
(void)mdesc;
return;
}
/*******************************************************************************
* Create data descriptor
**/
void RUNTIME_desc_create( MORSE_desc_t *mdesc )
{
parsec_data_collection_t *data_collection;
parsec_data_collection_t *data_collection;
morse_parsec_desc_t *pdesc;
int comm_size;
......@@ -200,7 +206,7 @@ void RUNTIME_desc_create( MORSE_desc_t *mdesc )
data_collection = (parsec_data_collection_t*)pdesc;
/* Super setup */
RUNTIME_comm_size( &comm_size );
comm_size = RUNTIME_comm_size( NULL );
data_collection->nodes = comm_size;
data_collection->myrank = mdesc->myrank;
......@@ -240,12 +246,12 @@ void RUNTIME_desc_create( MORSE_desc_t *mdesc )
parsec_datatype_t datatype;
switch(mdesc->dtyp) {
case MorseInteger: datatype = parsec_datatype_int32_t; break;
case MorseRealFloat: datatype = parsec_datatype_float_t; break;
case MorseRealDouble: datatype = parsec_datatype_double_t; break;
case MorseComplexFloat: datatype = parsec_datatype_complex_t; break;
case MorseComplexDouble: datatype = parsec_datatype_double_complex_t; break;
default: morse_fatal_error("MORSE_Element_Size", "undefined type"); break;
case MorseInteger: datatype = parsec_datatype_int32_t; break;
case MorseRealFloat: datatype = parsec_datatype_float_t; break;
case MorseRealDouble: datatype = parsec_datatype_double_t; break;
case MorseComplexFloat: datatype = parsec_datatype_complex_t; break;
case MorseComplexDouble: datatype = parsec_datatype_double_complex_t; break;
default: morse_fatal_error("MORSE_Element_Size", "undefined type"); break;
}
parsec_matrix_add2arena_tile( parsec_dtd_arenas[pdesc->arena_index], datatype, mdesc->mb*mdesc->nb*MORSE_Element_Size(mdesc->dtyp) );
......@@ -256,6 +262,9 @@ void RUNTIME_desc_create( MORSE_desc_t *mdesc )
return;
}
/*******************************************************************************
* Destroy data descriptor
**/
void RUNTIME_desc_destroy( MORSE_desc_t *mdesc )
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)(mdesc->schedopt);
......@@ -280,30 +289,49 @@ void RUNTIME_desc_destroy( MORSE_desc_t *mdesc )
return;
}
void RUNTIME_desc_submatrix( MORSE_desc_t *desc )
/*******************************************************************************
* Acquire data
**/
int RUNTIME_desc_acquire( const MORSE_desc_t *desc )
{
(void)desc;
return;
return MORSE_SUCCESS;
}
int RUNTIME_desc_acquire( MORSE_desc_t *desc )
/*******************************************************************************
* Release data
**/
int RUNTIME_desc_release( const MORSE_desc_t *desc )
{
(void)desc;
return MORSE_SUCCESS;
}
int RUNTIME_desc_release( MORSE_desc_t *desc )
/*******************************************************************************
* Get data on cpu - Synchronous call
**/
int RUNTIME_desc_getoncpu( const MORSE_desc_t *desc )
{
(void)desc;
return MORSE_SUCCESS;
}
int RUNTIME_desc_getoncpu( MORSE_desc_t *desc )
/*******************************************************************************
* Get data on cpu - Asynchronous call
**/
int RUNTIME_desc_getoncpu_async( const MORSE_desc_t *desc,
MORSE_sequence_t *sequence )
{
(void)desc;
parsec_taskpool_t* PARSEC_dtd_taskpool = (parsec_taskpool_t *)(sequence->schedopt);
parsec_dtd_data_flush_all( PARSEC_dtd_taskpool, (parsec_data_collection_t*)(desc->schedopt) );
return MORSE_SUCCESS;
}
/*******************************************************************************
* Get data addr
**/
void *RUNTIME_desc_getaddr( const MORSE_desc_t *desc, int m, int n )
{
assert(0); /* This should not be called because we also need the handle to match the address we need. */
......
/**
*
* @copyright (c) 2009-2015 The University of Tennessee and The University
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2015 Inria. All rights reserved.
* @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* @copyright 2012-2017 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 runtime_options.c
*
* @version 1.0.0
* @author Reazul Hoque
* @author Mathieu Faverge
* @date 2017-01-12
*
**/
#include <stdio.h>
......
/**
*
* @copyright (c) 2009-2015 The University of Tennessee and The University
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2015 Inria. All rights reserved.
* @copyright (c) 2012-2015 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
* @copyright 2012-2017 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 runtime_profiling.c
*
* @version 1.0.0
* @author Reazul Hoque
* @author Mathieu Faverge
* @date 2017-01-12
*
**/
#include "chameleon_parsec.h"
#include "chameleon_timer.h"
#include "chameleon/chameleon_timer.h"
double RUNTIME_get_time(){
return CHAMELEON_timer();
......@@ -43,3 +49,18 @@ void RUNTIME_kernelprofile_display(void)
{
morse_warning("RUNTIME_kernelprofile_display(parsec)", "Kernel profiling is not available with PaRSEC\n");
}
/*******************************************************************************
* Set iteration numbers for traces
**/
void RUNTIME_iteration_push( MORSE_context_t *morse, unsigned long iteration )
{
(void)morse; (void)iteration;
return;
}
void RUNTIME_iteration_pop( MORSE_context_t *morse )
{
(void)morse;
return;
}
/**
*
* @copyright (c) 2009-2015 The University of Tennessee and The University