Skip to content

Commit

Permalink
Merge branch 'hotfix/0.11.2'
Browse files Browse the repository at this point in the history
* hotfix/0.11.2:
  Version 0.11.2
  Compile fckit as static library with Cray compiler version 14 and up
  Trap SIGBUS
  Add test_owned_object
  Bump cmake requirements for tests to 3.12
  Add CMake information on eckit_mpi capability
  Compatibility with eckit < 1.23.0
  • Loading branch information
wdeconinck committed Mar 20, 2024
2 parents ebdaa45 + ca07904 commit f03eb93
Show file tree
Hide file tree
Showing 15 changed files with 354 additions and 16 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ if( fckit_HAVE_ECKIT )
endif()
endif()
set( fckit_HAVE_MPI ${HAVE_MPI} )
if( fckit_HAVE_ECKIT AND NOT fckit_HAVE_MPI )
ecbuild_warn("ecKit has been compiled without MPI. This causes fckit to not be able to run parallel executables.")
if( fckit_HAVE_ECKIT )
if( NOT fckit_HAVE_MPI )
ecbuild_warn("ecKit has been compiled without MPI. This causes fckit to not be able to run parallel executables.")
else()
ecbuild_info("ecKit has been compiled with MPI")
endif()
endif()

################################################################################################
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
0.11.1
0.11.2

4 changes: 2 additions & 2 deletions doc/fctest_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.

cmake_minimum_required( VERSION 3.6 FATAL_ERROR )
cmake_minimum_required( VERSION 3.12 FATAL_ERROR )

find_package( ecbuild 3.0.0 REQUIRED )
find_package( ecbuild 3.4 REQUIRED )

project( fctest_examples VERSION 0.0.0 LANGUAGES Fortran )

Expand Down
7 changes: 7 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.

set(FCKIT_HAVE_ECKIT_TENSOR 0)
if( HAVE_ECKIT )
if(eckit_VERSION VERSION_GREATER_EQUAL 1.23.0)
set(FCKIT_HAVE_ECKIT_TENSOR 1)
endif()
endif()

add_subdirectory(fckit)
add_subdirectory(apps)
add_subdirectory(tests)
Expand Down
27 changes: 21 additions & 6 deletions src/fckit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.

configure_file(fckit.h.in fckit.h)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/fckit.h DESTINATION include/fckit )
set( source_files_properties fckit.h.in PROPERTIES HEADER_FILE_ONLY TRUE )

if( HAVE_ECKIT )
list( APPEND eckit_required_src
module/fckit.F90
Expand All @@ -32,18 +28,27 @@ if( HAVE_ECKIT )
module/fckit_owned_object.F90
module/fckit_map.cc
module/fckit_map.F90
module/fckit_tensor.cc
module/fckit_tensor.F90
Libfckit.h
Libfckit.cc
Main.h
Main.cc
Log.h
Log.cc
)
if( FCKIT_HAVE_ECKIT_TENSOR )
list( APPEND eckit_required_src
module/fckit_tensor.cc
module/fckit_tensor.F90
)
endif()
set( eckit_required_libs eckit eckit_mpi )
endif()

configure_file(fckit.h.in fckit.h)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/fckit.h DESTINATION include/fckit )
set( source_files_properties fckit.h.in PROPERTIES HEADER_FILE_ONLY TRUE )


if( BUILD_SHARED_LIBS )
set( fckit_type SHARED )
else()
Expand All @@ -63,6 +68,16 @@ if( CMAKE_Fortran_COMPILER_ID MATCHES "PGI|NVHPC" )
set_source_files_properties( module/fckit_array.F90 PROPERTIES COMPILE_FLAGS "-w" )
endif()

if( CMAKE_Fortran_COMPILER_ID MATCHES "Cray" )
# Problem with type-bound procedures requires fckit static compilation or -fuse-ld=bfd linking flag
# Problem is tracked with LUMI #3011 support ticket and https://jira.ecmwf.int/browse/DE-927
# Bug present with cce/14 cce/15 cce/16 cce/17 (versions greater not tested)
if( ${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 14 )
ecbuild_warn( "Bug in cray < 14 requires fckit to be compiled statically" )
set( fckit_type STATIC )
endif()
endif()


ecbuild_add_library(
TARGET fckit
Expand Down
2 changes: 1 addition & 1 deletion src/fckit/fckit.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ does it submit to any jurisdiction.
#define FCKIT_FINAL_NOT_INHERITING @FCKIT_FINAL_NOT_INHERITING@
#define FCKIT_FINAL_BROKEN_FOR_ALLOCATABLE_ARRAY @FCKIT_FINAL_BROKEN_FOR_ALLOCATABLE_ARRAY@
#define FCKIT_FINAL_BROKEN_FOR_AUTOMATIC_ARRAY @FCKIT_FINAL_BROKEN_FOR_AUTOMATIC_ARRAY@

#define FCKIT_HAVE_ECKIT_TENSOR @FCKIT_HAVE_ECKIT_TENSOR@
#define FCKIT_FINAL impure elemental
#define FCKIT_FINAL_DEBUGGING 0

Expand Down
6 changes: 5 additions & 1 deletion src/fckit/module/fckit.F90
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ module fckit_module
use fckit_map_module, only: &
fckit_map

#if FCKIT_HAVE_ECKIT_TENSOR
use fckit_tensor_module, only: &
fckit_tensor_real32, &
fckit_tensor_real64
#endif

implicit none
private
Expand All @@ -75,8 +77,10 @@ module fckit_module
public :: fckit_version !! - [[fckit_module:fckit_version(function)]]
public :: fckit_git_sha1 !! - [[fckit_module:fckit_git_sha1(function)]]
public :: deallocate_fckit_configuration !! - [[fckit_configuration_module:deallocate_fckit_configuration(subroutine)]]
public :: fckit_tensor_real32 !! - [[fckit_tensor_module:fckit_tensor_real32(type)]]
#if FCKIT_HAVE_ECKIT_TENSOR
public :: fckit_tensor_real32 !! - [[fckit_tensor_module:fckit_tensor_real32(type)]]
public :: fckit_tensor_real64 !! - [[fckit_tensor_module:fckit_tensor_real64(type)]]
#endif

public :: log ! DEPRECATED. Use fckit_log instead.

Expand Down
3 changes: 3 additions & 0 deletions src/fckit/module/fckit_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ int32 fckit__SIGILL() {
int32 fckit__SIGTRAP() {
return SIGTRAP;
}
int32 fckit__SIGBUS() {
return SIGBUS;
}


} // extern "C"
6 changes: 6 additions & 0 deletions src/fckit/module/fckit_signal.F90
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ module fckit_signal_module
procedure, nopass, public :: SIGSEGV !! Return code for Segmentation violation
procedure, nopass, public :: SIGFPE !! Return code for Floating Point Exception
procedure, nopass, public :: SIGTRAP !! Return code for Trap/Breakpoint
procedure, nopass, public :: SIGBUS !! Return code for Bus error
end type

type(fckit_signal_type), save :: fckit_signal
Expand Down Expand Up @@ -202,6 +203,11 @@ function SIGTRAP() result(signum)
signum = fckit__SIGTRAP()
end function

function SIGBUS() result(signum)
use, intrinsic :: iso_c_binding, only : c_int32_t
integer(c_int32_t) :: signum
signum = fckit__SIGBUS()
end function

!------------------------------------------------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions src/fckit/module/fckit_signal.inc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ interface
use iso_c_binding, only: c_int32_t
integer(c_int32_t) :: signum
end function

!int fckit__SIGBUS ()
function fckit__SIGBUS() result(signum) bind(c,name="fckit__SIGBUS")
use iso_c_binding, only: c_int32_t
integer(c_int32_t) :: signum
end function
end interface

#endif
Expand Down
13 changes: 11 additions & 2 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ add_fctest( TARGET fckit_test_shared_ptr
test_shared_ptr.cc
LIBS fckit)

add_fctest( TARGET fckit_test_owned_object
LINKER_LANGUAGE Fortran
SOURCES
test_owned_object.F90
test_owned_object.cc
LIBS fckit eckit
CONDITION HAVE_ECKIT
)

add_fctest( TARGET fckit_test_mpi
LINKER_LANGUAGE Fortran
SOURCES test_mpi.F90
Expand All @@ -49,7 +58,7 @@ add_fctest( TARGET fckit_test_abort
add_fctest( TARGET fckit_test_map
LINKER_LANGUAGE Fortran
SOURCES test_map.F90
CONDITION HAVE_ECKIT
CONDITION FCKIT_HAVE_ECKIT_TENSOR
LIBS fckit)

add_fctest( TARGET fckit_test_tensor
Expand All @@ -58,7 +67,7 @@ add_fctest( TARGET fckit_test_tensor
test_tensor.F90
test_tensor.cc
INCLUDES ${ECKIT_INCLUDE_DIRS}
CONDITION HAVE_ECKIT
CONDITION FCKIT_HAVE_ECKIT_TENSOR
LIBS eckit fckit)


Expand Down
1 change: 1 addition & 0 deletions src/tests/test_configuration_fails.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
! With Apple Silicon (M1), using Apple clang 12.0.0 for C++ and Homebrew GCC 10.2.0_4 for Fortran
! it appears that the Fortran needs to trap the C++ exceptions via SIGTRAP
call fckit_signal%set_handler( fckit_signal%SIGTRAP() )
call fckit_signal%set_handler( fckit_signal%SIGBUS() )
END_TESTSUITE_INIT

! -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_downstream_fypp/downstream/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required( VERSION 3.6 FATAL_ERROR )
cmake_minimum_required( VERSION 3.12 FATAL_ERROR )

find_package( ecbuild REQUIRED )

Expand Down
Loading

0 comments on commit f03eb93

Please sign in to comment.