Commit c8854e1b authored by PRUVOST Florent's avatar PRUVOST Florent

take into account M. Faverge's remarks

 - create morse_f77.h file to store Fortran names necessary for some Fortran interface files
 - remove SetFortranMangling.cmake, equivalent is now in the main CMakeLists
 - remove morse_mangling.h from the installed headers
 - update the Fortran interface: Morse_Desc_Create_User, OOC and OOC_User functions
parent b85a5792
......@@ -59,7 +59,11 @@ else()
endif()
include(MorseInit)
include(GenPkgConfig)
include(SetFortranMangling)
include(FortranCInterface)
## Ensure that the fortran compiler and c compiler specified are compatible
FortranCInterface_VERIFY()
FortranCInterface_HEADER(${CMAKE_CURRENT_BINARY_DIR}/include/morse_mangling.h
MACRO_NAMESPACE "MORSE_")
#############################################
# #
......
###
#
# @copyright (c) 2017 Inria. All rights reserved.
#
###
#
# @file SetFortranMangling.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.0.0
# @author Florent Pruvost
# @date 25-04-2017
#
# Detect Fortran mangling and define the proper API symbols
###
include(FortranCInterface)
## Ensure that the fortran compiler and c compiler specified are compatible
FortranCInterface_VERIFY()
FortranCInterface_HEADER(${CMAKE_CURRENT_BINARY_DIR}/include/morse_mangling.h
MACRO_NAMESPACE "MORSE_"
SYMBOLS
MORSE_INIT
MORSE_FINALIZE
MORSE_ENABLE
MORSE_DISABLE
MORSE_SET
MORSE_GET
MORSE_DEALLOC_HANDLE
MORSE_VERSION
MORSE_DESC_CREATE
MORSE_DESC_DESTROY
MORSE_LAPACK_TO_TILE
MORSE_TILE_TO_LAPACK
)
......@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2017 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......@@ -22,6 +22,7 @@
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
# @author Florent Pruvost
# @date 13-07-2012
#
###
......@@ -52,6 +53,7 @@ set(CHAMELEON_HDRS
descriptor.h
gkkleader.h
global.h
morse_f77.h
morsewinthread.h
tile.h
workspace.h
......
......@@ -76,7 +76,6 @@
* Chameleon header files
**/
#include "morse.h"
#include "morse_mangling.h"
#include "coreblas/include/coreblas.h"
#if defined(CHAMELEON_USE_CUDA) && !defined(CHAMELEON_SIMULATION)
......@@ -90,15 +89,6 @@
#include "control/tile.h"
#include "control/async.h"
/** ****************************************************************************
* Determine FORTRAN names
**/
#define MORSE_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_##lcname, MORSE_##UCNAME)
#define MORSE_TILE_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_##lcname##_tile, MORSE_##UCNAME##_TILE)
#define MORSE_ASYNC_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_##lcname##_tile_async, MORSE_##UCNAME##_TILE_ASYNC)
#define MORSE_WS_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_alloc_workspace_##lcname, MORSE_ALLOC_WORKSPACE_##UCNAME)
#define MORSE_WST_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_alloc_workspace_##lcname##_tile, MORSE_ALLOC_WORKSPACE_##UCNAME##_TILE)
/*******************************************************************************
* Global shortcuts
**/
......
......@@ -3,7 +3,7 @@
* @copyright (c) 2009-2014 The University of Tennessee and The University
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2014 Inria. All rights reserved.
* @copyright (c) 2012-2017 Inria. All rights reserved.
* @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
*
**/
......@@ -16,71 +16,96 @@
* MORSE is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 0.9.0
* @version 1.0.0
* @author Bilel Hadri
* @author Cedric Castagnede
* @author Florent Pruvost
* @date 2010-11-15
*
**/
#include <stdlib.h>
#include "control/common.h"
#include "morse.h"
#include "morse_mangling.h"
#include "morse_f77.h"
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* FORTRAN API - auxiliary function prototypes
**/
void MORSE_INIT(int *CORES, int *NGPUS, int *INFO)
{ *INFO = MORSE_Init(*CORES, *NGPUS); }
/*******************************************************************************
* FORTRAN API - auxiliary function prototypes
**/
void MORSE_INIT(int *CORES, int *NGPUS, int *INFO)
{ *INFO = MORSE_Init(*CORES, *NGPUS); }
void MORSE_FINALIZE(int *INFO)
{ *INFO = MORSE_Finalize(); }
void MORSE_FINALIZE(int *INFO)
{ *INFO = MORSE_Finalize(); }
void MORSE_ENABLE(MORSE_enum *lever, int *INFO)
{ *INFO = MORSE_Enable(*lever); }
void MORSE_ENABLE(MORSE_enum *lever, int *INFO)
{ *INFO = MORSE_Enable(*lever); }
void MORSE_DISABLE(MORSE_enum *lever, int *INFO)
{ *INFO = MORSE_Disable(*lever); }
void MORSE_DISABLE(MORSE_enum *lever, int *INFO)
{ *INFO = MORSE_Disable(*lever); }
void MORSE_SET(MORSE_enum *param, int *value, int *INFO)
{ *INFO = MORSE_Set(*param, *value); }
void MORSE_SET(MORSE_enum *param, int *value, int *INFO)
{ *INFO = MORSE_Set(*param, *value); }
void MORSE_GET(MORSE_enum *param, int *value, int *INFO)
{ *INFO = MORSE_Get(*param, value); }
void MORSE_GET(MORSE_enum *param, int *value, int *INFO)
{ *INFO = MORSE_Get(*param, value); }
void MORSE_DEALLOC_HANDLE(size_t *sp, int *INFO)
{ free((void *)(*sp));
*INFO = MORSE_SUCCESS; }
void MORSE_DEALLOC_HANDLE(size_t *sp, int *INFO)
{ free((void *)(*sp));
*INFO = MORSE_SUCCESS; }
void MORSE_VERSION(int *VER_MAJOR, int *VER_MINOR, int *VER_MICRO, int *INFO)
{
*VER_MAJOR = CHAMELEON_VERSION_MAJOR;
*VER_MINOR = CHAMELEON_VERSION_MINOR;
*VER_MICRO = CHAMELEON_VERSION_MICRO;
*INFO = MORSE_SUCCESS;
}
void MORSE_VERSION(int *VER_MAJOR, int *VER_MINOR, int *VER_MICRO, int *INFO)
{
*VER_MAJOR = CHAMELEON_VERSION_MAJOR;
*VER_MINOR = CHAMELEON_VERSION_MINOR;
*VER_MICRO = CHAMELEON_VERSION_MICRO;
*INFO = MORSE_SUCCESS;
}
/***************************************************************************//**
* FORTRAN API - descriptor allocation and deallocation
**/
void MORSE_DESC_CREATE(MORSE_desc_t **desc, void *mat, MORSE_enum *dtyp, int *mb, int *nb, int *bsiz, int *lm, int *ln, int *i, int *j, int *m, int *n, int *p, int *q, int *INFO)
{ *INFO = MORSE_Desc_Create(desc, mat, *dtyp, *mb, *nb, *bsiz, *lm, *ln, *i, *j, *m, *n, *p, *q); }
/***************************************************************************
* FORTRAN API - descriptor allocation and deallocation
**/
void MORSE_DESC_CREATE(MORSE_desc_t **desc, void *mat, MORSE_enum *dtyp,
int *mb, int *nb, int *bsiz, int *lm, int *ln,
int *i, int *j, int *m, int *n, int *p, int *q,
int *INFO)
{ *INFO = MORSE_Desc_Create(desc, mat, *dtyp, *mb, *nb, *bsiz, *lm, *ln, *i, *j, *m, *n, *p, *q); }
void MORSE_DESC_CREATE_OOC(MORSE_desc_t **desc, MORSE_enum *dtyp,
int *mb, int *nb, int *bsiz, int *lm, int *ln,
int *i, int *j, int *m, int *n, int *p, int *q,
int *INFO)
{ *INFO = MORSE_Desc_Create_OOC(desc, *dtyp, *mb, *nb, *bsiz, *lm, *ln, *i, *j, *m, *n, *p, *q); }
void MORSE_DESC_CREATE_USER(MORSE_desc_t **descptr, void *mat, MORSE_enum *dtyp,
int *mb, int *nb, int *bsiz, int *lm, int *ln,
int *i, int *j, int *m, int *n, int *p, int *q,
void* (*get_blkaddr)( const MORSE_desc_t*, int, int ),
int (*get_blkldd) ( const MORSE_desc_t*, int ),
int (*get_rankof) ( const MORSE_desc_t*, int, int ),
int *INFO)
{ *INFO = MORSE_Desc_Create_User(descptr, mat, *dtyp, *mb, *nb, *bsiz, *lm, *ln, *i, *j, *m, *n, *p, *q,
get_blkaddr, get_blkldd, get_rankof); }
void MORSE_DESC_CREATE_OOC_USER(MORSE_desc_t **descptr, MORSE_enum *dtyp,
int *mb, int *nb, int *bsiz, int *lm, int *ln,
int *i, int *j, int *m, int *n, int *p, int *q,
int (*get_rankof) ( const MORSE_desc_t*, int, int ),
int *INFO)
{ *INFO = MORSE_Desc_Create_OOC_User(descptr, *dtyp, *mb, *nb, *bsiz, *lm, *ln, *i, *j, *m, *n, *p, *q,
get_rankof); }
void MORSE_DESC_DESTROY(MORSE_desc_t **desc, int *INFO)
{ *INFO = MORSE_Desc_Destroy(desc); }
void MORSE_DESC_DESTROY(MORSE_desc_t **desc, int *INFO)
{ *INFO = MORSE_Desc_Destroy(desc); }
/***************************************************************************//**
* FORTRAN API - conversion from LAPACK F77 matrix layout to tile layout
**/
void MORSE_LAPACK_TO_TILE(intptr_t *Af77, int *LDA, intptr_t *A, int *INFO)
{ *INFO = MORSE_Lapack_to_Tile( (void *)Af77, *LDA, (MORSE_desc_t *)(*A)); }
/***************************************************************************
* FORTRAN API - conversion from LAPACK F77 matrix layout to tile layout
**/
void MORSE_LAPACK_TO_TILE(intptr_t *Af77, int *LDA, intptr_t *A, int *INFO)
{ *INFO = MORSE_Lapack_to_Tile( (void *)Af77, *LDA, (MORSE_desc_t *)(*A)); }
void MORSE_TILE_TO_LAPACK(intptr_t *A, intptr_t *Af77, int *LDA, int *INFO)
{ *INFO = MORSE_Tile_to_Lapack((MORSE_desc_t *)(*A), (void *)Af77, *LDA); }
void MORSE_TILE_TO_LAPACK(intptr_t *A, intptr_t *Af77, int *LDA, int *INFO)
{ *INFO = MORSE_Tile_to_Lapack((MORSE_desc_t *)(*A), (void *)Af77, *LDA); }
#ifdef __cplusplus
}
......
/**
*
* @copyright (c) 2009-2014 The University of Tennessee and The University
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2017 Inria. All rights reserved.
* @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
*
**/
/**
*
* @file morse_f77.h
*
* MORSE Fortran names
* MORSE is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 1.0.0
* @author Florent Pruvost
* @date 2017-05-03
*
**/
#ifndef _MORSE_F77_H_
#define _MORSE_F77_H_
#include "include/morse_mangling.h"
/** ****************************************************************************
* Determine FORTRAN names
**/
#define MORSE_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_##lcname, MORSE_##UCNAME)
#define MORSE_TILE_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_##lcname##_tile, MORSE_##UCNAME##_TILE)
#define MORSE_ASYNC_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_##lcname##_tile_async, MORSE_##UCNAME##_TILE_ASYNC)
#define MORSE_WS_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_alloc_workspace_##lcname, MORSE_ALLOC_WORKSPACE_##UCNAME)
#define MORSE_WST_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_alloc_workspace_##lcname##_tile, MORSE_ALLOC_WORKSPACE_##UCNAME##_TILE)
#define MORSE_INIT MORSE_GLOBAL_(morse_init, MORSE_INIT)
#define MORSE_FINALIZE MORSE_GLOBAL_(morse_finalize, MORSE_FINALIZE)
#define MORSE_ENABLE MORSE_GLOBAL_(morse_enable, MORSE_ENABLE)
#define MORSE_DISABLE MORSE_GLOBAL_(morse_disable, MORSE_DISABLE)
#define MORSE_SET MORSE_GLOBAL_(morse_set, MORSE_SET)
#define MORSE_GET MORSE_GLOBAL_(morse_get, MORSE_GET)
#define MORSE_DEALLOC_HANDLE MORSE_GLOBAL_(morse_dealloc_handle, MORSE_DEALLOC_HANDLE)
#define MORSE_VERSION MORSE_GLOBAL_(morse_version, MORSE_VERSION)
#define MORSE_DESC_CREATE MORSE_GLOBAL_(morse_desc_create, MORSE_DESC_CREATE)
#define MORSE_DESC_CREATE_OOC MORSE_GLOBAL_(morse_desc_create_ooc, MORSE_DESC_CREATE_OOC)
#define MORSE_DESC_CREATE_USER MORSE_GLOBAL_(morse_desc_create_user, MORSE_DESC_CREATE_USER)
#define MORSE_DESC_CREATE_OOC_USER MORSE_GLOBAL_(morse_desc_create_ooc_user, MORSE_DESC_CREATE_OOC_USER)
#define MORSE_DESC_DESTROY MORSE_GLOBAL_(morse_desc_destroy, MORSE_DESC_DESTROY)
#define MORSE_LAPACK_TO_TILE MORSE_GLOBAL_(morse_lapack_to_tile, MORSE_LAPACK_TO_TILE)
#define MORSE_TILE_TO_LAPACK MORSE_GLOBAL_(morse_tile_to_lapack, MORSE_TILE_TO_LAPACK)
#endif
......@@ -182,6 +182,43 @@ module morse
end function MORSE_Desc_Create_c
end interface
interface
function MORSE_Desc_Create_OOC_c(desc, dtyp, mb, nb, bsiz, lm, ln, i, j, m, n, p, q) &
& bind(c, name='MORSE_Desc_Create_OOC')
use iso_c_binding
integer(kind=c_int) :: MORSE_Desc_Create_OOC_c
type(c_ptr) :: desc
integer(kind=c_int), value :: dtyp
integer(kind=c_int), value :: mb, nb, bsiz, lm, ln, i, j, m, n,p, q
end function MORSE_Desc_Create_OOC_c
end interface
interface
function MORSE_Desc_Create_User_c(desc, mat, dtyp, mb, nb, bsiz, lm, ln, i, j, m, n, p, q, get_blkaddr, get_blkldd, get_rankof) &
& bind(c, name='MORSE_Desc_Create_User')
use iso_c_binding
integer(kind=c_int) :: MORSE_Desc_Create_User_c
type(c_ptr) :: desc
type(c_ptr), value :: mat
integer(kind=c_int), value :: dtyp
integer(kind=c_int), value :: mb, nb, bsiz, lm, ln, i, j, m, n, p, q
type(c_ptr) :: get_blkaddr
type(c_ptr), value :: get_blkldd, get_rankof
end function MORSE_Desc_Create_User_c
end interface
interface
function MORSE_Desc_Create_OOC_User_c(desc, dtyp, mb, nb, bsiz, lm, ln, i, j, m, n, p, q, get_rankof) &
& bind(c, name='MORSE_Desc_Create_OOC_User')
use iso_c_binding
integer(kind=c_int) :: MORSE_Desc_Create_OOC_User_c
type(c_ptr) :: desc
integer(kind=c_int), value :: dtyp
integer(kind=c_int), value :: mb, nb, bsiz, lm, ln, i, j, m, n, p, q
type(c_ptr), value :: get_rankof
end function MORSE_Desc_Create_OOC_User_c
end interface
interface
function MORSE_Desc_Destroy_c(desc) &
& bind(c, name='MORSE_Desc_Destroy')
......
......@@ -3,7 +3,7 @@
* @copyright (c) 2009-2014 The University of Tennessee and The University
* of Tennessee Research Foundation.
* All rights reserved.
* @copyright (c) 2012-2014 Inria. All rights reserved.
* @copyright (c) 2012-2017 Inria. All rights reserved.
* @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
*
**/
......@@ -24,12 +24,14 @@
* @author Mathieu Faverge
* @author Emmanuel Agullo
* @author Cedric Castagnede
* @author Florent Pruvost
* @date 2010-11-15
* @precisions normal z -> c d s
*
**/
#include <stdlib.h>
#include "control/common.h"
#include "control/morse_f77.h"
#undef REAL
#define COMPLEX
......
......@@ -81,15 +81,12 @@ set(HDR_INSTALL
morse_struct.h
morse_types.h
runtime.h
${CMAKE_CURRENT_BINARY_DIR}/morse.h
${CMAKE_CURRENT_BINARY_DIR}/chameleon_config.h
)
foreach( hdr_file ${CHAMELEON_HDRS_GENERATED} )
list(APPEND HDR_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/${hdr_file})
endforeach()
list(APPEND
HDR_INSTALL
${CMAKE_CURRENT_BINARY_DIR}/morse.h
${CMAKE_CURRENT_BINARY_DIR}/morse_mangling.h
${CMAKE_CURRENT_BINARY_DIR}/chameleon_config.h)
# installation
# ------------
......
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