-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace another FORTRAN test program with gfortran -Wall
certified test program.
#1736
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please check what happens if we try to receive a bool from an external Fortran code (via slotting in our function as an external C call in a F code). I think from there we receive bools either as int or char values. That is why multi_sdfg has a different behavior. If so, can you please make it a config option whether the frontend parses bools as bools or ints (to ensure compatibility with external functions?) Please also add such a test if possible - it will need a different style of calling it too.
values into real array, which `gfortran` doesn't like. So, changed the array type into logical (and same on the external numpy array too).
3b3550d
to
450d4c1
Compare
Thanks for pointing this out. The logical array
Can I defer it for a separate future PR? Making it configurable means having to wire through the entire stack of the frontend, which is difficult to do without diverging multi_sdfg from main even more. Calling the C SDFG interface from Fortran works as follows
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
integer :: tmp
do I = 1, 3
do J = 1, 4
do K = 1, 5
tmp = I+J+K-3
tmp = mod(tmp, 2)
if (tmp == 1) then
d(I, J, K) = .true.
else
d(I, J, K) = .false.
end if
end do
end do
end do
end subroutine loop1_test_function
#include "loop1_test_function.h"
extern "C" int foo_(int * __restrict__ d) {
auto handle = __dace_init_loop1_test_function();
__program_loop1_test_function(handle, d);
return __dace_exit_loop1_test_function(handle);
}
program main
implicit none
external foo
logical :: d(3, 4, 5) = .false.
print *, d
call foo(d)
print *, d
print *, d(1, 1, 1)
print *, d(1, 1, 2)
stop
end program main
This gets me a pattern like expected:
I think that's because the |
array for a checkerboard pattern.
450d4c1
to
c70b523
Compare
LGTM |
A follow up of #1733 that took a bit longer to figure out.
This change breaks the test on
multi_sdfg
branch, but there the front-end is doing something additionally wrong (it somehow promotesnclv
into a input parameter for the whole program) -- but it will even take longer to figure out why.