diff --git a/CMakeLists.txt b/CMakeLists.txt index 6105696a81e83d57a93184bbf344f782ec3045c8..6983fbba4cb3f7a5951e4602cb6be86a85b0e2c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ else() endif() include(MorseInit) include(GenPkgConfig) +include(SetFortranMangling) ############################################# # # @@ -959,12 +960,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup") endif() -# Add define for Fortran Mangling (should be defined somewhere else) -# ------------------------------------------------------------------ -message("-- ${Blue}Add definition ADD_" - " - For Fortran mangling${ColourReset}") -set(ADD_ 1) - #------------------------------------------------------------------------------ if(CHAMELEON_SCHED_STARPU) link_directories(${STARPU_LIBRARY_DIRS_DEP}) diff --git a/cmake_modules/SetFortranMangling.cmake b/cmake_modules/SetFortranMangling.cmake new file mode 100644 index 0000000000000000000000000000000000000000..52c97a689ebe23695443e03cc7af8a64cd195377 --- /dev/null +++ b/cmake_modules/SetFortranMangling.cmake @@ -0,0 +1,42 @@ +### +# +# @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 + ) diff --git a/control/common.h b/control/common.h index 194359d3b1658da48915651773335cea23f67e79..9995669ab246c39703e9ce9d5dd8d2962cac7a2a 100644 --- a/control/common.h +++ b/control/common.h @@ -31,11 +31,6 @@ #ifndef _MORSE_COMMON_H_ #define _MORSE_COMMON_H_ -#include <stdlib.h> -#include <stdio.h> -#include <math.h> -#include <string.h> -#include <ctype.h> #if defined( _WIN32 ) || defined( _WIN64 ) #include <io.h> @@ -81,6 +76,7 @@ * Chameleon header files **/ #include "morse.h" +#include "morse_mangling.h" #include "coreblas/include/coreblas.h" #if defined(CHAMELEON_USE_CUDA) && !defined(CHAMELEON_SIMULATION) @@ -97,26 +93,11 @@ /** **************************************************************************** * Determine FORTRAN names **/ -#if defined(ADD_) -#define MORSE_FNAME(lcname, UCNAME) morse_##lcname##_ -#define MORSE_TILE_FNAME(lcname, UCNAME) morse_##lcname##_tile_ -#define MORSE_ASYNC_FNAME(lcname, UCNAME) morse_##lcname##_tile_async_ -#define MORSE_WS_FNAME(lcname, UCNAME) morse_alloc_workspace_##lcname##_ -#define MORSE_WST_FNAME(lcname, UCNAME) morse_alloc_workspace_##lcname##_tile_ -#elif defined(NOCHANGE) -#define MORSE_FNAME(lcname, UCNAME) morse_##lcname -#define MORSE_TILE_FNAME(lcname, UCNAME) morse_##lcname##_tile -#define MORSE_ASYNC_FNAME(lcname, UCNAME) morse_##lcname##_tile_async -#define MORSE_WS_FNAME(lcname, UCNAME) morse_alloc_workspace_##lcname -#define MORSE_WST_FNAME(lcname, UCNAME) morse_alloc_workspace_##lcname##_tile -#elif defined(UPCASE) -#define MORSE_FNAME(lcname, UCNAME) MORSE_##UCNAME -#define MORSE_TILE_FNAME(lcname, UCNAME) MORSE_##UCNAME##_TILE -#define MORSE_ASYNC_FNAME(lcname, UCNAME) MORSE_##UCNAME##_TILE_ASYNC -#define MORSE_WS_FNAME(lcname, UCNAME) MORSE_ALLOC_WORKSPACE_##UCNAME -#define MORSE_WST_FNAME(lcname, UCNAME) MORSE_ALLOC_WORKSPACE_##UCNAME##_TILE -#endif - +#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 diff --git a/control/config.h.in b/control/config.h.in index 48c3ce5aa77dae52d2e5f4b7b39ea116def31699..1194dc083e6de219d4f5db6eefd1aba10ed1f8dc 100644 --- a/control/config.h.in +++ b/control/config.h.in @@ -28,9 +28,6 @@ /* inherit from public chameleon's definitions */ #include "include/chameleon_config.h" -/* For BLAS Fortran mangling */ -#cmakedefine ADD_ - /* StarPU functions */ #cmakedefine HAVE_STARPU_FXT_PROFILING #cmakedefine HAVE_STARPU_IDLE_PREFETCH diff --git a/control/morse_f77.c b/control/morse_f77.c index fc60d10d8e094c74436728735f403dffb47e1515..db43b1e10ad1243a84caa9252b1bd7ebd943e319 100644 --- a/control/morse_f77.c +++ b/control/morse_f77.c @@ -25,34 +25,7 @@ #include <stdlib.h> #include "control/common.h" #include "morse.h" - -#ifdef ADD_ - #define MORSE_INIT morse_init_ - #define MORSE_FINALIZE morse_finalize_ - #define MORSE_ENABLE morse_enable_ - #define MORSE_DISABLE morse_disable_ - #define MORSE_SET morse_set_ - #define MORSE_GET morse_get_ - #define MORSE_DEALLOC_HANDLE morse_dealloc_handle_ - #define MORSE_VERSION morse_version_ - #define MORSE_DESC_CREATE morse_desc_create_ - #define MORSE_DESC_DESTROY morse_desc_destroy_ - #define MORSE_LAPACK_TO_TILE morse_lapack_to_tile_ - #define MORSE_TILE_TO_LAPACK morse_tile_to_lapack_ -#elif defined (NOCHANGE) - #define MORSE_INIT morse_init - #define MORSE_FINALIZE morse_finalize - #define MORSE_ENABLE morse_enable - #define MORSE_DISABLE morse_disable - #define MORSE_SET morse_set - #define MORSE_GET morse_get - #define MORSE_DEALLOC_HANDLE morse_dealloc_handle - #define MORSE_VERSION morse_version - #define MORSE_DESC_CREATE morse_desc_create - #define MORSE_DESC_DESTROY morse_desc_destroy - #define MORSE_LAPACK_TO_TILE morse_lapack_to_tile - #define MORSE_TILE_TO_LAPACK morse_tile_to_lapack -#endif +#include "morse_mangling.h" #ifdef __cplusplus extern "C" { diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 965963b85b96890513bf14053f1af5700c29509e..65e101b0b1645e07be96d819339b3d65069ea915 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -58,6 +58,7 @@ set(CHAMELEON_HDRS morse_struct.h morse_types.h morse.h + morse_mangling.h runtime.h ${CHAMELEON_HDRS_GENERATED} ) @@ -84,7 +85,11 @@ set(HDR_INSTALL 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}/chameleon_config.h) +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 # ------------