Merge topic 'fujitsu-compiler-4.0-support'

8ef55dec29 Help: Add release notes for Fujitsu compiler support
4c74c86f40 FindBLAS/LAPACK: Add support for the Fujitsu SSL2 library
376c300b25 FindOpenMP: Add support for Fujitsu compilers
9e0a1cf03e FindMPI: Add support for the Fujitsu compiler wrappers
a237450948 Tests: Update for the FujitsuClang compiler
27579e9cf1 FujitsuClang: Add support for the Fujitsu compiler in Clang mode
a55feff69c Tests: Update for the Fujitsu compiler
3c867cff4a Fujitsu: Add support for the Fujitsu compiler in Trad mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Axel Huebl <axel.huebl@plasma.ninja>
Acked-by: Gilles Gouaillardet <gilles@rist.or.jp>
Merge-request: !5954
This commit is contained in:
Brad King
2021-04-01 14:26:34 +00:00
committed by Kitware Robot
34 changed files with 408 additions and 61 deletions

View File

@@ -359,6 +359,7 @@ following :variable:`compiler ids <CMAKE_<LANG>_COMPILER_ID>` as of the
versions specified for each:
* ``Cray``: Cray Compiler Environment version 8.1+.
* ``Fujitsu``: Fujitsu HPC compiler 4.0+.
* ``PGI``: PGI version 12.10+.
* ``NVHPC``: NVIDIA HPC compilers version 11.0+.
* ``TI``: Texas Instruments compiler.

View File

@@ -0,0 +1,11 @@
fujitsu-compiler-support
------------------------
* Addition of the ``Fujitsu`` compiler ID operating in traditional ``Trad``
mode and ``FujitsuClang`` operating in ``Clang`` mode.
* The :module:`FindOpenMP` module learned to support ``Fujitsu`` and
``FujitsuClang``.
* The :module:`FindMPI` module learned to support ``Fujitsu`` and
``FujitsuClang`` in both host and cross compiling modes.
* The :module:`FindBLAS` and :module:`FindLAPACK` modules learned to support
the serial ``Fujitsu SSL2`` and parallel ``Fujitsu SSL2BLAMP`` libraries.

View File

@@ -19,6 +19,8 @@ include:
Cray = Cray Compiler (cray.com)
Embarcadero, Borland = Embarcadero (embarcadero.com)
Flang = Flang LLVM Fortran Compiler
Fujitsu = Fujitsu HPC compiler (Trad mode)
FujitsuClang = Fujitsu HPC compiler (Clang mode)
G95 = G95 Fortran (g95.org)
GNU = GNU Compiler Collection (gcc.gnu.org)
GHS = Green Hills Software (www.ghs.com)

View File

@@ -8,7 +8,7 @@
macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
set(${_VAR}
FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG
FAIL_REGEX "[Uu]nrecogni[sz]ed .*option" # GNU, NAG, Fujitsu
FAIL_REGEX "switch .* is no longer supported" # GNU
FAIL_REGEX "unknown .*option" # Clang
FAIL_REGEX "optimization flag .* not supported" # Clang

View File

@@ -66,6 +66,7 @@ function(compiler_id_detection outvar lang)
PGI
Cray
TI
FujitsuClang
Fujitsu
GHS
)

View File

@@ -165,6 +165,25 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
endif()
# The Fujitsu compiler does not always convey version information through
# preprocessor symbols so we extract through command line info
if (CMAKE_${lang}_COMPILER_ID STREQUAL "Fujitsu")
if(NOT CMAKE_${lang}_COMPILER_VERSION)
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}" -V
OUTPUT_VARIABLE output
ERROR_VARIABLE output
RESULT_VARIABLE result
TIMEOUT 10
)
if (result EQUAL 0)
if (output MATCHES [[Fujitsu [^ ]* Compiler ([0-9]+\.[0-9]+\.[0-9]+)]])
set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_MATCH_1}")
endif()
endif()
endif()
endif()
# if the format is unknown after all files have been checked, put "Unknown" in the cache
if(NOT CMAKE_EXECUTABLE_FORMAT)
set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format")
@@ -830,8 +849,10 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}")
endif()
if("${info}" MATCHES "INFO:compiler_version_internal\\[([^]\"]*)\\]")
string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION_INTERNAL "${CMAKE_MATCH_1}")
string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}")
set(COMPILER_VERSION_INTERNAL "${CMAKE_MATCH_1}")
string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}")
string(REGEX REPLACE "\\.0+([0-9]+)" ".\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}")
string(STRIP "${COMPILER_VERSION_INTERNAL}" COMPILER_VERSION_INTERNAL)
endif()
foreach(comp MAJOR MINOR PATCH TWEAK)
foreach(digit 1 2 3 4 5 6 7 8 9)

View File

@@ -139,6 +139,15 @@
#define COMPILER_VERSION_MAJOR DEC(__NAG_COMPILER_RELEASE/10)
#define COMPILER_VERSION_MINOR DEC(__NAG_COMPILER_RELEASE % 10)
#define COMPILER_VERSION_PATCH DEC(__NAG_COMPILER_BUILD)
#elif defined(__FUJITSU)
PRINT *, 'INFO:compiler[Fujitsu]'
# if defined(__FRT_major__)
# define COMPILER_VERSION_MAJOR DEC(__FRT_major__)
# define COMPILER_VERSION_MINOR DEC(__FRT_minor__)
# define COMPILER_VERSION_PATCH DEC(__FRT_patchlevel__)
# elif defined(__FRT_version__)
PRINT *, 'INFO:compiler_version['//__FRT_version__//']'
# endif
#else
PRINT *, 'INFO:compiler[]'
#endif

View File

@@ -146,6 +146,21 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var)
endif()
endif()
# Fujitsu compiler
if(CMAKE_${lang}_COMPILER_ID STREQUAL "Fujitsu" AND
line MATCHES "/ccpcom")
string(REGEX MATCHALL " (-I *|--sys_include=|--preinclude +)(\"[^\"]+\"|[^ \"]+)" incs "${line}")
foreach(inc IN LISTS incs)
string(REGEX REPLACE " (-I *|--sys_include=|--preinclude +)(\"[^\"]+\"|[^ \"]+)" "\\2" idir "${inc}")
list(APPEND rv "${idir}")
endforeach()
if(rv)
string(APPEND log " got implicit includes via fujitsu ccpcom parser!\n")
else()
string(APPEND log " warning: fujitsu ccpcom parse failed!\n")
endif()
endif()
if(log)
set(${log_var} "${log}" PARENT_SCOPE)
else()

View File

@@ -256,8 +256,12 @@
('0' + ((n)>>4 & 0xF)), \
('0' + ((n) & 0xF))
/* Construct a string literal encoding the version number. */
#ifdef COMPILER_VERSION
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
/* Construct a string literal encoding the version number components. */
#ifdef COMPILER_VERSION_MAJOR
#elif defined(COMPILER_VERSION_MAJOR)
char const info_version[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
@@ -281,6 +285,8 @@ char const info_version_internal[] = {
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
'i','n','t','e','r','n','a','l','[',
COMPILER_VERSION_INTERNAL,']','\0'};
#elif defined(COMPILER_VERSION_INTERNAL_STR)
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
#endif
/* Construct a string literal encoding the version number components. */

View File

@@ -0,0 +1,20 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/Fujitsu)
__compiler_fujitsu(C)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4)
set(CMAKE_C89_STANDARD_COMPILE_OPTION -std=c89)
set(CMAKE_C89_EXTENSION_COMPILE_OPTION -std=gnu89)
set(CMAKE_C89_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C99_STANDARD_COMPILE_OPTION -std=c99)
set(CMAKE_C99_EXTENSION_COMPILE_OPTION -std=gnu99)
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C11_STANDARD_COMPILE_OPTION -std=c11)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=gnu11)
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
endif()
__compiler_check_default_language_standard(C 4 11)

View File

@@ -0,0 +1,47 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
include(Compiler/Fujitsu)
__compiler_fujitsu(CXX)
#set(CMAKE_PCH_EXTENSION .pch)
#set(CMAKE_PCH_EPILOGUE "#pragma hdrstop")
#set(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH --no_pch_messages -include <PCH_HEADER> --use_pch <PCH_FILE>)
#set(CMAKE_CXX_COMPILE_OPTIONS_CREATE_PCH --no_pch_messages -include <PCH_HEADER> --create_pch <PCH_FILE>)
# The Fujitsu compiler offers both a 98 and 03 mode. These two are
# essentially interchangeable as 03 simply provides clarity to some 98
# ambiguyity.
#
# Re: Stroustrup's C++ FAQ:
# What is the difference between C++98 and C++03?
# From a programmer's view there is none. The C++03 revision of the
# standard was a bug fix release for implementers to ensure greater
# consistency and portability. In particular, tutorial and reference
# material describing C++98 and C++03 can be used interchangeably by all
# except compiler writers and standards gurus.
#
# Since CMake doesn't actually have an 03 mode and they're effectively
# interchangeable then we're just going to explicitly use 03 mode in the
# compiler when 98 is requested.
# The version matching is messy here. The std support seems to be related to
# the compiler tweak version derived from the patch id in the version string.
if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 4)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -std=c++03)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -std=gnu++03)
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -std=c++11)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -std=gnu++11)
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -std=c++14)
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -std=gnu++14)
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION -std=c++17)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION -std=gnu++17)
endif()
__compiler_check_default_language_standard(CXX 4 14)

View File

@@ -1,2 +1,17 @@
set(_compiler_id_pp_test "defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)")
set(_compiler_id_pp_test "defined(__FUJITSU)")
set(_compiler_id_version_compute "
# if defined(__FCC_version__)
# define @PREFIX@COMPILER_VERSION __FCC_version__
# elif defined(__FCC_major__)
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__FCC_major__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__FCC_minor__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__FCC_patchlevel__)
# endif
# if defined(__fcc_version)
# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__fcc_version)
# elif defined(__FCC_VERSION)
# define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__FCC_VERSION)
# endif
")

View File

@@ -0,0 +1,16 @@
include(Compiler/Fujitsu)
__compiler_fujitsu(Fortran)
set(CMAKE_Fortran_SUBMODULE_SEP ".")
set(CMAKE_Fortran_SUBMODULE_EXT ".smod")
set(CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -Cpp -E <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-Cpp")
set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-Fixed")
set(CMAKE_Fortran_FORMAT_FREE_FLAG "-Free")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT "")
set(CMAKE_Fortran_MODDIR_FLAG "-M ")

View File

@@ -0,0 +1,33 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_FUJITSU)
return()
endif()
set(__COMPILER_FUJITSU 1)
include(Compiler/CMakeCommonCompilerMacros)
macro(__compiler_fujitsu lang)
set(CMAKE_${lang}_VERBOSE_FLAG "-###")
# Initial configuration flags
string(APPEND CMAKE_${lang}_FLAGS_INIT " ")
string(APPEND CMAKE_${lang}_FLAGS_DEBUG_INIT " -g -O0")
string(APPEND CMAKE_${lang}_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
# PIC flags
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
# Passing link options to the compiler
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG "-Wl,")
set(CMAKE_${lang}_LINKER_WRAPPER_FLAG_SEP ",")
# How to actually call the compiler
set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
"<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E $<$<COMPILE_LANGUAGE:Fortran>:-Cpp> <SOURCE> > <PREPROCESSED_SOURCE>")
set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE "<CMAKE_${lang}_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
endmacro()

View File

@@ -0,0 +1,6 @@
include(Compiler/FujitsuClang)
set(_fjclang_ver "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
set(CMAKE_C_COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION_INTERNAL}")
include(Compiler/Clang-C)
set(CMAKE_C_COMPILER_VERSION "${_fjclang_ver}")

View File

@@ -0,0 +1,6 @@
include(Compiler/FujitsuClang)
set(_fjclang_ver "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
set(CMAKE_CXX_COMPILER_VERSION "${CMAKE_CXX_COMPILER_VERSION_INTERNAL}")
include(Compiler/Clang-CXX)
set(CMAKE_CXX_COMPILER_VERSION "${_fjclang_ver}")

View File

@@ -0,0 +1,9 @@
set(_compiler_id_pp_test "defined(__CLANG_FUJITSU)")
set(_compiler_id_version_compute "
# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__FCC_major__)
# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__FCC_minor__)
# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__FCC_patchlevel__)
# define @PREFIX@COMPILER_VERSION_INTERNAL_STR __clang_version__
")

View File

@@ -0,0 +1,11 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__COMPILER_FUJITSUCLANG)
return()
endif()
set(__COMPILER_FUJITSUCLANG 1)
include(Compiler/Clang)

View File

@@ -55,6 +55,8 @@ The following variables may be set to influence this module's behavior:
* ``Arm_ilp64_mp``
* ``EML``
* ``EML_mt``
* ``Fujitsu_SSL2`` (Fujitsu serial blas / lapack)
* ``Fujitsu_SSL2BLAMP`` (Fujitsu parallel blas / lapack)
* ``Generic``
.. versionadded:: 3.6
@@ -78,6 +80,7 @@ The following variables may be set to influence this module's behavior:
.. versionadded:: 3.20
Elbrus Math Library support (``EML``, ``EML_mt``).
Fujitsu SSL2 Library support (``Fujitsu_SSL2``, ``Fujitsu_SSL2BLAMP``)
``BLA_F95``
if ``ON`` tries to find the BLAS95 interfaces
@@ -153,13 +156,18 @@ if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_CO
endif()
function(_add_blas_target)
if(NOT TARGET BLAS::BLAS)
if(BLAS_FOUND AND NOT TARGET BLAS::BLAS)
add_library(BLAS::BLAS INTERFACE IMPORTED)
if(BLAS_LIBRARIES)
set_target_properties(BLAS::BLAS PROPERTIES
INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}"
)
endif()
if(BLAS_LINKER_FLAGS)
set_target_properties(BLAS::BLAS PROPERTIES
INTERFACE_LINK_OPTIONS "${BLAS_LINKER_FLAGS}"
)
endif()
endif()
endfunction()
@@ -228,34 +236,34 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add
endif()
list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
foreach(_library ${_list})
foreach(_library ${_list} ${_threadlibs})
if(_library MATCHES "^-Wl,--(start|end)-group$")
# Respect linker flags like --start/end-group (required by MKL)
set(${LIBRARIES} ${${LIBRARIES}} "${_library}")
else()
set(_combined_name ${_combined_name}_${_library})
if(NOT "${_threadlibs}" STREQUAL "")
set(_combined_name ${_combined_name}_threadlibs)
endif()
string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}")
set(_combined_name ${_combined_name}_${_lib_var})
if(_libraries_work)
find_library(${_prefix}_${_library}_LIBRARY
find_library(${_prefix}_${_lib_var}_LIBRARY
NAMES ${_library}
NAMES_PER_DIR
PATHS ${_extaddlibdir}
PATH_SUFFIXES ${_subdirs}
)
#message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}")
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_lib_var}_LIBRARY})
set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY})
endif()
endif()
endforeach()
foreach(_flag ${_flags})
string(REGEX REPLACE "[^A-Za-z0-9]" "_" _flag_var "${_flag}")
set(_combined_name ${_combined_name}_${_flag_var})
endforeach()
if(_libraries_work)
# Test this combination of libraries.
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threadlibs})
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
if(CMAKE_Fortran_COMPILER_LOADED)
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
else()
@@ -274,12 +282,12 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add
else()
set(${LIBRARIES} FALSE)
endif()
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endmacro()
set(BLAS_LINKER_FLAGS)
set(BLAS_LIBRARIES)
set(BLAS95_LIBRARIES)
set(_blas_fphsa_req_var BLAS_LIBRARIES)
if(NOT $ENV{BLA_VENDOR} STREQUAL "")
set(BLA_VENDOR $ENV{BLA_VENDOR})
else()
@@ -302,6 +310,9 @@ if(BLA_VENDOR STREQUAL "All")
""
)
endif()
if(BLAS_WORKS)
set(_blas_fphsa_req_var BLAS_WORKS)
endif()
endif()
# BLAS in the Intel MKL 10+ library?
@@ -1016,6 +1027,31 @@ if(BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All")
endif()
# Fujitsu SSL2 Library?
if(NOT BLAS_LIBRARIES AND
BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All")
if(BLA_VENDOR STREQUAL "Fujitsu_SSL2BLAMP")
set(_ssl2_suffix BLAMP)
else()
set(_ssl2_suffix)
endif()
check_blas_libraries(
BLAS_LIBRARIES
BLAS
sgemm
"-SSL2${_ssl2_suffix}"
""
""
""
""
)
if(BLAS_LIBRARIES)
set(BLAS_LINKER_FLAGS "-SSL2${_ssl2_suffix}")
set(_blas_fphsa_req_var BLAS_LINKER_FLAGS)
endif()
unset(_ssl2_suffix)
endif()
# Generic BLAS library?
if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
if(NOT BLAS_LIBRARIES)
@@ -1032,17 +1068,16 @@ if(BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if(NOT BLA_F95)
find_package_handle_standard_args(BLAS REQUIRED_VARS BLAS_LIBRARIES)
endif()
# On compilers that implicitly link BLAS (such as ftn, cc, and CC on Cray HPC machines)
# we used a placeholder for empty BLAS_LIBRARIES to get through our logic above.
# On compilers that implicitly link BLAS (i.e. CrayPrgEnv) we used a
# placeholder for empty BLAS_LIBRARIES to get through our logic above.
if(BLAS_LIBRARIES STREQUAL "BLAS_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
set(BLAS_LIBRARIES "")
endif()
if(NOT BLA_F95)
find_package_handle_standard_args(BLAS REQUIRED_VARS ${_blas_fphsa_req_var})
endif()
_add_blas_target()
cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})

View File

@@ -45,6 +45,8 @@ The following variables may be set to influence this module's behavior:
* ``Arm_ilp64_mp``
* ``EML``
* ``EML_mt``
* ``Fujitsu_SSL2`` (Fujitsu serial blas / lapack)
* ``Fujitsu_SSL2BLAMP`` (Fujitsu parallel blas / lapack)
* ``Generic``
.. versionadded:: 3.6
@@ -68,6 +70,7 @@ The following variables may be set to influence this module's behavior:
.. versionadded:: 3.20
Elbrus Math Library support (``EML``, ``EML_mt``).
Fujitsu SSL2 Library support (``Fujitsu_SSL2``, ``Fujitsu_SSL2BLAMP``)
``BLA_F95``
if ``ON`` tries to find the BLAS95/LAPACK95 interfaces
@@ -130,20 +133,33 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
function(_add_lapack_target)
if(LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK)
add_library(LAPACK::LAPACK INTERFACE IMPORTED)
# Filter out redundant BLAS info and replace with the BLAS target
set(_lapack_libs "${LAPACK_LIBRARIES}")
if(_lapack_libs AND TARGET BLAS::BLAS)
# remove the ${BLAS_LIBRARIES} from the interface and replace it
# with the BLAS::BLAS target
list(REMOVE_ITEM _lapack_libs "${BLAS_LIBRARIES}")
set(_lapack_flags "${LAPACK_LINKER_FLAGS}")
if(TARGET BLAS::BLAS)
if(_lapack_libs AND BLAS_LIBRARIES)
foreach(_blas_lib IN LISTS BLAS_LIBRARIES)
list(REMOVE_ITEM _lapack_libs "${_blas_lib}")
endforeach()
endif()
if(_lapack_flags AND BLAS_LINKER_FLAGS)
foreach(_blas_flag IN LISTS BLAS_LINKER_FLAGS)
list(REMOVE_ITEM _lapack_flags "${_blas_flag}")
endforeach()
endif()
list(APPEND _lapack_libs BLAS::BLAS)
endif()
if(_lapack_libs)
set_target_properties(LAPACK::LAPACK PROPERTIES
INTERFACE_LINK_LIBRARIES "${_lapack_libs}"
)
endif()
unset(_lapack_libs)
if(_lapack_flags)
set_target_properties(LAPACK::LAPACK PROPERTIES
INTERFACE_LINK_OPTIONS "${_lapack_flags}"
)
endif()
endif()
endfunction()
@@ -202,32 +218,35 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a
endif()
list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
foreach(_library ${_list})
foreach(_library ${_list} ${_threadlibs})
if(_library MATCHES "^-Wl,--(start|end)-group$")
# Respect linker flags like --start/end-group (required by MKL)
set(${LIBRARIES} ${${LIBRARIES}} "${_library}")
else()
set(_combined_name ${_combined_name}_${_library})
string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}")
set(_combined_name ${_combined_name}_${_lib_var})
if(_libraries_work)
find_library(${_prefix}_${_library}_LIBRARY
find_library(${_prefix}_${_lib_var}_LIBRARY
NAMES ${_library}
NAMES_PER_DIR
PATHS ${_extaddlibdir}
PATH_SUFFIXES ${_subdirs}
)
#message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}")
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_lib_var}_LIBRARY})
set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY})
endif()
endif()
endforeach()
unset(_library)
foreach(_flag ${_flags})
string(REGEX REPLACE "[^A-Za-z0-9]" "_" _flag_var "${_flag}")
set(_combined_name ${_combined_name}_${_flag_var})
endforeach()
if(_libraries_work)
# Test this combination of libraries.
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threadlibs})
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
if(CMAKE_Fortran_COMPILER_LOADED)
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
else()
@@ -250,7 +269,6 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a
unset(_extaddlibdir)
unset(_libraries_work)
unset(_combined_name)
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endmacro()
macro(_lapack_find_dependency dep)
@@ -279,6 +297,7 @@ _lapack_find_library_setup()
set(LAPACK_LINKER_FLAGS)
set(LAPACK_LIBRARIES)
set(LAPACK95_LIBRARIES)
set(_lapack_fphsa_req_var LAPACK_LIBRARIES)
# Check the language being used
if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED))
@@ -585,6 +604,38 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE)
)
endif()
# Fujitsu SSL2 Library?
if(NOT LAPACK_LIBRARIES
AND BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All")
if(BLA_VENDOR STREQUAL "Fujitsu_SSL2BLAMP")
set(_ssl2_suffix BLAMP)
else()
set(_ssl2_suffix)
endif()
set(_ssl2_blas)
if(BLAS_LIBRARIES STREQUAL "")
set(_ssl2_blas "${BLAS_LINKER_FLAGS}")
else()
set(_ssl2_blas "${BLAS_LIBRARIES} ${BLAS_LINKER_FLAGS}")
endif()
check_lapack_libraries(
LAPACK_LIBRARIES
LAPACK
cheev
"-SSL2${_ssl2_suffix}"
""
""
""
""
"${_ssl2_blas}"
)
if(LAPACK_LIBRARIES)
set(LAPACK_LINKER_FLAGS "-SSL2${_ssl2_suffix}")
set(_lapack_fphsa_req_var LAPACK_LINKER_FLAGS)
endif()
unset(_ssl2_suffix)
endif()
# Generic LAPACK library?
if(NOT LAPACK_LIBRARIES
AND (BLA_VENDOR STREQUAL "Generic"
@@ -612,7 +663,7 @@ if(LAPACK_NOT_FOUND_MESSAGE)
set(LAPACK_NOT_FOUND_MESSAGE
REASON_FAILURE_MESSAGE ${LAPACK_NOT_FOUND_MESSAGE})
endif()
find_package_handle_standard_args(LAPACK REQUIRED_VARS LAPACK_LIBRARIES
find_package_handle_standard_args(LAPACK REQUIRED_VARS ${_lapack_fphsa_req_var}
${LAPACK_NOT_FOUND_MESSAGE})
unset(LAPACK_NOT_FOUND_MESSAGE)

View File

@@ -277,6 +277,11 @@ set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r
mpif77 mpif77_r mpf77 mpf77_r
mpifc)
#Fujitsu cross/own compiler names
set(_MPI_Fujitsu_C_COMPILER_NAMES mpifccpx mpifcc)
set(_MPI_Fujitsu_CXX_COMPILER_NAMES mpiFCCpx mpiFCC)
set(_MPI_Fujitsu_Fortran_COMPILER_NAMES mpifrtpx mpifrt)
# GNU compiler names
set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r)
set(_MPI_GNU_CXX_COMPILER_NAMES mpig++ mpg++ mpig++_r mpg++_r mpigxx)
@@ -337,7 +342,7 @@ set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95
# pick up the right settings for it.
foreach (LANG IN ITEMS C CXX Fortran)
set(_MPI_${LANG}_COMPILER_NAMES "")
foreach (id IN ITEMS GNU Intel IntelLLVM MSVC PGI XL)
foreach (id IN ITEMS Fujitsu FujitsuClang GNU Intel IntelLLVM MSVC PGI XL)
if (NOT CMAKE_${LANG}_COMPILER_ID OR CMAKE_${LANG}_COMPILER_ID STREQUAL id)
foreach(_COMPILER_NAME IN LISTS _MPI_${id}_${LANG}_COMPILER_NAMES)
list(APPEND _MPI_${LANG}_COMPILER_NAMES ${_COMPILER_NAME}${MPI_EXECUTABLE_SUFFIX})

View File

@@ -130,6 +130,8 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
set(OMP_FLAG_XL "-qsmp=omp")
# Cray compiler activate OpenMP with -h omp, which is enabled by default.
set(OMP_FLAG_Cray " " "-h omp")
set(OMP_FLAG_Fujitsu "-Kopenmp" "-KOMP")
set(OMP_FLAG_FujitsuClang "-fopenmp" "-Kopenmp")
# If we know the correct flags, use those
if(DEFINED OMP_FLAG_${CMAKE_${LANG}_COMPILER_ID})

View File

@@ -0,0 +1 @@
include(Platform/Linux-Clang-C)

View File

@@ -0,0 +1 @@
include(Platform/Linux-Clang-CXX)

View File

@@ -0,0 +1,17 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# This module is shared by multiple languages; use include blocker.
if(__LINUX_COMPILER_FUJITSU)
return()
endif()
set(__LINUX_COMPILER_FUJITSU 1)
macro(__linux_compiler_fujitsu lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
endmacro()

View File

@@ -7,7 +7,7 @@ if(NOT DEFINED CMAKE_Fortran_COMPILER)
message(STATUS ${_desc})
file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CheckFortran/CMakeLists.txt"
"cmake_minimum_required(VERSION 2.4)
"cmake_minimum_required(VERSION 2.8.12)
project(CheckFortran Fortran)
file(WRITE \"\${CMAKE_CURRENT_BINARY_DIR}/result.cmake\"
\"set(CMAKE_Fortran_COMPILER \\\"\${CMAKE_Fortran_COMPILER}\\\")\\n\"

View File

@@ -18,7 +18,7 @@ macro(run_test feature lang)
endif()
endmacro()
if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM)$")
if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$")
get_property(c_features GLOBAL PROPERTY CMAKE_C_KNOWN_FEATURES)
list(FILTER c_features EXCLUDE REGEX "^c_std_[0-9][0-9]")
foreach(feature ${c_features})
@@ -26,7 +26,7 @@ if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM)$")
endforeach()
endif()
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM)$")
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$")
get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES)
list(FILTER cxx_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]")
foreach(feature ${cxx_features})

View File

@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.0)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build" FORCE)
endif()

View File

@@ -3,7 +3,8 @@
# ifndef PCH_PCH_H_INCLUDED
# error "Expected PCH_PCH_H_INCLUDED."
# endif
#elif defined(__PGIC__) || defined(__ibmxl__) || defined(_CRAYC)
#elif defined(__PGIC__) || defined(__ibmxl__) || defined(_CRAYC) || \
defined(__FUJITSU)
// No PCH expected but these compilers define macros below.
#elif defined(__GNUC__) || defined(__clang__) || defined(_INTEL_COMPILER) || \
defined(_MSC_VER)

View File

@@ -46,7 +46,7 @@ function(test_fortran_c_interface_module)
FortranCInterface_VERIFY()
FortranCInterface_VERIFY(CXX)
if(CMAKE_Fortran_COMPILER_SUPPORTS_F90)
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "SunPro|PathScale|Absoft")
if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "SunPro|PathScale|Absoft|Fujitsu")
set(module_expected 1)
endif()
if(FortranCInterface_MODULE_FOUND OR module_expected)

View File

@@ -117,15 +117,9 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
target_compile_definitions(IntelIfDef PRIVATE SOME_DEF)
endif()
# Skip these tests if compiler/version doesn't have preprocessing flags
if((CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 4.4)
OR (CMAKE_Fortran_COMPILER_ID STREQUAL "XL" AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 15.1.6))
set(test_pp_flags 0)
else()
set(test_pp_flags 1)
endif()
if(test_pp_flags)
# Skip these tests if compiler/version does enable and disable preprocessing
if(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON AND
CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF)
# Test that we can always preprocess a target
add_executable(preprocess_target preprocess2.f)
set_property(TARGET preprocess_target PROPERTY Fortran_PREPROCESS ON)
@@ -145,17 +139,22 @@ set_property(SOURCE no_preprocess_source_lower.f PROPERTY Fortran_PREPROCESS OFF
# Test that we can explicitly not preprocess a target or source.
# This will not work on certain compilers due to either missing a
# "don't preprocess" flag, or due to choice of file extension.
if(test_pp_flags AND NOT CMAKE_Fortran_COMPILER_ID MATCHES "(Flang|NAG|PGI|NVHPC|SunPro|XL)")
# "don't preprocess" flag, or due to the flags being ignored for
# extensions like '.F' and '.fpp'.
if(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF AND
NOT CMAKE_Fortran_COMPILER_ID MATCHES "(Flang|NAG|PGI|NVHPC|SunPro|XL)")
add_library(no_preprocess_target STATIC no_preprocess_target_upper.F)
target_compile_options(no_preprocess_target PRIVATE -DINTEGER=nonsense)
add_library(no_preprocess_source STATIC no_preprocess_source_upper.F)
target_compile_options(no_preprocess_source PRIVATE -DINTEGER=nonsense)
if(NOT CMAKE_Fortran_COMPILER_ID STREQUAL "Cray"
AND NOT "${CMAKE_Fortran_COMPILER_ID};${CMAKE_Fortran_SIMULATE_ID}" MATCHES "Intel(LLVM)?;MSVC")
target_sources(no_preprocess_target PRIVATE no_preprocess_target_fpp.fpp)
target_sources(no_preprocess_source PRIVATE no_preprocess_source_fpp.fpp)
endif()
set_property(TARGET no_preprocess_target PROPERTY Fortran_PREPROCESS OFF)
set_property(SOURCE no_preprocess_source_upper.F no_preprocess_source_fpp.fpp PROPERTY Fortran_PREPROCESS OFF)
endif()

View File

@@ -52,7 +52,7 @@ endmacro()
# detailed features tables, not just meta-features
if (CMAKE_C_COMPILE_FEATURES)
if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM)$")
if (NOT CMAKE_C_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$")
set(C_expected_features ${CMAKE_C_COMPILE_FEATURES})
list(FILTER C_expected_features EXCLUDE REGEX "^c_std_[0-9][0-9]")
endif()
@@ -95,7 +95,7 @@ if (C_expected_features)
endif()
if (CMAKE_CXX_COMPILE_FEATURES)
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM)$")
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IntelLLVM|Fujitsu|FujitsuClang)$")
set(CXX_expected_features ${CMAKE_CXX_COMPILE_FEATURES})
list(FILTER CXX_expected_features EXCLUDE REGEX "^cxx_std_[0-9][0-9]")
endif()

View File

@@ -280,7 +280,7 @@ add_RunCMake_test(Graphviz)
add_RunCMake_test(TargetPropertyGeneratorExpressions)
add_RunCMake_test(Languages)
add_RunCMake_test(LinkStatic)
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang)$")
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|Fujitsu|FujitsuClang)$")
add_RunCMake_test(MetaCompileFeatures)
endif()
if(MSVC)

View File

@@ -43,4 +43,9 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES SunPro)
target_link_libraries(hello PRIVATE sunquad)
endif()
endif()
elseif(CMAKE_Fortran_COMPILER_ID MATCHES Fujitsu)
# Fujitsu Fortran doesn't automatically link its runtime libraries into
# SOs
target_link_libraries(world PRIVATE fj90i fj90f fjsrcinfo)
target_link_libraries(hello PRIVATE fj90i fj90f fjsrcinfo)
endif()