Home > Archive > Fortran > November 2005 > not able to use implicit none
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
not able to use implicit none
|
|
| Kamaraju Kusumanchi 2005-11-17, 9:57 pm |
| I am not able to use implicit none statement when using IMSL libraries.
I must be doing something wrong here. Could you please help me out?
$cat test_bsj0.f90
! This code does not work if the implicit none line is uncommented.
!
! Tested using Absoft Fortran 8.0
! Compiling commands used
! f90 test_bsj0.f90 -limsl -limslblas -YCFRL=1 -YEXT_NAMES=ASIS
program bessel
! implicit none
write(*,*) bsj0_(2.0)
end program bessel
$f90 test_bsj0.f90 -limsl -limslblas -YCFRL=1 -YEXT_NAMES=ASIS; ./a.out
0.223891
If I uncomment the implicit none statement then
$f90 test_bsj0.f90 -limsl -limslblas -YCFRL=1 -YEXT_NAMES=ASIS
write(*,*) bsj0_(2.0)
^
cf90-232 f90fe: ERROR BESSEL, File = test_bsj0.f90, Line = 10, Column = 14
IMPLICIT NONE is specified in the local scope, therefore an explicit
type must be specified for function "BSJ0_".
f90: Copyright Absoft Corporation 1994-2002; Absoft Pro FORTRAN Version 8.0
f90fe: 11 source lines
f90fe: 1 Errors, 0 Warnings, 0 Other messages, 0 ANSI
I assume that the IMSL libraries were installed properly as I was
getting the correct answer without the implicit none statement. Thanks
in advance for any suggestions.
bye
raju
--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/
| |
| Jonas Stein 2005-11-17, 9:57 pm |
| Hi Kamaraju Kusumanchi
> I am not able to use implicit none statement when using IMSL librarie=
s.
> I must be doing something wrong here. Could you please help me out?
it seems you forgot to tell the compiler about the type of the function=
..
--=20
mit besten Gr=FC=DFen,
Jonas Stein <news@jonasstein.de> =20
| |
| Dan Nagle 2005-11-17, 9:57 pm |
| Hello,
Kamaraju Kusumanchi wrote:
> I am not able to use implicit none statement when using IMSL libraries.
> I must be doing something wrong here. Could you please help me out?
>
>
> $cat test_bsj0.f90
> ! This code does not work if the implicit none line is uncommented.
> !
> ! Tested using Absoft Fortran 8.0
> ! Compiling commands used
> ! f90 test_bsj0.f90 -limsl -limslblas -YCFRL=1 -YEXT_NAMES=ASIS
>
> program bessel
> ! implicit none
>
> write(*,*) bsj0_(2.0)
> end program bessel
>
>
> $f90 test_bsj0.f90 -limsl -limslblas -YCFRL=1 -YEXT_NAMES=ASIS; ./a.out
> 0.223891
OK, so everything's working.
> If I uncomment the implicit none statement then
>
> $f90 test_bsj0.f90 -limsl -limslblas -YCFRL=1 -YEXT_NAMES=ASIS
>
> write(*,*) bsj0_(2.0)
> ^
> cf90-232 f90fe: ERROR BESSEL, File = test_bsj0.f90, Line = 10, Column = 14
> IMPLICIT NONE is specified in the local scope, therefore an explicit
> type must be specified for function "BSJ0_".
Quite properly so.
You should add a declaration for bsj0_, something like
real( kind= ???), external :: bsj0_
or, because bsj0_ is a function, you might try an interface block:
interface
real( kind= ???) function bsj0_( x)
<< declare your type kind value here >>
real( kind= ???), intent( in) :: x
end function bsj0_
end interface
Either should work.
I put the ??? above because I don't know whether bsj0_
is single precision or double precision, and I can't recall
off the top of my head what Absoft's kind values are, anyway.
> f90: Copyright Absoft Corporation 1994-2002; Absoft Pro FORTRAN Version 8.0
> f90fe: 11 source lines
> f90fe: 1 Errors, 0 Warnings, 0 Other messages, 0 ANSI
>
>
> I assume that the IMSL libraries were installed properly as I was
> getting the correct answer without the implicit none statement.
That's the conclusion I would draw.
Another possibility is to place a use statement for imsl,
use imsl
and if you really want to get fancy, add an only clause
use imsl, only: bsj0
(You probably don't need the _ , the module will somehow
add that for you. But RTFM to be sure.)
> Thanks
> in advance for any suggestions.
>
> bye
> raju
HTH
--
Cheers!
Dan Nagle
Purple Sage Computing Solutions, Inc.
| |
| Kamaraju Kusumanchi 2005-11-17, 9:57 pm |
| Dan Nagle wrote:
>
> Quite properly so.
>
> You should add a declaration for bsj0_, something like
>
> real( kind= ???), external :: bsj0_
>
Thanks for the answer. It works. I always put all my functions in a
dummy module and so never felt the need to write prototypes. I am so
much used to this style that now I almost forgot the need to give
prototypes of functions used and thus fallen as a victim to the above
problem.
thanks again
raju
--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/
| |
| Richard Maine 2005-11-17, 9:57 pm |
| Kamaraju Kusumanchi <kk288@cornell.edu> wrote:
> Thanks for the answer. It works. I always put all my functions in a
> dummy module and so never felt the need to write prototypes....
If you like that style (as I do), but you are also working with a 3rd
party library that is not in a module, one possible approach is to write
the interface bodies (that's the Fortran-speak for "prototypes") and put
those interface bodies in a module. You can then use your module in the
style you are used to. You do still have to write the interface bodies,
but at least you only have to do it once (and you don't necessarily have
to do it for every procedure in the library - just the ones that you
use).
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
| |
| richard.koolhans@gmail.com 2005-11-18, 7:01 pm |
| IMSL provides a module that does this for you. (I now work for them,
once again.) You can simply put 'USE Numerical_Libraries' just before
'implicit none'. IMSL has done this interface work for the users. I
believe a better job could be done on making this known.
Using interface bodies is good practice, as noted.
Cheers, DTB
| |
| Kamaraju Kusumanchi 2005-11-18, 7:01 pm |
| richard.koolhans@gmail.com wrote:
> IMSL provides a module that does this for you. (I now work for them,
> once again.) You can simply put 'USE Numerical_Libraries' just before
> 'implicit none'. IMSL has done this interface work for the users. I
> believe a better job could be done on making this known.
> Using interface bodies is good practice, as noted.
> Cheers, DTB
>
That is good news. But I am not sure how to use this in the actual program.
$cat test_imsl_use.f90
program bessel
use Numerical_Libraries
implicit none
!real, external :: bsj0_
write(*,*) bsj0_(2.0)
end program bessel
On my system, The NUMERICAL_LIBRARIES.mod file is located on
/opt/absoft/modules directory
$ls /opt/absoft/modules/NUM*
/opt/absoft/modules/NUMERICAL_LIBRARIES.mod
$f90 -I/opt/absoft/modules test_imsl_use.f90 -limsl -limslblas -YCFRL=1
-YEXT_NAMES=ASIS
use Numerical_Libraries
^
cf90-292 f90fe: ERROR BESSEL, File = test_imsl_use.f90, Line = 2, Column = 7
"NUMERICAL_LIBRARIES" is specified as the module name on a USE
statement, but the compiler cannot find it.
write(*,*) bsj0_(2.0)
^
cf90-232 f90fe: ERROR BESSEL, File = test_imsl_use.f90, Line = 6, Column
= 14
IMPLICIT NONE is specified in the local scope, therefore an explicit
type must be specified for function "BSJ0_".
f90: Copyright Absoft Corporation 1994-2002; Absoft Pro FORTRAN Version 8.0
f90fe: 7 source lines
f90fe: 2 Errors, 0 Warnings, 0 Other messages, 0 ANSI
So I am not sure why it is not able to find the NUMERICAL_LIBRARIES.mod
file even though I specified its path (/opt/absoft/modules). I checked
the absoft documentation on how to link/use the Numerical_Libraries
module but could not find any compiling commands.
thanks for any advice
raju
--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/
|
|
|
|
|