Commit 74907797 authored by Mathieu Faverge's avatar Mathieu Faverge

Update contriold directory

parent 6e2d7fca
......@@ -15,15 +15,14 @@
**/
int RUNTIME_sequence_create(MORSE_context_t *morse, MORSE_sequence_t *sequence)
{
dague_context_t *dague = (dague_context_t *)morse->schedopt;
dague_dtd_handle_t *dague_dtd_handle = dague_dtd_handle_new((dague_context_t *)morse->schedopt);
parsec_context_t *parsec = (parsec_context_t *)morse->schedopt;
parsec_taskpool_t *parsec_dtd_tp = parsec_dtd_taskpool_new();
dague_enqueue(dague, (dague_handle_t*) dague_dtd_handle);
sequence->schedopt = dague_dtd_handle;
parsec_enqueue(parsec, (parsec_taskpool_t *) parsec_dtd_tp);
sequence->schedopt = parsec_dtd_tp;
parsec_context_start(parsec);
#if defined (OVERLAP)
dague_context_start(dague);
#endif
return MORSE_SUCCESS;
}
......@@ -32,14 +31,18 @@ int RUNTIME_sequence_create(MORSE_context_t *morse, MORSE_sequence_t *sequence)
**/
int RUNTIME_sequence_destroy(MORSE_context_t *morse, MORSE_sequence_t *sequence)
{
dague_context_t *dague = (dague_context_t *)morse->schedopt;
dague_dtd_handle_t *dague_dtd_handle = (dague_dtd_handle_t *) sequence->schedopt;
parsec_context_t *parsec = (parsec_context_t *)morse->schedopt;
parsec_taskpool_t *parsec_dtd_tp = (parsec_taskpool_t *) sequence->schedopt;
(void)morse;
assert( dague_dtd_handle );
assert( parsec_dtd_tp );
// TODO: switch to a patial wait
//parsec_dtd_taskpool_wait(parsec, parsec_dtd_tp);
parsec_context_wait(parsec);
parsec_taskpool_free(parsec_dtd_tp);
dague_dtd_context_wait_on_handle(dague, dague_dtd_handle);
dague_dtd_handle_destruct(dague_dtd_handle);
sequence->schedopt = NULL;
return MORSE_SUCCESS;
}
......@@ -49,12 +52,12 @@ int RUNTIME_sequence_destroy(MORSE_context_t *morse, MORSE_sequence_t *sequence)
**/
int RUNTIME_sequence_wait(MORSE_context_t *morse, MORSE_sequence_t *sequence )
{
dague_context_t *dague = (dague_context_t *)morse->schedopt;
dague_dtd_handle_t *dague_dtd_handle = (dague_dtd_handle_t *) sequence->schedopt;
parsec_context_t *parsec = (parsec_context_t *)morse->schedopt;
parsec_taskpool_t *parsec_dtd_tp = (parsec_taskpool_t *) sequence->schedopt;
assert( dague_dtd_handle );
assert( parsec_dtd_tp );
dague_dtd_handle_wait(dague, dague_dtd_handle);
parsec_dtd_taskpool_wait(parsec, parsec_dtd_tp);
return MORSE_SUCCESS;
}
......@@ -64,7 +67,7 @@ int RUNTIME_sequence_wait(MORSE_context_t *morse, MORSE_sequence_t *sequence )
**/
void RUNTIME_sequence_flush(void *schedopt, MORSE_sequence_t *sequence, MORSE_request_t *request, int status)
{
dague_context_t *dague = (dague_context_t *)schedopt;
parsec_context_t *parsec = (parsec_context_t *)schedopt;
(void)schedopt;
sequence->request = request;
sequence->status = status;
......
......@@ -11,6 +11,10 @@
#include <stdlib.h>
#include "chameleon_parsec.h"
#if defined(CHAMELEON_USE_MPI)
#include <mpi.h>
#endif
/*******************************************************************************
* Thread rank.
**/
......@@ -28,13 +32,13 @@ int RUNTIME_init_scheduler(MORSE_context_t *morse, int nworkers, int ncudas, int
int *argc = (int *)malloc(sizeof(int));
*argc = 0;
/* Initializing dague context */
/* Initializing parsec context */
if( 0 < nworkers ) {
default_ncores = nworkers;
}
morse->parallel_enabled = MORSE_TRUE;
morse->schedopt = (void *)dague_init(default_ncores, argc, NULL);
dague_dtd_init();
morse->schedopt = (void *)parsec_init(default_ncores, argc, NULL);
if(NULL != morse->schedopt) {
morse->nworkers = nworkers;
morse->nthreads_per_worker = nthreads_per_worker;
......@@ -50,9 +54,8 @@ int RUNTIME_init_scheduler(MORSE_context_t *morse, int nworkers, int ncudas, int
*/
void RUNTIME_finalize_scheduler(MORSE_context_t *morse)
{
dague_context_t *dague = (dague_context_t*)morse->schedopt;
dague_dtd_fini();
dague_fini(&dague);
parsec_context_t *parsec = (parsec_context_t*)morse->schedopt;
parsec_fini(&parsec);
return;
}
......@@ -61,9 +64,9 @@ void RUNTIME_finalize_scheduler(MORSE_context_t *morse)
**/
void RUNTIME_barrier(MORSE_context_t *morse)
{
dague_context_t *dague = (dague_context_t*)morse->schedopt;
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
//dague_context_wait( dague );
//parsec_context_wait( parsec );
return;
}
......@@ -131,5 +134,7 @@ void RUNTIME_comm_size( int *size )
**/
int RUNTIME_get_thread_nbr()
{
return vpmap_get_nb_total_threads();
// TODO: fixme
//return vpmap_get_nb_total_threads();
return 0;
}
......@@ -9,7 +9,12 @@
**/
#include <stdlib.h>
#include "chameleon_parsec.h"
#include <dague/data.h>
#include <parsec/data.h>
#include <parsec/datatype.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;
......@@ -29,16 +34,21 @@ void RUNTIME_mat_free( void *mat, size_t size)
}
struct morse_parsec_desc_s {
dague_ddesc_t super;
parsec_data_collection_t super;
MORSE_desc_t *desc;
dague_data_t **data_map;
parsec_data_t **data_map;
int arena_index;
};
int morse_parsec_get_arena_index(const MORSE_desc_t *desc) {
return ((morse_parsec_desc_t *)desc->schedopt)->arena_index;
}
static void
morse_parsec_key_to_coordinates(dague_ddesc_t *ddesc, dague_data_key_t key,
morse_parsec_key_to_coordinates(parsec_data_collection_t *data_collection, parsec_data_key_t key,
int *m, int *n)
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)ddesc;
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
MORSE_desc_t *mdesc = pdesc->desc;
int _m, _n;
......@@ -48,16 +58,16 @@ morse_parsec_key_to_coordinates(dague_ddesc_t *ddesc, dague_data_key_t key,
*n = _n - mdesc->j / mdesc->nb;
}
static dague_data_key_t
morse_parsec_data_key(dague_ddesc_t *ddesc, ...)
static parsec_data_key_t
morse_parsec_data_key(parsec_data_collection_t *data_collection, ...)
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)ddesc;
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
MORSE_desc_t *mdesc = pdesc->desc;
va_list ap;
int m, n;
/* Get coordinates */
va_start(ap, ddesc);
va_start(ap, data_collection);
m = va_arg(ap, unsigned int);
n = va_arg(ap, unsigned int);
va_end(ap);
......@@ -70,15 +80,15 @@ morse_parsec_data_key(dague_ddesc_t *ddesc, ...)
}
static uint32_t
morse_parsec_rank_of(dague_ddesc_t *ddesc, ...)
morse_parsec_rank_of(parsec_data_collection_t *data_collection, ...)
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)ddesc;
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
MORSE_desc_t *mdesc = pdesc->desc;
va_list ap;
int m, n;
/* Get coordinates */
va_start(ap, ddesc);
va_start(ap, data_collection);
m = va_arg(ap, unsigned int);
n = va_arg(ap, unsigned int);
va_end(ap);
......@@ -91,37 +101,37 @@ morse_parsec_rank_of(dague_ddesc_t *ddesc, ...)
}
static uint32_t
morse_parsec_rank_of_key(dague_ddesc_t *ddesc, dague_data_key_t key)
morse_parsec_rank_of_key(parsec_data_collection_t *data_collection, parsec_data_key_t key)
{
int m, n;
morse_parsec_key_to_coordinates(ddesc, key, &m, &n);
return morse_parsec_rank_of(ddesc, m, n);
morse_parsec_key_to_coordinates(data_collection, key, &m, &n);
return morse_parsec_rank_of(data_collection, m, n);
}
static int32_t
morse_parsec_vpid_of(dague_ddesc_t *ddesc, ...)
morse_parsec_vpid_of(parsec_data_collection_t *data_collection, ...)
{
return 0;
}
static int32_t
morse_parsec_vpid_of_key(dague_ddesc_t *ddesc, dague_data_key_t key)
morse_parsec_vpid_of_key(parsec_data_collection_t *data_collection, parsec_data_key_t key)
{
int m, n;
morse_parsec_key_to_coordinates(ddesc, key, &m, &n);
return morse_parsec_vpid_of(ddesc, m, n);
morse_parsec_key_to_coordinates(data_collection, key, &m, &n);
return morse_parsec_vpid_of(data_collection, m, n);
}
static dague_data_t*
morse_parsec_data_of(dague_ddesc_t *ddesc, ...)
static parsec_data_t*
morse_parsec_data_of(parsec_data_collection_t *data_collection, ...)
{
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)ddesc;
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
MORSE_desc_t *mdesc = pdesc->desc;
va_list ap;
int m, n;
/* Get coordinates */
va_start(ap, ddesc);
va_start(ap, data_collection);
m = va_arg(ap, unsigned int);
n = va_arg(ap, unsigned int);
va_end(ap);
......@@ -132,39 +142,39 @@ morse_parsec_data_of(dague_ddesc_t *ddesc, ...)
#if defined(CHAMELEON_USE_MPI)
/* TODO: change displacement in data_map when in distributed */
assert( mdesc->nodes == 1 );
//assert( data_collection->nodes == 1 );
#endif
return dague_data_create( pdesc->data_map + n * mdesc->lmt + m, ddesc,
morse_parsec_data_key( ddesc, m, n ),
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) );
}
static dague_data_t*
morse_parsec_data_of_key(dague_ddesc_t *ddesc, dague_data_key_t key)
static 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*)ddesc;
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
MORSE_desc_t *mdesc = pdesc->desc;
int m, n;
morse_parsec_key_to_coordinates(ddesc, key, &m, &n);
morse_parsec_key_to_coordinates(data_collection, key, &m, &n);
#if defined(CHAMELEON_USE_MPI)
/* TODO: change displacement in data_map when in distributed */
assert( mdesc->nodes == 1 );
//assert( data_collection->nodes == 1 );
#endif
return dague_data_create( pdesc->data_map + key, ddesc, key,
return parsec_data_create( pdesc->data_map + key, data_collection, key,
mdesc->get_blkaddr( mdesc, m, n ),
mdesc->bsiz * MORSE_Element_Size(mdesc->dtyp) );
}
#ifdef DAGUE_PROF_TRACE
#ifdef parsec_PROF_TRACE
static int
morse_parsec_key_to_string(dague_ddesc_t *ddesc, dague_data_key_t key, char * buffer, uint32_t buffer_size)
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*)ddesc;
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)data_collection;
MORSE_desc_t *mdesc = pdesc->desc;
int m, n, res;
morse_parsec_key_to_coordinates(ddesc, key, &m, &n);
morse_parsec_key_to_coordinates(data_collection, key, &m, &n);
res = snprintf(buffer, buffer_size, "(%d, %d)", m, n);
if (res < 0)
{
......@@ -182,42 +192,44 @@ void RUNTIME_desc_init( MORSE_desc_t *mdesc )
void RUNTIME_desc_create( MORSE_desc_t *mdesc )
{
dague_ddesc_t *ddesc;
parsec_data_collection_t *data_collection;
morse_parsec_desc_t *pdesc;
int comm_size;
pdesc = malloc( sizeof(morse_parsec_desc_t) );
ddesc = (dague_ddesc_t*)pdesc;
data_collection = (parsec_data_collection_t*)pdesc;
/* Super setup */
RUNTIME_comm_size( &comm_size );
ddesc->nodes = comm_size;
ddesc->myrank = mdesc->myrank;
ddesc->data_key = morse_parsec_data_key;
ddesc->rank_of = morse_parsec_rank_of;
ddesc->rank_of_key = morse_parsec_rank_of_key;
ddesc->data_of = morse_parsec_data_of;
ddesc->data_of_key = morse_parsec_data_of_key;
ddesc->vpid_of = morse_parsec_vpid_of;
ddesc->vpid_of_key = morse_parsec_vpid_of_key;
#if defined(DAGUE_PROF_TRACE)
data_collection->nodes = comm_size;
data_collection->myrank = mdesc->myrank;
data_collection->data_key = morse_parsec_data_key;
data_collection->rank_of = morse_parsec_rank_of;
data_collection->rank_of_key = morse_parsec_rank_of_key;
data_collection->data_of = morse_parsec_data_of;
data_collection->data_of_key = morse_parsec_data_of_key;
data_collection->vpid_of = morse_parsec_vpid_of;
data_collection->vpid_of_key = morse_parsec_vpid_of_key;
#if defined(parsec_PROF_TRACE)
{
int rc;
ddesc->key_to_string = morse_parsec_key_to_string;
ddesc->key = NULL;
rc = asprintf(&(ddesc->key_dim), "(%d, %d)", mdesc->lmt, mdesc->lnt);
data_collection->key_to_string = morse_parsec_key_to_string;
data_collection->key = NULL;
rc = asprintf(&(data_collection->key_dim), "(%d, %d)", mdesc->lmt, mdesc->lnt);
(void)rc;
}
#endif
ddesc->memory_registration_status = MEMORY_STATUS_UNREGISTERED;
data_collection->memory_registration_status = MEMORY_STATUS_UNREGISTERED;
pdesc->data_map = calloc( mdesc->lmt * mdesc->lnt, sizeof(dague_data_t*) );
pdesc->data_map = calloc( mdesc->lmt * mdesc->lnt, sizeof(parsec_data_t*) );
/* Double linking */
pdesc->desc = mdesc;
mdesc->schedopt = pdesc;
parsec_dtd_data_collection_init(data_collection);
/* /\* Overwrite the leading dimensions to store the padding *\/ */
/* mdesc->llm = mdesc->mb * mdesc->lmt; */
/* mdesc->lln = mdesc->nb * mdesc->lnt; */
......@@ -229,18 +241,21 @@ void RUNTIME_desc_destroy( MORSE_desc_t *mdesc )
morse_parsec_desc_t *pdesc = (morse_parsec_desc_t*)(mdesc->schedopt);
if ( pdesc->data_map != NULL ) {
dague_data_t **data = pdesc->data_map;
parsec_data_t **data = pdesc->data_map;
int nb_local_tiles = mdesc->lmt * mdesc->lnt;
int i;
for(i=0; i<nb_local_tiles; i++, data++)
{
dague_data_destroy( *data );
parsec_data_destroy( *data );
}
free( pdesc->data_map );
pdesc->data_map = NULL;
}
parsec_dtd_data_collection_fini( (parsec_data_collection_t *)pdesc );
free(pdesc);
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment