Discussion:
Why does the program stop when random numbers from a Poisson distribution are generated?
(too old to reply)
l***@aol.com
2009-03-19 17:39:09 UTC
Permalink
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.


PROGRAM TEST
USE MSIMSL
IMPLICIT NONE
INTEGER I, J
INTEGER NR
PARAMETER (NR=7)
INTEGER IR(NR), ISEED
REAL THETA, MEAN

THETA = 10.0
ISEED = 123457
CALL RNSET (ISEED)

DO I = 1, 100
CALL RNPOI (NR, THETA, IR)
MEAN = SUM(REAL(IR))/REAL(NR)
DO J = 1, 10000
WRITE(*,*) I, J
CALL RNPOI (NR, MEAN, IR)
END DO
END DO

END PROGRAM
dpb
2009-03-19 17:59:54 UTC
Permalink
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.
PROGRAM TEST
USE MSIMSL
My documentation says to USE numerical_libraries -- I'm not sure what
MSIMSL is for, but I'd recommend switching to the documented module
unless there's a specific reason for the other.

I didn't see anything real obvious otherwise--what error does IMSL
library return or other indications are there?

Is theta always >0?

--
LoveUs
2009-03-19 18:26:44 UTC
Permalink
Post by dpb
My documentation says to USE numerical_libraries -- I'm not sure what
MSIMSL is for, but I'd recommend switching to the documented module
unless there's a specific reason for the other.
I didn't see anything real obvious otherwise--what error does IMSL
library return or other indications are there?
Is theta always >0?
--
First of all, thanks for your reply.

I replaced "USE MSIMSL" with "USE numerical_libraries", but it still
stopped at I = 21 and J = 2396. No error message showed on the Fortran
screen.

Yes, theta > 0 always. When I = 21, MEAN = 10.14286 (>0).
dpb
2009-03-19 18:40:33 UTC
Permalink
Post by LoveUs
Post by dpb
My documentation says to USE numerical_libraries -- I'm not sure what
MSIMSL is for, but I'd recommend switching to the documented module
unless there's a specific reason for the other.
I didn't see anything real obvious otherwise--what error does IMSL
library return or other indications are there?
Is theta always >0?
--
First of all, thanks for your reply.
I replaced "USE MSIMSL" with "USE numerical_libraries", but it still
stopped at I = 21 and J = 2396. No error message showed on the Fortran
screen.
Yes, theta > 0 always. When I = 21, MEAN = 10.14286 (>0).
What are the error settings in IMSL? Have you got all debugging options
set in CVF? I've not time at the moment to try your program here; later
on tonight, maybe if somebody else hasn't got around to it before then.

Seems like there has to be something detectable--you mean you get what
appears to be a normal stop?

--
glen herrmannsfeldt
2009-03-19 19:43:51 UTC
Permalink
Post by LoveUs
I replaced "USE MSIMSL" with "USE numerical_libraries", but it still
stopped at I = 21 and J = 2396. No error message showed on the Fortran
screen.
I was just wondering about the use of modules one closed
source libraries. USE and the .mod should only depend
on the entry/exit code. (I suppose the INTERFACE in
Fortran terminology.) It should, then, be possible to
write dummy modules that don't contain any useful code,
but that will generate the appropriate .mod file (or whatever
the specific system needs). I wonder if any of
the closed source libraries do that.

-- glen
Steve Lionel
2009-03-19 20:08:11 UTC
Permalink
Post by glen herrmannsfeldt
I was just wondering about the use of modules one closed
source libraries. USE and the .mod should only depend
on the entry/exit code. (I suppose the INTERFACE in
Fortran terminology.) It should, then, be possible to
write dummy modules that don't contain any useful code,
but that will generate the appropriate .mod file (or whatever
the specific system needs). I wonder if any of
the closed source libraries do that.
In the versions of IMSL used by MSFPS and CVF, modules with interface
blocks were provided. The source of those modules were also provided.
This is similar to the Win32 declaration modules provided by MSFPS, CVF
and IVF. Dummy routines are not needed - just INTERFACE blocks.

The newer IMSL versions added a new "Fortran 90" interface for routines
- some new routines are provided only in that form. For those you need
to use different modules, some of which are generic interfaces and some
are the result of compiling the source (which is not provided.)

--
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH

For email address, replace "invalid" with "com"

User communities for Intel Software Development Products
http://software.intel.com/en-us/forums/
Intel Fortran Support
http://support.intel.com/support/performancetools/fortran
My Fortran blog
http://www.intel.com/software/drfortran
LoveUs
2009-03-19 20:08:30 UTC
Permalink
Post by glen herrmannsfeldt
Post by LoveUs
I replaced "USE MSIMSL" with "USE numerical_libraries", but it still
stopped at I = 21 and J = 2396. No error message showed on the Fortran
screen.
I was just wondering about the use of modules one closed
source libraries.  USE and the .mod should only depend
on the entry/exit code.  (I suppose the INTERFACE in
Fortran terminology.)  It should, then, be possible to
write dummy modules that don't contain any useful code,
but that will generate the appropriate .mod file (or whatever
the specific system needs).   I wonder if any of
the closed source libraries do that.
-- glen
Sorry, I don't understand what you meant because I am a new user. I
tried to change THETA from 10.0 to 5.0, and then it can ran to
completion. However, I must know why it doesn't work when THETA = 10.0
or other values because I will run more programs for different THETA.
Steve Lionel
2009-03-19 19:07:22 UTC
Permalink
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.
I don't have those versions handy right now, but I tried this with Intel
Visual Fortran 11.0 and IMSL 6.0 and it ran to completion.
--
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH

For email address, replace "invalid" with "com"

User communities for Intel Software Development Products
http://software.intel.com/en-us/forums/
Intel Fortran Support
http://support.intel.com/support/performancetools/fortran
My Fortran blog
http://www.intel.com/software/drfortran
unknown
2009-03-19 19:25:24 UTC
Permalink
On Thu, 19 Mar 2009 15:07:22 -0400, Steve Lionel
Post by Steve Lionel
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.
I don't have those versions handy right now, but I tried this with Intel
Visual Fortran 11.0 and IMSL 6.0 and it ran to completion.
I can just add that on MS FPS4 it ran to completion as well (using
MSIMSL).
On CVF66c it ran into the same problems as the OP described (using
MSIMSL and numerical_libraries), ending with 21 and ....

best regards
Luka
Dave Seaman
2009-03-19 21:34:56 UTC
Permalink
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.
PROGRAM TEST
USE MSIMSL
IMPLICIT NONE
INTEGER I, J
INTEGER NR
PARAMETER (NR=7)
INTEGER IR(NR), ISEED
REAL THETA, MEAN
THETA = 10.0
ISEED = 123457
CALL RNSET (ISEED)
DO I = 1, 100
CALL RNPOI (NR, THETA, IR)
MEAN = SUM(REAL(IR))/REAL(NR)
DO J = 1, 10000
WRITE(*,*) I, J
CALL RNPOI (NR, MEAN, IR)
END DO
END DO
END PROGRAM
The problem is that you are attempting to call RNPOI with the Fortran 77
interface, but the Fortran 90 interface is different. In fact, when I
compiled this, I first deleted

USE MSIMSL

since there is no such module in my environment, and I added the two lines

USE RNSET_INT
USE RNPOI_INT

in order to use the specific modules where those functions are defined.
I then got the compiler message that

No specific match can be found for the generic subprogram call
"RNPOI".

The F90 interface to RNPOI, according to the IMSL documentation, has two
required arguments and one optional argument. The first argument in the F77
call becomes optional and therefore is moved to the last position in the F90
call, if it is present. The default value for NR is SIZE(IR,1).

Hence, you should change

CALL RNPOI (NR, THETA, IR)

to

CALL RNPOI (THETA, IR)

and likewise with the second reference to RNPOI.

With these changes, I was able to compile and run your program and no error
messages were issued.
--
Dave Seaman
Third Circuit ignores precedent in Mumia Abu-Jamal ruling.
<http://www.indybay.org/newsitems/2008/03/29/18489281.php>
mecej4
2009-03-21 15:07:08 UTC
Permalink
Post by Dave Seaman
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.
PROGRAM TEST
USE MSIMSL
IMPLICIT NONE
INTEGER I, J
INTEGER NR
PARAMETER (NR=7)
INTEGER IR(NR), ISEED
REAL THETA, MEAN
THETA = 10.0
ISEED = 123457
CALL RNSET (ISEED)
DO I = 1, 100
CALL RNPOI (NR, THETA, IR)
MEAN = SUM(REAL(IR))/REAL(NR)
DO J = 1, 10000
WRITE(*,*) I, J
CALL RNPOI (NR, MEAN, IR)
END DO
END DO
END PROGRAM
The problem is that you are attempting to call RNPOI with the Fortran 77
interface, but the Fortran 90 interface is different. In fact, when I
compiled this, I first deleted
USE MSIMSL
since there is no such module in my environment, and I added the two lines
USE RNSET_INT
USE RNPOI_INT
in order to use the specific modules where those functions are defined.
I then got the compiler message that
No specific match can be found for the generic subprogram call
"RNPOI".
The F90 interface to RNPOI, according to the IMSL documentation, has two
required arguments and one optional argument. The first argument in the F77
call becomes optional and therefore is moved to the last position in the F90
call, if it is present. The default value for NR is SIZE(IR,1).
Hence, you should change
CALL RNPOI (NR, THETA, IR)
to
CALL RNPOI (THETA, IR)
and likewise with the second reference to RNPOI.
With these changes, I was able to compile and run your program and no error
messages were issued.
Although your analysis is correct and useful, it pertains to a different
version of the IMSL library. The version that accompanied CVF6.6 had
only Fortran-77 style interfaces. Here is the interface from
<CVF-DIR>\DF98\IMSL\INCLUDE\DFIMSLC.F90 (which is USE-d in MSIMSL.F90):

interface
subroutine rnpoi (nr, theta, ir)
integer nr, ir(*)
real theta
end subroutine
end interface

The OP has, after all, merely used the example code in the IMSL
documentation, adding a couple of loops around the call. The executable
produced by CVF 6.6 hangs after I = 21 and J = 2396.

-- mecej4
dpb
2009-03-21 15:24:54 UTC
Permalink
mecej4 wrote:
...
Post by mecej4
The OP has, after all, merely used the example code in the IMSL
documentation, adding a couple of loops around the call. The executable
produced by CVF 6.6 hangs after I = 21 and J = 2396.
...
Confirmed here as well w/ CVF 6.6c

--
Dave Seaman
2009-03-21 16:00:39 UTC
Permalink
Post by mecej4
Post by Dave Seaman
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.
PROGRAM TEST
USE MSIMSL
IMPLICIT NONE
INTEGER I, J
INTEGER NR
PARAMETER (NR=7)
INTEGER IR(NR), ISEED
REAL THETA, MEAN
THETA = 10.0
ISEED = 123457
CALL RNSET (ISEED)
DO I = 1, 100
CALL RNPOI (NR, THETA, IR)
MEAN = SUM(REAL(IR))/REAL(NR)
DO J = 1, 10000
WRITE(*,*) I, J
CALL RNPOI (NR, MEAN, IR)
END DO
END DO
END PROGRAM
The problem is that you are attempting to call RNPOI with the Fortran 77
interface, but the Fortran 90 interface is different. In fact, when I
compiled this, I first deleted
USE MSIMSL
since there is no such module in my environment, and I added the two lines
USE RNSET_INT
USE RNPOI_INT
in order to use the specific modules where those functions are defined.
I then got the compiler message that
No specific match can be found for the generic subprogram call
"RNPOI".
The F90 interface to RNPOI, according to the IMSL documentation, has two
required arguments and one optional argument. The first argument in the F77
call becomes optional and therefore is moved to the last position in the F90
call, if it is present. The default value for NR is SIZE(IR,1).
Hence, you should change
CALL RNPOI (NR, THETA, IR)
to
CALL RNPOI (THETA, IR)
and likewise with the second reference to RNPOI.
With these changes, I was able to compile and run your program and no error
messages were issued.
Although your analysis is correct and useful, it pertains to a different
version of the IMSL library. The version that accompanied CVF6.6 had
only Fortran-77 style interfaces. Here is the interface from
interface
subroutine rnpoi (nr, theta, ir)
integer nr, ir(*)
real theta
end subroutine
end interface
The OP has, after all, merely used the example code in the IMSL
documentation, adding a couple of loops around the call. The executable
produced by CVF 6.6 hangs after I = 21 and J = 2396.
Then it's a problem with the implementation, because the program runs to
completion on the two other platforms that I tried (Linux and Mac OS X).
--
Dave Seaman
Third Circuit ignores precedent in Mumia Abu-Jamal ruling.
<http://www.indybay.org/newsitems/2008/03/29/18489281.php>
dpb
2009-03-21 17:44:56 UTC
Permalink
Dave Seaman wrote:
...
Post by Dave Seaman
Then it's a problem with the implementation, because the program runs to
completion on the two other platforms that I tried (Linux and Mac OS X).
Yes, that was the conclusion drawn previously...what, specifically,
could be inferred from more digging I've not tried but something's
munged under that particular set of circumstances w/ the specific
library distribution.

--

robin
2009-03-20 14:22:34 UTC
Permalink
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.
You've not showed the whole program.
mecej4
2009-03-20 14:31:01 UTC
Permalink
Post by robin
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to
generate pseudorandom numbers from a Poisson distribution, it
cannot execute the following program and always stops at I = 21
and J = 2396. Can anybody tell me what's wrong with my program?
Thanks a lot.
You've not showed the whole program.
He showed as much as he can -- the missing code is in the proprietary IMSL library. Moreover, the problem that he stated does not occur with other combinations of compiler and IMSL library.

-- mecej4
robin
2009-03-21 12:42:36 UTC
Permalink
Post by mecej4
Post by robin
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to
generate pseudorandom numbers from a Poisson distribution, it
cannot execute the following program and always stops at I = 21
and J = 2396. Can anybody tell me what's wrong with my program?
Thanks a lot.
You've not showed the whole program.
He showed as much as he can
That isn't correct, either.

If he doesn't have the code, he has the description of how
to use the procedures that he invoked.
Dave Seaman
2009-03-21 14:59:50 UTC
Permalink
Post by robin
Post by mecej4
Post by robin
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to
generate pseudorandom numbers from a Poisson distribution, it
cannot execute the following program and always stops at I = 21
and J = 2396. Can anybody tell me what's wrong with my program?
Thanks a lot.
You've not showed the whole program.
He showed as much as he can
That isn't correct, either.
If he doesn't have the code, he has the description of how
to use the procedures that he invoked.
<http://www.vni.com/products/imsl/documentation/fort06/Stat.pdf>

See Chapter 18.

RNSET is on page 1361. RNPOI is on page 1395 and has two different
interfaces for F77 and F95. In general, the IMSL F95 interfaces require
fewer arguments and are more convenient to use. In the case of RNSET it
doesn't matter, but the F95 call for RNPOI has the arguments in a
different order and one of them is optional.

To get the F95 interfaces:

USE RNSET_INT
USE RNPOI_INT

The posted program, however, has

USE MSIMSL

and uses F77-style calls. MSIMSL is evidently a Microsoft-specific
module that I do not have access to. I was able to get the posted
program to run to completion on RedHat Linux and on Mac OS X by changing

USE MSIMSL
to
USE NUMERICAL_LIBRARIES
or
USE NUMERICAL_LIBRARIES_R

in order to access the F77 interfaces. Deleting the USE statements
altogether also works, of course, when using the F77 interface, but is
less safe because the compiler does not have the opportunity to check the
argument lists.
--
Dave Seaman
Third Circuit ignores precedent in Mumia Abu-Jamal ruling.
<http://www.indybay.org/newsitems/2008/03/29/18489281.php>
unknown
2009-03-20 18:25:26 UTC
Permalink
Post by robin
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.
You've not showed the whole program.
Yes he did.
robin
2009-03-21 12:42:36 UTC
Permalink
Post by unknown
Post by robin
Post by l***@aol.com
When I used Compaq Visual Fortran Professional Edition 6.6 to generate
pseudorandom numbers from a Poisson distribution, it cannot execute
the following program and always stops at I = 21 and J = 2396. Can
anybody tell me what's wrong with my program? Thanks a lot.
You've not showed the whole program.
Yes he did.
Not the procedures that are called, which is where the
problem is occurring..
Loading...