Skip to content

Commit

Permalink
Merge pull request #3185 from GEOS-ESM/feature/mathomp4/fixes-for-ifx
Browse files Browse the repository at this point in the history
Workaround for ifx bug
  • Loading branch information
tclune authored Dec 6, 2024
2 parents 69d34a2 + f22ece9 commit be39cab
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 43 deletions.
46 changes: 23 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ workflows:
- docker-hub-creds
matrix:
parameters:
compiler: [gfortran, ifort]
compiler: [gfortran, ifort, ifx]
cmake_generator: ['Unix Makefiles','Ninja']
baselibs_version: *baselibs_version
repo: MAPL
Expand All @@ -49,7 +49,7 @@ workflows:
- docker-hub-creds
matrix:
parameters:
compiler: [gfortran, ifort]
compiler: [gfortran, ifort, ifx]
baselibs_version: *baselibs_version
repo: MAPL
mepodevelop: false
Expand All @@ -67,7 +67,7 @@ workflows:
- docker-hub-creds
matrix:
parameters:
compiler: [ifort]
compiler: [ifort, ifx]
baselibs_version: *baselibs_version
repo: MAPL
mepodevelop: false
Expand All @@ -82,7 +82,7 @@ workflows:
- docker-hub-creds
matrix:
parameters:
compiler: [gfortran, ifort]
compiler: [gfortran, ifort, ifx]
tutorial_name:
- hello_world
- parent_no_children
Expand All @@ -104,7 +104,7 @@ workflows:
- docker-hub-creds
matrix:
parameters:
compiler: [gfortran, ifort]
compiler: [gfortran, ifort, ifx]
baselibs_version: *baselibs_version
repo: GEOSgcm
checkout_fixture: true
Expand All @@ -119,7 +119,7 @@ workflows:
- docker-hub-creds
matrix:
parameters:
compiler: [gfortran, ifort]
compiler: [gfortran, ifort, ifx]
requires:
- build-GEOSgcm-on-<< matrix.compiler >>
repo: GEOSgcm
Expand Down Expand Up @@ -200,23 +200,23 @@ workflows:
compiler_version: "2021.13"
image_name: geos-env
tag_build_arg_name: *tag_build_arg_name
#- ci/publish_docker:
#filters:
#tags:
#only: /^v.*$/
#name: publish-ifx-docker-image
#context:
#- docker-hub-creds
#- ghcr-creds
#os_version: *os_version
#baselibs_version: *baselibs_version
#container_name: mapl
#mpi_name: intelmpi
#mpi_version: "2021.13"
#compiler_name: ifx
#compiler_version: "2024.2"
#image_name: geos-env
#tag_build_arg_name: *tag_build_arg_name
- ci/publish_docker:
filters:
tags:
only: /^v.*$/
name: publish-ifx-docker-image
context:
- docker-hub-creds
- ghcr-creds
os_version: *os_version
baselibs_version: *baselibs_version
container_name: mapl
mpi_name: intelmpi
mpi_version: "2021.14"
compiler_name: ifx
compiler_version: "2025.0"
image_name: geos-env
tag_build_arg_name: *tag_build_arg_name
- ci/publish_docker:
filters:
tags:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Use v7.27.0 Baselibs
- Use GCC 14 for GNU tests
- Add pFUnit-less build test
- Enable ifx tests
- Improve some writes to be more informative
- In `base/MAPL_CFIO.F90`, added `Iam` to a print statement so that when a read fails we know which routine failed
- In `gridcomps/ExtData2G/ExtDataConfig.F90`, print out the name of the duplicate collection that causes model to fail

### Fixed

- Fixed issue of some Baselibs builds appearing to support zstandard. This is not possible due to Baselibs building HDF5 and netCDF as static libraries
- Workaround ifx bug in `pfio/ArrayReference.F90` (NOTE: This currently targets all versions of ifx, but will need to be qualified or removed in the future)
- Updates to support llvm-flang
- Trajectory sampler: fix a bug when group_name does not exist in netCDF file and a bug that omitted the first time point
- Fixed a bug where the periodicity around the earth of the lat-lon grid was not being set properly when grid did not span from pole to pole
Expand Down
9 changes: 0 additions & 9 deletions base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
esma_set_this (OVERRIDE MAPL.base)

if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 20)
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 17)
add_definitions(-D__ifort_18)
endif()
endif()
endif()


set (srcs
MAPL_Profiler.F90
CFIOCollection.F90 MAPL_RegridderManager.F90
Expand Down
40 changes: 36 additions & 4 deletions pfio/ArrayReference.F90
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function new_ArrayReference_1d(array, rc) result(reference)
reference%shape = shape(array)

_RETURN(_SUCCESS)

end function new_ArrayReference_1d

function new_ArrayReference_2d(array, rc) result(reference)
Expand Down Expand Up @@ -151,7 +151,7 @@ function new_ArrayReference_3d(array, rc) result(reference)
reference%shape = shape(array)

_RETURN(_SUCCESS)

end function new_ArrayReference_3d


Expand All @@ -167,24 +167,40 @@ function new_ArrayReference_4d(array, rc) result(reference)

select type (array)
type is (real(kind=REAL32))
#if defined(ODD_IFX_BUG)
if (has_address) reference%base_address = c_loc(array(1,1,1,1))
#else
if (has_address) reference%base_address = c_loc(array)
#endif
reference%type_kind = pFIO_REAL32
type is (real(kind=REAL64))
#if defined(ODD_IFX_BUG)
if (has_address) reference%base_address = c_loc(array(1,1,1,1))
#else
if (has_address) reference%base_address = c_loc(array)
#endif
reference%type_kind = pFIO_REAL64
type is (integer(kind=INT32))
#if defined(ODD_IFX_BUG)
if (has_address) reference%base_address = c_loc(array(1,1,1,1))
#else
if (has_address) reference%base_address = c_loc(array)
#endif
reference%type_kind = pFIO_INT32
type is (integer(kind=INT64))
#if defined(ODD_IFX_BUG)
if (has_address) reference%base_address = c_loc(array(1,1,1,1))
#else
if (has_address) reference%base_address = c_loc(array)
#endif
reference%type_kind = pFIO_INT64
class default
_FAIL( "ArrayRef does not support this type")
end select
reference%shape = shape(array)

_RETURN(_SUCCESS)

end function new_ArrayReference_4d

function new_ArrayReference_5d(array, rc) result(reference)
Expand All @@ -199,16 +215,32 @@ function new_ArrayReference_5d(array, rc) result(reference)

select type (array)
type is (real(kind=REAL32))
#if defined(ODD_IFX_BUG)
if (has_address) reference%base_address = c_loc(array(1,1,1,1,1))
#else
if (has_address) reference%base_address = c_loc(array)
#endif
reference%type_kind = pFIO_REAL32
type is (real(kind=REAL64))
#if defined(ODD_IFX_BUG)
if (has_address) reference%base_address = c_loc(array(1,1,1,1,1))
#else
if (has_address) reference%base_address = c_loc(array)
#endif
reference%type_kind = pFIO_REAL64
type is (integer(kind=INT32))
#if defined(ODD_IFX_BUG)
if (has_address) reference%base_address = c_loc(array(1,1,1,1,1))
#else
if (has_address) reference%base_address = c_loc(array)
#endif
reference%type_kind = pFIO_INT32
type is (integer(kind=INT64))
#if defined(ODD_IFX_BUG)
if (has_address) reference%base_address = c_loc(array(1,1,1,1,1))
#else
if (has_address) reference%base_address = c_loc(array)
#endif
reference%type_kind = pFIO_INT64
class default
_FAIL( "ArrayRef does not support this type")
Expand All @@ -217,7 +249,7 @@ function new_ArrayReference_5d(array, rc) result(reference)
reference%shape = shape(array)

_RETURN(_SUCCESS)

end function new_ArrayReference_5d

integer function type_kind(element, rc)
Expand Down
14 changes: 7 additions & 7 deletions pfio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
esma_set_this (OVERRIDE MAPL.pfio)

if(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 20)
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER 17)
add_definitions(-D__ifort_18)
endif()
endif()
endif()
# This is a workaround for a current ifx bug
# Technically, this bug is only due to a bug between
# ifx, OpenMP, and ArrayReference.F90, but in CMake land, it
# is hard to remove OpenMP flags for a *single* file.
if (CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
set_source_files_properties(ArrayReference.F90 PROPERTIES COMPILE_DEFINITIONS ODD_IFX_BUG)
endif ()

set (srcs
# pFIO Files
Expand Down

0 comments on commit be39cab

Please sign in to comment.