Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fixed GEOSlandpert build when MKL is unavailable by enabling MKL-specific code paths only when MKL is detected.

### Removed

- Removed 2d lfs collection from HISTORY.rc template.
Expand Down
5 changes: 3 additions & 2 deletions GEOSlandpert_GridComp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ esma_add_library (${this}
DEPENDENCIES GEOS_LdasShared GEOSens_GridComp GEOSland_GridComp MAPL ${MKL_LIBRARIES}
INCLUDES ${INC_ESMF} ${MKL_INCLUDE_DIRS})

if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "NAG")
target_compile_definitions(${this} PRIVATE MKL_AVAILABLE)
# Enable MKL paths only when MKL was detected and the compiler supports it.
if (MKL_FOUND AND NOT CMAKE_Fortran_COMPILER_ID MATCHES "NAG")
target_compile_definitions(${this} PRIVATE MKL_AVAILABLE)
endif ()
7 changes: 6 additions & 1 deletion GEOSlandpert_GridComp/random_fields.F90
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,13 @@ subroutine sqrt_gauss_spectrum_2d(this, lx, ly, dx, dy)
! assemble spectrum in "wrap-around" order
i1 = 1
i2 = this%N_x_fft
#ifdef MKL_AVAILABLE
if (this%comm /= MPI_COMM_NULL) then
call MPI_COMM_Rank(this%node_comm, rank, ierror)
i1 = sum(this%dim1_counts(1:rank)) + 1
i2 = sum(this%dim1_counts(1:rank+1))
endif
#endif

do j=1,this%N_y_fft
this%field1_fft(i1:i2,j) = fac*exp(-.25*(lx2kx2(i1:i2)+ly2ky2(j)))
Expand Down Expand Up @@ -395,13 +397,14 @@ subroutine rfg2d_fft(this, rseed, rfield, rfield2, lx, ly, dx, dy)
integer :: i, j
integer :: N_x_fft, N_y_fft
real :: N_xy_fft_real
integer :: n1, n2
#ifdef MKL_AVAILABLE
integer :: status
complex, allocatable :: z_inout(:)
complex, pointer :: tmp_field(:,:)
complex, pointer :: tmp_field_dim1(:,:)
complex, pointer :: tmp_field_dim2(:,:)
integer :: n1, n2, npes, rank, ldim1, ldim2, ierror
integer :: npes, rank, ldim1, ldim2, ierror
complex, pointer :: X(:)
type (c_ptr) :: cptr
#else
Expand Down Expand Up @@ -624,6 +627,7 @@ subroutine quit(message)

end subroutine quit

#ifdef MKL_AVAILABLE
subroutine win_allocate(this, nx, ny, rc)
class(random_fields), intent(inout) :: this
integer, intent(in) :: nx, ny
Expand Down Expand Up @@ -662,6 +666,7 @@ subroutine win_deallocate(this, rc)
_VERIFY(status)

end subroutine win_deallocate
#endif

end module Random_fieldsMod

Expand Down
Loading