andy buzza
2016-07-24 19:54:49 UTC
Hello all,
I have been trying to compile a relatively simple pair of Fortran files,
one referencing a subroutine from another file (mainmodule.f90 references
othermodule.f90). I have been able to compile them using a Fortran
compiler, but receive a NotImplementedError when using f2py.
Steps I use for f2py:
$gfortran -shared -o othermodule.so othermodule.f90 -fPIC
$f2py -c -l/path/othermodule -m mainmodule mainmodule.f90
I am running this on linux and wasn't sure how to correct the error.
othermodule.f90
module moderator
implicit none
integer*1 :: i
integer*8 :: fact,len
real*8,dimension(:),allocatable :: ex
contains
subroutine submarine(ii,ff,exex)
implicit none
integer*1 :: ii
integer*8 :: ff
real*8 :: exex
exex=exp(real(ii))/ff
end subroutine submarine
end module moderator
mainmodule.f90
program mains
use moderator
implicit none
len=10
allocate(ex(len))
fact=1
do i=1,len
fact=fact*i
call submarine(i,fact,ex(i))
if (i==1) then
print*,"here's your ",i,"st number: ",ex(i)
elseif (i==2) then
print*,"here's your ",i,"nd number: ",ex(i)
elseif (i==3) then
print*,"here's your ",i,"rd number: ",ex(i)
else
print*,"here's your ",i,"th number: ",ex(i)
endif
enddo
deallocate(ex)
end program
Thanks for the help,
Andy
I have been trying to compile a relatively simple pair of Fortran files,
one referencing a subroutine from another file (mainmodule.f90 references
othermodule.f90). I have been able to compile them using a Fortran
compiler, but receive a NotImplementedError when using f2py.
Steps I use for f2py:
$gfortran -shared -o othermodule.so othermodule.f90 -fPIC
$f2py -c -l/path/othermodule -m mainmodule mainmodule.f90
I am running this on linux and wasn't sure how to correct the error.
othermodule.f90
module moderator
implicit none
integer*1 :: i
integer*8 :: fact,len
real*8,dimension(:),allocatable :: ex
contains
subroutine submarine(ii,ff,exex)
implicit none
integer*1 :: ii
integer*8 :: ff
real*8 :: exex
exex=exp(real(ii))/ff
end subroutine submarine
end module moderator
mainmodule.f90
program mains
use moderator
implicit none
len=10
allocate(ex(len))
fact=1
do i=1,len
fact=fact*i
call submarine(i,fact,ex(i))
if (i==1) then
print*,"here's your ",i,"st number: ",ex(i)
elseif (i==2) then
print*,"here's your ",i,"nd number: ",ex(i)
elseif (i==3) then
print*,"here's your ",i,"rd number: ",ex(i)
else
print*,"here's your ",i,"th number: ",ex(i)
endif
enddo
deallocate(ex)
end program
Thanks for the help,
Andy