Is there a way to find out how many pages are in a particle output file programmatically, in particular that would be fast over very large files with hundreds of pages?
For instance, a series of bash commands that would print out how many pages are in a file?
Number of Output Pages
Moderators: cyao, michael_borland
-
- Posts: 60
- Joined: 05 Aug 2010, 11:32
- Location: SLAC National Accelerator Laboratory
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Number of Output Pages
Joel,
You can use "sdds2stream -npages=bare <filename>" . This program also has the ability to report the number of rows (-rows=bare).
--Michael
You can use "sdds2stream -npages=bare <filename>" . This program also has the ability to report the number of rows (-rows=bare).
--Michael
-
- Posts: 2008
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Number of Output Pages
Joel,
Another tip: if the file is very large, it might be faster to look at another, smaller file that is generated by the same elegant run and will have the same number of pages.
--Michael
Another tip: if the file is very large, it might be faster to look at another, smaller file that is generated by the same elegant run and will have the same number of pages.
--Michael
-
- Posts: 60
- Joined: 05 Aug 2010, 11:32
- Location: SLAC National Accelerator Laboratory
Re: Number of Output Pages
Michael,
Thanks. This method takes about 5 minutes on a 6 GB file, so we'll keep looking for alternate methods. I was hoping to avoid the secondary file method, but that seems like the only solution now. Unless maybe there's a character sequence in the binary format that represents a new page that we could grep (or something similar)?
Joel
Thanks. This method takes about 5 minutes on a 6 GB file, so we'll keep looking for alternate methods. I was hoping to avoid the secondary file method, but that seems like the only solution now. Unless maybe there's a character sequence in the binary format that represents a new page that we could grep (or something similar)?
Joel
Re: Number of Output Pages
Hi Joel and Michael,
I think I have come up with a faster solution for finding the page count of an sdds file. I use sddscollapse on the original input file, then define a parameter in the new file that is simply the number of rows in the new file, which should be equal to the number of pages in the original input file. This can then be printed with sddsprintout.
For example:
I found this code can give the page count on a 6 GB file in about 10 seconds (the same file Joel was using for benchmarking, I believe).
-Mike Litos
I think I have come up with a faster solution for finding the page count of an sdds file. I use sddscollapse on the original input file, then define a parameter in the new file that is simply the number of rows in the new file, which should be equal to the number of pages in the original input file. This can then be printed with sddsprintout.
For example:
Code: Select all
sddscollapse $1 -pipe=out -noWarning |\
sddsprocess -pipe -noWarnings \
"-define=parameter,pagecount,n_rows,type=long" |\
sddsprintout -pipe=in -par=pagecount
-Mike Litos