comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Short array memory allocation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Short array memory allocation [message #61225] Thu, 10 July 2008 13:44 Go to next message
ray.laymon064 is currently offline  ray.laymon064
Messages: 8
Registered: July 2008
Junior Member
Hi Everyone,

I searched the posted messages but couldn't find the answer I am
looking for. Sorry if I repeat the same question.

I am dealing with some data in "grib" format. I perform a simple
operation on each file (open/extract single pixel). The array size of
each file is small (450*250), and I don't store any of the variables
at each loop (overwrite so no memory allocation is needed). However,
there are lots of files (~600,000).

I have a 2.5 Ghz dual-core 4GB memory laptop. When I run my script it,
the task manager tells me IDL uses ~ 12% CPU & ~32MB memory (total PC
CPU usage is ~ 16% and total PC memory usage is ~ 450MB)...And the
whole script takes ~1,5 hours.

I know, there are lots of small files, and naturally it takes time but
is there a way I can speed up the processing time?
Thanks,

Ray
Re: Short array memory allocation [message #61307 is a reply to message #61225] Fri, 11 July 2008 07:53 Go to previous messageGo to next message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Fri, 11 Jul 2008, ray.laymon064@gmail.com wrote:

>
> That was the answer I was afraid to get..
> I tried opening and closing the files only and it took the ~same
> time...
>
> Still, is there any IDL setting that I can change and make my IDL use
> more sources?
> In a way IDL to open/read the file faster.

Probably file lookup in directories is the bottleneck here. This can be
very slow if the directories contain thousand of files. Try to rearrange
your ~600.000 files in a tree where a single directory contains no more
than 256 files.

regards,
lajos
Re: Short array memory allocation [message #61308 is a reply to message #61225] Fri, 11 July 2008 07:20 Go to previous messageGo to next message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article
<eb7e674b-929d-4775-a3db-92d2f60d30b2@m44g2000hsc.googlegroups.com>,
ray.laymon064@gmail.com wrote:

> That was the answer I was afraid to get..
> I tried opening and closing the files only and it took the ~same
> time...
>
> Still, is there any IDL setting that I can change and make my IDL use
> more sources?
> In a way IDL to open/read the file faster.
>
>
> Ray,
>
> p.s. I have 7200 rpm SATA disk, and unfortunately I can't modify..

What you are seeing is the OS overhead for opening and closing
a file. If you need to do this operation repeatedly, then you
should consider merging the files into a small number of larger
files.

If you know that you are always going to be accessing the data
in the same manner (e.g., one value from many records), you would
get a significant speed-up by transposing the data order so that
"file index" is your first dimension.

This will be slow to do, but you will only have to do it once.

Ken Bowman
Re: Short array memory allocation [message #61962 is a reply to message #61225] Mon, 11 August 2008 19:09 Go to previous message
ray.laymon064 is currently offline  ray.laymon064
Messages: 8
Registered: July 2008
Junior Member
On Aug 11, 11:22 am, Brian Larsen <balar...@gmail.com> wrote:
>> So my quesiton is: "Is there a commend/way to create folder inside IDL-
>> script"? Or Should I do it
>> through a shell-script..
>
> But of course IDL can create a folder :)
>
> try a help on directory (? directory) there is all sorts of good
> things there. What you want is FILE_MKDIR.
>
> Cheers,
>
> Brian
>
> ------------------------------------------------------------ --------------
> Brian Larsen
> Boston University
> Center for Space Physicshttp://people.bu.edu/balarsen/Home/IDL

Well, thanks for the hint.. and of course works like a charm..
I knew it would be very trivial..
All the time I have been searching the help/google with wrong keywords
(create directory, folder)..

Best,
Ray
Re: Short array memory allocation [message #61965 is a reply to message #61225] Mon, 11 August 2008 08:22 Go to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
> So my quesiton is: "Is there a commend/way to create folder inside IDL-
> script"? Or Should I do it
> through a shell-script..

But of course IDL can create a folder :)

try a help on directory (? directory) there is all sorts of good
things there. What you want is FILE_MKDIR.

Cheers,

Brian



------------------------------------------------------------ --------------
Brian Larsen
Boston University
Center for Space Physics
http://people.bu.edu/balarsen/Home/IDL
Re: Short array memory allocation [message #61966 is a reply to message #61307] Mon, 11 August 2008 08:16 Go to previous message
ray.laymon064 is currently offline  ray.laymon064
Messages: 8
Registered: July 2008
Junior Member
On Jul 11, 10:53 am, FĂ–LDY Lajos <fo...@rmki.kfki.hu> wrote:
> On Fri, 11 Jul 2008, ray.laymon...@gmail.com wrote:
>
>> That was the answer I was afraid to get..
>> I tried opening and closing the files only and it took the ~same
>> time...
>
>> Still, is there any IDL setting that I can change and make my IDL use
>> more sources?
>> In a way IDL to open/read the file faster.
>
> Probably file lookup in directories is the bottleneck here. This can be
> very slow if the directories contain thousand of files. Try to rearrange
> your ~600.000 files in a tree where a single directory contains no more
> than 256 files.
>
> regards,
> lajos

Hi Lajos,

I may need ~2000 folders (in a tree) to distribute my files..
openw, creates a file, but if the folder to be written doesn't exist,
IDL exists with an error..

So my quesiton is: "Is there a commend/way to create folder inside IDL-
script"? Or Should I do it
through a shell-script..

Best Regards,
Ray
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Can i avoid the loop,help me speed up,thanks
Next Topic: neural networks

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:21:41 PDT 2025

Total time taken to generate the page: 0.00513 seconds