runtime_context.c 2.13 KB
Newer Older
1 2
/**
 *
3 4
 * @copyright (c) 2009-2014 The University of Tennessee and The University
 *                          of Tennessee Research Foundation.
5 6
 *                          All rights reserved.
 * @copyright (c) 2012-2014 Inria. All rights reserved.
7
 * @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
8 9 10 11 12
 *
 **/

/**
 *
13
 * @file runtime_context.c
14 15 16 17 18
 *
 *  MORSE auxiliary routines
 *  MORSE is a software package provided by Univ. of Tennessee,
 *  Univ. of California Berkeley and Univ. of Colorado Denver
 *
19
 * @version 0.9.0
20 21 22 23 24 25 26
 * @author Cedric Augonnet
 * @author Mathieu Faverge
 * @author Cedric Castagnede
 * @date 2010-11-15
 *
 **/
#include <stdlib.h>
27
#include "runtime/starpu/include/morse_starpu.h"
28 29 30 31 32 33 34 35

/*******************************************************************************
 *  Create new context
 **/
void RUNTIME_context_create( MORSE_context_t *morse )
{
    starpu_conf_t *conf;

36
    morse->scheduler = CHAMELEON_SCHED_STARPU;
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
    morse->schedopt = (void*) malloc (sizeof(struct starpu_conf));
    conf = morse->schedopt;

    starpu_conf_init( conf );

    return;
}

/*******************************************************************************
 *  Clean the context
 **/

void RUNTIME_context_destroy( MORSE_context_t *morse )
{
    free(morse->schedopt);
    return;
}

/*******************************************************************************
 *
 */
void RUNTIME_enable( MORSE_enum lever )
{
    switch (lever)
    {
        case MORSE_PROFILING_MODE:
            starpu_profiling_status_set(STARPU_PROFILING_ENABLE);
            break;
        case MORSE_BOUND:
            starpu_bound_start(0, 0);
            break;
        default:
            return;
    }
    return;
}

/*******************************************************************************
 *
 **/
void RUNTIME_disable( MORSE_enum lever )
{
    switch (lever)
    {
        case MORSE_PROFILING_MODE:
            starpu_profiling_status_set(STARPU_PROFILING_DISABLE);
            break;
        case MORSE_BOUND:
            starpu_bound_stop();
            break;
        default:
            return;
    }
    return;
}