Skip to content

Commit

Permalink
Another corrected test program: This one was trying to assign logical
Browse files Browse the repository at this point in the history
values into real array, which `gfortran` doesn't like. So, changed the
array type into logical (and same on the external numpy array too).
  • Loading branch information
pratyai committed Nov 6, 2024
1 parent 7c70423 commit 3b3550d
Showing 1 changed file with 27 additions and 28 deletions.
55 changes: 27 additions & 28 deletions tests/fortran/fortran_language_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,35 +91,35 @@ def test_fortran_frontend_loop1():
"""
Tests that the loop construct is correctly parsed and translated to DaCe.
"""

test_string = """
PROGRAM loop1_test
implicit none
double precision d(3,4,5)
CALL loop1_test_function(d)
end

SUBROUTINE loop1_test_function(d)
double precision d(3,4,5),ZFAC(10)
INTEGER :: a, JK, JL,JM
INTEGER, PARAMETER :: KLEV=10, N=10,NCLV=3
double precision :: RLMIN,ZVQX(NCLV)
LOGICAL :: LLCOOLJ,LLFALL(NCLV)
LLFALL(:)= .FALSE.
ZVQX(:)= 0.0
ZVQX(2)= 1.0
DO JM=1,NCLV
IF (ZVQX(JM)>0.0) LLFALL(JM)=.TRUE. ! falling species
ENDDO
d(1,1,1)=LLFALL(1)
d(1,1,2)=LLFALL(2)
END SUBROUTINE loop1_test_function
"""
test_string = """
program loop1_test
implicit none
logical :: d(3, 4, 5)
call loop1_test_function(d)
end
subroutine loop1_test_function(d)
logical :: d(3, 4, 5), ZFAC(10)
integer :: a, JK, JL, JM
integer, parameter :: KLEV = 10, N = 10, NCLV = 3
double precision :: RLMIN, ZVQX(NCLV)
logical :: LLCOOLJ, LLFALL(NCLV)
LLFALL(:) = .false.
ZVQX(:) = 0.0
ZVQX(2) = 1.0
do JM = 1, NCLV
if (ZVQX(JM) > 0.0) LLFALL(JM) = .true. ! falling species
end do
d(1, 1, 1) = LLFALL(1)
d(1, 1, 2) = LLFALL(2)
end subroutine loop1_test_function
"""
sdfg = fortran_parser.create_sdfg_from_string(test_string, "loop1_test")
sdfg.simplify(verbose=True)
d = np.full([3, 4, 5], 42, order="F", dtype=np.float64)
d = np.full([3, 4, 5], np.True_, order="F", dtype=np.bool_)
sdfg(d=d)
assert (d[0, 0, 0] == 0)
assert (d[0, 0, 1] == 1)
Expand Down Expand Up @@ -196,7 +196,7 @@ def test_fortran_frontend_pow2():
"""
Tests that the power intrinsic is correctly parsed and translated to DaCe (this time it's p sqrt p).
"""

test_string = """
PROGRAM pow2_test
implicit none
Expand Down Expand Up @@ -253,7 +253,6 @@ def test_fortran_frontend_sign1():


if __name__ == "__main__":

test_fortran_frontend_real_kind_selector()
test_fortran_frontend_if1()
test_fortran_frontend_loop1()
Expand Down

0 comments on commit 3b3550d

Please sign in to comment.