Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Re: Derived typ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 22 of 26 Topic 8212 of 8656
Post > Topic >>

Re: Derived types and allocatable

by Damian <damian@[EMAIL PROTECTED] > May 8, 2008 at 07:56 PM

On May 8, 9:52 am, Steve Lionel <Steve.Lio...@[EMAIL PROTECTED]
> wrote:
> On Thu, 8 May 2008 09:05:09 -0700 (PDT), Damian <dam...@[EMAIL PROTECTED]
>
wrote:
> >I will e-mail you my contact information.  I can probably give you
> >enough information offline so that you could track down the issue
> >number.
>
> Please do.  It is probable that the fix went into an update to 10.1. 
Your
> name and email address (at the time) should be all I need.
> --
> Steve Lionel
> Developer Products Division
> Intel Cor****ation
> Nashua, NH
>
> For email address, replace "invalid" with "com"
>
> User communities for Intel Software Development Products
>  http://softwareforums.intel.com/
> Intel Fortran Sup****t
>  http://sup****t.intel.com/sup****t/performancetools/fortran
> My Fortran blog
>  http://www.intel.com/software/drfortran

Name: Damian Rouson.  At that time, my e-mail address was
damian.rouson@[EMAIL PROTECTED]
  That address is no longer active and
someone else submitted it on my behalf so it might be under her name
and e-mail address.

I found this code that I *think* was submitted with the bug re****t
(can't recall if this was for the first bug re****t, which was fixed,
or for the second, which was not fixed in the initial release of 10.1
but might be fixed in a more recent release):


MODULE Vector_Module

  IMPLICIT NONE

  PRIVATE                 ! hide all types & procedures by default
  PUBLIC :: Vector        ! expose type
  PUBLIC :: Vector_       ! expose constructor

  TYPE Vector
    PRIVATE
    REAL ,DIMENSION(:), ALLOCATABLE :: component
  END TYPE Vector

  CONTAINS

    ! ___________ Vector constructor: allocate/initialize state
variables _______

    FUNCTION Vector_(num_elements) RESULT(this)
      INTEGER  ,INTENT(IN) :: num_elements
      TYPE(Vector)         :: this

      ALLOCATE(this%component(num_elements))

      this%component = 0.0

    END FUNCTION Vector_

END MODULE Vector_Module

MODULE Double_Vector_Module

  USE Vector_Module

  IMPLICIT NONE

  PRIVATE                  ! hide all types & procedures by default
  PUBLIC :: Double_Vector  ! expose type
  PUBLIC :: Double_Vector_ ! expose constructor

  TYPE Double_Vector
    PRIVATE
    TYPE(Vector) :: first_vector
    TYPE(Vector) :: second_vector
  END TYPE Double_Vector

  CONTAINS

    ! ___________ Vector constructor: allocate/initialize state
variables _______

    FUNCTION Double_Vector_(num_elements) RESULT(this)
      INTEGER  ,INTENT(IN) :: num_elements
      TYPE(Double_Vector)         :: this

      this%first_vector  = Vector_(num_elements)
      this%second_vector = Vector_(num_elements)

    END FUNCTION Double_Vector_

END MODULE Double_Vector_Module

PROGRAM main
  USE Double_Vector_Module
  IMPLICIT NONE

  INTEGER ,PARAMETER :: loop_length=150
  INTEGER ,PARAMETER :: vector_length=2**22 ! x 4 bytes/real = 16 MB
vectors
  INTEGER            :: i

  TYPE(Double_Vector) :: duplicate

  DO i=1,loop_length
    PRINT *, i
    duplicate = Double_Vector_(vector_length)
  END DO

END PROGRAM main

These files are all time-stamped April 15, 2007.  I named the file
containing the above main program "leak.f90."  I named the following
file "noleak.f90":

PROGRAM main
  USE Vector_Module
  IMPLICIT NONE

  INTEGER ,PARAMETER :: loop_length=1500
  INTEGER ,PARAMETER :: vector_length=2**22 ! x 4 bytes/real = 16 MB
vectors
  INTEGER            :: i

  TYPE(Vector) :: duplicate

  DO i=1,loop_length
    PRINT *, i
    duplicate = Vector_(vector_length)
  END DO

END PROGRAM main

So apparently the allocatable components have to be nested a couple of
levels deep to demonstrate the leak.  In my application, I'm
interested in even deeper nesting, so I hope the leak fix is general
enough to handle arbitrarily deeply nested types.

Damian
 




 26 Posts in Topic:
Derived types and allocatable
Gib Bogle <g.bogle@[EM  2008-05-06 16:01:28 
Re: Derived types and allocatable
Gib Bogle <g.bogle@[EM  2008-05-06 18:09:36 
Re: Derived types and allocatable
"James Van Buskirk&q  2008-05-06 00:41:26 
Re: Derived types and allocatable
Steven Correll <steven  2008-05-06 07:08:11 
Re: Derived types and allocatable
"James Giles" &  2008-05-11 00:26:34 
Re: Derived types and allocatable
=?ISO-8859-15?Q?Jan_Vorbr  2008-05-14 12:07:46 
Re: Derived types and allocatable
"James Giles" &  2008-05-14 19:30:39 
Re: Derived types and allocatable
glen herrmannsfeldt <g  2008-05-14 12:39:38 
Re: Derived types and allocatable
"James Giles" &  2008-05-14 20:49:59 
Re: Derived types and allocatable
glen herrmannsfeldt <g  2008-05-14 13:27:46 
Re: Derived types and allocatable
"James Giles" &  2008-05-14 21:40:48 
Re: Derived types and allocatable
=?ISO-8859-15?Q?Jan_Vorbr  2008-05-15 11:14:13 
Re: Derived types and allocatable
"James Van Buskirk&q  2008-05-14 11:03:21 
Re: Derived types and allocatable
"James Giles" &  2008-05-14 19:37:02 
Re: Derived types and allocatable
"Kurt Kallblad"  2008-05-07 07:56:49 
Re: Derived types and allocatable
nospam@[EMAIL PROTECTED]   2008-05-07 00:15:43 
Re: Derived types and allocatable
Gib Bogle <bogle@[EMAI  2008-05-08 08:35:27 
Re: Derived types and allocatable
Damian <damian@[EMAIL   2008-05-07 12:03:34 
Re: Derived types and allocatable
Steve Lionel <Steve.Li  2008-05-07 15:33:13 
Re: Derived types and allocatable
Damian <damian@[EMAIL   2008-05-08 09:05:09 
Re: Derived types and allocatable
Steve Lionel <Steve.Li  2008-05-08 12:52:00 
Re: Derived types and allocatable
Damian <damian@[EMAIL   2008-05-08 19:56:55 
Re: Derived types and allocatable
Steve Lionel <Steve.Li  2008-05-09 14:11:34 
Re: Derived types and allocatable
Damian <damian@[EMAIL   2008-05-09 12:15:07 
Re: Derived types and allocatable
"James Van Buskirk&q  2008-05-06 00:11:29 
Re: Derived types and allocatable
Gib Bogle <g.bogle@[EM  2008-05-06 18:39:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Aug 30 8:20:26 CDT 2008.