chameleon_f77.c 4.31 KB
Newer Older
1
/**
2
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
3
 * @file chameleon_f77.c
4
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
5 6
 * @copyright 2009-2014 The University of Tennessee and The University of
 *                      Tennessee Research Foundation. All rights reserved.
Mathieu Faverge's avatar
Mathieu Faverge committed
7
 * @copyright 2012-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8
 *                      Univ. Bordeaux. All rights reserved.
9
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
10
 ***
11
 *
Mathieu Faverge's avatar
Mathieu Faverge committed
12
 * @brief Chameleon Fortran77 interface
13
 *
14
 * @version 1.0.0
15 16
 * @author Bilel Hadri
 * @author Cedric Castagnede
17
 * @author Florent Pruvost
18 19
 * @date 2010-11-15
 *
20
 */
21
#include <stdlib.h>
22
#include "control/common.h"
Mathieu Faverge's avatar
Mathieu Faverge committed
23
#include "chameleon.h"
Mathieu Faverge's avatar
Mathieu Faverge committed
24
#include "chameleon_f77.h"
25 26 27 28 29

#ifdef __cplusplus
extern "C" {
#endif

30
    /**
31
     *  FORTRAN API - auxiliary function prototypes
32
     */
Mathieu Faverge's avatar
Mathieu Faverge committed
33 34
    void CHAMELEON_INIT(int *CORES, int *NGPUS, int *INFO)
    {   *INFO = CHAMELEON_Init(*CORES, *NGPUS); }
35

Mathieu Faverge's avatar
Mathieu Faverge committed
36 37
    void CHAMELEON_FINALIZE(int *INFO)
    {   *INFO = CHAMELEON_Finalize(); }
38

Mathieu Faverge's avatar
Mathieu Faverge committed
39 40
    void CHAMELEON_ENABLE(int *lever, int *INFO)
    {   *INFO = CHAMELEON_Enable(*lever); }
41

Mathieu Faverge's avatar
Mathieu Faverge committed
42 43
    void CHAMELEON_DISABLE(int *lever, int *INFO)
    {   *INFO = CHAMELEON_Disable(*lever); }
44

Mathieu Faverge's avatar
Mathieu Faverge committed
45 46
    void CHAMELEON_SET(int *param, int *value, int *INFO)
    {   *INFO = CHAMELEON_Set(*param, *value); }
47

Mathieu Faverge's avatar
Mathieu Faverge committed
48 49
    void CHAMELEON_GET(int *param, int *value, int *INFO)
    {   *INFO = CHAMELEON_Get(*param, value); }
50

Mathieu Faverge's avatar
Mathieu Faverge committed
51
    void CHAMELEON_DEALLOC_HANDLE(size_t *sp, int *INFO)
52
    {   free((void *)(*sp));
Mathieu Faverge's avatar
Mathieu Faverge committed
53
        *INFO = CHAMELEON_SUCCESS; }
54

Mathieu Faverge's avatar
Mathieu Faverge committed
55
    void CHAMELEON_VERSION(int *VER_MAJOR, int *VER_MINOR, int *VER_MICRO, int *INFO)
56 57 58 59
    {
        *VER_MAJOR = CHAMELEON_VERSION_MAJOR;
        *VER_MINOR = CHAMELEON_VERSION_MINOR;
        *VER_MICRO = CHAMELEON_VERSION_MICRO;
Mathieu Faverge's avatar
Mathieu Faverge committed
60
        *INFO = CHAMELEON_SUCCESS;
61
    }
62

63
    /**
64
     *  FORTRAN API - descriptor allocation and deallocation
65
     */
Mathieu Faverge's avatar
Mathieu Faverge committed
66
    void CHAMELEON_DESC_CREATE(CHAM_desc_t **desc, void *mat, cham_flttype_t *dtyp,
67 68 69
                           int *mb, int *nb, int *bsiz, int *lm, int *ln,
                           int *i, int *j, int *m, int *n, int *p, int *q,
                           int *INFO)
Mathieu Faverge's avatar
Mathieu Faverge committed
70 71
    {   *INFO = CHAMELEON_Desc_Create(desc, mat, *dtyp, *mb, *nb, *bsiz, *lm, *ln, *i, *j, *m, *n, *p, *q); }
    void CHAMELEON_DESC_CREATE_OOC(CHAM_desc_t **desc, cham_flttype_t *dtyp,
72 73 74
                               int *mb, int *nb, int *bsiz, int *lm, int *ln,
                               int *i, int *j, int *m, int *n, int *p, int *q,
                               int *INFO)
Mathieu Faverge's avatar
Mathieu Faverge committed
75 76
    {   *INFO = CHAMELEON_Desc_Create_OOC(desc, *dtyp, *mb, *nb, *bsiz, *lm, *ln, *i, *j, *m, *n, *p, *q); }
    void CHAMELEON_DESC_CREATE_USER(CHAM_desc_t **descptr, void *mat, cham_flttype_t *dtyp,
77 78
                                int *mb, int *nb, int *bsiz, int *lm, int *ln,
                                int *i, int *j, int *m, int *n, int *p, int *q,
Mathieu Faverge's avatar
Mathieu Faverge committed
79 80 81
                                void* (*get_blkaddr)( const CHAM_desc_t*, int, int ),
                                int   (*get_blkldd) ( const CHAM_desc_t*, int      ),
                                int   (*get_rankof) ( const CHAM_desc_t*, int, int ),
82
                                int *INFO)
Mathieu Faverge's avatar
Mathieu Faverge committed
83
    {   *INFO = CHAMELEON_Desc_Create_User(descptr, mat, *dtyp, *mb, *nb, *bsiz, *lm, *ln, *i, *j, *m, *n, *p, *q,
84
                                       get_blkaddr, get_blkldd, get_rankof); }
Mathieu Faverge's avatar
Mathieu Faverge committed
85
    void CHAMELEON_DESC_CREATE_OOC_USER(CHAM_desc_t **descptr, cham_flttype_t *dtyp,
86 87
                                    int *mb, int *nb, int *bsiz, int *lm, int *ln,
                                    int *i, int *j, int *m, int *n, int *p, int *q,
Mathieu Faverge's avatar
Mathieu Faverge committed
88
                                    int (*get_rankof) ( const CHAM_desc_t*, int, int ),
89
                                    int *INFO)
Mathieu Faverge's avatar
Mathieu Faverge committed
90
    {   *INFO = CHAMELEON_Desc_Create_OOC_User(descptr, *dtyp, *mb, *nb, *bsiz, *lm, *ln, *i, *j, *m, *n, *p, *q,
91
                                           get_rankof); }
92

Mathieu Faverge's avatar
Mathieu Faverge committed
93 94
    void CHAMELEON_DESC_DESTROY(CHAM_desc_t **desc, int *INFO)
    {   *INFO = CHAMELEON_Desc_Destroy(desc); }
95

96
    /**
97
     *  FORTRAN API - conversion from LAPACK F77 matrix layout to tile layout
98
     */
Mathieu Faverge's avatar
Mathieu Faverge committed
99 100
    void CHAMELEON_LAPACK_TO_TILE(intptr_t *Af77, int *LDA, intptr_t *A, int *INFO)
    {   *INFO = CHAMELEON_Lapack_to_Tile( (void *)Af77, *LDA, (CHAM_desc_t *)(*A)); }
101

Mathieu Faverge's avatar
Mathieu Faverge committed
102 103
    void CHAMELEON_TILE_TO_LAPACK(intptr_t *A, intptr_t *Af77, int *LDA, int *INFO)
    {   *INFO = CHAMELEON_Tile_to_Lapack((CHAM_desc_t *)(*A), (void *)Af77, *LDA); }
104 105 106 107

#ifdef __cplusplus
}
#endif