Commit 4b83ad0d authored by PRUVOST Florent's avatar PRUVOST Florent

detect mangling using FortranCInterface and remove the ADD_ arbitrary prepocessor variable

parent efffaa5a
...@@ -59,6 +59,7 @@ else() ...@@ -59,6 +59,7 @@ else()
endif() endif()
include(MorseInit) include(MorseInit)
include(GenPkgConfig) include(GenPkgConfig)
include(SetFortranMangling)
############################################# #############################################
# # # #
...@@ -959,12 +960,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ...@@ -959,12 +960,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup") set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
endif() 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) if(CHAMELEON_SCHED_STARPU)
link_directories(${STARPU_LIBRARY_DIRS_DEP}) link_directories(${STARPU_LIBRARY_DIRS_DEP})
......
###
#
# @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
)
...@@ -31,11 +31,6 @@ ...@@ -31,11 +31,6 @@
#ifndef _MORSE_COMMON_H_ #ifndef _MORSE_COMMON_H_
#define _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 ) #if defined( _WIN32 ) || defined( _WIN64 )
#include <io.h> #include <io.h>
...@@ -81,6 +76,7 @@ ...@@ -81,6 +76,7 @@
* Chameleon header files * Chameleon header files
**/ **/
#include "morse.h" #include "morse.h"
#include "morse_mangling.h"
#include "coreblas/include/coreblas.h" #include "coreblas/include/coreblas.h"
#if defined(CHAMELEON_USE_CUDA) && !defined(CHAMELEON_SIMULATION) #if defined(CHAMELEON_USE_CUDA) && !defined(CHAMELEON_SIMULATION)
...@@ -97,26 +93,11 @@ ...@@ -97,26 +93,11 @@
/** **************************************************************************** /** ****************************************************************************
* Determine FORTRAN names * Determine FORTRAN names
**/ **/
#if defined(ADD_) #define MORSE_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_##lcname, MORSE_##UCNAME)
#define MORSE_FNAME(lcname, UCNAME) morse_##lcname##_ #define MORSE_TILE_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_##lcname##_tile, MORSE_##UCNAME##_TILE)
#define MORSE_TILE_FNAME(lcname, UCNAME) morse_##lcname##_tile_ #define MORSE_ASYNC_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_##lcname##_tile_async, MORSE_##UCNAME##_TILE_ASYNC)
#define MORSE_ASYNC_FNAME(lcname, UCNAME) morse_##lcname##_tile_async_ #define MORSE_WS_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_alloc_workspace_##lcname, MORSE_ALLOC_WORKSPACE_##UCNAME)
#define MORSE_WS_FNAME(lcname, UCNAME) morse_alloc_workspace_##lcname##_ #define MORSE_WST_FNAME(lcname, UCNAME) MORSE_GLOBAL(morse_alloc_workspace_##lcname##_tile, MORSE_ALLOC_WORKSPACE_##UCNAME##_TILE)
#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
/******************************************************************************* /*******************************************************************************
* Global shortcuts * Global shortcuts
......
...@@ -28,9 +28,6 @@ ...@@ -28,9 +28,6 @@
/* inherit from public chameleon's definitions */ /* inherit from public chameleon's definitions */
#include "include/chameleon_config.h" #include "include/chameleon_config.h"
/* For BLAS Fortran mangling */
#cmakedefine ADD_
/* StarPU functions */ /* StarPU functions */
#cmakedefine HAVE_STARPU_FXT_PROFILING #cmakedefine HAVE_STARPU_FXT_PROFILING
#cmakedefine HAVE_STARPU_IDLE_PREFETCH #cmakedefine HAVE_STARPU_IDLE_PREFETCH
......
...@@ -25,34 +25,7 @@ ...@@ -25,34 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "control/common.h" #include "control/common.h"
#include "morse.h" #include "morse.h"
#include "morse_mangling.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
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
......
...@@ -58,6 +58,7 @@ set(CHAMELEON_HDRS ...@@ -58,6 +58,7 @@ set(CHAMELEON_HDRS
morse_struct.h morse_struct.h
morse_types.h morse_types.h
morse.h morse.h
morse_mangling.h
runtime.h runtime.h
${CHAMELEON_HDRS_GENERATED} ${CHAMELEON_HDRS_GENERATED}
) )
...@@ -84,7 +85,11 @@ set(HDR_INSTALL ...@@ -84,7 +85,11 @@ set(HDR_INSTALL
foreach( hdr_file ${CHAMELEON_HDRS_GENERATED} ) foreach( hdr_file ${CHAMELEON_HDRS_GENERATED} )
list(APPEND HDR_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/${hdr_file}) list(APPEND HDR_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/${hdr_file})
endforeach() 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 # 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