Re: qsort

From: Mary Haley (haley AT ucar.edu)
Date: Wed Jun 22 2005 - 13:13:00 MDT

  • Next message: Mary Haley: "Re: Problems with plotting data on maps"

    This is a heads up that the qsort problem has been fixed, and we are
    happy to create a new NCL binary for anybody that needs a fix.

    Meanwhile, another user pointed out that we don't really have a good
    mechanism for alerting our users about known problems in NCL. We have
    currently been doing this via ncl-talk, and also via the "what's new"
    and "what's coming in the next release", but he has a good point here.

    We will try to come up with such a document soon. Also, we may create
    another methodology for reporting bugs in NCL; reporting bugs via
    ncl-talk will still be an accepted method.

    Cheers,

    --Mary

    On Thu, 16 Jun 2005, Michael Barlage wrote:

    >
    > Sorry Dennis, I should have supplied more machine info. I've run this
    > using NCL v032 on a Linux FC3 Machine with 1GB RAM and 2GB Swap and using
    > NCL v031 on a Linux FC3 Machine with 2GB RAM and 2GB Swap. I've also just
    > run it on a DEC Alpha machine with the same results.
    >
    > This simple code I provided is for debug purposes and won't bring the
    > first machine to it's knees until about iteration 100. That's why I was
    > curious about what 'top' tells you about the process memory usage. When I
    > run this, every iteration will take about 30MB more memory until it
    > eventually runs out of swap.
    >
    > M
    >
    > ==================================
    > Michael Barlage, PhD
    > Research Scientist
    > Institute of Atmospheric Physics
    > University of Arizona
    > (520) 626-3552
    > barlage@atmo.arizona.edu
    > ==================================
    >
    > On Thu, 16 Jun 2005, Dennis Shea wrote:
    >
    >>> Just like to know if anyone has noticed any memory issues while using
    >>> qsort. I'm sorting large arrays in a loop and deleting variables along the
    >>> way to save memory but it seems that everytime qsort is called, temp
    >>> variables are created and then not deleted(that's my diagnosis anyway).
    >>> Run this test program and top. It eventually sucks up my machine memory:
    >>>
    >>> begin
    >>> do i = 0,200
    >>> print((/i/))
    >>> x1D = new((/4000000/),integer)
    >>> x1D = 1
    >>> qsort(x1D)
    >>> delete(x1D)
    >>> end do
    >>> end
    >>>
    >>> Also, I think the example on qsort is incorrect. 'qsort_x = qsort(x)' will
    >>> not work.
    >>>
    >>> http://www.ncl.ucar.edu/Document/Functions/Built-in/qsort.shtml
    >>>
    >> Hello
    >>
    >> [1]
    >> yes ... the documentation is incorrect.
    >> qsort is a procedure not a function.
    >> I have fixed that. [do a reload on the above page]
    >>
    >> It should be:
    >>
    >> x = (/4.3, 0.9, 5.2, 7.7, 2.3, -4.7, -9.1/)
    >> qsort(x)
    >>
    >> THX for the 'heads-up'
    >> ----
    >> [2]
    >> I copied your code and ran the following on several of our machines.
    >> [SGI: 64GB memory], [linux: 8GB and 2GB], [Solaris: ?1GB or 2 GB]
    >>
    >> %>ncl testQ.ncl
    >> Copyright (C) 1995-2004 - All Rights Reserved
    >> University Corporation for Atmospheric Research
    >> NCAR Command Language Version 4.2.0.a032
    >> The use of this software is governed by a License Agreement.
    >> See http://ngwww.ucar.edu/ncl/ for more details.
    >> (0) 0
    >> (0) 1
    >> (0) 2
    >> (0) 3
    >> (0) 4
    >> (0) 5
    >> (0) 6
    >> (0) 7
    >> (0) 8
    >> (0) 9
    >> [I stopped it here]
    >>
    >> I also tried some large vectors on a large memory machine:
    >>
    >> /home/tempest/shea>ncl
    >> ncl 0> N = 10000000
    >> ncl 1> x = random_uniform(-10,10,N)
    >> ncl 2> qsort(x)
    >> ncl 3> N = 50000000 ; this is *slow* but works
    >> ncl 4> y = random_uniform(-10,10,N)
    >> ncl 5> qsort(y)
    >> ncl 6> quit
    >>
    >> Not fast but no memory error.
    >>
    >> What OS [uname -a] and how much memory do you have available?
    >>
    >> ---
    >> Incidently,
    >>
    >> do i = 0,200
    >> print((/i/))
    >> x1D = new((/4000000/),integer)
    >> x1D = 1
    >> qsort(x1D)
    >> delete(x1D) ; *no* need to do this here because
    >> ; the size/type does not change with
    >> ; each iteration
    >> end do
    >>
    >> ---
    >> I suspect that the above is a sample for debug
    >> but the best way would be
    >>
    >> x1D = new((/4000000/),integer) ; one memory allocation
    >>
    >> do i = 0,200
    >> print((/i/)) ; or print("i="+i)
    >> x1D = 1 ; all 1
    >> qsort(x1D) ; obviously no need in this trivial case
    >> end do
    >>
    >> Regards
    >> D
    >>
    >>
    >
    > _______________________________________________
    > ncl-talk mailing list
    > ncl-talk@ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    >
    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Wed Jun 22 2005 - 13:59:16 MDT