Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • nitin_amtOctober 3, 2008 3: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)October 3, 2008 4:44 PM PDT
    Rate
     
    Re: RAN function not working

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



    Steve

    Attaching or including files in a post
    Doctor Fortran blog
    @DoctorFortran on Twitter

    Brian FrancisOctober 6, 2008 11:30 AM PDT
    Rate
     
    Re: RAN function not working

    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 FrancisOctober 6, 2008 11:33 AM PDT
    Rate
     
    Re: RAN function not working

    Replace "negative" with "odd" in my reply above. Next time I'll read the docs first and post second.

     



    Steve NuchiaOctober 8, 2008 7:07 AM PDT
    Rate
     
    Re: RAN function not working

    The doc give a specific example using 3.  It doesn't work in 10.1.019.

     



    Brian FrancisOctober 8, 2008 12:40 PM PDT
    Rate
     
    Re: RAN function not working

    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)October 9, 2008 5:02 AM PDT
    Rate
     
    Re: RAN function not working

    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 NuchiaOctober 9, 2008 2:34 PM PDT
    Rate
     
    Re: RAN function not working

    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)March 2, 2009 11:44 AM PST
    Rate
     
    Re: RAN function not working


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

Forum jump:  

Intel Software Network Forums Statistics

17,025 users have contributed to 48,321 threads and 172,753 posts to date.

In the past 24 hours, we have 16 new thread(s) 57 new posts(s), and 54 new user(s).

In the past 3 days, the most popular thread for everyone has been How to manage rounding by IVF ?? The most posts were made to Most likely, the issue is that The post with the most views is Optimalization of sine function\'s taylor expansion

Please welcome our newest member redfruit83


For more complete information about compiler optimizations, see our Optimization Notice.