Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
nitin_amt
Total Points:
10
Registered User
October 3, 2008 4:01 PM PDT
RAN function not working

Ran function is not working with "Intel(R) Fortran Compiler Integration for Microsoft Visual Studio 2008, 10.1.3440.2008, Copyright (C) 2002-2008 Intel Corporation"

The code not working is below with line numbers at the start of each line. At line 6 when I call RAN(IFF), the value of IFF is still the same after line 6 is excuted. I would expect the value of IFF change after line 6. But this is not the case. Please help with the issue. Thanks in advance.

 

 

 

 

 

 

 

1. program

 

 

 seven_11
2. USE IFPORT, ONLY: SRAND,RAN, RAND
3. integer*4 IFF
4. real*4 RAN2
5. DATA IFF /3333337/
6. RAN2=RAN(IFF)
7. IFF = 357
8. RAN2=RAN(IFF)
9. end program seven_11

Steve Lionel (Intel)
Total Points:
115,145
Status Points:
115,145
Black Belt
October 3, 2008 5:44 PM PDT
Rate
 
#1

Curious.  I can reproduce this.  I suggest using the standard intrinsic RANDOM_NUMBER instead,  I'll report this to the developers.




Brian Francis
Total Points:
485
Status Points:
0
Green Belt
October 6, 2008 12:30 PM PDT
Rate
 
#2 Reply to #1
I think it is working fine. The first call to RAN should use a large negative number as a seed for best results, but the important point to remember is that given the same seed value, the "random" results will be identical from one run to the next (handy for debugging). For a truly random result, try using an integer seed deived from the date and time.
Brian.

 



Brian Francis
Total Points:
485
Status Points:
0
Green Belt
October 6, 2008 12:33 PM PDT
Rate
 
#3 Reply to #2
Replace "negative" with "odd" in my reply above. Next time I'll read the docs first and post second.

 



Steve Nuchia
Total Points:
2,237
Status Points:
1,737
Brown Belt
October 8, 2008 8:07 AM PDT
Rate
 
#4 Reply to #3
The doc give a specific example using 3.  It doesn't work in 10.1.019.

 



Brian Francis
Total Points:
485
Status Points:
0
Green Belt
October 8, 2008 1:40 PM PDT
Rate
 
#5 Reply to #4
The doc give a specific example using 3.  It doesn't work in 10.1.019.

I've tried the following with 10.1.021 and get results as advertised...

program main
integer seed/3/ write (*,*) ran(seed)
write (*,*) ran(seed)
end

...which outputs...

4.8220158E-05
0.3321905

 Brian.



Kevin Davis (Intel)
Total Points:
11,112
Status Points:
10,612
Brown Belt
October 9, 2008 6:02 AM PDT
Rate
 
#6 Reply to #5
I found that with IVF 10.x, the USE IFPORT interferes with RAN which the original sample program included.

 

If Brian’s program is modified slightly as shown:

program main
use ifport
integer iseed /3/   
write (*,*) ran(iseed)
write (*,*) ran(iseed)
end

  

Then it prints:

 

  6.7433808E-05

  6.7433808E-05

 

If line 2 is removed, then it prints:

 

  4.8220158E-05

  0.3321905

 

I reported this to the Fortran Front-end team and will follow-up when I know more. (Internal ref. CQ- 50312)

 



Steve Nuchia
Total Points:
2,237
Status Points:
1,737
Brown Belt
October 9, 2008 3:34 PM PDT
Rate
 
#7 Reply to #6
My bad: the using statement was something I put in there to get it compiling during the initial porting pass, long before we could actually run anything.
"It seemed like the thing to do at the time."

 



Kevin Davis (Intel)
Total Points:
11,112
Status Points:
10,612
Brown Belt
March 2, 2009 12:44 PM PST
Rate
 
#8 Reply to #7

This issue is fixed in the latest IVF 11.0 update, 11.0.072 (Windows).



Intel Software Network Forums Statistics

8470 users have contributed to 31601 threads and 100650 posts to date.
In the past 24 hours, we have 29 new thread(s) 115 new posts(s), and 162 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member kopernikus