From: Gianfranco Costamagna Date: Tue, 15 May 2018 17:26:32 +0000 (+0100) Subject: Import boinc-app-seti_8.00~svn3725.orig.tar.gz X-Git-Tag: archive/raspbian/8.00_svn3725-2+rpi1^2~16 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=323a1cc27d7fdc75f4e3ab68155ae7fb9565df38;p=boinc-app-seti.git Import boinc-app-seti_8.00~svn3725.orig.tar.gz [dgit import orig boinc-app-seti_8.00~svn3725.orig.tar.gz] --- 323a1cc27d7fdc75f4e3ab68155ae7fb9565df38 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..8b4d067 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,53 @@ + +Authors of SETI@home: +Eric J. Korpela +Jeff Cobb +Matt Lebofsky +David Anderson +Charlie Fenton +Rom Walton +Tetsuji Rai +Eric Heien +Hiram Clawson +Alex Kan +Ben Herndon +Josef Segur +Simon Zadra +Jason Groothuis +Raistmer +Mateusz Szpakowski + +Authors of FFTW (reachable at fftw at fftw.org): +Matteo Frigo +Stevenj G. Johnson +Stefan Kral wrote genfft-k7/*.ml*, which was +added in fftw-3.0 and removed in fftw-3.2. + +Additional authors of Astropulse: +Joshua Von Korff +Paul Demorest + +OpenCL development by: +Raistmer +Urs Echternacht +Frizz + +X-Branch CUDA by: +Jason Richard Groothuis ( jgopt.org, contact at jgopt dot org ), +in collaboration with Josef Segur ( Lunatics.kwsn.info ) +Linux porting by Aaron Haviland. + +Original CUDA development by: +Przemyslaw Zych (NVIDIA) +Scott Le Grand (NVIDIA) +Bob Johnston (NVIDIA) + +Authors of fft8g.[cpp,h] +Takuya Ooura +Eric J. Korpela +Jeff Cobb + +Author of ASMLIB +Agner Fog + +Background artwork by Tatiana Plakhova ( http://complexitygraphics.com/ ) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 0000000..f600350 --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,42 @@ +// Copyright (c) 1999-2016 Regents of the University of California +// +// FFTW: Copyright (c) 2003,2006-2016 Matteo Frigo +// Copyright (c) 2003,2006-2016 Massachusets Institute of Technology +// +// fft8g.[cpp,h]: Copyright (c) 1995-2001 Takya Ooura +// +// Brook+ and OpenCL portions of code: Copyright (c) 2010-2016 Raistmer +// +// ASMLIB: Copyright (c) 2004 Agner Fog +// +// X-Branch: Copyright (c) 2012-2016 Jason Richard Groothuis +// + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any later +// version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions +// as an alternative to FFTW and distribute a linked executable and +// source code. You must obey the GNU General Public License in all +// respects for all of the code used other than the FFT library itself. +// Any modification required to support these libraries must be distributed +// under the terms of this license. If you modify this program, you may extend +// this exception to your version of the program, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. Please be aware that FFTW and ASMLIB are not covered by +// this exception, therefore you may not use FFTW and ASMLIB in any derivative +// work so modified without permission of the authors of those packages. + diff --git a/CheckResult b/CheckResult new file mode 100755 index 0000000..7cf8165 --- /dev/null +++ b/CheckResult @@ -0,0 +1,288 @@ +#!/bin/sh +# +# CheckResult - produce an html page with client test results +# +# Usage: CheckResult [more outfile.sah files] > check.html +# must supply at least one argument, the name of +# an outfile.sah to check. More than one file can +# be supplied to check. Each file will produce a table +# in the resulting html output. Place the output of this +# script into a file and read with a browser. +# +# KNOWN PROBLEM: Some clients output numbers in the form of: +# 1.803966e+000 instead of 1.803966e+00 +# This will cause a compare error. A work-around on +# such platforms is to edit the reference outfile and +# change all the +0x to +00x and -0x to -00x +# +# ASSUMED: outfile.sah_version_2.0 is available here in ./ +# +# Set the reference file location if different in your setup: + +Reference="./outfile.sah_version_2.0" + +# What kind of awk do you need ? I note Solaris needs to use nawk, +# and others need to use simply awk. Please set this to what you +# need to have for an awk. +AWK=nawk + +# trap signals and exit cleanly + +trap "CleanExit" 1 2 3 15 + +########################################################################### +# subroutines +########################################################################### +Usage() { + echo "Usage: [more outfile.sah files] > check.html" + echo "\t - name of outfile.sah to check" + echo "\t[more outfile.sah files] - can check more than one" + echo "\t reference file is assumed to be:" + echo "\t ${Reference}" +} + +########################################################################### +# There are no /tmps file to remove at this time. If some are +# developed in the future, clean them up here. +# +CleanExit() { + exit 0 +} # caught signal + +########################################################################### +Header() { +cat << _EOF_ + + SETI@home ${Reference} delta report SETI clients + + +_EOF_ +} # Header() + +########################################################################### +TableStart() { +cat << _EOF_ +
+ + + + + + + + + + + + +_EOF_ +} # TableStart() + +########################################################################### +TableEnd(){ +cat << _EOF_ +
+ SETI@home delta report for ${TITLE} +
+`date` - `date -u` +
+
When OK:
(actual delta) + (allowed delta)
When Bad:
(actual + measurement) (reference measurement)
power delta peak delta mean delta chisqr delta others ?
+_EOF_ +} # TableEnd() + +########################################################################### +Tailer(){ +cat << _EOF_ +
+The deltas are computed: <reference value> - <test value>
+power delta - the difference between power= on the spike: lines
+peak delta - the difference between peak= on the gaussian: lines
+mean delta - the difference between mean= on the gaussian: lines
+chisqr delta - the difference between chisqr= on the gaussian: lines
+others ? - indication if other fields on any line have differences
+
+
+ SETI@home STATS home page
+ SETI@home home page +
+
+
This page last updated: `date` - `date -u`
+ +_EOF_ +} # Tailer() +########################################################################### +########################################################################### +# start of main program + +# (It might be better to make the reference file be the first +# argument ?) + +if [ ! -f "${Reference}" ]; then { + echo "Reference outfile does not exist. Looking for:" + echo "\t${Reference}" + CleanExit +} fi + +if [ "$#" -lt 1 ]; then { + Usage + CleanExit +} fi + +Header # start the html file + +# For each file on the command line, generate a table + +for Test in $* +do + +TITLE="${Test}" + +#echo "

Checking file: ${Test}

" + +echo "
"
+if [ ! -f "${Test}" ]; then {
+	echo "\nERROR: specified file does not exist:"
+	echo "\t${Test}"
+} fi
+
+# first, see if there are the same number of lines in the outfiles
+
+TestWC=`cat ${Test} | wc -l`
+RefWC=`cat ${Reference} | wc -l`
+
+if [ "${TestWC}" -ne "${RefWC}" ]; then {
+	echo "ERROR: the two files do not have the same number of lines"
+	echo "'wc ${Test} ${Reference}'"
+	wc ${Test} ${Reference}
+} fi
+
+echo "
" + +TableStart + +# Processing is to read line by line from the reference file and +# the test file to check. Parse out all the numbers on +# the lines, and compare all numbers. Assuming format +# of output as it is currently in version 1.1 -> 1.3 +# (this works even with the new v1.10, v2.0 format, although +# it is not checking the pow= value) + +$AWK ' +function check_error(reference,measured,tolerance) { + diff=reference-measured + errbar=reference*tolerance + if ( errbar < 0 ) { abserrbar = - errbar } else { abserrbar = errbar } + if ( diff < 0 ) { absdiff = - diff } else { absdiff = diff } + if ( (absdiff < .0000001) ) { +printf "
0.0 (%.3e)
", reference + } else if ( (absdiff - abserrbar) > 0 ) { +printf " %.6e (!= %.6e) ", measured, reference + } else { +printf "
%.3e (%.3e)
", absdiff, abserrbar + } +} +function ogh(LineIn) { + n=split(LineIn, a, " ") + split(a[2], b, "="); ncfft=b[2] + split(a[3], b, "="); cr=b[2] + split(a[4], b, "="); fl=b[2] +} +function spike(LineIn) { + n=split(LineIn, a, " ") + split(a[2], b, "="); power=b[2] + split(a[3], b, "="); ra=b[2] + dec=a[5] + time=a[7] + split(a[8], b, "="); freq=b[2] + split(a[9], b, "="); fft_len=b[2] + split(a[10], b, "="); chirp_rate=b[2] +} +function gaussian(LineIn) { + n=split(LineIn, a, " ") + split(a[2], b, "="); peak=b[2] + split(a[3], b, "="); mean=b[2] + split(a[4], b, "="); ra=b[2] + dec=a[6] + time=a[8] + split(a[9], b, "="); freq=b[2] + split(a[10], b, "="); sigma=b[2] + split(a[11], b, "="); chisqr=b[2] + split(a[12], b, "="); fft_len=b[2] + split(a[13], b, "="); chirprate=b[2] +} +BEGIN { + Fname0="'${Reference}'" + Fname1="'${Test}'" + while ( (getline LineIn < Fname0) > 0 ) { + if ( match(LineIn, "^ end of file on %s\n", Fname1 + } else { + if ( match(LineIn, "^ yes \n" +} + } else if ( match(LineIn, "^ yes \n" +} + } else if ( match(LineIn, "^spike:") ) { + spike(LineIn) +power1=power; ra1=ra; dec1=dec; time1=time; freq1=freq; fft_len1=fft_len; + chirp_rate1=chirp_rate; + printf " " + check_error(power0, power1, .001) + printf "" +if ( (ra1 != ra0) || (dec1 != dec0) || (time1 != time0) || (freq1 != freq0) || (fft_len1 != fft_len0) ) { + printf" yes \n" +} else { +printf "\n" +} + } else if ( match(LineIn, "^gaussian:") ) { + gaussian(LineIn) +peak1=peak; mean1=mean; gra1=ra; gdec1=dec; gtime1=time; gfreq1=freq; +sigma1=sigma; chisqr1=chisqr; fft_len1=fft_len; chirprate1=chirprate; + printf "" + check_error(peak0, peak1, .001) + check_error(mean0, mean1, .001) + check_error(chisqr0, chisqr1, .001) + printf "\n" +if ( (gra1 != gra0) || (gdec1 != gdec0) || (gtime1 != gtime0) || (gfreq1 != gfreq0) || (sigma1 != sigma0) || (fft_len1 != fft_len0) || (chirprate1 != chirprate0) ) { + printf" \n" +} else { +printf "\n" +} + } + } + } + close Fname0 + close Fname1 +} +' +TableEnd + +done + +Tailer # Finished with the html file + +CleanExit diff --git a/Graphics.Readme b/Graphics.Readme new file mode 100644 index 0000000..2df9001 --- /dev/null +++ b/Graphics.Readme @@ -0,0 +1,9 @@ +This document will describe how to install seti with graphics. + +Make sure that boinc has been installed with graphics enabled. Follow +the instructions Makefile.Readme in seti_boinc/client to make sure +that Makefile.in.graphics will work with your system. Rename +Makefile.in.graphics as Makefile.in. From the seti_boinc/ directory +run configure (or ./configure), then make. The executable will then be +xseti[version and system info] and your app_info.xml file should +reflect that name. \ No newline at end of file diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..6ab54d0 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,46 @@ +# $Id: Makefile.am,v 1.2.2.1 2005/10/26 18:23:03 korpela Exp $ +# +# + +AUTOMAKE_OPTIONS = foreign + +## make sure rebuilding uses the right aclocal-switches +ACLOCAL_AMFLAGS = -I m4 + +if ENABLE_CLIENT + CLIENT_SUBDIRS = client +if ENABLE_TESTS + CLIENT_SUBDIRS +=tools +endif +endif + +if ENABLE_SERVER + SERVER_SUBDIRS = splitter_pfb assimilator validate +endif + +if USE_MY_IMAGELIBS + IMDIR = image_libs +endif + +if USE_MY_GLUT + GLUTDIR = glut +endif + + +SUBDIRS = $(JPEGDIR) $(IMDIR) $(GLUTDIR) $(CLIENT_SUBDIRS) $(SERVER_SUBDIRS) + +dist-hook: + rm -rf `find $(distdir) -name .backup -prune -o -name '*~' -o -name CVS` + +client-bin: + cd client && make client-bin client-bin-gz + +EXTRA_DIST = \ + glut \ + image_libs \ + db \ + tools \ + client/win_build \ + client/test_workunits \ + INSTALL + diff --git a/Makefile.incl b/Makefile.incl new file mode 100644 index 0000000..89f28aa --- /dev/null +++ b/Makefile.incl @@ -0,0 +1,56 @@ +# $Id: Makefile.incl,v 1.2.2.6 2007/02/13 23:16:11 korpela Exp $ +# +# + +@SET_MAKE@ + +AM_LIBS = @LIBS@ +AM_LDFLAGS = @LDFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @PICFLAGS@ @DEFS@ -I$(top_srcdir) +AM_CFLAGS = $(AM_CPPFLAGS) +AM_CXXFLAGS = $(AM_CPPFLAGS) + +BOINCDIR = @BOINCDIR@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +LIBEXT = @LIBEXT@ +DLLEXT = @DLLEXT@ +DOTEXEEXT = @DOTEXEEXT@ +LINK_DLL = @LINK_DLL@ + +LIBTOOL = @LIBTOOL@ + +MYSQL_LIBS = @MYSQL_LIBS@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +INFORMIXDIR = @INFORMIXDIR@ +INFORMIX_LIBS = @INFORMIX_LIBS@ +INFORMIX_CFLAGS = @INFORMIX_CFLAGS@ +APP_LIBS = @ASMLIB_LIBS@ @APP_LIBS@ @CLIENT_EXTRA_LIBS@ +APP_LDFLAGS = @ASMLIB_LDFLAGS@ @APP_LDFLAGS@ +APP_CFLAGS = @ASMLIB_CFLAGS@ @APP_CFLAGS@ +GRAPHICS_CFLAGS = @GRAPHICS_CFLAGS@ +DEFS = @DEFS@ +GRAPHICS_LIBS = @GRAPHICS_LIBS@ +SETILIBDIR = @SETILIBDIR@ +HEALPIX = @HEALPIX@ + +SUFFIXES = .cpp .c .@OBJEXT@ .@DLLEXT@ .@LIBEXT@ @DOTEXEEXT@ + +VERSION_MAJOR = @MAJOR_VERSION@ +VERSION_MINOR = @MINOR_VERSION@ + +BOINC_CFLAGS= @BOINC_CFLAGS@ + +BOINC_PLATFORM = @boinc_platform@ + +LDSTATIC = @LDSTATIC@ + +DEBUG_PROG = setiathome-$(VERSION_MAJOR).$(VERSION_MINOR).$(BOINC_PLATFORM).debug$(DOTEXEEXT) +DEBUG_NATIVESO = setiathome-$(VERSION_MAJOR).$(VERSION_MINOR).$(BOINC_PLATFORM).debug.$(DLLEXT) +CLIENT_PROG = setiathome-$(VERSION_MAJOR).$(VERSION_MINOR).$(BOINC_PLATFORM)$(DOTEXEEXT) +CLIENT_NATIVESO = setiathome-$(VERSION_MAJOR).$(VERSION_MINOR).$(BOINC_PLATFORM).$(DLLEXT) + + diff --git a/README b/README new file mode 100644 index 0000000..5587d03 --- /dev/null +++ b/README @@ -0,0 +1,57 @@ +setiathome(1) User Commands Version 6.90 - Feb 2011 + +NAME + seti_boinc - the SETI@home client program + +SYNOPSIS + seti_boinc [options] + +DESCRIPTION + seti_boinc is the boinc version of the SETI@home client. + It runs under the BOINC client which downloads radio telescope data + from a network server, analyzes the data looking for signals of + extraterrestrial origin, and uploads results to the server, + repeating this cycle indefinitely. + See http://setiathome.berkeley.edu for more information. + +FILES + In order to use seti_boinc to analyze data from the seti@home project + you must first download the BOINC client software which is avalable + through the setiathome web page http://setiathome.berkeley.edu/ + If used on a supported host platform, the BOINC client will automatically + download the most recent versions of the seti@home client software. + + If you are compiling for an unsupported host platform, you may need to use + the boinc anonymous platform mechanism described at + http://boinc.berkeley.edu/anonymous_platform.php + + The program generates several files with .sah extension + in the directory from which it's run. + These should not be modified. + + +OPTIONS + -nographics + Do not show graphics while running. + + -version + Show software version + +SEE ALSO: + There is much more information to be found about the operation + of the client at the following WEB sites: + http://setiathome.berkeley.edu/ + http://boinc.berkeley.edu/ + with discussions of add-on programs and scripts to control + the BOINC client in various situations. + + The most recent version of the seti_boinc source code can be found at + http://setiathome.berkeley.edu/ + + The most recent version of the official FFTW library can be found at + http://www.fftw.org/. A version containing any modifications made for + SETI@home can be found at http://setiathome.berkeley.edu/ + If you are unable to find it there, please contact Eric Korpela + . + + diff --git a/README_MAC b/README_MAC new file mode 100644 index 0000000..e7d3064 --- /dev/null +++ b/README_MAC @@ -0,0 +1 @@ +./configure --enable-fast-math -C --with-apple-opengl-framework --with-boinc-platform=powerpc-apple-darwin --without-x --disable-dynamic-graphics --with-my-libjpeg --with-my-jpeglib diff --git a/_autosetup b/_autosetup new file mode 100755 index 0000000..db600cd --- /dev/null +++ b/_autosetup @@ -0,0 +1,137 @@ +#!/bin/sh + +## $Id: _autosetup,v 1.2.2.3 2007/08/07 21:42:31 mattl Exp $ + +## ---------- some portability checks/adjustments [stolen from configure] ---------- +## 'echo -n' is not portable.. +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +##---------- + +## ---------------------------------------------------------------------- +## Check that given command $1 has version >= $2.$3 +## return 0 if ok, 1 too old or not found (-> shell conventions). +## ---------------------------------------------------------------------- +check_version() +{ + dir=`pwd` + cd /tmp + foundit= + ## get current version of $1 + desired=$2 + echo $ECHO_N "Checking version of '$1' >= $desired... $ECHO_C" + name=$1 + fullpath=`type $name | awk '{ print $(NF) }'`; + if [ -x "$fullpath" ]; then + foundit=yes; + fi + + if [ "$foundit" != yes ]; then + echo "Didn't find application"; + version=0 + success=no + else + cmdline="$fullpath --version"; + if version=`($cmdline 2>/dev/null)` 2>/dev/null; then + echo >/dev/null + else + version="0"; + fi + if [ -n "${version}" ]; then + version=`echo $version | awk '{ for (i=1;i<=NF;i++) { split($i,j,"."); m=j[1]"."j[2] ; if (m ~ /[0-9]+\.[0-9]+/) { print m ; break; } } }'` + if [ -z "$version" ]; then version=0; fi + success=`echo "$version" "$desired" | awk '{ if ($1 >= $2) { print "yes";} else {print "no";}} '` + else + version=0 + success=no + fi + fi + cd $dir + + if [ $success = "yes" ] ; then + echo "succeeded. ($version)" + return 0; + else + echo "failed. ($version)" + return 1; + fi +} ## check_version() + + + ## -------------------------------------------------------------------------------- + ## 'MAIN' starts here + ## -------------------------------------------------------------------------------- + echo "Bootstrapping configure script and makefiles:" + + ## ---------- first check santity of the installed versions of the build-system + ## in case there's GNU drop-in tools available, set these + + ## some sorry systems don't have proper GNU-make... + if check_version make 3.79; then + echo >/dev/null + else + if check_version gmake 3.79; then + have_gmake=yes; + else + echo "Couldn't find a new-enough version of GNU 'make', please install one!"; + exit 1; + fi + fi + + ## FreeBSD's m4 seems to be broken? Download a fresh one + if check_version m4 1.4; then + echo >/dev/null + else + ## solaris m4 works fine + if test -f /usr/ccs/bin/m4 -o "`uname -s`" = "FreeBSD" + then + echo >/dev/null + else + echo "Couldn't find a new-enough version of 'm4', please install one!"; + exit 1; + fi + # build_lsc_aux "m4-1.4.1" + fi + +# if check_version pkg-config 0.15; then +# echo >/dev/null +# else +# echo "Couldn't find a new-enough version of 'pkg-config', please install one!"; +# exit 1; +# # build_lsc_aux "pkgconfig-0.15.0" +# fi + + if check_version autoconf 2.58; then + echo >/dev/null + else + echo "Couldn't find a new-enough version of 'autoconf', please install one!"; + echo "If you have a newer version, set the environment-variable 'AUTOCONF' to its path"; + exit 1; + # build_lsc_aux "autoconf-2.59" + fi + if check_version automake 1.08; then + echo >/dev/null + else + echo "Couldn't find a new-enough version of 'automake', please install one!"; + echo "If you have a newer version, set the environment-variable 'AUTOMAKE' to its path"; + exit 1; + # build_lsc_aux "automake-1.8.5" + fi + + ## ---------- ok, now run autoreconf + cmdline="autoreconf -i"; +echo "$cmdline" +if eval $cmdline; then + echo "Done, now run ./configure" + echo " ./configure -C to enable caching" + echo " ./configure --enable-maintainer-mode to enable maintainer depedencies" + exit 0 +else + echo "Something failed .... please check error-message and re-run when fixed." + echo "exiting..." + exit 1 +fi diff --git a/assimilator/Makefile.am b/assimilator/Makefile.am new file mode 100644 index 0000000..ef482ec --- /dev/null +++ b/assimilator/Makefile.am @@ -0,0 +1,35 @@ +## $Id: Makefile.am,v 1.2.2.6 2007/08/09 23:37:34 jeffc Exp $ +include $(top_srcdir)/Makefile.incl + +AM_CFLAGS = @CFLAGS@ @DEFS@ -DTEXT_UI -DNDEBUG @PTHREAD_CFLAGS@ +AM_CXXFLAGS = $(AM_CFLAGS) + +AM_LDFLAGS += -Xlinker -R -Xlinker $(INFORMIXDIR)/lib:$(INFORMIXDIR)/lib/esql:$(LD_LIBRARY_PATH) @LDFLAGS@ -static + +CLIBS = @LIBS@ + +BOINC_INC = -I$(BOINCDIR) -I$(BOINCDIR)/api -I$(BOINCDIR)/lib -I$(BOINCDIR)/sched -I$(BOINCDIR)/db +BOINC_LIBS = -L$(BOINCDIR)/sched -lsched @MYSQL_LIBS@ @PTHREAD_LIBS@ -L$(BOINCDIR)/lib -lboinc -L$(SSLDIR) -lcrypto -lssl +HEALPIX_INC = -I$(HEALPIX)/include +HEALPIX_LIBS = -L$(HEALPIX)/lib -lchealpix -lhealpix_cxx -lcxxsupport +SYSLIBS = -larmadillo + +#bin_PROGRAMS = sah_assimilator +noinst_PROGRAMS = sah_assimilator + +sah_assimilator_SOURCES = \ + $(BOINCDIR)/sched/assimilator.cpp \ + $(BOINCDIR)/sched/validate_util.cpp \ + sah_assimilate_handler.cpp \ + ../client/timecvt.cpp \ + ../db/schema_master.cpp \ + ../db/sqlifx.cpp \ + ../db/sqlrow.cpp \ + ../db/sqlblob.cpp \ + ../db/xml_util.cpp \ + ../db/app_config.cpp + +sah_assimilator_CFLAGS = $(AM_CFLAGS) $(BOINC_INC) $(HEALPIX_INC) $(SETILIB_CFLAGS) $(MYSQL_CFLAGS) $(INFORMIX_CFLAGS) -I.. -I../db $(PTHREAD_CFLAGS) -I../client -I../validate +sah_assimilator_CXXFLAGS = $(AM_CXXFLAGS) $(BOINC_INC) $(SETILIB_CFLAGS) $(HEALPIX_INC) $(MYSQL_CFLAGS) $(INFORMIX_CFLAGS) -I.. -I../db $(PTHREAD_CFLAGS) -I../client -I../validate +sah_assimilator_LDADD = $(PTHREAD_CFLAGS) $(BOINC_LIBS) $(SETILIB_LIBS) $(MYSQL_LIBS) $(INFORMIX_LIBS) $(CLIBS) $(HEALPIX_LIBS) $(SYSLIBS) + diff --git a/assimilator/sah_assimilate_handler.cpp b/assimilator/sah_assimilate_handler.cpp new file mode 100644 index 0000000..194c26e --- /dev/null +++ b/assimilator/sah_assimilate_handler.cpp @@ -0,0 +1,765 @@ +#include "sah_config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "boinc_db.h" +#include "sched_config.h" +#include "sah_assimilate_handler.h" +#include "sched_util.h" +#include "sched_msgs.h" +#include "parse.h" +#include "sched_util.h" +#include "util.h" +#include "validate_util.h" +#include "filesys.h" + +#include "setilib.h" + +#include "timecvt.h" +#include "db_table.h" +#include "schema_master.h" +#include "app_config.h" +#include "sqlint8.h" +#include "sah_result.h" + +// the boinc assimilator makes these available +extern SCHED_CONFIG config; +//extern bool noinsert; + +const double D2R = 0.017453292; +const int fpix_res = 10; // Hz + +const float bad_fp_val_marker = -91.0; + +struct timespec nanotime; + +//inline long round(double x) {return long(floor(x + 0.5f));} + +// the init and usage functions are required by boinc +int assimilate_handler_init(int, char**) { + return 0; +} +void assimilate_handler_usage() { +} + + +int populate_seti_result( + result& sah_result, + RESULT& boinc_canonical_result, + WORKUNIT& b_wu, + long long & seti_wu_id +); +template int insert_signals( T& signal, + char * signal_name, + char * wu_name, + sqlint8_t sah_result_id, + std::ifstream& result_file, + receiver_config& receiver_cfg, + int appid, + int max_signals_allowed, + bool check_rfi, + list& hotpix); +template int pre_process(T& signal, receiver_config& receiver_cfg, sqlint8_t sah_result_id, char * wu_name, bool check_rfi); +template int check_values(T& signal, sqlint8_t sah_result_id, char * wu_name); +int get_science_configs(WORKUNIT& boinc_wu, long long seti_wu_id, receiver_config& receiver_cfg, analysis_config& analysis_cfg); +int parse_settings_id(WORKUNIT& boinc_wu); +int get_configs_old_method(WORKUNIT& boinc_wu, long long seti_wu_id, receiver_config& receiver_cfg, analysis_config& analysis_cfg); +long long new_wu_id(long long old_wu_id); + + +// assimilate_handler() is called by BOINC code and is passed the canonical +// result for a workunit. assimilate_handler() reads the referenced result +// file and inserts the result and its signals into the master science DB. +// BOINC also passes the workunit (as it appears in the BOINC DB) and a vector +// containing all results (including the canonical one) for that workunit. +// We use the workunit to determine if there is an error condition. +int assimilate_handler( + WORKUNIT& boinc_wu, vector& boinc_results, RESULT& boinc_canonical_result +) { + int retval=0; + int spike_count=0, spike_inserted_count=0, gaussian_count=0, gaussian_inserted_count=0, pulse_count=0, pulse_inserted_count=0, triplet_count=0, triplet_inserted_count=0, autocorr_count=0, autocorr_inserted_count=0; + static receiver_config receiver_cfg; + static analysis_config analysis_cfg; + workunit s_wu; + workunit_grp s_wu_grp; + result sah_result; + spike_t sah_spike; + gaussian_t sah_gaussian; + pulse_t sah_pulse; + triplet_t sah_triplet; + autocorr_t sah_autocorr; + char filename[256]; + char * path; + std::string path_str; + long sah_result_id; + sqlint8_t sah_spike_id, sah_autocorr_id, sah_gaussian_id, sah_pulse_id, sah_triplet_id; + static bool first_time = true; + int sql_error_code; + long long seti_wu_id; + time_t now; + int hotpix_update_count; + int hotpix_insert_count; + + APP_CONFIG sah_config; + + hotpix hotpix; + list qpixlist; // will be a unique list of qpixes for + // updating the hotpix table + list::iterator qpix_i; + + nanotime.tv_sec = 0; + nanotime.tv_nsec = 1000000; + + + // app specific configuration + if (first_time) { + first_time = false; + receiver_cfg.id = 0; + analysis_cfg.id = 0; + retval = sah_config.parse_file(".."); + if (retval) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "First entrance to handler : can't parse config file. Exiting.\n" + ); + return(retval); + } else { + retval = db_change(sah_config.scidb_name); + if (!retval) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "First entrance to handler : could not open science DB %s. Exiting.\n", + sah_config.scidb_name + ); + return(retval); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "First entrance to handler : using science DB %s\n", + sah_config.scidb_name + ); + } + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "Will%s check signals for rfi\n", + sah_config.assim_check_rfi ? "" : " not" + ); + } + // Sometimes we want to perform all assimilation functions + // *except* insertion into the science master DB. + //if (noinsert) { + // log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + // "[%s] assimilator is in noinsert mode.\n", + // boinc_wu.name + // ); + //} + } else { +/* + retval = db_change(sah_config.scidb_name); + if (!retval) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "First entrance to handler : could not open science DB %s. Exiting.\n", + sah_config.scidb_name + ); + return(retval); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "First entrance to handler : using science DB %s\n", + sah_config.scidb_name + ); + } +*/ + } + //if (noinsert) return 0; // Note that this will result in the WU being marked as assimilated - + // we will not see it again. + + // translate seti wuid for thos wus that changed ids during the DB merge + seti_wu_id = new_wu_id((long long)boinc_wu.opaque); + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] old seti WU id is : %lld new seti WU id is : %lld\n", + boinc_wu.name, (long long)boinc_wu.opaque, seti_wu_id + ); + + if (boinc_wu.canonical_resultid) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] Canonical result is %ld. SETI workunit ID is %lld.\n", + boinc_wu.name, boinc_wu.canonical_resultid, seti_wu_id + ); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] No canonical result\n", boinc_wu.name + ); + } + + if (!boinc_wu.canonical_resultid) { + return 0; // Note that this will result in the WU being marked as assimilated - + // we will not see it again. No canonical result means that + // too many results were returned with no concensus. + + } + + // Obtain and check the full path to the boinc result file. + retval = get_output_file_path(boinc_canonical_result, path_str); + if (retval) { + if (retval == ERR_XML_PARSE) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Cannot extract filename from canonical result %ld.\n", + boinc_wu.name, boinc_wu.canonical_resultid); + return(retval); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] unknown error from get_output_file_path() for result %ld.\n", + boinc_wu.name, boinc_wu.canonical_resultid); + return(retval); + } + } else { + path = (char *)path_str.c_str(); + if (!boinc_file_exists(path)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Output file %s does not exist for result %ld.\n", + boinc_wu.name, path, boinc_wu.canonical_resultid); + return(-1); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] Result %ld : using upload file %s\n", + boinc_wu.name, boinc_wu.canonical_resultid, path); + } + } + + // Open it. + std::ifstream result_file(path, ios_base::in); + if (!result_file.is_open()) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] open error for result file %s : errno %d\n", + boinc_wu.name, path, errno + ); + return -1; + } + + retval = get_science_configs(boinc_wu, seti_wu_id, receiver_cfg, analysis_cfg); + if (retval) { + if (retval == 100) { + return (0); + } else { + return (-1); + } + } + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] Result %ld : using receiver_cfg %ld and analysis_cfg %ld\n", + boinc_wu.name, boinc_wu.canonical_resultid, receiver_cfg.id, analysis_cfg.id); + + // Insert a sah result + retval = populate_seti_result(sah_result, boinc_canonical_result, boinc_wu, seti_wu_id); + sah_result_id = sah_result.insert(); + if (sah_result_id) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "[%s] Inserted result. Boinc result id is %ld. Sah result id is %lld.\n", + boinc_wu.name, boinc_canonical_result.id, + (long long)sah_result_id + ); + } else { + if (sql_last_error_code() == -239 || sql_last_error_code() == -268) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not insert duplicate result. SQLCODE is %d. SQLMSG is %s.\n", + boinc_wu.name, sql_last_error_code(), sql_error_message() + ); + return 0; // non-fatal - we will never see this result again + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not insert result. SQLCODE is %d. SQLMSG is %s.\n", + boinc_wu.name, sql_last_error_code(), sql_error_message() + ); + return -1; // fatal - non-dup error + } + } + + // Insert all sah signals in turn + insert_signals( sah_spike, + "spike", + boinc_wu.name, + sah_result_id, + result_file, + receiver_cfg, + boinc_canonical_result.appid, + analysis_cfg.max_spikes, + sah_config.assim_check_rfi, + qpixlist); + + insert_signals( sah_autocorr, + "autocorr", + boinc_wu.name, + sah_result_id, + result_file, + receiver_cfg, + boinc_canonical_result.appid, + analysis_cfg.max_autocorr, + sah_config.assim_check_rfi, + qpixlist); + + insert_signals( sah_gaussian, + "gaussian", + boinc_wu.name, + sah_result_id, + result_file, + receiver_cfg, + boinc_canonical_result.appid, + analysis_cfg.max_gaussians, + sah_config.assim_check_rfi, + qpixlist); + + insert_signals( sah_pulse, + "pulse", + boinc_wu.name, + sah_result_id, + result_file, + receiver_cfg, + boinc_canonical_result.appid, + analysis_cfg.max_pulses, + sah_config.assim_check_rfi, + qpixlist); + + insert_signals( sah_triplet, + "triplet", + boinc_wu.name, + sah_result_id, + result_file, + receiver_cfg, + boinc_canonical_result.appid, + analysis_cfg.max_triplets, + sah_config.assim_check_rfi, + qpixlist); + + // update last hit time to now for each qpix hit + qpixlist.unique(); + hotpix_update_count = 0; + hotpix_insert_count = 0; + qpix_set_hotpix(qpixlist, hotpix_update_count, hotpix_insert_count); +//#define DEBUG_NEIGHBORS +#ifdef DEBUG_NEIGHBORS + for(qpix_i = qpixlist.begin(); qpix_i != qpixlist.end(); qpix_i++) fprintf(stderr, "%ld\n", *qpix_i); +#endif + qpixlist.clear(); + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] Updated %d rows and inserted %d rows in the hotpix table\n", + boinc_wu.name, hotpix_update_count, hotpix_insert_count + ); + + return 0; // the successful assimilation of one WU +} + + +template +int insert_signals( T& signal, + char * signal_name, + char * wu_name, + sqlint8_t sah_result_id, + std::ifstream& result_file, + receiver_config& receiver_cfg, + int appid, + int max_signals_allowed, + bool check_rfi, + list& qpixlist) { + + int signal_count=0, signal_inserted_count=0, retval=0, qpix; + sqlint8_t signal_id=0; + + result_file.clear(); + result_file.seekg(0); + while (!result_file.eof()) { + result_file >> signal; + if (!result_file.eof()) { + signal_count++; + signal.result_id = sah_result_id; // fill in any additional signal fields + if (max_signals_allowed == 0 || signal_count <= max_signals_allowed) { + if (!(signal.rfi_found = check_values(signal, sah_result_id, wu_name))) { + // preprocess only if we have good values + retval = pre_process(signal, receiver_cfg, sah_result_id, wu_name, check_rfi); + qpixlist.push_back(npix2qpix((long long)signal.q_pix)); + } + signal_id = signal.insert(); + if (signal_id) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] Inserted %s %"INT8_FMT" for sah result %"INT8_FMT"\n", + wu_name, signal_name, INT8_PRINT_CAST(signal_id), INT8_PRINT_CAST(sah_result_id) + ); + signal_inserted_count++; + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not insert %s for sah result %"INT8_FMT". SQLCODE is %d. q_pix is %"INT8_FMT" ra is %lf decl is %lf .\n", + wu_name, signal_name, sah_result_id, sql_last_error_code(), signal.q_pix, signal.ra, signal.decl + ); +#if 0 + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not insert %s for sah result %ld. SQLCODE is %d. SQLMSG is %s q_pix is %"INT8_FMT".\n", + wu_name, signal_name, sah_result_id, sql_last_error_code(), sql_error_message(), signal.q_pix + ); +#endif + return -1; + } + } + } + } + + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "[%s] Inserted %d out of %d %s(s) for sah result %"INT8_FMT" \n", + wu_name, signal_inserted_count, signal_count, signal_name, INT8_PRINT_CAST(sah_result_id) + ); + return 0; +} + + +int populate_seti_result( + result& s_result, RESULT& b_result, WORKUNIT& b_wu, long long & seti_wu_id +) { + + // from boinc result + s_result.boinc_result = b_result.id; + s_result.received = time_t_to_jd((time_t) b_result.received_time); + s_result.wuid = seti_wu_id; + s_result.hostid = b_result.hostid; + s_result.versionid = b_result.app_version_num; + s_result.return_code = b_result.exit_status; + if ((int)b_result.opaque & RESULT_FLAG_OVERFLOW) s_result.overflow = 1; + + // from boinc WU + s_result.reserved = b_wu.error_mask; + + return(0); + +} + +template +int pre_process(T& signal, receiver_config& receiver_cfg, sqlint8_t sah_result_id, char * wu_name, bool check_rfi) { + + //long q_pix; + + // barycenter reference frame - note that we pass epoch of the + // day coordinates as seti_dop_FreqAtBaryCenter() does precession. + // We should change this but such a change will involve several + // projects. + signal.barycentric_freq = seti_dop_FreqAtBaryCenter(signal.detection_freq, + signal.time, + signal.ra, + signal.decl, + stdepoch, + (telescope_id)receiver_cfg.s4_id + ); + + // precess in place + eod2stdepoch(signal.time, signal.ra, signal.decl, stdepoch); + + // cubic pixel number with precessed coords plus course frequency + signal.q_pix = co_radeclfreq2npix(signal.ra, signal.decl, signal.barycentric_freq); + + //co_radecl2pix(signal.ra, signal.decl, q_pix); + // move the sky portion to the high order 4 bytes + // and add in freq portion (will land in the low order 4 bytes). + //signal.q_pix = q_pix; + //signal.q_pix = (signal.q_pix << 32) + ((unsigned long)round(signal.barycentric_freq / fpix_res)); + + // send the signal through the rfi checker if configured to do so + if(check_rfi) { + if (is_rfi(signal)) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] Signal for result %"INT8_FMT" flagged as RFI\n", + wu_name, sah_result_id + ); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] Signal for result %"INT8_FMT" flagged as RFI CLEAN\n", + wu_name, sah_result_id + ); + } + } + + return 0; +} + +template +int check_values(T& signal, sqlint8_t sah_result_id, char * wu_name) { + + int retval=0; + + // check for ranges and NaN's + + if(signal.ra < 0 || signal.ra >= 24 || signal.ra != signal.ra) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Signal for result %"INT8_FMT" has out of range RA : %lf\n", + wu_name, sah_result_id, signal.ra + ); + signal.ra = bad_fp_val_marker; + retval = 1; + } + if(signal.decl < -90 || signal.decl > 90 || signal.decl != signal.decl) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Signal for result %"INT8_FMT" has out of range declination : %lf\n", + wu_name, sah_result_id, signal.decl + ); + signal.decl = bad_fp_val_marker; + retval = 1; + } + // time range is from 1990 to 2050 + if(signal.time < 2447892.5 || signal.time > 2469807.5 || signal.time != signal.time) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Signal for result %"INT8_FMT" has out of range time : %lf\n", + wu_name, sah_result_id, signal.time + ); + signal.time = bad_fp_val_marker; + retval = 1; + } + if(signal.freq < 0 || signal.freq != signal.freq) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Signal for result %"INT8_FMT" has out of range frequency : %lf\n", + wu_name, sah_result_id, signal.freq + ); + signal.freq = bad_fp_val_marker; + retval = 1; + } + + return(retval); +} + +int get_science_configs(WORKUNIT& boinc_wu, long long seti_wu_id, receiver_config& receiver_cfg, analysis_config& analysis_cfg) { + + int settings_id, retval=0; + static int first_time=1, current_settings_id=0, current_analysis_config_id=0, current_receiver_config_id=0; + settings settings; + + settings_id = parse_settings_id(boinc_wu); + if (settings_id) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] Name string contains settings id %d\n", + boinc_wu.name, settings_id + ); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "[%s] Name string contains no settings id\n", + boinc_wu.name + ); + } + +#if 0 + // temp hack + if (first_time) { + retval = get_configs_old_method(boinc_wu, seti_wu_id, receiver_cfg, analysis_cfg); + if (!retval) first_time = 0; + } + return (retval); + // end temp hack +#endif + + // can be removed after all WUs have settings (no settings would then be a fatal error) + if (!settings_id) { + get_configs_old_method(boinc_wu, seti_wu_id, receiver_cfg, analysis_cfg); + return(0); + } + // end can be removed after all WUs have settings + + if (settings_id == current_settings_id) { + return (0); + } else { + current_settings_id = settings_id; + + // get settings row + if (settings.fetch(settings_id)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "[%s] Obtained science master DB row for settings table id %ld\n", + boinc_wu.name, settings.id + ); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not obtain science master DB row for settings table id %d. SQLCODE is %d\n", + boinc_wu.name, settings_id, sql_last_error_code() + ); + return(-1); + } + + // get analysis config row + if (settings.analysis_cfg.id != current_analysis_config_id) { + if (analysis_cfg.fetch(settings.analysis_cfg.id)) { + current_analysis_config_id = analysis_cfg.id; + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "[%s] Obtained science master DB row for analysis_config table id %ld\n", + boinc_wu.name, analysis_cfg.id + ); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not obtain science master DB row for analysis_config table id %ld. SQLCODE is %d\n", + boinc_wu.name, settings.analysis_cfg.id, sql_last_error_code() + ); + return(-1); + } + } + + // get receiver config row + if (settings.receiver_cfg.id != current_receiver_config_id) { + if (receiver_cfg.fetch(settings.receiver_cfg.id)) { + current_receiver_config_id = receiver_cfg.id; + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "[%s] Obtained science master DB row for receiver_config table id %ld\n", + boinc_wu.name, receiver_cfg.id + ); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not obtain science master DB row for receiver_config table id %ld. SQLCODE is %d\n", + boinc_wu.name, settings.receiver_cfg.id, sql_last_error_code() + ); + return(-1); + } + } + + return(0); + + } +} + + +int parse_settings_id(WORKUNIT& boinc_wu) { + + int i=0, j=0, num_tokens=1, pos=0, len=0; + const int max_tokens=7, max_token_len=128, settings_token=4; + char tokens[max_tokens][max_token_len]; + + len = strlen(boinc_wu.name); + + // parse the dot delimited WU name into its + // constituent tokens + for (pos=0, i=0, j=0; + pos < len && i < max_tokens; + pos++) { + if (boinc_wu.name[pos] == '.') { + // terminate this token + tokens[i][j] = '\0'; + j = 0; + i++; + num_tokens++; + continue; + } + if (j >= max_token_len) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Token too long during name parsing.\n", + boinc_wu.name + ); + exit(1); + } else { + // continue this token + tokens[i][j] = boinc_wu.name[pos]; + j++; + } + } + + if (i >= max_tokens) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Too many tokens during name parsing.\n", + boinc_wu.name + ); + exit(1); + } else { + tokens[i][j] = '\0'; // terminate the final token + num_tokens++; + } + + if (i >= settings_token-1) { // does name cointain settings? + return(atoi(tokens[settings_token])); // yes - return it + } else { + return(0); + } +} + + +int get_configs_old_method(WORKUNIT& boinc_wu, long long seti_wu_id, receiver_config& receiver_cfg, analysis_config& analysis_cfg) { + + workunit s_wu; + workunit_grp s_wu_grp; + int sql_error_code; + + // workunit + if (s_wu.fetch(seti_wu_id)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "[%s] Obtained science master DB row for wu %lld [%s]\n", + boinc_wu.name, seti_wu_id, s_wu.name + ); + } else { + sql_error_code = sql_last_error_code(); + if (sql_error_code == 100) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Science master DB row for wuid %lld does not exit. Marking as assimilated.\n", + boinc_wu.name, seti_wu_id + ); + return sql_error_code; + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not obtain science master DB row for wuid %lld. SQLCODE is %d\n", + boinc_wu.name, seti_wu_id, sql_error_code + ); + return -1; + } + } + + // workunit_grp + if (s_wu_grp.fetch(s_wu.group_info.id)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "[%s] Obtained science master DB row for wugid %ld\n", + boinc_wu.name, s_wu_grp.id + ); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not obtain science master DB row for wugid %ld. SQLCODE is %d\n", + boinc_wu.name, s_wu.group_info.id, sql_last_error_code() + ); + return -1; + } + + // receiver_config - get it if it has changed + if (receiver_cfg.id != s_wu_grp.receiver_cfg.id) { + if (receiver_cfg.fetch(s_wu_grp.receiver_cfg.id)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "[%s] Obtained science master DB row for receiver table id %ld [%s]\n", + boinc_wu.name, receiver_cfg.id, receiver_cfg.name + ); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not obtain science master DB row for receiver table id %ld. SQLCODE is %d\n", + boinc_wu.name, s_wu_grp.receiver_cfg.id, sql_last_error_code() + ); + return -1; + } + } + + // analysis_config - get it if it has changed + if (analysis_cfg.id != s_wu_grp.analysis_cfg.id) { + if (analysis_cfg.fetch(s_wu_grp.analysis_cfg.id)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "[%s] Obtained science master DB row for analysis table id %ld.\n", + boinc_wu.name, analysis_cfg.id + ); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Could not obtain science master DB row for analysis table id %ld. SQLCODE is %d\n", + boinc_wu.name, s_wu_grp.analysis_cfg.id, sql_last_error_code() + ); + return -1; + } + } + + return 0; +} + +long long new_wu_id(long long old_wu_id) { + + workunit seti_wu; + char buf[256]; + + sprintf(buf,"where sb_id=%lld", old_wu_id); + + if (!seti_wu.fetch(std::string(buf))) { + return (old_wu_id); + } else { + return (seti_wu.id); + } + +} diff --git a/assimilator/sah_assimilate_handler.h b/assimilator/sah_assimilate_handler.h new file mode 100644 index 0000000..94b00e4 --- /dev/null +++ b/assimilator/sah_assimilate_handler.h @@ -0,0 +1,7 @@ +#include +#include "boinc_db.h" + +#define PROJECTDIR ".." + +extern int assimilate_handler(WORKUNIT&, std::vector&, RESULT&); + diff --git a/build_android_arm64_client.sh b/build_android_arm64_client.sh new file mode 100755 index 0000000..46577b0 --- /dev/null +++ b/build_android_arm64_client.sh @@ -0,0 +1,48 @@ +#! /bin/sh + +# +# See: http://boinc.berkeley.edu/trac/wiki/AndroidBuildApp# +# + +# Script to compile various BOINC libraries for Android to be used +# by science applications + +COMPILEBOINC="yes" +CONFIGURE="yes" +MAKECLEAN="yes" +export HOME=/mydisks/b/usr/ + +export BOINC="../boinc" #BOINC source code + +export ANDROIDTC="$HOME/androidarm64-tc" +export TCBINARIES="$ANDROIDTC/bin" +export TCINCLUDES="$ANDROIDTC/aarch64-linux-android" +export TCSYSROOT="$ANDROIDTC/sysroot" +export STDCPPTC="$TCINCLUDES/lib/libstdc++.a" + +export PATH="$TCBINARIES:$TCINCLUDES/bin:$PATH" +export CC=aarch64-linux-android-gcc +export CXX=aarch64-linux-android-g++ +export LD=aarch64-linux-android-ld +export CFLAGS="--sysroot=$TCSYSROOT -DANDROID -DDECLARE_TIMEZONE -Wall -I$TCINCLUDES/include -O3 -fomit-frame-pointer -funsafe-math-optimizations -freciprocal-math -fPIE" +export CXXFLAGS="${CFLAGS}" +export LDFLAGS="-static-libstdc++ -static-libgcc -L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -llog -fPIE -pie" +export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" +export PKG_CONFIG_SYSROOT_DIR=$TCSYSROOT + +# Prepare android toolchain and environment +#./build_androidtc_arm.sh + + +echo "==================building seti_boinc==========================" +if [ -n "$MAKECLEAN" ]; then +make clean +fi +if [ -n "$CONFIGURE" ]; then +./configure --host=aarch64-linux-android --prefix=$TCINCLUDES --disable-graphics --disable-server --with-boinc-platform=aarch64-android-linux-gnu --with-ssl=${TCINCLUDES} +fi +make +make install + +echo "=============================seti_boinc done=============================" + diff --git a/build_android_client.sh b/build_android_client.sh new file mode 100755 index 0000000..92610b7 --- /dev/null +++ b/build_android_client.sh @@ -0,0 +1,131 @@ +#!/bin/sh + +# +# See: http://boinc.berkeley.edu/trac/wiki/AndroidBuildApp# +# + +# Script to compile various BOINC libraries for Android to be used +# by science applications + +for pie in yes no ; do +for targetarch in armv6-vfp armv6-neon armv7-neon armv7-vfpv3 armv7-vfpv4 armv7-vfpv3d16 +#for targetarch in armv6-vfp armv6-neon +do +fpabi="-mfloat-abi=softfp" +configargs="" +cpuarch=armv7-a +tune=cortex-a9 +LIBSTDCPP=$targetarch/libstdc++.a +case $targetarch in + armv6-soft) + fpabi="-mfloat-abi=soft" + cpuarch=armv6 + fpu= + tune=cortex-m1 + ;; + armv6-vfp) + cpuarch=armv6 + configargs="--disable-neon" + fpu="-mfpu=vfp" + tune=cortex-m1 + ;; + armv6-neon) + cpuarch=armv6 + tune=cortex-m1 + fpu="-mfpu=neon -ftree-vectorize" + ;; + thumb-vfpv3d16) + cpuarch="armv7-a -mthumb" + fpu="-mfpu=vfpv3-d16" + ;; + *-neon) + fpu="-mfpu=neon -ftree-vectorize" + ;; + *-vfpv3) + fpu="-mfpu=vfpv3" + ;; + *-vfpv3d16) + fpu="-mfpu=vfpv3-d16" + ;; + *-vfpv4) + fpu="-mfpu=vfpv4" + ;; + *) + ;; +esac + + + + +COMPILEBOINC="yes" +CONFIGURE="yes" +MAKECLEAN="yes" + +export BOINC="../boinc" #BOINC source code +export PKG_CONFIG_DEBUG_SPEW=1 + +export ANDROIDTC="/usr/arm-linux-androideabi" +export TCBINARIES="$ANDROIDTC/bin" +export TCINCLUDES="$ANDROIDTC/arm-linux-androideabi" +export TCSYSROOT="$ANDROIDTC/sysroot" +export STDCPPTC="$TCINCLUDES/lib/$LIBSTDCPP" + +export CROSS_PREFIX=arm-linux-androideabi +export ac_cv_host=${CROSS_PREFIX} + +export PATH="$PATH:$TCBINARIES:$TCINCLUDES/bin" +export CC=${CROSS_PREFIX}-gcc +export CCAS=${CROSS_PREFIX}-gcc +export CXX=${CROSS_PREFIX}-g++ +export LD=${CROSS_PREFIX}-ld +export NM=${CROSS_PREFIX}-nm +export AR=${CROSS_PREFIX}-ar +export STRIP=${CROSS_PREFIX}-strip +export RANLIB=${CROSS_PREFIX}-ranlib + +export CFLAGS="--sysroot=$TCSYSROOT -DANDROID -DDECLARE_TIMEZONE -Wall -O3 -fomit-frame-pointer -march=${cpuarch} -I$TCSYSROOT/usr/include ${fpu} ${fpabi}" +export CXXFLAGS="--sysroot=$TCSYSROOT -DANDROID -Wall -funroll-loops -fexceptions -O3 -fomit-frame-pointer -march=${cpuarch} -I$TCSYSROOT/usr/include ${fpu} ${fpabi}" +export CCASFLAGS="${CFLAGS}" +export LDFLAGS="-static-libstdc++ -static-libgcc -L$TCINCLUDES/lib/${targetarch} -L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -llog -lstdc++" +export LIBS="$STDCPPTC" +export PKG_CONFIG_SYSROOT_DIR=$TCSYSROOT +export PKG_CONFIG_PATH=$CURL_DIR/lib/pkgconfig:$OPENSSL_DIR/lib/pkgconfig +if [ $pie = "yes" ] ; then + export CFLAGS="${CFLAGS} -fPIE" + export CXXFLAGS="${CXXFLAGS} -fPIE" + export CCASFLAGS="${CCASFLAGS} -fPIE" + export LDFLAGS="${LDFLAGS} -fPIE -pie" + export PIEEXT="" +else + export PIEEXT="-nopie" +fi + +if [ -n "$COMPILEBOINC" ]; then +echo "==================building Libraries from $BOINC==========================" +if [ -n "$MAKECLEAN" ]; then +cd client +make clean +cd .. +fi +if [ -n "$CONFIGURE" ]; then +./_autosetup +/bin/rm config.cache +if ! ./configure -C --host=${ac_cv_host} --prefix="${ANDROIDTC}/arm-linux-androideabi" --exec-prefix="${ANDROIDTC}/arm-linux-androideabi" --with-boinc-platform="arm-android-linux-gnu" --with-ssl=$TCINCLUDES --disable-graphics --disable-server $configargs +then + sleep 60 + break +fi +fi +cd client +if ! make -j 14 ; then + break +fi +pwd +#source ./working_collect2_line_for_android_$targetarch +cp seti_boinc setiathome_8.00_arm-android-linux-gnu__${targetarch}${PIEEXT} +cp hires_timer_test hires_timer_test__${targetarch}${PIEEXT} +cd .. +echo "=============================BOINC done=============================" +fi +done +done diff --git a/checkin_notes b/checkin_notes new file mode 100644 index 0000000..d999464 --- /dev/null +++ b/checkin_notes @@ -0,0 +1,4145 @@ +5/20/03 jeffc + This is a preliminary checkin for the project of including WU + analysis parameters in the WU header. It also includes a routine + to read binary data WUs. + + In the end, all analysis parameters will have a default compile + time value which can be supersede by values contained in the WU header. + There will be no command line analysis parameters. + + For this checkin, I added the following variables + to the SETI_WORKUNIT_INFO (swi) structure. + + spike_sigma_thresh; + gaussian_chi_sq_thresh; + gaussian_power_thresh; + gaussian_peak_power_thresh; + beam_width; + num_fft_lengths; + analysis_fft_lengths[MAX_NUM_FFTS]; + chirp_resolution; + num_chirp_ranges; + ChirpFftTable_t chirp_fft_table[MAX_CFFT_PARAMS]; + + These replaced various standalone global variables and constants. + Values for all of these variables are to be included in the WU header. + + Because of all the moving of cfft parameters to swi, chirpfft_tab was removed from + the makefile. This prompted to removal of the params assignment in common_init() + and the necessity of passing the chirp resolution down to where it was needed - + InitChirpStep(). + + I added the following array sizers: + #define MAX_NUM_FFTS 64 + #define MAX_CFFT_PARAMS 2 + + I added code to seti_parse_wu_header() to parse the new header values. + + I added the following fields to PoTInfo_t. + GaussChiSqThresh; + GaussPowerThresh; + GaussPeakPowerThresh; + + In the output routines for each signal type, I added the temporary line: + outfile.flush(); + until a outfile flushing is added to the boinc code. + + The following existing members of swi were changed from float to double and associated + scanf()'s were changed to reflect this: + start_ra + start_dec + end_ra + end_dec + angle_range + + There were some places where we were using strlen where sizeof should have + been used in seti_parse_wu_header(). I fixed these. + + Added new routine read_bin_data() to read binary data. + + Testing. I dumped the generated chirpfft table and it matches the one + generated by the current client. I let the boinc app complete a WU + and the reported signals were correct within tolerances. The reading + of binary data WUs has *not* been tested. + + Still to do (among other things): + - make swi a global structure with compile time initialization. + - swi will include substructures for: + receiver parameters + recorder parameters + splitter parameters + analysis parameters + - create a new source file, seti_parse.C that will contain + routines for parsing complex seti variables like the + above parameter lists. + - there are still a number of single precision floats + in the code. These should all be changed to doubles. + - XML-ize the signal lines in outfile. + - do away with command line options that are redundant with + WU header items. + - add bounding tags to coordinate list in the WU header. + - add bounding tags for the different parameter groups (splitter, + analysis, etc) in the WU header. + - it might be a good idea to not have the limits imposed by + MAX_NUM_FFTS and MAX_CFFT_PARAMS. Instead, we could + have analysis_fft_lengths and chirp_fft_table be pointers + to areas that we realloc as we parse the WU header. + - remove outfile.flush() from the signal outut routines. + + changed sources: + analyzeFuncs.C + analyzeReport.C,h + worker.C + chirpfft.C,h + seti_header.C,h + analyzePoT.C,h + gaussfit.C + unix_main.C + analyze.h + s_util.C,h + +5/21/03 jeffc + Removed the include of hosts.make from Makefile and hardcoded: + + BOINCDIR = /disks/milkyway/a/users/anderson/boinc_cvs/boinc + +7/16/03 korpela + Basic workunit parsing now functioning. Maybe + + Makefile.in + Makefile + seti_header.C + unix_main.C + workunit.sah + db/Makefile.server + db/db_table.h + db/schema_master.sql + db/schema_to_class.awk + +7/21/03 jeffc + CFFT table generation now uses the new header classes. Note that while + the CFFT table still follows the same order in regard to chirp rates, + the order of FFT lengths at a given chirp rate is reversed from that + of the current release client. This should not matter. + + Also pulled out some debug printf()'s. + + chirpfft.C,h + worker.C + analyzeFuncs.C + analyzePoT.C + seti.C + +7/22/03 korpela + schema_master.[Ch] now compile in server mode. + Also make mods to schema, and started a new database (sah2@master_tcp) for + test purposes. + + db/Makefile.server + db/schema_master.sql + db/db_table.h + db/schema_to_class.awk + +7/24/03 korpela + Made changes to fix printing and allow real database access. + + db/Makefile.server + db/schema_to_class.awk + db/sqlinf.ec + db/sqlinf.h + db/db_table.h + +7/24/03 korpela + Moved the SQLROW class to a separate file so it could be used in the client. + Added indentation to the database XML printing to give a more structured feel. + deleted db_sah.* and db_informix.* + + db/Makefile.client + db/Makefile.server + db/db_table.h + db/schema_to_class.awk + db/sqlinf.ec + db/sqlinf.h + db/sqlrow.cpp [New] + db/sqlrow.h [New] + db/db_informix.cpp [Removed] + db/db_informix.ec [Removed] + db/db_informix.h [Removed] + db/db_sah.cpp [Removed] + db/db_sah.h [Removed] + +8/13/03 jeffc + Integrated Eric K's signal classes into the signal INFO structures (SPIKE_INFO + etc). These structures (now classes) contain a signal proper (Eric's class) + plus ancillary data needed for "best of" tracking and graphics. The handling + of the INFO objects required some code reoriganization to not be confusing. + + Signal INFO objects are print_xml()'ed to the state file at checkpoint time. + + Best of signal objects are print_xml()'ed to the outfile upon exit from the + main analysis loop. + + This is a preliminary checkin. More testing needs to be done. There is a known + seg fault with an overloaded assignment operator (for class gaussian at least). + Some debug code and comments need to be pulled out. + + gaussfit.C + unix_main.C + spike.C,h [New] + seti.C + worker.C + analyzeReport.C,h + analyzeFuncs.C + gdata.h + + +8/14/03 jeffc + Removed the hard coded path to the boinc api includes. + + unix_main.C + worker.C + + Removed or commented out various unused variables. + + analyzeReport.C + gaussfit.C + spike.C + seti.C + seti_header.C + +8/15/03 korpela + Added "std_fixes.h", "win_config.h" and "config.h" to db directory + "std_fixes.h" should contain any routines missing from the std:: namespace on + various platforms, ifdefed by defines found in "config.h" and "win_config.h" + Renamed "sqlinf.h" to "sqlapi.h", "sqlinf.cpp" to "sqlifx.cpp" + Misc changes for compiling under windows. + +2003/08/21 quarl + Added standalone-mode run-time option (-standalone, available only in + TEST_VERSION) + + unix_main.C + + +8/28/2003 jeffc + Some (not very clean) mods to fix unix compilation. There was + a dependency of ~/bin/astyle which I removed by removing the indent + logic from schema_to_class.in. db/schema_to_class was not being made + executable, even though this was specified in configure.ac. I specified + it in db/Makefile.in (twice, ugly) instead and this works. + + db/schema_to_class.in + db/Makefile.in + +9/3/03 jeffc + The ANALYSIS_STATE struct was being intialized *after* the parsing + of the state file. We now initialize, then parse. + + worker.cpp + +9/4/03 jeffc testing notes + I ran the client on the reference WU. The results matched well with + the reference result on triplets ans spikes. The reference result contains + 1 pulse and the new result contains no pulses. The reference result contains + 2 gaussians and the new result contains 1 gaussian that did not match well + with either of the reference gaussians. The 2 reference gaussians are + really one gaussian detected twice over a shot time period. + + I realized that the WU specified the new (correct) BW - 0.083 degrees. + I reran the client with the old 0.1 degree BW and the gaussian + matched much better and I got a pulse but it did not match well. + + new gaussian new gaussian reference gaussian + bw = 0.083 bw = 0.1 bw = 0.1 + peak power 2.1929943561554 2.271505355835 2.476470e+00 + mean power 0.6764104962348 0.635128259658 6.407137e-01 + ra 14.868992642608 14.87093261104 14.871 + dec 28.5 28.56 28.56 + time 2451606.8586998 2451606.858738 2451606.85874 + freq 1418917595.1423 1418922359.339 1418922359.34 + chirp rate 6.3884830474854 -21.7681655883 -2.176817e+01 + sigma 3.5038092136383 5.086092948913 4.129033e+00 + chisq 8.4692783355713 8.749799728393 8.323806e+00 + max power 5.0800476074219 5.173916816711 5.173924e+00 + + + new pulse new pulse reference pulse + bw = 0.083 bw = 0.1 bw = 0.1 + power NO PULSE 0.3064200878 1.605851e+00 + mean 0.0019431554 1.964450e-03 + period 0.042048022 1.078955e-01 + ra 14.9086410 14.892 + dec 28.58 28.57 + time 2451606.859504 2451606.85916 + freq 1418919677.7275 1418922119.13 + fft len 32 32 + chirp rate 0 0 + snr 6.004581928253 6.854417e+00 + thresh 5.9453372955 6.675629e+00 + len_prof 12 32 + + I added the reference result and the reference result to CVS. + + checkin_notes + reference_work_unit.sah + old_format_reference_result.sah + + I added a final outfile.flush() and that fixed the problem whereby we + were getting a truncated result. + + analyzeFuncs.cpp + +David Sept 12 2003 + - Moved SPIKE_INFO etc. from gdata.h to seti.h + Principle: everything relating to graphics should be surrounded by + #ifdef BOINC_APP_GRAPHICS + - Changed gdata from pointer to struct + - Defined new structs G_SPIKE_INFO etc. for graphics-related + signal info, to avoid template/constructor problems in graphics code + - Changed BOOLEAN to bool everywhere + + Graphics now work in a rudimentary way. + + Changes most files. New file: gdata.cpp + +Eric K 13 Sep 03 + -Moved client into client directory and modified makefiles + accordingly. + +Eric K 15 Sep 03 + -Moved win_build into client directory and modified seti_boinc.dsp + accordingly. + +Jeff 17 Sep 03 + No code changes. This is the branch point for the beta. The tag is: + + setiathome-4.xx_all_platforms_beta + + for both seti_boinc and boinc. They both make on solaris without serious + error and the resulting seti client links without error with the resulting + boinc libs. I ran the seti solaris 2.7 client on the reference WU and + it produces a reasonable looking result file. The science content has + not yet been fully validated but that is OK. "Best of" signals in the + result looks good. Checkpoint and restart work. + +Eric K. 22 Sep 03 + + Checked in several mods to the setiathome-4 beta branch and the main branch + required to get the splitter working properly under boinc. + + config.h.in + configure + configure.ac + db/db_table.h + db/sqlrow.cpp + db/tools/Makefile + db/tools/Makefile.in + db/tools/analysis_configs.xml + db/tools/insert_analysis_config.cpp + db/tools/insert_s4_receivers.cpp + db/tools/insert_splitter_config.cpp + db/tools/print_s4_receivers.cpp + db/tools/recorder_configs.sql + db/tools/splitter_configs.xml + splitter/Makefile.in + splitter/splitparms.h + splitter/splitter.cpp + splitter/splitter.h + splitter/wufiles.cpp + win_build/seti_boinc.dsp + +Jeff 24 Sep 03 + We now pass a tag to the XML print routine for the printing + of the best signals. + + client/ + analyzeFuncs.cpp + +Eric K 09/25/03 + Binary types in db tables are now of class sqlblob + + Makefile.in + client/Makefile.in + client/analyzeReport.cpp + client/seti.h + db/db_table.h + db/schema_master.cpp + db/schema_master.h + db/schema_master.sql + db/schema_to_class.awk + db/sqlblob.cpp + db/sqlblob.h + db/tools/Makefile + db/tools/Makefile.in + +Eric K 09/28/03 + Added operator =() to all db_table<> children. + Changed db_*::operator =() to call the child = operators. + + db/db_table.h + db/schema_to_class.awk + db/schema_master.h + db/schema_master.cpp + +Jeff 9/29/03 + Boolean standalone now initialized to false. + + If we have no WU to read (fopen() failed) in read_wu_state(), we set retval + to FOPEN_FAILED and return. This is certainly good to do and prevents + seg faults due to empty SWI's. But we need to also check SWI data before + using it. + + client/main.cpp + client/worker.cpp + +David Sept 30 2003 + - include graphics-related stuff only if BOINC_APP_GRAPHICS is defined + + main.cpp + +David Oct 2 2003 + - read_wu_state(): if there's no input file, return an error + - got rid of windows .exe + + client/ + worker.cpp + client/win_build/Debug + seti_boinc.exe (removed) + +Eric K. Oct 2 2003 + - moved xml_indent() from sqlrow.cpp, sqlrow.h to boinc/lib/xml_util.[Ch] + + db/sqlrow.cpp + db/sqlrow.h + +David Oct 4 2003 + - Reorganized graphics code to facilitate graphical variation + Factored user prefs into GRAPHICS_PREFS + Combined all graphics-related stuff into SAH_GRAPHICS + This inherits from GDATA, GRAPHICS_PREFS etc. + so that its member functions (all render-related code) + can access data without qualification. + + There are three top-level graphics "styles": + Classic: 3D version of original graphics + Panels: text is on rotating panels + Headsup: text is 2D in corners of screen + Each of these styles has numerous user-configurable settings. + + Not everything is working yet but the code is in better shape. + + client/ + analyzeFuncs.cpp + gdata.cpp,h + main.cpp + sah_gfx.cpp,h + win_build/ + seti_boinc.dsp + +David Oct 6 2003 + - Implement rotating-panels display for SETI@home + - Factor out generation of text in display + + client/ + analyzeFuncs.cpp + sah_gfx.cpp,h + win_build/ + seti_boinc.dsp + p004_640.jpg (new, just a sample background image) + +David Oct 7 2003 + NOTE: there are three different structs for each signal type. E.g.: + class gaussian (in schema_master.h) + has PoT array in unsigned chars + struct GAUSS_INFO (in seti.h) + contains "gaussian" as an element. + Also has score, bin, and the PoT array in floats + G_GAUSS_INFO (in gdata.h) + Has the minimal set of info needed to display a Gaussian. + A few fields from GAUSS_INFO, plus an "is_best" flag, + and a "dirty" flag (has this been displayed yet?) + Has a "copy" member function for copying from a GAUSS_INFO + + The variable best_gauss (of type GAUSS_INFO) etc. (in analyzeReport.cpp) + stores the best Gaussian found so far (zero power if none) + Stored and read from the state file. + The variable SAH_GRAPHICS::gi (of type G_GAUSS_INFO) + stores the Gaussian currently being displayed (zero power if none) + + Normally SAH_GRAPHICS::gi is copied from best_gauss, + and its is_best flag is true. + However, during analyze_pot(), SAH_GRAPHICS::gi is just the + most recent Gaussian computed, and is_best is false. + + - Set the "dirty" flag of SAH_GRAPHIC's signals whenever copy to them + (i.e. don't need to do this separately) + - Remove "is_best" field of GAUSS_INFO etc. + - Copy PoT arrays using a for loop, not a memcpy() + - In graphics code: factor out the decision about which signal to display + into a separate function (choose_signal_to_display()). + Display a dirty signal if there is one, + otherwise rotate among those that are actually there. + + client/ + analyzeReport.cpp + gaussfit.cpp + gdata.cpp,h + sah_gfx.cpp,h + seti.h +David Oct 7 2003 + - show CPU time in Classic-style graphics + - improve code factoring in Classic-style graphics + - add "present" flag to TEXTURE_DESC + - fix function names + + client/ + gdata.h + sah_gfx.cpp + win_build/seti_boinc.dsp + +Oliver Oct 8 2003 + - draws logos and user icons + - fixed headsup display + + client/ + sah_gfx.cpp + win_build/seti_boinc.dsp + +David Oct 8 2003 + - Use new texture-drawing interface + + sah_gfx.cpp,h + +Jeff Oct 9 2003 + Fixed bug in calls to ::parse_xml(). The string passed to these + routines must include the outer signal tags (eg . + + client/ + seti.cpp + +Jeff Oct 10 2003 + Checkpoint triplet PoTs. + + client/ + seti.cpp + +David Oct 10 2003 + - The functions that copy signals to the graphics structure now + have a "best_of" flag + - The functions that copy signals to the graphics structure now + check whether what they're copying is the same as what's already there; + if so they don't set the "dirty" flag + (otherwise the copy of the best-of signals after each PoT analysis + disrupt the 5-second cycle of signals) + - Fixed the code that implements 5-second cycle of signals + (it was doing integer arithmetic on a huge double, yielding negative results) + - Alpha of pillars is one (opaque) + - made a STARFIELD class + - changed GRAPH_2D to RIBBON_GRAPH + - Added support for tick marks in RIBBON_GRAPH + - tested parsing of XML preferences. + Preferred way of changing graphics is to edit app_init.xml + + client/ + AnalyzeFuncs.cpp + AnalyzeReport.cpp + gdata.cpp,h + sah_gfx.cpp,h + win_build/ + init_data.xml + +Jeff Oct 10 2003 + - Fixed bug that was preventing the choosing of the first best + spike (a legitimate spike score can be < 0). + + client/ + spike.cpp + +Oliver Oct 10 2003 + - Updated panel display, moved camera to origen + + client/ + sah_gfx.c,h + +David Oct 14 2003 + - changed angle param from "rate" to "period" + - put complete set of graphics prefs in init_data.xml + - updated graphics prefs code to use same set of parameters and names + as the Web code (astropulse/html/project_specific_prefs.inc) + - removed cruft + + + client/ + main.cpp + sah_gfx.cpp,h + seti.cpp + win_builc/init_data.xml + +Oliver Oct 14 2003 + - fixed stars, moved camera back to original location + + client/ + sah_gfx.cpp + +Oliver Oct 16 2003 + - more improvements on star generation + - fixed resize via. applying a universal glScale + + client/ + sah_gfx.cpp,H + +Jeff Oct 16 2003 + - tested, debugged and added documentation to the validator + and assimilator. + - Built production executables and installed them in the + "astropulse" beta test. + - Added the informix lib paths to the boinc master cron + program. This is needed for the assimilator. + - Note that at this point server side executables (and all + parts that make them up) have to be built on koloth (the + production host). This is because koloth has a different + gcc (and libs) than our other machines. Our standard gcc + is v 3.0.4 (bundled with libstdc++.so.3) while on koloth + we have gcc 3.3 (bundled with libstdc++.so.5). Running on + koloth after building elsewhere gives: + fatal: libstdc++.so.3: open failed: No such file or directory + - Note that various Makefile.in's specify the mysql library as + being /usr/local/mysql. But for koloth it needs to be + /usr/local/mysql_32bit. Linking against /usr/local/mysql + on koloth (a 64 bit mysql) gives + ld: warning: file /usr/local/mysql/lib/libmysqlclient.a(libmysql.o): + wrong ELF class: ELFCLASS64 + There will be a sysadmin fix for this to make /usr/local/mysql + correct on all hosts. + + code: + assimilator/ + sah_assimilate_handler.cpp,h + validate/ + sah_boinc_db.cpp,h + sah_result.cpp,h + sah_validate.cpp + + systems: + koloth:~boincadm/projects/ + AstroPulse_Beta/ + config.xml + cron/ + cron-boinc + +David 16 Oct 2003 + - Factored out the part of graphics that is common to both SETI@home and Astropulse + (SAH_GRAPHICS_BASE, in sah_gfx_base.cpp) + This will make it easier to maintain consistent graphics and preferences + between the two apps + + client/ + sah_gfx.cpp,h + sah_gfx_base.cpp,h (new!) + win_build/seti_boinc.dsp + +Jeff 17 Oct 2003 + - Best triplet PoT starting tag now has encoding type and length. + - Flush the results file (outfile) only at checkpoint time and workunit + completion time. + - Cleared out various old comments and debug lines. + + client/ + analyzeFuncs.cpp + analyzeReport.cpp + seti.cpp + +Oliver 17 Oct 2003 + - Fixed panel size + client/ + sah_gfx.cpp + +Jeff 17 Oct 2003 + - Checkpoint the gaussian display power threshold. This used + to be set to zero at program start/restart and then get bumped + to a higher value with the first gaussian (but then get set + back to zero on the next restart). Thus, if the best gaussian + in the WU was in fact below tha higher thershold, the same + WU could yield different best gassians depending on restart + history. This would have interfered with redundacy based + validation. + + client/ + analyzeReport.cpp + gaussfit.cpp + seti.cpp + seti.h + +Jeff 18 Oct 2003 + - Code cleanup. Removed some long commented out code and unneeded + header files. + + client/ + analyzeReport.cpp,h + gaussfit.cpp + seti.cpp,h + spike.cpp + +David 20 Oct 2003 + - Don't use len_prof as pulse PoT length; use PULSE_POT_LEN + + client/ + gdata.cpp,h + sah_gfx.cpp + +Jeff 22 Oct 2003 + - Specify app version as 2.00. + - Use new xml_util routines to output the triplet PoTs to the + state file as comma separated values. The min and max PoTs + are now printed to the state file as 2 separate PoTs. + + configure.ac + client/ + seti.cpp + +David 23 Oct 2003 + - fixed bug where an MFILE::printf() was overrunning its static buffer. + (use MFILE::write() instead; also upped buffer size to 20K) + client/ + seti.cpp + + +Oliver 24 Oct 2003 + - updated so that it will pass the name of the axis labels in when graph is created + + client/ + analyzeFuncs.cpp + sah_gfx.cpp + sah_gfx_base.cpp,h + +David 25 Oct 2003 + - split the graphics initialization into two parts: + 1) worker thread, which sets up the data structure + shared between worker and graphics + 2) graphics thread, which does OpenGL calls (must be in graphics thread). + This fixes a race condition where sometimes the worker thread + would access the shared data structure before it was initialized. + - check for logos present before drawing. + Fixes bug with white boxes drawn in place of logos + + client/ + main.cpp + sah_gfx.cpp + sah_gfx_base.cpp,h + +Jeff 27 Oct 2003 + - use match_tag() rather than parse_str() to find the triplet PoT's + in the state file. + - bump version to 2.01. + + configure.ac + client/ + seti.cpp + +Eric K. 27 Oct 2003 + - tried to fix the indentation problem by storing and recovering the + xml_indent_level at the beginning and end of write_state_file() + + client/ + seti.cpp + +Jeff 27 Oct 2003 + - renamed output file to result.sah + + client/ + s_util.h + +David 28 Oct 2003 + - call boinc_resolve_filename() for input, output files + + client/ + worker.cpp + +Jeff 29 Oct 2003 + - bumped version to 2.03 + + configure.ac + +Oliver 29 Oct 2003 + - fixed scaled logos + + client/ + sah_gfx_base.cpp + +Jeff 29 Oct 2003 + - gather up the entire triplet PoT from the state file before + sending it off to the XML parser. + - bump version to 2.04 + + client/ + seti.cpp + configure.ac + +Jeff 30 Oct 2003 + - simplified the coding and raised the buffer size to 8K in + parse_state_file(). + + client/ + seti.cpp + +David 31 Oct 2003 + - reorganized graphics to accommodate new BOINC mechanism + for adaptation to changing user preferences. + SAH_GRAPHICS now includes graphics objects rather than pointers, + since the may need to be init()ed repeatedly. + The code organization is described in a block comment + at the top of sah_gfx.cpp + - in panel display, panel colors are 1/3 and 2/3 points of hue range + + client/ + analyzeFuncs.cpp + main.cpp + sah_gfx.cpp,h + sah_gfx_base.cpp,h + win_build/ + seti_boinc.dsp + +David 1 Nov 2003 + - more "graphics follow prefs" changes + + client/ + sah_gfx.cpp + sah_gfx_base.cpp + +David 4 Nov 2003 + - removed old code (reduce_output() etc.) that output the + top N signals globally + - removed *_start() and *_end() functions from source files. + These are relics of an old and failed code-checksum scheme + - use string instead of char[256] a few places + + client/ + analyzePot.cpp + analyzeReport.cpp + gasdev.cpp + gaussfit.cpp + malloc_a.cpp + pulsefind.cpp + ran1.cpp + seti.cpp + seti_header.cpp + worker.cpp + +David 4 Nov 2003 + - released version 2.05 in beta test + +Jeff 5 Nov 2003 + - beta released setiathome_2.06_sparc-sun-solaris2.7. Looks like + setiathome_2.06_windows_intelx86 was released yesterday. + +David 6 Nov 2003 + - track BOINC API changes + + client/ + sah_gfx.cpp + win_build/ + seti_boinc.dsp + +David 6 Nov 2003 + - release windows version 2.07 + +Jeff 17 Nov 2003 + + - Added the GNU GPL to files in client/, db/ (except db/tools/), m4/, + and some top level files. Removed some obsolete files. + + client/ + * added GPL except... + fft8g.cpp added ooura license + *.{cpp,h} removed CVS/RCS log lines + gasdev.cpp removed + ran1.cpp removed + nr.h removed + lcgamm_test.cpp removed + Makefile.in removed references to nr stuff + db/* added GPL (but not to files in tools/) + m4/* added GPL + + + - I also created a public release distribution that includes everything + needed to build the client side application. We should automate this. + For reference, the distro contains no CVS directories and does contain: + COPYING + config.guess + config.h.in + config.sub + configure + configure.ac + install-sh + Makefile.in + aclocal.m4 + config.h + client/* + *except* : + win_build/ + Logo2.bmp + Logo2.jpg + p004_640.jpg + db/* + *except*: + tools + m4/* + + + +Karl 2003-11-21 + - recompiled with BOINC api bug fix. + - 2.08 client release (non-Windows only) + +David 25 Nov 2003 + - change to + - restored missing }; + - removed deleted files from .dsp file + + client/ + analyzeFuncs.cpp + analyzeReport.cpp + spike.cpp + sah_gfx_base.h,cpp + win_build/ + seti_boinc.dsp + +Jeff 27 Nov 2003 + - New release - bumbed version to 2.10 + + configure.ac + +Jeff 01 Dec 2003 + - Added debug code and fixed path bugs in validator and assimilator. + The production validator should be working at this point. + + validator/ + sah_boinc_db.cpp + sah_boinc_db.o + assimlator/ + sah_assimilate_handler.cpp + +Karl 2003-12-02 + - created script to trim sources of files we don't want to + distribute. (it's a badass 'find' line) + - created nightly tarball script. + + trim-sources (added) + nightly-tarball (added) + +Jeff 03 Dec 2003 + - released a statically linked version of the app for linux. Bumped + version to 2.11 + + configure.ac + +Jeff 08 Dec 2003 + - We have the same gcc version problem with solaris that we do with + linux whereby if the version number of libstdc++.so on the run + machine is different than that on the build machine, the loader + fails. However, on solaris you cannot just say gcc -static as there + are dynamic only versions of some needed libs, namely libdl and + libaio. I tried to use the -Xlinker gcc option which theoretically + should allow us to specify the link (collect2) line in precise + detail. But -lstdc++ kept showing up twice with one occurrence + being outside my -Xlinker -B -Xlinker static directive. So I + hand crafted a collect2 line and placed it in a file - collect2_line. + Sourcing this file produces an executable that will load and run + across gcc versions (and solaris versions for that matter). I + don't like it but it works. + + client/ + collect2_line (new file) + +Jeff 09 Dec 2003 + - Released version 2.12 for solaris 7, with a statically linked + stdc++. + + configure.ac + client/ + collect2_line + +Eric K. 13 Dec 2003 + - Changed from error return to exception based error handling. + - The seti_error class is defined in s_util.[h,cpp] + - Not yet tested under Windows... + + client/ + analyzeFuncs.cpp + analyzePoT.cpp + analyzeReport.cpp + chirpfft.cpp + gaussfit.cpp + main.cpp + pulsefind.cpp + s_util.cpp + s_util.h + seti.cpp + seti_header.cpp + spike.cpp + worker.cpp + +12/16/03 jeffc + - The SETI_WU_HEADER was declared gloabally as "seti_wu_header" + but was passed around by reference, usually under the name + "swi". This passing around was historical and had become + confusing and needless. This change is the first of 2 steps + to have all code access the global SETI_WU_HEADER as "swi". + I removed the passing of the entire swi from all function + calls that had it. Still to do is to remove the passing of + individual fields of swi. + + client/ + analyzeFuncs.cpp,h + analyzePoT.cpp,h + analyzeReport.cpp + chirpfft.cpp,h + gaussfit.cpp + seti.cpp,h + seti_header.cpp,h + spike.cpp + worker.cpp + +12/16/03 jeffc + - The assimlator to insert into the science DB. + + assimilate/ + sah_assimilate_handler.cpp + +Jeff 18 Dec 2003 + - Commented out the catch "(boinc_error e) {}" in main.cpp. Windows compiles + were failing on it. + - Removed the second parameter, "wu", from the cnvt_fftlen_hz() call in + in sah_gfx.cpp. The prototype of cnvt_fftlen_hz() has changed and + wu was wrong (and unused) anyway. + + client/ + main.cpp + sah_gfx.cpp + +Jeff 19 Dec 2003 + - New windows release - setiathome_2.13_windows_intelx86. + This was built on machine "bart", winXP, VC6. + - Note that with this release I started archiving both release + and debug builds (with symbol table files) in apps_release_sets/ + in the project directory. The contents fo this windows release + is: + apps_release_sets/setiathome_2.13_windows_intelx86/release/ + setiathome_2.13_windows_intelx86 + vc60.idb + apps_release_sets/setiathome_2.13_windows_intelx86/debug/ + setiathome_2.13_windows_intelx86.exe + setiathome_2.13_windows_intelx86.pdb + vc60.idb + vc60.pdb + +Jeff 22 Dec 2003 + - New windows release - setiathome_2.14_windows_intelx86. + This is the debug build associated with release 2.13. + +David 23 Dec 2003 + - fixed bug in seti_parse_data(): + "catch" clause was freeing a pointer that wasn't always assigned + + client/ + seti.cpp + +Jeff 26 Dec 2003 + - Made sure that we always initialize retval to 0. + + client/ + analyzeFuncs.cpp + analyzeReport.cpp + seti.cpp + worker.cpp + +Jeff 26 Dec 2003 + - Added boinc/lib/filesys.C,h to windows VC++ project. + - Bumped version to 2.17. + - Released windows app 2.17 (debug version). + + client/ + configure.ac + client/win_build/ + seti_boinc.dsp + +Eric (via Jeff) 26 Dec 2003 + - Implement copy and assignment constructors for SPIKE_INFO. + + client/ + seti.h + spike.cpp + analyzePoT.cpp + +Jeff 28 Dec 2003 + - Make sure that retval is checked after calls to MFILE::printf. + + client/ + analyzeFuncs.cpp + seti.cpp + +Jeff 28 Dec 2003 + - release windows app 2.18 + +Jeff 29 Dec 2003 + - release solaris app 2.18 (semi-static build) + + configure.ac (bump version) + configure + +Jeff 30 Dec 2003 + - release linux app 2.18 (static build). + The build was done on host shaggy. There is some malfunctioning of autoconf/configure + such that I had to hand code -DHAVE_ATOLL and -DHAVE_DIRENT_H into client/Makefile and + VERSION_MAJOR VERSION_MINOR into config.h. + +Jeff 5 Jan 2004 + - Commented out the generation of reconfigure code in the top level Makefile. + + Makefile.in + +Jeff 5 Jan 2004 + - Removed depricated code used in processing old style (nonXML) WU headers. + - Removed depricated code used in processing command line science params (science + tuning is now done in the WU header). + - Overloaded the seti_parse_wu_header() and seti_write_wu_header() functions. One version + of each makes use on the global SETI_WU_INFO structure and one version of each + takes a SETI_WU_INFO reference as a parameter. + - Moved the global SETI_WU_INFO from seti.cpp to seti_header.cpp so that the splitter + could see it. Linking the splitter to seti.o produced a number of unresolved + symbols. We should probably put all global objects in some file called global.cpp. + - Added a CC= line to the splitter's Makefile.in and removed some test programs. + + client/ + main.cpp + seti.cpp + seti_header.cpp,h + splitter/ + Makefile.in + +Jeff 9 Jan 2004 + - The splitter places the seti WU ID into the boinc WU opaque field. Now + the assimlator reads that ID from the boinc WU opaque field and places + it into the seti result wuid field, providing a reference from result + to workunit. + + assimlator/ + sah_assimilate_handler.cpp + +Jeff 13 Jan 2004 + - A many line set of changes to have the code use the analysis + configuration parameters in the WU header rather than those in analyze.h. + Specifically: + - Removed all analysis paramters from analyze.h. For reference, + these were: + #define BOX_CAR_LENGTH 8192 + #define POINTS_IN_CHUNK 32768 + #define SPIKES_TO_REPORT 1 + #define SIGMA_THRESH 22 + #define THRESH_IN_MEAN 3 + #define THRESH_IN_TRUEMEAN 3.2f + #define CHI_SQ_THRESH 8.8f + #define PULSE_MAX 40960 + #define PULSE_MIN 16 + #define PULSE_FFT_MAX 8192 + #define PULSE_THRESH 17.0 + #define PULSE_DISPLAY_THRESH 0.5f + #define TRIPLET_MAX 131072 + #define TRIPLET_MIN 16 + #define TRIPLET_THRESH 7.75 + #define OVERLAP_FACTOR 0.5 + #define PULSE_BEAMS 1.0 + #define GAUSS_POT_LEN 64 + #define PULSE_POT_LEN 256 + #define TRIPLET_POT_LEN 256 + #define POT_LEN 64 + #define T_OFFSET 1 + #define MIN_SLEW 0.0021f + #define MAX_SLEW 0.0105f + #define BEAM_WIDTH 0.1 + #define GAUSS_SIGMA 6.78 + #define GAUSS_SIGMA_SQ 45.9684 + - In all places where analyze.h paramters where used, + switched to the corresponding swi.analysis_cfg field. + - Many of the PoTInfo fields had been initialized at compile + time with analyze.h values. PoTInfo is now initialized at + compile time with zeros and and with swi.analysis_cfg values + at run time in ComputePoTInfo(). + - The signal info objects (SPIKE_INFO, etc) used to be globally + instantiated at compile time in analyzeReport.cpp. These + are now global pointers (in analyzeReport.cpp). They + are instantiated via reset_high_scores() at run time. reset_high_scores() + first deletes the signal info objects if they exist and then + (re)new's them into existance. + This change was needed because PoT array sizing within these objects + is now a run time function. + - All '.' notation to get to signal info fields had to be changed + to "->" throughout the code. + - Moved the signal info method code from seti.h (where it was inline) + to seti.cpp (where it is not). + + client/ + analyze.h + analyzeFuncs.cpp,h + analyzePoT.cpp + analyzeReport.cpp,h + gaussfit.cpp + pulsefind.cpp + seti.cpp,h + seti_header.cpp + spike.cpp,h + +Jeff 14 Jan 2004 + - added the following #defines back, in gdata.h this time. + There are graphics only global signal info structures whose + PoT arrays are sized at compile time. Making these dynamic + would probably mean instantiating them via new in main.cpp + right before the call to sah_graphics.worker_thread_init() + or in sah_graphics.worker_thread_init() itself. Note that + at this point, graphics initialing happens *before* we + read in the WU and the included analysis config info. That + would have to change. + #define GAUSS_POT_LEN 64 + #define PULSE_POT_LEN 256 + #define TRIPLET_POT_LEN 256 + + client/ + gdata.h + + +Jeff 14 Jan 2004 + - Added 2 new fields to analysis_config table: + pulse_beams smallfloat + max_signals integer + These fields have been added to analysis_config table in + the sah2@master_tcp database but have not yet been given values. + + db/ + schema_master.sql + schema_master.h + schema_master.cpp + +Jeff 15 Jan 2004 + - Changed to pointer syntax for _INFO structs in the + G__INFO copy constructors. + + client/ + gaussfit.cpp + spike.cpp + analyzeReport.cpp + gdata.cpp,h + +Jeff 15 Jan 2004 + - Added new row (id = 4) to table analysis_config in the backend + DB. Changed: + bsmooth_chunk_size from 32767 to 32768 + pulse_beams from NULL to 1.0 (new field) + max_signals from NULL to 30 (new field) + + max_signals may need to be adjusted. + + db/tools/ + analysis_configs.xml + +Jeff 15 jan 2004 + - Added stackwalker source to the client win_build directory. + This code was copied over from the boinc source tree. + + client/ + win_build/ + Stackwalker.cpp,h + +David 15 Jan 2004 + - validator: if can't get output file, mark the result as invalid. + This deals with situations where (usually because of a BOINC bug) + there is no output file, and infinite retrying won't help. + + validate/ + sah_boinc_db.cpp + sah_validate.cpp + +David 19 Jan 2004 + - call initGL() in SAH_GRAPHICS_BASE::graphics_thread_init() + (moved from windows_opengl.C, to remove OpenGL dependency) + - add win_util.h to project + + client/ + sah_gfx_base.cpp + win_build/ + seti_boinc.dsp + +Jeff 20 Jan 2004 + - fixed a bug in the G_PULSE_INFO copy constructor where the pulse proper + pot was being assigned rather than pot_max. + - removed references to GAUSS_INFO.pot as it was not being used anywhere. + This was the floating point pot outside of the gaussian proper. + + client/ + gdata.cpp + seti.cpp,h + +Jeff 21 Jan 2004 + - removed a redundant call to reset_high_scores() in parse_state_file(). The + call in seti_init_state() suffices. + - removed the call to report_init() in seti_analyze and replaced its functionality + with a call to new function reload_graphics_state() in parse_state_file(). + - removed unneeded calls to boinc_time_to_checkpoint() in seti_analyze(). + + client/ + analyzeFuncs.cpp + analyzeReport.cpp,h + seti.cpp + +Jeff 22 Jan 2004 + - app release 2.19. Cvs tagged as app_release_2_19. + + client/ + configure + configure.ac + +Jeff 22 Jan 2004 + - removed depricated and commented out code. + + client/ + analyzeFuncs.cpp + analyzePoT.cpp + analyzeReport.cpp + main.cpp + seti.cpp + seti_header.cpp + spike.cpp + +Jeff 26 Jan 2004 + - changed all calls to match_tag() to xml_match_tag(). + - (via Eric) implemented assignment and copy constructors for TRIPLET_INFO. + - moved call to seti_init_state() to after the call to seti_parse_wu(). + This is was necessary because seti_init_state() needs configuration + data contained in the WU header. This may fix a number of access + violations and seg faults. + + client/ + analyzeReport.cpp + seti.cpp,h + seti_header.cpp + worker.cpp + +Jeff 28 Jan 2004 + - Fixed a bug in the copy constructor for PULSE_INFO + - Got stackwalker working (Rom Walton did this). + - got rid of the dependency on the windows debug runtime (Rom). + - Bumped version to 2.21 for release. + - Cvs tagged as app_release_2_21. + + client/ + main.cpp + seti.cpp + configure.ac + configure + win_build/ + seti_boinc.vcproj + +Jeff 30 Jan 2004 + - Invoke stackwalker in stack trace mode only. It was crashing with + with an access violation during memory allocation tracing. (Rom Walton) + - Made progress more linear by treating pulse finding as it should be - + an (n^2)log(n) operation. + - Update global progress upon each return from find_pulse. This happens + several times for reach frequency bin, ie much more often than before. + - CVS tagged source as app_release_2_22 and released as version 2.22 on + the windows platform. + + configure.ac + configure + client/ + main.cpp (Rom) + analyzeFuncs.cpp + analyzePoT.cpp + progress.cpp,h (new files) + Makefile.in + win_build/ + seti_boinc.vcproj (added new files) + +Jeff 01 Feb 2004 + - Changed the pulse finding progress scale factor from 1/1e6 to 1/.65e6. + - Removed commented out code. + + client/ + progress.cpp + analyzeFuncs.cpp + analyzePoT.cpp + +Jeff 02 Feb 2004 + - Progress clean up. + + client/ + analyzePoT.cpp + progress.cpp + +Rom 02 Feb 2004 + - Hooked up to diagnostics library + - Replaced ANSI C assert with BOINCASSERT + + client/ + analyzePot.cpp + analyzeReport.cpp + lcgamm.cpp + main.cpp + spike.cpp + client/winbuild + seti_boinc.vcproj + +Rom 03 Feb 2004 + - Modified stackwalker so it attemps to use the dbghelp.dll that is included + with BOINC before using the search path. + + client/winbuild + stackwalker.cpp + +Jeff 03 Feb 2004 + - Moved progress related globals from analyzeFuncs.cpp,h to progress.cpp,h. + - Changed some floats to doubles to get rid of compile warnings. + + client/ + analyzeFuncs.cpp,h + analyzePoT.cpp + progress.cpp,h + seti.cpp + worker.cpp + +Jeff 04 Feb 2004 + - Windows release. - CVS tagged source as app_release_2_23. + +Rom 05 Feb 2004 + - Remove stackwalker from the project as it has been moved to the boinc project + api folder + - updated project files to new locations + + client/win_build/ + seti_boinc.vcproj + stackwalker.h + stackwalker.cpp + +Rom 06 Feb 2004 + - Removed boincdiag.cpp, h from project files. + + client/win_build/ + seti_boinc.vcproj + +Jeff 08 Feb 2004 + - Impelmented overflow detection. Upon reaching a maximum signal + count the app will throw a RESULT_OVERFLOW exception on the + next attempt to write a signal. Max_signals is an anlaysis + config parameter. It is not yet being provided in the WU headeer + so the app has it hard coded with the value 30. The current + signal count is saved to and read from the state file. + - PoTInfo.PulseBeams now gets its value from an analysis config + paramter. It is not yet being provided in the WU headeer + so the app has it hard coded with the value 1.0. + - Renamed write_state_file() to checkpoint() as this routine + is doing more than writing to the state file. + - Routine checkpoint() now has a paramter to tell it to force + the checkpoint without a call to boinc_time_to_checkpoint(). + + client/ + analyzeFuncs.cpp + analyzePoT.cpp + analyzeReport.cpp,h + main.cpp + s_util.cpp,h + seti.cpp,h + seti_header.cpp + +Jeff 11 Feb 2004 + - kludge fix to the pulse display PoT assert failures. If we see + a value over 255, we set it to 255. + - change all match_tag() calls to xml_match_tag() calls in the db/ + code. + - bumped version to 2.24. + - Windows release. - CVS tagged source as app_release_2_23. + + client/ + analyzeReport.cpp + win_build/ + seti_boinc.vcproj + db/ + schema_master.cpp + schema_to_class.awk + configure + configure.ac + +Jeff 12 Feb 2004 + - max_signals and PoTInfo.PulseBeams both now get their values + from the analysis_cfg in the swi. + - make sure that the work areas are freed before exiting GenChirpFftPairs(). + + client/ + seti_header.cpp + chirpfft.cpp + +Rom 19 Feb 2004 + - Attempt to track down error 128 by specifying GLU32.DLL, GLUT32.DLL, + OPENGL32.DLL, and OLE32.DLL (Debug Build Only) as Delay-Load DLL's. + This causes an exception to be thrown if the DLL isn't found instead + of the OS poping up a dialog the user has to deal with. + + client/win_build/ + seti_boinc.vcproj + +Jeff Feb 19 2004 + - CVS tagged as seti_boinc_app_release_2_25. + +Rom 19 Feb 2004 + - When throwing exceptions, make the exception contain line and file + information. + + client/ + analyzeFuncs.cpp + analyzePoT.cpp + analyzeReport.cpp + chirpfft.cpp + gaussfit.cpp + main.cpp + pulsefind.cpp + s_util.cpp, h + seti.cpp + seti_header.cpp + spike.cpp + worker.cpp + +Rom 19 Feb 2004 + - Revert one try/catch block back to the orginal int type instead of what I + converted it to so it'll actually execute the cleanup code for DATA_SUN_BINARY + encodings. + + client/ + seti.cpp + +Rom 23 Feb 2004 + - Sample exception in main. + + client/ + main.cpp + +Jeff Feb 25 2004 + - CVS tagged as seti_boinc_app_release_2_26. This tag is a little late but + the sources should be little if any changed. + +Rom 06 Mar 2004 + - Include file overhaul on the Windows platform. This fixes the build breaks introduced + by the changes to the BOINC include file structure on the Windows platform + + I pretty much touched all the source and header files. This checkin should not have any + effect on any platform other than Windows. + +Rom 08 Mar 2004 + - Fix build breaks on Solaris/Linux + + Lib/ + sah_gfx.cpp + sah_gfx_base.cpp + +Eric 08 Mar 2004 + - Fixed pulse reported POT for + len_prof>analysis_config.pulse_pot_max. + pulse.len_prof is now set to zero and the pi.pot is .clear()ed. + - changed match_tag in db_table.h to xml_match_tag to fix parsing problem + + client/ + analyzeReport.h + analyzeReport.cpp + db/ + db_table.h + +Jeff 09 Mar 2004 + - Bumped to version 2.27. + - CVS tagged as seti_boinc_app_release_2_27. + + configure.ac + configure + +Rom 09 Mar 2004 + - Reduce user confusion by marking the results_overflow exception as an informational + message instead of an error. + + client/ + main.cpp + +Rom 13 Mar 2004 + - Updated time_sources script so that the image libraries could be included in the nightly drops. + +Jeff Mar 15 2004 + - CVS tagged boinc and seti_boinc as boinc_app_release_2_28. + +Jeff Mar 18 2004 + - Validator overflow code. + + validate/ + sah_validate.cpp + +Jeff Mar 19 2004 + - Result file now has bounding tags. + + client/ + worker.cpp + analyzeFuncs.cpp + + BTW, here is how to build the mac osx client/app in such a way that you + can specify the build name: + configure --build powerpc-apple-darwin + +Jeff Mar 22 2004 + - Improved debug logging in the validator. + + validate/ + sah_validate.cpp + +Rom Mar 22 2004 + - Force the memory allocation functions to include file and line information for each + allocation. + - Turn on the memory leak detection report for Windows built binaries + - replaced malloc_a/calloc_a/free_a with their Windows CRT equivs. This only applies to + Windows when being compiled as Debug. + - Fixed a couple of bugs where the copy constructors and assignment operators were only + coping a fraction of what they intended to copy + + client/ + analyzeFuncs.cpp + analyzePoT.cpp + analyzeReport.cpp + main.cpp + malloc_a.h + pulsefind.cpp + seti.cpp + stdafx.h + client/win_build/ + seti_boinc.vcproj + +Rom Mar 22 2004 + - Attempt to force load glut32.dll in a specific location, if it fails catch the SEH exception + and just disable grapgics. + + client/ + sah_gfx_base.cpp + stdafx.h + +Rom Mar 23 2004 + - client applications don't really need to dump leak detection information + for public consumption. So remark it out for public release. + - Tag for a 2.29 release. + +Rom Mar 23 2004 + - Unify all diagnostics functionality under the same banner, SETI_BOINC, + BOINC_CLI, BOINC_GUI, upper_case now all initialize the BOINC Diagnostics + Library which sets up stdout and stderr redirection, heap corruption + detection, stackwalker for Windows, and stackalker fo *nix can be pluged + in and be automatically used by all applications. + - Taskbase#1131 -- closed + - Taskbase#1132 -- closed + + client/ + analyzeReport.cpp + lcgamm.cpp + main.cpp + stdafx.h + client/winbuild/ + seti_boinc.vcproj + +Jeff Mar 24 2004 + - Fixed nightly tarball generation so that autoconf,configure,make + will result in a successful build. + + trim_sources added awk line to trim configure.ac + configure.ac made sure lines to be trimmed are clear + of autoconf special characters + +Rom Mar 25 2004 + - I have made SETI_BOINC Glut Free, Basically copied font code from glut + and put it into the glut folder. + - Removed Glut libraries + - Removed Delay Load technologies + + client/win_build + seti_boinc.vcproj + client/win_build/glut + + glut/ + + +Rom Mar 25 2004 + - Fix up project file so it'll build on a clean platform. + + client/win_build + seti_boinc.vcproj + +Jeff Mar 26 2004 + - Release tags. Sources were tagged as seti_boinc_release_2_30 and then, + after some build problems were fixed, were tagged as seti_boinc_release_2_30a. + The build from this latter tag was what was released as app version 2.30. + +Jeff Mar 26 2004 + - Removed parseOutfile from the project. + +Rom Mar 26 2004 + - Fix a minor bug where after the screen saver shutdown BOINC would fire-up + a new SAH Window + - Tag for a 2.31 release. + + client/win_build + seti_boinc.vcproj + +Rom Mar 30 2004 + - Include the glut folder in the nightly tarball + + / + trim_sources + +Jeff Mar 31 2004 + - Nightly tarball generation now runs autoconf to produce a configure script + stripped of the trimmed directories. + + trim_sources + +David Mar 31 2004 + - handle mouse events, and offer a simple interface where + dragging rotates the 3D objects + + client/ + sah_gfx.cpp + sah_gfx_base.cpp,h + +Jeff April 2 2004 + - Kludge fix for the access violations we see in csv encoding. In the + checkpoint routine I check len_prof of the best_pulse and if it is + zero we do not write that pulse to the state file. + + - tagged as seti_boinc_app_release_2_32 and released to alpha. + + client/ + seti.cpp + +Jeff April 8 2004 + - Have splitter give full path to result template on read error. + - Correct configure defined PROJECTDIR + + / + aclocal.m4 + configure + splitter/ + splitter.cpp + +Jeff April 12 2004 + - tagged with: + seti_boinc_app_release_3_00 + +David April 12 2004 + - when get OVERFLOW exception we need to call boinc_finish(), + else the core client won't regard the result as done + + client/ + main.cpp + +David April 14 2004 + - include "mfile.h" + + client/ + analyzeReport.h + +Rom April 20 2004 + - Turn on tracing of CRT warnings by default since the CRT considers + heap corruption a warning offense instead of an error. + + client/ + main.cpp + +David April 22 2004 + - change all fopen()s to boinc_fopen(). + This is necessary to avoid EINTR failures on Unix, + and locking-related failures on Windows + + client/ + chirpfft.cpp + seti.cpp + worker.cpp + +Jeff April 30 2004 + - Fixed bug where a call to encode() lacked a parameter. + + db/ + sqlblob.h + +Jeff May 13 2004 + - Overflow results are now marked thusly in the SAH master science DB. + Boinc result.opaque is used to pass the overflow flag from the + validator to the assimilator. + - Fixed bug that resulted in the following assimilator error message: + Too many open SQL statements (> 20) for sql operations + The fix (via Eric) was to do an sql_close(fd) before each return(false) + in sql_run(). + + validate/ + sah_validate.cpp + sah_result.h + assimilator/ + sah_assimilate_handler.cpp + db/ + sqlifx.ec + +David May 15 2004 + - Some changes to reflect the new STARFIELD handling + (which is done entirely in 2D). + Call app_init_camera() in SAH_GFX_BASE::render(), + instead of just once at the beginning. + Since this is where viewpoint distance is handled, + we no longer have to do it in the mouse handler. + - add glFlush() to SAH_GFX_BASE::render() + + client/ + sah_gfx.cpp + sah_gfx_base.cpp,h + win_build/init_data.xml + +Jeff May 18 2004 + - corrected printf format for logging seti WU ID as contained in the + boinc:result.opaque field. + + assimilate/ + sah_assimilate_handler.cpp + +Jeff May 18 2004 + - Testing notes. I followed WU 11se03aa.9564.4544.428382.126 through the + system (seti side DB, boinc side DB, files) and found that the following + (at least) are working properly: + - seti workunit_grp points to tape + - seti wu points to workunit_grp + - seti result points to seti wu + - seti result points to boinc result + - the data description in the workunit_grp (DB) looks OK and appears + properly in the wu file + - the following all look good in the seti DB and appear properly + in the wu file: + - receiver_config + - recorder_config + - splitter_config + - analysis_config + *except* that the xml field in the wu file receiver_config + section has the string "apos" improperly embedded (task 1275). + - the workunit_header's in the wu file and result file are identical + *except* that the wu name in the result file is incomplete (task + 1274). + - the 1 reported pulse signal also appears as the best pulse in the + result file and is inserted properly in the DB. + - the 1 triplet signal also appears as the best triplet in the + result file and is inserted properly in the DB. + - the 7 spikes are inserted properly in the DB and the highest + power spike appears as the best spike. + - there was no gaussian in this wu. + +Jeff May 18 2004 + - Place app version number and received time as julian day into the result + record in the seti master DB. + + assimilate/ + sah_assimilate_handler.cpp + + +Jeff May 21 2004 + - Targeted heap checking. Placed the following code: + #ifdef _WIN32 + BOINCASSERT(_CrtCheckMemory()); + #endif + at the beginning and end of the following functions: + find_pulse() + ReportPulseEvent() + ReportTripletEvent() + checkpoint() + parse_state_file() + and at the beginning and end of all PULSE_INFO and TRIPLET_INFO + contructors and destructors. + + - use time_t_to_jd() to calculate julian day in the assimilator. + + + client/ + pulsefind.cpp + analyzeReport.cpp + seti.cpp + + assimilate/ + sah_assimilate_handler.cpp + Makefile.in + +Jeff May 25 2004 + - Obtain analysis configuration table for result pre-proccessing + (eg barycentric frequency calculation). + - Pre-processing stub routines. + - Check the new noinsert flag (command line parameter). + + assimilate/ + sah_assimilate_handler.cpp + +Rom May 25 2004 + - tagged with: + seti_boinc_app_release_3_07 + +Rom May 26 2004 + - updated config.guess based of David's checkin in BOINC + - Update config.guess so we don't have to add the --build command to + each execution of ./configure for the Macs + + / + config.guess + +David May 27 2004 + - resize(), graphics_thread_init(): do OpenGL stuff ourselves + + client/ + sah_gfx_base.cpp + +David May 27 2004 + - change logo-rendering code to use (0,1)x(0,1) + coord system instead of bizarre 3x4 stuff + + client/ + sah_gfx.cpp + sah_gfx_base.cpp,h + +Jeff june 2 2004 + - Upped minimum quorum from 2 to 3. + + splitter/ + wufiles.cpp + +David June 2 2004 + - changed default graphics prefs + + client/ + sah_gfx_base.cpp + +David June 8 2004 + - change boinc_resolve_filename() calls + + client/ + seti.cpp + worker.cpp + +David June 11 2004 + - moved xml_util* here from BOINC + + db/ + xml_util.C,h (new) + +David June 11 2004 + - added xml_util.C,h to Windows project file + + Note: doesn't build on Windows. + Indecipherable error messages involving std::XXX stuff + + client/win_build/ + init_data.xml + seti_boinc.vcproj + db/ + xml_util.C + +Rom June 12 2004 + - Cleanup build errors on Windows + + client/ + chirpfft.cpp + s_util.cpp + sah_gfx.cpp + sah_gfx_base.cpp + stdafx.cpp + timecvt.cpp + client/win_build/ + seti_boinc.vcproj + db/ + schema_master.cpp + schema_to_class.awk + sqlrow.cpp + xml_util.C, .h + +Jeff June 15 2004 + - Check for memory allocation failures in signal info constructors. + - Cleanup build errors on *nix. + + client/ + seti.cpp + db/ + Makefile.in + +Jeff (for Eric) June 15 2004 + - New routine, db_change(). + + db/ + schema_to_class.awk + schema_master.cpp + schema_master.h + +Rom June 15 2004 + - Tag for 3.08 release, all platforms + seti_boinc_app_release_3_08 + +Jeff June 15 2004 + - Strip leading zero from minor version. + + configure.ac + +David 15 June 2004 + - added rule for .C files + + client/Makefile.in + +Jeff 16 June 2004 + - Modifications to allow the same splitter executable to run under + different projects, say beta and public. The mods are: + + - The backend sciece DB name was hard coded in splitter.cpp and + is now a required command line parameter (-scidb=). We are using + the new db_change() routine to attach to the desired DB. + - The project directory was hard coded in config.h (PROJECTDIR) + and is now a required command line parameter (-projectdir=). + - the download directory was hard coded in splitparms.h as + WU_DIR. This was changed to WU_SUBDIR which equates to + "download" and concatenated to the projectdir to get the + fully qualified download directory. + + splitter/ + splitter.cpp,h + splitparms.h + makebufs.cpp + wufiles.cpp + +Rom 16 June 2004 + - Fix awk script so it'll coreectly deal with stdafx.h + + db/ + schema_master.cpp + schema_to_class.awk + +David 16 June 2004 + - include miofile.C in project + + client/win_build/ + seti_boinc.vcproj + +Jeff 17 June 2004 + - Change xml_util.C to xml_util.cpp. + + db/ + xml_util.C deleted + xml_util.cpp added + Makefile.in + +Jeff 18 June 2004 + - Splitter now reads the science DB name from an application config file. + This config file and the parsing of it is modeled on the boinc + config file. It is called sah_config.xml and resides in the project + directory. + + - Routine db_change() now dies nothing is the requested DB is already + open. + + db/ + app_config.cpp,h new files + schema_to_class.awk + schema_master.h + Makefile.in + + splitter/ + splitter.cpp + wufiles.cpp + +Jeff 20 June 2004 + - Assimilator now reads the science DB name from an application config file. + - Added pre_process stubs to assimilator (will be used for reference frame + correction etc). + + assimilator/ + sah_assimilate_handler.cpp,h + Makefile.in + +Jeff 21 June 2004 + - Changed fpops numbers on the splitter (these numbers appear in the WU. + db_wu.rsc_fpops_est from 3.9e+12 to 2.79248e+13 + db_wu.rsc_fpops_bound from 6.4e+13 to 4.46797e+14 + Keeping the ratio of bound to estimated at 16/1. + + splitter/ + wufiles.cpp + +Karl 2004-06-24 + + OpenBSD compile fixes from Daniel Hartmeier + + client/ + worker.cpp + db/ + xml_util.h + +Eric K 30 June 2004 + - Removed "using" directives from header files. "using" + directives should not be used in header files for the following reasons. + - A "using namespace" directive cannot be revoked for any source file + including the header. It forces the use of the namespace regardless of + the consequences. + - Dropping the namespace qualifier on STL templates ambiguates the + resolution of template functions. (How many C libraries or headers + have you seen that define the function min()?) + - Reducing typing is not a good reason to drop namespace qualifiers any + more than it would be a good idea to "#define p printf" + - Namespaces exist for a reason. + - It's acceptable to have "using" directive in a source file, since it + won't affect other files. It's better to have "using std::string;" + directives than "using namespace std;" for hopefully obvious reasons. + +Eric K 1 July 2004 + - changed the sql type of pot in gauss in triplet from char[64] to byte + - added a print_raw() method to the sqlblob class + - changed the gaussian null chisqr threshold to 2.075 to increase the number + of gaussians found. + client/gaussfit.cpp + db/schema_master.cpp + db/schema_master.sql + db/schema_to_class.awk + db/sqlblob.h + db/sqlifx.ec + db/sqlrow.cpp + db/sqlrow.h + db/tools/analysis_configs.xml + +David 7 June 2004 + - compile fixes, and use new BOINC API + + client/ + main.cpp + sah_gfx_base.cpp + +Jeff 9 July 2004 + - Splitter uses new prototype to create_work() in order to specify + the fully qualified path to the result template file. + - Because the query to count unsent results takes a long time, we + only perform the query every once every 100 times into + wait_for_db_wus_ondisk(). All other calls to this routine return + immediately, indicating a need for work. Further, while in the + wait for work loop, we perform the query only every 10 minutes. + - For Eric - the FOPS estimates have bben increased by a factor + of 6 (previous code checkin). + + splitter/ + splitter.cpp,h + wufiles.cpp + +Jeff 12 July 2004 + - db_change() will do nothing but return db_is_open if the requested + database is already open. + + db/ + schema_to_class.awk + +Jeff 12 July 2004 + - as a matter of policy, application handlers called by boinc programs + (ie the validator and assimilator) should handle error returns from boinc + functions themselves rather than return the error up to boinc code. + This change is for the assimilator to issue a message and then exit + if it cannot parse the project config file or if it cannot connect + the the project (boinc) DB. + + ssimilator/ + sah_assimilate_handler.cpp + +Jeff 15 July 2004 + - At Rom's request, backed out Eric's fops estimation changes + (see entry of 9 July 2004). + + splitter/ + wufiles.cpp + +Rom July 15 2004 + - Tag for 4.00 release, all platforms + seti_boinc_app_release_4_00 + +David July 19 2004 + - Win build: changed output filename to 4.00 + + client/win_build/ + seti_boinc.vcproj + + +Noaa 30 July 2004 + + - changed headers for sah_gfx_base.cpp + - different Makefile.in (ie Makefile.in.graphics) that can be + put in place of Makefile.in before configure to configure for + graphics, may need to be changed slightly depending on user, + description in Makefile.Readme + + client/ + sah_gfx_base.cpp + Makefile.in.graphics (new) + Makefile.Readme + +David 3 Aug 2004 + - BOINC API change + + client/ + main.cpp + +Noaa 5 August 2004 + + - changed lglut to lboincglut in Makefile.in.graphics + - changed Makefile.Readme to reflect that + - added a Graphics.Readme to explain how to install w/graphics + + / + Graphics.Readme + + client/ + Makefile.in.graphics + Makefile.Readme + +Noaa 6 August 2004 + + - Minor change to Makefile.Readme + - change of sah_gfx_base.cpp headers + + client/ + Makefile.Readme + sah_gfx_base.cpp + + +Jeff 12 Aug 2004 + - use hierarchical uldl directory structures (see boinc checkin notes). + - call perror() when splitter cannot fork(). + + assimilator/ + sah_assimilate_handler.cpp + validate/ + sah_boinc_db.cpp + splitter/ + splitter.cpp + wufiles.cpp + +Jeff 13 Aug 2004 + - bumbed the WU ondisk threshold from 20k to 50k. + - fixed a bad call to create_work(). The prototype had changed. + + splitter/ + splitparms.h + wufiles.cpp + +Jeff 24 Aug 2004 + - officially renamed the splitter executable to sah_splitter + + splitter/ + Makefile.in + +Jeff 25 Aug 2004 + - tell dir_hier_path() to create download subdirs as needed. + + splitter/ + wufiles.cpp + +David 30 Aug 2004 + - created html/ directory + + html/ (new) + project.inc + +Jeff 09 Sep 2004 + - Change to the validator to handle the case where one or more of the result files + for a WU's result set are missing. Before this change this state would result + in this WU and it's results never getting looked at again. No science, no + credit. + + This is coordinated seti_boinc / boinc change. This note is repeated in + the boinc checkin_notes. + + seti_boinc changes: + - get_result_file(), if it cannot read the result file, tries to read the + directory where the result file should be. If it can read the directory, + it returns ERR_FOPEN, as before. If it cannot read the directory, it + resturns ERR_OPENDIR. ERR_OPENDIR in this context signals a possibly + transient problem. Upon a successful result read, it sets sah_result.have_result + (a new data member as of this change) to true. + - check_set(), upon return from get_result_file() : + - sets result.validate_state to VALIDATE_STATE_ERROR (a new state + as of this change) and retval to zero if there is a nonzero + retval from check_set() and it is not ERR_OPENDIR. It then + continues. + - otherwise just continues. + check_set() then determines if any IO errors brought the result count + below wu.min_quorum. If not, it continues. Otherwise it returns. + In all subsequent logic any results for which sah_result.have_result == false + are skipped. Note that the result and the sah_result vectors are associated. + + validate/ + sah_result.h + sah_validate.cpp + sah_boinc_db.cpp + + boinc changes: + - new validate state VALIDATE_STATE_ERROR. + - in the enumeration for check_set(), we now include a clause to check for + VALIDATE_STATE_INIT in order to ignore results set to VALIDATE_STATE_ERROR. + This enumeration query now matches that for check_pair(). + Note that the only possible retvals from check_set() are now zero or + ERR_OPENDIR. + Note that logic to retry possibly transient errors still needs to be done. + Also left to be done is a transitioner change to subtract the number of + results in state VALIDATE_STATE_ERROR from the count of active results. + The latter change is needed to stimulate the production of additional results + for the affected WU. + + sched/ + validator.C + db/ + boinc_db.h + +Jeff 09 Sep 2004 + - Some changes to the validator mods of today. Validator logic now matches the + updated validator documentation on the boinc website. + + validate/ + sah_validate.cpp + +Jeff 19 Sep 2004 + - Some time ago a bug was fixed that reduced the amount of time it takes + to do pulse searching but the progress unit computation remained tuned + to the bug. This resulted in an overestimation of the percentage of + total processing time spent in pulse searcing. We do the most intensive + pulse searching at the start of a WU so what the user sees is an early + and false jump in percentage done. This change is just a retuning of + PulseProgressUnits(). I changed: + return(PulsePoTLen * PulsePoTLen * log(PulsePoTLen) * FftLen / 0.65e6); + to: + return(PulsePoTLen * PulsePoTLen * log(PulsePoTLen) * FftLen / 2.65e6); + + client/ + progress.cpp + +David 29 Sept 2004 + - fixed "heads-up" graphics display + + client/ + sah_gfx.cpp + +David 11 Oct 2004 + - accommodate change to BOINC graphics API + Moved exception-catchers from main() to worker() + - renamed SAH_GRAPHICS_BASE::worker_thread_init() to data_struct_init() + (since this is now called by graphics thread, not worker) + + client/ + main.cpp + sah_gfx.cpp,h + sah_gfx_base.cpp,h + worker.cpp,h + win_build/ + seti_boinc.vcproj + +Lana 13 Oct 2004 + - cleanup validator code to correspond to the boinc API + requirements for handling error conditions + + validate/ + sah_validate.cpp + +David 13 Oct 2004 + - compile fixes + + client/ + sah_gfx_base.cpp,h + +David 26 Oct 2004 + - track change to BOINC API + + client/ + main.cpp + +Rom 26 Oct 2004 + - Tag for 4.06 release, all platforms + seti_boinc_app_release_4_06 + +Eric 28 Oct 2004 + - Added support for threaded clients + - Fixed problem with retrieving insert ids related to ifx_getserial8() + - Fixed problem in xml_util.h when compiling on LLP64 platforms + + aclocal.m4 + config.h.in + configure.ac + configure + m4/ + acx_pthread.m4 + assimilator/ + Makefile.in + client/ + Makefile.in + db/ + sqlifx.ec + xml_util.h + db/tools/ + Makefile.in + splitter/ + Makefile.in + validate/ + Makefile.in + +Rom 29 Oct 2004 + - Tag for 4.07 release, all platforms + seti_boinc_app_release_4_07 + +David 31 Oct 2004 + - add config line to get rt library (sched_get_priority_min) on Solaris + + configure.ac + +Jeff 10 Nov 2004 + - Started using the "best_" signals in a result for validation. We had always + meant to do this in order to provide robust validation for results with + no signals exceeding threshold. Plus, the way the validator is written, + zero signal results arriving after the initial WU validation would always + recieve zero credit (at least one signal was expected). + + - Siganls counts now appear in the log (DEBUG level). + + validate/ + sah_result.{h,cpp} + sah_validate.cpp + +David 12 Nov 2004 + - move code to parse BOINC init file from + data_struct_init() to graphics_thread_init(); + fixes bug where user name and team didn't show + - Win compile fixes + + client/ + sah_gfx_base.cpp + win_build/ + seti_boinc.vcproj + +David 17 Nov 2004 + - use regular GLUT library + + client/ + Makefile.in.graphics + +Eric K. 18 Nov 2004 + - increased memory resource bound to 64M to prevent core client + from killing application when running with graphics enabled. + - Fixed base64 and base85 decoders in xml_util.h + - Altered BLOB printing so a minimum of 1 byte will always be inserted. + This fixes a problem with the new informix SDK. + + db/ + xml_util.h + schema_to_class.awk + schema_master.cpp + schema_master.h + splitter/ + wufiles.cpp + + - addendum (jeffc) : The BLOB fix here does indeed fix the problem + whereby some 5% of pulse inserts failed. Spike and triplet + inserts still fail at a rate of less than 1% in each case. The + cause of this is as yet unknown. The first public project SAH + result ID processed since today's fix was put in place was + 2969946. + +Jeff 18 Nov 2004 + - Added better error checking around inserts into the science DB. + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 19 Nov 2004 + - Return from handler if result insert fails. + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 19 Nov 2004 + - added the following fields to analysis_config table (all initialized + to zero): + max_spikes + max_gaussians + max_pulses + max_triplets + + db/ + schema_master.sql + schema_master.cpp + schema_master.h + tools/ + analysis_configs.xml + + with a recompile of the splitter and assimilator. + +Jeff 23 Nov 2004 + - bumped MAX_WUS_ONDISK back up to 500000. + + splitter/ + splitparams.h + +Rom 23 Nov 2004 + - Tag for 4.09 release, all platforms + seti_boinc_app_release_4_09 + +Jeff 29 Nov 2004 + - Master science DB fetches to obtain analysis config. This is used to + find max allowable inserts for any given signal type. + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 30 Nov 2004 + - Final step in the "limit spike insertions to 8" project. Stopped + splitters, made a new analysis_config row (id=4), updated settings + to make analysis_cfg=4, and restarted splitters. The max(id)'s + of the following tables prior to splitter restart were: + seti master DB (sah2) workunit_grp : 22423 + seti master DB (sah2) workunit : 5736259 + boinc DB (SETI_BOINC) workunit : 5279254 + + db/tools/ + analysis_configs.xml + +Jeff 02 Dec 2004 + - Removed 2 files. uttolst.cpp contained a buggy routine, + tm_UtToLst() which did not handle multiple 24 hour wraps in the + calculation of LMST. This bug is what led to some RA's being >= 24. + Eric fixed this with an fmod() call in the new LMST routine, jd_to_lmst(), + contained in source file coordcvt.cpp. The only program to use code + from uttolst.cpp is testcoord, a program that Eric used to test + jd_to_lmst(). jd_to_lmst() has been fully tested and in production + for quite some time (over a year). + + splitter/ + Makefile.in + uttolst.cpp removed + testcoord.cpp removed + +Jeff 03 Dec 2004 + - Added the start of a public app build and test page. Needs work. + + html/ + sah_source_code.php + +Jeff 03 Dec 2004 + - added code (commented out for now) for precessing and reference frame + correcting signals. + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 07 Dec 2004 + - Finished source code / build instruction page for the web site. + - Placed a reference result in the test WU directory. + - Removed the old style reference result. + + html/ + sah_participate.php + sah_source_code.php + client/ + test_workunits/ + old_format_reference_result.sah (removed) + reference_result.sah + + +Rom 07 Dec 2004 + - Cleanup from header file changes + + client/ + lcgamm.cpp + main.cpp + sah_gfx.cpp + sah_gfx_base.cpp + client/win/ + seti_boinc.vcproj + image_libs/ + bmplib.cpp + +Jeff 08 Dec 2004 + - Corrected tolerances in the validator so that they match this policy: + ra 0.00066 hours absolute + dec 0.01 degrees absolute + time .000011574 days absolute + frequency 0.01 Hz absolute + chirp_rate 0.01 Hz/s absolute + powers 1% relative + chisqrs 1% relative + triplet period 0.01 second absolute + pulse period 0.1% relative + pulse threshold 1% relative + pulse snr 1% relative + + Diffs: + was: if (abs_diff(ra, s.ra) > .15) return false; // .01 deg + is: if (abs_diff(ra, s.ra) > .00066) return false; // .01 deg + + case SIGNAL_TYPE_PULSE: + was: if (abs_diff(period, s.period) > .01) return false; // .01 sec + is: if (rel_diff(period, s.period) > .01) return false; // 1% + + + case SIGNAL_TYPE_TRIPLET: + was: if (rel_diff(period, s.period) > .01) return false; // 1% + is: if (abs_diff(period, s.period) > .01) return false; // .01 sec + + max(id) for result in the master science DB (sah2) prior to this change + (assimilator was allowed to drain): 4345521 + + validate/ + sah_result.cpp + +David 10 Dec 2004 + - Fixed Windows compile. + Added ../../../boinc/win_build to the include path + to pick up config.h + + client/win_build/ + init_data.xml + libboincapi.vcproj + seti_boinc.vcproj + setiboincdb.vcproj + +Jeff 16 Dec 2004 + - Record the app exit value in the master result record. Max(id) in + the master DB result table before this change was 4873677. + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 17 Dec 2004 + - Record the boinc WU_ERROR state in the master result record. Max(id) in + the master DB result table before this change was 4923923. + + This is being recorded in the result.reserved field. This field needs + to be renamed. + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 17 Dec 2004 + - Fixed link problem in the client directory. We now need to link to the boinc_api + as well as the boinc lib. + + client/ + Makefile.in + +Jeff 21 Dec 2004 + - Brought the assimilate handler into compliance with the new prototype. It now returns + a non zero retval on any error and zero on success. All errors are potentially recoverable. + + assimilator/ + sah_assimilate_handler.cpp + +Eric K 23 Dec 2004 + - First step in getting a universal graphical/non-graphical application. + - Added a -nographics command line option to turn off graphics. + - Graphics calls are now wrapped in "if (!nographics)" + - Added a client_stage variable which contains the initialization state of + the graphics (PREGRX,GRXINIT,POSTINIT). If a fatal error occurs, this + allows the client to guess at whether the failure was graphics related. + - Added an atexit handler which restarts the application in nographics + mode if exit is called in stage GRXINIT. + - If found, seti_boinc uses the native libjpeg. + + aclocal.m4 + config.h.in + configure + configure.ac + client/ + Makefile.in + analyzeFuncs.cpp + analyzePoT.cpp + analyzeReport.cpp + gaussfit.cpp + main.cpp + s_util.[h,cpp] + seti.[h,cpp] + spike.[h,cpp] + worker.[h,cpp] + +Jeffc 23 Dec 2004 + - Started the add of setilib to the configuration. + + configure.ac + aclocal.m4 + config.h.in + configure + m4/ + sah_check_setilib.m4 + assimilate/ + Makefile.in + +David 25 Dec 2004 + - compile fix for windows + - commented out sleep(10) in worker + + client/ + worker.cpp + win_build/ + libboinc.vcproj + +David 25 Dec 2004 + - more compile fixes for Windows, which mysteriously didn't + compile the debug version correctly + + added ../../../boinc/win_build to the include search path for all projects, + and removed boinc/api/win and boinc/client/win (these don't exist) + + Removed the forced include of ../config.h (this file doesn't exist) + + Note: on Windows, as far as I know, + "config.h" refers to the file boinc/win_build/config.h + + client/ + worker.cpp + win_build/ + libboinc.vcproj + libboincapi.vcproj + seti_boinc.sln + seti_boinc.vcproj + setiboincdb.vcproj + +Jeff 27 Dec 2004 + - More values are now read from sah_config.xml. Current values: + sah2@master_tcp + 500000 + 2 WAS 3 + 3 + 5 + 10 WAS 7 + 5 + - max WU IDs before this change went online: + SETI_BOINC DB : 7084313 + sah2 (science master) DB : 7545411 + + splitter/ + splitter.cpp + wufiles.cpp + db/ + app_config.cpp + app_config.h + +David 29 Dec 2004 + - Got the windows client to compile. + Added a file win_build/win_version.h that defines + MAJOR_VERSION and MINOR_VERSION. + Currently these are in configure.ac, + but I don't see how to convey these values to a file + included in the Windows compile. + If there's a better way feel free to undo this change + + client/ + version.cpp + win_build/ + seti_boinc.vcproj + win_build/ + win_version.h (new) +Jeff 4 Jan 2005 + - Rather than call dir_hier_path() directly, call boinc routine get_output_file_path() + to get path to result files. This automatically gives us the new path hash algorithm. + (see boinc checkin notes on 1/1/2005). + + Max result ID in the master science DB prior to the assimilator change was 5993798. + + validate/ + Makefile.in + sah_boinc_db.cpp + assimilator/ + Makefile.in + sah_assimilate_handler.cpp +Jeff 4 Jan 2005 + - Added calls to setilib routines to precess RA and declination to J2000. At this point, + this is only done for spikes and the results of the calculations are printed to the + log only - we are not actually updating the spike coords. After making sure the precession + is correct, we can start updating all signals. + + Max result ID in the master science DB prior to this change was 6005078. + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 11 Jan 2005 + - Calculate barycentric frequency for all signals (not updating yet). + + validate/ + sah_assimilate_handler.cpp + +David 8 Feb 2005 + Various changes to get the Win version to compile, + hopefully with graphics working: + + - removed SAH_GRAPHICS_BASE_INTERFACE class. + The new idea is to have a SAH_GRAPHICS object, + which in the shared-library case lives in the shared library. + The main program has a pointer to this object, + but calls only its data-modification functions, + so it doesn't need to link with OpenGL or GLUT. + - Moved render() from SAH_GRAPHICS_BASE to SAH_GRAPHICS. + This eliminates the need for virtual functions. + - added reduce.C, md5*.C to project files + + client/ + sah_gfx.cpp,h + sah_gfx_base.cpp,h + seti.h + worker.cpp + win_build/ + libboinc.vcproj + libboincapi.vcproj +Eric 8 Feb 2005 + - Removed the db directory from the Makefile.am build list + - Added SETILIBDIR and INFORMIXDIR to Makefile.incl + - Changed references to /bin/false in configure.ac to remove path + - Changes to make the unix client compatible with davids changes above: + - worker thread needs access to + SAH_GRAPHICS_BASE::get_generate_buffer() and + SAH_GRAPHICS_BASE::generate_done(), so added #ifdefs to make + them visible to the executable during build + - Reordered db/db_table.h to re-fix undefined symbols + + Makefile.am + Makefile.in + Makefile.incl + configure.ac + configure + client/ + Makefile.am + Makefile.in + sah_gfx.[h,cpp] + sah_gfx_base.[h,cpp] + db/ + db_table.h + +Eric 10 Feb 2005 + - Removed aclocal.m4 and configure because they are generated by + _autosetup. + - Simplified the folding algorithm bases on code send by Ben Herndon. + On superscalar processors this can also be a speedup. On SPARC, + it's a 0.24% slowdown, not enough that we should stick with the + more complex original code. + - Changed the automake file to remove references to "installing" + seti_boinc into /usr/local/bin + - Fixes to get the windows client running. + - Added check for _int32 and int32_t to configure.ac + - Now that sah_graphics is dynamically allocated, a lot of our + graphics structures weren't getting initialized properly. I've + written default constructors for: G_GAUSS_INFO, G_TRIPLET_INFO, + G_PULSE_INFO, GDATA, SAH_GRAPHICS_BASE, SAH_GRAPHICS, SETI_WU_INFO, + GRAPH_BUFFER, and GRAPHICS_PREFS. + - Added ltmain.sh, depcomp and win_build/* to the nightly tarball. + - Changed trim_sources to use _autosetup instead of autoconf. + + aclocal.m4 (removed) + configure (removed) + trim_sources + configure.ac + config.h.in + client/ + pulsefind.cpp + Makefile.am + worker.cpp + sah_gfx.[h,cpp] + sah_gfx_base.[h,cpp] + seti_header.cpp + gdata.h + jpeglib/ + jpeglib.h + +Jeff 14 Feb 2005 + - put libboinc at the end of the lib list (functions in other + libs use symbols defined in libboinc) + - change some assimilator messages to DEBUG level. + + assimlator/ + Makefile.am + sah_assimilate_handler.cpp + validate/ + Makefile.am + +Eric K. 15 Feb 2005 + - fixed missing definition of dir_hier_path() in wufiles.cpp + - reordered initializations in constructors to get rid of + warning messages + - modified configure script to set CXXFLAGS to equal CFLAGS if + CXXFLAGS is not defined + - The client was trying to look up the graphics library symbol + "x11_glut_is_initialized" rather than "xwin_glut_is_initialized" + + configure.ac + client/ + gdata.h + sah_gfx_base.cpp + worker.cpp + splitter/ + wufiles.cpp + +Eric K. 16 Feb 2005 + - Fixed broken nightly tarball + + trim_sources + +Eric K. 16 Feb 2005 + -Rather than rechirping the original data every 1000 chirp + steps, we now rechirp the original data every step. This + will make results more repeatable when restarting work units. + It may also allow floating point rather than double precision + trig functions. + -The savedWUData in analysis_state used to be the raw data from + the file. As of now it is the baseline smoothed data floating + point data (unchirpped). + + client/ + seti.h + seti.cpp + analyzeFuncs.cpp + + + + - Fixed broken nightly tarball + +Eric K. 10 Mar 2005 + -To better support systems with concurrent calculation of sin() + and cos() I've added a sincos() and sincosf() function for + systems without these intrinsics. + -Modified analyzeFuncs and fft8g to use sincosf(). + -Fixed bug that prevented baseline smoothing on chirp 0 data. + -Modified configure to check for sinf(),cosf(),sincos() and sincosf() + + configure.ac + config.h.in + client/ + fft8g.cpp + sincos.h + analyzeFuncs.cpp + +Jeff 11 Mar 2005 + - Templated the science pre_processing function. Max(id) for result in the + master science DB before putting this change online was 9289454. + + assimilator/ + sah_assimilate_handler.cpp + +Charlie 11 Mar 2005 + - Add support for building Mac SETI@home application using XCODE IDE on Macintosh. + + mac_build/ + HowToBuildBOINC_XCode.rtf + seti_boinc.xcode.zip + +Jeff 16 Mar 2005 + - We now do values checking on signals and do not pass a signal on to + preprocessing is there is a critical value out of range (ra, decl, + time, freq at this point). We so however attemp to insert such a + signal into the master DB, with the value 1 placed in rfi_found. + + Max(id) for result in the master science DB before putting this + change online was 9826217. + + It came to light during testing this change that the occasional + insert failures that we see are for signals with wildly bad + values (NaNs ?). + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 17 Mar 2005 + - Began inserting signals with pre-processed values: + - precession of coordinates from EOD to J2000. This uses + the serendip precession code. + This was tested by comparing assimilator precession results + to those obtained by the online FUSE precession calculator: + http://fuse.pha.jhu.edu/cgi-bin/precess_tool + There was agreement to under an arcsecond. This was also + tested under RA wrap conditions. Here are 2 examples: + obs RA obs decl sah precession obs time precession by fuse calc sah-fuse diff in arcsec + RA decl RA decl RA decl RA decl + 17.018570 18.127011 17.014893 18.134086 2453368.151255 17.014886 18.13411 0.378 -0.0864 + 0.001608 28.397810 23.997351 28.37006 2453365.416415 23.997336 28.36997 0.81 0.324 + + - calculation of the signal's barycentric frequency. + This also uses serendip code. Frequency shifts were within + the expected range (max ~= 142KHz) but no independent tests were done. + + - calculation of the cubic pixel number. This was tested by + reversing the qpix calculation and comparing the resulting + RA/Decl with the the original. There was agreement to a max + deviation of ~1.3 arcminutes which is OK because the qpix reversal + gives you the pixel center coordinates which is a max of ~1.3 arcmin + arcminutes from the pixel edge (given nside=2048). Most diviations + on reversal were smaller than this. + + Max(id) for result in the master science DB before putting this + change online was 9927205. + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 21 Mar 2005 + - Better debugging output during WU file path resolution. + + assimilator/ + sah_assimilate_handler.cpp + +Rom 23 Mar 2005 + - Fix the release build of the S@H app on Windows + + client/ + version.cpp + client/win_build/ + seti_boinc.vcproj + + +Eric 12 Apr 2005 + - Fix bug in database code. The informix interface was expecting blobs to + be presented in hex format rather than raw binary. So informix interface + was attempting to translate the code to binary. In addition there was a + bug in the translating code such that only characters 'a'-'f' and 'A'-'F' + were being translated. The result was that most of the blob data were + reassigned blob[i]=(blob[2*i]*16+blob[2*i+1])&0xff. + - For better debugging, I changed the sqlifx.ec chk_status() macro (which + included a RETURN!!! Yuck!) into a boolean function. + - Since the informix SQLCODE variable (and the identical sqlca.sqlcode) + aren't available to the debugger, I replaced accesses to this variable + with calls to sql_error_code(). + - Since when errors were detected, sql_close() was being called which + cleared the error code. We've added a function sql_last_error_code() to + return the last non-zero error code and sql_reset_error_code() to reset + the last non-zero error code. There's still some work to do as far as + returning proper error status to the calling environment + - Changed the database name in the schema to sah2@sci_master_tcp to match + move to new db server/ + + db/ + schema_master.[cpp,h,sql] + schema_to_class.awk + sqlapi.h + sqlblob.h + sqlifx.ec + +Jeff 27 Apr 2005 + - Many changes to the informix related code in db/ in order to get the + science master DB migration code to work and to fix a bug that + was preventing the proper insertion of PoT's (both gaussian and + pulse). Eric L essentially rewrote sqlifx.ec. Note that to + allow DB insertions with ID's the symbol KEEP_ID must be defined + at compile time. + + - also some mods to the config insert tools in order to add some + new configs. + + db/ + db_table.h + schema_master.cpp + schema_to_class.awk + sqlapi.h + sqlblob.h + sqlifx.ec + sqlrow.cpp + sqlrow.h + + tools/ + Makefile.in + insert_analysis_config.cpp + insert_s4_receivers.cpp + insert_splitter_config.cpp + settings.sql + splitter_configs.xml + +Jeff 01 May 2005 + - recompiled the validater to pick up the credit fix referenced: + Bruce 29 April 2005 + and started it in the public project. Here is the start line of sah_validate1: + 2005-05-01 13:37:32 [normal ] Starting validator + + +Jeff 02 May 2005 + + - Assimilator changes: + - If there is no canonical result for a WU, return 0. This will cause + the boinc assimilator to mark the WU as assimilated and it will then + have it's file's and it's DB record(s) deleted. No canonical result + means that too many results were returned with no concensus. + - use sql_last_error_code() rather than sql_error_code(), as the latter + always returns 0. + - I a result insert get an informix error -239, return 0. This will cause + the boinc assimilator to mark the WU as assimilated and it will then + have it's file's and it's DB record(s) deleted. A -239 (uniqueness + violation, in this case on sah result field boinc_result) means that + we have already inserted the canonical result for this WU. This + should "never" happen but maybe with aome odd stop/start combo it does. + - If the bad value check detects a bad value in a signal, replace this + bad value with a recognizable marker. This is in addition to flagging + the signal in the rfi_found field. This value replacement is needed + because some bad values cannot be interted into the DB. The marker + value is -91.0. This is an impossible value for ra, decl, time, and freq. + - Max(id) for result in the master science DB before this change went online + was 13364296. + + + assimilator/ + sah_assimilate_handler.cpp + +Charlie 05 May 2005 +Mac: Modify projects and rebuild with OS 10.3.0 compatibility SDK. +Update build instructions. Check in XCode project. + mac_build/ + HowToBuildBOINC_XCode.rtf + seti_boinc.xcode + boinc.pbproj/ + project.pbxproj (add) + +Eric K. 18 May 2005 + - Changed includes of C headers to includes of C++ headers. (i.e. we now + include rather than ) + - Modified malloc_a() to use native aligned allocation routines if + available. + - Removed explicit use of _aligned_malloc on _WIN32 platforms since + malloc_a() will use _aligned_malloc(). + - Defined type sah_complex which is compatible with the FFTW complex + data type. Complex arrays that used to be defined a float arrays are + now of type sah_complex. Code accessing these arrays has been modified + where necessary. + - Added mods to allow the function prototypes in sincos.h to work if these + functions are present, but not in the system header. + - Modified the method by which the chirp table is computed. The goal is + to have the drift be less than 1 bin over the duration of interest + to the analysis. In the case of gaussians that duration is 2 beam + crossings. In the case of pulses it's one beam crossing. In the + case of spikes it's one fft length. This should pick up 1.5 dB in + sensitivity to gaussians, pulses and triplets. We could pick up another + 0.25 dB with another doubling of this duration, but I think we've reached + diminishing returns. + - Replaced repeated allocations of WorkData in the main loop with one + allocation prior to loop entry + - Made main processing loop compatible with FFTW. The configure script + now detects the FFTW library and header files and if both are available + USE_FFTW is defined in "config.h". This define determines which FFT is + used. + + + config.guess + config.sub + ltmain.sh + Makefile + Makefile.incl + configure.ac + client/ + Makefile.am + analyzeFuncs.[cpp,h] + malloc_a.[cpp,h] + fft8g.[cpp,h] + chirpfft.cpp + lcgamm.cpp + analyzePoT.cpp + s_util.[cpp,h] + main.cpp + progress.cpp + pulsefind.cpp + seti.[cpp,h] + analyzeReport.cpp + sincos.h + test_workunits/ + reference_work_unit.sah + +Rom 26 June 2005 + - Update Windows project files to use the FFTW library and optimize for SSE + + client/ + win-config.h + client/win_build/ + seti_boinc.vcproj + +Jeff 26 July 2005 + - Added a sky_map table to the db schema. This will be the primary table used + to control the near time persistency checker. + - Split a while() loop into 2 lines because otherwise gdb would not allow a + break to be set inside the loop (Eric change). + + db/ + schema_master.sql + schema_master.[cpp,h] + sqlifx.ec + +Jeff 09 Sept 2005 + - added a couple of libs to the splitter makefile that the new boinc crypto + code needs. + + splitter/ + Makefile.in + +Jeff 05 Oct 2005 + - Removed old/new hash boolean from call to dir_hier_path(). + + splitter/ + wufiles.cpp + +Jeff 28 Oct 2005 + - Fixed memory leak in the validator. + - Sync with changes in the BOINC SCHED_MSG_LOG definition. + + validate/ + sah_validate.cpp + sah_boinc_db.cpp + + +Jeff 1/9/2006 Jeff + Splitter related changes. + - account for new command_line parm in create_work() - we just pass NULL. + - changed all instances of safe_strncpy() to strlcpy(). + - change the app config file name to sah_enhanced_config.xml. + - added settings ID WU name. + + splitter/ + readtape.cpp + wufiles.cpp + db/ + app_config.cpp + +Jeff 1/11/2006 + - More safe_strncpy -> strlcpy(). + + client/ + timecvt.cpp + +Jeff 1/19/2006 + - added field sb_id to tape, workunit_grp, workunit, and result. These + fields were required for the DB merge. We can drop thme after a while. + + - app config file name back to sah_config.xml. This should be a command line item. + + db/ + app_config.cpp + schema_master.cpp + schema_master.h + schema_master.sql + +Jeff 1/23/2006 + - The assimilator now uses the settings ID that is embedded in the wu/result name + to get to the analysis_config and receiver_config tables. If the settings ID + has not changed from one result to the next (normally true until the enhanced client + gets released) then we do no DB accessing. This replaces the logic whereby + we were reading the wu and wug for each result. + - Both the enhanced and old splitter were previously modified to embed the settings ID + into the wu/result names. + + assimilator/ + sah_assimilate_handler.cpp + +Jeff 1/24/2006 + - Templated signal insertion. There were several other small code changes secondary + to this. + - if (appid == 2) signal.reserved = 1. This is temporary for enhanced rollout plus + DB correction. The correction code needs to know is the signals were returned + by an enhanced app or not. + + This sah2:result.max(id) before this change went on was 1615350419. + + assimilator/ + sah_assimilate_handler.cpp + + +Jeff 2/7/2006 + - Changed the type of q_pix in all 4 signal table schemas from integer to int8. + - The assimilator now inserts signals with "n_pix", a 64 bit integer. It + contains "q_pix" in the high order 32 bits and frequency with a resoltion of 10 Hz + in the low order 32 bits. All floating point numbers are cast (ie floored) to + integers in this processed. + + Note: the max IDs before this change were: + spike 1017689548 + gaussian 116885361 + pulse 173469464 + triplet 125669326 + + -------------------- Testing notes (all tests look good) ------------------ + + Here is a new spike. + + id 1017690489 + result_id 1619052602 + peak_power 24.45193290000 + mean_power 1.000000000000 + time 2453342.626688 + ra 2.944765570000 + decl 26.35156250000 + q_pix 3601673817190043 + freq 1421050038.263 + detection_freq 1421049936.330 + barycentric_freq 1421103637.391 + fft_len 131072 + chirp_rate -1.38084543000 + rfi_checked 0 + rfi_found 0 + reserved 0 + + n_pix q_pix freq + ---------------- ----------- ----------- + 3601673817190043 = 00 0C CB B4 08 78 6E 9B + + + 00 0C CB B4 = 838580.00 + which translates to RA 2.9443359 and Decl 26.3392294 + from DB 2.9447656 26.3515625 + --------- ---------- + 37 arcsec diff 44 arcsec diff + + 08 78 6E 9B = 142110363 + 1421103637.391/10 = 142110363 + --------- + 0 Hz diff + + Here is a new gaussian: + + id 116899622 + result_id 1619068124 + peak_power 1.717239500000 + mean_power 0.458329827 + time 2452982.120403 + ra 14.84703540000 + decl 18.09752270000 + q_pix 38639321233114672 + freq 1419769999.385 + detection_freq 1419770480.211 + barycentric_freq 1419689449.058 + fft_len 16384 + chirp_rate 11.23900990000 + rfi_checked 0 + rfi_found 0 + reserved 0 + sigma 6.227958200000 + chisqr 1.342639920000 + null_chisqr 2.142316580000 + score 0.00 + max_power 4.632330890000 + pot + + n_pix q_pix freq + ----------------- ----------- ----------- + 38639321233114672 = 00 89 46 42 08 76 46 30 + + 00 89 46 42 = 8996418 + which translates to RA 14.8461914 18.0921908 + from DB 14.8470354 18.0975227 + ---------- ---------- + 73 arcsec diff 19 arcsec diff + + 08 76 46 30 = 141968944 + 1419689449.058/10 = 141968944 + --------- + 0 Hz diff + + + Here is a new triplet: + + id 125678570 + result_id 1619068730 + peak_power 10.59097860000 + mean_power 0.00197354145 + time 2453358.223775 + ra 18.05746840000 + decl 20.87687870000 + q_pix 142995601912863989 + freq 1419248962.402 + detection_freq 1419248962.402 + barycentric_freq 1419256216.076 + fft_len 32 + chirp_rate 0.00 + rfi_checked 0 + rfi_found 0 + reserved 0 + period 0.919142425 + + + n_pix q_pix freq + ------------------ ----------- ----------- + 142995601912863989 = 01 fc 05 be 08 75 9c f5 + + 01 FC 05 BE = 33293758 + which translates to RA 18.0571289 Decl 20.8620894 + from DB 18.0574684 20.8768787 + ---------- ---------- + 29 arcsec diff 53 arcsec diff + + 08 75 9C F5 = 141925621 + 1419256216/10 = 141925621 + --------- + 0 Hz diff + + Here is a new pulse: + + id 173470235 + result_id 1619053031 + peak_power 0.919080853 + mean_power 0.00388364005 + time 2453357.914301 + ra 10.59253220000 + decl 18.10714530000 + q_pix 121561945579447491 + freq 1420880737.305 + detection_freq 1420880737.305 + barycentric_freq 1420750751.969 + fft_len 64 + chirp_rate 0.00 + rfi_checked 0 + rfi_found 0 + reserved 0 + period 0.293273598 + snr 7.352646830000 + thresh 7.250113490000 + score 0.00 + len_prof 44 + pot + + n_pix q_pix freq + ------------------ ----------- ----------- + 121561945579447491 = 01 AF DF F2 08 77 E4 C3 + + + 01 AF DF F2 = 28303346.00 + which translates to RA 10.5922852 Decl 18.0921908 + from DB 10.5925322 Decl 18.1071453 + ---------- ---------- + 21 arcsec diff 54 arcsec diff + + + 08 77 E4 C3 = 142075075 + 1420750751.969/10 = 142075075 + --------- + 0 Hz diff + + +2/23/2006 Jeff + - Changed the frequency to fpix conversion from a cast-to-long to + a round function: + inline long round(double x) {return long(floor(x + 0.5f));} + Casts from floating point to integers are always equivalent + to either (int)floor() or (int)ceil(), depending on the rounding + mode of the platform. + + This sah2:result.max(id) before this change went on was 1623225559. + + assimilator/ + sah_assimilate_handler.cpp + + I then thought there was a problem and fell back on this change. + The old assimilator went back on after result id 1623229153. + + I confirmed that there was in fact no problem and the new assimilator + went back on on 2/24/06 after result id 1623492910. + + Testing notes: + + Here is a new spike: + + id 1024551102 + result_id 1623225782 + peak_power 24.31553840000 + mean_power 1.000000000000 + time 2451858.467759 + ra 21.35094640000 + decl 18.07765010000 + q_pix 55794923851997434 + freq 1420622880.906 + detection_freq 1420621698.453 + barycentric_freq 1420741058.565 + fft_len 131072 + chirp_rate -19.5776901000 + rfi_checked 0 + rfi_found 0 + reserved 0 + + n_pix q_pix freq + ------------------ ----------- ----------- + 55794923851997434 00 C6 39 30 08 77 E0 FA + + 00 C6 39 30 = 12990768 + which translates to RA 21.3515625 Decl 18.0725708 + 21.3509464 18.0776501 + ---------- ---------- + 53 arcsec diff 18 arcsec diff + + + + 0877E0FA = 142074106 + round(1420741058.565/10) = 142074106 + --------- + 0 Hz diff + + Here is a new pulse: + + id 176938950 + result_id 1623229140 + peak_power 0.229531646 + mean_power 0.00195498206 + time 2451802.752266 + ra 1.953974720000 + decl 19.68553160000 + q_pix 2934081280477886 + freq 1420283508.301 + detection_freq 1420283508.301 + barycentric_freq 1420192624.394 + fft_len 32 + chirp_rate 0.00 + rfi_checked 0 + rfi_found 0 + reserved 0 + period 0.0233727992 + snr 5.806743140000 + thresh 5.665772440000 + score 0.00 + len_prof 7 + pot + + + n_pix q_pix freq + ------------------ ----------- ----------- + 2934081280477886 00 0A 6C 88 08 77 0A BE + + + 000A6C88 = 683144 + which translates to RA 1.9541016 Decl 19.6889732 + 1.95397472 Decl 19.6855316 + ---------- ---------- + 11 arcsec diff 12 arcsec diff + + + + 08770ABE = 142019262 + round(1420192624.394/10) = 142019262 + --------- + 0 Hz diff + + + Here is a new gaussian: + + id 120516510 + result_id 1623489856 + peak_power 3.313514950000 + mean_power 0.580334067 + time 2451925.666315 + ra 7.090055470000 + decl 8.357689860000 + q_pix 98579528333729636 + freq 1418915066.719 + detection_freq 1418912570.889 + barycentric_freq 1418934757.328 + fft_len 16384 + chirp_rate -35.8465271000 + rfi_checked 0 + rfi_found 0 + reserved 0 + sigma 3.568017480000 + chisqr 1.412076230000 + null_chisqr 2.102728610000 + score 0.00 + max_power 8.865511890000 + pot + + + n_pix q_pix freq + ------------------ ----------- ----------- + 98579528333729636 01 5E 39 8F 08 75 1F 64 + + 015E398F = 22952335 + which translates to RA 7.0898438 Decl 8.3666866 + 7.09005547 Decl 8.35768986 + ---------- ---------- + 18 arcsec diff 32 arcsec diff + + + 08751F64 = 141893476 + round(1418934757.328/10) = 141893476 + --------- + 0 Hz diff + +3/24/06 Jeff + Validator result overflow checking no longer uses an internal buffer. + stderr_out is checked in place. + + validate/ + sah_validate.cpp + +3/30/06 David + Added gutil_text.C to windows project + +5/4/06 Charlie + - Mac: Fix glut.h to be compatible with Mac's OpenGL framework. + - Create combined config.h file for Intel and PowerPC Macs. + - Create shell script to build fftw-3.1.1 library as universal + binary (PowerPC and Intel). + - Update seti_boinc XCode project to build both PowerPC and + Intel versions of SETI@home Enhanced application for Macintosh. + + glut/ + glut.h + mac_build/ + config.h + buildfftw-3.1.1.sh + seti_boinc.xcodeproj/ + project.pbxproj + +5/5/06 Charlie + - Mac: Fix fftw-3.1.1 build script to work on PowerPC as well as + Intel Macs. + + mac_build/ + buildfftw-3.1.1.sh + +5/8/06 Charlie + - Mac: Add icon to SETI@home enhanced. + + client/ + app_icon.h (added) + main.cpp + mac_build/ + seti_boinc.xcodeproj/ + project.pbxproj + +5/9/06 Charlie + - Mac: Fix crash bug on systems 10.3.0 through 10.3.8 due to + undefined sinf, cosf, atanf functions in dynamic linked + library usr/lib/libSystem.B.dylib. The fix is to not #define + HAVE_SINF, HAVE_COSF and HAVE_ATANF in config.h file for + PowerPC builds. + - Update Mac version to 5.13 + + mac_build/ + config.h + +5/15/06 Eric + - Version to 5.15 + - Embedded calls to boinc_worker_timer() in main loop + +6/14/06 Eric + - Version to 5.17 + - Removed calls to boinc_worker_timer() from main loop. + - Added support for transposing the PoT array on large memory machines. + This can improve performance, since caching is better for the transposed + PoT. Initial code by Alex Kan. + - Added several variations of transpose functions. Depending upon the size + and associativity of the machine cache, one may outperform the rest. + - Fixed some boinc compile problems (changes to the boinc_app_mouse_move(), + etc prototypes) + - added files in "client/vector" to the Dev-C++ and VCC projects. + - added high resolution timer class (vector/hires_timer.*) for function + timing. + - added timing code for on the fly function testing and switching. This + currently supporst BaseLineSmooth(), GetPowerSpectrum(), ChirpData(), and + Transpose(). Support for pulse, triplet and Gaussian finding will come + later. Functions can be added to the tests by adding them to the arrays + in analyzeFuncs_vector.cpp. + + client/ + analyzeFuncs.[cpp,h] + analyzePot.[cpp,h] + analyzeReport.[cpp,h] + sah_gfx.cpp + sah_gfx_base.cpp + win-config.h + seti.h + pulsefind.cpp + chirpfft.cpp + s_util.h + vector/ + analyzeFuncs_vector.[cpp,h] + hires_timer.[cpp,h] + analyzeFuncs_altivec.cpp + win_build/ + *.dev + *.vcproj + win_build/ + win_version.h + m4/ + optimizations.m4 + configure.ac + +7/20/06 Charlie + - Mac: Update seti_boinc XCode project for added source files and to link + with universal binary versions of BOINC libraries as built by + current BOINC XCode project (but seti_boinc project still builds + separate PPC and Intel applications.) + + mac_build/ + seti_boinc.xcodeproj/ + project.pbxproj + +8/1/06 Charlie + - Mac: Update seti_boinc XCode project for Altivec support. + + mac_build/ + seti_boinc.xcodeproj/ + project.pbxproj + +8/2/06 Charlie + - Mac: Create a new mac-specific config.h file which #includes either + config-i386.h or config-ppc.h; include instructions for generating + these files. Tthis is much easier than trying to merge them into + one combined file with "#ifdef i386" etc. + - #undef'ed HAVE_ATANF, HAVE_COSF and HAVE_SINF because this generates + much smaller code + - Create a new shell script makeseticonfigs.sh to automatically create + config-i386.h and config-ppc.h. + + mac_build/ + config.h + config-i386.h (new) + config-ppc.h (new) + makeseticonfigs.sh (new) + seti_boinc.xcodeproj/ + project.pbxproj + +8/3/06 Charlie + - Mac: Allow HAVE_ATANF, HAVE_COSF and HAVE_SINF for Intel to match + earlier versions. + + mac_build/ + config.h + +8/28/06 Charlie + - Mac: Incresae stack size by 8MB for Intel Macs only. This seems to + take care of the remaining screensaver graphics crashes. + + client/ + main.cpp + +9/19/06 Charlie + - Mac: Incresae stack size by another 8MB for Intel Macs only for a + total of 24MB. There were still a few occasional crashes with + 16MB stack. Tripling the original stack allocation is consistent + with my observation that memory sizes for most applications on + Intel Macs seem to be about three times that on PowerPC Macs. + + client/ + main.cpp + +1/29/07 Charlie + - Mac: Set Maximum stack size to system limit, for compatibvility with + future versions of core client (rlp.rlim_cur = rlp.rlim_max). The + core client will do this after fork() and before execv(). NOTE: if + the OS has set rlim_max to RLIM_INFINITY, that value is -1. So + adding a fixed amount (like 16MB) to -1 would actually reduce the + limit instead of increasing it. This change avoids that problem. + + client/ + main.cpp + +3/16/07 Jeffc + - some setilib related name changes. No logic change. + + assimilator/ + sah_assimilate_handler.cpp + +4/23/07 jeffc + - Upon recompile of the assimilator for bruno (i686-linux), + it aborted with: + *** stack smashing detected *** + This turned out to be an undersized char array in routine + sql_insert_id(). I increased it from 21 bytes to 256 bytes. + Still not too safe... + + sah:result.max(id) before this change was 1691705161. + + db/ + sqlifx.ec + +5/2/07 jeffc + - Assimilator changes: + - Functions radecl2pix(), pix2radecl(), and eod2stdepoch() were moved + to setilib. + - The code to pack ra, decl, and freq into signal.q_pix was put in setilib + function co_radeclfreq2npix(). + - Lots of little code and build cleanups. + + sah:result.max(id) before this change was 1694234121. + + assimilator/ + Makefile.am + sah_assimilate_handler.cpp + +5/31/07 korpela + - Increased version number to 5.20 !!! THIS IS NOT YET A WORKING BUILD. I + WILL TAG IT WHEN IT WORKS !!! + - Lots of changes by Joe Segur to implement optimized algorithms. + - Current build finds extra triplets. Tracking that down now. + - This might not build on Visual Studio. + + Significant changes are: + +1. Modified Pulse finding. This includes both algorithmic improvements +effective on all systems, and the possibility of using vectorized +folding subroutines on systems with SIMD capability. Files: +pulsefind.cpp, h - primary changes +analyzeReport.cpp, h - minor supporting change +AKfoldSSE.cpp - new + +The algorithmic improvements include: + +- The sums produced in the folding subroutines are not divided by + the fold level, saving a small amount of time. +- The invert_lcgf() caching saves the display threshold value rather + than the report threshold, and also doesn't scale by fold level. + This allows a quick comparison where only for the approximately 1% + of cases where display threshold is reached does report threshold + need to be calculated and checked. +- Calculations of period values are kept in integer form and only + converted to floating point for reporting. +- The memcpy() of Pulse PoT arrays before the initial fold by 3, 4, + or 5 is removed. +- The sequence of folding operations for Pulse PoTs of length 511 + and shorter is cached. This reduces the 3 nested loops to a + single faster loop for most cases where the loop overhead was using + a significant fraction of the time for folding. +- The default folding subroutines are optimized for FPU and coded to + encourage efficient instruction scheduling by the compiler. + +In support of SIMD folding: + +- Outputs of the folding subroutines are written 16 byte aligned so + the next fold can use aligned loads. (This is also more cache-friendly + even when SIMD isn't available). +- Because SIMD routines are not very efficient for the shortest PoT + lengths, particularly those not divisible by 4, the choice of routine + for each length up to 31 is table-driven. (Again, this proved to also + be a help for the default FPU optimized routines). + +Overall, the algorithmic improvements approach a 10% improvement in +total crunch time, SIMD folding another 10%. + +2. Transpose changes and additions: + +- Transpose is only done for chirp/fft pairs for which Gaussian, Pulse, + or Triplet searching will be done. +- Changed testing from 512x2048 to 16Kx64 which is used much more. That + had very little effect on my Pentium-M with 1 MiB L2 cache, more on + my Willamette P4 with 256 KiB L2, and most on my Pentium-MMX with + 256 KiB very slow L2 on the motherboard. +- Added a non-prefetch version of v_vTranspose4. It's faster on my + Willamette P4 system than the original, though slightly slower on + my Pentium-M system. (I also did the same for the GetPowerSpectrum + routines with similar effect.) +- Added another vectorized 4x4 subtranspose which differs mainly in + using non-temporal writes, plus a variety of functions which use + it. One of those always measures fastest on my two systems with SIMD + capability, by a 30% or more margin. + +files: +analyzeFuncs.cpp, h +analyzeFuncs_sse.cpp, h +analyzeFuncs_vector.cpp, h + + +3. Chirping changes and additions: + +- Modified CalcTrigArray() so when going two or more ChirpRateInd steps + it only transits the two 16 MiB arrays once. +- Modified testing so the change from negative to positive chirp goes + two steps up. That provides a better overall speed approximation, + though it's only a rough match to the number of chirp indices which + are skipped in typical WUs. +- Modified testing to start at chirp index 27040 so the error check is + including the difficult angles of over 262144 which make single + float rounding produce fractional input to the SinCos approximation + with only 5 bits of precision. +- After testing, if TrigArray isn't chosen then InitTrigArray() is not + called again. +- Added SSE3, SSE2, and SSE1 versions derived from Alex Kan's sources. +- Added an FPU version patterned after the SIMD versions; quick rounding + and non-branching polynomial SinCos approximation. On my systems it's + quicker than TrigArray and of course it doesn't need the extra 32 MiB + array space. This one isn't yet in a lunatics.at release, but Simon + has built pretest versions so I'll find out soon if it's faster on + AMD systems. + +Note 1: The DevC++ builds do a good job of making main() align per the + default preferred_stack_boundary of 2^4, but not the worker thread. + To work around that so the SIMD chirping wouldn't crash I added a + hack near the beginning of worker() to force the stack pointer to + a multiple of 16 for GNUC builds. The calculations in those SIMD + routines are complex enough that there are register spills to + temporary stack variables, so the kind of aligned alloca() used in + analyzeFuncs_x86_64.cpp isn't adequate, I did try that. I suppose + adding enough additional aligned variables could make that approach + work, but I'm reluctant to modify those well-tested routines more + than strictly necessary. +Note 2: The "const" in float4 constant definitions seems to conflict + with the MinGW intrinsics. I'm not sure why, I thought the C style + cast to (void *) used in the *mmintrin.h files should work, so I + just removed "const" for now. + +files: +x86_float4.cpp, h - modified +analyzeFuncs.cpp, h - modified +analyzeFuncs_vector.cpp, h - modified +analyzeFuncs_sse.cpp - modified +analyzeFuncs_fpu.cpp - new +analyzeFuncs_sse2.cpp - new +analyzeFuncs_sse3.cpp - new + + +4. Miscellaneous: + +- In seti.cpp, h added save to and restore from state file of individual + signal counts, plus relocated the final report of those values there; + it's now called before both the normal exit in analyzeFuncs.cpp and + the overflow exit in worker.cpp. +- In analyzeFuncs.cpp added output of a CUSTOM_STRING (if defined) to + the beginning of stderr, and a restart indication with the progress + in percent. +- In worker.cpp replaced the try/catch for parsing the state file with + a check for existence of that file, same as in my 517STxx builds from + the "Builds for unexplained error test" NC forum thread. +- In analyzeFuncs_vector.cpp, h restructured the tables of functions to + test to a single table for each type, adding a field indicating what + CPU capabilities are required for the function. Also added a routine + to set a variable to the host capabilities; the testing routines + compare those and don't try unsupported routines. + +06/07/2007 Eric K. + - Version to 5.21 + - Fixed crash on non-SSE processors. + - More optimized code merging from Joe Segur + + "In analyzeFuncs.cpp I moved the call to ComputePoTInfo up before the +call to ChooseFunctions() because the folding test uses some of the +PoTInfo values both directly and indirectly. The 3 new arguments in +ChooseFunctions() are needed because the folding test accesses the +ChirpFftPairs array. + + client/ + analyzeFuncs.cpp + pulsefind.h + vector/ + AKfoldSSE.cpp (removed) + analyzeFuncs_sse.cpp + analyzeFuncs_vector.[cpp,h] + x86_float4.h + win_build/ + seti_boinc.dev + +7/20/07 jeffc + Added science table hotpix. + + db/ + schema_master.{sql,cpp,h} + +7/21/07 Charlie + - Mac: Changed files for new vector functions, changed config.h + to sah_config.h, version 5.23, etc. + + mac_build/ + config-i386.h + config-ppc.h + makeseticonfigs.sh + seti_boinc.xcodeproj/ + project.pbxproj + +7/24/07 Charlie + - Mac: Reconfigure XCode project for separate PowerPC and Intel + targets, to allow individual source files to have different + compiler flags for each architecture. + - Mac: Use auto-config to build new config-i386.h, config-ppc.h; add + changes to sah_config.h to override certain items in these files. + -Mac: Update build instructions. + + mac_build/ + config-i386.h + config-ppc.h + sah_config.h + seti_boinc.xcodeproj/ + project.pbxproj + HowToBuildSETI_XCode.rtf + +7/25/07 Charlie + - Mac: More tweaks to XCode project and sah_config.h. + + mac_build/ + sah_config.h + seti_boinc.xcodeproj/ + project.pbxproj + +7/25/07 jeffc + The assimilator now populates a new table - hotpix. Rows consist of + a qpix and the time of assimlation. For each result assimilated + a unique list of qpixes for the signal set is constructed. For each + of these qpixes a new row in hotpix will be inserted, unless there is + already a row for that qpix, in which case the time will be unpdated. + + Max ID for result in beta before this change was 379785. + + assimilator/ + Makefile.am + sah_assimilate_handler.cpp + +7/25/07 jeffc + Placed a uniqueness constraint on hotpix.id via a unique index. + + db/ + schema_master.{sql,h,cpp} + +8/16/07 Charlie + - Mac: Update build instructions to put updating the version number + in the proper section. + - Mac: define USING_XCODE in project settings. + - Mac: Add path to BOINC version.h in header search paths; adjust + analyzeFuncs.cpp to get the library version from version.h instead + of config.h if USING_XCODE. + - Mac: Don't include sah_config.h from command line in XCODE project. + - Mac: tweaks to sah_config.h to correctly get COMPILER_STRING with GCC + version number. + - Mac: Fix compile error in analyzeFuncs_vector.cpp: included header + file contains "#undef isnan". + + client/ + analyzeFuncs.cpp + vector/ + analyzeFuncs_vector.cpp + mac_build/ + sah_config.h + seti_boinc.xcodeproj/ + project.pbxproj + HowToBuildSETI_XCode.rtf + +8/16/07 jeffc + - splitter: repeat read of all config's for each WUG. Not doing this for + the analysis_config lead to gradual lowering of (at least) the triplet + threshold that resulted in WUs that got bogged down in triplet + finding (looking at every PoT bin) and WU overflows (again, triplets). + + splitter/ + mb_splitter.cpp + +Jeff 10 Sep 2007 + - The CVS repository is deprecated this date. We now use SVN. + +Eric K. 6 Dec 07 + - Checked in David's extensive changes for V6 Graphics + +Charlie 7 Dec 07 + - Mac: Update XCode project for V6 graphics (separate graphics application) + - Fix compile error on Mac (memset undefined in this context) + + client/ + gdata.h + mac_build/ + seti_boinc.xcodeproj/ + project.pbxproj + +Eric K. 17 Dec 07 + - Fixed problem with SAH_PACKAGE_STRING assignment. + - Modified seti_boinc.dev for V6 graphics build with DevC++ + - Added seti_graphics.dev for building V6 graphics display app. + + client/ + analyzeFuncs.cpp + sah_gfx.cpp + win-sah_config.h + win_build/ + seti_boinc.dev + seti_graphics.dev + +Charlie 18 Dec 07 + - Mac: Fix bugs in definition of COMPILER_STRING. + - Mac: Put version number definitions in mac_build/sahconfig.h + instead of in 2 places (config-i386.h and config-ppc.h). + - Mac: Change version number to 6.00. + - Mac: Fix bug in XCode project (ppc targets had Run Script phase + after build instead of before.) + + mac_build/ + config-i386.h + config-ppc.h + sah_config.h + seti_boinc.xcodeproj/ + project.pbxproJ + +Eric 20 Dec 2007 + - Added three new methods to the db tables. + bool authorize_delete(bool auth); + bool DELETE(sqlint8_t id); + bool DELETE(std::string where); + Before delete is called, the caller must call (using the same instance) + authorized_delete(true). This must be called prior to each call to + DELETE(). + - Added a xml_encoding_from_string() call to xml_util.h + + db/ + db_table.h + xml_util.h + +Eric 31 Jan 2008 + - Fixed problem with incorrect receiver name in graphics output for multibeam workunits. + - Added copyright notices to files that were missing them. + - Added #include to analyzeFuncs_fpu.cpp + - Changed sqlblob input processing + + client/ + seti.cpp + gdata.h + sah_gfx.cpp + sah_gfx_main.cpp + sah_gfx_main.h + vector/ + analyzeFuncs_fpu.cpp + win_build/ + seti_graphics.dev + seti_boinc_private.rc + db/ + schema_to_class.awk + schema_master.cpp + sqlblob.h + +Eric K Feb 19, 2008 + - First attempt at simplifying autoconf. May break some builds on some + platforms. + - fixed problem with SAH_CHECK_ASMLIB macro + + m4/ + sah_asmlib.m4 + configure.ac + Makefile.incl + Makefile.am + sah_config.h + client/ + sah_gfx.cpp + client/ + Makefile.am + +David 10 June 2008 + - Add mechanism so that main program doesn't update shmem + if no graphics app is running + + client/ + gdata.h + sah_gfx.cpp + sah_gfx_main.cpp,.h + +Rom 11 Aug 2010 + - WIN: Use BOINC defined library project files for Visual Studio. + + client/win_build/ + libboinc.vcproj (deleted) + libboincapi.vcproj (deleted) + libgraphics2.vcproj (deleted) + seti_boinc.sln + +Charlie 17 Aug 11 + - Mac: Clean up XCode project (remove redundant build rules.) + + mac_build/ + seti_boinc.xcodeproj/ + project.pbxproj + +Charlie 21 Sep 12 + - Bump version number in configure.ac to 7.00. + - Mac: Fix path to graphics library, update Mac-specific configure files. + + configure.ac + mac_build/ + config_i386.h + config_ppc.h + seti_boinc.xcodeproj/ + project.pbxproj diff --git a/client/Makefile.Readme b/client/Makefile.Readme new file mode 100644 index 0000000..bf5aba2 --- /dev/null +++ b/client/Makefile.Readme @@ -0,0 +1,27 @@ +This readme will explain the differences between Makefile.in and Makefile.in.graphics, +as well as usage and possible changes to be made to be system compliant. + +To use Makefile.in.graphics just rename it Makefile.in and configure seti_boinc. The +changes between the original Makefile.in and Makefile.in.graphics are: + +CFLAGS: addition of -DBOINC_APP_GRAPHICS +BOINC_INC: addition of -I/usr/openwin/share/include (possibly extraneous) + addition of -I$(BOINCDIR)/boincglut/include + -I../jpeglib +CXX, CC: addition of -g debug option (not vital) +GUIOBJS: addition of all the files prexisting under OBJS, as well as + graphics_api, x_opengl, grahpics_data from ../../boinc/api and sah_gfx_base, sah_gfx, and gdata (all .$(OBJEXT)) +GUILIBS: addition of -lX11, -lXmu, -L$(BOINCDIR)/boincglut/lib/glut -lboincglut + -L../jpeglib -ljpeg + THE FOLLOWING ADDITION IS SYSTEM DEPENDENT: the location of the GL + and GLU libraries on the system (ie /usr/X11R6/lib in Linux, + -L/usr/openwin/lib/ on Solaris) followed by -lGL and -lGLU +all: change PROGS to GUIPROG (possible to have both? I couldn't figure out how) +GUIPROG: addition of main.$(OBJEXT) to dependencies + addition of main.$(OBJEXT), gutil.$(OBJEXT), reduce.$(OBJEXT), + $(LIBS), -lpthread to rule + +The only thing that should need to be changed is the location of the GL libraries +as mentioned, but it's possible that other changes should be made. + +- Noaa Avital \ No newline at end of file diff --git a/client/Makefile.am b/client/Makefile.am new file mode 100644 index 0000000..233b632 --- /dev/null +++ b/client/Makefile.am @@ -0,0 +1,252 @@ +## $Id: Makefile.am,v 1.7.2.21 2007/08/01 00:15:31 korpela Exp $ + +include $(top_srcdir)/Makefile.incl + + +BOINC_LIBS = -lboinc_api -lboinc + +CLIENT_C_FLAGS = $(APP_CFLAGS) $(CFLAGS) \ + $(DEFS) \ + -DTEXT_UI -DNDEBUG -DCLIENT \ + -I$(top_srcdir)/db \ + -I$(top_srcdir)/client \ + -I$(top_srcdir)/client/win_build \ + $(BOINC_CFLAGS) \ + $(PTHREAD_CFLAGS) \ + $(ASMLIB_CFLAGS) +CLIENT_LD_FLAGS = $(PTHREAD_CFLAGS) $(LDFLAGS) $(APP_LDFLAGS) +CLIENT_LD_ADD = $(PTHREAD_LIBS) $(BOINC_LIBS) $(APP_LIBS) + + + +if ENABLE_GUI + CLIENT_BIN = $(CLIENT_PROG) $(CLIENT_NATIVE) $(DEBUG_NATIVE) $(DEBUG_PROG) + GUI_BIN = seti_graphics + GUI_C_FLAGS = $(CLIENT_C_FLAGS) $(GRAPHICS_CFLAGS) + GUI_LD_ADD = $(GRAPHICS_LIBS_RAW) + CLIENT_LD_FLAGS += $(LDSTATIC) + CLIENT_LD_ADD += -L$(BOINCDIR)/api -L$(BOINCDIR)/lib $(BOINC_LIBS) + SAH_GRX_SOURCES = sah_gfx_main.cpp +else +#no graphics + SAH_GRX_SOURCES = + CLIENT_BIN = $(CLIENT_PROG) $(DEBUG_PROG) +endif + +if X86_64 + CLIENT_C_FLAGS+= -march=opteron -mtune=generic -msse2 -DUSE_SSE -DUSE_SSE2 +endif + +all: client-bin + +client-bin: $(CLIENT_BIN) + +$(DEBUG_PROG): seti_boinc + @RM@ -f $(DEBUG_PROG) + @LN@ seti_boinc $(DEBUG_PROG) + +$(CLIENT_PROG): seti_boinc + @CP@ seti_boinc $(CLIENT_PROG) + @STRIP@ $(CLIENT_PROG) + + + +noinst_PROGRAMS = seti_boinc + +if ENABLE_TESTS +noinst_PROGRAMS += hires_timer_test + +hires_timer_test_SOURCES= vector/hires_timer.cpp +hires_timer_test_CXXFLAGS=-DTEST_TIMER $(CXXFLAGS) $(CLIENT_C_FLAGS) +hires_timer_test_LDFLAGS=$(CLIENT_LD_FLAGS) +hires_timer_test_LDADD=$(CLIENT_LD_ADD) +endif + +seti_boinc_SOURCES = \ + main.cpp \ + vector/analyzeFuncs_vector.cpp \ + vector/analyzeFuncs_fpu.cpp \ + vector/analyzeFuncs_sse.cpp \ + vector/analyzeFuncs_sse2.cpp \ + vector/analyzeFuncs_sse3.cpp \ + vector/analyzeFuncs_avx.cpp \ + vector/analyzeFuncs_x86_64.cpp \ + vector/analyzeFuncs_altivec.cpp \ + vector/analyzeFuncs_neon.S \ + vector/analyzeFuncs_vfp.S \ + vector/analyzeFuncs_vfp_aux.cpp \ + vector/x86_float4.cpp \ + vector/hires_timer.cpp \ + analyzeFuncs.cpp \ + analyzeReport.cpp \ + analyzePoT.cpp \ + pulsefind.cpp \ + gaussfit.cpp \ + lcgamm.cpp \ + malloc_a.cpp \ + seti.cpp \ + seti_header.cpp \ + timecvt.cpp \ + s_util.cpp \ + sah_version.cpp \ + worker.cpp \ + chirpfft.cpp \ + spike.cpp \ + autocorr.cpp \ + progress.cpp \ + fft8g.cpp \ + gdata.cpp \ + ../db/schema_master.cpp \ + ../db/sqlrow.cpp \ + ../db/sqlblob.cpp \ + ../db/xml_util.cpp \ + $(SAH_GRX_SOURCES) + +seti_boinc_CFLAGS = $(CLIENT_C_FLAGS) +seti_boinc_CXXFLAGS = $(CLIENT_C_FLAGS) +seti_boinc_LDFLAGS = $(CLIENT_LD_FLAGS) +seti_boinc_LDADD = $(CLIENT_LD_ADD) +seti_boinc_LINK = $(CXX) $(seti_boinc_CXXFLAGS) $(seti_boinc_LDFLAGS) -o $@ + +if I386 +# allow use of sse instructions on i[3456]86 +seti_boinc-analyzeFuncs_sse3.o: vector/analyzeFuncs_sse3.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE -DUSE_SSE2 \ + -DUSE_SSE3 -D__SSE__ -D__SSE2__ -D__SSE3__ \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -msse3 \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +seti_boinc-analyzeFuncs_sse2.o: vector/analyzeFuncs_sse2.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE -DUSE_SSE2 \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -msse2 \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +seti_boinc-analyzeFuncs_sse.o: vector/analyzeFuncs_sse.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -msse \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +seti_boinc-analyzeFuncs_x86_64.o: vector/analyzeFuncs_x86_64.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -mfpmath=sse -msse2 \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +seti_boinc-x86_float4.o: vector/x86_float4.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -msse \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +if AVX +seti_boinc-analyzeFuncs_avx.o: vector/analyzeFuncs_avx.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE -DUSE_SSE2 \ + -DUSE_SSE3 -DUSE_AVX -D__SSE__ -D__SSE2__ -D__SSE3__ \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -mavx \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +seti_boinc-analyzeFuncs_vector.o: vector/analyzeFuncs_vector.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE -DUSE_SSE2 \ + -DUSE_SSE3 -DUSE_3DNOW -DUSE_AVX \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +else +seti_boinc-analyzeFuncs_vector.o: vector/analyzeFuncs_vector.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE -DUSE_SSE2 \ + -DUSE_SSE3 -DUSE_3DNOW \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +endif +endif + +if X86_64 +# allow use of sse instructions on x86_64 +seti_boinc-analyzeFuncs_sse3.o: vector/analyzeFuncs_sse3.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE3 \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -msse3 \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +if AVX +seti_boinc-analyzeFuncs_avx.o: vector/analyzeFuncs_avx.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE3 -DUSE_AVX \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -mavx \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +seti_boinc-analyzeFuncs_vector.o: vector/analyzeFuncs_vector.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE3 -DUSE_3DNOW -DUSE_AVX \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +else +seti_boinc-analyzeFuncs_vector.o: vector/analyzeFuncs_vector.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE3 -DUSE_3DNOW \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +endif +endif + +if PPC +# allow use of altivec instructions on PPC +seti_boinc-analyzeFuncs_altivec.o: vector/analyzeFuncs_altivec.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_ALTIVEC \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -faltivec -mabi=altivec \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +seti_boinc-analyzeFuncs_vector.o: vector/analyzeFuncs_vector.cpp + if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_ALTIVEC \ + -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ + -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +endif + + +if LINUX +# too much optimization on main.cpp breaks the client for some reason +seti_boinc-main.o: main.cpp + if $(CXX) --include ../sah_config.h $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DEFS) -DTEXT_UI -DNDEBUG -DCLIENT $(CLIENT_C_FLAGS) -I$(top_srcdir)/db -I$(top_srcdir) $(BOINC_CFLAGS) $(PTHREAD_CFLAGS) -O2 -Wall -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +endif + + +if ENABLE_GUI +noinst_PROGRAMS += seti_graphics + +seti_graphics_SOURCES = \ + timecvt.cpp \ + sah_gfx.cpp \ + sah_gfx_base.cpp \ + graphics_main.cpp \ + sah_version.cpp + +seti_graphics_CFLAGS = $(GUI_C_FLAGS) +seti_graphics_CXXFLAGS = $(GUI_C_FLAGS) +seti_graphics_LDFLAGS = $(GUI_LD_FLAGS) + + + +seti_graphics_LDADD = $(GUI_LD_ADD) $(BOINC_LIBS) + +$(DEBUG_NATIVE): $(GUI_BUILD) + @RM@ -f $(DEBUG_NATIVE) + @LN@ sah_graphics $(DEBUG_NATIVE) + +$(CLIENT_NATIVE): $(DEBUG_NATIVE) + @RM@ -f $(CLIENT_NATIVE) + @CP@ $(DEBUG_NATIVE) $(CLIENT_NATIVE) + +endif + diff --git a/client/Makefile.in.graphics b/client/Makefile.in.graphics new file mode 100644 index 0000000..c31ead3 --- /dev/null +++ b/client/Makefile.in.graphics @@ -0,0 +1,151 @@ +# $Id: Makefile.in.graphics,v 1.4.2.1 2006/12/14 22:21:43 korpela Exp $ +# +# + +@SET_MAKE@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +LIBEXT = @LIBEXT@ +DLLEXT = @DLLEXT@ +DOTEXEEXT = @DOTEXEEXT@ + + +SUFFIXES = .cpp .c .@OBJEXT@ .@DLLEXT@ .@LIBEXT@ @DOTEXEEXT@ + +VERSION_MAJOR = @MAJOR_VERSION@ +VERSION_MINOR = @MINOR_VERSION@ + +BOINCDIR = @BOINCDIR@ + +CC = @CC@ +CFLAGS = @CFLAGS@ @DEFS@ -DTEXT_UI -DNDEBUG -DCLIENT -DBOINC_APP_GRAPHICS + +CXX = @CXX@ +CXXFLAGS = $(CFLAGS) + +BOINC_INC= -I$(BOINCDIR)/api -I$(BOINCDIR)/lib -I$(BOINCDIR)/image_libs/ -I/usr/openwin/share/include/ -I../jpeglib + +.cpp.@OBJEXT@: + $(CXX) -g $(CXXFLAGS) $(BOINC_INC) -I.. -I../db -c -o $*.@OBJEXT@ $< + +.C.@OBJEXT@: + $(CXX) -g $(CXXFLAGS) $(BOINC_INC) -I.. -I../db -c -o $*.@OBJEXT@ $< + +.c.@OBJEXT@: + $(CC) -g $(CFLAGS) $(BOINC_INC) -I.. -I../db -c -o $*.@OBJEXT@ $< + +LDFLAGS = @LDFLAGS@ + +CLIBS = @LIBS@ + +SUFFIXES = .cpp .@OBJEXT@ +PROG = setiathome-$(VERSION_MAJOR).$(VERSION_MINOR).@host@$(DOTEXEEXT) +GUIPROG = xsetiathome-$(VERSION_MAJOR).$(VERSION_MINOR).@host@$(DOTEXEEXT) +PROGS = $(PROG) setiathome_test$(DOTEXEEXT) + +../aclocal.m4: ../m4/*.m4 + @CAT@ ../m4/*.m4 >../aclocal.m4 + +../configure: ../configure.ac ../aclocal.m4 ../sah_config.h.in + (cd ..; make sah_config.h) + +OBJS = \ + analyzeFuncs.$(OBJEXT) \ + analyzeReport.$(OBJEXT) \ + analyzePoT.$(OBJEXT) \ + pulsefind.$(OBJEXT) \ + gaussfit.$(OBJEXT) \ + lcgamm.$(OBJEXT) \ + malloc_a.$(OBJEXT) \ + seti.$(OBJEXT) \ + seti_header.$(OBJEXT) \ + timecvt.$(OBJEXT) \ + s_util.$(OBJEXT) \ + version.$(OBJEXT) \ + worker.$(OBJEXT) \ + chirpfft.$(OBJEXT) \ + spike.$(OBJEXT) \ + progress.$(OBJEXT) \ + ../db/schema_master_client.$(OBJEXT) \ + ../db/sqlrow_client.$(OBJEXT) \ + ../db/sqlblob.$(OBJEXT) \ + ../db/xml_util.$(OBJEXT) + +BOINC_OBJS = -L$(BOINCDIR)/lib -lboinc + +GUIOBJS = \ + analyzeFuncs.$(OBJEXT) \ + analyzeReport.$(OBJEXT) \ + analyzePoT.$(OBJEXT) \ + pulsefind.$(OBJEXT) \ + gaussfit.$(OBJEXT) \ + lcgamm.$(OBJEXT) \ + malloc_a.$(OBJEXT) \ + seti.$(OBJEXT) \ + seti_header.$(OBJEXT) \ + timecvt.$(OBJEXT) \ + s_util.$(OBJEXT) \ + version.$(OBJEXT) \ + worker.$(OBJEXT) \ + chirpfft.$(OBJEXT) \ + spike.$(OBJEXT) \ + progress.$(OBJEXT) \ + sah_gfx_base.$(OBJEXT) \ + sah_gfx.$(OBJEXT) \ + gdata.$(OBJEXT) \ + ../db/schema_master_client.$(OBJEXT) \ + ../db/sqlrow_client.$(OBJEXT) \ + ../db/sqlblob.$(OBJEXT) \ + ../db/xml_util.$(OBJEXT) + +GUILIBS = -lX11 -lXmu @GRXLIBS@ -L../jpeglib/ -ljpeg -L/usr/X11R6/lib -L/usr/openwin/lib/ -lGL -lGLU -lglut \ + -L../../boinc/api -lboinc_api -lboinc_graphics_api + +LIBS = -L. \ + -looura + +all: Makefile dependencies $(GUIPROG) + +clean: + rm -f *.$(OBJEXT) libooura.$(LIBEXT) $(PROGS) dependencies config.log config.cache + +OOURAOBS = fft8g.$(OBJEXT) + +libooura.$(LIBEXT): $(OOURAOBS) + @AR@ r libooura.$(LIBEXT) $(OOURAOBS) + @RANLIB@ libooura.$(LIBEXT) + +$(PROG): main.$(OBJEXT) libooura.$(LIBEXT) $(OBJS) + $(CXX) main.$(OBJEXT) $(OBJS) $(LIBS) $(CLIBS) -o $(PROG) $(BOINC_OBJS) + strip $(PROG) + +$(GUIPROG): main.$(OBJEXT) $(GUIOBJS) libooura.$(LIBEXT) + $(CXX) main.$(OBJEXT) ../../boinc/api/gutil.$(OBJEXT) ../../boinc/api/reduce.$(OBJEXT) $(GUIOBJS) $(GUILIBS) $(LIBS) $(CLIBS) -lpthread -o $(GUIPROG).debug $(BOINC_OBJS) + cp $(GUIPROG).debug $(GUIPROG) + strip $(GUIPROG) + +# The following is because version.$(OBJEXT) depends on +# VERSION_MAJOR and VERSION_MINOR, defined in the Makefile. +# Is there a cleaner way of doing this? +version.$(OBJEXT): version.cpp ../sah_config.h version.h + +main_test.$(OBJEXT): main.cpp + $(CXX) $(CXXFLAGS) $(BOINC_INC) -I.. -I../db -DTEST_VERSION -c -o main_test.$(OBJEXT) main.cpp + +setiathome_test$(DOTEXEEXT): main_test.$(OBJEXT) $(OBJS) libooura.$(LIBEXT) + $(CXX) main_test.$(OBJEXT) $(OBJS) $(LIBS) $(CLIBS) -o setiathome_test$(DOTEXEEXT) $(BOINC_OBJS) + +../db/sqlrow_client.$(OBJEXT): ../db/sqlrow.cpp ../db/sqlrow.h + (cd ../db; $(MAKE) sqlrow_client.$(OBJEXT)) + +../db/schema_master_client.$(OBJEXT): ../db/schema_master.cpp ../db/db_table.h + (cd ../db; $(MAKE) schema_master_client.$(OBJEXT)) + +../db/schema_master.cpp: ../db/schema_master.sql ../db/schema_to_class.awk + (cd ../db; $(MAKE) schema_master.cpp) + +dependencies: ../sah_config.h *.cpp Makefile + $(CXX) $(CXXFLAGS) -I.. -I/ -I../db $(BOINC_INC) -M *.cpp > dependencies + +include dependencies diff --git a/client/amd64fft8g.cpp b/client/amd64fft8g.cpp new file mode 100644 index 0000000..c2225c0 --- /dev/null +++ b/client/amd64fft8g.cpp @@ -0,0 +1,129 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// AMD optimizations by Evandro Menezes + +#ifdef USE_AMD_OPT_CODE + +#include +#include + +static const int as [4] [4] = {{0, 0, INT_MIN, INT_MIN}, // {-, -, +, +} + {0, 0, 0, INT_MIN}, // {-, +, +, +} + {0, INT_MIN, 0, INT_MIN}, // {-, +, -, +} + {INT_MIN, 0, INT_MIN, 0}}; // {+, -, +, -} +static const __m128 mmpp = *(__m128 *) (as [0] + 0), + mppp = *(__m128 *) (as [1] + 0), + mpmp = *(__m128 *) (as [2] + 0), + pmpm = *(__m128 *) (as [3] + 0); + +void cftfsub(int n, float *a, float *w) +{ + void cft1st(int n, float *a, float *w); + void cftmdl(int n, int l, float *a, float *w); + int j, j1, j2, j3, l; + __m128 x10, x32, y10, y32, zz; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("cftfsub()"); +#endif + + zz = _mm_setzero_ps (); + + l = 2; + if (n >= 16) { + cft1st(n, a, w); + l = 16; + while ((l << 3) <= n) { + cftmdl(n, l, a, w); + l <<= 3; + } + } + if ((l << 1) < n) { + for (j = 0; j < l; j += 2) { + j1 = j + l; + j2 = j1 + l; + j3 = j2 + l; + // x0r = a[j] + a[j1]; + // x0i = a[j + 1] + a[j1 + 1]; + x10 = _mm_loadl_pi (zz, (__m64 *) (a + j)); + y10 = _mm_loadl_pi (zz, (__m64 *) (a + j1)); + // x1r = a[j] - a[j1]; + // x1i = a[j + 1] - a[j1 + 1]; + x10 = _mm_movelh_ps (x10, x10); + y10 = _mm_movelh_ps (y10, y10); + y10 = _mm_xor_ps (mmpp, y10); + x10 = _mm_add_ps (x10, y10); + // x2r = a[j2] + a[j3]; + // x2i = a[j2 + 1] + a[j3 + 1]; + x32 = _mm_loadl_pi (zz, (__m64 *) (a + j2)); + y32 = _mm_loadl_pi (zz, (__m64 *) (a + j3)); + // x3r = a[j2] - a[j3]; + // x3i = a[j2 + 1] - a[j3 + 1]; + x32 = _mm_movelh_ps (x32, x32); + y32 = _mm_movelh_ps (y32, y32); + y32 = _mm_xor_ps (mmpp, y32); + x32 = _mm_add_ps (x32, y32); + + // a[j] = x0r + x2r; + // a[j + 1] = x0i + x2i; + // a[j1] = x1r - x3i; + // a[j1 + 1] = x1i + x3r; + x32 = _mm_xor_ps (mppp, x32); + x32 = _mm_shuffle_ps (x32, x32, _MM_SHUFFLE (2, 3, 1, 0)); + y10 = _mm_add_ps (x10, x32); + _mm_storel_pi ((__m64 *) (a + j), y10); + _mm_storeh_pi ((__m64 *) (a + j1), y10); + // a[j2] = x0r - x2r; + // a[j2 + 1] = x0i - x2i; + // a[j3] = x1r + x3i; + // a[j3 + 1] = x1i - x3r; + y32 = _mm_sub_ps (x10, x32); + _mm_storel_pi ((__m64 *) (a + j2), y32); + _mm_storeh_pi ((__m64 *) (a + j3), y32); + } + } else if ((l << 1) == n) { + for (j = 0; j < l; j += 2) { + j1 = j + l; + // x0r = a[j] - a[j1]; + // x0i = a[j + 1] - a[j1 + 1]; + x10 = _mm_loadl_pi (zz, (__m64 *) (a + j)); + x32 = _mm_loadl_pi (zz, (__m64 *) (a + j1)); + y10 = _mm_sub_ps (x10, x32); + // a[j] += a[j1]; + // a[j + 1] += a[j1 + 1]; + y32 = _mm_add_ps (x10, x32); + _mm_storel_pi ((__m64 *) (a + j), y32); + // a[j1] = x0r; + // a[j1 + 1] = x0i; + _mm_storel_pi ((__m64 *) (a + j1), y10); + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} +#endif // USE_AMD_OPT_CODE diff --git a/client/analyze.h b/client/analyze.h new file mode 100644 index 0000000..8b164e4 --- /dev/null +++ b/client/analyze.h @@ -0,0 +1,70 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// This file contains compile time configuration parameters +// for the seti@home reference algorithm implementation. + +#ifndef _ANALYZE_ +#define _ANALYZE_ + +#define ISODD(a) (a)%2 != 0 ? true : false +#define IROUND(a) ( (int) ((a) + 0.5f) ) +#define LROUND(a) ( (long) ((a) + 0.5f) ) +#define SQUARE(a) ((a) * (a)) +typedef unsigned char BOOLEAN; + +#define SPIKE_SCORE_HIGH 40 // a high number (extremely unlikely in noise) +#define AUTOCORR_SCORE_HIGH 40 // a high number (extremely unlikely in noise) + +#define USE_PULSE +#define USE_TRIPLET + +extern int t_offset_start; +extern int t_offset_stop; +extern float SlewRate; + +extern float gauss_sigma; +extern float gauss_sigma_sq; + +#define NEG_LN_ONE_HALF 0.693 +#define EXP(a,b,c) exp(-(NEG_LN_ONE_HALF * SQUARE((float)(a) - (float)(b))) / (float)(c)) + +#endif + +// ========================================================================== + +// General Notes + +// Concerning the gaussian function macro EXP: +// The EXP macro defined here is used to generate the gaussian function +// f(x) = exp(-(C * x^2 / sigma^2)) in both fakedata and gaussfit. Sigma +// is in arbitrary units and simply gives the width of the gaussian. We +// give it a particular meaning by properly setting the value of the +// constant C. The meaning we give sigma here is that 2sigma is the +// half power beamwidth of the telescope. We solve for C when x = sigma +// and f(x) = 1/2. Thus we have f(x) = exp(-C). Taking the natural log +// of both sides gives us ln(1/2) = -C. And so C = -ln(1/2) = 0.693. diff --git a/client/analyzeFuncs.cpp b/client/analyzeFuncs.cpp new file mode 100644 index 0000000..16de55d --- /dev/null +++ b/client/analyzeFuncs.cpp @@ -0,0 +1,1556 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// analyzeFuncs.C +// $Id: analyzeFuncs.cpp,v 1.34.2.44 2007/08/16 10:13:55 charlief Exp $ +// + +#define DO_SMOOTH + +#if defined(USING_XCODE) || defined(_WIN32) +#include "version.h" +const char *BOINC_PACKAGE_STRING="libboinc: " BOINC_VERSION_STRING; +#else +#include "config.h" +const char *BOINC_PACKAGE_STRING="libboinc: " PACKAGE_STRING; +#endif + +#undef PACKAGE_STRING +#undef PACKAGE +#undef PACKAGE_NAME +#undef PACKAGE_BUGREPORT +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef VERSION + +#include "sah_config.h" +const char *SAH_PACKAGE_STRING=CUSTOM_STRING; + +#include +#include +#include +#include +#include +#ifdef HAVE_MEMORY_H +#include +#endif +#ifdef HAVE_MMAN_H +#include +#endif +#ifdef HAVE_SYS_MMAN_H +#include +#endif +#ifdef HAVE_MMAP_H +#include +#endif +#include + +#include "sincos.h" +#include "util.h" +#include "s_util.h" +#include "boinc_api.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif +#include "diagnostics.h" +#include "vector/sighandler.h" +#ifdef __arm__ +#include "vector/fp_arm.h" +#endif + +// In order to use IPP, set -DUSE_IPP and one of -DUSE_SSE3, -DUSE_SSE2, +// -DUSE_SSE or nothing(generic), IPP precedes FFTW, ooura // TMR +#if defined(USE_IPP) +#pragma message ("-----IPP-----") +#if defined(USE_SSE3) +#define T7 1 +#pragma message ("-----sse3-----") +#include +#elif defined(USE_SSE2) +#define W7 1 +#pragma message ("-----sse2-----") +#include +#elif defined(USE_SSE) +#define A6 1 +#pragma message ("-----sse-----") +#include +#else +#pragma message ("-----mmx-----") +#include +#endif // T7 +#include +#elif defined(USE_FFTWF) +#pragma message ("----FFTW----") +#include +#else +#pragma message ("----ooura----") +#include "fft8g.h" +#endif // USE_IPP + + +#include "seti.h" +#include "analyze.h" +#include "analyzeReport.h" +#include "gaussfit.h" +#include "spike.h" +#include "autocorr.h" +#include "malloc_a.h" +#include "analyzeFuncs.h" +#include "analyzePoT.h" +#include "chirpfft.h" +#include "worker.h" +#include "filesys.h" +#include "progress.h" + +BaseLineSmooth_func BaseLineSmooth=v_BaseLineSmooth; +GetPowerSpectrum_func GetPowerSpectrum=v_GetPowerSpectrum; +ChirpData_func ChirpData=v_ChirpData; +Transpose_func Transpose=v_Transpose4; + +#ifdef USE_IPP +static int MaxBufSize = 0; +static Ipp8u* FftBuf = NULL; +#endif // USE_IPP + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#define INVALID_CHIRP 2e+20 + +ChirpFftPair_t* ChirpFftPairs = NULL; + +double ProgressUnitSize; +double progress=0, remaining=1; + +// These are used to calculate chirped signals +// TrigStep contains trigonometric functions for MinChirpStep over time +// CurrentTrig contains current trigonometric fuctions +// Tetsuji "Maverick" Rai + +// Trigonometric arrays +SinCosArray* TrigStep = NULL; // trigonometric array of MinChirpStep +SinCosArray* CurrentTrig = NULL; // current chirprate trigonometric array +int CurrentChirpRateInd; // current chirprate index (absolute value) +double MinChirpStep=0.0; +bool use_transposed_pot; + +void InitTrigArray(int, double, int, double); +void FreeTrigArray(void); +void CalcTrigArray (int len, int ChirpRateInd); + +// The main analysis function. Args: +// state pointer to data, # of points, starting chirp/fftlen +// Must be called with unchirped data; +// this function modifies (chirps) the data in place +// swi parsed WU header + +//#define DEBUG +#ifdef DEBUG +int icfft; // for debug +#endif + +#ifdef USE_FFTWF + fftwf_plan transpose_plans[MAX_NUM_FFTS]; +#endif + +int seti_analyze (ANALYSIS_STATE& state) { + sah_complex* DataIn = state.savedWUData; + int NumDataPoints = state.npoints; + sah_complex* ChirpedData = NULL; + sah_complex* WorkData = NULL; + float* PowerSpectrum = NULL; + float* tPowerSpectrum; // Transposed power spectra if used. + float* AutoCorrelation = NULL; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("seti_analyze()"); +#endif + + use_transposed_pot= (!notranspose_flag) && + ((app_init_data.host_info.m_nbytes != 0) && + (app_init_data.host_info.m_nbytes >= MIN_TRANSPOSE_MEMORY)); + + int num_cfft = 0; + float chirprate; + int last_chirp_ind = - 1 << 20, chirprateind; + + double progress_diff, progress_in_cfft, cputime0=0; + int retval=0; + + if (swi.analysis_cfg.credit_rate != 0) LOAD_STORE_ADJUSTMENT=swi.analysis_cfg.credit_rate; + +#ifndef DEBUG + int icfft; +#endif + int NumFfts, ifft, fftlen; + int CurrentSub; + int FftNum, need_transpose; + unsigned long bitfield=swi.analysis_cfg.analysis_fft_lengths; + unsigned long FftLen; + unsigned long ac_fft_len=swi.analysis_cfg.autocorr_fftlen; + +#ifdef USE_IPP + IppsFFTSpec_C_32fc* FftSpec[MAX_NUM_FFTS]; + int BufSize; + + ippStaticInit(); // initialization of IPP library +#elif defined(USE_FFTWF) + // plan space for fftw + fftwf_plan analysis_plans[MAX_NUM_FFTS]; + fftwf_plan autocorr_plan; +#else + // fields need by the ooura fft logic + int * BitRevTab[MAX_NUM_FFTS]; + float * CoeffTab[MAX_NUM_FFTS]; +#endif + + // Allocate data array and work area arrays. + ChirpedData = state.data; + PowerSpectrum = (float*) calloc_a(NumDataPoints, sizeof(float), MEM_ALIGN); + if (PowerSpectrum == NULL) SETIERROR(MALLOC_FAILED, "PowerSpectrum == NULL"); + if (use_transposed_pot) { + tPowerSpectrum = (float*) calloc_a(NumDataPoints, sizeof(float), MEM_ALIGN); + if (tPowerSpectrum == NULL) SETIERROR(MALLOC_FAILED, "tPowerSpectrum == NULL"); + } else { + tPowerSpectrum=PowerSpectrum; + } + AutoCorrelation = (float*)calloc_a(ac_fft_len, sizeof(float), MEM_ALIGN); + if (AutoCorrelation == NULL) SETIERROR(MALLOC_FAILED, "AutoCorrelation == NULL"); + + // boinc_worker_timer(); + FftNum=0; + FftLen=1; + + + +#ifdef USE_FFTWF + double sz; + FILE *wisdom; + std::string wisdom_path("wisdom.sah"); + double wisdom_size=0; + + if ((file_size(wisdom_path.c_str(),wisdom_size)==0) && (wisdom_size>512)) { + if ((wisdom=boinc_fopen(wisdom_path.c_str(),"r"))) { +#ifdef HAVE_MUNMAP + char *wiz=(char *)mmap(NULL,wisdom_size,PROT_READ,MAP_PRIVATE,fileno(wisdom),0); +#else + char *wiz=(char *)calloc_a(wisdom_size+1,1,MEM_ALIGN); + int n=0; + while (wiz && nstatus, "Generating FFT Coefficients"); +#endif + while (bitfield != 0) { + if (bitfield & 1) { + swi.analysis_fft_lengths[FftNum]=FftLen; +#ifdef USE_IPP + int order = 0; + for (int tmp = FftLen; !(tmp & 1); order++) tmp >>= 1; + IPP_FFT_NODIV_BY_ANY, ippAlgHintFast)) { + SETIERROR (MALLOC_FAILED, "ippsFFTInitAlloc failed"); + } +#elif !defined(USE_FFTWF) + // See docs in fft8g.C for sizing guidelines for BitRevTab and CoeffTab. + BitRevTab[FftNum] = (int*) calloc_a(3+(int)sqrt((float)swi.analysis_fft_lengths[FftNum]), sizeof(int), MEM_ALIGN); + if (BitRevTab[FftNum] == NULL) SETIERROR(MALLOC_FAILED, "BitRevTab[FftNum] == NULL"); + BitRevTab[FftNum][0] = 0; +#else + + + WorkData = (sah_complex *)malloc_a(swi.nsamples * sizeof(float),MEM_ALIGN); + sah_complex *scratch=(sah_complex *)malloc_a(swi.nsamples*sizeof(float),MEM_ALIGN); + if ((WorkData == NULL) || (scratch==NULL)) { + SETIERROR(MALLOC_FAILED, "WorkData == NULL || scratch == NULL"); + } + + // TODO: Deallocate these at the end of the function +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fftwf_plan_dft_1d()"); +#endif + analysis_plans[FftNum] = fftwf_plan_dft_1d(FftLen, scratch, WorkData, FFTW_BACKWARD, FFTW_MEASURE_OR_ESTIMATE|FFTW_PRESERVE_INPUT); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (use_transposed_pot) { + fftwf_iodim dims[2]; + dims[0].n = swi.nsamples/FftLen; + dims[0].is = FftLen; + dims[0].os = 1; + dims[1].n = FftLen; + dims[1].is = 1; + dims[1].os = swi.nsamples/FftLen; + transpose_plans[FftNum] = fftwf_plan_guru_r2r(0, NULL, 2, dims, (float *)WorkData, (float *)scratch, NULL, FFTW_MEASURE_OR_ESTIMATE); + } + FftNum++; + free_a(scratch); + free_a(WorkData); +#endif /* USE_FFTWF */ + + } + FftLen*=2; + bitfield>>=1; + } + +#ifdef USE_FFTWF + { + float *out= (float *)malloc_a(ac_fft_len*sizeof(float),MEM_ALIGN); + float *scratch=(float *)malloc_a(ac_fft_len*sizeof(float),MEM_ALIGN); + if ((WorkData == NULL) || (scratch==NULL)) { + SETIERROR(MALLOC_FAILED, "WorkData == NULL || scratch == NULL"); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fftwf_plan_r2r_1d()"); +#endif + autocorr_plan=fftwf_plan_r2r_1d(ac_fft_len, scratch, out, FFTW_REDFT10, FFTW_MEASURE_OR_ESTIMATE|FFTW_PRESERVE_INPUT); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + free_a(scratch); + free_a(out); + } + + wisdom=boinc_fopen(wisdom_path.c_str(),"w"); + if (wisdom) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fftwf_export_wisdom_to_string()"); +#endif + char *wiz=fftwf_export_wisdom_to_string(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (wiz) { + fwrite(wiz,strlen(wiz),1,wisdom); + } + fclose(wisdom); + } +#endif /* USE_FFTWF */ + + if (!state.icfft) { +#ifdef CUSTOM_STRING + fprintf(stderr,"%s\n", CUSTOM_STRING); +#else + fprintf(stderr,"%s\n", SAH_PACKAGE_STRING); +#endif +#ifdef AVX_EMU + fprintf(stderr,"Emulating AVX\n"); +#endif + fprintf(stderr,"%s\n\n", BOINC_PACKAGE_STRING); + fprintf(stderr,"Work Unit Info:\n"); + fprintf(stderr,"...............\n"); + fprintf(stderr,"WU true angle range is : %f\n", swi.angle_range); + } else fprintf(stderr,"Restarted at %.2f percent.\n", progress*100); + fflush(stderr); + + swi.num_fft_lengths=FftNum; + // gernerate table of chirp/fft pairs (we may read table from file if testing) + if (cfft_file != NULL) + num_cfft = ReadCFftFile(&ChirpFftPairs, &MinChirpStep); + else + num_cfft = GenChirpFftPairs(&ChirpFftPairs, &MinChirpStep); + if (num_cfft == MALLOC_FAILED) { + SETIERROR(MALLOC_FAILED, "num_cfft == MALLOC_FAILED"); + } + + // Get together various values that we'll need to analyse power over time + ComputePoTInfo(num_cfft, NumDataPoints); + + // Initialize TrigArrays for testing if we have the memory.... + // If we can't tell how much memory we have, assume we have plenty. + if ((app_init_data.host_info.m_nbytes == 0) || + (app_init_data.host_info.m_nbytes >= MIN_TRIGARRAY_MEMORY)) { + InitTrigArray (NumDataPoints, MinChirpStep, + TESTCHIRPIND, + swi.subband_sample_rate); + } + + boinc_install_signal_handlers(); +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) strcpy(sah_graphics->status, "Choosing optimal functions"); +#endif + // Choose the best analysis functions. + ChooseFunctions(&BaseLineSmooth, + &GetPowerSpectrum, + &ChirpData, + &Transpose, + ChirpFftPairs, + num_cfft, + swi.nsamples, + state.icfft == 0); + + if ((app_init_data.host_info.m_nbytes == 0) || + (app_init_data.host_info.m_nbytes >= MIN_TRIGARRAY_MEMORY)) { + FreeTrigArray(); + // If we're using TrigArrays, reallocate & reinit + if ((ChirpData == v_ChirpData) || (ChirpData == fpu_opt_ChirpData)) { + InitTrigArray (NumDataPoints, MinChirpStep, + ChirpFftPairs[state.icfft].ChirpRateInd, + swi.subband_sample_rate); + } + } + +#ifdef USE_IPP + if (MaxBufSize) { + FftBuf = (Ipp8u*) malloc_a (MaxBufSize, MEM_ALIGN); + if (FftBuf == NULL) SETIERROR (MALLOC_FAILED, "FftBuf == NULL"); + } +#elif !defined(USE_FFTWF) + for (FftNum = 0; FftNum < swi.num_fft_lengths; FftNum++) { + CoeffTab[FftNum] = (float*) calloc_a(swi.analysis_fft_lengths[FftNum]/2, sizeof(float), MEM_ALIGN); + if (CoeffTab[FftNum] == NULL) SETIERROR(MALLOC_FAILED, "CoeffTab[FftNum] == NULL"); + } +#endif + + // Allocate WorkData array the size of the biggest FFT we'll do + // TODO: Deallocate this at the end of the function + WorkData = (sah_complex *)malloc_a(FftLen/2 * sizeof(sah_complex),MEM_ALIGN); + if (WorkData == NULL) { + SETIERROR(MALLOC_FAILED, "WorkData == NULL"); + } + + // Smooth Baseline + +#ifdef DO_SMOOTH +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) strcpy(sah_graphics->status, "Doing Baseline Smoothing"); +#endif + retval = BaseLineSmooth( + DataIn, NumDataPoints, swi.analysis_cfg.bsmooth_boxcar_length, + swi.analysis_cfg.bsmooth_chunk_size + ); + if (retval) SETIERROR(retval,"from BaseLineSmooth"); +#endif + + + // used to calculate percent done + //ProgressUnitSize = GetProgressUnitSize(NumDataPoints, num_cfft, swi); + ProgressUnitSize = GetProgressUnitSize(NumDataPoints, num_cfft, ac_fft_len); + //#define DUMP_CHIRP +#ifdef DUMP_CHIRP + // dump chirp/fft pairs and exit. + fprintf(stderr, "size = %d MinChirpStep = %f\n", num_cfft, MinChirpStep); + for (icfft = 0; icfft < num_cfft; icfft++) { + fprintf(stderr,"%6d %15.11f %6d %6d %d %d\n", + icfft, + ChirpFftPairs[icfft].ChirpRate, + ChirpFftPairs[icfft].ChirpRateInd, + ChirpFftPairs[icfft].FftLen, + ChirpFftPairs[icfft].GaussFit, + ChirpFftPairs[icfft].PulseFind + ); + } + fflush(stderr); + exit(0); +#endif + + + boinc_wu_cpu_time(cputime0); + reset_units(); + double chirp_units=0; + + // Loop through chirp/fft pairs - this is the top level analysis loop. + double last_ptime=0; + int rollovers=0; + double clock_max=0; + for (icfft = state.icfft; icfft < num_cfft; icfft++) { + fftlen = ChirpFftPairs[icfft].FftLen; + chirprate = ChirpFftPairs[icfft].ChirpRate; + chirprateind = ChirpFftPairs[icfft].ChirpRateInd; + // boinc_worker_timer(); +#ifdef DEBUG + double ptime=static_cast((unsigned)clock())/CLOCKS_PER_SEC+ + clock_max*rollovers; + clock_max=std::max(last_ptime-ptime,clock_max); + if (ptime((unsigned)clock())/CLOCKS_PER_SEC+ + clock_max*rollovers; + } + last_ptime=ptime; + + fprintf(stderr,"%f %f %f %f %f %f %f %f %f\n", + ptime, + progress, + ((double)icfft)/num_cfft, + analysis_state.FLOP_counter, + triplet_units, + pulse_units, + spike_units, + gauss_units, + chirp_units + ); + fflush(stderr); + + double cputime=0; + boinc_wu_cpu_time(cputime); + cputime-=cputime0; +#endif + + remaining=1.0-(double)icfft/num_cfft; + + if (chirprateind != last_chirp_ind) { +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) strcpy(sah_graphics->status, "Chirping data"); +#endif + + retval = ChirpData( + DataIn, + ChirpedData, + chirprateind, + chirprate, + NumDataPoints, + swi.subband_sample_rate + ); + + if (retval) SETIERROR(retval, "from ChirpData()"); + + progress += (double)(ProgressUnitSize * ChirpProgressUnits()); + chirp_units+=(double)(ProgressUnitSize * ChirpProgressUnits()); + progress = std::min(progress,1.0); + } + + // last_chirp = chirprate; + last_chirp_ind = chirprateind; + + // Process this FFT length. + // For a given FFT length (at a given chirp), we construct + // PowerSpectrum[] which is a "waterfall" array of power spectra, + // each fftlen long on the frequency axis and sample time long + // on the time axis. + // As we go along, we check each spectra for spikes. + + state.icfft = icfft; // update analysis state + + // Find index into FFT length table for the current + // FFT length. This will be the same index needed + // for ooura's coeffecient and bit reverse tables. + for (FftNum = 0; FftNum < swi.num_fft_lengths; FftNum++) { + if (swi.analysis_fft_lengths[FftNum] == fftlen) { + break; + } + } + +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) { + sah_graphics->fft_info.chirp_rate = chirprate; + sah_graphics->fft_info.fft_len = fftlen; + strcpy(sah_graphics->status, "Computing Fast Fourier Transform"); + } +#endif + + // If PoT freq bin is non-negative, we are into PoT analysis + // for this cfft pair and should not re-output an "ogh" line. + if (state.PoT_freq_bin == -1) { + retval = result_group_start(); + if (retval) SETIERROR(retval,"from result_group_start"); + } + + // Number of FFTs for this length + NumFfts = NumDataPoints / fftlen; + +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) { + rarray.init_data(fftlen, NumFfts); + } +#endif + for (ifft = 0; ifft < NumFfts; ifft++) { + // boinc_worker_timer(); + CurrentSub = fftlen * ifft; +#if !defined(USE_FFTWF) && !defined(USE_IPP) + // FFTW and IPP now use out of place transforms. + memcpy( + WorkData, + &ChirpedData[CurrentSub], + (int)(fftlen * sizeof(sah_complex)) + ); +#endif + + state.FLOP_counter+=5*(double)fftlen*log((double)fftlen)/log(2.0); +#ifdef USE_IPP + ippsFFTInv_CToC_32fc((Ipp32fc*)ChirpedData[CurrentSub], + (Ipp32fc*)WorkData, + FftSpec[FftNum], FftBuf); +#elif defined(USE_FFTWF) +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fftwf_execute_dft()"); +#endif + fftwf_execute_dft(analysis_plans[FftNum], &ChirpedData[CurrentSub], WorkData); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +#else /* !USE_FFTWF */ + // replace time with freq - ooura FFT + cdft(fftlen*2, 1, WorkData, BitRevTab[FftNum], CoeffTab[FftNum]); +#endif /* USE_FFTWF */ + + // replace freq with power + state.FLOP_counter+=(double)fftlen; + GetPowerSpectrum( WorkData, + &PowerSpectrum[CurrentSub], + fftlen + ); + + if (fftlen==(long)ac_fft_len) { + state.FLOP_counter+=((double)fftlen)*5*log((double)fftlen)/log(2.0)+2*fftlen; +#if defined(USE_FFTWF) +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fftwf_execute_r2r()"); +#endif + fftwf_execute_r2r(autocorr_plan,&PowerSpectrum[CurrentSub],AutoCorrelation); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +#else +#error Analysis needs to be modified for your FFT choice. +#endif + } + + // any ETIs ?! + // If PoT freq bin is non-negative, we are into PoT analysis + // for this cfft pair and need not redo spike and autocorr finding. + if (state.PoT_freq_bin == -1) { + //JWS: Don't look for Spikes at too short FFT lengths. + if (fftlen >= PoTInfo.SpikeMin) { + state.FLOP_counter+=(double)fftlen; + retval = FindSpikes( + &PowerSpectrum[CurrentSub], + fftlen, + ifft, + swi + ); + if (retval) SETIERROR(retval,"from FindSpikes"); + } + + if (fftlen==ac_fft_len) { + retval = FindAutoCorrelation( + AutoCorrelation, + fftlen, + ifft, + swi + ); + if (retval) SETIERROR(retval,"from FindAutoCorrelation"); + progress += 2.0*SpikeProgressUnits(fftlen)*ProgressUnitSize/NumFfts; + } else { + progress += SpikeProgressUnits(fftlen)*ProgressUnitSize/NumFfts; + } + } + + //progress = ((float)icfft)/num_cfft + ((float)ifft)/(NumFfts*num_cfft); + progress = std::min(progress,1.0); +#ifdef BOINC_APP_GRAPHICS + if (!nographics()) { + rarray.add_source_row(PowerSpectrum+fftlen*ifft); + sah_graphics->local_progress = (((float)ifft+1)/NumFfts); + } +#endif + remaining=1.0-(double)(icfft+1)/num_cfft; + fraction_done(progress,remaining); + // jeffc + //fprintf(stderr, "S fft len %d progress = %12.10f\n", fftlen, progress); + } // loop through chirped data array + +#ifdef BOINC_APP_GRAPHICS + if (!nographics()) { + memcpy(&sah_shmem->rarray_data, &rarray, sizeof(REDUCED_ARRAY_DATA)); + } +#endif + fraction_done(progress,remaining); + // jeffc + //fprintf(stderr, "Sdone fft len %d progress = %12.10f\n", fftlen, progress); + + // transpose PoT matrix to make memory accesses nicer + need_transpose = ChirpFftPairs[icfft].GaussFit || ChirpFftPairs[icfft].PulseFind; + if ( !need_transpose ) { + int tmpPulsePoTLen, tmpOverlap; + GetPulsePoTLen( NumFfts, &tmpPulsePoTLen, &tmpOverlap ); + if ( ! ( tmpPulsePoTLen > PoTInfo.TripletMax || tmpPulsePoTLen < PoTInfo.TripletMin ) ) + need_transpose = true; + } + + if (need_transpose && use_transposed_pot) { + Transpose(fftlen, NumFfts, (float *) PowerSpectrum, (float *)tPowerSpectrum); + } + // + // Analyze Power over Time. May return quickly if this FFT + // length and/or this WUs slew rate places the data block + // outside PoT analysis limits. + // Counting flops is done inside analyze_pot + retval = analyze_pot(tPowerSpectrum, NumDataPoints, ChirpFftPairs[icfft]); + if (retval) SETIERROR(retval,"from analyze_pot"); + +#ifdef BOINC_APP_GRAPHICS + // switch the display back to "best of" signals + // + if (!nographics()) { + sah_graphics->gi.copy(best_gauss, true); + sah_graphics->pi.copy(best_pulse, true); + sah_graphics->ti.copy(best_triplet, true); + } +#endif + // Force progress to 100% before calling result_group_end() to store + // 100% in state file so it will survive exit & relaunch + if (icfft == (num_cfft-1)) { + progress = 1; + remaining = 0; + fraction_done(progress,remaining); + } + retval = checkpoint(); + if (retval) SETIERROR(retval,"from checkpoint() in seti_analyse()"); + + } // loop over chirp/fftlen paris + + // Return the "best of" signals. This may include duplicates of + // already reported interesting signals. + if (best_spike->s.fft_len) { + retval = outfile.printf("%s", best_spike->s.print_xml(0,0,1,"best_spike").c_str()); + if (retval < 0) { + SETIERROR(WRITE_FAILED,"from outfile.printf (best spike) in seti_analyze()"); + } + } + + if (best_autocorr->a.fft_len) { + retval = outfile.printf("%s", best_autocorr->a.print_xml(0,0,1,"best_autocorr").c_str()); + if (retval < 0) { + SETIERROR(WRITE_FAILED,"from outfile.printf (best autocorr) in seti_analyze()"); + } + } + + if (best_gauss->g.fft_len || best_gauss->score) { + retval = outfile.printf("%s", best_gauss->g.print_xml(0,0,1,"best_gaussian").c_str()); + if (retval < 0) { + SETIERROR(WRITE_FAILED,"from outfile.printf (best gaussian) in seti_analyze()"); + } + } + if (best_pulse->p.fft_len) { + retval = outfile.printf("%s", best_pulse->p.print_xml(0,0,1,"best_pulse").c_str()); + if (retval < 0) { + SETIERROR(WRITE_FAILED,"from outfile.printf (best pulse) in seti_analyze()"); + } + } + if (best_triplet->t.fft_len) { + retval = outfile.printf("%s", best_triplet->t.print_xml(0,0,1,"best_triplet").c_str()); + if (retval < 0) { + SETIERROR(WRITE_FAILED,"from outfile.printf (best triplet) in seti_analyze()"); + } + } + retval=outfile.printf("" PACKAGE_VERSION "\n"); + +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) strcpy(sah_graphics->status, "Work unit done"); +#endif + final_report(); // flop and signal counts to stderr + retval = checkpoint(); // try a final checkpoint + + if (PowerSpectrum) free_a(PowerSpectrum); + if (use_transposed_pot) free_a(tPowerSpectrum); + +#ifdef USE_IPP + for (FftNum = 0; FftNum < swi.num_fft_lengths; FftNum++) { + if (FftSpec[FftNum]) ippsFFTFree_C_32fc (FftSpec[FftNum]); + } + if (FftBuf) free_a(FftBuf); + FftBuf = NULL; +#elif !defined(USE_FFTWF) + for (FftNum = 0; FftNum < swi.num_fft_lengths; FftNum++) { + if (BitRevTab[FftNum]) free_a(BitRevTab[FftNum]); + } + for (FftNum = 0; FftNum < swi.num_fft_lengths; FftNum++) { + if (CoeffTab[FftNum]) free_a(CoeffTab[FftNum]); + } +#endif + + if (WorkData) free_a(WorkData); + WorkData = NULL; + + if (ChirpFftPairs) free(ChirpFftPairs); + if ((app_init_data.host_info.m_nbytes == 0) || + (app_init_data.host_info.m_nbytes >= MIN_TRIGARRAY_MEMORY)) { + FreeTrigArray(); + } + + // jeffc + //retval = outfile.flush(); + xml_indent(-2); + outfile.printf(""); + outfile.close(); + //if (retval) SETIERROR(WRITE_FAILED,"from outfile.fflush in seti_analyze()"); + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return retval; +} + + +int v_BaseLineSmooth( + sah_complex* DataIn, + int NumDataPoints, + int BoxCarLength, + int NumPointsInChunk +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_BaseLineSmooth"); +#endif + // We use a sliding boxcar method for baseline smoothing. Input data + // is the time domain. It is transformed (using a separate array) + // into the frequency domain. After baseline smoothing is done + // in the frequency domain, it is transformed back into the time domain. + + int h, i, j, k; + sah_complex* DataInChunk; + static sah_complex *DataOutChunk=0; + static float* PowerSpectrum=0; + float Total, LocalMean, ScaleFactor,recipNumPointsInChunk=1.0/NumPointsInChunk; + int NumTimeChunks, TimeChunk, Endpoint; + static int OldNumPointsInChunk = 0; +#ifdef USE_IPP + static IppsFFTSpec_C_32fc* FftSpec = NULL; +#elif defined(USE_FFTWF) + static fftwf_plan backward_transform, forward_transform; +#endif /* USE_FFTWF */ + +#ifndef USE_FFTWF + static int * BitRevTab = NULL; + static float * CoeffTab = NULL; +#endif /* USE_FFTWF */ + + NumTimeChunks = (int)(NumDataPoints * recipNumPointsInChunk); + + + // If we keep doing transforms that are the same length, don't reinitialize plans + if (NumPointsInChunk != OldNumPointsInChunk) { + if (OldNumPointsInChunk != 0) { + +#ifdef USE_IPP + if (FftSpec) ippsFFTFree_C_32fc (FftSpec); +#elif defined(USE_FFTWF) + if (backward_transform) free_a(backward_transform); + if (forward_transform) free_a(forward_transform); +#else + if (BitRevTab) free_a(BitRevTab); + if (CoeffTab) free_a(CoeffTab); +#endif + if (PowerSpectrum) free_a(PowerSpectrum); + if (DataOutChunk) free_a(DataOutChunk); + } + PowerSpectrum = (float*) calloc_a(NumPointsInChunk, sizeof(float), MEM_ALIGN); + if (PowerSpectrum == NULL) { + printf("Could not allocate Power Spectrum array in v_BaseLineSmooth()\n"); + exit(1); + } + // Do the transforms in the DataOutChunk, since DataInChunk won't + // necessarily be aligned correctly (and we won't get SIMD) + // TODO: automatically make DataInChunk aligned correctly so we + // don't need the memcpy. This may already be done if + // NumPointsInChunk*sizeof(sah_complex) is a multiple of MEM_ALIGN + DataOutChunk = (sah_complex *)malloc_a(NumPointsInChunk * sizeof(sah_complex),MEM_ALIGN); + OldNumPointsInChunk = NumPointsInChunk; + +#ifdef USE_IPP + int order = 0; + for (int tmp = NumPointsInChunk; !(tmp & 1); order++) tmp >>= 1; + ippsFFTInitAlloc_C_32fc (&FftSpec, order, IPP_FFT_NODIV_BY_ANY, + ippAlgHintAccurate); +#elif defined(USE_FFTWF) + sah_complex *scratch = (sah_complex *)malloc_a(NumPointsInChunk * sizeof(sah_complex),MEM_ALIGN); +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fftwf_plan_dft_1d()"); +#endif + backward_transform = fftwf_plan_dft_1d(NumPointsInChunk, scratch, DataOutChunk, FFTW_BACKWARD, FFTW_MEASURE_OR_ESTIMATE|FFTW_PRESERVE_INPUT); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); + call_stack.enter("fftwf_plan_dft_1d()"); +#endif + forward_transform = fftwf_plan_dft_1d(NumPointsInChunk, DataOutChunk, DataOutChunk, FFTW_FORWARD, FFTW_MEASURE_OR_ESTIMATE); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + free_a(scratch); +#else /* !USE_FFTWF */ + BitRevTab = (int*) calloc_a(3+(int)sqrt((float)NumPointsInChunk/2), sizeof(int), MEM_ALIGN); + if (BitRevTab == NULL) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return MALLOC_FAILED; + } + + CoeffTab = (float*) calloc_a(NumPointsInChunk/2, sizeof(float), MEM_ALIGN); + if (CoeffTab == NULL) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return MALLOC_FAILED; + } + // flag to tell cdft() to init it's work areas + // already done since we used calloc_a(); + // BitRevTab[0] = 0; +#endif /* USE_FFTWF */ + + } + + for (TimeChunk = 0; TimeChunk < NumTimeChunks; TimeChunk++) { +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) sah_graphics->local_progress = (((float)TimeChunk)/NumTimeChunks); +#endif + + DataInChunk = &(DataIn[TimeChunk*NumPointsInChunk]); +#ifndef USE_FFTWF + memcpy( DataOutChunk, DataInChunk, (int)(NumPointsInChunk*sizeof(sah_complex)) ); +#endif + + // transform to freq +#ifdef USE_IPP + ippsFFTInv_CToC_32fc ((Ipp32fc*)DataOutChunk, (Ipp32fc*)DataOutChunk, + FftSpec, NULL); +#elif !defined(USE_FFTWF) + cdft(NumPointsInChunk*2, 1, DataOutChunk, BitRevTab, CoeffTab); +#else /* USE_FFTWF */ +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fftwf_execute_dft()"); +#endif + fftwf_execute_dft(backward_transform,DataInChunk,DataOutChunk); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +#endif /* !USE_FFTWF */ + + GetPowerSpectrum( + DataOutChunk, PowerSpectrum, NumPointsInChunk + ); + + // Begin: normalize in freq. domain via sliding boxcar + + Endpoint = NumPointsInChunk / 2; + + i = Endpoint; // start i at lowest negative freq; + // this is low point in first boxcar + j = i + BoxCarLength / 2; // start j midpoint in first boxcar + k = i + BoxCarLength; // start k at end of first boxcar; + // thus a boxcar is i----j----k + Total = 0; + for (h = i; h < k; h++) { // Get mean for first boxcar + Total += PowerSpectrum[h]; + } + LocalMean = Total / BoxCarLength; + ScaleFactor = (float)(1.0/sqrt(LocalMean * 0.5)); + + // normalize 1st half of 1st boxcar + for (h = i; h < j; h++) { + DataOutChunk[h][0] *= ScaleFactor; + DataOutChunk[h][1] *= ScaleFactor; + } + + for (; k != Endpoint; i++, j++, k++) { // sliding boxcar + if (k == NumPointsInChunk) { // take care of wrapping + k = 0; + } + if (j == NumPointsInChunk) { + j = 0; + } + if (i == NumPointsInChunk) { + i = 0; + } + + LocalMean = LocalMean + - PowerSpectrum[i] / BoxCarLength + + PowerSpectrum[k] / BoxCarLength; + ScaleFactor = (float)(1.0/sqrt(LocalMean * 0.5)); + + DataOutChunk[j][0] *= ScaleFactor; + DataOutChunk[j][1] *= ScaleFactor; + + } // End sliding boxcar + + // normalize final half of final boxcar + for (h = j; h < k; h++) { + DataOutChunk[h][0] *= ScaleFactor; + DataOutChunk[h][1] *= ScaleFactor; + } + + // End: normalize in freq. domain via sliding boxcar + + // transform back to time +#ifdef USE_IPP + ippsFFTFwd_CToC_32fc((Ipp32fc*)DataOutChunk, (Ipp32fc*)DataOutChunk, + FftSpec, NULL); +#elif !defined(USE_FFTWF) + cdft(NumPointsInChunk*2, -1, DataOutChunk, BitRevTab, CoeffTab); +#else +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fftwf_execute()"); +#endif + fftwf_execute(forward_transform); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +#endif + analysis_state.FLOP_counter+=10.0*NumPointsInChunk*log((double)NumPointsInChunk)/log(2.0)+10.0*NumPointsInChunk; + // return powers to normal + for (i = 0; i < NumPointsInChunk; i++) { + DataInChunk[i][0] = DataOutChunk[i][0]*recipNumPointsInChunk; + DataInChunk[i][1] = DataOutChunk[i][1]*recipNumPointsInChunk; + } + } + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +int v_GetPowerSpectrum( + sah_complex* FreqData, + float* PowerSpectrum, + int NumDataPoints +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_GetPowerSpectrum()"); +#endif + int i; + +#ifdef __INTEL_COMPILER +#pragma message ("---using ICC---") +#pragma vector aligned + __assume_aligned (FreqData, MEM_ALIGN); +#endif + analysis_state.FLOP_counter+=3.0*NumDataPoints; + for (i = 0; i < NumDataPoints; i++) { + PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0] + + FreqData[i][1] * FreqData[i][1]; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// chirp_rate is in Hz per second + +#ifndef USE_INTEL_OPT_CODE +int v_ChirpData( + sah_complex* cx_DataArray, + sah_complex* cx_ChirpDataArray, + int chirp_rate_ind, + double chirp_rate, + int ul_NumDataPoints, + double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_ChirpData()"); +#endif + int i; + double recip_sample_rate=1.0/sample_rate; + +#ifdef DEBUG + fprintf(stderr, "icfft = %6d crate index = %6d\n", icfft, chirp_rate_ind); + fflush(stderr); +#endif + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, + cx_DataArray, + (int)ul_NumDataPoints * sizeof(sah_complex) + ); // NOTE INT CAST + } else { + + // what we do depends on how much memory we have... + // If we have more than 64MB, we'll cache the chirp table. If not + // we'll calculate it each time. + bool CacheChirpCalc=((app_init_data.host_info.m_nbytes == 0) || + (app_init_data.host_info.m_nbytes >= MIN_TRIGARRAY_MEMORY)); + + // calculate trigonometric array + // this function returns w/o doing nothing when sign of chirp_rate_ind + // reverses. so we have to take care of it. + + if (CacheChirpCalc) CalcTrigArray(ul_NumDataPoints, chirp_rate_ind); + + for (i = 0; i < ul_NumDataPoints; i++) { + float c, d, real, imag; + + if (CacheChirpCalc) { + c = CurrentTrig[i].Cos; + d = (chirp_rate_ind >0)? CurrentTrig[i].Sin : -CurrentTrig[i].Sin; + } else { + double dd,cc; + double time=static_cast(i)*recip_sample_rate; + // since ang is getting moded by 2pi, we calculate "ang mod 2pi" + // before the call to sincos() inorder to reduce roundoff error. + // (Bug submitted by Tetsuji "Maverick" Rai) + double ang = 0.5*chirp_rate*time*time; + ang -= floor(ang); + ang *= M_PI*2; + sincos(ang,&dd,&cc); + c=cc; + d=dd; + } + + // Sometimes chirping is done in place. + // We don't want to overwrite data prematurely. + real = cx_DataArray[i][0] * c - cx_DataArray[i][1] * d; + imag = cx_DataArray[i][0] * d + cx_DataArray[i][1] * c; + cx_ChirpDataArray[i][0] = real; + cx_ChirpDataArray[i][1] = imag; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} +#endif // USE_INTEL_OPT_CODE + + +// Trigonometric arrays functions +// These functions makes trigonometric arrays very quickly and +// will speed up v_ChirpData() +// by Tetsuji "Maverick" Rai + +// initialize TrigStep and CurrentTrig + +void InitTrigArray(int len, double ChirpStep, int InitChirpRateInd, + double SampleRate) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("InitTrigArray()"); +#endif + int i; + double ang, Coef; + + TrigStep = (SinCosArray*) malloc_a (len * sizeof(SinCosArray), MEM_ALIGN); + if (TrigStep == NULL) SETIERROR(MALLOC_FAILED, "TrigStep == NULL"); + + CurrentTrig = (SinCosArray*) malloc_a (len * sizeof(SinCosArray), MEM_ALIGN); + if (CurrentTrig == NULL) SETIERROR(MALLOC_FAILED, "CurrentTrig == NULL"); + + // Make ChirpStep array + + Coef = ChirpStep / (SampleRate*SampleRate); + + for (i = 0; i < len; i++) { + // since ang is getting cast to a float, we calculate "ang mod 2pi" + // before the call to sincosf() inorder to reduce roundoff error. + // (Bug submitted by Tetsuji "Maverick" Rai) + // addition: now it's used as double float, but this bug fix + // is still preferable + ang = 0.5*(double)i*(double)i*Coef; + ang -= floor(ang); + ang *= 2*M_PI; + sincos(ang, &TrigStep[i].Sin, &TrigStep[i].Cos); + } + + // Set initial trigonometric array + + if ((CurrentChirpRateInd = abs(InitChirpRateInd)) != 0) { + Coef = CurrentChirpRateInd*ChirpStep / (SampleRate*SampleRate); + + for (i = 0; i < len; i++) { + ang = 0.5*(double)i*(double)i*Coef; + ang -= floor(ang); + ang *= 2*M_PI; + sincos(ang, &CurrentTrig[i].Sin, &CurrentTrig[i].Cos); + } + } else { + // if it starts from the beginning, it's quite simple + for (i = 0; i < len; i++) { + CurrentTrig[i].Sin = 0.; + CurrentTrig[i].Cos = 1.0; + } + } +} + + + +// calculate next CurrentTrig + +void CalcTrigArray (int len, int ChirpRateInd) { + double SinX, CosX, SinS, CosS; + int TempCRateInd = abs(ChirpRateInd); + int i, j; + // skip automatically when TempCRateInd == CurrentChirpRateInd + // (it happens when sign of chirprate reverses) + // Otherwise + // sin(x+step) = sin(x)*cos(step) + cos(x)*sin(step) + // cos(x+step) = cos(x)*cos(step) - sin(x)*sin(step) + + // In most cases index increases by 1, and in the later phase of a WU + // by 4 at most in reference WU, but it's 2-3 times faster than + // sincos() function on P4 with gcc or icc. When index increases by 1, + // this is about 10 times as fast as sincos() + + // JWS: Modified so when index increases by more than one, the two 16 MiB + // arrays are only loaded once. The index can increase by as much as 16. + // +#ifdef DEBUG + fprintf(stderr, " New ind = %6d (abs(%6d)) Previous = %6d\n", + ChirpRateInd, TempCRateInd, CurrentChirpRateInd); + fflush(stderr); +#endif + + switch ( TempCRateInd - CurrentChirpRateInd ) { + case 0: +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return; // replaces "automatic skip" + case 1: + for ( j = 0; j < len; j++ ) { + SinX = CurrentTrig[j].Sin; + CosX = CurrentTrig[j].Cos; + SinS = TrigStep[j].Sin; + CosS = TrigStep[j].Cos; + + CurrentTrig[j].Sin = SinX * CosS + CosX * SinS; + CurrentTrig[j].Cos = CosX * CosS - SinX * SinS; + } + break; + case 2: // unroll once to avoid 50/50 inner loop + for ( j = 0; j < len; j++ ) { + double SinTmp, CosTmp; + + SinX = CurrentTrig[j].Sin; + CosX = CurrentTrig[j].Cos; + SinS = TrigStep[j].Sin; + CosS = TrigStep[j].Cos; + + SinTmp = SinX * CosS + CosX * SinS; + CosTmp = CosX * CosS - SinX * SinS; + + CurrentTrig[j].Sin = SinTmp * CosS + CosTmp * SinS; + CurrentTrig[j].Cos = CosTmp * CosS - SinTmp * SinS; + } + break; + default: // 3 or more + for ( j = 0; j < len; j++ ) { + for ( i = CurrentChirpRateInd; i < TempCRateInd; i++ ) { + SinX = CurrentTrig[j].Sin; + CosX = CurrentTrig[j].Cos; + SinS = TrigStep[j].Sin; + CosS = TrigStep[j].Cos; + + CurrentTrig[j].Sin = SinX * CosS + CosX * SinS; + CurrentTrig[j].Cos = CosX * CosS - SinX * SinS; + } + } + break; + } + CurrentChirpRateInd = TempCRateInd; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +// free TrigStep and CurrentTrig + +void FreeTrigArray() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("FreeTrigArray()"); +#endif + if (TrigStep) free_a(TrigStep); + TrigStep = NULL; + + if (CurrentTrig) free_a(CurrentTrig); + CurrentTrig = NULL; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +template +inline void v_subTranspose(float * __restrict in, float * __restrict out, int xline, int yline) { +#ifdef USE_MANUAL_CALLSTACK + static char name_buf[64]; + sprintf(name_buf,"v_subtranspose<%d>()",x); + call_stack.enter(name_buf); +#endif + // Transpose an X by X subsection of a XLINE by YLINE matrix into the + // appropriate part of a YLINE by XLINE matrix. "IN" points to the first + // (lowest address) element of the input submatrix. "OUT" points to the + // first (lowest address) element of the output submatrix. + int i,j; + float *p; + register float tmp[x*x]; + for (j=0;j(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i> 1) & 0x55555555); + x = (((x >> 2) & 0x33333333) + (x & 0x33333333)); + x = (((x >> 4) + x) & 0x0f0f0f0f); + x += (x >> 8); + x += (x >> 16); + return(x & 0x0000003f); +#endif +} + +inline uint32_t ilog2(int32_t n) { + register int32_t rv=-1; + if (n) { +#if defined(HAVE___BUILTIN_CLZ) + rv=(CHAR_BIT*sizeof(n))-__builtin_clz(n)-1; +#else + n |= (n >> 1); + n |= (n >> 2); + n |= (n >> 4); + n |= (n >> 8); + n |= (n >> 16); + rv=(ones32(n >> 1)); +#endif + } +return rv; +} + +int fftwf_transpose(int x, int y, float *in, float *out) { + int i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fftwf_transpose"); +#endif + i=ilog2(x)-3; + fftwf_execute_r2r(transpose_plans[i], in, out); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + diff --git a/client/analyzeFuncs.h b/client/analyzeFuncs.h new file mode 100644 index 0000000..fe82db7 --- /dev/null +++ b/client/analyzeFuncs.h @@ -0,0 +1,135 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// Title : analyzeFuncs.h +// $Id: analyzeFuncs.h,v 1.5.2.9 2007/05/31 22:03:09 korpela Exp $ +#ifndef ANALYZE_FUNCS_H +#include "seti.h" + +// The PROGRESS_FACTORs are based on the relative time that +// it takes to apply the given algorithm to the data block, +// at some given chirp/fft pair. They are more flakey than +// I would like. On rewrite, I would run calibrating +// benchmarks on program startup. +// +// The GAUSS_PROGRESS_FACTOR of 10 seems about right for gaussian +// finding at an FFT length of 16K and maybe 8K. At shorter FFTs, +// gaussian finding goes alot faster, but this situation occurs a +// lot fewer times and so it's contribution gets washed out. +// +// Pulse finding with array size 14 is given 1 factor unit, as that +// very roughly takes the same amount of time as FFT/spike finding. +// As the array size doubles, the number of factor units will also +// double. N here is the array size. + +/* These constants are no longer used, see functions in progress.cpp + +#define SPIKE_PROGRESS_FACTOR 1.0f +#define CHIRP_PROGRESS_FACTOR 2.0f +#define GAUSS_PROGRESS_FACTOR 10.0f +#define TRIPLET_PROGRESS_FACTOR 0.1f +#define PULSE_PROGRESS_FACTOR(N) (N/14.0f) +*/ + +#define KILOBYTE 1024L +#define MEGABYTE 1048576L + +#ifdef ANDROID +#define MIN_TRANSPOSE_MEMORY static_cast(512*MEGABYTE) +#define MIN_TRIGARRAY_MEMORY static_cast(384*MEGABYTE) +#else +#define MIN_TRANSPOSE_MEMORY static_cast(96*MEGABYTE) +#define MIN_TRIGARRAY_MEMORY static_cast(64*MEGABYTE) +#endif + +#define FFTW_MEASURE_OR_ESTIMATE ((app_init_data.host_info.m_nbytes >= MIN_TRANSPOSE_MEMORY)?FFTW_MEASURE:FFTW_ESTIMATE) + +#define PROGRESS_DISPLAY_RES 1.0 +// for text-only versions: display progress with every 1% + +extern int seti_analyze(ANALYSIS_STATE&); + +#include "vector/analyzeFuncs_vector.h" + +extern int v_BaseLineSmooth( + sah_complex * cx_DataIn, + int ul_NumDataPoints, + int ul_BoxCarLength, + int ul_TimeLength + ); + +extern int v_GetPowerSpectrum( + sah_complex * cx_FreqData, + float * fp_PowerSpectrum, + int ul_NumDataPoints + ); + +#define TESTCHIRPIND 27040 + +extern int v_ChirpData( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); + +extern int v_Transpose(int xsize, int ysize, float *in, float *out); +extern int v_Transpose2(int xsize, int ysize, float *in, float *out); +extern int v_Transpose4(int xsize, int ysize, float *in, float *out); +extern int v_Transpose8(int xsize, int ysize, float *in, float *out); + +extern BaseLineSmooth_func BaseLineSmooth; +extern GetPowerSpectrum_func GetPowerSpectrum; +extern ChirpData_func ChirpData; +extern Transpose_func Transpose; + +// These are used to calculate chirped signals +// TrigStep contains trigonometric functions for MinChirpStep over time +// CurrentTrig contains current trigonometric fuctions +// Tetsuji "Maverick" Rai + +// Trigonometric arrays +typedef struct {double Sin, Cos; } +SinCosArray; + +extern SinCosArray* TrigStep; // trigonometric array of MinChirpStep +extern SinCosArray* CurrentTrig; // current chirprate trigonometric array +extern int CurrentChirpRateInd; // current chirprate index (absolute value) +extern double MinChirpStep; +extern bool use_transposed_pot; + +//extern float GetProgressUnitSize(int NumDataPoints, int num_cfft, SETI_WU_INFO& swi); +extern float GetProgressUnitSize(int NumDataPoints, int num_cfft); + +extern double ProgressUnitSize; +extern double progress; +extern double remaining; +extern float min_slew; +extern float max_slew; +#endif diff --git a/client/analyzePoT.cpp b/client/analyzePoT.cpp new file mode 100644 index 0000000..d16b2dd --- /dev/null +++ b/client/analyzePoT.cpp @@ -0,0 +1,701 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: analyzePoT.cpp,v 1.24.2.13 2007/08/10 00:38:47 korpela Exp $ +// + +#include "sah_config.h" + +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + +#include "util.h" +#include "malloc_a.h" +#include "analyze.h" +#include "seti.h" +#include "worker.h" +#include "analyzeFuncs.h" +#include "analyzePoT.h" +#include "analyzeReport.h" +#include "gaussfit.h" +#include "pulsefind.h" +#include "chirpfft.h" +#include "filesys.h" +#include "util.h" +#include "s_util.h" +#include "progress.h" +#ifdef __arm__ +#include "vector/fp_arm.h" +#endif + +//#define DEBUG_POT + +// Compile time inits. Command line parms of setiathome_test can +// change a number of these. +PoTInfo_t PoTInfo = {0}; + +int analyze_pot( + float *PowerSpectrum, + int NumDataPoints, + ChirpFftPair_t &cfft +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("analyze_pot()"); +#endif + + // This function analyses Power over Time for the current data block. + // The PoT array is created by taking an array of power spectra (a + // standard row-major 2D array) and extracting the PoT as column-major + // data. We essentialy turn the array on its side. + + int retval = 0, + i, + FftLength=cfft.FftLen, // Current FFT length + ThisPoT, // index of current PoT along the freq axis + PoTLen, // compliment of FFT length - determines time res + PulsePoTLen, // length of PoT segment passed to pulse finders + Overlap, // PoT segment overlap in bins + TOffset, // index into ThisPoT of current pulse segment + PulsePoTNum = 0, // the oridinal position of a pulse PoT w/in a full PoT + NumPulsePoTs = 0, // the number of pulse PoTs w/in a full PoT. This is + // constant regardless of FFT or PoT length and is + // determined by slew rate. + AdvanceBy; // the number of bins to advance for the next pulse PoT + + float ProgressAddFactor = 0.0, // sum of progress adds for ThisPoT + ProgressPerPulsePoT = 0.0; // for local progress display + + bool SkipGauss = false, + SkipPulse = false, + SkipTriplet = false, + TOffsetOK = true; + + static float *GaussPoT = NULL, + *PulsePoT = NULL; + +#ifdef DUMP_POWER_SPECTRA + + if (ul_FftLength == FFT_TO_DUMP) { + for (i=0;i PoTInfo.TripletMax || PulsePoTLen < PoTInfo.TripletMin) + SkipTriplet = true; + SkipGauss = !(cfft.GaussFit); + SkipPulse = !(cfft.PulseFind); + + if(!SkipPulse || !SkipTriplet) { + // NumPulsePoTs is the number of PoT segments that we pass to the pulse + // detectors per frequency bin. ProgressPerPulsePoT is the inverse of + // number of pulse detection segments in the entire data block, taking + // into account that we skip the first (DC) frequency bin. An assumption + // is made here that minimum pulse/triplet PoT length will always be + // greater than 1. Otherwise, AdvanceBy can become zero and a divide by + // zero can occur. The assumption is also made that FftLength is always + // greater than 1! + NumPulsePoTs = 1 + (PoTLen-PulsePoTLen)/AdvanceBy + ((PoTLen-PulsePoTLen)%AdvanceBy ? 1 : 0); + ProgressPerPulsePoT = (float)1 / ((FftLength - 1) * NumPulsePoTs); + } + +#ifdef DEBUG_POT + fprintf(stderr, "SlewRate = %f\n", PoTInfo.SlewRate); + fprintf(stderr, "PoTLen = %d\n", PoTLen); + fprintf(stderr, "MaxPoTLen = %d\n", PoTInfo.MaxPoTLen); + fprintf(stderr, "PoTDuration = %f\n", PoTInfo.WUDuration); + fprintf(stderr, "BeamRate = %f\n", PoTInfo.BeamRate); + fprintf(stderr, "PulsePoTLen = %d\n", PulsePoTLen); + fprintf(stderr, "Overlap = %d\n", Overlap); + fprintf(stderr, "AdvanceBy = %d\n", AdvanceBy); + fprintf(stderr, "min_slew = %f\n", PoTInfo.min_slew); + fprintf(stderr, "max_slew = %f\n", PoTInfo.max_slew); + fprintf(stderr, "PulseOverlapFactor = %f\n", PoTInfo.PulseOverlapFactor); + fprintf(stderr, "PulseBeams = %f\n", PoTInfo.PulseBeams); + fprintf(stderr, "PulseThresh = %f\n", PoTInfo.PulseThresh); + fprintf(stderr, "PulseMax = %d\n", PoTInfo.PulseMax); + fprintf(stderr, "PulseMin = %d\n", PoTInfo.PulseMin); + fprintf(stderr, "PulseFftMax = %d\n", PoTInfo.PulseFftMax); + fprintf(stderr, "TripletThresh = %f\n", PoTInfo.TripletThresh); + fprintf(stderr, "TripletMax = %d\n", PoTInfo.TripletMax); + fprintf(stderr, "TripletMin = %d\n", PoTInfo.TripletMin); +#endif + +#ifndef USE_PULSE + + SkipPulse = TRUE; +#endif +#ifndef USE_TRIPLET + + SkipTriplet = TRUE; +#endif + + // Get memory fot the PoT arrays. The PoT array for gausian analysis is + // of set size. The PoT array for pulse analysis is sized to cover + // PulseBeams beams, regardless of whether this violates either the + // triplet or pulse limits on array size. + if(!GaussPoT) { + GaussPoT = (float *)malloc_a(swi.analysis_cfg.gauss_pot_length * sizeof(float), MEM_ALIGN); + if(GaussPoT == NULL) { + SETIERROR(MALLOC_FAILED, "GaussPoT == NULL"); + } + } + if(!PulsePoT) { + PulsePoT = (float *)calloc_a(PoTInfo.MaxPoTLen+3, sizeof(float), MEM_ALIGN); + if(PulsePoT == NULL) { + SETIERROR(MALLOC_FAILED, "PulsePoT == NULL"); + } + } + + // Look for gaussians --------------------------------------------------- + if(!SkipGauss && (analysis_state.PoT_activity == POT_DOING_GAUSS || + analysis_state.PoT_activity == POT_INACTIVE)) { + +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) + strcpy(sah_graphics->status, "Searching for Gaussians"); +#endif + + // If we are back from being interrupted in the middle of gaussian PoT + // analysis, load state and continue. Otherwise start anew, skipping + // the DC (0) bin. + if(analysis_state.PoT_activity == POT_DOING_GAUSS) { + ThisPoT = analysis_state.PoT_freq_bin; + } else { + ThisPoT = 1; // skip the DC bin on start of new cfft pair + } + + // Initial display of local Progress / CPU time. Assumes that + // we start ThisPoT at 1 each time in! +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) + sah_graphics->local_progress = ((float)ThisPoT-1)/(FftLength-1); +#endif + + // loop through frequencies + for(; ThisPoT < FftLength; ThisPoT++) { + + // Create PowerOfTime array for gaussian fit + retval = GetFixedPoT( + PowerSpectrum, + NumDataPoints, + FftLength, + GaussPoT, + swi.analysis_cfg.gauss_pot_length, + ThisPoT + ); + if (retval) + continue; + + retval = GaussFit(GaussPoT, FftLength, ThisPoT); + if (retval) + SETIERROR(retval,"from GaussFit"); + + + + progress += ProgressUnitSize * GaussianProgressUnits() / (float)(FftLength - 1); + progress=std::min(progress,1.0); // prevent display of > 100% + fraction_done(progress,remaining); + + // At the end of each frequency bin we update progress and save state. +#ifdef BOINC_APP_GRAPHICS + if (!nographics()) { + sah_graphics->local_progress = ((float)ThisPoT)/(FftLength-1); + } +#endif + analysis_state.PoT_freq_bin = ThisPoT; + analysis_state.PoT_activity = POT_DOING_GAUSS; + retval = checkpoint(); + if (retval) + SETIERROR(retval,"from checkpoint()"); + + } // end loop through frequencies + + analysis_state.PoT_freq_bin = -1; + analysis_state.PoT_activity = POT_INACTIVE; + + } // end looking for gaussians + + + // Look for pulses ------------------------------------------------------- + if(!SkipPulse || !SkipTriplet) { + +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) { + strcpy(sah_graphics->status, "Searching for Pulses / Triplets"); + // init local progress for pulse search + sah_graphics->local_progress = 0; + } +#endif + + + // If we are back from being interrupted in the middle of pulse PoT + // analysis, load state and continue. Otherwise start anew, skipping + // the DC (0) bin. + if(analysis_state.PoT_activity == POT_DOING_PULSE) { + ThisPoT = analysis_state.PoT_freq_bin; + } else { + ThisPoT = 1; // skip the DC bin on start of new cfft pair + } + + PulsePoTNum = 0; + +#ifdef BOINC_APP_GRAPHICS + // Inital display of Local Progress + if (sah_graphics) { + sah_graphics->local_progress = (((ThisPoT-1) * NumPulsePoTs) + + PulsePoTNum) * + ProgressPerPulsePoT; + } +#endif + + // loop through frequencies + for(; ThisPoT < FftLength; ThisPoT++) { + + // loop through time for each frequency. PulsePoTNum is + // used only for progress calculation. + for(TOffset = 0, PulsePoTNum = 1, TOffsetOK = true; + TOffsetOK; + PulsePoTNum++, TOffset += AdvanceBy) { + + // Create PowerOfTime array for pulse detection. If there + // are not enough points left in this PoT, adjust TOffset + // to get the latest possible pulse PoT. + if(TOffset + PulsePoTLen >= PoTLen) { + TOffsetOK = false; + TOffset = PoTLen - PulsePoTLen; + } + if (use_transposed_pot) { + memcpy(PulsePoT, &PowerSpectrum[ThisPoT * PoTLen + TOffset], PulsePoTLen*sizeof(float)); + } else { + for(i = 0; i < PulsePoTLen; i++) { + PulsePoT[i] = PowerSpectrum[ThisPoT + (TOffset+i) * FftLength]; + } + } + + if(!SkipTriplet) { + retval = find_triplets(PulsePoT, + PulsePoTLen, + (float)PoTInfo.TripletThresh, + TOffset, + ThisPoT); + if (retval) + SETIERROR(retval,"from find_triplets()"); + } + + if(!SkipPulse) { + retval = find_pulse(PulsePoT, + PulsePoTLen, + (float)PoTInfo.PulseThresh, + TOffset, + ThisPoT + ); + if (retval) + SETIERROR(retval,"from find_pulse()"); + } + + // At the end of each pulse PoT we update progress. Progress + // will thus get updted several times per frequency bin. +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) + { + sah_graphics->local_progress = (((ThisPoT-1) * NumPulsePoTs) + + PulsePoTNum) * + ProgressPerPulsePoT; + } +#endif + if(!SkipTriplet) { + progress += (ProgressUnitSize * TripletProgressUnits()) / + (float)(FftLength - 1) / NumPulsePoTs; + } + if(!SkipPulse) { + progress += (ProgressUnitSize * PulseProgressUnits(PulsePoTLen, FftLength - 1)) / + (float)(FftLength - 1) / NumPulsePoTs; + + } + progress=std::min(progress,1.0); // prevent display of > 100% + fraction_done(progress,remaining); + + } // end loop through time for each frequency + + // At the end of each frequency bin we save state. + analysis_state.PoT_activity = POT_DOING_PULSE; + analysis_state.PoT_freq_bin = ThisPoT; + retval = checkpoint(); + if (retval) + SETIERROR(retval,"from checkpoint()"); + + } // end loop through frequencies + + analysis_state.PoT_freq_bin = -1; + analysis_state.PoT_activity = POT_INACTIVE; + + } // end looking for pulses + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return (retval); // no error return point +} + +int GetFixedPoT( + float fp_PowerSpectrum[], + int ul_NumDataPoints, + int ul_FftLength, + float fp_PoT[], + int ul_PoTLen, + int ul_PoT +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("GetFixedPoT()"); +#endif + // This routine returns a PoT array of fixed length, regardless + // of the actual number of time bins in the current data block. + + int ul_PoT_i, + ul_PoTChunkSize, + ul_PoTChunk_i, + ul_PoTChunkLimit, + ul_NumSpectra, + ul_PoTsPerSpec, + ul_MidPoint, + ul_BaseSpec, + ul_SubPoT_i; + + float f_Factor, + f_BaseSpecPowerPerPoT = 0.0, + f_AftSpecPowerPerPoT = 0.0, + f_ForwardSpecPowerPerPoT = 0.0, + f_BaseWeight; + + ul_NumSpectra = ul_NumDataPoints / ul_FftLength; + ul_PoTChunkSize = ul_NumSpectra / ul_PoTLen; + + // Populate PoT + + // For setiathome_enhanced, the number of spectra is the same as the + // number of elements in a PoT array more times than not (16K FFT length). + // For an 0.426 angle range, there are 2.2104e10 cases where they're equal + // and 2.2082e10 cases where they're not. Copying directly rather than + // adding also means no FLOP_counter increment is needed. + if (ul_NumSpectra == ul_PoTLen) { + if (use_transposed_pot) { + memcpy(fp_PoT, &fp_PowerSpectrum[ul_PoT * ul_NumSpectra], + swi.analysis_cfg.gauss_pot_length * sizeof(float)); + } else { + for (ul_PoT_i = 0, ul_PoTChunk_i = 0; + ul_PoT_i < swi.analysis_cfg.gauss_pot_length; + ul_PoT_i++, ul_PoTChunk_i += ul_FftLength) { + fp_PoT[ul_PoT_i] = fp_PowerSpectrum[ul_PoT + ul_PoTChunk_i]; + } + } + // If the number of spectra is greater than the number + // of elements in a PoT array, we add sum adjacent spectra + // into PoT elements. + // ul_PoTChunkSize indicates how many time-wise + // power spectra bins are added together to make one PoT bin. + } else if (ul_NumSpectra > ul_PoTLen) { + ul_PoTChunk_i = 0; + int blksize = UNSTDMAX(1, UNSTDMIN(pow2((unsigned int) sqrt((float) ((ul_PoTChunkSize) / 32)) * 32), 512)); + for (ul_PoT_i = 0; ul_PoT_i < swi.analysis_cfg.gauss_pot_length; ul_PoT_i++) { + fp_PoT[ul_PoT_i] = 0.0; + ul_PoTChunkLimit = ul_PoTChunk_i + ul_PoTChunkSize; + + // Stuff chunk of power spectra bins into 1 PoT bin + int b,chunk_i; + float total = 0.0f,partial; + if (use_transposed_pot) { + for (b=0;b 0) { + if (use_transposed_pot) { + f_AftSpecPowerPerPoT = fp_PowerSpectrum[ul_PoT + * ul_NumSpectra + (ul_BaseSpec-1)] * f_Factor; + } else { + f_AftSpecPowerPerPoT = fp_PowerSpectrum[ul_PoT + + ul_FftLength * (ul_BaseSpec-1)] * f_Factor; + } + } + if (ul_BaseSpec < ul_NumSpectra - 1) { + if (use_transposed_pot) { + f_ForwardSpecPowerPerPoT = fp_PowerSpectrum[ul_PoT + * ul_NumSpectra + (ul_BaseSpec+1)] * f_Factor; + } else { + f_ForwardSpecPowerPerPoT = fp_PowerSpectrum[ul_PoT + + ul_FftLength * (ul_BaseSpec+1)] * f_Factor; + } + } + + // Begin interpolation. + if (ul_SubPoT_i < ul_MidPoint) { + // Use the Aft spectrum if there is one. + // If not, use non-interpoated powers. + if (ul_BaseSpec == 0) { + fp_PoT[ul_PoT_i] = f_BaseSpecPowerPerPoT; + } else { + f_BaseWeight = (float)(ul_PoTsPerSpec - (ul_MidPoint - ul_SubPoT_i)) / ul_PoTsPerSpec; + fp_PoT[ul_PoT_i] = (f_BaseSpecPowerPerPoT * f_BaseWeight) + + (f_AftSpecPowerPerPoT * (1.0f - f_BaseWeight)); + } + } else { + // Use the Forward spectrum if there is one. + // If not, use non-interpoated powers. + if (ul_BaseSpec == ul_NumSpectra-1) { + fp_PoT[ul_PoT_i] = f_BaseSpecPowerPerPoT; + } else { + f_BaseWeight = (float)(ul_PoTsPerSpec - (ul_SubPoT_i - ul_MidPoint)) / ul_PoTsPerSpec; + fp_PoT[ul_PoT_i] = (f_BaseSpecPowerPerPoT * f_BaseWeight) + + (f_ForwardSpecPowerPerPoT * (1.0f - f_BaseWeight)); + } + } + } // end for ul_PoT_i < swi.analysis_cfg.gauss_pot_length + analysis_state.FLOP_counter+=(double)(9*swi.analysis_cfg.gauss_pot_length); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +void ComputePoTInfo(int num_cfft, int NumDataPoints) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ComputePoTInfo()"); +#endif + // Tis routine calculates various PoT values based on program constants + // and data contained in the current WU. + + // A note on "sigma", calculated here and used by the gaussian finder: + // The sigma calculated here is in units of PoT, ie, in bins of the + // Power Of Time arrays. Gaussian PoT arrays are of fixed length, given by + // GAUSS_POT_LEN. The basic definition of sigma here is that it is the + // amount of time it takes to cover 1/2 the half-power-beamwidth of the + // serendip feed. This is also a constant - BEAM_WIDTH - in units of + // degrees. We scan BEAM_WIDTH degrees at a given, but variable, slew rate. + // + + + volatile double DegPerPotBin; // slew rate in degrees per PoT bin + volatile float ftmp; // temporary to ensure float rounding + int i, MinFftLen; + + // jeffc - is there really any need for these PoTInfo fields + // at this point? + PoTInfo.min_slew = swi.analysis_cfg.pot_min_slew; + PoTInfo.max_slew = swi.analysis_cfg.pot_max_slew; + PoTInfo.PulseOverlapFactor = swi.analysis_cfg.pot_overlap_factor; // ? + PoTInfo.PulseBeams = swi.analysis_cfg.pulse_beams; + PoTInfo.PulseThresh = swi.analysis_cfg.pulse_thresh; + PoTInfo.PulseMax = swi.analysis_cfg.pulse_max; + PoTInfo.PulseMin = swi.analysis_cfg.pulse_min; + PoTInfo.PulseFftMax = swi.analysis_cfg.pulse_fft_max; + PoTInfo.TripletThresh = swi.analysis_cfg.triplet_thresh; + PoTInfo.TripletMax = swi.analysis_cfg.triplet_max; + //JWS: Don't process Triplet PoTs too short to produce a reportable signal. + PoTInfo.TripletMin = std::max((int)swi.analysis_cfg.triplet_min, + (int)(ceil(3.0 * swi.analysis_cfg.triplet_thresh))); + //JWS: Nor Spike PoFs. + PoTInfo.SpikeMin = (int)(ceil(swi.analysis_cfg.spike_thresh)); + PoTInfo.GaussChiSqThresh = swi.analysis_cfg.gauss_chi_sq_thresh; + PoTInfo.GaussPowerThresh = swi.analysis_cfg.gauss_power_thresh; + PoTInfo.GaussPeakPowerThresh = swi.analysis_cfg.gauss_peak_power_thresh; + + // Find the max fft length in the chirp/fft table + for(i = 1, MinFftLen = ChirpFftPairs[0].FftLen; i < num_cfft; i++) { + if(ChirpFftPairs[i].FftLen < MinFftLen) { + MinFftLen = ChirpFftPairs[i].FftLen; + } + } + + PoTInfo.MaxPoTLen = NumDataPoints / MinFftLen; + ftmp = (float)(swi.nsamples / swi.subband_sample_rate); + PoTInfo.WUDuration = ftmp; + + // 11/2/15 - EK increased accuracy of conversion from HPBW to gaussian sigma + // + // Here we calculate slew rate and slew related values. + // If there is no telescope movement, slew related values remain + // in their initialized state (zero). + if(swi.angle_range != 0.0) { + ftmp = (float)(swi.angle_range / PoTInfo.WUDuration); + PoTInfo.SlewRate = ftmp; + ftmp = (float)(PoTInfo.SlewRate / swi.beam_width); + PoTInfo.BeamRate = ftmp; + DegPerPotBin = swi.angle_range / swi.analysis_cfg.gauss_pot_length; + ftmp = (float)((swi.beam_width/2.35482f) / DegPerPotBin); + PoTInfo.GaussSigma = ftmp; + PoTInfo.GaussSigmaSq = PoTInfo.GaussSigma * PoTInfo.GaussSigma; + PoTInfo.GaussTOffsetStart = static_cast(floor(swi.analysis_cfg.pot_t_offset * PoTInfo.GaussSigma+0.5)); + PoTInfo.GaussTOffsetStop = swi.analysis_cfg.gauss_pot_length - PoTInfo.GaussTOffsetStart; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +void GetPulsePoTLen(long FullPoTLen, int * PulsePoTLen, int * PulseOverlap) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("GetPulsePotLen()"); +#endif + + // This routine, given the time axis length of a WU in bins and data available + // in the PoTInfo struct, will calculate how many time bins to pass the pulse + // detectors for the given time axis length. Time axis length in seconds is + // is constant, while length in bins is inversely proportional to FFT length. + + // If slew rate is so low that, over the duration of the entire WU, + // we do not cover the number of beams passed to each call of the + // pulse finders then assume that we will be passing the entire PoT + // to the pulse finders. This also takes care of the case where slew + // rate is zero. Otherwise, calculate that portion of the PoT that + // we will be passing. + + // NOTE: the code calling this routine may be concerned with either pulse finding + // or triplet finding. There may be different max and/or min PoT length constraints + // between these 2 algorithms. Thus, this routine just returns the length that + // will contain PoTInfo.PulseBeams worth of data. It is up to the calling code + // to then apply any length constaints. + + double BinRate, // function of time resolution and slew rate + BinsPerBeam; // function of time res, slew rate, and beam width + + // jeffc - the following line in temporary. Pulse beams will go into the + // analysis config. + //PoTInfo.PulseBeams = 1.0; + + BinRate = FullPoTLen / PoTInfo.WUDuration; // in bins/second + + if(PoTInfo.BeamRate * PoTInfo.WUDuration < PoTInfo.PulseBeams) { + BinsPerBeam = (float)FullPoTLen; // slow slew - pass FullPoT + } else { + BinsPerBeam = BinRate / PoTInfo.BeamRate; // we will pass a portion of FullPoT + } + + *PulsePoTLen = IROUND(BinsPerBeam * PoTInfo.PulseBeams); // in bins + if(*PulsePoTLen > FullPoTLen) { + *PulsePoTLen = FullPoTLen; // pulse PoT longer than full PoT + } // ... so pass as much as we can + // ... ie the full PoT + + *PulseOverlap = IROUND(BinsPerBeam * PoTInfo.PulseOverlapFactor); // in bins + +#ifdef DEBUG_POT + + fprintf(stderr, "BinRate = %f\n", BinRate); + fprintf(stderr, "BinsPerBeam = %f\n", BinsPerBeam); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + diff --git a/client/analyzePoT.h b/client/analyzePoT.h new file mode 100644 index 0000000..6e230c0 --- /dev/null +++ b/client/analyzePoT.h @@ -0,0 +1,91 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: analyzePoT.h,v 1.5.2.2 2005/07/04 22:50:09 korpela Exp $ + +#include "chirpfft.h" +#define POT_INACTIVE 0 +#define POT_DOING_GAUSS 1 +#define POT_DOING_PULSE 2 + +extern double beam_width; + +typedef struct { + double WUDuration; // in seconds + double SlewRate; // degrees/second + double BeamRate; // beams/second + int MaxPoTLen; + + double GaussSigma; // in gaussian PoT bins + double GaussSigmaSq; // in gaussian PoT bins + int GaussTOffsetStart; // in gaussian PoT bins + int GaussTOffsetStop; // in gaussian PoT bins + double min_slew; + double max_slew; + double GaussChiSqThresh; // gaussian reporting thresh + double GaussPowerThresh; // PoT investigation thresh - in units + // of mean power across entire PoT + double GaussPeakPowerThresh; // gaussian investigation thresh - in + // units of mean power across PoT, + // exclusive of 2 sigma area on either + // side of gaussian peak + + double PulseOverlapFactor; // for both pulse and triplets + double PulseBeams; // for both pulse and triplets + + double PulseThresh; + int PulseMax; + int PulseMin; + int PulseFftMax; + + double TripletThresh; + int TripletMax; + int TripletMin; + + int SpikeMin; +} +PoTInfo_t; + +extern PoTInfo_t PoTInfo; + +int analyze_pot( + float * fp_PowerSpectrum, + int ul_NumDataPoints, + ChirpFftPair_t &cfft +); + +int GetFixedPoT( + float fp_PowerSpectrum[], + int ul_NumDataPoints, + int ul_FftLength, + float fp_PoT[], + int ul_PoTLen, + int ul_PoT +); + +void ComputePoTInfo(int num_cfft, int NumDataPoints); +void GetPulsePoTLen(long FullPoTLen, int * PulsePoTLen, int * PulseOverlap); diff --git a/client/analyzeReport.cpp b/client/analyzeReport.cpp new file mode 100644 index 0000000..5d60e0f --- /dev/null +++ b/client/analyzeReport.cpp @@ -0,0 +1,542 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// analyzeReport.C +// $Id: analyzeReport.cpp,v 1.40.2.9 2007/05/31 22:03:09 korpela Exp $ +// + +#include "sah_config.h" + +#include +#include +#include +#include +#include + +#include "diagnostics.h" +#include "util.h" +#include "s_util.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + +#include "analyze.h" +#include "gaussfit.h" +#include "seti.h" +#include "chirpfft.h" +#include "analyzeReport.h" +#include "analyzePoT.h" +#ifdef __arm__ +#include "vector/fp_arm.h" +#endif + +#include "../db/schema_master.h" + +// outfile will be flushed at checkpoint time and just before +// normal program exit. +MFILE outfile; + +SPIKE_INFO * best_spike; +AUTOCORR_INFO * best_autocorr; +GAUSS_INFO * best_gauss; +PULSE_INFO * best_pulse; +TRIPLET_INFO * best_triplet; + +int signal_count = 0; +int spike_count = 0; +int autocorr_count = 0; +int pulse_count = 0; +int triplet_count = 0; +int gaussian_count = 0; + +void reload_graphics_state() { +#ifdef BOINC_APP_GRAPHICS +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("reload_graphics_state()"); +#endif + if (!nographics()) { + sah_graphics->si.copy(best_spike, true); + sah_graphics->ai.copy(best_autocorr, true); + sah_graphics->gi.copy(best_gauss, true); + sah_graphics->pi.copy(best_pulse, true); + sah_graphics->ti.copy(best_triplet, true); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +#endif +} + +void reset_high_scores() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("reset_high_scores()"); +#endif + if(best_spike) delete(best_spike); + if(best_autocorr) delete(best_autocorr); + if(best_gauss) delete(best_gauss); + if(best_pulse) delete(best_pulse); + if(best_triplet) delete(best_triplet); + + best_spike = new(SPIKE_INFO); + best_autocorr = new(AUTOCORR_INFO); + best_gauss = new(GAUSS_INFO); + best_gauss->score=-12; + best_pulse = new(PULSE_INFO); + best_triplet = new(TRIPLET_INFO); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +static double interpol(double x1,double y1,double x2,double y2, double x) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("interpol()"); +#endif + double slope=(y2-y1)/(x2-x1); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return slope*(x-x1)+y1; +} + +void time_to_ra_dec(double time_jd, double *ra, double *dec) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("time_to_ra_dec()"); +#endif + int i=0; + double raoffs=0; + + while ((i 12.0) { + raoffs=-24.0; + } + if ((swi.position_history[i].ra-swi.position_history[i+1].ra)> 12.0) { + raoffs=24.0; + } + + *ra=interpol( + swi.position_history[i].time, + swi.position_history[i].ra, + swi.position_history[i+1].time, + swi.position_history[i+1].ra+raoffs, + time_jd + ); + if (*ra<0) { + *ra+=24; + } else if (*ra>24) { + *ra-=24; + } + + *dec=interpol( + swi.position_history[i].time, + swi.position_history[i].dec, + swi.position_history[i+1].time, + swi.position_history[i+1].dec, + time_jd + ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +int result_spike(SPIKE_INFO &si) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("result_spike()"); +#endif + int retval=0; + + //R: & JWS: sanity check for found result + if(si.s.peak_power > si.s.fft_len){ + boinc_temporary_exit(5*60,"Impossible Spike, retrying from checkpoint.",true); + } + + + retval = outfile.printf("%s", si.s.print_xml(0,0,1).c_str()); + + if (retval < 0) { + SETIERROR(WRITE_FAILED,"in result_spike"); + } else { + signal_count++; + spike_count++; + } + + if (signal_count >= swi.analysis_cfg.max_signals) { + SETIERROR(RESULT_OVERFLOW,"in result_spike"); + } + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +int result_autocorr(AUTOCORR_INFO &ai) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("result_autocorr()"); +#endif + + int retval=0; + + retval = outfile.printf("%s", ai.a.print_xml(0,0,1).c_str()); + + if (retval < 0) { + SETIERROR(WRITE_FAILED,"in result_autocorr"); + } else { + signal_count++; + autocorr_count++; + } + + if (signal_count >= swi.analysis_cfg.max_signals) { + SETIERROR(RESULT_OVERFLOW,"in result_autocorr"); + } + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +int result_gaussian(GAUSS_INFO &gi) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("result_gaussian()"); +#endif + + //R: & JWS: sanity check for found result + if(gi.g.peak_power > swi.analysis_cfg.gauss_pot_length){ + boinc_temporary_exit(5*60,"Improbable Gaussian, retrying from checkpoint.",true);} + + + int retval=0; + + retval = outfile.printf("%s", gi.g.print_xml(0,0,1).c_str()); + + if (retval >= 0) { + retval= outfile.printf("\n"); + } + + if (retval < 0) { + SETIERROR(WRITE_FAILED,"in result_gaussian"); + } else { + signal_count++; + gaussian_count++; + } + + if (signal_count >= swi.analysis_cfg.max_signals) { + SETIERROR(RESULT_OVERFLOW,"in result_gaussian"); + } + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +int ReportTripletEvent( + float Power, float MeanPower, float period, + float mid_time_bin, int start_time_bin, int freq_bin, + int pot_len,const float *PoT, int write_triplet +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ReportTripletEvent()"); +#endif + TRIPLET_INFO ti; + triplet triplet; + int retval=0, i, j; + double step,norm,index; + double max_power=0; + static int * inv; + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + //JWS: sanity check for found result. + if(Power > (float)pot_len){ + boinc_temporary_exit(5*60,"Impossible Triplet, retrying from checkpoint.",true); + } + + if (!inv) inv = (int*)calloc_a(swi.analysis_cfg.triplet_pot_length, sizeof(int), MEM_ALIGN); + + // triplet info + ti.score=Power; + ti.t.peak_power=Power; + ti.t.mean_power=MeanPower; + ti.freq_bin=freq_bin; + ti.time_bin=mid_time_bin+start_time_bin+0.5f; + ti.t.chirp_rate=ChirpFftPairs[analysis_state.icfft].ChirpRate; + ti.t.fft_len=ChirpFftPairs[analysis_state.icfft].FftLen; + ti.bperiod=period; + ti.t.period=static_cast(period*static_cast(ti.t.fft_len)/swi.subband_sample_rate); + ti.t.freq=cnvt_bin_hz(freq_bin, ti.t.fft_len); + double t_offset=(static_cast(mid_time_bin)+start_time_bin+0.5) + *static_cast(ti.t.fft_len)/ + swi.subband_sample_rate; + ti.t.detection_freq=calc_detection_freq(ti.t.freq,ti.t.chirp_rate,t_offset); + ti.t.time=swi.time_recorded+t_offset/86400.0; + time_to_ra_dec(ti.t.time, &ti.t.ra, &ti.t.decl); + + // Populate the min and max PoT arrays. These are only used + // for graphics. + memset(ti.pot_min,0xff,swi.analysis_cfg.triplet_pot_length*sizeof(int)); + memset(ti.pot_max,0,swi.analysis_cfg.triplet_pot_length*sizeof(int)); + step=static_cast(pot_len)/swi.analysis_cfg.triplet_pot_length; + ti.scale=static_cast(1.0/step); + index=0; + for (i=0;imax_power) max_power=PoT[i]; + } + norm=255.0/max_power; + float mtb = mid_time_bin; + if (pot_len > swi.analysis_cfg.triplet_pot_length) { + ti.tpotind0_0 = ti.tpotind0_1 = static_cast(((mtb-period)*swi.analysis_cfg.triplet_pot_length)/pot_len); + ti.tpotind1_0 = ti.tpotind1_1 = static_cast(((mtb)*swi.analysis_cfg.triplet_pot_length)/pot_len); + ti.tpotind2_0 = ti.tpotind2_1 = static_cast(((mtb+period)*swi.analysis_cfg.triplet_pot_length)/pot_len); + for (j=0; j(floor(PoT[j]*norm)); + } + if ((PoT[j]*norm)>ti.pot_max[i]) { + ti.pot_max[i]=static_cast(floor(PoT[j]*norm)); + } + } + } else { + memset(inv, -1, swi.analysis_cfg.triplet_pot_length*sizeof(int)); + for (i=0;i(floor(PoT[j]*norm)); + } + if ((PoT[j]*norm)>ti.pot_max[i]) { + ti.pot_max[i]=static_cast(floor(PoT[j]*norm)); + } + } + ti.tpotind0_0 = inv[static_cast(mtb-period)]; + ti.tpotind0_1 = inv[static_cast(mtb-period+1)]; + ti.tpotind1_0 = (inv[static_cast(mtb)]+inv[static_cast(mtb+1)])/2; + ti.tpotind1_1 = (inv[static_cast(mtb+1)]+inv[static_cast(mtb+2)])/2; + ti.tpotind2_0 = inv[static_cast(mtb+period)]; + if (mtb+period+1 >= pot_len) ti.tpotind2_1 = swi.analysis_cfg.triplet_pot_length-1; + else ti.tpotind2_1 = inv[static_cast(mtb+period+1)]; + } + + // Update sah_graphics triplet info regardless of whether it is the + // best thus far. If a triplet has made it this far, display it. +#ifdef BOINC_APP_GRAPHICS + if (!nographics()) sah_graphics->ti.copy(&ti); +#endif + + // best thus far ? + if (ti.score>best_triplet->score) { + if(verbose>=2){ + fprintf(stderr,"Best triplet updated:"); + fprintf(stderr,"score=%.4g; power=%.4g; freq_bin=%.4g; icfft=%d\n", + ti.score,ti.t.peak_power,ti.freq_bin,analysis_state.icfft); + } + *best_triplet=ti; + } + + + if (write_triplet) { + if(verbose>=1){ + int fft=(ti.t.fft_len>1024)?(ti.t.fft_len/1024):(ti.t.fft_len); + char symbol=(ti.t.fft_len>1024)?('k'):(' '); + fprintf(stderr,"Triplet: peak=%.7g, time=%.4g, period=%.4g, d_freq=%.12g, chirp=%.5g, fft_len=%d%c\n", + ti.t.peak_power,(ti.t.time-swi.time_recorded)*86400,ti.t.period,ti.t.detection_freq,ti.t.chirp_rate,fft,symbol); + } + retval = outfile.printf("%s", ti.t.print_xml(0,0,1).c_str()); + + if (retval < 0) { + SETIERROR(WRITE_FAILED,"in ReportTripletEvent"); + } else { + signal_count++; + triplet_count++; + } + + if (signal_count >= swi.analysis_cfg.max_signals) { + SETIERROR(RESULT_OVERFLOW,"in ReportTripletEvent"); + } + + } + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return(retval); +} + +int ReportPulseEvent(float PulsePower,float MeanPower, float period, + int time_bin,int freq_bin, float snr, float thresh, float *folded_pot, + int scale, int write_pulse) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ReportPulseEvent()"); +#endif + PULSE_INFO pi; + pulse pulse; + int retval=0, i, len_prof=static_cast(floor(period)); + float step,norm,index,MinPower=PulsePower*MeanPower*scale; + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + //JWS: sanity check for found result. The limit would be 4/3 * period, + // but discrete math and short PoTs can exceed that slightly. + if(PulsePower > 1.4 * period){ + boinc_temporary_exit(5*60,"Impossible Pulse, retrying from checkpoint.",true); + } + + // pulse info + pi.score=snr/thresh; + pi.p.peak_power=PulsePower-1; + pi.p.mean_power=MeanPower; + pi.p.fft_len=ChirpFftPairs[analysis_state.icfft].FftLen; + pi.p.chirp_rate=ChirpFftPairs[analysis_state.icfft].ChirpRate; + pi.p.period=static_cast(period*static_cast(pi.p.fft_len)/swi.subband_sample_rate); + pi.p.snr = snr; + pi.p.thresh = thresh; + pi.p.len_prof = len_prof; + pi.freq_bin=freq_bin; + pi.time_bin=time_bin; + pi.p.freq=cnvt_bin_hz(freq_bin, pi.p.fft_len); + double t_offset=(static_cast(time_bin)+0.5) + *static_cast(pi.p.fft_len)/ + swi.subband_sample_rate; + pi.p.detection_freq=calc_detection_freq(pi.p.freq,pi.p.chirp_rate,t_offset); + pi.p.time=swi.time_recorded+t_offset/86400.0; + time_to_ra_dec(pi.p.time, &pi.p.ra, &pi.p.decl); + + for (i=0;i(len_prof)/swi.analysis_cfg.pulse_pot_length; + index=0; + for (i=0;i((folded_pot[static_cast(floor(index))+j]-MinPower)*norm); + if (pot= 256) pi.pot_min[i] = 255; // kludge until we fix the assert failures + BOINCASSERT(pi.pot_min[i] < 256); + if (pot>pi.pot_max[i]) + pi.pot_max[i]=pot; + if (pi.pot_max[i] >= 256) pi.pot_max[i] = 255; // kludge until we fix the assert failures + BOINCASSERT(pi.pot_max[i] < 256); + } + index+=step; + } + } +#endif + + // Populate the result PoT if the folded PoT will fit. + if (pi.p.len_prof < swi.analysis_cfg.pulse_pot_length) { + pi.p.pot.resize(len_prof); + for (i=0;ipi.copy(&pi); +#endif + + // best thus far ? + if (pi.score>best_pulse->score) { + *best_pulse=pi; + if(verbose>=2){ + fprintf(stderr,"Best pulse updated: score=%.4g,power=%.5g,fftlen=%d,freq_bin=%d,time_bin=%d,icfft=%d\n", + pi.score,pi.p.peak_power,pi.p.fft_len,pi.freq_bin,pi.time_bin,analysis_state.icfft); + } + } + + if (write_pulse) { + + //for (i=0;i=1){ + int fft=(pi.p.fft_len>1024)?(pi.p.fft_len/1024):(pi.p.fft_len); + char symbol=(pi.p.fft_len>1024)?('k'):(' '); + fprintf(stderr,"Pulse: peak=%.7g, time=%.4g, period=%.4g, d_freq=%.12g, score=%.4g, chirp=%.5g, fft_len=%d%c\n", + pi.p.peak_power,(pi.p.time-swi.time_recorded)*86400,pi.p.period,pi.p.detection_freq,pi.score,pi.p.chirp_rate,fft,symbol); + } + retval = outfile.printf("%s", pi.p.print_xml(0,0,1).c_str()); + + if (retval >= 0) { + outfile.printf("\n"); + } + + if (retval < 0) { + SETIERROR(WRITE_FAILED,"in ReportPulseEvent"); + } else { + signal_count++; + pulse_count++; + } + + if (signal_count >= swi.analysis_cfg.max_signals) { + SETIERROR(RESULT_OVERFLOW,"in ReportPulseEvent"); + } + + } + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return(retval); +} + diff --git a/client/analyzeReport.h b/client/analyzeReport.h new file mode 100644 index 0000000..0340107 --- /dev/null +++ b/client/analyzeReport.h @@ -0,0 +1,105 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// Title : analyzeReport.h +// $Id: analyzeReport.h,v 1.8.2.3 2007/05/31 22:03:09 korpela Exp $ + +#include + +#include "seti.h" +#include "boinc_api.h" +#include "mfile.h" + +int ReportEvents( + float * fp_PowerSpectrum, + int ul_NumDataPoints, + int us_FFT, + double spike_sigma_thresh + ); + +int ReportGaussEvent( + int ul_TOffset, + float f_PeakPower, + float f_TrueMean, + float f_SumSq, + int ul_PoT, + float sigma, + float f_PoTMaxPower, + float fp_PoT[] + ); + +int ReportPulseEvent( + float PulsePower, + float MeanPower, + float PulsePeriod, + int time_bin, + int freq_bin, + float snr, + float thresh, + float *foldedPOT, + int scale, + int write + ); + +int ReportTripletEvent( + float PulsePower, + float MeanPower, + float PulsePeriod, + float mid_time_bin, + int start_time_bin, + int freq_bin, + int pot_len, + const float *PoT, + int write + ); + +int result_spike(SPIKE_INFO &si); + +int result_autocorr(AUTOCORR_INFO &ai); + +int result_gaussian(GAUSS_INFO &gi); + +void time_to_ra_dec(double time_jd, double *ra, double *dec); + +extern void reset_high_scores(); + +//extern void report_init(); +extern void reload_graphics_state(); + +extern SPIKE_INFO * best_spike; +extern AUTOCORR_INFO * best_autocorr; +extern GAUSS_INFO * best_gauss; +extern PULSE_INFO * best_pulse; +extern TRIPLET_INFO * best_triplet; +extern MFILE outfile; + +extern int signal_count; +extern int autocorr_count; +extern int spike_count; +extern int pulse_count; +extern int gaussian_count; +extern int triplet_count; diff --git a/client/app_icon.h b/client/app_icon.h new file mode 100644 index 0000000..384686e --- /dev/null +++ b/client/app_icon.h @@ -0,0 +1,2152 @@ +char MacAppIconData[] = { + 0X69,0X63,0X6E,0X73,0X00,0X00,0X86,0X53,0X69,0X63,0X73,0X23,0X00,0X00,0X00,0X48, + 0X02,0X00,0X05,0X00,0X08,0X80,0X15,0X40,0XED,0XB8,0X80,0X08,0XC0,0X18,0X6F,0XB0, + 0X3F,0XE0,0X1F,0XC0,0X0F,0X80,0X1F,0XC0,0X38,0XE0,0X17,0X40,0X2F,0XA0,0X7F,0XF0, + 0X02,0X00,0X07,0X00,0X0F,0X80,0X1F,0XC0,0XFF,0XF8,0XFF,0XF8,0XFF,0XF8,0X7F,0XF0, + 0X3F,0XE0,0X1F,0XC0,0X0F,0X80,0X1F,0XC0,0X3F,0XE0,0X1F,0XC0,0X3F,0XE0,0X7F,0XF0, + 0X69,0X63,0X73,0X34,0X00,0X00,0X00,0X88,0X00,0X00,0X00,0XF0,0X00,0X00,0X00,0X00, + 0X00,0X00,0X0F,0X1F,0X00,0X00,0X00,0X00,0X00,0X00,0XF1,0X11,0XF0,0X00,0X00,0X00, + 0X00,0X0F,0X1F,0X1F,0X1F,0X00,0X00,0X00,0XFF,0XF1,0XFF,0X1F,0XF1,0XFF,0XF0,0X00, + 0XF1,0X11,0X11,0X11,0X11,0X11,0XF0,0X00,0XF9,0X81,0X81,0X81,0X81,0X89,0XF0,0X00, + 0X0F,0X98,0X88,0X88,0X88,0X9F,0X00,0X00,0X00,0XF9,0X89,0X99,0X89,0XF0,0X00,0X00, + 0X00,0X0F,0XF9,0X99,0XFF,0X00,0X00,0X00,0X00,0X00,0XF9,0XF9,0XF0,0X00,0X00,0X00, + 0X00,0X0F,0XF9,0X99,0XFF,0X00,0X00,0X00,0X00,0XFF,0X98,0X88,0X9F,0XF0,0X00,0X00, + 0X00,0X0F,0X89,0XF9,0X8F,0X00,0X00,0X00,0X00,0XF8,0XFF,0X9F,0XF8,0XF0,0X00,0X00, + 0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X69,0X63,0X73,0X38,0X00,0X00,0X01,0X08, + 0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, + 0X00,0X00,0X00,0X00,0X00,0XFF,0X28,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, + 0X00,0X00,0X00,0X00,0XFF,0X28,0X28,0X28,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00, + 0X00,0X00,0X00,0XFF,0X71,0XFF,0X28,0XFF,0X71,0XFF,0X00,0X00,0X00,0X00,0X00,0X00, + 0XFF,0XFF,0XFF,0X71,0XFF,0XFF,0X28,0XFF,0XFF,0X71,0XFF,0XFF,0XFF,0X00,0X00,0X00, + 0XFF,0X28,0X28,0X28,0X28,0X28,0X28,0X28,0X28,0X28,0X28,0X28,0XFF,0X00,0X00,0X00, + 0XFF,0XE8,0X9B,0X71,0X9B,0X71,0X9B,0X71,0X9B,0X71,0X9B,0XE8,0XFF,0X00,0X00,0X00, + 0X00,0XFF,0XE6,0X9B,0XE4,0XE4,0XE4,0XE4,0XE4,0X9B,0XE6,0XFF,0X00,0X00,0X00,0X00, + 0X00,0X00,0XFF,0XE8,0XE4,0XE6,0XE6,0XE6,0XE4,0XE8,0XFF,0X00,0X00,0X00,0X00,0X00, + 0X00,0X00,0X00,0XFF,0XE9,0XE8,0XE8,0XE8,0XE9,0XFF,0X00,0X00,0X00,0X00,0X00,0X00, + 0X00,0X00,0X00,0X00,0XFF,0XE8,0XFF,0XE8,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00, + 0X00,0X00,0X00,0XFF,0XE9,0XE6,0XE6,0XE6,0XE9,0XFF,0X00,0X00,0X00,0X00,0X00,0X00, + 0X00,0X00,0XFF,0XE9,0XE6,0X9B,0X9B,0X9B,0XE6,0XE9,0XFF,0X00,0X00,0X00,0X00,0X00, + 0X00,0X00,0X00,0XFF,0X9B,0XE6,0XFF,0XE6,0X9B,0XFF,0X00,0X00,0X00,0X00,0X00,0X00, + 0X00,0X00,0XFF,0X9B,0XFF,0XFF,0XE6,0XFF,0XFF,0X9B,0XFF,0X00,0X00,0X00,0X00,0X00, + 0X00,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X00,0X00,0X00,0X00, + 0X49,0X43,0X4E,0X23,0X00,0X00,0X01,0X08,0XFF,0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88,0X88,0X88,0X88,0X81,0XFF,0XFF,0XEF, + 0XFC,0X66,0X69,0X18,0X98,0X98,0X98,0X98,0X98,0X98,0X98,0X98,0X89,0X66,0X66,0XEF, + 0XFC,0XFF,0XFF,0X89,0X89,0X89,0X89,0X89,0X89,0X89,0X89,0X89,0X8F,0XFF,0XFF,0XEF, + 0XFC,0X66,0X66,0X61,0X88,0X88,0X88,0X88,0X88,0X88,0X88,0X81,0X66,0X66,0X66,0XEF, + 0XFC,0XFF,0XFF,0XFF,0X89,0X99,0X99,0X99,0X99,0X99,0X99,0X8F,0XFF,0XFF,0XFF,0XEF, + 0XFC,0X66,0X66,0X66,0X68,0X99,0X99,0X99,0X99,0X99,0X98,0X66,0X66,0X66,0X66,0XEF, + 0XFD,0XFF,0XFF,0XFF,0XFF,0XF9,0X99,0X99,0X99,0X99,0XFF,0XFF,0XFF,0XFF,0XFF,0XEF, + 0XFD,0X66,0X66,0X6C,0X66,0X66,0X9F,0XFF,0XFF,0X96,0X66,0X66,0XC6,0X66,0X66,0XEF, + 0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0X99,0X99,0X99,0X9F,0XFF,0XFF,0XFF,0XFF,0XFF,0XEF, + 0XFD,0X66,0X66,0X66,0X66,0X66,0X69,0XF9,0XF9,0X66,0X66,0X66,0X66,0X66,0X66,0XEF, + 0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0XF9,0X9F,0X99,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XEF, + 0XFD,0X66,0XE6,0X66,0X66,0X66,0X99,0X99,0X99,0X96,0X66,0X66,0X66,0X6E,0X66,0XEF, + 0XFD,0XFF,0XFF,0XFF,0XFF,0XFF,0X89,0XFF,0XF9,0X8F,0XFF,0XFF,0XFF,0XFF,0XFF,0XEF, + 0XFD,0X66,0X66,0X66,0X66,0X68,0X9F,0X8F,0X8F,0X98,0X66,0X66,0X66,0X66,0X66,0XEF, + 0XFD,0XFF,0XFF,0XFF,0XFF,0X89,0XFF,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,0X91,0XF1,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XF1,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XF1,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0XB4,0X00,0X01,0XFF,0XFF,0XB8,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XB2,0X00,0X00,0X2A,0X81,0XFF,0X00,0X2A,0XA9, + 0X00,0X00,0X02,0X89,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XB1, + 0X00,0X01,0X38,0XEE,0X81,0XFF,0X01,0XEE,0X38,0XA8,0X00,0X03,0X04,0X07,0X04,0X03, + 0X86,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9C,0X00,0X80,0X01, + 0X8E,0X00,0X02,0X38,0XEE,0XF6,0X81,0XFF,0X02,0XF6,0XEE,0X38,0XA5,0X00,0X05,0X02, + 0X12,0X1C,0X24,0X17,0X08,0X86,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0X9C,0X00,0X03,0X0B,0X25,0X22,0X09,0X8C,0X00,0X03,0X37,0XE9,0XF1,0XF8,0X81, + 0XFA,0X03,0XF8,0XF1,0XE9,0X37,0XA3,0X00,0X07,0X03,0X0D,0X3B,0X6B,0X7A,0X57,0X1F, + 0X05,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9B,0X00,0X05, + 0X05,0X33,0X93,0X8C,0X30,0X02,0X8A,0X00,0X04,0X36,0XE4,0XEB,0XF2,0XEF,0X81,0XF4, + 0X04,0XEF,0XF2,0XEB,0XE4,0X36,0XA2,0X00,0X08,0X07,0X23,0X6D,0XB7,0XC8,0X9B,0X43, + 0X0B,0X02,0X84,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9B,0X00, + 0X05,0X05,0X4F,0XC1,0XB9,0X49,0X05,0X89,0X00,0X05,0X34,0XDC,0XE4,0XEA,0XE7,0X76, + 0X81,0XEC,0X05,0X76,0XE7,0XEA,0XE4,0XDC,0X34,0XA1,0X00,0X07,0X07,0X2B,0X82,0XCA, + 0XD9,0XB0,0X53,0X11,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X9B,0X00,0X05,0X01,0X20,0X5A,0X56,0X1A,0X03,0X88,0X00,0X06,0X32,0XD5,0XDC,0XE2, + 0XE0,0X72,0X00,0X81,0XE4,0X06,0X00,0X72,0XE0,0XE2,0XDC,0XD5,0X32,0XA0,0X00,0X07, + 0X02,0X1D,0X60,0XA3,0XB5,0X89,0X39,0X0A,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0X9C,0X00,0X02,0X07,0X06,0X08,0X89,0X00,0X07,0X30,0XCC,0XD3, + 0XD9,0XD7,0X6D,0X00,0X00,0X81,0XDB,0X07,0X00,0X00,0X6D,0XD7,0XD9,0XD3,0XCC,0X30, + 0X9F,0X00,0X07,0X01,0X0C,0X26,0X4D,0X58,0X3D,0X15,0X02,0X85,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XAA,0X00,0X05,0X2E,0XC4,0XCB,0XD0,0XCE,0X69, + 0X80,0X00,0X81,0XD2,0X80,0X00,0X05,0X69,0XCE,0XD0,0XCB,0XC4,0X2E,0X9F,0X00,0X05, + 0X01,0X06,0X10,0X12,0X0B,0X03,0X86,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0XA9,0X00,0X05,0X2C,0XBB,0XC1,0XC6,0XC4,0X64,0X81,0X00,0X81,0XC8,0X81, + 0X00,0X05,0X64,0XC4,0XC6,0XC1,0XBB,0X2C,0X9F,0X00,0X03,0X07,0X01,0X02,0X04,0X87, + 0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA8,0X00,0X05,0X2A,0XB2, + 0XB8,0XBE,0XBB,0X5F,0X82,0X00,0X81,0XBF,0X82,0X00,0X05,0X5F,0XBB,0XBE,0XB8,0XB2, + 0X2A,0XAC,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA7,0X00,0X05, + 0X28,0XAA,0XB0,0XB5,0XB2,0X5B,0X83,0X00,0X81,0XB6,0X83,0X00,0X05,0X5B,0XB2,0XB5, + 0XB0,0XAA,0X28,0XAB,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA6, + 0X00,0X05,0X26,0XA1,0XA7,0XAC,0XAA,0X54,0X84,0X00,0X81,0XAD,0X84,0X00,0X05,0X54, + 0XAA,0XAC,0XA7,0XA1,0X26,0XAA,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0X81,0X00,0X05,0X01,0X01,0X07,0X04,0X04,0X01,0X9B,0X00,0X05,0X24,0X99,0X9E, + 0XA3,0XA1,0X50,0X85,0X00,0X81,0XA4,0X85,0X00,0X05,0X50,0XA1,0XA3,0X9E,0X99,0X24, + 0XA9,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00,0X07,0X01, + 0X06,0X12,0X21,0X1E,0X11,0X04,0X01,0X99,0X00,0X05,0X22,0X91,0X96,0X9A,0X98,0X4B, + 0X86,0X00,0X81,0X9B,0X86,0X00,0X05,0X4B,0X98,0X9A,0X96,0X91,0X22,0XA8,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00,0X07,0X04,0X15,0X3B,0X5A, + 0X55,0X32,0X10,0X02,0X98,0X00,0X05,0X20,0X88,0X8D,0X91,0X8F,0X47,0X87,0X00,0X81, + 0X92,0X87,0X00,0X05,0X47,0X8F,0X91,0X8D,0X88,0X20,0XA7,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00,0X08,0X08,0X26,0X63,0X88,0X81,0X4F,0X1A, + 0X03,0X01,0X96,0X00,0X05,0X1E,0X7F,0X83,0X87,0X85,0X42,0X88,0X00,0X81,0X88,0X88, + 0X00,0X05,0X42,0X85,0X87,0X83,0X7F,0X1E,0XA6,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X0D,0XC3,0XB4,0X91,0X00,0X00,0X01,0X07,0X29,0X65,0X8B,0X83,0X51,0X1B,0X04,0X96, + 0X00,0X05,0X1C,0X77,0X7B,0X7E,0X7D,0X3E,0X89,0X00,0X81,0X7F,0X89,0X00,0X05,0X3E, + 0X7D,0X7E,0X7B,0X77,0X1C,0XA5,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0X80,0X00,0X07,0X04,0X1A,0X43,0X61,0X59,0X33,0X10,0X04,0X95,0X00,0X05,0X1A, + 0X6E,0X72,0X75,0X74,0X39,0X8A,0X00,0X81,0X76,0X8A,0X00,0X05,0X39,0X74,0X75,0X72, + 0X6E,0X1A,0XA4,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00, + 0X07,0X01,0X08,0X18,0X25,0X22,0X12,0X04,0X01,0X94,0X00,0X05,0X18,0X67,0X6A,0X6D, + 0X6C,0X35,0X8B,0X00,0X81,0X6E,0X8B,0X00,0X05,0X35,0X6C,0X6D,0X6A,0X67,0X18,0XA3, + 0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X05,0X01,0X05, + 0X06,0X07,0X02,0X01,0X94,0X00,0X05,0X16,0X5F,0X62,0X65,0X64,0X32,0X8C,0X00,0X81, + 0X66,0X8C,0X00,0X05,0X32,0X64,0X65,0X62,0X5F,0X16,0XA2,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X82,0X00,0X00,0X01,0X97,0X00,0X05,0X15,0X5A,0X5D, + 0X5F,0X5E,0X2F,0X8D,0X00,0X81,0X60,0X8D,0X00,0X05,0X2F,0X5E,0X5F,0X5D,0X5A,0X15, + 0XA1,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0XD6,0XFF, + 0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X00,0XCB, + 0XD4,0XCC,0X00,0XCB,0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X89,0X00,0X02,0XC5,0XCC,0XB8,0XD0,0XB7,0X02,0XB8,0XCC,0XC5,0X8C,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X02,0XB4,0XC8,0X9E,0XD0,0X99, + 0X02,0X9E,0XC8,0XB4,0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X89,0X00,0X02,0X9E,0XC4,0X88,0XD0,0X79,0X02,0X88,0XC4,0X9E,0X8C,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X02,0X82,0XBF,0X7B,0XD0,0X5B, + 0X02,0X7B,0XBF,0X82,0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X89,0X00,0X02,0X65,0XBA,0X75,0XD0,0X3A,0X02,0X75,0XBA,0X65,0X8C,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X02,0X44,0XB4,0X7A,0XD0,0X1B, + 0X02,0X7A,0XB4,0X44,0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X89,0X00,0X03,0X21,0XAB,0X8D,0X06,0X81,0X04,0X00,0X02,0X84,0X04,0X00,0X02,0X84, + 0X04,0X00,0X02,0X84,0X04,0X00,0X02,0X84,0X04,0X00,0X02,0X84,0X04,0X00,0X02,0X84, + 0X04,0X00,0X02,0X84,0X04,0X00,0X02,0X84,0X04,0X00,0X02,0X84,0X04,0X00,0X02,0X81, + 0X04,0X03,0X06,0X8D,0XAB,0X21,0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X8A,0X00,0X02,0X7E,0XA6,0X28,0XCE,0X00,0X02,0X28,0XA6,0X7E,0X8D,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8A,0X00,0X02,0X52,0X9F,0X4D, + 0XCE,0X00,0X02,0X4D,0X9F,0X52,0X8D,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X8A,0X00,0X03,0X28,0X97,0X70,0X01,0XCC,0X00,0X03,0X01,0X70,0X97,0X28, + 0X8D,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8B,0X00,0X02,0X65, + 0X91,0X1A,0XCC,0X00,0X02,0X1A,0X91,0X65,0X8E,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0X8B,0X00,0X02,0X36,0X89,0X3F,0XCC,0X00,0X02,0X3F,0X89,0X36, + 0X8E,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8B,0X00,0X03,0X0A, + 0X60,0X78,0X13,0XCA,0X00,0X03,0X22,0X78,0X60,0X0A,0X8E,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X8C,0X00,0X02,0X31,0X7B,0X4A,0XCA,0X00,0X02,0X4A, + 0X7B,0X31,0X8F,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8C,0X00, + 0X03,0X05,0X4D,0X6D,0X1E,0XC8,0X00,0X03,0X1E,0X6D,0X4D,0X05,0X8F,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8D,0X00,0X03,0X1F,0X61,0X47,0X09,0XC6, + 0X00,0X03,0X09,0X47,0X61,0X1F,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X8E,0X00,0X02,0X32,0X66,0X34,0XC6,0X00,0X02,0X34,0X66,0X32,0X91,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8E,0X00,0X03,0X07,0X3D,0X58, + 0X22,0XC4,0X00,0X03,0X22,0X58,0X3D,0X07,0X91,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0X8F,0X00,0X03,0X12,0X44,0X47,0X15,0XC2,0X00,0X03,0X15,0X47, + 0X44,0X12,0X92,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X90,0X00, + 0X03,0X18,0X44,0X39,0X0D,0XC0,0X00,0X03,0X0D,0X39,0X44,0X18,0X93,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X91,0X00,0X03,0X1A,0X40,0X30,0X0A,0XBE, + 0X00,0X03,0X0A,0X30,0X40,0X1A,0X94,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X92,0X00,0X03,0X19,0X3A,0X2A,0X09,0XBC,0X00,0X03,0X09,0X2A,0X3A,0X19, + 0X95,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X93,0X00,0X03,0X14, + 0X30,0X27,0X0B,0XBA,0X00,0X03,0X0B,0X27,0X30,0X14,0X96,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X94,0X00,0X03,0X0F,0X27,0X25,0X0D,0XB8,0X00,0X03, + 0X0D,0X25,0X27,0X0F,0X97,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X95,0X00,0X03,0X08,0X1C,0X25,0X11,0XB6,0X00,0X03,0X11,0X25,0X1C,0X08,0X98,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X96,0X00,0X04,0X02,0X12,0X20, + 0X14,0X04,0XB2,0X00,0X04,0X04,0X14,0X20,0X12,0X02,0X99,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X98,0X00,0X03,0X09,0X15,0X10,0X03,0XB0,0X00,0X03, + 0X03,0X10,0X15,0X09,0X9B,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X99,0X00,0X04,0X02,0X0A,0X11,0X08,0X01,0XAC,0X00,0X09,0X01,0X08,0X11,0X0A,0X02, + 0X00,0X01,0X00,0X00,0X01,0X97,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0X9B,0X00,0X04,0X03,0X09,0X0D,0X09,0X03,0XA8,0X00,0X07,0X03,0X09,0X0D,0X09, + 0X03,0X01,0X00,0X00,0X81,0X01,0X97,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X9D,0X00,0X04,0X02,0X06,0X09,0X07,0X02,0XA4,0X00,0X11,0X02,0X07,0X09, + 0X06,0X02,0X00,0X01,0X01,0X00,0X03,0X02,0X02,0X01,0X01,0X03,0X01,0X00,0X01,0X93, + 0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9F,0X00,0X04,0X01,0X03, + 0X04,0X05,0X03,0XA0,0X00,0X13,0X03,0X05,0X04,0X03,0X01,0X01,0X00,0X00,0X02,0X02, + 0X03,0X03,0X06,0X05,0X05,0X04,0X03,0X01,0X01,0X02,0X93,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0XA2,0X00,0X00,0X01,0X80,0X02,0X00,0X01,0X9A,0X00, + 0X00,0X01,0X80,0X02,0X00,0X01,0X81,0X00,0X05,0X01,0X01,0X03,0X03,0X06,0X08,0X80, + 0X09,0X06,0X07,0X05,0X03,0X02,0X01,0X02,0X01,0X91,0X00,0X02,0X67,0X48,0X30,0X83, + 0X00,0X02,0XC3,0XB4,0X91,0XCC,0X00,0X10,0X01,0X02,0X03,0X06,0X09,0X0C,0X0F,0X11, + 0X11,0X0F,0X0C,0X0B,0X06,0X04,0X01,0X00,0X01,0X91,0X00,0X02,0X67,0X48,0X30,0X83, + 0X00,0X02,0XC3,0XB4,0X91,0XAA,0X00,0X03,0X01,0X02,0X01,0X02,0X81,0X01,0X84,0X00, + 0X81,0X01,0X03,0X02,0X01,0X02,0X01,0X86,0X00,0X12,0X01,0X01,0X02,0X02,0X04,0X09, + 0X0E,0X13,0X1D,0X21,0X22,0X1C,0X18,0X10,0X0B,0X08,0X03,0X02,0X01,0X91,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XCB,0X00,0X11,0X01,0X03,0X03,0X08, + 0X0D,0X14,0X1F,0X36,0X47,0X51,0X40,0X2B,0X19,0X0F,0X09,0X05,0X00,0X02,0X91,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XCC,0X00,0X11,0X02,0X06,0X0A, + 0X12,0X1C,0X39,0X66,0X96,0XA3,0X83,0X4B,0X27,0X15,0X0E,0X09,0X03,0X01,0X01,0X90, + 0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XCA,0X00,0X13,0X01,0X01, + 0X03,0X06,0X0C,0X14,0X25,0X4A,0X97,0XD1,0XDD,0XBC,0X6E,0X34,0X1E,0X0F,0X09,0X05, + 0X02,0X02,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XCC,0X00, + 0X11,0X03,0X07,0X0E,0X18,0X29,0X56,0XA4,0XDD,0XE8,0XCB,0X7B,0X38,0X1F,0X11,0X09, + 0X05,0X03,0X02,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XCA, + 0X00,0X13,0X02,0X02,0X03,0X06,0X0D,0X15,0X25,0X49,0X86,0XBE,0XCB,0XA9,0X66,0X32, + 0X1A,0X12,0X09,0X04,0X03,0X01,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0XCB,0X00,0X11,0X02,0X01,0X07,0X0B,0X14,0X1F,0X33,0X52,0X74,0X7D,0X64, + 0X40,0X25,0X1A,0X0F,0X09,0X03,0X01,0X91,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02, + 0XC3,0XB4,0X91,0X86,0X00,0X0E,0X01,0X00,0X00,0X01,0X00,0X02,0X01,0X01,0X02,0X01, + 0X02,0X02,0X01,0X01,0X02,0X80,0X01,0XB0,0X00,0X12,0X01,0X02,0X04,0X09,0X0F,0X18, + 0X21,0X2E,0X3B,0X3E,0X36,0X2A,0X1D,0X14,0X0C,0X07,0X03,0X00,0X02,0X90,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X84,0X00,0X03,0X01,0X01,0X00,0X03, + 0X80,0X02,0X04,0X01,0X00,0X00,0X01,0X02,0X80,0X00,0X03,0X01,0X01,0X02,0X01,0XB1, + 0X00,0X12,0X01,0X02,0X03,0X06,0X0B,0X11,0X17,0X22,0X23,0X24,0X26,0X1B,0X14,0X0F, + 0X08,0X05,0X03,0X02,0X01,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0X83,0X00,0X10,0X01,0X01,0X02,0X03,0X03,0X04,0X03,0X03,0X04,0X03,0X00,0X02, + 0X01,0X00,0X00,0X01,0X01,0XB3,0X00,0X11,0X01,0X02,0X01,0X02,0X05,0X07,0X0B,0X0F, + 0X14,0X16,0X15,0X15,0X11,0X0E,0X09,0X06,0X03,0X02,0X92,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X05,0X01,0X01,0X02,0X03,0X04,0X07,0X80, + 0X08,0X03,0X07,0X05,0X04,0X02,0X80,0X01,0X80,0X00,0X00,0X01,0XB4,0X00,0X0E,0X02, + 0X01,0X01,0X04,0X06,0X08,0X0C,0X0D,0X0C,0X0C,0X09,0X07,0X04,0X04,0X03,0X93,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X0E,0X03,0X01,0X04, + 0X07,0X0B,0X0D,0X0E,0X10,0X10,0X0D,0X0B,0X07,0X04,0X03,0X01,0XBA,0X00,0X04,0X02, + 0X01,0X03,0X04,0X05,0X80,0X06,0X05,0X07,0X06,0X03,0X03,0X01,0X01,0X86,0X00,0X00, + 0X01,0X89,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X10, + 0X01,0X04,0X07,0X0B,0X0F,0X16,0X18,0X1A,0X19,0X16,0X12,0X0E,0X08,0X05,0X03,0X00, + 0X01,0XBB,0X00,0X01,0X02,0X02,0X83,0X03,0X00,0X02,0X87,0X00,0X05,0X01,0X05,0X06, + 0X07,0X04,0X01,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X17,0XC3,0XB4,0X91,0X00, + 0X00,0X01,0X02,0X02,0X05,0X08,0X10,0X16,0X1F,0X25,0X28,0X25,0X22,0X1B,0X14,0X0B, + 0X08,0X05,0X02,0X01,0XBB,0X00,0X0A,0X01,0X02,0X01,0X02,0X01,0X01,0X00,0X01,0X00, + 0X01,0X01,0X84,0X00,0X07,0X01,0X03,0X0E,0X21,0X27,0X1A,0X09,0X02,0X84,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X17,0XC3,0XB4,0X91,0X00,0X00,0X01,0X00,0X04,0X06,0X0D, + 0X16,0X1F,0X29,0X33,0X37,0X34,0X2D,0X24,0X1A,0X10,0X09,0X06,0X03,0X01,0XBC,0X00, + 0X01,0X01,0X01,0X81,0X00,0X01,0X02,0X01,0X86,0X00,0X08,0X01,0X0E,0X30,0X5B,0X68, + 0X49,0X1B,0X05,0X03,0X83,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X16,0XC3,0XB4,0X91, + 0X00,0X01,0X01,0X02,0X04,0X08,0X11,0X1A,0X28,0X3B,0X6F,0X8C,0X5A,0X39,0X2B,0X20, + 0X14,0X0C,0X06,0X03,0XBD,0X00,0X00,0X01,0X8D,0X00,0X08,0X04,0X19,0X51,0X89,0X95, + 0X75,0X30,0X0A,0X01,0X83,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X17,0XC3,0XB4,0X91, + 0X00,0X00,0X01,0X03,0X06,0X09,0X12,0X1D,0X2D,0X5D,0XC3,0XE6,0X99,0X40,0X2F,0X23, + 0X17,0X0C,0X06,0X04,0X01,0X93,0X00,0X02,0X03,0X0E,0X05,0X93,0X00,0X02,0X04,0X0E, + 0X03,0X9B,0X00,0X08,0X04,0X1B,0X56,0X8D,0X99,0X7A,0X36,0X08,0X03,0X83,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X03,0XC3,0XB4,0X91,0X00,0X80,0X01,0X10,0X05,0X0A,0X11, + 0X1B,0X2A,0X5C,0XC1,0XE4,0X96,0X3F,0X30,0X22,0X16,0X0D,0X07,0X03,0X01,0X92,0X00, + 0X03,0X08,0X22,0X0B,0X04,0X93,0X00,0X03,0X0E,0X0E,0X22,0X09,0X99,0X00,0X08,0X01, + 0X03,0X0F,0X39,0X66,0X72,0X53,0X20,0X07,0X84,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0X81,0X00,0X10,0X04,0X08,0X10,0X1A,0X25,0X3B,0X6C,0X89,0X57, + 0X38,0X2A,0X1F,0X13,0X0B,0X06,0X03,0X01,0X91,0X00,0X05,0X0D,0X39,0X12,0X07,0X3B, + 0X0E,0X91,0X00,0X05,0X1A,0X38,0X07,0X10,0X39,0X0E,0X99,0X00,0X06,0X01,0X04,0X12, + 0X28,0X2F,0X20,0X0A,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X16,0XC3,0XB4,0X91, + 0X00,0X00,0X01,0X02,0X03,0X07,0X0C,0X13,0X1D,0X28,0X30,0X34,0X30,0X2C,0X23,0X18, + 0X11,0X09,0X05,0X01,0X91,0X00,0X07,0X12,0X51,0X1A,0X00,0X00,0X14,0X54,0X14,0X8F, + 0X00,0X07,0X24,0X4F,0X0A,0X00,0X00,0X17,0X51,0X14,0X9A,0X00,0X04,0X03,0X07,0X0A, + 0X05,0X04,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00, + 0X0E,0X03,0X05,0X0A,0X10,0X16,0X1D,0X22,0X25,0X24,0X20,0X1A,0X13,0X0B,0X08,0X03, + 0X91,0X00,0X02,0X16,0X65,0X21,0X81,0X00,0X02,0X19,0X69,0X19,0X8D,0X00,0X02,0X2E, + 0X63,0X0D,0X81,0X00,0X02,0X1D,0X65,0X19,0X9B,0X00,0X00,0X01,0X87,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X10,0X02,0X03,0X05,0X09,0X0E, + 0X11,0X16,0X19,0X18,0X15,0X10,0X0C,0X07,0X04,0X02,0X01,0X01,0X8E,0X00,0X02,0X1C, + 0X7D,0X29,0X83,0X00,0X02,0X1E,0X82,0X1E,0X8B,0X00,0X02,0X38,0X7A,0X0F,0X83,0X00, + 0X02,0X24,0X7D,0X1E,0XA5,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X81,0X00,0X0E,0X01,0X01,0X04,0X05,0X07,0X0B,0X0D,0X0D,0X0E,0X0C,0X09,0X07,0X05, + 0X03,0X02,0X8F,0X00,0X02,0X21,0X93,0X30,0X85,0X00,0X02,0X24,0X9A,0X24,0X89,0X00, + 0X02,0X42,0X8E,0X12,0X85,0X00,0X02,0X2A,0X93,0X24,0XA4,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X0F,0X02,0X02,0X01,0X03,0X04,0X07,0X07, + 0X09,0X09,0X06,0X06,0X04,0X03,0X02,0X02,0X01,0X8D,0X00,0X02,0X26,0XA7,0X36,0X87, + 0X00,0X02,0X2A,0XAE,0X2A,0X87,0X00,0X02,0X4B,0XA1,0X15,0X87,0X00,0X02,0X30,0XAB, + 0X2A,0XA3,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X83,0X00,0X80, + 0X01,0X80,0X04,0X80,0X03,0X02,0X02,0X00,0X02,0X8E,0X00,0X02,0X29,0XB6,0X3B,0X89, + 0X00,0X02,0X2D,0XBD,0X2D,0X85,0X00,0X02,0X52,0XAE,0X16,0X89,0X00,0X02,0X34,0XBA, + 0X2D,0XA2,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X83,0X00,0X01, + 0X02,0X00,0X80,0X01,0X05,0X02,0X02,0X01,0X00,0X00,0X01,0X8E,0X00,0X02,0X29,0XB6, + 0X3B,0X8B,0X00,0X02,0X2D,0XBD,0X2D,0X83,0X00,0X02,0X52,0XAE,0X16,0X8B,0X00,0X02, + 0X34,0XBA,0X2D,0XA1,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X83, + 0X00,0X00,0X01,0X84,0X00,0X00,0X01,0X8F,0X00,0X02,0X29,0XB6,0X3B,0X8D,0X00,0X02, + 0X2D,0XBD,0X2D,0X81,0X00,0X02,0X52,0XAE,0X16,0X8D,0X00,0X02,0X34,0XBA,0X2D,0XA0, + 0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9D,0X00,0X02,0X29,0XB6, + 0X3B,0X8F,0X00,0X07,0X2D,0XBD,0X2D,0X00,0X00,0X52,0XAE,0X16,0X8F,0X00,0X02,0X34, + 0XBA,0X2D,0X9F,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9D,0X00, + 0X01,0X94,0X3B,0X91,0X00,0X05,0X2D,0X61,0X00,0X0F,0XA7,0X16,0X91,0X00,0X02,0X34, + 0XAA,0X04,0X9E,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XB4,0X9B,0X75,0XCE,0X67, + 0X00,0X69,0X9F,0X67,0X02,0X59,0X3F,0X30,0X83,0X00,0X02,0X8E,0X6C,0X55,0XAA,0X48, + 0X04,0X47,0X46,0X46,0X47,0X47,0XBF,0X48,0X02,0X3F,0X30,0X30,0X83,0X00,0X02,0X69, + 0X4D,0X37,0XA9,0X30,0X06,0X2F,0X2A,0X25,0X22,0X26,0X2B,0X2F,0XC1,0X30,0XFF,0X00, + 0XFF,0X00,0XFF,0X00,0XA2,0X00,0X02,0X06,0X22,0X2F,0X81,0X4A,0X01,0X36,0X0C,0X83, + 0X00,0X01,0X09,0X16,0X83,0X1B,0X82,0X00,0X8A,0X1B,0X83,0X00,0X80,0X4A,0X83,0X00, + 0X16,0X06,0X0F,0X19,0X24,0X2E,0X38,0X43,0X4D,0X56,0X5C,0X5C,0X5F,0X63,0X68,0X6D, + 0X73,0X78,0X7D,0X82,0X88,0X8D,0X92,0X96,0X81,0X99,0X00,0X46,0XA7,0X00,0X02,0X06, + 0X2F,0X5F,0X84,0X66,0X00,0X26,0X82,0X00,0X02,0X12,0X41,0X5F,0X83,0X66,0X82,0X00, + 0X8A,0X66,0X83,0X00,0X80,0X66,0X83,0X00,0X16,0X0A,0X19,0X2A,0X3C,0X4D,0X5D,0X6F, + 0X80,0X8F,0X99,0X99,0X9E,0XA5,0XAD,0XB6,0XBF,0XC8,0XD0,0XD9,0XE2,0XEB,0XF3,0XFA, + 0X80,0XFF,0X01,0XA7,0X05,0XA6,0X00,0X01,0X06,0X52,0X80,0X66,0X01,0X4A,0X37,0X80, + 0X2F,0X01,0X3D,0X28,0X81,0X00,0X02,0X08,0X40,0X5D,0X84,0X66,0X82,0X00,0X8A,0X66, + 0X83,0X00,0X80,0X66,0X83,0X00,0X1A,0X0A,0X19,0X2A,0X3C,0X4D,0X5D,0X6F,0X80,0X8F, + 0X99,0X99,0X9E,0XA5,0XAD,0XB6,0XBF,0XC8,0XD0,0XD9,0XE2,0XEB,0XF3,0XFA,0XFF,0XFF, + 0XA7,0X05,0XA7,0X00,0X04,0X44,0X66,0X66,0X44,0X06,0X88,0X00,0X04,0X16,0X5D,0X66, + 0X60,0X06,0X8C,0X00,0X02,0X4A,0X66,0X66,0X91,0X00,0X19,0X0A,0X19,0X2A,0X3C,0X4D, + 0X5D,0X6F,0X80,0X8F,0X99,0X99,0X9E,0XA5,0XAD,0XB6,0XBF,0XC8,0XD0,0XD9,0XE2,0XEB, + 0XF3,0XFA,0XFF,0XA7,0X05,0XA7,0X00,0X03,0X0D,0X66,0X66,0X4A,0X8A,0X00,0X03,0X1A, + 0X65,0X66,0X39,0X8D,0X00,0X02,0X4A,0X66,0X66,0X91,0X00,0X18,0X0A,0X19,0X2A,0X3C, + 0X4D,0X5D,0X6F,0X80,0X8F,0X99,0X99,0X9E,0XA5,0XAD,0XB6,0XBF,0XC8,0XD0,0XD9,0XE2, + 0XEB,0XF3,0XFA,0XA7,0X05,0XA8,0X00,0X03,0X2F,0X66,0X66,0X22,0X8A,0X00,0X03,0X1B, + 0X66,0X66,0X2F,0X8D,0X00,0X02,0X4A,0X66,0X66,0X91,0X00,0X17,0X0A,0X19,0X2A,0X3C, + 0X4D,0X5D,0X6F,0X80,0X8F,0X99,0X99,0X9E,0XA5,0XAD,0XB6,0XBF,0XC8,0XD0,0XD9,0XE2, + 0XEB,0XF3,0XA4,0X05,0XA9,0X00,0X03,0X2F,0X66,0X66,0X1B,0X8A,0X00,0X03,0X1B,0X66, + 0X66,0X2F,0X8D,0X00,0X02,0X4A,0X66,0X66,0X88,0X00,0X02,0X37,0X4A,0X4A,0X83,0X00, + 0X16,0X02,0X05,0X08,0X0C,0X10,0X13,0X16,0X1A,0X1D,0X1F,0X1F,0X37,0XA5,0XAD,0XB6, + 0XBF,0XC8,0XD0,0XD9,0XE2,0XEB,0X9F,0X05,0X98,0X00,0X01,0X03,0X09,0X8D,0X00,0X03, + 0X28,0X66,0X66,0X3D,0X8A,0X00,0X03,0X1B,0X66,0X66,0X2F,0X8D,0X00,0X02,0X4A,0X66, + 0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X0A,0X1D,0XA5,0XAD,0XB6,0XBF,0XC8, + 0XD0,0XD9,0XE2,0X9A,0X05,0X98,0X00,0X02,0X03,0X6C,0X1D,0X8D,0X00,0X00,0X0D,0X80, + 0X66,0X00,0X2F,0X89,0X00,0X03,0X1B,0X66,0X66,0X2F,0X8D,0X00,0X02,0X4A,0X66,0X66, + 0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X09,0X1D,0XA5,0XAD,0XB6,0XBF,0XC8,0XD0, + 0XD9,0X94,0X05,0X98,0X00,0X03,0X04,0X71,0XA5,0X1D,0X8E,0X00,0X00,0X37,0X80,0X66, + 0X01,0X4A,0X1B,0X87,0X00,0X03,0X1B,0X66,0X66,0X2F,0X8D,0X00,0X02,0X4A,0X66,0X66, + 0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X08,0X1D,0XA5,0XAD,0XB6,0XBF,0XC8,0XD0, + 0X8E,0X04,0X98,0X00,0X04,0X04,0X77,0XAD,0XA5,0X1D,0X8F,0X00,0X00,0X3D,0X81,0X66, + 0X01,0X4A,0X1B,0X85,0X00,0X03,0X1B,0X66,0X66,0X59,0X83,0X4A,0X87,0X00,0X02,0X4A, + 0X66,0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X07,0X1D,0XA5,0XAD,0XB6,0XBF, + 0XC8,0X88,0X04,0X98,0X00,0X05,0X04,0X7D,0XB6,0XAD,0XA5,0X1D,0X90,0X00,0X01,0X28, + 0X5F,0X81,0X66,0X01,0X3D,0X06,0X83,0X00,0X00,0X1B,0X86,0X66,0X87,0X00,0X02,0X4A, + 0X66,0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X06,0X1D,0XA5,0XAD,0XB6,0XBF, + 0X83,0X04,0X98,0X00,0X06,0X04,0X83,0XBF,0XB6,0XAD,0XA5,0X1D,0X91,0X00,0X02,0X06, + 0X2F,0X5F,0X80,0X66,0X01,0X5F,0X13,0X82,0X00,0X03,0X1B,0X66,0X66,0X4A,0X83,0X2F, + 0X87,0X00,0X02,0X4A,0X66,0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X05,0X1D, + 0XA5,0XAD,0XB6,0X7D,0X04,0X98,0X00,0X07,0X04,0X88,0XC8,0XBF,0XB6,0XAD,0XA5,0X1D, + 0X93,0X00,0X06,0X06,0X2F,0X5F,0X66,0X66,0X5F,0X06,0X81,0X00,0X03,0X1B,0X66,0X66, + 0X2F,0X8D,0X00,0X02,0X4A,0X66,0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X04, + 0X1D,0XA5,0XAD,0X77,0X04,0X98,0X00,0X08,0X04,0X8E,0XD0,0XC8,0XBF,0XB6,0XAD,0XA5, + 0X1D,0X95,0X00,0X04,0X0D,0X52,0X66,0X66,0X3D,0X81,0X00,0X03,0X1B,0X66,0X66,0X2F, + 0X8D,0X00,0X02,0X4A,0X66,0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X03,0X1D, + 0XA5,0X71,0X04,0X98,0X00,0X09,0X05,0X94,0XD9,0XD0,0XC8,0XBF,0XB6,0XAD,0XA5,0X1D, + 0X96,0X00,0X03,0X0D,0X66,0X66,0X59,0X81,0X00,0X03,0X1B,0X66,0X66,0X2F,0X8D,0X00, + 0X02,0X4A,0X66,0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X02,0X1D,0X6C,0X03, + 0X98,0X00,0X0A,0X05,0X9A,0XE2,0XD9,0XD0,0XC8,0XBF,0XB6,0XAD,0XA5,0X1D,0X97,0X00, + 0X02,0X52,0X66,0X66,0X81,0X00,0X03,0X1B,0X66,0X66,0X2F,0X8D,0X00,0X02,0X4A,0X66, + 0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0X8E,0X00,0X01,0X09,0X03,0X98,0X00,0X16,0X05, + 0X9F,0XEB,0XE2,0XD9,0XD0,0XC8,0XBF,0XB6,0XAD,0XA5,0X37,0X1F,0X1F,0X1D,0X1A,0X16, + 0X13,0X10,0X0C,0X08,0X05,0X02,0X8C,0X00,0X02,0X4A,0X66,0X66,0X81,0X00,0X03,0X1B, + 0X66,0X66,0X2F,0X8D,0X00,0X02,0X4A,0X66,0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0XAA, + 0X00,0X17,0X05,0XA4,0XF3,0XEB,0XE2,0XD9,0XD0,0XC8,0XBF,0XB6,0XAD,0XA5,0X9E,0X99, + 0X99,0X8F,0X80,0X6F,0X5D,0X4D,0X3C,0X2A,0X19,0X0A,0X8B,0X00,0X03,0X06,0X66,0X66, + 0X44,0X81,0X00,0X03,0X1B,0X66,0X66,0X2F,0X8D,0X00,0X02,0X4A,0X66,0X66,0X88,0X00, + 0X02,0X4A,0X66,0X66,0XA9,0X00,0X18,0X05,0XA7,0XFA,0XF3,0XEB,0XE2,0XD9,0XD0,0XC8, + 0XBF,0XB6,0XAD,0XA5,0X9E,0X99,0X99,0X8F,0X80,0X6F,0X5D,0X4D,0X3C,0X2A,0X19,0X0A, + 0X8A,0X00,0X04,0X06,0X52,0X66,0X66,0X1B,0X81,0X00,0X03,0X1A,0X65,0X66,0X44,0X8D, + 0X00,0X02,0X4A,0X66,0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0XA8,0X00,0X19,0X05,0XA7, + 0XFF,0XFA,0XF3,0XEB,0XE2,0XD9,0XD0,0XC8,0XBF,0XB6,0XAD,0XA5,0X9E,0X99,0X99,0X8F, + 0X80,0X6F,0X5D,0X4D,0X3C,0X2A,0X19,0X0A,0X82,0X00,0X00,0X1B,0X81,0X00,0X06,0X13, + 0X22,0X37,0X5F,0X66,0X66,0X36,0X82,0X00,0X04,0X11,0X5A,0X66,0X66,0X24,0X82,0X1B, + 0X87,0X00,0X02,0X4A,0X66,0X66,0X88,0X00,0X02,0X4A,0X66,0X66,0XA7,0X00,0X1A,0X05, + 0XA7,0XFF,0XFF,0XFA,0XF3,0XEB,0XE2,0XD9,0XD0,0XC8,0XBF,0XB6,0XAD,0XA5,0X9E,0X99, + 0X99,0X8F,0X80,0X6F,0X5D,0X4D,0X3C,0X2A,0X19,0X0A,0X82,0X00,0X86,0X66,0X01,0X5F, + 0X2F,0X83,0X00,0X02,0X04,0X3A,0X5A,0X84,0X66,0X87,0X00,0X02,0X4A,0X66,0X66,0X88, + 0X00,0X02,0X4A,0X66,0X66,0XA6,0X00,0X01,0X05,0XA7,0X80,0XFF,0X16,0XFA,0XF3,0XEB, + 0XE2,0XD9,0XD0,0XC8,0XBF,0XB6,0XAD,0XA5,0X9E,0X99,0X99,0X8F,0X80,0X6F,0X5D,0X4D, + 0X3C,0X2A,0X19,0X0A,0X82,0X00,0X00,0X5F,0X83,0X66,0X02,0X52,0X2F,0X06,0X85,0X00, + 0X02,0X10,0X40,0X5F,0X83,0X66,0X87,0X00,0X02,0X4A,0X66,0X66,0X88,0X00,0X02,0X4A, + 0X66,0X66,0XA6,0X00,0X00,0X46,0X81,0X99,0X16,0X96,0X92,0X8D,0X88,0X82,0X7D,0X78, + 0X73,0X6D,0X68,0X63,0X5F,0X5C,0X5C,0X56,0X4D,0X43,0X38,0X2E,0X24,0X19,0X0F,0X06, + 0X83,0X00,0X00,0X13,0X80,0X1B,0X00,0X13,0XFF,0X00,0XFF,0X00,0XCF,0X00,0XFF,0X00, + 0XFF,0X00,0XFC,0X00,0X02,0XE9,0XE2,0XCE,0XF1,0XC3,0X02,0XB4,0X8E,0X69,0X83,0X00, + 0X02,0XE2,0XDD,0XC6,0XF1,0XB4,0X02,0X9B,0X6C,0X4D,0X83,0X00,0X02,0XCE,0XC6,0XA8, + 0XF1,0X91,0X02,0X75,0X55,0X37,0X83,0X00,0X02,0XC3,0XB4,0X91,0XF1,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XF1,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0XF1,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0XB4,0X00,0X01,0XFF,0XFF,0XB8,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0XB2,0X00,0X00,0X2A,0X81,0XFF,0X00,0X2A,0XA9,0X00,0X00,0X02,0X89,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XB1,0X00,0X01,0X38,0XEE,0X81,0XFF, + 0X01,0XEE,0X38,0XA8,0X00,0X03,0X04,0X07,0X04,0X03,0X86,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X9C,0X00,0X80,0X01,0X8E,0X00,0X02,0X38,0XEE,0XF6, + 0X81,0XFF,0X02,0XF6,0XEE,0X38,0XA5,0X00,0X05,0X02,0X12,0X1C,0X24,0X17,0X08,0X86, + 0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9C,0X00,0X03,0X0B,0X25, + 0X22,0X09,0X8C,0X00,0X03,0X38,0XED,0XF5,0XFC,0X81,0XFE,0X03,0XFC,0XF5,0XED,0X38, + 0XA3,0X00,0X07,0X03,0X0D,0X3B,0X6B,0X7A,0X57,0X1F,0X05,0X85,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9B,0X00,0X05,0X05,0X33,0X93,0X8C,0X30,0X02, + 0X8A,0X00,0X04,0X37,0XEB,0XF3,0XFA,0XF7,0X81,0XFC,0X04,0XF7,0XFA,0XF3,0XEB,0X37, + 0XA2,0X00,0X08,0X07,0X23,0X6D,0XB7,0XC8,0X9B,0X43,0X0B,0X02,0X84,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9B,0X00,0X05,0X05,0X4F,0XC1,0XB9,0X49, + 0X05,0X89,0X00,0X05,0X37,0XE9,0XF1,0XF8,0XF5,0X7D,0X81,0XFA,0X05,0X7D,0XF5,0XF8, + 0XF1,0XE9,0X37,0XA1,0X00,0X07,0X07,0X2B,0X82,0XCA,0XD9,0XB0,0X53,0X11,0X85,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9B,0X00,0X05,0X01,0X20,0X5A, + 0X56,0X1A,0X03,0X88,0X00,0X06,0X36,0XE7,0XEE,0XF5,0XF2,0X7B,0X00,0X81,0XF7,0X06, + 0X00,0X7B,0XF2,0XF5,0XEE,0XE7,0X36,0XA0,0X00,0X07,0X02,0X1D,0X60,0XA3,0XB5,0X89, + 0X39,0X0A,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9C,0X00, + 0X02,0X07,0X06,0X08,0X89,0X00,0X07,0X36,0XE5,0XEC,0XF3,0XF0,0X7A,0X00,0X00,0X81, + 0XF5,0X07,0X00,0X00,0X7A,0XF0,0XF3,0XEC,0XE5,0X36,0X9F,0X00,0X07,0X01,0X0C,0X26, + 0X4D,0X58,0X3D,0X15,0X02,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0XAA,0X00,0X05,0X35,0XE2,0XE9,0XF0,0XED,0X79,0X80,0X00,0X81,0XF2,0X80,0X00, + 0X05,0X79,0XED,0XF0,0XE9,0XE2,0X35,0X9F,0X00,0X05,0X01,0X06,0X10,0X12,0X0B,0X03, + 0X86,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA9,0X00,0X05,0X34, + 0XDF,0XE7,0XED,0XEA,0X77,0X81,0X00,0X81,0XEF,0X81,0X00,0X05,0X77,0XEA,0XED,0XE7, + 0XDF,0X34,0X9F,0X00,0X03,0X07,0X01,0X02,0X04,0X87,0X00,0X02,0X67,0X48,0X30,0X83, + 0X00,0X02,0XC3,0XB4,0X91,0XA8,0X00,0X05,0X34,0XDD,0XE5,0XEB,0XE8,0X76,0X82,0X00, + 0X81,0XED,0X82,0X00,0X05,0X76,0XE8,0XEB,0XE5,0XDD,0X34,0XAC,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA7,0X00,0X05,0X33,0XDA,0XE2,0XE8,0XE5,0X75, + 0X83,0X00,0X81,0XEA,0X83,0X00,0X05,0X75,0XE5,0XE8,0XE2,0XDA,0X33,0XAB,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA6,0X00,0X05,0X33,0XD9,0XE0,0XE6, + 0XE3,0X71,0X84,0X00,0X81,0XE8,0X84,0X00,0X05,0X71,0XE3,0XE6,0XE0,0XD9,0X33,0XAA, + 0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X05,0X01,0X01, + 0X07,0X04,0X04,0X01,0X9B,0X00,0X05,0X32,0XD6,0XDD,0XE3,0XE1,0X6F,0X85,0X00,0X81, + 0XE5,0X85,0X00,0X05,0X6F,0XE1,0XE3,0XDD,0XD6,0X32,0XA9,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00,0X07,0X01,0X06,0X12,0X21,0X1E,0X11,0X04, + 0X01,0X99,0X00,0X05,0X32,0XD3,0XDA,0XE0,0XDE,0X6E,0X86,0X00,0X81,0XE2,0X86,0X00, + 0X05,0X6E,0XDE,0XE0,0XDA,0XD3,0X32,0XA8,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02, + 0XC3,0XB4,0X91,0X80,0X00,0X07,0X04,0X15,0X3B,0X5A,0X55,0X32,0X10,0X02,0X98,0X00, + 0X05,0X31,0XD1,0XD8,0XDE,0XDC,0X6D,0X87,0X00,0X81,0XE0,0X87,0X00,0X05,0X6D,0XDC, + 0XDE,0XD8,0XD1,0X31,0XA7,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X80,0X00,0X08,0X08,0X26,0X63,0X88,0X81,0X4F,0X1A,0X03,0X01,0X96,0X00,0X05,0X31, + 0XCE,0XD5,0XDB,0XD9,0X6B,0X88,0X00,0X81,0XDD,0X88,0X00,0X05,0X6B,0XD9,0XDB,0XD5, + 0XCE,0X31,0XA6,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X0D,0XC3,0XB4,0X91,0X00,0X00, + 0X01,0X07,0X29,0X65,0X8B,0X83,0X51,0X1B,0X04,0X96,0X00,0X05,0X30,0XCB,0XD2,0XD8, + 0XD6,0X6A,0X89,0X00,0X81,0XDA,0X89,0X00,0X05,0X6A,0XD6,0XD8,0XD2,0XCB,0X30,0XA5, + 0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00,0X07,0X04,0X1A, + 0X43,0X61,0X59,0X33,0X10,0X04,0X95,0X00,0X05,0X2F,0XCA,0XD0,0XD6,0XD4,0X69,0X8A, + 0X00,0X81,0XD8,0X8A,0X00,0X05,0X69,0XD4,0XD6,0XD0,0XCA,0X2F,0XA4,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00,0X07,0X01,0X08,0X18,0X25,0X22, + 0X12,0X04,0X01,0X94,0X00,0X05,0X2F,0XC7,0XCD,0XD3,0XD1,0X68,0X8B,0X00,0X81,0XD5, + 0X8B,0X00,0X05,0X68,0XD1,0XD3,0XCD,0XC7,0X2F,0XA3,0X00,0X02,0X67,0X48,0X30,0X83, + 0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X05,0X01,0X05,0X06,0X07,0X02,0X01,0X94,0X00, + 0X05,0X2E,0XC5,0XCC,0XD1,0XCF,0X67,0X8C,0X00,0X81,0XD3,0X8C,0X00,0X05,0X67,0XCF, + 0XD1,0XCC,0XC5,0X2E,0XA2,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X82,0X00,0X00,0X01,0X97,0X00,0X05,0X2E,0XC3,0XCA,0XCF,0XCD,0X66,0X8D,0X00,0X81, + 0XD1,0X8D,0X00,0X05,0X66,0XCD,0XCF,0XCA,0XC3,0X2E,0XA1,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0XD6,0XFF,0X8C,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X00,0XFE,0XD4,0XFF,0X00,0XFE,0X8C,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X01,0XF6,0XFF,0XD2, + 0XF6,0X01,0XFF,0XF6,0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X89,0X00,0X02,0XE2,0XFC,0XEC,0XD0,0XEA,0X02,0XEC,0XFC,0XE2,0X8C,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X02,0XC7,0XF8,0XE1,0XD0,0XDC, + 0X02,0XE1,0XF8,0XC7,0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X89,0X00,0X02,0XA6,0XF3,0XDB,0XD0,0XD0,0X02,0XDB,0XF3,0XA6,0X8C,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X02,0X81,0XEE,0XD8,0XD0,0XC5, + 0X02,0XD8,0XEE,0X81,0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X89,0X00,0X02,0X58,0XE9,0XD7,0XD0,0XB9,0X02,0XD7,0XE9,0X58,0X8C,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X03,0X2C,0XE0,0XD9,0XAE,0X81, + 0XAD,0X00,0X97,0X84,0XAD,0X00,0X97,0X84,0XAD,0X00,0X97,0X84,0XAD,0X00,0X97,0X84, + 0XAD,0X00,0X97,0X84,0XAD,0X00,0X97,0X84,0XAD,0X00,0X97,0X84,0XAD,0X00,0X97,0X84, + 0XAD,0X00,0X97,0X84,0XAD,0X00,0X97,0X81,0XAD,0X03,0XAE,0XD9,0XE0,0X2C,0X8C,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8A,0X00,0X02,0XA8,0XDD,0XB4, + 0X80,0XA7,0X02,0X94,0X63,0X94,0X82,0XA7,0X02,0X94,0X63,0X94,0X82,0XA7,0X02,0X94, + 0X63,0X94,0X82,0XA7,0X02,0X94,0X63,0X94,0X82,0XA7,0X02,0X94,0X63,0X94,0X82,0XA7, + 0X02,0X94,0X63,0X94,0X82,0XA7,0X02,0X94,0X63,0X94,0X82,0XA7,0X02,0X94,0X63,0X94, + 0X82,0XA7,0X02,0X94,0X63,0X94,0X82,0XA7,0X02,0X94,0X63,0X94,0X80,0XA7,0X02,0XB4, + 0XDD,0XA8,0X8D,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8A,0X00, + 0X05,0X6F,0XD6,0XBC,0XA3,0XA3,0X93,0X80,0X61,0X00,0X93,0X80,0XA3,0X00,0X93,0X80, + 0X61,0X00,0X93,0X80,0XA3,0X00,0X93,0X80,0X61,0X00,0X93,0X80,0XA3,0X00,0X93,0X80, + 0X61,0X00,0X93,0X80,0XA3,0X00,0X93,0X80,0X61,0X00,0X93,0X80,0XA3,0X00,0X93,0X80, + 0X61,0X00,0X93,0X80,0XA3,0X00,0X93,0X80,0X61,0X00,0X93,0X80,0XA3,0X00,0X93,0X80, + 0X61,0X00,0X93,0X80,0XA3,0X00,0X93,0X80,0X61,0X00,0X93,0X80,0XA3,0X00,0X93,0X80, + 0X61,0X05,0X93,0XA3,0XA3,0XBC,0XD6,0X6F,0X8D,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0X8A,0X00,0X56,0X36,0XCD,0XC2,0X9E,0X91,0X5F,0X5F,0X91,0X5F, + 0X5F,0X91,0X9E,0X91,0X5F,0X5F,0X91,0X5F,0X5F,0X91,0X9E,0X91,0X5F,0X5F,0X91,0X5F, + 0X5F,0X91,0X9E,0X91,0X5F,0X5F,0X91,0X5F,0X5F,0X91,0X9E,0X91,0X5F,0X5F,0X91,0X5F, + 0X5F,0X91,0X9E,0X91,0X5F,0X5F,0X91,0X5F,0X5F,0X91,0X9E,0X91,0X5F,0X5F,0X91,0X5F, + 0X5F,0X91,0X9E,0X91,0X5F,0X5F,0X91,0X5F,0X5F,0X91,0X9E,0X91,0X5F,0X5F,0X91,0X5F, + 0X5F,0X91,0X9E,0X91,0X5F,0X5F,0X91,0X5F,0X5F,0X91,0X9E,0XC2,0XCD,0X36,0X8D,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8B,0X00,0X54,0X8C,0XC9,0X9B, + 0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X8F,0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X8F, + 0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X8F,0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X8F, + 0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X8F,0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X8F, + 0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X8F,0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X8F, + 0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X8F,0X5D,0X5D,0X8F,0X9A,0X8F,0X5D,0X5D,0X9B, + 0XC9,0X8C,0X8E,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8B,0X00, + 0X08,0X4C,0XC2,0X93,0X5B,0X8D,0X95,0X91,0X95,0X8D,0X80,0X5B,0X04,0X8D,0X95,0X91, + 0X95,0X8D,0X80,0X5B,0X04,0X8D,0X95,0X91,0X95,0X8D,0X80,0X5B,0X04,0X8D,0X95,0X91, + 0X95,0X8D,0X80,0X5B,0X04,0X8D,0X95,0X91,0X95,0X8D,0X80,0X5B,0X04,0X8D,0X95,0X91, + 0X95,0X8D,0X80,0X5B,0X04,0X8D,0X95,0X91,0X95,0X8D,0X80,0X5B,0X04,0X8D,0X95,0X91, + 0X95,0X8D,0X80,0X5B,0X04,0X8D,0X95,0X91,0X95,0X8D,0X80,0X5B,0X08,0X8D,0X95,0X91, + 0X95,0X8D,0X5B,0X93,0XC2,0X4C,0X8E,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X8B,0X00,0X54,0X0F,0X8B,0XB8,0X93,0X91,0X8E,0X75,0X8E,0X91,0X8C,0X5A, + 0X8C,0X91,0X8E,0X75,0X8E,0X91,0X8C,0X5A,0X8C,0X91,0X8E,0X75,0X8E,0X91,0X8C,0X5A, + 0X8C,0X91,0X8E,0X75,0X8E,0X91,0X8C,0X5A,0X8C,0X91,0X8E,0X75,0X8E,0X91,0X8C,0X5A, + 0X8C,0X91,0X8E,0X75,0X8E,0X91,0X8C,0X5A,0X8C,0X91,0X8E,0X75,0X8E,0X91,0X8C,0X5A, + 0X8C,0X91,0X8E,0X75,0X8E,0X91,0X8C,0X5A,0X8C,0X91,0X8E,0X75,0X8E,0X91,0X8C,0X5A, + 0X8C,0X91,0X8E,0X75,0X8E,0X91,0X9C,0XB8,0X8B,0X0F,0X8E,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X8C,0X00,0X03,0X47,0XB4,0XA4,0X8B,0X80,0X72,0X00, + 0X8B,0X80,0X8C,0X00,0X8B,0X80,0X72,0X00,0X8B,0X80,0X8C,0X00,0X8B,0X80,0X72,0X00, + 0X8B,0X80,0X8C,0X00,0X8B,0X80,0X72,0X00,0X8B,0X80,0X8C,0X00,0X8B,0X80,0X72,0X00, + 0X8B,0X80,0X8C,0X00,0X8B,0X80,0X72,0X00,0X8B,0X80,0X8C,0X00,0X8B,0X80,0X72,0X00, + 0X8B,0X80,0X8C,0X00,0X8B,0X80,0X72,0X00,0X8B,0X80,0X8C,0X00,0X8B,0X80,0X72,0X00, + 0X8B,0X80,0X8C,0X00,0X8B,0X80,0X72,0X03,0X8B,0XA4,0XB4,0X47,0X8F,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8C,0X00,0X07,0X08,0X75,0XAC,0X81,0X6F, + 0X88,0X6F,0X6F,0X80,0X88,0X04,0X6F,0X6F,0X88,0X6F,0X6F,0X80,0X88,0X04,0X6F,0X6F, + 0X88,0X6F,0X6F,0X80,0X88,0X04,0X6F,0X6F,0X88,0X6F,0X6F,0X80,0X88,0X04,0X6F,0X6F, + 0X88,0X6F,0X6F,0X80,0X88,0X04,0X6F,0X6F,0X88,0X6F,0X6F,0X80,0X88,0X04,0X6F,0X6F, + 0X88,0X6F,0X6F,0X80,0X88,0X04,0X6F,0X6F,0X88,0X6F,0X6F,0X80,0X88,0X04,0X6F,0X6F, + 0X88,0X6F,0X6F,0X80,0X88,0X07,0X6F,0X6F,0X88,0X6F,0X81,0XAC,0X75,0X08,0X8F,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8D,0X00,0X50,0X30,0X96,0X94, + 0X87,0X83,0X85,0X6B,0X6B,0X85,0X6B,0X6B,0X85,0X83,0X85,0X6B,0X6B,0X85,0X6B,0X6B, + 0X85,0X83,0X85,0X6B,0X6B,0X85,0X6B,0X6B,0X85,0X83,0X85,0X6B,0X6B,0X85,0X6B,0X6B, + 0X85,0X83,0X85,0X6B,0X6B,0X85,0X6B,0X6B,0X85,0X83,0X85,0X6B,0X6B,0X85,0X6B,0X6B, + 0X85,0X83,0X85,0X6B,0X6B,0X85,0X6B,0X6B,0X85,0X83,0X85,0X6B,0X6B,0X85,0X6B,0X6B, + 0X85,0X83,0X85,0X6B,0X6B,0X85,0X6B,0X6B,0X85,0X83,0X87,0X94,0X96,0X30,0X90,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8E,0X00,0X05,0X4F,0XA2,0X90, + 0X7E,0X7E,0X81,0X80,0X68,0X00,0X81,0X80,0X7E,0X00,0X81,0X80,0X68,0X00,0X81,0X80, + 0X7E,0X00,0X81,0X80,0X68,0X00,0X81,0X80,0X7E,0X00,0X81,0X80,0X68,0X00,0X81,0X80, + 0X7E,0X00,0X81,0X80,0X68,0X00,0X81,0X80,0X7E,0X00,0X81,0X80,0X68,0X00,0X81,0X80, + 0X7E,0X00,0X81,0X80,0X68,0X00,0X81,0X80,0X7E,0X00,0X81,0X80,0X68,0X00,0X81,0X80, + 0X7E,0X00,0X81,0X80,0X68,0X05,0X81,0X7E,0X7E,0X90,0XA2,0X4F,0X91,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8E,0X00,0X08,0X0C,0X64,0X99,0X86,0X7A, + 0X7A,0X7E,0X65,0X7E,0X82,0X7A,0X02,0X7E,0X65,0X7E,0X82,0X7A,0X02,0X7E,0X65,0X7E, + 0X82,0X7A,0X02,0X7E,0X65,0X7E,0X82,0X7A,0X02,0X7E,0X65,0X7E,0X82,0X7A,0X02,0X7E, + 0X65,0X7E,0X82,0X7A,0X02,0X7E,0X65,0X7E,0X82,0X7A,0X02,0X7E,0X65,0X7E,0X82,0X7A, + 0X08,0X7E,0X65,0X7E,0X7A,0X7A,0X86,0X99,0X64,0X0C,0X91,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X8F,0X00,0X03,0X1F,0X71,0X8E,0X7D,0XC2,0X75,0X03, + 0X7D,0X8E,0X71,0X1F,0X92,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X90,0X00,0X03,0X2B,0X77,0X86,0X75,0XC0,0X70,0X03,0X75,0X86,0X77,0X2B,0X93,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X91,0X00,0X03,0X30,0X76,0X7E, + 0X6F,0XBE,0X6B,0X03,0X6F,0X7E,0X76,0X30,0X94,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0X92,0X00,0X03,0X30,0X6F,0X77,0X6A,0XBC,0X66,0X03,0X6A,0X77, + 0X6F,0X30,0X95,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X93,0X00, + 0X03,0X2A,0X64,0X71,0X66,0XBA,0X61,0X03,0X66,0X71,0X64,0X2A,0X96,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X94,0X00,0X03,0X21,0X56,0X6D,0X62,0XB8, + 0X5C,0X03,0X62,0X6D,0X56,0X21,0X97,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X95,0X00,0X03,0X15,0X44,0X69,0X5F,0XB6,0X57,0X03,0X5F,0X69,0X44,0X15, + 0X98,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X96,0X00,0X04,0X06, + 0X30,0X5A,0X5D,0X54,0XB2,0X52,0X04,0X54,0X5D,0X5A,0X30,0X06,0X99,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X98,0X00,0X03,0X1B,0X41,0X50,0X3F,0XB0, + 0X35,0X03,0X3F,0X50,0X41,0X1B,0X9B,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X99,0X00,0X04,0X06,0X27,0X47,0X46,0X3A,0XAC,0X35,0X09,0X3A,0X46,0X47, + 0X27,0X06,0X00,0X01,0X00,0X00,0X01,0X97,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02, + 0XC3,0XB4,0X91,0X9B,0X00,0X04,0X0E,0X2B,0X48,0X4E,0X49,0XA8,0X47,0X07,0X49,0X4E, + 0X48,0X2B,0X0E,0X01,0X00,0X00,0X81,0X01,0X97,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0X9D,0X00,0X04,0X0E,0X28,0X42,0X4A,0X46,0XA4,0X44,0X11,0X46, + 0X4A,0X42,0X28,0X0E,0X00,0X01,0X01,0X00,0X03,0X02,0X02,0X01,0X01,0X03,0X01,0X00, + 0X01,0X93,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9F,0X00,0X04, + 0X08,0X1E,0X35,0X46,0X46,0XA0,0X44,0X13,0X46,0X46,0X35,0X1E,0X08,0X01,0X00,0X00, + 0X02,0X02,0X03,0X03,0X06,0X05,0X05,0X04,0X03,0X01,0X01,0X02,0X93,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA2,0X00,0X04,0X10,0X21,0X37,0X43,0X45, + 0X9A,0X44,0X04,0X45,0X43,0X37,0X21,0X10,0X81,0X00,0X05,0X01,0X01,0X03,0X03,0X06, + 0X08,0X80,0X09,0X06,0X07,0X05,0X03,0X02,0X01,0X02,0X01,0X91,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA5,0X00,0X04,0X0B,0X1A,0X56,0X4B,0X45,0X94, + 0X44,0X04,0X45,0X4B,0X56,0X1A,0X0B,0X83,0X00,0X10,0X01,0X02,0X03,0X06,0X09,0X0C, + 0X0F,0X11,0X11,0X0F,0X0C,0X0B,0X06,0X04,0X01,0X00,0X01,0X91,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA7,0X00,0X0A,0X77,0X77,0X5A,0X57,0X52,0X4E, + 0X4B,0X48,0X47,0X45,0X45,0X82,0X44,0X0C,0X45,0X47,0X45,0X45,0X47,0X48,0X4B,0X4E, + 0X52,0X57,0X5A,0X77,0X77,0X83,0X00,0X12,0X01,0X01,0X02,0X02,0X04,0X09,0X0E,0X13, + 0X1D,0X21,0X22,0X1C,0X18,0X10,0X0B,0X08,0X03,0X02,0X01,0X91,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA7,0X00,0X01,0X77,0X77,0X96,0X54,0X01,0X77, + 0X77,0X84,0X00,0X11,0X01,0X03,0X03,0X08,0X0D,0X14,0X1F,0X36,0X47,0X51,0X40,0X2B, + 0X19,0X0F,0X09,0X05,0X00,0X02,0X91,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0XA7,0X00,0X01,0X77,0X77,0X96,0X4D,0X01,0X77,0X77,0X85,0X00,0X11,0X02, + 0X06,0X0A,0X12,0X1C,0X39,0X66,0X96,0XA3,0X83,0X4B,0X27,0X15,0X0E,0X09,0X03,0X01, + 0X01,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA7,0X00,0X01, + 0X77,0X77,0X96,0X45,0X01,0X77,0X77,0X83,0X00,0X13,0X01,0X01,0X03,0X06,0X0C,0X14, + 0X25,0X4A,0X97,0XD1,0XDD,0XBC,0X6E,0X34,0X1E,0X0F,0X09,0X05,0X02,0X02,0X90,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA7,0X00,0X01,0X77,0X77,0X96, + 0X3D,0X01,0X77,0X77,0X85,0X00,0X11,0X03,0X07,0X0E,0X18,0X29,0X56,0XA4,0XDD,0XE8, + 0XCB,0X7B,0X38,0X1F,0X11,0X09,0X05,0X03,0X02,0X90,0X00,0X02,0X67,0X48,0X30,0X83, + 0X00,0X02,0XC3,0XB4,0X91,0XA7,0X00,0X01,0X77,0X77,0X96,0X35,0X01,0X77,0X77,0X83, + 0X00,0X13,0X02,0X02,0X03,0X06,0X0D,0X15,0X25,0X49,0X86,0XBE,0XCB,0XA9,0X66,0X32, + 0X1A,0X12,0X09,0X04,0X03,0X01,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0XA7,0X00,0X9A,0X77,0X84,0X00,0X11,0X02,0X01,0X07,0X0B,0X14,0X1F,0X33, + 0X52,0X74,0X7D,0X64,0X40,0X25,0X1A,0X0F,0X09,0X03,0X01,0X91,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X86,0X00,0X0E,0X01,0X00,0X00,0X01,0X00,0X02, + 0X01,0X01,0X02,0X01,0X02,0X02,0X01,0X01,0X02,0X80,0X01,0X8C,0X00,0X9A,0X77,0X84, + 0X00,0X12,0X01,0X02,0X04,0X09,0X0F,0X18,0X21,0X2E,0X3B,0X3E,0X36,0X2A,0X1D,0X14, + 0X0C,0X07,0X03,0X00,0X02,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0X84,0X00,0X03,0X01,0X01,0X00,0X03,0X80,0X02,0X04,0X01,0X00,0X00,0X01,0X02, + 0X80,0X00,0X03,0X01,0X01,0X02,0X01,0X92,0X00,0X90,0X39,0X89,0X00,0X12,0X01,0X02, + 0X03,0X06,0X0B,0X11,0X17,0X22,0X23,0X24,0X26,0X1B,0X14,0X0F,0X08,0X05,0X03,0X02, + 0X01,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X83,0X00,0X10, + 0X01,0X01,0X02,0X03,0X03,0X04,0X03,0X03,0X04,0X03,0X00,0X02,0X01,0X00,0X00,0X01, + 0X01,0X95,0X00,0X90,0X39,0X88,0X00,0X11,0X01,0X02,0X01,0X02,0X05,0X07,0X0B,0X0F, + 0X14,0X16,0X15,0X15,0X11,0X0E,0X09,0X06,0X03,0X02,0X92,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X05,0X01,0X01,0X02,0X03,0X04,0X07,0X80, + 0X08,0X03,0X07,0X05,0X04,0X02,0X80,0X01,0X80,0X00,0X00,0X01,0X94,0X00,0X83,0X39, + 0X07,0X27,0X16,0X09,0X01,0X01,0X09,0X16,0X27,0X82,0X39,0X8A,0X00,0X0E,0X02,0X01, + 0X01,0X04,0X06,0X08,0X0C,0X0D,0X0C,0X0C,0X09,0X07,0X04,0X04,0X03,0X93,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X0E,0X03,0X01,0X04,0X07, + 0X0B,0X0D,0X0E,0X10,0X10,0X0D,0X0B,0X07,0X04,0X03,0X01,0X99,0X00,0X81,0X39,0X02, + 0X34,0X1A,0X01,0X83,0X00,0X02,0X01,0X1A,0X34,0X80,0X39,0X8B,0X00,0X04,0X02,0X01, + 0X03,0X04,0X05,0X80,0X06,0X05,0X07,0X06,0X03,0X03,0X01,0X01,0X86,0X00,0X00,0X01, + 0X89,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X10,0X01, + 0X04,0X07,0X0B,0X0F,0X16,0X18,0X1A,0X19,0X16,0X12,0X0E,0X08,0X05,0X03,0X00,0X01, + 0X97,0X00,0X81,0X39,0X00,0X1A,0X87,0X00,0X00,0X1A,0X80,0X39,0X00,0X0D,0X8D,0X00, + 0X01,0X02,0X02,0X83,0X03,0X00,0X02,0X87,0X00,0X05,0X01,0X05,0X06,0X07,0X04,0X01, + 0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X17,0XC3,0XB4,0X91,0X00,0X00,0X01,0X02, + 0X02,0X05,0X08,0X10,0X16,0X1F,0X25,0X28,0X25,0X22,0X1B,0X14,0X0B,0X08,0X05,0X02, + 0X01,0X96,0X00,0X00,0X0D,0X80,0X39,0X01,0X27,0X01,0X87,0X00,0X05,0X01,0X27,0X39, + 0X39,0X35,0X0D,0X8C,0X00,0X0A,0X01,0X02,0X01,0X02,0X01,0X01,0X00,0X01,0X00,0X01, + 0X01,0X84,0X00,0X07,0X01,0X03,0X0E,0X21,0X27,0X1A,0X09,0X02,0X84,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X17,0XC3,0XB4,0X91,0X00,0X00,0X01,0X00,0X04,0X06,0X0D,0X16, + 0X1F,0X29,0X33,0X37,0X34,0X2D,0X24,0X1A,0X10,0X09,0X06,0X03,0X01,0X95,0X00,0X01, + 0X0E,0X3C,0X80,0X40,0X00,0X19,0X89,0X00,0X05,0X19,0X40,0X40,0X3E,0X3C,0X0E,0X8C, + 0X00,0X01,0X01,0X01,0X81,0X00,0X01,0X02,0X01,0X86,0X00,0X08,0X01,0X0E,0X30,0X5B, + 0X68,0X49,0X1B,0X05,0X03,0X83,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X16,0XC3,0XB4, + 0X91,0X00,0X01,0X01,0X02,0X04,0X08,0X11,0X1A,0X28,0X3B,0X6F,0X8C,0X5A,0X39,0X2B, + 0X20,0X14,0X0C,0X06,0X03,0X95,0X00,0X02,0X10,0X44,0X46,0X80,0X49,0X00,0X0B,0X89, + 0X00,0X06,0X0B,0X49,0X49,0X48,0X46,0X44,0X10,0X8B,0X00,0X00,0X01,0X8D,0X00,0X08, + 0X04,0X19,0X51,0X89,0X95,0X75,0X30,0X0A,0X01,0X83,0X00,0X02,0X67,0X48,0X30,0X83, + 0X00,0X17,0XC3,0XB4,0X91,0X00,0X00,0X01,0X03,0X06,0X09,0X12,0X1D,0X2D,0X5D,0XC3, + 0XE6,0X99,0X40,0X2F,0X23,0X17,0X0C,0X06,0X04,0X01,0X93,0X00,0X03,0X16,0X5A,0X58, + 0X53,0X80,0X54,0X00,0X02,0X89,0X00,0X07,0X02,0X54,0X52,0X52,0X53,0X57,0X5A,0X16, + 0X9B,0X00,0X08,0X04,0X1B,0X56,0X8D,0X99,0X7A,0X36,0X08,0X03,0X83,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X03,0XC3,0XB4,0X91,0X00,0X80,0X01,0X10,0X05,0X0A,0X11,0X1B, + 0X2A,0X5C,0XC1,0XE4,0X96,0X3F,0X30,0X22,0X16,0X0D,0X07,0X03,0X01,0X92,0X00,0X07, + 0X1E,0X75,0X68,0X62,0X5F,0X5F,0X5E,0X5F,0X8B,0X12,0X81,0X5F,0X03,0X6A,0X6A,0X75, + 0X1F,0X99,0X00,0X08,0X01,0X03,0X0F,0X39,0X66,0X72,0X53,0X20,0X07,0X84,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X10,0X04,0X08,0X10,0X1A, + 0X25,0X3B,0X6C,0X89,0X57,0X38,0X2A,0X1F,0X13,0X0B,0X06,0X03,0X01,0X91,0X00,0X09, + 0X26,0X8F,0X77,0X70,0X96,0X74,0X64,0X62,0X63,0X1E,0X8A,0X1D,0X08,0X67,0X64,0X64, + 0X7C,0X94,0X70,0X75,0X8F,0X27,0X99,0X00,0X06,0X01,0X04,0X12,0X28,0X2F,0X20,0X0A, + 0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X16,0XC3,0XB4,0X91,0X00,0X00,0X01,0X02, + 0X03,0X07,0X0C,0X13,0X1D,0X28,0X30,0X34,0X30,0X2C,0X23,0X18,0X11,0X09,0X05,0X01, + 0X91,0X00,0X09,0X2F,0XA7,0X83,0X74,0X74,0X82,0XAD,0X7F,0X6D,0X6C,0X8B,0X2A,0X09, + 0X6B,0X6D,0X8A,0XAA,0X7B,0X74,0X74,0X81,0XA7,0X30,0X9A,0X00,0X04,0X03,0X07,0X0A, + 0X05,0X04,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00, + 0X0E,0X03,0X05,0X0A,0X10,0X16,0X1D,0X22,0X25,0X24,0X20,0X1A,0X13,0X0B,0X08,0X03, + 0X91,0X00,0X0C,0X35,0XBB,0X91,0X80,0X7E,0X3F,0X40,0X8E,0XC1,0X8C,0X78,0X37,0X3B, + 0X87,0X34,0X0C,0X41,0X41,0X75,0X99,0XBE,0X86,0X40,0X3F,0X7E,0X80,0X8E,0XBB,0X38, + 0X9B,0X00,0X00,0X01,0X87,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X81,0X00,0X10,0X02,0X03,0X05,0X09,0X0E,0X11,0X16,0X19,0X18,0X15,0X10,0X0C,0X07, + 0X04,0X02,0X01,0X01,0X8E,0X00,0X0D,0X3E,0XCF,0X9F,0X8B,0X89,0X44,0X00,0X00,0X46, + 0X9B,0XD5,0X99,0X83,0X1C,0X87,0X00,0X0D,0X1C,0X83,0XA8,0XD1,0X92,0X46,0X00,0X00, + 0X44,0X89,0X8B,0X9C,0XCF,0X40,0XA5,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X81,0X00,0X0E,0X01,0X01,0X04,0X05,0X07,0X0B,0X0D,0X0D,0X0E,0X0C,0X09, + 0X07,0X05,0X03,0X02,0X8F,0X00,0X05,0X45,0XDF,0XAC,0X96,0X94,0X49,0X81,0X00,0X05, + 0X4B,0XA7,0XE5,0XA5,0X8D,0X21,0X85,0X00,0X05,0X21,0X8D,0XB5,0XDF,0X9E,0X4B,0X81, + 0X00,0X05,0X49,0X94,0X96,0XA9,0XDF,0X48,0XA4,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0X81,0X00,0X0F,0X02,0X02,0X01,0X03,0X04,0X07,0X07,0X09,0X09, + 0X06,0X06,0X04,0X03,0X02,0X02,0X01,0X8D,0X00,0X05,0X4C,0XEC,0XB5,0X9F,0X9D,0X4E, + 0X83,0X00,0X05,0X4E,0XB1,0XF1,0XAF,0X95,0X23,0X83,0X00,0X05,0X23,0X95,0XBF,0XEB, + 0XA7,0X4E,0X83,0X00,0X05,0X4E,0X9D,0X9F,0XB2,0XEE,0X50,0XA3,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X83,0X00,0X80,0X01,0X80,0X04,0X80,0X03,0X02, + 0X02,0X00,0X02,0X8E,0X00,0X05,0X51,0XF4,0XBC,0XA6,0XA4,0X51,0X85,0X00,0X05,0X51, + 0XB8,0XF8,0XB6,0X9C,0X25,0X81,0X00,0X05,0X25,0X9C,0XC7,0XF2,0XAE,0X51,0X85,0X00, + 0X05,0X51,0XA4,0XA6,0XB9,0XF6,0X55,0XA2,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02, + 0XC3,0XB4,0X91,0X83,0X00,0X01,0X02,0X00,0X80,0X01,0X05,0X02,0X02,0X01,0X00,0X00, + 0X01,0X8E,0X00,0X05,0X51,0XF4,0XBC,0XA6,0XA4,0X51,0X87,0X00,0X0D,0X51,0XB8,0XF8, + 0XB6,0X9C,0X25,0X00,0X00,0X25,0X9C,0XC7,0XF2,0XAE,0X51,0X87,0X00,0X05,0X51,0XA4, + 0XA6,0XB9,0XF6,0X55,0XA1,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X83,0X00,0X00,0X01,0X84,0X00,0X00,0X01,0X8F,0X00,0X05,0X51,0XF4,0XBC,0XA6,0XA4, + 0X51,0X89,0X00,0X0B,0X51,0XB8,0XF8,0XB6,0X9C,0X25,0X25,0X9C,0XC7,0XF2,0XAE,0X51, + 0X89,0X00,0X05,0X51,0XA4,0XA6,0XB9,0XF6,0X55,0XA0,0X00,0X02,0X67,0X48,0X30,0X83, + 0X00,0X02,0XC3,0XB4,0X91,0X9D,0X00,0X05,0X51,0XF4,0XBC,0XA6,0XA4,0X51,0X8B,0X00, + 0X09,0X51,0XB8,0XF8,0XB6,0X9E,0X9E,0XC7,0XF2,0XAE,0X51,0X8B,0X00,0X05,0X51,0XA4, + 0XA6,0XB9,0XF6,0X55,0X9F,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X9C,0X00,0X05,0X25,0XE4,0XBC,0XA6,0XA4,0X51,0X8D,0X00,0X07,0X51,0XB8,0XD0,0XA6, + 0XAD,0XEF,0XAE,0X51,0X8D,0X00,0X05,0X51,0XA4,0XA6,0XB9,0XEF,0X29,0X9E,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X02,0XB4,0X9B,0X75,0XCE,0X67,0X00,0X6A,0X9F,0X67,0X02, + 0X59,0X3F,0X30,0X83,0X00,0X02,0X8E,0X6C,0X55,0XAA,0X48,0X04,0X47,0X46,0X46,0X47, + 0X47,0XBF,0X48,0X02,0X3F,0X30,0X30,0X83,0X00,0X02,0X69,0X4D,0X37,0XA9,0X30,0X06, + 0X2F,0X2A,0X25,0X22,0X26,0X2B,0X2F,0XC1,0X30,0XFF,0X00,0XFF,0X00,0XFF,0X00,0XA2, + 0X00,0X02,0X10,0X55,0X75,0X81,0XBA,0X01,0X88,0X1E,0X82,0X00,0X03,0X01,0X17,0X38, + 0X43,0X82,0X44,0X82,0X00,0X8A,0X44,0X83,0X00,0X80,0XBA,0X83,0X00,0X08,0X0A,0X19, + 0X2A,0X3C,0X4D,0X5D,0X6F,0X80,0X8F,0X8F,0X99,0X00,0X46,0XA7,0X00,0X02,0X10,0X75, + 0XEE,0X84,0XFF,0X00,0X60,0X81,0X00,0X03,0X01,0X2E,0XA3,0XEF,0X83,0XFF,0X82,0X00, + 0X8A,0XFF,0X83,0X00,0X80,0XFF,0X83,0X00,0X08,0X11,0X2A,0X46,0X64,0X80,0X9B,0XB9, + 0XD5,0XEE,0X8E,0XFF,0X01,0XA7,0X05,0XA6,0X00,0X01,0X10,0XCE,0X80,0XFF,0X01,0XBA, + 0X89,0X80,0X75,0X01,0X99,0X63,0X81,0X00,0X02,0X14,0X9F,0XE8,0X84,0XFF,0X82,0X00, + 0X8A,0XFF,0X83,0X00,0X80,0XFF,0X83,0X00,0X08,0X11,0X2A,0X46,0X64,0X80,0X9B,0XB9, + 0XD5,0XEE,0X8D,0XFF,0X01,0XA7,0X05,0XA7,0X00,0X04,0XAA,0XFF,0XFF,0XAA,0X10,0X88, + 0X00,0X04,0X36,0XE8,0XFF,0XF0,0X10,0X8C,0X00,0X02,0XBA,0XFF,0XFF,0X91,0X00,0X08, + 0X11,0X2A,0X46,0X64,0X80,0X9B,0XB9,0XD5,0XEE,0X8C,0XFF,0X01,0XA7,0X05,0XA7,0X00, + 0X03,0X20,0XFF,0XFF,0XBA,0X8A,0X00,0X03,0X42,0XFD,0XFF,0X8E,0X8D,0X00,0X02,0XBA, + 0XFF,0XFF,0X91,0X00,0X08,0X11,0X2A,0X46,0X64,0X80,0X9B,0XB9,0XD5,0XEE,0X8B,0XFF, + 0X01,0XA7,0X05,0XA8,0X00,0X03,0X75,0XFF,0XFF,0X55,0X8A,0X00,0X03,0X44,0XFF,0XFF, + 0X75,0X8D,0X00,0X02,0XBA,0XFF,0XFF,0X91,0X00,0X08,0X11,0X2A,0X46,0X64,0X80,0X9B, + 0XB9,0XD5,0XEE,0X8A,0XFF,0X01,0XA7,0X05,0XA9,0X00,0X03,0X75,0XFF,0XFF,0X44,0X8A, + 0X00,0X03,0X44,0XFF,0XFF,0X75,0X8D,0X00,0X02,0XBA,0XFF,0XFF,0X88,0X00,0X02,0X89, + 0XBA,0XBA,0X83,0X00,0X0B,0X03,0X08,0X0E,0X14,0X1A,0X1F,0X25,0X2B,0X30,0X33,0X33, + 0X58,0X86,0XFF,0X01,0XA7,0X05,0X98,0X00,0X01,0X05,0X0E,0X8D,0X00,0X03,0X65,0XFF, + 0XFF,0X99,0X8A,0X00,0X03,0X44,0XFF,0XFF,0X75,0X8D,0X00,0X02,0XBA,0XFF,0XFF,0X88, + 0X00,0X02,0XBA,0XFF,0XFF,0X8E,0X00,0X00,0X2E,0X85,0XFF,0X01,0XA7,0X05,0X98,0X00, + 0X02,0X05,0XA7,0X2E,0X8D,0X00,0X00,0X20,0X80,0XFF,0X00,0X75,0X89,0X00,0X03,0X44, + 0XFF,0XFF,0X75,0X8D,0X00,0X02,0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF,0X8E, + 0X00,0X00,0X2E,0X84,0XFF,0X01,0XA7,0X05,0X98,0X00,0X03,0X05,0XA7,0XFF,0X2E,0X8E, + 0X00,0X00,0X89,0X80,0XFF,0X01,0XBA,0X44,0X87,0X00,0X03,0X44,0XFF,0XFF,0X75,0X8D, + 0X00,0X02,0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF,0X8E,0X00,0X00,0X2E,0X83, + 0XFF,0X01,0XA7,0X05,0X98,0X00,0X04,0X05,0XA7,0XFF,0XFF,0X2E,0X8F,0X00,0X00,0X99, + 0X81,0XFF,0X01,0XBA,0X44,0X85,0X00,0X03,0X44,0XFF,0XFF,0XDE,0X83,0XBA,0X87,0X00, + 0X02,0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF,0X8E,0X00,0X00,0X2E,0X82,0XFF, + 0X01,0XA7,0X05,0X98,0X00,0X01,0X05,0XA7,0X80,0XFF,0X00,0X2E,0X90,0X00,0X01,0X65, + 0XEE,0X81,0XFF,0X01,0X99,0X10,0X83,0X00,0X00,0X44,0X86,0XFF,0X87,0X00,0X02,0XBA, + 0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF,0X8E,0X00,0X00,0X2E,0X81,0XFF,0X01,0XA7, + 0X05,0X98,0X00,0X01,0X05,0XA7,0X81,0XFF,0X00,0X2E,0X91,0X00,0X02,0X10,0X75,0XEE, + 0X80,0XFF,0X01,0XEE,0X30,0X82,0X00,0X03,0X44,0XFF,0XFF,0XBA,0X83,0X75,0X87,0X00, + 0X02,0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF,0X8E,0X00,0X00,0X2E,0X80,0XFF, + 0X01,0XA7,0X05,0X98,0X00,0X01,0X05,0XA7,0X82,0XFF,0X00,0X2E,0X93,0X00,0X06,0X10, + 0X75,0XEE,0XFF,0XFF,0XEE,0X10,0X81,0X00,0X03,0X44,0XFF,0XFF,0X75,0X8D,0X00,0X02, + 0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF,0X8E,0X00,0X04,0X2E,0XFF,0XFF,0XA7, + 0X05,0X98,0X00,0X01,0X05,0XA7,0X83,0XFF,0X00,0X2E,0X95,0X00,0X04,0X20,0XCE,0XFF, + 0XFF,0X99,0X81,0X00,0X03,0X44,0XFF,0XFF,0X75,0X8D,0X00,0X02,0XBA,0XFF,0XFF,0X88, + 0X00,0X02,0XBA,0XFF,0XFF,0X8E,0X00,0X03,0X2E,0XFF,0XA7,0X05,0X98,0X00,0X01,0X05, + 0XA7,0X84,0XFF,0X00,0X2E,0X96,0X00,0X03,0X20,0XFF,0XFF,0XDE,0X81,0X00,0X03,0X44, + 0XFF,0XFF,0X75,0X8D,0X00,0X02,0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF,0X8E, + 0X00,0X02,0X2E,0XA7,0X05,0X98,0X00,0X01,0X05,0XA7,0X85,0XFF,0X00,0X2E,0X97,0X00, + 0X02,0XCE,0XFF,0XFF,0X81,0X00,0X03,0X44,0XFF,0XFF,0X75,0X8D,0X00,0X02,0XBA,0XFF, + 0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF,0X8E,0X00,0X01,0X0E,0X05,0X98,0X00,0X01,0X05, + 0XA7,0X86,0XFF,0X0B,0X58,0X33,0X33,0X30,0X2B,0X25,0X1F,0X1A,0X14,0X0E,0X08,0X03, + 0X8C,0X00,0X02,0XBA,0XFF,0XFF,0X81,0X00,0X03,0X44,0XFF,0XFF,0X75,0X8D,0X00,0X02, + 0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF,0XAA,0X00,0X01,0X05,0XA7,0X8A,0XFF, + 0X08,0XEE,0XD5,0XB9,0X9B,0X80,0X64,0X46,0X2A,0X11,0X8B,0X00,0X03,0X10,0XFF,0XFF, + 0XAA,0X81,0X00,0X03,0X44,0XFF,0XFF,0X75,0X8D,0X00,0X02,0XBA,0XFF,0XFF,0X88,0X00, + 0X02,0XBA,0XFF,0XFF,0XA9,0X00,0X01,0X05,0XA7,0X8B,0XFF,0X08,0XEE,0XD5,0XB9,0X9B, + 0X80,0X64,0X46,0X2A,0X11,0X8A,0X00,0X04,0X10,0XCE,0XFF,0XFF,0X44,0X81,0X00,0X03, + 0X40,0XFC,0XFF,0XA9,0X8D,0X00,0X02,0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF,0XFF, + 0XA8,0X00,0X01,0X05,0XA7,0X8C,0XFF,0X08,0XEE,0XD5,0XB9,0X9B,0X80,0X64,0X46,0X2A, + 0X11,0X82,0X00,0X00,0X44,0X81,0X00,0X06,0X30,0X55,0X89,0XEE,0XFF,0XFF,0X88,0X82, + 0X00,0X04,0X2A,0XE2,0XFE,0XFF,0X5B,0X82,0X44,0X87,0X00,0X02,0XBA,0XFF,0XFF,0X88, + 0X00,0X02,0XBA,0XFF,0XFF,0XA7,0X00,0X01,0X05,0XA7,0X8D,0XFF,0X08,0XEE,0XD5,0XB9, + 0X9B,0X80,0X64,0X46,0X2A,0X11,0X82,0X00,0X86,0XFF,0X01,0XEE,0X75,0X83,0X00,0X02, + 0X0A,0X91,0XE2,0X84,0XFF,0X87,0X00,0X02,0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA,0XFF, + 0XFF,0XA6,0X00,0X01,0X05,0XA7,0X8E,0XFF,0X08,0XEE,0XD5,0XB9,0X9B,0X80,0X64,0X46, + 0X2A,0X11,0X82,0X00,0X00,0XEE,0X83,0XFF,0X02,0XCE,0X75,0X10,0X84,0X00,0X04,0X01, + 0X28,0X9F,0XEE,0XFE,0X82,0XFF,0X87,0X00,0X02,0XBA,0XFF,0XFF,0X88,0X00,0X02,0XBA, + 0XFF,0XFF,0XA6,0X00,0X00,0X46,0X8F,0X99,0X08,0X8F,0X80,0X6F,0X5D,0X4D,0X3C,0X2A, + 0X19,0X0A,0X83,0X00,0X00,0X30,0X80,0X44,0X00,0X30,0XFF,0X00,0XFF,0X00,0XCF,0X00, + 0XFF,0X00,0XFF,0X00,0XFC,0X00,0X02,0XE9,0XE2,0XCE,0XF1,0XC3,0X02,0XB4,0X8E,0X69, + 0X83,0X00,0X02,0XE2,0XDD,0XC6,0XF1,0XB4,0X02,0X9B,0X6C,0X4D,0X83,0X00,0X02,0XCE, + 0XC6,0XA8,0XF1,0X91,0X02,0X75,0X55,0X37,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF,0XB7, + 0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0XCC,0X55,0X80,0X56,0X0F,0X58, + 0X5A,0X5E,0X62,0X68,0X6F,0X76,0X7D,0X84,0X8B,0X91,0X97,0X9C,0X9F,0XA1,0XA2,0X82, + 0XA3,0X03,0XA4,0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3, + 0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0XCB,0X55,0X12,0X56,0X55,0X57,0X58,0X5C, + 0X60,0X65,0X6B,0X72,0X79,0X81,0X88,0X8E,0X93,0X98,0X9C,0X9F,0XA1,0XA2,0X83,0XA3, + 0X03,0XA4,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XF1,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XB4,0X00,0X01,0XCC,0XCC,0XB8,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E, + 0X74,0X6A,0X62,0X5A,0XA6,0X55,0X00,0X69,0X81,0XCC,0X00,0X69,0X97,0X55,0X80,0X56, + 0X11,0X58,0X5A,0X5D,0X61,0X67,0X6E,0X75,0X7D,0X85,0X8B,0X91,0X96,0X9A,0X9C,0X9E, + 0XA1,0XA1,0XA2,0X85,0XA3,0X04,0XA4,0XA4,0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4, + 0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0XA5,0X55,0X01, + 0X6F,0XC4,0X81,0XCC,0X01,0XC4,0X6F,0X95,0X55,0X16,0X56,0X56,0X57,0X59,0X5B,0X5F, + 0X64,0X6A,0X71,0X79,0X80,0X87,0X8E,0X93,0X98,0X9B,0X9D,0X9F,0XA1,0XA2,0XA5,0XA3, + 0XA4,0X85,0XA3,0X03,0XA4,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9C,0X00, + 0X80,0X01,0X8E,0X00,0X02,0X2D,0XBE,0XC5,0X81,0XCC,0X02,0XC5,0XBE,0X2D,0XA5,0X00, + 0X05,0X02,0X12,0X1C,0X24,0X17,0X08,0X86,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02, + 0XC3,0XB4,0X91,0X9C,0X00,0X03,0X0B,0X25,0X22,0X09,0X8C,0X00,0X03,0X2C,0XBA,0XC0, + 0XC5,0X81,0XC7,0X03,0XC5,0XC0,0XBA,0X2C,0XA3,0X00,0X07,0X03,0X0D,0X3B,0X6B,0X7A, + 0X57,0X1F,0X05,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF, + 0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X8F,0X55,0X05,0X58,0X77, + 0XB7,0XB2,0X75,0X56,0X8A,0X55,0X04,0X6C,0XB9,0XBC,0XBF,0XBE,0X81,0XC0,0X05,0XBE, + 0XBF,0XBC,0XB9,0X6C,0X56,0X88,0X55,0X01,0X56,0X55,0X80,0X56,0X26,0X57,0X58,0X59, + 0X5B,0X5E,0X62,0X67,0X6D,0X74,0X7C,0X83,0X8A,0X90,0X95,0X99,0X9C,0X9E,0XA0,0XA1, + 0XA2,0XA5,0XB0,0XCA,0XE5,0XEB,0XDB,0XBA,0XA6,0XA2,0XA1,0XA1,0XA0,0X9F,0X9F,0X9E, + 0X9D,0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91, + 0X87,0X7E,0X74,0X6A,0X62,0X5A,0X8F,0X55,0X05,0X58,0X8A,0XD6,0XD0,0X86,0X58,0X89, + 0X55,0X05,0X6B,0XB1,0XB5,0XB7,0XB6,0X86,0X81,0XB8,0X07,0X86,0XB6,0XB7,0XB5,0XB1, + 0X6C,0X56,0X56,0X81,0X57,0X82,0X56,0X2B,0X57,0X56,0X57,0X58,0X58,0X5A,0X5C,0X5E, + 0X62,0X66,0X6B,0X71,0X78,0X7F,0X86,0X8D,0X92,0X97,0X9B,0X9D,0X9F,0XA0,0XA1,0XA2, + 0XA2,0XA6,0XB3,0XD2,0XEC,0XF1,0XE2,0XC0,0XA7,0XA0,0X9F,0X9E,0X9D,0X9C,0X9B,0X9A, + 0X9A,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9B,0X00,0X05,0X01,0X20,0X5A, + 0X56,0X1A,0X03,0X88,0X00,0X06,0X26,0XA2,0XA8,0XAD,0XAB,0X57,0X00,0X81,0XAE,0X06, + 0X00,0X57,0XAB,0XAD,0XA8,0XA2,0X26,0XA0,0X00,0X07,0X02,0X1D,0X60,0XA3,0XB5,0X89, + 0X39,0X0A,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9C,0X00, + 0X02,0X07,0X06,0X08,0X89,0X00,0X07,0X24,0X99,0X9E,0XA3,0XA1,0X52,0X00,0X00,0X81, + 0XA4,0X07,0X00,0X00,0X52,0XA1,0XA3,0X9E,0X99,0X24,0X9F,0X00,0X07,0X01,0X0C,0X26, + 0X4D,0X58,0X3D,0X15,0X02,0X85,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4, + 0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X9E,0X55,0X05, + 0X64,0X95,0X98,0X99,0X99,0X77,0X80,0X55,0X81,0X9A,0X0A,0X5D,0X5F,0X62,0X7F,0X99, + 0X9A,0X98,0X97,0X75,0X6B,0X6B,0X83,0X6A,0X13,0X6B,0X6C,0X6D,0X70,0X72,0X76,0X79, + 0X7E,0X83,0X88,0X8C,0X91,0X95,0X99,0X9C,0X9E,0XA0,0XA1,0XA2,0XA2,0X84,0XA3,0X10, + 0XA5,0XA8,0XA8,0XA3,0X9E,0X9A,0X97,0X94,0X90,0X8E,0X8D,0X90,0X95,0X9D,0X67,0X48, + 0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74, + 0X6A,0X62,0X5A,0X9D,0X55,0X09,0X62,0X8B,0X8D,0X8F,0X8E,0X72,0X55,0X56,0X56,0X57, + 0X81,0X8F,0X09,0X64,0X68,0X6B,0X6F,0X80,0X8E,0X8F,0X8E,0X8D,0X7C,0X80,0X77,0X81, + 0X76,0X12,0X77,0X78,0X7A,0X7C,0X7F,0X82,0X86,0X8A,0X8D,0X91,0X95,0X98,0X9B,0X9D, + 0X9F,0XA0,0XA1,0XA2,0XA2,0X85,0XA3,0X10,0XA5,0XA1,0XA1,0XA0,0X9B,0X97,0X93,0X8E, + 0X8B,0X8A,0X8B,0X90,0X9A,0XA3,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA8, + 0X00,0X05,0X1D,0X7C,0X80,0X84,0X82,0X42,0X82,0X00,0X81,0X85,0X82,0X00,0X05,0X42, + 0X82,0X84,0X80,0X7C,0X1D,0XAC,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0XA7,0X00,0X05,0X1B,0X73,0X77,0X7A,0X79,0X3D,0X83,0X00,0X81,0X7B,0X83,0X00, + 0X05,0X3D,0X79,0X7A,0X77,0X73,0X1B,0XAB,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X0E, + 0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X9A, + 0X55,0X0C,0X5B,0X70,0X71,0X72,0X71,0X63,0X55,0X56,0X57,0X58,0X5D,0X61,0X68,0X81, + 0X72,0X0C,0X86,0X8B,0X8F,0X92,0X94,0X96,0X97,0X85,0X73,0X72,0X73,0X75,0X90,0X81, + 0X97,0X0D,0X98,0X98,0X99,0X9A,0X9B,0X9C,0X9D,0X9E,0X9F,0XA0,0XA1,0XA1,0XA2,0XA2, + 0X89,0XA3,0X11,0XA2,0XA1,0X9F,0X9C,0X98,0X92,0X8C,0X85,0X82,0X82,0X87,0X91,0X9E, + 0XAB,0XB7,0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A, + 0X91,0X89,0X7F,0X75,0X6A,0X62,0X5A,0X99,0X55,0X0D,0X59,0X67,0X67,0X68,0X68,0X5E, + 0X55,0X55,0X56,0X58,0X5C,0X61,0X68,0X71,0X81,0X68,0X0D,0X91,0X94,0X97,0X99,0X9B, + 0X9C,0X9C,0X9D,0X83,0X69,0X68,0X6A,0X6C,0X91,0X82,0X9D,0X06,0X9E,0X9E,0X9F,0XA0, + 0XA0,0XA1,0XA1,0X80,0XA2,0X8B,0XA3,0X11,0XA2,0XA1,0X9F,0X9B,0X96,0X8F,0X88,0X82, + 0X7F,0X81,0X88,0X93,0XA1,0XAF,0XBB,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X80,0X00,0X07,0X01,0X06,0X12,0X21,0X1E,0X11,0X04,0X01,0X99,0X00,0X05,0X15,0X58, + 0X5B,0X5D,0X5C,0X2E,0X86,0X00,0X81,0X5E,0X86,0X00,0X05,0X2E,0X5C,0X5D,0X5B,0X58, + 0X15,0XA8,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00,0X07, + 0X04,0X15,0X3B,0X5A,0X55,0X32,0X10,0X02,0X98,0X00,0X05,0X12,0X4E,0X51,0X53,0X52, + 0X29,0X87,0X00,0X81,0X54,0X87,0X00,0X05,0X29,0X52,0X53,0X51,0X4E,0X12,0XA7,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA4,0XA1,0XA7, + 0XAD,0XA8,0X92,0X75,0X63,0X5B,0X96,0X55,0X01,0X52,0X4A,0X80,0X49,0X00,0X4F,0X81, + 0X55,0X06,0X56,0X5A,0X60,0X69,0X74,0X7F,0X8A,0X81,0X49,0X04,0XA0,0XA1,0XA1,0XA2, + 0XA2,0X83,0XA3,0X05,0X77,0X4B,0X4A,0X4C,0X4F,0X8F,0X8A,0XA3,0X84,0XA2,0X83,0XA3, + 0X11,0XA2,0XA0,0X9D,0X97,0X90,0X88,0X80,0X7C,0X7B,0X82,0X8D,0X9A,0XA8,0XB5,0XBE, + 0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA4,0XA1,0XA8,0XAE, + 0XA9,0X93,0X76,0X64,0X5A,0X95,0X55,0X05,0X50,0X40,0X40,0X3F,0X3F,0X4A,0X81,0X55, + 0X07,0X56,0X58,0X5C,0X63,0X6E,0X79,0X85,0X8F,0X81,0X3F,0X80,0XA2,0X86,0XA3,0X05, + 0X72,0X41,0X40,0X43,0X46,0X8D,0X86,0XA3,0X81,0XA2,0X82,0XA1,0X81,0XA2,0X14,0XA3, + 0XA3,0XA2,0XA2,0X9F,0X9C,0X96,0X8F,0X86,0X7F,0X7B,0X7B,0X82,0X8E,0X9B,0XA9,0XB6, + 0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00,0X07,0X04,0X1A,0X43, + 0X61,0X59,0X33,0X10,0X04,0X95,0X00,0X05,0X0C,0X31,0X33,0X35,0X34,0X1A,0X8A,0X00, + 0X81,0X35,0X8A,0X00,0X05,0X1A,0X34,0X35,0X33,0X31,0X0C,0XA4,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0X00,0X07,0X01,0X08,0X18,0X25,0X22,0X12, + 0X04,0X01,0X94,0X00,0X05,0X09,0X28,0X29,0X2B,0X2A,0X15,0X8B,0X00,0X81,0X2B,0X8B, + 0X00,0X05,0X15,0X2A,0X2B,0X29,0X28,0X09,0XA3,0X00,0X02,0X67,0X48,0X30,0X83,0X00, + 0X0E,0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X92,0X89,0X80,0X75,0X6A,0X62,0X5A, + 0X92,0X55,0X05,0X4A,0X26,0X25,0X23,0X24,0X3D,0X82,0X55,0X09,0X56,0X56,0X58,0X5D, + 0X64,0X6F,0X7C,0X87,0X92,0X99,0X81,0X23,0X8C,0XA3,0X10,0X65,0X26,0X24,0X28,0X2C, + 0X87,0XA3,0XA3,0XA2,0XA2,0XA1,0X9F,0X9E,0X9C,0X9A,0X97,0X95,0X80,0X94,0X19,0X96, + 0X98,0X9A,0X9C,0X9E,0XA0,0XA1,0XA1,0XA0,0X9D,0X99,0X92,0X8A,0X81,0X7A,0X78,0X7B, + 0X84,0X91,0X9D,0XAA,0XB6,0XBF,0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF, + 0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X91,0X55,0X05,0X48,0X20, + 0X1E,0X1C,0X1D,0X39,0X84,0X55,0X08,0X56,0X5A,0X60,0X69,0X74,0X80,0X8B,0X95,0X9B, + 0X81,0X1C,0X8D,0XA3,0X2C,0X61,0X1F,0X1D,0X21,0X25,0X85,0XA2,0XA2,0XA1,0X9F,0X9D, + 0X9A,0X97,0X93,0X90,0X8D,0X8B,0X8A,0X8B,0X8D,0X90,0X94,0X97,0X9B,0X9D,0X9F,0X9F, + 0X9E,0X9C,0X97,0X90,0X88,0X7F,0X78,0X77,0X7B,0X85,0X91,0X9E,0XAB,0XB6,0XBF,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0XD6,0XFF,0X8C,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0XD6,0X33,0X8C,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X10,0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E, + 0X74,0X6A,0X62,0X5A,0X34,0X33,0XD2,0X2E,0X13,0X33,0X36,0X90,0X8E,0X89,0X82,0X7B, + 0X75,0X73,0X75,0X7D,0X88,0X94,0XA0,0XAC,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X11, + 0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X36, + 0X32,0X27,0XD0,0X26,0X14,0X27,0X32,0X3B,0X86,0X85,0X80,0X7A,0X75,0X71,0X71,0X76, + 0X7E,0X89,0X95,0XA0,0XAC,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0X89,0X00,0X02,0X27,0X31,0X22,0XD0,0X1E,0X02,0X22,0X31,0X27,0X8C,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X02,0X21,0X30,0X1F,0XD0,0X17, + 0X02,0X1F,0X30,0X21,0X8C,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X11,0XC3,0XB4,0X91, + 0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X40,0X2E,0X1D,0XD0, + 0X0F,0X14,0X1D,0X2E,0X47,0X64,0X64,0X62,0X62,0X64,0X67,0X6F,0X78,0X82,0X8D,0X98, + 0XA2,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X11,0XC3,0XB4,0X91,0XBF,0XB7,0XAD, + 0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X46,0X2D,0X1F,0XD0,0X07,0X14,0X1F, + 0X2D,0X4A,0X5D,0X5D,0X5C,0X5D,0X62,0X67,0X6F,0X7A,0X83,0X8E,0X99,0XA2,0XAD,0XB7, + 0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X89,0X00,0X02,0X08,0X2A,0X23, + 0X82,0X01,0X00,0X00,0X84,0X01,0X00,0X00,0X84,0X01,0X00,0X00,0X84,0X01,0X00,0X00, + 0X84,0X01,0X00,0X00,0X84,0X01,0X00,0X00,0X84,0X01,0X00,0X00,0X84,0X01,0X00,0X00, + 0X84,0X01,0X00,0X00,0X84,0X01,0X00,0X00,0X82,0X01,0X02,0X23,0X2A,0X08,0X8C,0X00, + 0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8A,0X00,0X02,0X20,0X2A,0X0A, + 0XCE,0X00,0X02,0X0A,0X2A,0X20,0X8D,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X12,0XC3, + 0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X55,0X3E, + 0X28,0X13,0XCE,0X00,0X02,0X13,0X28,0X3E,0X81,0X55,0X0E,0X59,0X61,0X69,0X73,0X7D, + 0X86,0X90,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X12,0XC3,0XB4,0X91, + 0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X55,0X49,0X26,0X1C, + 0XCE,0X00,0X02,0X1C,0X26,0X49,0X81,0X55,0X0E,0X5A,0X62,0X69,0X73,0X7E,0X87,0X91, + 0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8B,0X00, + 0X02,0X19,0X24,0X06,0XCC,0X00,0X02,0X06,0X24,0X19,0X8E,0X00,0X02,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X8B,0X00,0X02,0X0D,0X22,0X10,0XCC,0X00,0X02,0X10, + 0X22,0X0D,0X8E,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X14,0XC3,0XB4,0X91,0XBF,0XB7, + 0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X55,0X55,0X51,0X2E,0X1D,0X04, + 0XCA,0X00,0X03,0X08,0X1D,0X2E,0X51,0X82,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87, + 0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBF, + 0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X80,0X55,0X02,0X40,0X1F, + 0X13,0XCA,0X00,0X02,0X13,0X1F,0X40,0X83,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87, + 0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8C, + 0X00,0X03,0X01,0X13,0X1C,0X08,0XC8,0X00,0X03,0X08,0X1C,0X13,0X01,0X8F,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8D,0X00,0X03,0X08,0X18,0X11,0X02, + 0XC6,0X00,0X03,0X02,0X11,0X18,0X08,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X0E, + 0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X82, + 0X55,0X02,0X39,0X1A,0X0D,0XC6,0X00,0X02,0X0D,0X1A,0X38,0X85,0X55,0X0E,0X5A,0X62, + 0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X0E, + 0XC3,0XB4,0X91,0XBF,0XB7,0XAD,0XA3,0X9A,0X91,0X87,0X7E,0X74,0X6A,0X62,0X5A,0X82, + 0X55,0X03,0X52,0X30,0X16,0X09,0XC4,0X00,0X03,0X09,0X16,0X2E,0X50,0X85,0X55,0X0E, + 0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83, + 0X00,0X02,0XC3,0XB4,0X91,0X8F,0X00,0X03,0X05,0X11,0X11,0X05,0XC2,0X00,0X03,0X05, + 0X11,0X11,0X05,0X92,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X90, + 0X00,0X03,0X06,0X11,0X0E,0X03,0XC0,0X00,0X03,0X03,0X0E,0X11,0X06,0X93,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X0E,0XC3,0XB4,0X91,0XBD,0XB4,0XAA,0XA0,0X96,0X8E,0X85, + 0X7D,0X73,0X69,0X61,0X59,0X80,0X55,0X08,0X56,0X58,0X5E,0X64,0X6E,0X55,0X22,0X0C, + 0X03,0XBE,0X00,0X03,0X03,0X0C,0X1C,0X3E,0X88,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E, + 0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X1B,0XC3,0XB4,0X91, + 0XB8,0XAF,0XA6,0X9B,0X94,0X8B,0X82,0X7A,0X71,0X68,0X61,0X59,0X56,0X55,0X56,0X58, + 0X5C,0X62,0X6A,0X75,0X80,0X5E,0X23,0X0B,0X02,0XBC,0X00,0X03,0X02,0X0B,0X1A,0X3C, + 0X89,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X93,0X00,0X03,0X05,0X0C,0X0A,0X03,0XBA, + 0X00,0X03,0X03,0X0A,0X0C,0X05,0X96,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X94,0X00,0X03,0X04,0X0A,0X09,0X03,0XB8,0X00,0X03,0X03,0X09,0X0A,0X04, + 0X97,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X1E,0XC3,0XB4,0X91,0XA1,0X9A,0X92,0X8C, + 0X86,0X81,0X7B,0X76,0X70,0X69,0X64,0X5F,0X5D,0X5F,0X62,0X68,0X6F,0X78,0X82,0X8B, + 0X93,0X99,0X9D,0XA0,0X85,0X44,0X09,0X04,0XB6,0X00,0X03,0X04,0X09,0X27,0X47,0X8C, + 0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48, + 0X30,0X83,0X00,0X20,0XC3,0XB4,0X91,0X9A,0X96,0X90,0X8B,0X87,0X83,0X7F,0X7A,0X75, + 0X6E,0X6A,0X66,0X64,0X67,0X6B,0X72,0X79,0X82,0X8A,0X92,0X97,0X9C,0X9F,0XA1,0XA2, + 0X9B,0X5B,0X1A,0X05,0X01,0XB2,0X00,0X04,0X01,0X05,0X11,0X31,0X51,0X8D,0X55,0X0E, + 0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83, + 0X00,0X02,0XC3,0XB4,0X91,0X98,0X00,0X03,0X02,0X05,0X04,0X01,0XB0,0X00,0X03,0X01, + 0X04,0X05,0X02,0X9B,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9A, + 0X00,0X02,0X03,0X05,0X02,0XAE,0X00,0X08,0X02,0X05,0X03,0X00,0X00,0X01,0X00,0X00, + 0X01,0X97,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X19,0XC3,0XB4,0X91,0X9D,0X9D,0X9B, + 0X9B,0X9A,0X98,0X96,0X93,0X90,0X8D,0X8A,0X88,0X87,0X89,0X8C,0X90,0X94,0X98,0X9B, + 0X9E,0XA0,0XA1,0XA2,0X84,0XA3,0X04,0X8A,0X53,0X18,0X02,0X01,0XA8,0X00,0X07,0X01, + 0X02,0X0E,0X2D,0X48,0X56,0X55,0X55,0X81,0X56,0X8B,0X55,0X0E,0X5A,0X62,0X6A,0X74, + 0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X18,0XC3,0XB4, + 0X91,0XA1,0XA0,0XA0,0X9F,0X9E,0X9D,0X9C,0X9A,0X98,0X96,0X93,0X92,0X92,0X93,0X95, + 0X97,0X9A,0X9C,0X9E,0XA0,0XA1,0XA2,0X87,0XA3,0X04,0X87,0X54,0X1C,0X02,0X01,0XA4, + 0X00,0X09,0X01,0X02,0X10,0X2C,0X47,0X55,0X56,0X56,0X55,0X57,0X81,0X56,0X03,0X57, + 0X56,0X55,0X56,0X87,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD, + 0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XA0,0X00,0X81,0X01,0XA0, + 0X00,0X81,0X01,0X0F,0X00,0X01,0X00,0X00,0X02,0X02,0X03,0X03,0X06,0X05,0X05,0X04, + 0X03,0X01,0X01,0X02,0X93,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91, + 0XA4,0X00,0X01,0X01,0X01,0X9C,0X00,0X01,0X01,0X01,0X83,0X00,0X05,0X01,0X01,0X03, + 0X03,0X06,0X08,0X80,0X09,0X06,0X07,0X05,0X03,0X02,0X01,0X02,0X01,0X91,0X00,0X02, + 0X67,0X48,0X30,0X83,0X00,0X04,0XC3,0XB4,0X91,0XA4,0XA4,0X81,0XA3,0X80,0XA2,0X80, + 0XA1,0X00,0XA0,0X80,0XA1,0X80,0XA2,0X92,0XA3,0X01,0X88,0X66,0X9A,0X00,0X01,0X35, + 0X47,0X83,0X55,0X10,0X56,0X56,0X57,0X59,0X5B,0X5D,0X5F,0X60,0X60,0X5F,0X5D,0X5C, + 0X59,0X58,0X56,0X55,0X56,0X85,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A, + 0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X03,0XC3,0XB4,0X91,0XA4,0X86,0XA3, + 0X83,0XA2,0X97,0XA3,0X82,0X00,0X01,0X01,0X01,0X8C,0X00,0X01,0X01,0X01,0X82,0X00, + 0X83,0X55,0X81,0X56,0X0E,0X58,0X5B,0X5E,0X62,0X68,0X6B,0X6C,0X68,0X65,0X60,0X5C, + 0X5A,0X57,0X56,0X56,0X85,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3, + 0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XCB,0X00,0X11,0X01, + 0X03,0X03,0X08,0X0D,0X14,0X1F,0X36,0X47,0X51,0X40,0X2B,0X19,0X0F,0X09,0X05,0X00, + 0X02,0X91,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XCC,0X00,0X11, + 0X02,0X06,0X0A,0X12,0X1C,0X39,0X66,0X96,0XA3,0X83,0X4B,0X27,0X15,0X0E,0X09,0X03, + 0X01,0X01,0X90,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9F,0XA3, + 0X80,0XA2,0X01,0XA1,0XA1,0X80,0XA0,0X9A,0X00,0X83,0X55,0X13,0X56,0X56,0X57,0X59, + 0X5D,0X62,0X6E,0X86,0XBA,0XE0,0XE8,0XD2,0X9E,0X78,0X69,0X5F,0X5B,0X58,0X56,0X56, + 0X84,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X9C,0XA3,0X80,0XA2,0X07,0XA1,0XA0,0XA0, + 0X9F,0X9E,0X9E,0X9D,0X9D,0X9A,0X00,0X85,0X55,0X11,0X57,0X5A,0X5E,0X65,0X70,0X8E, + 0XC2,0XE8,0XF0,0XDC,0XA7,0X7A,0X6A,0X60,0X5B,0X58,0X57,0X56,0X84,0X55,0X0E,0X5A, + 0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0XCA,0X00,0X13,0X02,0X02,0X03,0X06,0X0D,0X15,0X25,0X49,0X86, + 0XBE,0XCB,0XA9,0X66,0X32,0X1A,0X12,0X09,0X04,0X03,0X01,0X90,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0XCB,0X00,0X11,0X02,0X01,0X07,0X0B,0X14,0X1F, + 0X33,0X52,0X74,0X7D,0X64,0X40,0X25,0X1A,0X0F,0X09,0X03,0X01,0X91,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8B,0XA3,0X1B,0XA4,0XA3,0XA3,0XA4,0XA3, + 0XA4,0XA4,0XA3,0XA3,0XA4,0XA3,0XA3,0XA2,0XA2,0XA1,0XA0,0X9E,0X9D,0X9B,0X98,0X95, + 0X92,0X8F,0X8B,0X89,0X86,0X85,0X83,0X9A,0X00,0X84,0X55,0X12,0X56,0X56,0X58,0X5B, + 0X5F,0X65,0X6B,0X74,0X7C,0X7E,0X79,0X71,0X68,0X62,0X5D,0X5A,0X57,0X55,0X56,0X84, + 0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X87,0XA3,0X81,0XA4,0X81,0XA3,0X00,0XA4,0X82, + 0XA3,0X11,0XA4,0XA2,0XA2,0XA1,0X9F,0X9D,0X9B,0X98,0X95,0X91,0X8D,0X88,0X84,0X80, + 0X7D,0X7A,0X78,0X77,0X80,0X76,0X01,0X75,0X74,0X90,0X00,0X89,0X55,0X12,0X56,0X56, + 0X57,0X59,0X5C,0X60,0X64,0X6C,0X6C,0X6D,0X6E,0X67,0X62,0X5F,0X5A,0X58,0X57,0X56, + 0X56,0X84,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF, + 0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X83,0X00,0X10,0X01,0X01,0X02,0X03, + 0X03,0X04,0X03,0X03,0X04,0X03,0X00,0X02,0X01,0X00,0X00,0X01,0X01,0XB3,0X00,0X11, + 0X01,0X02,0X01,0X02,0X05,0X07,0X0B,0X0F,0X14,0X16,0X15,0X15,0X11,0X0E,0X09,0X06, + 0X03,0X02,0X92,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00, + 0X05,0X01,0X01,0X02,0X03,0X04,0X07,0X80,0X08,0X03,0X07,0X05,0X04,0X02,0X80,0X01, + 0X80,0X00,0X00,0X01,0XB4,0X00,0X0E,0X02,0X01,0X01,0X04,0X06,0X08,0X0C,0X0D,0X0C, + 0X0C,0X09,0X07,0X04,0X04,0X03,0X93,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X81,0XA3,0X0D,0XA4,0XA3,0XA4,0XA6,0XA7,0XA8,0XA8,0XA9,0XA9,0XA8,0XA7, + 0XA6,0XA4,0XA4,0X82,0XA3,0X14,0XA2,0XA1,0X9F,0X9D,0X99,0X94,0X8D,0X86,0X7F,0X78, + 0X71,0X6B,0X66,0X62,0X5F,0X5D,0X5C,0X5B,0X5A,0X59,0X5A,0X80,0X59,0X90,0X00,0X8B, + 0X55,0X04,0X56,0X56,0X57,0X58,0X58,0X80,0X59,0X05,0X5A,0X59,0X57,0X57,0X56,0X56, + 0X87,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X82,0XA3,0X04,0XA4,0XA6,0XA7,0XA8,0XAB, + 0X80,0XAC,0X05,0XAB,0XA9,0XA8,0XA6,0XA5,0XA4,0X80,0XA3,0X10,0XA2,0XA2,0XA0,0X9E, + 0X9A,0X95,0X8E,0X86,0X7D,0X75,0X6D,0X67,0X61,0X5E,0X5B,0X59,0X58,0X80,0X57,0X82, + 0X56,0X90,0X00,0X00,0X42,0X8D,0X55,0X01,0X56,0X56,0X83,0X57,0X00,0X56,0X88,0X55, + 0X0F,0X58,0X5D,0X65,0X6C,0X75,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48, + 0X30,0X83,0X00,0X17,0XC3,0XB4,0X91,0X00,0X00,0X01,0X02,0X02,0X05,0X08,0X10,0X16, + 0X1F,0X25,0X28,0X25,0X22,0X1B,0X14,0X0B,0X08,0X05,0X02,0X01,0XBB,0X00,0X0A,0X01, + 0X02,0X01,0X02,0X01,0X01,0X00,0X01,0X00,0X01,0X01,0X84,0X00,0X07,0X01,0X03,0X0E, + 0X21,0X27,0X1A,0X09,0X02,0X84,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X17,0XC3,0XB4, + 0X91,0X00,0X00,0X01,0X00,0X04,0X06,0X0D,0X16,0X1F,0X29,0X33,0X37,0X34,0X2D,0X24, + 0X1A,0X10,0X09,0X06,0X03,0X01,0XBC,0X00,0X01,0X01,0X01,0X81,0X00,0X01,0X02,0X01, + 0X86,0X00,0X08,0X01,0X0E,0X30,0X5B,0X68,0X49,0X1B,0X05,0X03,0X83,0X00,0X02,0X67, + 0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0XA3,0X1F,0XA4,0XA4,0XA6,0XA9,0XAC, + 0XB1,0XB8,0XCB,0XD6,0XC3,0XB8,0XB3,0XAF,0XAA,0XA7,0XA5,0XA4,0XA3,0XA2,0XA1,0X9E, + 0X9B,0X95,0X8D,0X83,0X78,0X6D,0X64,0X5D,0X59,0X57,0X56,0X86,0X55,0X02,0X42,0X06, + 0X03,0X91,0X00,0X02,0X03,0X06,0X42,0X8B,0X55,0X00,0X56,0X8D,0X55,0X11,0X57,0X63, + 0X81,0XA1,0XA9,0X9D,0X86,0X81,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0XA3,0X1F,0XA4,0XA5,0XA6,0XA9,0XAD,0XB3,0XC5, + 0XE9,0XF6,0XDA,0XBA,0XB4,0XB0,0XAB,0XA7,0XA5,0XA4,0XA2,0XA2,0XA0,0X9D,0X98,0X91, + 0X87,0X7C,0X71,0X67,0X5F,0X5A,0X57,0X55,0X56,0X85,0X55,0X02,0X42,0X09,0X01,0X93, + 0X00,0X02,0X01,0X09,0X42,0X9B,0X55,0X11,0X57,0X64,0X84,0XA3,0XAB,0X9F,0X89,0X81, + 0X88,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X03,0XC3,0XB4,0X91, + 0X00,0X80,0X01,0X10,0X05,0X0A,0X11,0X1B,0X2A,0X5C,0XC1,0XE4,0X96,0X3F,0X30,0X22, + 0X16,0X0D,0X07,0X03,0X01,0X92,0X00,0X03,0X02,0X09,0X03,0X01,0X93,0X00,0X03,0X04, + 0X04,0X09,0X02,0X99,0X00,0X08,0X01,0X03,0X0F,0X39,0X66,0X72,0X53,0X20,0X07,0X84, + 0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X10,0X04,0X08, + 0X10,0X1A,0X25,0X3B,0X6C,0X89,0X57,0X38,0X2A,0X1F,0X13,0X0B,0X06,0X03,0X01,0X91, + 0X00,0X05,0X03,0X0E,0X05,0X02,0X0F,0X04,0X91,0X00,0X05,0X06,0X0E,0X02,0X04,0X0E, + 0X04,0X99,0X00,0X06,0X01,0X04,0X12,0X28,0X2F,0X20,0X0A,0X85,0X00,0X02,0X67,0X48, + 0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X80,0XA3,0X1C,0XA4,0XA4,0XA6,0XA7,0XAA,0XAD, + 0XB1,0XB4,0XB6,0XB4,0XB3,0XB0,0XAC,0XA9,0XA6,0XA5,0XA2,0XA1,0X9F,0X9C,0X96,0X8E, + 0X83,0X77,0X6B,0X61,0X5B,0X57,0X56,0X85,0X55,0X07,0X41,0X18,0X09,0X00,0X00,0X05, + 0X15,0X05,0X8F,0X00,0X07,0X09,0X14,0X02,0X00,0X00,0X08,0X18,0X41,0X9A,0X55,0X0F, + 0X57,0X5E,0X67,0X6C,0X75,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30, + 0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0XA3,0X1A,0XA4,0XA5,0XA7,0XA9,0XAB,0XAD,0XAF, + 0XB0,0XB0,0XAF,0XAC,0XAA,0XA7,0XA6,0XA4,0XA2,0XA1,0X9E,0X9A,0X93,0X8A,0X7E,0X72, + 0X67,0X5E,0X59,0X56,0X85,0X55,0X02,0X40,0X1C,0X0B,0X81,0X00,0X02,0X06,0X1A,0X06, + 0X8D,0X00,0X02,0X0B,0X19,0X03,0X81,0X00,0X02,0X0A,0X1C,0X40,0X9A,0X55,0X0E,0X5A, + 0X63,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00, + 0X02,0XC3,0XB4,0X91,0X81,0X00,0X10,0X02,0X03,0X05,0X09,0X0E,0X11,0X16,0X19,0X18, + 0X15,0X10,0X0C,0X07,0X04,0X02,0X01,0X01,0X8E,0X00,0X02,0X07,0X1F,0X0A,0X83,0X00, + 0X02,0X08,0X20,0X08,0X8B,0X00,0X02,0X0E,0X1F,0X04,0X83,0X00,0X02,0X09,0X1F,0X08, + 0XA5,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X81,0X00,0X0E,0X01, + 0X01,0X04,0X05,0X07,0X0B,0X0D,0X0D,0X0E,0X0C,0X09,0X07,0X05,0X03,0X02,0X8F,0X00, + 0X02,0X08,0X25,0X0C,0X85,0X00,0X02,0X09,0X26,0X09,0X89,0X00,0X02,0X11,0X23,0X05, + 0X85,0X00,0X02,0X0B,0X25,0X09,0XA4,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3, + 0XB4,0X91,0X81,0XA3,0X04,0XA4,0XA4,0XA3,0XA4,0XA4,0X81,0XA6,0X01,0XA5,0XA5,0X80, + 0XA4,0X0C,0XA3,0XA1,0X9E,0X9A,0X93,0X89,0X7E,0X71,0X66,0X5D,0X59,0X56,0X56,0X82, + 0X55,0X02,0X3F,0X2B,0X10,0X87,0X00,0X02,0X0A,0X2B,0X0A,0X87,0X00,0X02,0X13,0X28, + 0X05,0X87,0X00,0X02,0X0E,0X2C,0X3F,0X97,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87, + 0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X86, + 0XA3,0X84,0XA4,0X0C,0XA3,0XA4,0XA2,0XA0,0X9D,0X98,0X90,0X86,0X79,0X6D,0X63,0X5C, + 0X57,0X83,0X55,0X02,0X3F,0X2E,0X11,0X89,0X00,0X02,0X0B,0X2F,0X0B,0X85,0X00,0X02, + 0X14,0X2C,0X06,0X89,0X00,0X02,0X0F,0X2F,0X3F,0X96,0X55,0X0E,0X5A,0X62,0X6A,0X74, + 0X7E,0X87,0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4, + 0X91,0X83,0X00,0X01,0X02,0X00,0X80,0X01,0X05,0X02,0X02,0X01,0X00,0X00,0X01,0X8E, + 0X00,0X02,0X0A,0X2D,0X0F,0X8B,0X00,0X02,0X0B,0X2F,0X0B,0X83,0X00,0X02,0X14,0X2C, + 0X06,0X8B,0X00,0X02,0X0D,0X2E,0X0B,0XA1,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02, + 0XC3,0XB4,0X91,0X83,0X00,0X00,0X01,0X84,0X00,0X00,0X01,0X8F,0X00,0X02,0X0A,0X2D, + 0X0F,0X8D,0X00,0X02,0X0B,0X2F,0X0B,0X81,0X00,0X02,0X14,0X2C,0X06,0X8D,0X00,0X02, + 0X0D,0X2E,0X0B,0XA0,0X00,0X02,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8E, + 0XA3,0X0A,0XA2,0XA0,0X9D,0X98,0X91,0X86,0X7A,0X6E,0X63,0X5C,0X57,0X81,0X55,0X02, + 0X3F,0X2E,0X11,0X8F,0X00,0X07,0X0B,0X2F,0X0B,0X00,0X00,0X14,0X2C,0X06,0X8F,0X00, + 0X02,0X0F,0X2F,0X3F,0X93,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87,0X91,0X9A,0XA3, + 0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XC3,0XB4,0X91,0X8E,0XA3,0X0A,0XA2, + 0XA0,0X9C,0X97,0X8E,0X83,0X77,0X6A,0X61,0X5A,0X56,0X80,0X55,0X05,0X42,0X27,0X11, + 0X00,0X00,0X09,0X8D,0X11,0X07,0X09,0X0B,0X18,0X00,0X04,0X2A,0X06,0X09,0X8D,0X11, + 0X05,0X09,0X00,0X01,0X0F,0X2C,0X42,0X92,0X55,0X0E,0X5A,0X62,0X6A,0X74,0X7E,0X87, + 0X91,0X9A,0XA3,0XAD,0XB7,0XBF,0X67,0X48,0X30,0X83,0X00,0X02,0XB4,0X9B,0X75,0XCE, + 0X67,0X00,0X66,0X9F,0X67,0X02,0X59,0X3F,0X30,0X83,0X00,0X02,0X8E,0X6C,0X55,0XAA, + 0X48,0X04,0X47,0X46,0X46,0X47,0X47,0XBF,0X48,0X02,0X3F,0X30,0X30,0X83,0X00,0X02, + 0X69,0X4D,0X37,0XA9,0X30,0X06,0X2F,0X2A,0X25,0X22,0X26,0X2B,0X2F,0XC1,0X30,0XFF, + 0X00,0XFF,0X00,0XFF,0X00,0XDA,0X00,0X16,0X02,0X05,0X08,0X0C,0X0F,0X13,0X16,0X1A, + 0X1D,0X1F,0X1F,0X22,0X26,0X2B,0X30,0X35,0X3B,0X40,0X45,0X4A,0X50,0X55,0X59,0X81, + 0X5C,0X00,0X2A,0XE1,0X00,0X16,0X03,0X08,0X0E,0X14,0X1A,0X1F,0X25,0X2B,0X30,0X33, + 0X33,0X38,0X3F,0X47,0X50,0X59,0X62,0X6A,0X73,0X7C,0X85,0X8D,0X94,0X80,0X99,0X01, + 0X64,0X03,0XE1,0X00,0X1A,0X03,0X08,0X0E,0X14,0X1A,0X1F,0X25,0X2B,0X30,0X33,0X33, + 0X38,0X3F,0X47,0X50,0X59,0X62,0X6A,0X73,0X7C,0X85,0X8D,0X94,0X99,0X99,0X64,0X03, + 0XE2,0X00,0X19,0X03,0X08,0X0E,0X14,0X1A,0X1F,0X25,0X2B,0X30,0X33,0X33,0X38,0X3F, + 0X47,0X50,0X59,0X62,0X6A,0X73,0X7C,0X85,0X8D,0X94,0X99,0X64,0X03,0XE3,0X00,0X18, + 0X03,0X08,0X0E,0X14,0X1A,0X1F,0X25,0X2B,0X30,0X33,0X33,0X38,0X3F,0X47,0X50,0X59, + 0X62,0X6A,0X73,0X7C,0X85,0X8D,0X94,0X64,0X03,0XE4,0X00,0X17,0X03,0X08,0X0E,0X14, + 0X1A,0X1F,0X25,0X2B,0X30,0X33,0X33,0X38,0X3F,0X47,0X50,0X59,0X62,0X6A,0X73,0X7C, + 0X85,0X8D,0X61,0X03,0XE5,0X00,0X07,0X01,0X02,0X03,0X04,0X05,0X06,0X07,0X09,0X80, + 0X0A,0X0B,0X13,0X3F,0X47,0X50,0X59,0X62,0X6A,0X73,0X7C,0X85,0X5C,0X03,0X98,0X00, + 0X01,0X01,0X03,0XD4,0X00,0X0A,0X0A,0X3F,0X47,0X50,0X59,0X62,0X6A,0X73,0X7C,0X57, + 0X03,0X98,0X00,0X02,0X01,0X29,0X0A,0XD4,0X00,0X09,0X0A,0X3F,0X47,0X50,0X59,0X62, + 0X6A,0X73,0X51,0X03,0X98,0X00,0X03,0X02,0X2E,0X3F,0X0A,0XD4,0X00,0X08,0X0A,0X3F, + 0X47,0X50,0X59,0X62,0X6A,0X4B,0X02,0X98,0X00,0X04,0X02,0X34,0X47,0X3F,0X0A,0XD4, + 0X00,0X07,0X0A,0X3F,0X47,0X50,0X59,0X62,0X45,0X02,0X98,0X00,0X05,0X02,0X3A,0X50, + 0X47,0X3F,0X0A,0XD4,0X00,0X06,0X0A,0X3F,0X47,0X50,0X59,0X40,0X02,0X98,0X00,0X06, + 0X02,0X40,0X59,0X50,0X47,0X3F,0X0A,0XD4,0X00,0X05,0X0A,0X3F,0X47,0X50,0X3A,0X02, + 0X98,0X00,0X07,0X02,0X45,0X62,0X59,0X50,0X47,0X3F,0X0A,0XD4,0X00,0X04,0X0A,0X3F, + 0X47,0X34,0X02,0X98,0X00,0X08,0X02,0X4B,0X6A,0X62,0X59,0X50,0X47,0X3F,0X0A,0XD4, + 0X00,0X03,0X0A,0X3F,0X2E,0X02,0X98,0X00,0X09,0X03,0X51,0X73,0X6A,0X62,0X59,0X50, + 0X47,0X3F,0X0A,0XD4,0X00,0X02,0X0A,0X29,0X01,0X98,0X00,0X0A,0X03,0X57,0X7C,0X73, + 0X6A,0X62,0X59,0X50,0X47,0X3F,0X0A,0XD4,0X00,0X01,0X03,0X01,0X98,0X00,0X0B,0X03, + 0X5C,0X85,0X7C,0X73,0X6A,0X62,0X59,0X50,0X47,0X3F,0X13,0X80,0X0A,0X07,0X09,0X07, + 0X06,0X05,0X04,0X03,0X02,0X01,0XE5,0X00,0X17,0X03,0X61,0X8D,0X85,0X7C,0X73,0X6A, + 0X62,0X59,0X50,0X47,0X3F,0X38,0X33,0X33,0X30,0X2B,0X25,0X1F,0X1A,0X14,0X0E,0X08, + 0X03,0XE4,0X00,0X18,0X03,0X64,0X94,0X8D,0X85,0X7C,0X73,0X6A,0X62,0X59,0X50,0X47, + 0X3F,0X38,0X33,0X33,0X30,0X2B,0X25,0X1F,0X1A,0X14,0X0E,0X08,0X03,0XE3,0X00,0X19, + 0X03,0X64,0X99,0X94,0X8D,0X85,0X7C,0X73,0X6A,0X62,0X59,0X50,0X47,0X3F,0X38,0X33, + 0X33,0X30,0X2B,0X25,0X1F,0X1A,0X14,0X0E,0X08,0X03,0XE2,0X00,0X1A,0X03,0X64,0X99, + 0X99,0X94,0X8D,0X85,0X7C,0X73,0X6A,0X62,0X59,0X50,0X47,0X3F,0X38,0X33,0X33,0X30, + 0X2B,0X25,0X1F,0X1A,0X14,0X0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, + 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, + 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, + 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, + 0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF, + 0XFF,0XFF,0XFF +}; diff --git a/client/autocorr.cpp b/client/autocorr.cpp new file mode 100644 index 0000000..6a0d7c1 --- /dev/null +++ b/client/autocorr.cpp @@ -0,0 +1,172 @@ +// Copyright 2011 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + + +#include "sah_config.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOINC_APP_GRAPHICS +#include "graphics2.h" +#endif + +#include "util.h" +#include "s_util.h" +#include "analyze.h" +#include "gaussfit.h" +#include "seti.h" +#include "chirpfft.h" +#include "analyzeReport.h" +#include "analyzePoT.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + +#include "../db/schema_master.h" + +int FindAutoCorrelation( + float * AutoCorrelation, + int ul_NumDataPoints, + int fft_num, + SETI_WU_INFO& swi +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("FindAutoCorrelation()"); +#endif + // Because positive and negative delays are the same + // we only have to look at half the points + int i, j, k, m, retval, blksize; + float temp; + float total, MeanPower, partial; + AUTOCORR_INFO ai; + + i = j = k = m = 0; + total = 0.0f; + + int len = ul_NumDataPoints/2; + blksize = UNSTDMAX(4, UNSTDMIN(pow2((unsigned int) sqrt((float) (len / 32)) * 32), 512)); + + for(int b = 0; b < len/blksize; b++) { + partial = 0.0f; + for(i = 0; i < blksize; i++) { + AutoCorrelation[b*blksize+i]*=AutoCorrelation[b*blksize+i]; + partial += AutoCorrelation[b*blksize+i]; + } + total += partial; + } + MeanPower = total / ul_NumDataPoints; + + // Here we extract the autocorrs_to_report highest power events, + // outputing them as we go. + // Index usage: + // i : walk power spectrum us_NumToReport times + // j : walks power spectrum for each i + // k : marks current high power candidate while j walks on + // m : marks the current tail of the high power hit "list" + + + for (i = 0; i < swi.analysis_cfg.autocorr_per_spectrum; i++) { + + temp = 0.0; + + // Walk the array, looking for the first/next highest power. + // Start j at 1, in order to skip the DC (ie 0) bin. + // NOTE: this is a simple scan for high powers. Nice and fast + // for a very low i. If i is substantial, this code should be + // replaced with an index (q)sort. + for (j = 1; j < ul_NumDataPoints/2; j++) { + + if (AutoCorrelation[j] > temp) { + if (AutoCorrelation[j] < AutoCorrelation[m] || m == 0) { + temp = AutoCorrelation[j]; + k = j; + } + } + } // temp now = first/next highest power and k = it's bin number + + m = k; // save the "lowest" highest. + + //JWS: Sanity check, delayed peaks cannot be higher than the zero delay power. + if (temp > AutoCorrelation[0]) { + boinc_temporary_exit(5*60,"Impossible Autocorr power, retrying from checkpoint.",true); + } + + // autocorr info + ai.a.peak_power = temp/MeanPower; + ai.a.mean_power = 1.0; + ai.bin = k; + ai.fft_ind = fft_num; + ai.a.chirp_rate = ChirpFftPairs[analysis_state.icfft].ChirpRate; + ai.a.fft_len = ChirpFftPairs[analysis_state.icfft].FftLen; + ai.a.delay = ((float)ai.bin)/swi.subband_sample_rate; + ai.a.freq = swi.subband_center; + double t_offset=((double)ai.fft_ind+0.5)*(double)ai.a.fft_len/ + swi.subband_sample_rate; + ai.a.detection_freq=calc_detection_freq(ai.a.freq,ai.a.chirp_rate,t_offset); + ai.a.time = swi.time_recorded + t_offset / 86400.0; + time_to_ra_dec(ai.a.time, &ai.a.ra, &ai.a.decl); + + // Score used for "best of" and graphics. + ai.score = ai.a.peak_power / AUTOCORR_SCORE_HIGH; + ai.score = ai.score > 0.0 ? log10(ai.score) : -12.0; + // if best_autocorr.s.fft_len == 0, there is not yet a first autocorr + if (ai.score > best_autocorr->score || best_autocorr->a.fft_len == 0) { + *best_autocorr = ai; + if(verbose>=2){ + fprintf(stderr,"Best autocorr updated:"); + fprintf(stderr,"score=%.4g, peak_power=%.4g, bin=%d, fft_ind=%d, icfft=%d\n", + ai.score,ai.a.peak_power,ai.bin,ai.fft_ind,analysis_state.icfft); + } +#ifdef BOINC_APP_GRAPHICS + if (!nographics()) sah_graphics->ai.copy(&ai); +#endif + } + + // Report a signal if it excceeds threshold. + if (ai.a.peak_power > (swi.analysis_cfg.autocorr_thresh)) { + retval = result_autocorr(ai); + if(verbose>=1){ + int fft=(ai.a.fft_len>1024)?(ai.a.fft_len/1024):(ai.a.fft_len); + char symbol=(ai.a.fft_len>1024)?('k'):(' '); + fprintf(stderr,"Autocorr: peak=%.7g, time=%.4g, delay=%.5g, d_freq=%.12g, chirp=%.5g, fft_len=%d%c\n", + ai.a.peak_power,(ai.a.time-swi.time_recorded)*86400,ai.a.delay,ai.a.detection_freq,ai.a.chirp_rate,fft,symbol); + } + if (retval) SETIERROR(retval,"from result_autocorr()"); + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + diff --git a/client/autocorr.h b/client/autocorr.h new file mode 100644 index 0000000..9f63287 --- /dev/null +++ b/client/autocorr.h @@ -0,0 +1,34 @@ +// Copyright 2011 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +int FindAutoCorrelation( + float * AutoCorrelation, + int ul_NumDataPoints, + int fft_num, + SETI_WU_INFO& swi +); + diff --git a/client/chirpfft.cpp b/client/chirpfft.cpp new file mode 100644 index 0000000..e91ece9 --- /dev/null +++ b/client/chirpfft.cpp @@ -0,0 +1,328 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +#include "sah_config.h" + +#include +#include +#include +#include + +#include "diagnostics.h" +#include "util.h" +#include "s_util.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + + + +#include "seti_header.h" +#include "seti.h" +#include "util.h" +#include "filesys.h" +#include "s_util.h" +#include "analyze.h" +#include "worker.h" +#include "lcgamm.h" +#include "chirpfft.h" +#ifdef __arm__ +#include "vector/fp_arm.h" +#endif + +sh_sint8_t num_gaussian_searches; +sh_sint8_t num_pulse_searches; +sh_sint8_t num_triplet_searches; + +char * cfft_file = NULL; + +size_t GenChirpFftPairs( + ChirpFftPair_t ** ChirpFftPairs, + double * MinChirpStep +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("GenChirpFftPairs()"); +#endif + + long i, j, max_fft_len; + double CRate; + double ChirpRes = swi.analysis_cfg.chirp_resolution; + double NumSamples = swi.nsamples; + double WUDuration = (double)(swi.nsamples/swi.subband_sample_rate); + double SlewRate=static_cast(swi.angle_range)/WUDuration; + long MaxGaussFFTLen=swi.nsamples/swi.analysis_cfg.gauss_pot_length; + + double BeamsPerWU = std::max(swi.true_angle_range/swi.beam_width,1.0); + long MinPulseFFTLen=(long)ceil(swi.nsamples/(swi.analysis_cfg.pulse_max*BeamsPerWU*swi.analysis_cfg.pulse_beams)); + long MaxPulseFFTLen= + std::min((unsigned long)(swi.nsamples/(swi.analysis_cfg.pulse_min*swi.analysis_cfg.pulse_beams*BeamsPerWU)), + (unsigned long)swi.analysis_cfg.pulse_fft_max); + + //JWS: Adjustment to avoid Pulse finding for short PoT lengths which cannot + // produce a reportable signal. The adjustment is not applied until after a + // chirp/fft table entry has been generated using the original logic, otherwise + // it could affect Spikes and Triplets too. + long MaxPulseFFTLenAlt; + if(MaxPulseFFTLen < swi.analysis_fft_lengths[0]) { + // If motion is so extreme we already know there will be no pulsefinds, skip. + MaxPulseFFTLenAlt = MaxPulseFFTLen; + } else { + // Find actual longest allowed FFT length + for (i = swi.num_fft_lengths; i ; i--) { + MaxPulseFFTLenAlt = swi.analysis_fft_lengths[i - 1]; + if (MaxPulseFFTLenAlt <= MaxPulseFFTLen) break; + } + // An ideal folded pulse PoT would have all power in one element, That won't ever + // happen with real data, but simulation by putting all power into the first or second + // element of the original PulsePoT makes all folded PoTs ideal. Under those conditions, + // the shortest period tested at fold by 3 is seen as the best of the folded PoTs. Thus, + // to check whether a particular PulsePotLen can or cannot produce a reportable pulse + // the math for that fold level is used to determine if the threshold is low enough + // that an ideal PoT would be reportable. + while (MaxPulseFFTLenAlt > 1) { + int PulsePotLen = (int)(((NumSamples / MaxPulseFFTLenAlt) / (swi.analysis_cfg.pulse_beams*BeamsPerWU)) + 0.5); + int di = (PulsePotLen / 2 + 1) / 2; + float thresh = invert_lcgf((float)(-swi.analysis_cfg.pulse_thresh - log((float)di)), 3.0f, 0.0001f); + if (thresh <= (float)PulsePotLen) break; + if (i) MaxPulseFFTLenAlt = swi.analysis_fft_lengths[--i]; + else MaxPulseFFTLenAlt /= 2; + } + } + + long NumLimits = (long)swi.analysis_cfg.chirps.size(); + double * ChirpSteps ; + ChirpFftPair_t tmp; + std::map ChirpFftMap; + + // An arrays associated with the FFT length array. + ChirpSteps = (double *)calloc(swi.num_fft_lengths, sizeof(double)); + + // Each FFT length has a (different) associated chirp step. + CalcChirpSteps(ChirpSteps, MinChirpStep); + + // Lets simplify the logic for doing chirps by using the STL map + // container for sorting. + max_fft_len=swi.analysis_fft_lengths[swi.num_fft_lengths-1]; + for (i=0; i= swi.analysis_cfg.pot_min_slew) && + (SlewRate <= swi.analysis_cfg.pot_max_slew)); + tmp.PulseFind=0; + while (CRate <= swi.analysis_cfg.chirps[i].chirp_limit) { + // Pulse find on alternate chirp rates when fitting Gaussians + if ((SlewRate >= swi.analysis_cfg.pot_min_slew) && + (SlewRate <= swi.analysis_cfg.pot_max_slew)) { + tmp.PulseFind=!(tmp.PulseFind) && tmp.GaussFit + && (tmp.FftLen<=MaxPulseFFTLen) + && (tmp.FftLen>=MinPulseFFTLen); + // else pulse find when our FFT liength is in range... + } else { + tmp.PulseFind=(tmp.FftLen<=MaxPulseFFTLen) + && (tmp.FftLen>=MinPulseFFTLen); + } + // Force all chirp rates to be a multiple of the minimum step. + tmp.ChirpRate= + (tmp.ChirpRateInd=(int32_t)floor(CRate/(*MinChirpStep)+0.5)) + *(*MinChirpStep); + // Generate keys specifying the order of the chirps + // chirp_rate,sign,fft_length order... + sh_sint8_t key=static_cast(floor(CRate/(*MinChirpStep)+0.5))*2; + key*=max_fft_len*2; + key+=tmp.FftLen; + //JWS: Finally, reset PulseFind if a reportable pulse cannot be found. + if (tmp.FftLen > MaxPulseFFTLenAlt) tmp.PulseFind=0; + // Insert the positive chirp overwriting any existing with this + // key value; + ChirpFftMap[key]=tmp; + //fprintf(stderr,"%f %d %f\n",CRate,tmp.ChirpRateInd,tmp.ChirpRate); + //fflush(stderr); + // Now the negative chirps for non-zero chirp; + if (CRate != 0.0) { + tmp.ChirpRate*=-1; + tmp.ChirpRateInd*=-1; + key+=max_fft_len*2; // flip the bit representing the sign in the + // key + ChirpFftMap[key]=tmp; + } + CRate+=ChirpSteps[j]; + } // end while loop through chirp rates + } // end if + } // end for loop through fft lenngths + } // end for loop through cfft parameter table + + + // Copy our ordereds CFFT map into a more standard array + *ChirpFftPairs = (ChirpFftPair_t *)calloc(ChirpFftMap.size(),sizeof(ChirpFftPair_t)); + std::map::const_iterator p; + i=0; + for (p=ChirpFftMap.begin();p!=ChirpFftMap.end();p++) { + num_gaussian_searches+=(p->second.GaussFit*(p->second.FftLen-1)); + num_pulse_searches+=(sh_sint8_t)(p->second.PulseFind*(p->second.FftLen-1)*(NumSamples/p->second.FftLen)*log((double)NumSamples/p->second.FftLen)/log(2.0)); + num_triplet_searches+=(sh_sint8_t)(p->second.PulseFind*(p->second.FftLen-1)*(NumSamples/p->second.FftLen)*(NumSamples/p->second.FftLen)); + (*ChirpFftPairs)[i++]=p->second; + } + /* + fprintf( + stderr,"NumCfft=%d\n NumGauss="SINT8_FMT"\n NumPulse="SINT8_FMT"\n NumTriplet="SINT8_FMT"\n", + static_cast(ChirpFftMap.size()), + SINT8_FMT_CAST(num_gaussian_searches), + SINT8_FMT_CAST(num_pulse_searches), + SINT8_FMT_CAST(num_triplet_searches) + ); + */ + fflush(stderr); + + if (ChirpSteps) free (ChirpSteps); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return(ChirpFftMap.size()); +} + + +void CalcChirpSteps(double* ChirpSteps, double* MinChirpStep) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("CalcChirpSteps()"); +#endif + double ChirpRes = swi.analysis_cfg.chirp_resolution; + double NumSamples = swi.nsamples; + double WUDuration = (double)(swi.nsamples/swi.subband_sample_rate); + + + int i; + double SecondsInAnalysis; + double SlewRate=static_cast(swi.angle_range)/WUDuration; + long FftLen; + long MaxGaussFFTLen=swi.nsamples/swi.analysis_cfg.gauss_pot_length; + double BeamsPerWU = std::max(swi.true_angle_range/swi.beam_width,1.0); + long MinPulseFFTLen=(long)ceil(swi.nsamples/(swi.analysis_cfg.pulse_max*BeamsPerWU*swi.analysis_cfg.pulse_beams)); + long MaxPulseFFTLen= + std::min((unsigned long)(swi.nsamples/(swi.analysis_cfg.pulse_min*swi.analysis_cfg.pulse_beams*BeamsPerWU)), + (unsigned long)swi.analysis_cfg.pulse_fft_max); + long MaxTripletFFTLen=swi.nsamples/swi.analysis_cfg.triplet_min; + double SecondsInBeam = WUDuration/swi.true_angle_range*swi.beam_width; + + // For each FFT length, calculate the corresponding chirp + // step (in Hz/s), given the chirp resolution (in FFT bins). + // Keep track of the minimum chirp step. + + // The goal here is to have the drift be less than 1 bin over the + // duration of interest to the analysis. In the case of gaussians + // that duration is 2 beam crossings. In the case of pulses it's + // one beam crossing. In the case of spikes it's one fft length. + *MinChirpStep = 0.0; + for(i = 0; i < swi.num_fft_lengths; i++) { + FftLen = swi.analysis_fft_lengths[i]; + double SecondsInFFT = WUDuration / (NumSamples / FftLen); + // Are we going to do Gaussians? + if ((FftLen <= MaxGaussFFTLen) && + (SlewRate >= swi.analysis_cfg.pot_min_slew) && + (SlewRate <= swi.analysis_cfg.pot_max_slew)) { + SecondsInAnalysis = SecondsInBeam*2; + // In not, are we going to do pulses or triplets? + } else if ((FftLen<=MaxPulseFFTLen) && (FftLen<= MaxTripletFFTLen)) { + // Look for pulses over one beam crossing or one beam crossing + // at the pot_min_slew, whichever is lower. + SecondsInAnalysis = std::min(SecondsInBeam,swi.beam_width/swi.analysis_cfg.pot_min_slew); + } else { + SecondsInAnalysis = SecondsInFFT; + } + ChirpSteps[i] = ChirpRes / (SecondsInAnalysis * SecondsInFFT); + //fprintf(stderr,"%d %f\n",i,ChirpSteps[i]); + //fflush(stderr); + if(ChirpSteps[i] < *MinChirpStep || *MinChirpStep == 0.0) { + *MinChirpStep = ChirpSteps[i]; + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +bool VeryClose(double a, double b, double CloseEnough) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("VeryClose()"); +#endif + double Diff; + + Diff = fabs(a - b); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if(Diff > CloseEnough) + return(false); + else + return(true); +} + + +int ReadCFftFile(ChirpFftPair_t ** ChirpFftPairs, double * MinChirpStep) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ReadCFftFile()"); +#endif + // ChirpFftSet_t ChirpFftSet; + ChirpFftPair_t * ChirpFftPair; + int NumChirpFftPairs; + FILE * cfftfp; + double ChirpRate; + int FftLen; + + NumChirpFftPairs = 0; + + cfftfp = boinc_fopen(cfft_file, "r"); + + ChirpFftPair = (ChirpFftPair_t*) calloc(1,sizeof(ChirpFftPair_t)); + + while(fscanf(cfftfp, "%lf %d", &ChirpRate, &FftLen) == 2) { + ChirpFftPair = (ChirpFftPair_t *)realloc( + (void *)ChirpFftPair, sizeof(ChirpFftPair_t)*(NumChirpFftPairs+1)); + if (ChirpFftPair == NULL) SETIERROR(MALLOC_FAILED, "ChirpFftPair == NULL"); + ChirpFftPair[NumChirpFftPairs].ChirpRate = ChirpRate; + ChirpFftPair[NumChirpFftPairs].FftLen = FftLen; + NumChirpFftPairs++; + } + + *ChirpFftPairs = ChirpFftPair; + *MinChirpStep = (float) TEST_MIN_CHIRP_STEP; + + fclose(cfftfp); + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return(NumChirpFftPairs); +} + diff --git a/client/chirpfft.h b/client/chirpfft.h new file mode 100644 index 0000000..693b91a --- /dev/null +++ b/client/chirpfft.h @@ -0,0 +1,58 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +#ifndef SAH_CHIRPFFT_H +#define SAH_CHIRPFFT_H + +#define TEST_MIN_CHIRP_STEP 0.002776 // chirps .5 bins with 128K point FFT + +// Variable (usually an array of such +// variables) to hold chirp/fft pairs. +typedef struct { + double ChirpRate; + int ChirpRateInd; // chirprate index (= ChirpRate / MinChirpStep) + int FftLen; + int GaussFit; + int PulseFind; +} +ChirpFftPair_t; + +size_t GenChirpFftPairs( + ChirpFftPair_t ** ChirpFftPairs, + double * MinChirpStep +); + +extern ChirpFftPair_t * ChirpFftPairs; +extern char * cfft_file; + +void CalcChirpSteps(double* ChirpSteps, double* MinChirpStep); + +bool VeryClose(double a, double b, double CloseEnough); + +int ReadCFftFile(ChirpFftPair_t ** ChirpFftPairs, double * MinChirpStep); + +#endif diff --git a/client/classes/ICoreSigProc/ICoreSigProc.cpp b/client/classes/ICoreSigProc/ICoreSigProc.cpp new file mode 100644 index 0000000..5cd5e22 --- /dev/null +++ b/client/classes/ICoreSigProc/ICoreSigProc.cpp @@ -0,0 +1,53 @@ +#include "ICoreSigProc.h" + +template class ICoreSigProc; + +template< class _Tin, class _Tout > +ICoreSigProc<_Tin,_Tout>::ICoreSigProc() +: m_name("ICoreSigProc Class"), +m_description("Abstract Signal processor class"), +m_n(DEFAULT_SIZE), m_batch(1), m_self_allocated_arrays(true) +{ + this->Alloc_new(m_n,m_batch); +} + +template< class _Tin, class _Tout > +ICoreSigProc<_Tin,_Tout>::ICoreSigProc( int n, int batch, _Tin* idata, _Tout* odata) +: m_name("ICoreSigProc Class"), +m_description("Abstract Signal processor class"), +m_n(n), m_batch(batch), m_self_allocated_arrays(false) +{ + m_idata = idata; + m_odata = odata; +} + +template< class _Tin, class _Tout > +void ICoreSigProc<_Tin,_Tout>::Alloc_new(int n, int batch) +{ + m_self_allocated_arrays = true; + m_idata = new _Tin[n*batch]; + m_odata = new _Tout[n*batch]; +} + +template< class _Tin, class _Tout > +ICoreSigProc<_Tin,_Tout>::~ICoreSigProc() +{ + if (m_self_allocated_arrays) + { + delete[] m_idata; + delete[] m_odata; + } +} + +/* +template +ICoreSigProc<_Tin,_Tout>::ICoreSigProc() +: m_name("ICoreSigProc Class"), +m_description("Abstract Signal processor class"), +m_n(DEFAULT_SIZE), m_batch(1) +{ + FILE_LOG(logDEBUG1) << "ICoreSigProc::ICoreSigProc() called, for " << m_name << endl; + this->Alloc_new(m_n,m_batch); +} +*/ + diff --git a/client/classes/ICoreSigProc/ICoreSigProc.h b/client/classes/ICoreSigProc/ICoreSigProc.h new file mode 100644 index 0000000..9e49456 --- /dev/null +++ b/client/classes/ICoreSigProc/ICoreSigProc.h @@ -0,0 +1,43 @@ +#ifndef ICORESIGPROC_H +#define ICORESIGPROC_H + +#include +#include + +using namespace std; + +#define DEFAULT_SIZE 1024 + +template +class ICoreSigProc +{ + public: + /** Default constructor */ + ICoreSigProc(void); // for performance, avoid the default destructor, which uses new/delete for data arrays + ICoreSigProc(int n, int batch, _Tin* idata, _Tout* odata); + ~ICoreSigProc(void); + + virtual void execute()=0; + + // member getters & setters + string Getname() { return m_name; } + void Setname(string val) { m_name = val; } + string Getdescription() { return m_description; } + void Setdescription(string val) { m_description = val; } + size_t Getn() { return m_n; } + // void Setn(size_t val) { m_n = val; } + size_t Getbatch() { return m_batch; } + // void Setbatch(size_t val) { m_batch = val; } + protected: + void Alloc_new(int n, int batch); + string m_name; //!< Member variable "m_name" + string m_description; + size_t m_n; + size_t m_batch; + _Tin *m_idata; + _Tout *m_odata; + private: + bool m_self_allocated_arrays; +}; + +#endif // ICORESIGPROC_H diff --git a/client/classes/classes_history.txt b/client/classes/classes_history.txt new file mode 100644 index 0000000..634aa71 --- /dev/null +++ b/client/classes/classes_history.txt @@ -0,0 +1,48 @@ +----------------------------------------------------------------------------------------------------------- +31st May 2014 - Added folder structure for ITranspose and IPowerspectrum abstract base classes +----------------------------------------------------------------------------------------------------------- +30th May 2014 - Initial cut, for refinement as derived classes take shape +(FFT's will be first cab off the rank, via IFFT abstract class deriving from this, followed by fftw, oura, +cufft, oclfft and naive dft implementation classes) +- ICoreSigProc: Abstract (pure virtual) base template class +template parameters <_Tin, _Tout> are input and output types respectively. +execute() member function is pure virtual, for polymorphic use of derived classes in pipelines. +derived classes, abstract or otherwise, should either feed pointers through using the fully +specified constructor, or the fairly useless default constructor will be used. Will probably disable that default constructor later. +- Fully templatised so that higher & possibly arbitrary precision gold reference implementations +can be easily injected in test pieces, regression tests etc, while using the same class library. +----------------------------------------------------------------------------------------------------------- +24th May 2014, (Part 2) [Added IPulse base class, derived from ISearch] +- Folders for some candidate derived generic classes, for devices, signal processors, and pipelines. +IDevices: CPUs, GPUs, and Remote nodes (future RPC) +ICoreSigProcs: Generalisations of major search algorithm processing steps. +IPipelineSigProcs: Generalises different levels of parallelism that may be used +-- IFFTPipeline: Might be asked to process one or more FFT's in a given CFFT pair, up to a whole CFFT +-- ICFFTPipeline: Might be asked to process from one CFFT up to a whole Chirp full. +-- IChirpPipeline: Might be asked to process from one Chirp, up to a whole task. +-- ITaskPipeline: Might process from one to many tasks at once (future) + +Jason Groothuis ( contact at jgopt dot org ) +----------------------------------------------------------------------------------------------------------- +24th May 2014, (Part 1) + Initial trial folder structure (only), mirroring top level of proposed class hierarchy (currently inactive/unused). For dropping in candidate classes for refinement and future use. + +Due to a lack of naming convention for C++ Abstract Classes, I'll use common capitalisation for implementation classes, and prefix with 'I' for abstract ones. Will stay fairly flexible this early, should namespace conflicts arise here. (i.e. don't expect stable interfaces yet ) + +Expect containers/enumeration at high level for easing future development. + +ICoreSigProc- Abstract signal processor class, +- parent/ancestor of all derived FFT, Chirp, Spike, Triplet, Pulse, Gaussian and Autocorrelation generic classes. +- Another generic abstraction level under this one for wrapping implementations below. + +IDevice- Abstract Processing resource class, +- parent/ancestor of all compute devices capable of processing any portion of core signal processing in any fashion +- Another generic abstraction level under this one, for wrapping different kinds of device. + +IPipelineSigProc- Abstract class pipelining of ICoreSigProcs and IDevices +- Abstracts allowable processing order/reductions of results etc, and devices +- represents the processing algorithm at the highest levels +- implementations and generalisations underneath may represent totally different 'ways' of arriving at a reference 'answer'. + +Jason Groothuis ( contact at jgopt dot org ) +----------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/client/collect2_line_linux.csh b/client/collect2_line_linux.csh new file mode 100755 index 0000000..a0530e8 --- /dev/null +++ b/client/collect2_line_linux.csh @@ -0,0 +1,6 @@ +#! /bin/csh + +# Run this with the desired version number as the only operand. Ex: +# collect2_line 2.27 + +/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o setiathome_$1_i686-pc-linux-gnu /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/crtbegin.o -L. -L../../boinc/lib -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.2 -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/../../.. main.o analyzeFuncs.o analyzeReport.o analyzePoT.o pulsefind.o gaussfit.o lcgamm.o malloc_a.o seti.o seti_header.o timecvt.o s_util.o version.o worker.o chirpfft.o spike.o progress.o ../db/schema_master_client.o ../db/sqlrow_client.o ../db/sqlblob.o ../db/xml_util.o -looura -Bstatic -lstdc++ -Bdynamic -lz -lnsl -ldl -lboinc -Bstatic -lstdc++ -Bdynamic -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/crtend.o /usr/lib/crtn.o diff --git a/client/collect2_line_solaris.csh b/client/collect2_line_solaris.csh new file mode 100644 index 0000000..a2ff246 --- /dev/null +++ b/client/collect2_line_solaris.csh @@ -0,0 +1,6 @@ +#! /bin/csh + +# Run this with the desired version number as the only operand. Ex: +# collect2_line 2.27 + +/usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.0.4/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o setiathome_${1}_sparc-sun-solaris2.7 /usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.0.4/crt1.o /usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.0.4/crti.o /usr/ccs/lib/values-Xa.o /usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.0.4/crtbegin.o -L. -L../../boinc/lib -L/usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.0.4 -L/usr/local/gcc/bin/../lib/gcc-lib -L/usr/local/gcc-3.0.4/lib/gcc-lib/sparc-sun-solaris2.7/3.0.4 -L/usr/ccs/bin -L/usr/ccs/lib -L/usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.0.4/../../.. -L/usr/local/gcc-3.0.4/lib/gcc-lib/sparc-sun-solaris2.7/3.0.4/../../.. main.o analyzeFuncs.o analyzeReport.o analyzePoT.o pulsefind.o gaussfit.o lcgamm.o malloc_a.o seti.o seti_header.o timecvt.o s_util.o version.o worker.o chirpfft.o spike.o progress.o ../db/schema_master_client.o ../db/sqlrow_client.o ../db/sqlblob.o ../db/xml_util.o -looura -B static -lstdc++ -B dynamic -lz -lsocket -lnsl -lelf -ldl -laio -lboinc -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.0.4/crtend.o /usr/local/gcc/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.0.4/crtn.o diff --git a/client/fft8g.cpp b/client/fft8g.cpp new file mode 100644 index 0000000..f033987 --- /dev/null +++ b/client/fft8g.cpp @@ -0,0 +1,1280 @@ +// This code is from the General Purpose FFT (Fast Fourier/Cosine/Sine Transform) Package. +// Copyright Takuya OOURA, 1996-2001 +// (Email: ooura@kurims.kyoto-u.ac.jp or ooura@mmm.t.u-tokyo.ac.jp) +// +// You may use, copy, modify and distribute this code for any purpose +// (include commercial use) and without fee. Please refer to this package +// when you modify this code. + +// $Id: fft8g.cpp,v 1.4.2.3 2006/12/14 22:21:45 korpela Exp $ +/* +NOTE ON USE BY SETI@HOME : All floating point objects were changed + from double precision to single precision. + The function prototypes below were placed + in file fft8g.h. + Also, the following unused transforms were + removed from the source: + rdft: Real Discrete Fourier Transform + ddst: Discrete Sine Transform + dfct: Cosine Transform of RDFT (Real Symmetric DFT) + dfst: Sine Transform of RDFT (Real Anti-symmetric DFT) + + Modified to use sincosf/sinf/cosf/atanf. Implementations of these are + in sincos.h for machines without + + +Fast Fourier/Cosine/Sine Transform + dimension :one + data length :power of 2 + decimation :frequency + radix :8, 4, 2 + data :inplace + table :use +functions + cdft: Complex Discrete Fourier Transform +function prototypes + void cdft(int, int, float *, int *, float *); + void ddct(int, int, float *, int *, float *); + + +-------- Complex DFT (Discrete Fourier Transform) -------- + [definition] + + X[k] = sum_j=0^n-1 x[j]*exp(2*pi*i*j*k/n), 0<=k + X[k] = sum_j=0^n-1 x[j]*exp(-2*pi*i*j*k/n), 0<=k + ip[0] = 0; // first time only + cdft(2*n, 1, a, ip, w); + + ip[0] = 0; // first time only + cdft(2*n, -1, a, ip, w); + [parameters] + 2*n :data length (int) + n >= 1, n = power of 2 + a[0...2*n-1] :input/output data (float *) + input data + a[2*j] = Re(x[j]), + a[2*j+1] = Im(x[j]), 0<=j= 2+sqrt(n) + strictly, + length of ip >= + 2+(1<<(int)(log(n+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n/2-1] :cos/sin table (float *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + cdft(2*n, -1, a, ip, w); + is + cdft(2*n, 1, a, ip, w); + for (j = 0; j <= 2 * n - 1; j++) { + a[j] *= 1.0 / n; + } + . + +------- DCT (Discrete Cosine Transform) / Inverse of DCT -------- + [definition] + IDCT (excluding scale) + C[k] = sum_j=0^n-1 a[j]*cos(pi*j*(k+1/2)/n), 0<=k DCT + C[k] = sum_j=0^n-1 a[j]*cos(pi*(j+1/2)*k/n), 0<=k + ip[0] = 0; // first time only + ddct(n, 1, a, ip, w); + + ip[0] = 0; // first time only + ddct(n, -1, a, ip, w); + [parameters] + n :data length (int) + n >= 2, n = power of 2 + a[0...n-1] :input/output data (float *) + output data + a[k] = C[k], 0<=k= 2+sqrt(n/2) + strictly, + length of ip >= + 2+(1<<(int)(log(n/2+0.5)/log(2))/2). + ip[0],ip[1] are pointers of the cos/sin table. + w[0...n*5/4-1] :cos/sin table (float *) + w[],ip[] are initialized if ip[0] == 0. + [remark] + Inverse of + ddct(n, -1, a, ip, w); + is + a[0] *= 0.5; + ddct(n, 1, a, ip, w); + for (j = 0; j <= n - 1; j++) { + a[j] *= 2.0 / n; + } + + + + +Appendix : + The cos/sin table is recalculated when the larger table required. + w[] and ip[] are compatible with all routines. +*/ + +#include "sah_config.h" +#include "sincos.h" +#include "s_util.h" +#include "seti.h" + +void fft8g_start() {} + + +void cdft(int n, int isgn, sah_complex *aa, int *ip, float *w) { + void makewt(int nw, int *ip, float *w); + void bitrv2(int n, int *ip, float *a); + void bitrv2conj(int n, int *ip, float *a); + void cftfsub(int n, float *a, float *w); + void cftbsub(int n, float *a, float *w); +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("cdft()"); +#endif + + float *a=(float *)aa; + + if (n > (ip[0] << 2)) { + makewt(n >> 2, ip, w); + } + if (n > 4) { + if (isgn >= 0) { + bitrv2(n, ip + 2, a); + cftfsub(n, a, w); + } else { + bitrv2conj(n, ip + 2, a); + cftbsub(n, a, w); + } + } else if (n == 4) { + cftfsub(n, a, w); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +void ddct(int n, int isgn, float *a, int *ip, float *w) +{ + void makewt(int nw, int *ip, float *w); + void makect(int nc, int *ip, float *c); + void bitrv2(int n, int *ip, float *a); + void cftfsub(int n, float *a, float *w); + void cftbsub(int n, float *a, float *w); + void rftfsub(int n, float *a, int nc, float *c); + void rftbsub(int n, float *a, int nc, float *c); + void dctsub(int n, float *a, int nc, float *c); + int j, nw, nc; + float xr; + + nw = ip[0]; + if (n > (nw << 2)) { + nw = n >> 2; + makewt(nw, ip, w); + } + nc = ip[1]; + if (n > nc) { + nc = n; + makect(nc, ip, w + nw); + } + if (isgn < 0) { + xr = a[n - 1]; + for (j = n - 2; j >= 2; j -= 2) { + a[j + 1] = a[j] - a[j - 1]; + a[j] += a[j - 1]; + } + a[1] = a[0] - xr; + a[0] += xr; + if (n > 4) { + rftbsub(n, a, nc, w + nw); + bitrv2(n, ip + 2, a); + cftbsub(n, a, w); + } else if (n == 4) { + cftfsub(n, a, w); + } + } + dctsub(n, a, nc, w + nw); + if (isgn >= 0) { + if (n > 4) { + bitrv2(n, ip + 2, a); + cftfsub(n, a, w); + rftfsub(n, a, nc, w + nw); + } else if (n == 4) { + cftfsub(n, a, w); + } + xr = a[0] - a[1]; + a[0] += a[1]; + for (j = 2; j < n; j += 2) { + a[j - 1] = a[j] - a[j + 1]; + a[j] += a[j + 1]; + } + a[n - 1] = xr; + } +} + + + + +/* -------- initializing routines -------- */ + + +#include + +void makewt(int nw, int *ip, float *w) { + void bitrv2(int n, int *ip, float *a); + int j, nwh; + float delta, x, y; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("makewt()"); +#endif + + ip[0] = nw; + ip[1] = 1; + if (nw > 2) { + nwh = nw >> 1; + delta = atanf(1.0) / nwh; + w[0] = 1; + w[1] = 0; + w[nwh] = cosf(delta * nwh); + w[nwh + 1] = w[nwh]; + if (nwh > 2) { + for (j = 2; j < nwh; j += 2) { + sincosf(delta*j,&y,&x); + w[j] = x; + w[j + 1] = y; + w[nw - j] = y; + w[nw - j + 1] = x; + } + for (j = nwh - 2; j >= 2; j -= 2) { + x = w[2 * j]; + y = w[2 * j + 1]; + w[nwh + j] = x; + w[nwh + j + 1] = y; + } + bitrv2(nw, ip + 2, w); + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void makect(int nc, int *ip, float *c) { + int j, nch; + float delta; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("makect()"); +#endif + + ip[1] = nc; + if (nc > 1) { + nch = nc >> 1; + delta = atanf(1.0f) / nch; + c[0] = cosf(delta * nch); + c[nch] = (0.5f * c[0]); + for (j = 1; j < nch; j++) { + sincosf(delta*j,c+nc-j,c+j); + c[j]*=0.5f; + c[nc-j]*=0.5f; + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +/* -------- child routines -------- */ + + +void bitrv2(int n, int *ip, float *a) { + int j, j1, k, k1, l, m, m2; + float xr, xi, yr, yi; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("bitrv2()"); +#endif + + ip[0] = 0; + l = n; + m = 1; + while ((m << 3) < l) { + l >>= 1; + for (j = 0; j < m; j++) { + ip[m + j] = ip[j] + l; + } + m <<= 1; + } + m2 = 2 * m; + if ((m << 3) == l) { + for (k = 0; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 2 * j + ip[k]; + k1 = 2 * k + ip[j]; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += 2 * m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 -= m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += 2 * m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + j1 = 2 * k + m2 + ip[k]; + k1 = j1 + m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + } else { + for (k = 1; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 2 * j + ip[k]; + k1 = 2 * k + ip[j]; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += m2; + xr = a[j1]; + xi = a[j1 + 1]; + yr = a[k1]; + yi = a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void bitrv2conj(int n, int *ip, float *a) { + int j, j1, k, k1, l, m, m2; + float xr, xi, yr, yi; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("bitrv2conj()"); +#endif + ip[0] = 0; + l = n; + m = 1; + while ((m << 3) < l) { + l >>= 1; + for (j = 0; j < m; j++) { + ip[m + j] = ip[j] + l; + } + m <<= 1; + } + m2 = 2 * m; + if ((m << 3) == l) { + for (k = 0; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 2 * j + ip[k]; + k1 = 2 * k + ip[j]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += 2 * m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 -= m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += 2 * m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + k1 = 2 * k + ip[k]; + a[k1 + 1] = -a[k1 + 1]; + j1 = k1 + m2; + k1 = j1 + m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + k1 += m2; + a[k1 + 1] = -a[k1 + 1]; + } + } else { + a[1] = -a[1]; + a[m2 + 1] = -a[m2 + 1]; + for (k = 1; k < m; k++) { + for (j = 0; j < k; j++) { + j1 = 2 * j + ip[k]; + k1 = 2 * k + ip[j]; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + j1 += m2; + k1 += m2; + xr = a[j1]; + xi = -a[j1 + 1]; + yr = a[k1]; + yi = -a[k1 + 1]; + a[j1] = yr; + a[j1 + 1] = yi; + a[k1] = xr; + a[k1 + 1] = xi; + } + k1 = 2 * k + ip[k]; + a[k1 + 1] = -a[k1 + 1]; + a[k1 + m2 + 1] = -a[k1 + m2 + 1]; + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void cftfsub(int n, float *a, float *w) { + void cft1st(int n, float *a, float *w); + void cftmdl(int n, int l, float *a, float *w); + int j, j1, j2, j3, l; + float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("cftfsub()"); +#endif + + l = 2; + if (n >= 16) { + cft1st(n, a, w); + l = 16; + while ((l << 3) <= n) { + cftmdl(n, l, a, w); + l <<= 3; + } + } + if ((l << 1) < n) { + for (j = 0; j < l; j += 2) { + j1 = j + l; + j2 = j1 + l; + j3 = j2 + l; + x0r = a[j] + a[j1]; + x0i = a[j + 1] + a[j1 + 1]; + x1r = a[j] - a[j1]; + x1i = a[j + 1] - a[j1 + 1]; + x2r = a[j2] + a[j3]; + x2i = a[j2 + 1] + a[j3 + 1]; + x3r = a[j2] - a[j3]; + x3i = a[j2 + 1] - a[j3 + 1]; + a[j] = x0r + x2r; + a[j + 1] = x0i + x2i; + a[j2] = x0r - x2r; + a[j2 + 1] = x0i - x2i; + a[j1] = x1r - x3i; + a[j1 + 1] = x1i + x3r; + a[j3] = x1r + x3i; + a[j3 + 1] = x1i - x3r; + } + } else if ((l << 1) == n) { + for (j = 0; j < l; j += 2) { + j1 = j + l; + x0r = a[j] - a[j1]; + x0i = a[j + 1] - a[j1 + 1]; + a[j] += a[j1]; + a[j + 1] += a[j1 + 1]; + a[j1] = x0r; + a[j1 + 1] = x0i; + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void cftbsub(int n, float *a, float *w) { + void cft1st(int n, float *a, float *w); + void cftmdl(int n, int l, float *a, float *w); + int j, j1, j2, j3, j4, j5, j6, j7, l; + float wn4r, x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("cftbsub"); +#endif + + l = 2; + if (n > 16) { + cft1st(n, a, w); + l = 16; + while ((l << 3) < n) { + cftmdl(n, l, a, w); + l <<= 3; + } + } + if ((l << 2) < n) { + wn4r = w[2]; + for (j = 0; j < l; j += 2) { + j1 = j + l; + j2 = j1 + l; + j3 = j2 + l; + j4 = j3 + l; + j5 = j4 + l; + j6 = j5 + l; + j7 = j6 + l; + x0r = a[j] + a[j1]; + x0i = -a[j + 1] - a[j1 + 1]; + x1r = a[j] - a[j1]; + x1i = -a[j + 1] + a[j1 + 1]; + x2r = a[j2] + a[j3]; + x2i = a[j2 + 1] + a[j3 + 1]; + x3r = a[j2] - a[j3]; + x3i = a[j2 + 1] - a[j3 + 1]; + y0r = x0r + x2r; + y0i = x0i - x2i; + y2r = x0r - x2r; + y2i = x0i + x2i; + y1r = x1r - x3i; + y1i = x1i - x3r; + y3r = x1r + x3i; + y3i = x1i + x3r; + x0r = a[j4] + a[j5]; + x0i = a[j4 + 1] + a[j5 + 1]; + x1r = a[j4] - a[j5]; + x1i = a[j4 + 1] - a[j5 + 1]; + x2r = a[j6] + a[j7]; + x2i = a[j6 + 1] + a[j7 + 1]; + x3r = a[j6] - a[j7]; + x3i = a[j6 + 1] - a[j7 + 1]; + y4r = x0r + x2r; + y4i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + x2r = x1r + x3i; + x2i = x1i - x3r; + y5r = wn4r * (x0r - x0i); + y5i = wn4r * (x0r + x0i); + y7r = wn4r * (x2r - x2i); + y7i = wn4r * (x2r + x2i); + a[j1] = y1r + y5r; + a[j1 + 1] = y1i - y5i; + a[j5] = y1r - y5r; + a[j5 + 1] = y1i + y5i; + a[j3] = y3r - y7i; + a[j3 + 1] = y3i - y7r; + a[j7] = y3r + y7i; + a[j7 + 1] = y3i + y7r; + a[j] = y0r + y4r; + a[j + 1] = y0i - y4i; + a[j4] = y0r - y4r; + a[j4 + 1] = y0i + y4i; + a[j2] = y2r - y6i; + a[j2 + 1] = y2i - y6r; + a[j6] = y2r + y6i; + a[j6 + 1] = y2i + y6r; + } + } else if ((l << 2) == n) { + for (j = 0; j < l; j += 2) { + j1 = j + l; + j2 = j1 + l; + j3 = j2 + l; + x0r = a[j] + a[j1]; + x0i = -a[j + 1] - a[j1 + 1]; + x1r = a[j] - a[j1]; + x1i = -a[j + 1] + a[j1 + 1]; + x2r = a[j2] + a[j3]; + x2i = a[j2 + 1] + a[j3 + 1]; + x3r = a[j2] - a[j3]; + x3i = a[j2 + 1] - a[j3 + 1]; + a[j] = x0r + x2r; + a[j + 1] = x0i - x2i; + a[j2] = x0r - x2r; + a[j2 + 1] = x0i + x2i; + a[j1] = x1r - x3i; + a[j1 + 1] = x1i - x3r; + a[j3] = x1r + x3i; + a[j3 + 1] = x1i + x3r; + } + } else { + for (j = 0; j < l; j += 2) { + j1 = j + l; + x0r = a[j] - a[j1]; + x0i = -a[j + 1] + a[j1 + 1]; + a[j] += a[j1]; + a[j + 1] = -a[j + 1] - a[j1 + 1]; + a[j1] = x0r; + a[j1 + 1] = x0i; + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void cft1st(int n, float *a, float *w) { + int j, k1; + float wn4r, wtmp, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i, + wk4r, wk4i, wk5r, wk5i, wk6r, wk6i, wk7r, wk7i; + float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("cftlst()"); +#endif + + wn4r = w[2]; + x0r = a[0] + a[2]; + x0i = a[1] + a[3]; + x1r = a[0] - a[2]; + x1i = a[1] - a[3]; + x2r = a[4] + a[6]; + x2i = a[5] + a[7]; + x3r = a[4] - a[6]; + x3i = a[5] - a[7]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y2r = x0r - x2r; + y2i = x0i - x2i; + y1r = x1r - x3i; + y1i = x1i + x3r; + y3r = x1r + x3i; + y3i = x1i - x3r; + x0r = a[8] + a[10]; + x0i = a[9] + a[11]; + x1r = a[8] - a[10]; + x1i = a[9] - a[11]; + x2r = a[12] + a[14]; + x2i = a[13] + a[15]; + x3r = a[12] - a[14]; + x3i = a[13] - a[15]; + y4r = x0r + x2r; + y4i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + x2r = x1r + x3i; + x2i = x1i - x3r; + y5r = wn4r * (x0r - x0i); + y5i = wn4r * (x0r + x0i); + y7r = wn4r * (x2r - x2i); + y7i = wn4r * (x2r + x2i); + a[2] = y1r + y5r; + a[3] = y1i + y5i; + a[10] = y1r - y5r; + a[11] = y1i - y5i; + a[6] = y3r - y7i; + a[7] = y3i + y7r; + a[14] = y3r + y7i; + a[15] = y3i - y7r; + a[0] = y0r + y4r; + a[1] = y0i + y4i; + a[8] = y0r - y4r; + a[9] = y0i - y4i; + a[4] = y2r - y6i; + a[5] = y2i + y6r; + a[12] = y2r + y6i; + a[13] = y2i - y6r; + if (n > 16) { + wk1r = w[4]; + wk1i = w[5]; + x0r = a[16] + a[18]; + x0i = a[17] + a[19]; + x1r = a[16] - a[18]; + x1i = a[17] - a[19]; + x2r = a[20] + a[22]; + x2i = a[21] + a[23]; + x3r = a[20] - a[22]; + x3i = a[21] - a[23]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y2r = x0r - x2r; + y2i = x0i - x2i; + y1r = x1r - x3i; + y1i = x1i + x3r; + y3r = x1r + x3i; + y3i = x1i - x3r; + x0r = a[24] + a[26]; + x0i = a[25] + a[27]; + x1r = a[24] - a[26]; + x1i = a[25] - a[27]; + x2r = a[28] + a[30]; + x2i = a[29] + a[31]; + x3r = a[28] - a[30]; + x3i = a[29] - a[31]; + y4r = x0r + x2r; + y4i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + x2r = x1r + x3i; + x2i = x3r - x1i; + y5r = wk1i * x0r - wk1r * x0i; + y5i = wk1i * x0i + wk1r * x0r; + y7r = wk1r * x2r + wk1i * x2i; + y7i = wk1r * x2i - wk1i * x2r; + x0r = wk1r * y1r - wk1i * y1i; + x0i = wk1r * y1i + wk1i * y1r; + a[18] = x0r + y5r; + a[19] = x0i + y5i; + a[26] = y5i - x0i; + a[27] = x0r - y5r; + x0r = wk1i * y3r - wk1r * y3i; + x0i = wk1i * y3i + wk1r * y3r; + a[22] = x0r - y7r; + a[23] = x0i + y7i; + a[30] = y7i - x0i; + a[31] = x0r + y7r; + a[16] = y0r + y4r; + a[17] = y0i + y4i; + a[24] = y4i - y0i; + a[25] = y0r - y4r; + x0r = y2r - y6i; + x0i = y2i + y6r; + a[20] = wn4r * (x0r - x0i); + a[21] = wn4r * (x0i + x0r); + x0r = y6r - y2i; + x0i = y2r + y6i; + a[28] = wn4r * (x0r - x0i); + a[29] = wn4r * (x0i + x0r); + k1 = 4; + for (j = 32; j < n; j += 16) { + k1 += 4; + wk1r = w[k1]; + wk1i = w[k1 + 1]; + wk2r = w[k1 + 2]; + wk2i = w[k1 + 3]; + wtmp = 2 * wk2i; + wk3r = wk1r - wtmp * wk1i; + wk3i = wtmp * wk1r - wk1i; + wk4r = 1 - wtmp * wk2i; + wk4i = wtmp * wk2r; + wtmp = 2 * wk4i; + wk5r = wk3r - wtmp * wk1i; + wk5i = wtmp * wk1r - wk3i; + wk6r = wk2r - wtmp * wk2i; + wk6i = wtmp * wk2r - wk2i; + wk7r = wk1r - wtmp * wk3i; + wk7i = wtmp * wk3r - wk1i; + x0r = a[j] + a[j + 2]; + x0i = a[j + 1] + a[j + 3]; + x1r = a[j] - a[j + 2]; + x1i = a[j + 1] - a[j + 3]; + x2r = a[j + 4] + a[j + 6]; + x2i = a[j + 5] + a[j + 7]; + x3r = a[j + 4] - a[j + 6]; + x3i = a[j + 5] - a[j + 7]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y2r = x0r - x2r; + y2i = x0i - x2i; + y1r = x1r - x3i; + y1i = x1i + x3r; + y3r = x1r + x3i; + y3i = x1i - x3r; + x0r = a[j + 8] + a[j + 10]; + x0i = a[j + 9] + a[j + 11]; + x1r = a[j + 8] - a[j + 10]; + x1i = a[j + 9] - a[j + 11]; + x2r = a[j + 12] + a[j + 14]; + x2i = a[j + 13] + a[j + 15]; + x3r = a[j + 12] - a[j + 14]; + x3i = a[j + 13] - a[j + 15]; + y4r = x0r + x2r; + y4i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + x2r = x1r + x3i; + x2i = x1i - x3r; + y5r = wn4r * (x0r - x0i); + y5i = wn4r * (x0r + x0i); + y7r = wn4r * (x2r - x2i); + y7i = wn4r * (x2r + x2i); + x0r = y1r + y5r; + x0i = y1i + y5i; + a[j + 2] = wk1r * x0r - wk1i * x0i; + a[j + 3] = wk1r * x0i + wk1i * x0r; + x0r = y1r - y5r; + x0i = y1i - y5i; + a[j + 10] = wk5r * x0r - wk5i * x0i; + a[j + 11] = wk5r * x0i + wk5i * x0r; + x0r = y3r - y7i; + x0i = y3i + y7r; + a[j + 6] = wk3r * x0r - wk3i * x0i; + a[j + 7] = wk3r * x0i + wk3i * x0r; + x0r = y3r + y7i; + x0i = y3i - y7r; + a[j + 14] = wk7r * x0r - wk7i * x0i; + a[j + 15] = wk7r * x0i + wk7i * x0r; + a[j] = y0r + y4r; + a[j + 1] = y0i + y4i; + x0r = y0r - y4r; + x0i = y0i - y4i; + a[j + 8] = wk4r * x0r - wk4i * x0i; + a[j + 9] = wk4r * x0i + wk4i * x0r; + x0r = y2r - y6i; + x0i = y2i + y6r; + a[j + 4] = wk2r * x0r - wk2i * x0i; + a[j + 5] = wk2r * x0i + wk2i * x0r; + x0r = y2r + y6i; + x0i = y2i - y6r; + a[j + 12] = wk6r * x0r - wk6i * x0i; + a[j + 13] = wk6r * x0i + wk6i * x0r; + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void cftmdl(int n, int l, float *a, float *w) { + int j, j1, j2, j3, j4, j5, j6, j7, k, k1, m; + float wn4r, wtmp, wk1r, wk1i, wk2r, wk2i, wk3r, wk3i, + wk4r, wk4i, wk5r, wk5i, wk6r, wk6i, wk7r, wk7i; + float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i, + y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i, + y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("cftmdl()"); +#endif + + m = l << 3; + wn4r = w[2]; + for (j = 0; j < l; j += 2) { + j1 = j + l; + j2 = j1 + l; + j3 = j2 + l; + j4 = j3 + l; + j5 = j4 + l; + j6 = j5 + l; + j7 = j6 + l; + x0r = a[j] + a[j1]; + x0i = a[j + 1] + a[j1 + 1]; + x1r = a[j] - a[j1]; + x1i = a[j + 1] - a[j1 + 1]; + x2r = a[j2] + a[j3]; + x2i = a[j2 + 1] + a[j3 + 1]; + x3r = a[j2] - a[j3]; + x3i = a[j2 + 1] - a[j3 + 1]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y2r = x0r - x2r; + y2i = x0i - x2i; + y1r = x1r - x3i; + y1i = x1i + x3r; + y3r = x1r + x3i; + y3i = x1i - x3r; + x0r = a[j4] + a[j5]; + x0i = a[j4 + 1] + a[j5 + 1]; + x1r = a[j4] - a[j5]; + x1i = a[j4 + 1] - a[j5 + 1]; + x2r = a[j6] + a[j7]; + x2i = a[j6 + 1] + a[j7 + 1]; + x3r = a[j6] - a[j7]; + x3i = a[j6 + 1] - a[j7 + 1]; + y4r = x0r + x2r; + y4i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + x2r = x1r + x3i; + x2i = x1i - x3r; + y5r = wn4r * (x0r - x0i); + y5i = wn4r * (x0r + x0i); + y7r = wn4r * (x2r - x2i); + y7i = wn4r * (x2r + x2i); + a[j1] = y1r + y5r; + a[j1 + 1] = y1i + y5i; + a[j5] = y1r - y5r; + a[j5 + 1] = y1i - y5i; + a[j3] = y3r - y7i; + a[j3 + 1] = y3i + y7r; + a[j7] = y3r + y7i; + a[j7 + 1] = y3i - y7r; + a[j] = y0r + y4r; + a[j + 1] = y0i + y4i; + a[j4] = y0r - y4r; + a[j4 + 1] = y0i - y4i; + a[j2] = y2r - y6i; + a[j2 + 1] = y2i + y6r; + a[j6] = y2r + y6i; + a[j6 + 1] = y2i - y6r; + } + if (m < n) { + wk1r = w[4]; + wk1i = w[5]; + for (j = m; j < l + m; j += 2) { + j1 = j + l; + j2 = j1 + l; + j3 = j2 + l; + j4 = j3 + l; + j5 = j4 + l; + j6 = j5 + l; + j7 = j6 + l; + x0r = a[j] + a[j1]; + x0i = a[j + 1] + a[j1 + 1]; + x1r = a[j] - a[j1]; + x1i = a[j + 1] - a[j1 + 1]; + x2r = a[j2] + a[j3]; + x2i = a[j2 + 1] + a[j3 + 1]; + x3r = a[j2] - a[j3]; + x3i = a[j2 + 1] - a[j3 + 1]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y2r = x0r - x2r; + y2i = x0i - x2i; + y1r = x1r - x3i; + y1i = x1i + x3r; + y3r = x1r + x3i; + y3i = x1i - x3r; + x0r = a[j4] + a[j5]; + x0i = a[j4 + 1] + a[j5 + 1]; + x1r = a[j4] - a[j5]; + x1i = a[j4 + 1] - a[j5 + 1]; + x2r = a[j6] + a[j7]; + x2i = a[j6 + 1] + a[j7 + 1]; + x3r = a[j6] - a[j7]; + x3i = a[j6 + 1] - a[j7 + 1]; + y4r = x0r + x2r; + y4i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + x2r = x1r + x3i; + x2i = x3r - x1i; + y5r = wk1i * x0r - wk1r * x0i; + y5i = wk1i * x0i + wk1r * x0r; + y7r = wk1r * x2r + wk1i * x2i; + y7i = wk1r * x2i - wk1i * x2r; + x0r = wk1r * y1r - wk1i * y1i; + x0i = wk1r * y1i + wk1i * y1r; + a[j1] = x0r + y5r; + a[j1 + 1] = x0i + y5i; + a[j5] = y5i - x0i; + a[j5 + 1] = x0r - y5r; + x0r = wk1i * y3r - wk1r * y3i; + x0i = wk1i * y3i + wk1r * y3r; + a[j3] = x0r - y7r; + a[j3 + 1] = x0i + y7i; + a[j7] = y7i - x0i; + a[j7 + 1] = x0r + y7r; + a[j] = y0r + y4r; + a[j + 1] = y0i + y4i; + a[j4] = y4i - y0i; + a[j4 + 1] = y0r - y4r; + x0r = y2r - y6i; + x0i = y2i + y6r; + a[j2] = wn4r * (x0r - x0i); + a[j2 + 1] = wn4r * (x0i + x0r); + x0r = y6r - y2i; + x0i = y2r + y6i; + a[j6] = wn4r * (x0r - x0i); + a[j6 + 1] = wn4r * (x0i + x0r); + } + k1 = 4; + for (k = 2 * m; k < n; k += m) { + k1 += 4; + wk1r = w[k1]; + wk1i = w[k1 + 1]; + wk2r = w[k1 + 2]; + wk2i = w[k1 + 3]; + wtmp = 2 * wk2i; + wk3r = wk1r - wtmp * wk1i; + wk3i = wtmp * wk1r - wk1i; + wk4r = 1 - wtmp * wk2i; + wk4i = wtmp * wk2r; + wtmp = 2 * wk4i; + wk5r = wk3r - wtmp * wk1i; + wk5i = wtmp * wk1r - wk3i; + wk6r = wk2r - wtmp * wk2i; + wk6i = wtmp * wk2r - wk2i; + wk7r = wk1r - wtmp * wk3i; + wk7i = wtmp * wk3r - wk1i; + for (j = k; j < l + k; j += 2) { + j1 = j + l; + j2 = j1 + l; + j3 = j2 + l; + j4 = j3 + l; + j5 = j4 + l; + j6 = j5 + l; + j7 = j6 + l; + x0r = a[j] + a[j1]; + x0i = a[j + 1] + a[j1 + 1]; + x1r = a[j] - a[j1]; + x1i = a[j + 1] - a[j1 + 1]; + x2r = a[j2] + a[j3]; + x2i = a[j2 + 1] + a[j3 + 1]; + x3r = a[j2] - a[j3]; + x3i = a[j2 + 1] - a[j3 + 1]; + y0r = x0r + x2r; + y0i = x0i + x2i; + y2r = x0r - x2r; + y2i = x0i - x2i; + y1r = x1r - x3i; + y1i = x1i + x3r; + y3r = x1r + x3i; + y3i = x1i - x3r; + x0r = a[j4] + a[j5]; + x0i = a[j4 + 1] + a[j5 + 1]; + x1r = a[j4] - a[j5]; + x1i = a[j4 + 1] - a[j5 + 1]; + x2r = a[j6] + a[j7]; + x2i = a[j6 + 1] + a[j7 + 1]; + x3r = a[j6] - a[j7]; + x3i = a[j6 + 1] - a[j7 + 1]; + y4r = x0r + x2r; + y4i = x0i + x2i; + y6r = x0r - x2r; + y6i = x0i - x2i; + x0r = x1r - x3i; + x0i = x1i + x3r; + x2r = x1r + x3i; + x2i = x1i - x3r; + y5r = wn4r * (x0r - x0i); + y5i = wn4r * (x0r + x0i); + y7r = wn4r * (x2r - x2i); + y7i = wn4r * (x2r + x2i); + x0r = y1r + y5r; + x0i = y1i + y5i; + a[j1] = wk1r * x0r - wk1i * x0i; + a[j1 + 1] = wk1r * x0i + wk1i * x0r; + x0r = y1r - y5r; + x0i = y1i - y5i; + a[j5] = wk5r * x0r - wk5i * x0i; + a[j5 + 1] = wk5r * x0i + wk5i * x0r; + x0r = y3r - y7i; + x0i = y3i + y7r; + a[j3] = wk3r * x0r - wk3i * x0i; + a[j3 + 1] = wk3r * x0i + wk3i * x0r; + x0r = y3r + y7i; + x0i = y3i - y7r; + a[j7] = wk7r * x0r - wk7i * x0i; + a[j7 + 1] = wk7r * x0i + wk7i * x0r; + a[j] = y0r + y4r; + a[j + 1] = y0i + y4i; + x0r = y0r - y4r; + x0i = y0i - y4i; + a[j4] = wk4r * x0r - wk4i * x0i; + a[j4 + 1] = wk4r * x0i + wk4i * x0r; + x0r = y2r - y6i; + x0i = y2i + y6r; + a[j2] = wk2r * x0r - wk2i * x0i; + a[j2 + 1] = wk2r * x0i + wk2i * x0r; + x0r = y2r + y6i; + x0i = y2i - y6r; + a[j6] = wk6r * x0r - wk6i * x0i; + a[j6 + 1] = wk6r * x0i + wk6i * x0r; + } + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void rftfsub(int n, float *a, int nc, float *c) { + int j, k, kk, ks, m; + float wkr, wki, xr, xi, yr, yi; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("rftfsub()"); +#endif + + m = n >> 1; + ks = 2 * nc / m; + kk = 0; + for (j = 2; j < m; j += 2) { + k = n - j; + kk += ks; + wkr = static_cast(0.5 - c[nc - kk]); + wki = c[kk]; + xr = a[j] - a[k]; + xi = a[j + 1] + a[k + 1]; + yr = wkr * xr - wki * xi; + yi = wkr * xi + wki * xr; + a[j] -= yr; + a[j + 1] -= yi; + a[k] += yr; + a[k + 1] -= yi; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void rftbsub(int n, float *a, int nc, float *c) { + int j, k, kk, ks, m; + float wkr, wki, xr, xi, yr, yi; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("rftbsub()"); +#endif + + a[1] = -a[1]; + m = n >> 1; + ks = 2 * nc / m; + kk = 0; + for (j = 2; j < m; j += 2) { + k = n - j; + kk += ks; + wkr = 0.5f - c[nc - kk]; + wki = c[kk]; + xr = a[j] - a[k]; + xi = a[j + 1] + a[k + 1]; + yr = wkr * xr + wki * xi; + yi = wkr * xi - wki * xr; + a[j] -= yr; + a[j + 1] = yi - a[j + 1]; + a[k] += yr; + a[k + 1] = yi - a[k + 1]; + } + a[m + 1] = -a[m + 1]; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void dctsub(int n, float *a, int nc, float *c) { + int j, k, kk, ks, m; + float wkr, wki, xr; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("dctsub()"); +#endif + + m = n >> 1; + ks = nc / n; + kk = 0; + for (j = 1; j < m; j++) { + k = n - j; + kk += ks; + wkr = c[kk] - c[nc - kk]; + wki = c[kk] + c[nc - kk]; + xr = wki * a[j] - wkr * a[k]; + a[j] = wkr * a[j] + wki * a[k]; + a[k] = xr; + } + a[m] *= c[0]; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void dstsub(int n, float *a, int nc, float *c) { + int j, k, kk, ks, m; + float wkr, wki, xr; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("dstsub()"); +#endif + + m = n >> 1; + ks = nc / n; + kk = 0; + for (j = 1; j < m; j++) { + k = n - j; + kk += ks; + wkr = c[kk] - c[nc - kk]; + wki = c[kk] + c[nc - kk]; + xr = wki * a[k] - wkr * a[j]; + a[k] = wkr * a[k] + wki * a[j]; + a[j] = xr; + } + a[m] *= c[0]; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void fft8g_end() {} diff --git a/client/fft8g.h b/client/fft8g.h new file mode 100644 index 0000000..62eb03d --- /dev/null +++ b/client/fft8g.h @@ -0,0 +1,11 @@ +// This code is from the General Purpose FFT (Fast Fourier/Cosine/Sine Transform) Package. +// Copyright Takuya OOURA, 1996-2001 +// (Email: ooura@kurims.kyoto-u.ac.jp or ooura@mmm.t.u-tokyo.ac.jp) +// +// You may use, copy, modify and distribute this code for any purpose +// (include commercial use) and without fee. Please refer to this package +// when you modify this code. + +// $Id: fft8g.h,v 1.3.2.1 2005/05/19 00:42:30 korpela Exp $ +void cdft(int, int, sah_complex *, int *, float *); +void ddct(int, int, float *, int *, float *); diff --git a/client/gaussfit.cpp b/client/gaussfit.cpp new file mode 100644 index 0000000..8139a59 --- /dev/null +++ b/client/gaussfit.cpp @@ -0,0 +1,578 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// gaussfit.C +// $Id: gaussfit.cpp,v 1.21.2.12 2007/08/10 00:38:48 korpela Exp $ +// + +// The purpose of gaussian fitting is to find signals that rise and +// fall in power over time at a rate consistent with the beam +// pattern of the telescope. + +#include "sah_config.h" + +#include +#include + +#include + +// debug stuff +#define DEBUG_POT +//#define DUMP_POWER_SPECTRA +//#define DUMP_GAUSSIAN +#define POT_TO_DUMP 32 +#define TOFF_TO_DUMP 15 +#define FFT_TO_DUMP 131072 +int gul_PoT; +int gul_Fftl; +// end debug stuff + +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + +//#include "util.h" +#include "s_util.h" +#include "analyze.h" +#include "seti.h" +#include "worker.h" +#include "analyzeFuncs.h" +#include "analyzeReport.h" +#include "analyzePoT.h" +#include "lcgamm.h" +#include "gaussfit.h" +#include "chirpfft.h" +#ifdef __arm__ +#include "vector/fp_arm.h" +#endif + +bool dump_pot = false; +//float gauss_display_power_thresh = 0; + +float f_GetPeak( + float fp_PoT[], + int ul_TOffset, + int ul_HalfSumLength, + float f_MeanPower, + float f_PeakScaleFactor, + float f_weight[] +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("f_GetPeak()"); +#endif + // Peak power is calculated as the weighted + // sum of all powers within ul_HalfSumLength + // of the assumed gaussian peak. + // The weights are given by the gaussian function itself. + // BUG WATCH : for the f_PeakScaleFactor to work, + // ul_HalfSumLength *must* be set to sigma. + + int i; + float f_sum; + + f_sum = 0.0; + + // Find a weighted sum + for (i = ul_TOffset - ul_HalfSumLength; i <= ul_TOffset + ul_HalfSumLength; i++) { + f_sum += (fp_PoT[i] - f_MeanPower) * f_weight[abs(i-ul_TOffset)]; + } + + analysis_state.FLOP_counter+=6.0*ul_HalfSumLength; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return(f_sum * f_PeakScaleFactor); +} + +float f_GetChiSq( + float fp_PoT[], + int ul_PowerLen, + int ul_TOffset, + float f_PeakPower, + float f_MeanPower, + float f_weight[], + float *xsq_null=0 +) { + // We calculate our assumed gaussian powers + // on the fly as we try to fit them to the + // actual powers at each point along the PoT. +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("f_GetChiSq()"); +#endif + + int i; + float f_ChiSq=0,f_null_hyp=0, f_PredictedPower, f_tot_weight=0; + double rebin=swi.nsamples/ChirpFftPairs[analysis_state.icfft].FftLen + /ul_PowerLen; + + for (i = 0; i < ul_PowerLen; i++) { + f_PredictedPower = f_MeanPower + + f_PeakPower * f_weight[abs(i-ul_TOffset)] ; + f_tot_weight+=f_weight[abs(i-ul_TOffset)]; +#ifdef DUMP_GAUSSIAN + if ((gul_PoT == POT_TO_DUMP && ul_TOffset == TOFF_TO_DUMP) && + gul_Fftl == FFT_TO_DUMP) { + fprintf(stdout, "%f\n", f_PredictedPower); + } +#endif + // ChiSq in this realm is: + // sum[0:i]( (observed power - expected power)^2 / expected variance ) + // The power of a signal is: + // power = (noise + signal)^2 = noise^2 + signal^2 + 2*noise*signal + // With mean power normalization, noise becomes 1, leaving: + // power = signal^2 +or- 2*signal + 1 + f_PredictedPower/=f_MeanPower; + double signal=f_PredictedPower; + double noise=(2.0*sqrt(std::max(f_PredictedPower,1.0f)-1)+1); + + f_ChiSq += + (static_cast(rebin*SQUARE(fp_PoT[i]/f_MeanPower - signal)/noise)); + f_null_hyp+= + (static_cast(rebin*SQUARE(fp_PoT[i]/f_MeanPower-1)/noise)); + } + + analysis_state.FLOP_counter+=20.0*ul_PowerLen+5; + f_ChiSq/=ul_PowerLen; + f_null_hyp/=ul_PowerLen; + +#ifdef DUMP_GAUSSIAN + if (gul_PoT == POT_TO_DUMP + && ul_TOffset == TOFF_TO_DUMP + && gul_Fftl == FFT_TO_DUMP + ) { + for (i = 0; i < ul_PowerLen; i++) { + fprintf(stdout, "%f\n", fp_PoT[i]); + } + } +#endif + if (xsq_null) *xsq_null=f_null_hyp; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return f_ChiSq; +} + + +float f_GetTrueMean( + float fp_PoT[], + int ul_PowerLen, + float f_TotalPower, + int ul_TOffset, + int ul_ExcludeLen +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("f_GetTrueMean()"); +#endif + // TrueMean is the mean power of the data set minus all power + // out to ExcludeLen from our current TOffset. + int i, i_start, i_lim; + float f_ExcludePower = 0,f; + + // take care that we do not add to exclude power beyond PoT bounds! + i_start = std::max(ul_TOffset - ul_ExcludeLen, 0); + i_lim = std::min(ul_TOffset + ul_ExcludeLen + 1, swi.analysis_cfg.gauss_pot_length); + for (i = i_start; i < i_lim; i++) { + f_ExcludePower += fp_PoT[i]; + } + + analysis_state.FLOP_counter+=(double)(i_lim-i_start+5); + f=((f_TotalPower - f_ExcludePower) / (ul_PowerLen - (i - i_start))); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return f; +} + + +float f_GetPeakScaleFactor(float f_sigma) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("f_GetPeakScaleFactor()"); +#endif + // The PeakScaleFactor is calculated such that when used in f_GetPeak(), + // the actual peak power can be extracted from a weighted sum. + // This sum (see f_GetPeak()), is calculated as : + // sum = SUM[x from -sigma to +sigma] of (gaussian weights * our data) + // The gaussian weights are e^(-x^2 / sigma^2). + // Our data is A(e^(-x^2 / sigma^2)), where 'A' is the peak power. + // Through algebraic manipulation, we have: + // A = sum * (1 / SUM[x from -sigma to +sigma] of (e^(-x^2 / sigma^2))^2. + // The factor by which we multiply the sum is the PeakScaleFactor. + // It is completely determined by sigma. + + int i, i_s = static_cast(floor(f_sigma+0.5)); + float f_sigma_sq = f_sigma*f_sigma; + float f_sum = 0.0; + + for (i = -i_s; i <= i_s; i++) { + f_sum += static_cast(EXP(i, 0, f_sigma_sq)); + } + + analysis_state.FLOP_counter+=(13.0*f_sigma+3); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return(1 / f_sum); +} + + +int ChooseGaussEvent( + int ifft, + float PeakPower, + float TrueMean, + float ChiSq, + float null_ChiSq, + int bin, + float sigma, + float PoTMaxPower, + float fp_PoT[] +) { + +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ChooseGaussEvent"); +#endif + GAUSS_INFO gi; + float scale_factor; + bool report, chisqOK=(ChiSq <= swi.analysis_cfg.gauss_chi_sq_thresh); + + // gaussian info + gi.bin = bin; + gi.fft_ind = ifft; + gi.g.chirp_rate = ChirpFftPairs[analysis_state.icfft].ChirpRate; + gi.g.fft_len = ChirpFftPairs[analysis_state.icfft].FftLen; + gi.g.sigma = sigma; + gi.g.peak_power = PeakPower; + gi.g.mean_power = TrueMean; + gi.g.chisqr = ChiSq; + gi.g.null_chisqr = null_ChiSq; + gi.g.freq = cnvt_bin_hz(bin, gi.g.fft_len); + double t_offset=(((double)gi.fft_ind+0.5)/swi.analysis_cfg.gauss_pot_length)* + PoTInfo.WUDuration; + gi.g.detection_freq =calc_detection_freq(gi.g.freq,gi.g.chirp_rate,t_offset); + gi.g.time = swi.time_recorded+t_offset/86400.0; + gi.g.max_power = PoTMaxPower; + gi.score = -13.0; + time_to_ra_dec(gi.g.time, &gi.g.ra, &gi.g.decl); + + // Scale PoT down to 256 16 bit ints. + //for (i=0; i(gi.g.max_power) / 255.0f; + if (gi.g.pot.size() != static_cast(swi.analysis_cfg.gauss_pot_length)) { + gi.g.pot.set_size(swi.analysis_cfg.gauss_pot_length); + } + float_to_uchar(fp_PoT, &(gi.g.pot[0]), swi.analysis_cfg.gauss_pot_length, scale_factor); + + if (!swi.analysis_cfg.gauss_null_chi_sq_thresh) + swi.analysis_cfg.gauss_null_chi_sq_thresh=1.890; + // Gauss score used for "best of" and graphics. + // This score is now set to be based upon the probability that a signal + // would occur due to noise and the probability that it is shaped like + // a Gaussian (normalized to 0 at thresholds). Thanks to Tetsuji for + // making me think about this. The Gaussian has 62 degrees of freedom and + // the null hypothesis has 63 degrees of freedom when gauss_pot_length=64; + //JWS: Calculate invariant terms once, ala Alex Kan and Przemyslaw Zych + static float gauss_bins = static_cast(swi.analysis_cfg.gauss_pot_length); + static float gauss_dof = gauss_bins - 2.0f; + static float null_dof = gauss_bins - 1.0f; + static double score_offset = ( + lcgf(0.5*null_dof, swi.analysis_cfg.gauss_null_chi_sq_thresh*0.5*gauss_bins) + -lcgf(0.5*gauss_dof, swi.analysis_cfg.gauss_chi_sq_thresh*0.5*gauss_bins) + ); +//R: same optimization as for GPU build: if there is reportable Gaussian already - +//R: skip score calculation for all except new reportable Gaussians + // Final thresholding first. + report = chisqOK + && (gi.g.peak_power >= gi.g.mean_power * swi.analysis_cfg.gauss_peak_power_thresh) + && (gi.g.null_chisqr >= swi.analysis_cfg.gauss_null_chi_sq_thresh); + if (gaussian_count==0||report) { + gi.score = score_offset + +lcgf(0.5*gauss_dof,std::max(gi.g.chisqr*0.5*gauss_bins,0.5*gauss_dof+1)) + -lcgf(0.5*null_dof,std::max(gi.g.null_chisqr*0.5*gauss_bins,0.5*null_dof+1)); + } + // Only include "real" Gaussians (those meeting the chisqr threshold) + // in the best Gaussian display. + if (gi.score > best_gauss->score && chisqOK) { + *best_gauss = gi; + if(verbose>=2){ + fprintf(stderr,"Best gaussian updated: score=%.7g, fft_len=%d, PoT=%d, Offset=%d,\n\tPeak=%.7g, TrueMean=%.7g,ChiSq=%.7g,null_hyp=%.7g,PoTMaxPower=%.7g,icfft=%d\n", + gi.score,ChirpFftPairs[analysis_state.icfft].FftLen,bin,ifft, + PeakPower,TrueMean,ChiSq,null_ChiSq,PoTMaxPower,analysis_state.icfft); + } + } + // Update gdata gauss info regardless of whether it is the + // best thus far or even passes the final threshold. If + // a gaussian has made it this far, display it. +#ifdef BOINC_APP_GRAPHICS + if (!nographics()) sah_graphics->gi.copy(&gi); +#endif + + + analysis_state.FLOP_counter+=24.0; + // Final reporting. + if (report) { + int retval=result_gaussian(gi); + if(verbose>=1){ + int fft=(gi.g.fft_len>1024)?(gi.g.fft_len/1024):(gi.g.fft_len); + char symbol=(gi.g.fft_len>1024)?('k'):(' '); + fprintf(stderr,"Gaussian: peak=%.7g, mean=%.7g, ChiSq=%.7g, time=%.4g, d_freq=%.12g,\n\tscore=%.7g, null_hyp=%.7g, chirp=%.5g, fft_len=%d%c\n", + gi.g.peak_power,gi.g.mean_power,gi.g.chisqr,(gi.g.time-swi.time_recorded)*86400,gi.g.detection_freq,gi.score, + gi.g.null_chisqr,gi.g.chirp_rate,fft,symbol); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return retval; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +int GaussFit( + float * fp_PoT, + int ul_FftLength, + int ul_PoT +) { + int i, retval; + BOOLEAN b_IsAPeak; + float f_NormMaxPower; + float f_null_hyp; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("GaussFit()"); +#endif + + int ul_TOffset; + int iSigma = static_cast(floor(PoTInfo.GaussSigma+0.5)); + float f_GroupSum, f_GroupMax; + int i_f, iPeakLoc; + + float f_TotalPower, + f_MeanPower, + f_TrueMean, + f_ChiSq, + f_PeakPower; + + // For setiathome the Sigma and Gaussian PoT length don't change during + // a run of the application, so these frequently used values can be + // precalculated and kept. + static float f_PeakScaleFactor; + static float *f_weight; + + if (!f_weight) { + f_PeakScaleFactor = f_GetPeakScaleFactor(static_cast(PoTInfo.GaussSigma)); + f_weight = reinterpret_cast(malloc(PoTInfo.GaussTOffsetStop*sizeof(float))); + if (!f_weight) SETIERROR(MALLOC_FAILED, "!f_weight"); + for (i = 0; i < PoTInfo.GaussTOffsetStop; i++) { + f_weight[i] = static_cast(EXP(i, 0, PoTInfo.GaussSigmaSq)); + } + } + // Find mean over power-of-time array + f_TotalPower = 0; + for (i = 0; i < swi.analysis_cfg.gauss_pot_length; i++) { + f_TotalPower += fp_PoT[i]; + } + f_MeanPower = f_TotalPower / swi.analysis_cfg.gauss_pot_length; + + // Normalize power-of-time and check for the existence + // of at least 1 peak. + b_IsAPeak = false; + double r_MeanPower=1.0/f_MeanPower; + for (i = 0; i < swi.analysis_cfg.gauss_pot_length; i++) { + fp_PoT[i] *= r_MeanPower; + if (fp_PoT[i] > PoTInfo.GaussPowerThresh) b_IsAPeak = true; + } + analysis_state.FLOP_counter+=3.0*swi.analysis_cfg.gauss_pot_length+2; + + if (!b_IsAPeak) { + //printf("no peak\n"); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; // no peak - bail on this PoT + } + + // Recalculate Total Power across normalized array. + // Given that powers are positive, f_TotalPower will + // end up being == swi.analysis_cfg.gauss_pot_length. + f_TotalPower = 0; + f_NormMaxPower = 0; + // Also locate group with the highest sum for use in second bailout check. + f_GroupSum = 0; + f_GroupMax = 0; + for (i = 0, i_f = -iSigma; i < swi.analysis_cfg.gauss_pot_length; i++, i_f++) { + f_TotalPower += fp_PoT[i]; + if(fp_PoT[i] > f_NormMaxPower) f_NormMaxPower = fp_PoT[i]; + f_GroupSum += fp_PoT[i] - ((i_f < 0) ? 0.0f : fp_PoT[i_f]); + if (f_GroupSum > f_GroupMax) { + f_GroupMax = f_GroupSum; + iPeakLoc = i - iSigma/2; + } + } + + // Check at the group peak location whether data may contain Gaussians + // (but only after the first hurry-up Gaussian has been set for graphics) + + if (best_gauss->display_power_thresh != 0) { + iPeakLoc = std::max(PoTInfo.GaussTOffsetStart, + (std::min(PoTInfo.GaussTOffsetStop - 1, iPeakLoc))); + + f_TrueMean = f_GetTrueMean( + fp_PoT, + swi.analysis_cfg.gauss_pot_length, + f_TotalPower, + iPeakLoc, + 2 * iSigma + ); + + f_PeakPower = f_GetPeak( + fp_PoT, + iPeakLoc, + iSigma, + f_TrueMean, + f_PeakScaleFactor, + f_weight + ); + + analysis_state.FLOP_counter+=5.0*swi.analysis_cfg.gauss_pot_length+5; + + if (f_PeakPower < f_TrueMean*best_gauss->display_power_thresh*0.5f) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; // not even a weak peak at max group - bail on this PoT + } + } + + + // slide dynamic gaussian across the Power Of Time array + for (ul_TOffset = PoTInfo.GaussTOffsetStart; + ul_TOffset < PoTInfo.GaussTOffsetStop; + ul_TOffset++ + ) { + + // TrueMean is the mean power of the data set minus all power + // out to 2 sigma from our current TOffset. + f_TrueMean = f_GetTrueMean( + fp_PoT, + swi.analysis_cfg.gauss_pot_length, + f_TotalPower, + ul_TOffset, + 2 * iSigma + ); + + f_PeakPower = f_GetPeak( + fp_PoT, + ul_TOffset, + iSigma, + f_TrueMean, + f_PeakScaleFactor, + f_weight + ); + + // worth looking at ? + if (f_PeakPower < f_TrueMean*best_gauss->display_power_thresh) { + continue; + } + + // bump up the display threshold to its final value. + // We could bump it up only to the gaussian just found, + // but that would cause a lot of time waste + // computing chisq etc. + if (best_gauss->display_power_thresh == 0) { + best_gauss->display_power_thresh = PoTInfo.GaussPeakPowerThresh/3; + } + +#ifdef TEXT_UI + if(dump_pot) { + printf("Found good peak at this PoT element.... truemean is %f, power is %f\n", f_TrueMean, f_PeakPower); + } +#endif + +#ifdef DUMP_GAUSSIAN + gul_PoT = ul_PoT; + gul_Fftl = ul_FftLength; +#endif + + // look at it - try to fit + f_ChiSq = f_GetChiSq( + fp_PoT, + swi.analysis_cfg.gauss_pot_length, + ul_TOffset, + f_PeakPower, + f_TrueMean, + f_weight, + &f_null_hyp + ); + +#ifdef TEXT_UI + if(dump_pot) { + printf("Checking ChiSqr for PoT dump....\n"); + if(f_ChiSq <= swi.analysis_cfg.gauss_chi_sq_thresh) { + int dump_i; + printf( + "POT %d %f %f %f %f %d ", + ul_TOffset, + f_PeakPower, + f_TrueMean, + PoTInfo.GaussSigmaSq, + f_ChiSq, + ul_PoT + ); + for (dump_i = 0; dump_i < swi.analysis_cfg.gauss_pot_length; dump_i++) { + printf("%f ", fp_PoT[dump_i]); + } + printf("\n"); + } else { + printf("ChiSqr is %f, not good enough.\n", f_ChiSq); + } + } +#endif + + retval = ChooseGaussEvent( + ul_TOffset, + f_PeakPower, + f_TrueMean, + f_ChiSq, + f_null_hyp, + ul_PoT, + static_cast(PoTInfo.GaussSigma), + f_NormMaxPower, + fp_PoT + ); + if (retval) SETIERROR(retval,"from ChooseGaussEvent"); + + } // End of sliding gaussian + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + +} // End of gaussfit() + + diff --git a/client/gaussfit.h b/client/gaussfit.h new file mode 100644 index 0000000..db96e31 --- /dev/null +++ b/client/gaussfit.h @@ -0,0 +1,62 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// Title : gaussfit.h +// $Id: gaussfit.h,v 1.3.2.2 2006/06/22 23:53:57 korpela Exp $ + +extern int GaussFit( + float * fp_PoT, + int ul_FftLength, + int ul_PoT + ); + +extern float f_GetPeak( + float fp_PoT[], + int ul_TOffset, + int ul_HalfSumLength, + float f_MeanPower, + float f_PeakScaleFactor, + float f_weight[] +); + +int ChooseGaussEvent( + int ifft, + float PeakPower, + float TrueMean, + float ChiSq, + float null_ChiSq, + int bin, + float sigma, + float PoTMaxPower, + float fp_PoT[] +); + +float f_GetPeakScaleFactor(float f_sigma); + +extern void gauss_display_init(); + +extern bool dump_pot; diff --git a/client/gdata.cpp b/client/gdata.cpp new file mode 100644 index 0000000..24c7b6b --- /dev/null +++ b/client/gdata.cpp @@ -0,0 +1,130 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +#include "sah_config.h" +#include + +#include "seti.h" + +#include "gdata.h" + +// in each case, see if the signal being copied is the same +// as what's already there, and return if so. +// This prevents the dirty flag from being set spuriously +// + +void G_TRIPLET_INFO::copy(TRIPLET_INFO * ti, bool ib) { + int i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("G_TRIPLET_INFO::copy()"); +#endif + if (peak_power==ti->t.peak_power && period==ti->t.period) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return; + } + peak_power = ti->t.peak_power; + period = ti->t.period; + tpotind0_0 = ti->tpotind0_0; + tpotind0_1 = ti->tpotind0_1; + tpotind1_0 = ti->tpotind1_0; + tpotind1_1 = ti->tpotind1_1; + tpotind2_0 = ti->tpotind2_0; + tpotind2_1 = ti->tpotind2_1; + for (i=0; ipot_max[i]; + } + for (i=0; ipot_min[i]; + } + dirty = true; + is_best = ib; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +void G_PULSE_INFO::copy(PULSE_INFO * pi, bool ib) { + int i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("G_PULSE_INFO::copy()"); +#endif + if (score==pi->score && peak_power==pi->p.peak_power) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return; + } + peak_power = pi->p.peak_power; + period = pi->p.period; + score = pi->score; + for (i=0; ipot_max[i]; + } + //for (i=0; ipot_min[i]; + //} + dirty = true; + is_best = ib; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +void G_GAUSS_INFO::copy(GAUSS_INFO * gi, bool ib) { + size_t i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("G_GAUSS_INFO::copy()"); +#endif + if (score==gi->score && chisqr==gi->g.chisqr) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return; + } + score = gi->score; + peak_power = gi->g.peak_power; + mean_power = gi->g.mean_power; + chisqr = gi->g.chisqr; + sigma = gi->g.sigma; + fft_ind = gi->fft_ind; + for (i=0; ig.pot.size(),static_cast(GAUSS_POT_LEN)); i++) { + pot[i] = gi->g.pot[i]; + } + dirty = true; + is_best = ib; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +void G_SPIKE_INFO::copy(SPIKE_INFO * si, bool ib) { +} + +void G_AUTOCORR_INFO::copy(AUTOCORR_INFO * si, bool ib) { +} diff --git a/client/gdata.h b/client/gdata.h new file mode 100644 index 0000000..8e7536b --- /dev/null +++ b/client/gdata.h @@ -0,0 +1,157 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: gdata.h,v 1.16.2.5 2007/05/31 22:03:10 korpela Exp $ + +// GDATA is a collection of information generated by the worker thread +// that might be useful for graphics. +// It does not contain any user preference info, +// or anything related to a particular style of graphics. + +#ifndef _GDATA_ +#define _GDATA_ + +#include "sah_version.h" +#include "reduce.h" +#ifndef AP_CLIENT +#include "analyze.h" +#include + +struct GAUSS_INFO; +struct SPIKE_INFO; +struct AUTOCORR_INFO; +struct TRIPLET_INFO; +struct PULSE_INFO; + +// Power of time array sizes for graphics routines only. +#define GAUSS_POT_LEN 64 +#define PULSE_POT_LEN 256 +#define TRIPLET_POT_LEN 256 + +struct FFT_INFO { + double chirp_rate; + int fft_len; +}; + + +struct G_AUTOCORR_INFO { + void copy(AUTOCORR_INFO *, bool is_best=false); +}; + +struct G_SPIKE_INFO { + void copy(SPIKE_INFO *, bool is_best=false); +}; + +struct G_GAUSS_INFO { + double score; + bool is_best; // true if best score so far + bool dirty; // true if we haven't displayed this yet + double peak_power; + double mean_power; + double chisqr; + double sigma; + int fft_ind; // assigned in ReportGaussEvent() + float pot[GAUSS_POT_LEN]; + void copy(GAUSS_INFO *, bool is_best=false); + G_GAUSS_INFO() : score(0), is_best(false), dirty(false), peak_power(0), mean_power(0), chisqr(0), sigma(0), fft_ind(0) + { memset(pot,0,sizeof(pot)); }; +}; + +struct G_TRIPLET_INFO { + double peak_power; + double period; + bool is_best; + bool dirty; + int tpotind0_0; // index into pot_min/pot_max arrays + int tpotind0_1; // of start/end of first element of triplet + int tpotind1_0; // second element + int tpotind1_1; + int tpotind2_0; // and third element + int tpotind2_1; + unsigned int pot_min[TRIPLET_POT_LEN]; // Scaled 0-255 for display + unsigned int pot_max[TRIPLET_POT_LEN]; // Scaled 0-255 for display + void copy(TRIPLET_INFO *, bool is_best=false); + G_TRIPLET_INFO() : peak_power(0), period(0), is_best(false), dirty(false), tpotind0_0(0), tpotind0_1(0), + tpotind1_0(0), tpotind1_1(0), tpotind2_0(0), tpotind2_1(0) + { memset(pot_min,0,sizeof(pot_min)); memset(pot_max,0,sizeof(pot_max)); } +}; + +struct G_PULSE_INFO { + bool is_best; + bool dirty; + double peak_power; + double period; + double score; + unsigned int pot_max[PULSE_POT_LEN]; // Scaled 0-255 for display + void copy(PULSE_INFO *, bool is_best=false); + G_PULSE_INFO() : is_best(false), dirty(false), peak_power(0), period(0), score(0) + { memset(pot_max,0,sizeof(pot_max)); } +}; + +#endif + +struct G_SETI_WU_INFO { + char receiver_name[255]; + int s4_id; + double time_recorded; + double subband_base; + double start_ra, start_dec; + double subband_sample_rate; +}; + +struct GDATA { + int ready; + int version_major; + int version_minor; + double local_progress; + double progress; + double cpu_time; + volatile int countdown; + // the graphics app sets this to 5 every second, + // and the main app decrements it every second. + // So if it's zero, it means no graphics app is running + char status[80]; + +#ifndef AP_CLIENT + G_SETI_WU_INFO wu; + FFT_INFO fft_info; + G_SPIKE_INFO si; + G_AUTOCORR_INFO ai; + G_GAUSS_INFO gi; + G_TRIPLET_INFO ti; + G_PULSE_INFO pi; +#endif +}; + +// SAH_SHMEM is the shared-memory structure + +struct SAH_SHMEM { + GDATA gdata; + REDUCED_ARRAY_DATA rarray_data; +}; + +#endif diff --git a/client/graphics_main.cpp b/client/graphics_main.cpp new file mode 100644 index 0000000..ee82238 --- /dev/null +++ b/client/graphics_main.cpp @@ -0,0 +1,51 @@ +// Berkeley Open Infrastructure for Network Computing +// http://boinc.berkeley.edu +// Copyright (C) 2005 University of California +// +// This is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; +// either version 2.1 of the License, or (at your option) any later version. +// +// This software is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Lesser General Public License for more details. +// +// To view the GNU Lesser General Public License visit +// http://www.gnu.org/copyleft/lesser.html +// or write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +// Example graphics application, paired with uc2.C +// This demonstrates: +// - using shared memory to communicate with the worker app +// - reading XML preferences by which users can customize graphics +// (in this case, select colors) +// - handle mouse input (in this case, to zoom and rotate) +// - draw text and 3D objects using OpenGL + +#ifdef _WIN32 +#include "boinc_win.h" +#else +#include +#include +#endif + +#include "boinc_api.h" +#include "graphics2.h" +#include "diagnostics.h" +#include "sah_gfx.h" + +SAH_GRAPHICS sah_graphics; +APP_INIT_DATA sah_aid; + +int main(int argc, char** argv) { + boinc_init_graphics_diagnostics(BOINC_DIAG_DEFAULTS); + boinc_parse_init_data_file(); + boinc_get_init_data(sah_aid); + if (sah_aid.project_preferences) { + sah_graphics.parse_project_prefs(sah_aid.project_preferences); + } + boinc_graphics_loop(argc, argv); +} diff --git a/client/i686_graphics_link b/client/i686_graphics_link new file mode 100644 index 0000000..59afae2 --- /dev/null +++ b/client/i686_graphics_link @@ -0,0 +1 @@ + g++ -m32 -O3 -I/usr/local/include -static-libgcc -g -Wall -I/usr/local/include -I/usr/include -I/usr/include/openssl -DHAVE_CONFIG_H -DTEXT_UI -DNDEBUG -DCLIENT -I../db -I../client -I../client/win_build -I/home/korpela/build/i686-linux/boinc -I/home/korpela/build/i686-linux/boinc/api -I/home/korpela/build/i686-linux/boinc/lib -I/home/korpela/build/i686-linux/boinc/sched -I/home/korpela/build/i686-linux/boinc/db -I/home/korpela/build/i686-linux/boinc/clientgui/mac -pthread -msse2 -mfpmath=sse -DUSE_SSE -DUSE_SSE2 -I/usr/ -g -Wall -I/usr/local/include -I/usr/include -I/usr/include/openssl -o seti_graphics seti_graphics-timecvt.o seti_graphics-sah_gfx.o seti_graphics-sah_gfx_base.o seti_graphics-graphics_main.o seti_graphics-sah_version.o -pthread -L/usr/local/lib -L/usr/lib -L/home/korpela/build/i686-linux/boinc/api -L/home/korpela/build/i686-linux/boinc/lib /usr/lib/gcc/i686-redhat-linux/4.4.7/libstdc++.a /home/korpela/build/i686-linux/boinc/api/.libs/libboinc_graphics2.a /usr/lib/libglut.so /usr/lib/libGLU.so /usr/lib/libGL.so /usr/local/lib/libjpeg.a /home/korpela/build/i686-linux/boinc/api/.libs/libboinc_api.a /home/korpela/build/i686-linux/boinc/lib/.libs/libboinc.a -pthread /usr/lib/gcc/i686-redhat-linux/4.4.7/libstdc++.a /usr/lib/libm.a diff --git a/client/lcgamm.cpp b/client/lcgamm.cpp new file mode 100644 index 0000000..5efdeaa --- /dev/null +++ b/client/lcgamm.cpp @@ -0,0 +1,210 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +/* + * $Id: lcgamm.cpp,v 1.9.2.11 2007/05/31 22:03:10 korpela Exp $ + */ +#include "sah_config.h" + +#if defined(_WIN32) && !defined(__MINGW32__) +#include +#endif + +#include +#include +#include +#include +#include +#include // delete me! + +#include "diagnostics.h" + +#define ITMAX 10000 // Needs to be a few times the sqrt of the max. input to lcgf +#define FP_EPS 1.0e-35 + +/* Log of the complete gamma function */ +static double gammln(double a) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("gammln()"); +#endif + double x,y,tmp,ser,rv; + static double cof[6]={76.18009172947146,-86.50532032941677, + 24.01409824083091,-1.231739572450155, + 0.1208650973866179e-2,-0.5395239384953e-5}; + int j; + + y=x=a; + tmp=x+5.5; + tmp -= (x+0.5)*log(tmp); + ser=1.000000000190015; + for (j=0;j<=5;j++) ser += cof[j]/++y; + rv=(double)(-tmp+log(2.5066282746310005*ser/x)); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +/* Log of the compliment of the incomplete gamma function + * log(1-P(a,x)) valid only for (a+1)::epsilon(); + const double FPMIN=std::numeric_limits::min()/EPS; + double an,b,c,d,del,h,gln=gammln(a),rv; + + // assert(x>=(a+1)); + BOINCASSERT(x>=(a+1)); + b=x+1.0-a; + c=1.0f/FPMIN; + d=1.0/b; + h=d; + for (i=1;i<=ITMAX;i++) { + an = -i*(i-a); + b += 2.0; + d=an*d+b; + if (fabs(d)=0); + + rts=0.5f*(xh+xl); + dxold=(float)fabs(xh-xl); + dx=dxold; + f=lcgf(a,rts)-y; + df=dlcgf(a,rts); + for (j=1;j<=ITMAX;j++) { + if ((((rts-xh)*df-f)*((rts-xl)*df-f) >= 0.0) + || (fabs(2.0*f)>fabs(dxold*df))) { + dxold=dx; + dx=0.5f*(xh-xl); + rts=xl+dx; + if ((xl==rts) || (xh==rts)) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rts; + } + } else { + dxold=dx; + dx=f/df; + temp=rts; + rts-=dx; + if (temp==rts) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rts; + } + } + f=lcgf(a,rts)-y; + df=dlcgf(a,rts); + if (fabs(f) +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#endif + + +#include "diagnostics.h" +#include "util.h" +#include "s_util.h" +#include "boinc_api.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#include "graphics2.h" +#endif + +#ifdef BOINC_APP_GRAPHICS + +#endif + +#include "util.h" +#include "s_util.h" +#include "str_util.h" +#include "str_replace.h" +#include "analyze.h" +#include "analyzeFuncs.h" +#include "analyzePoT.h" +#include "worker.h" +#include "sah_version.h" +#include "chirpfft.h" +#include "gaussfit.h" + +#ifdef __APPLE_CC__ +#include "app_icon.h" +#include +#endif + +#ifdef ANDROID +#ifdef HAVE_LIBCORKSCREW +#include +void (* ignore_this)(unsigned, const backtrace_frame_t *, const backtrace_symbol_t *, char *, size_t)=&format_backtrace_line; +#endif +#endif + +static int g_argc; +static char **g_argv; + +void usage() { + printf( + "options:\n" +#ifdef BOINC_APP_GRAPHICS + " -nographics run without graphics\n" + " -notranspose do not transpose data for pulse and gaussian searches\n" + " -default_functions use the safe unoptimized default functions\n" + " -standalone (implies -nographics)\n" +#else + " -standalone\n" +#endif + " -version show version info\n" + " -verbose print running status\n" + " -v N level N of verbosity (N==2 to print best signals formation, N==0 to disable signals output)\n" + ); +} + +void print_error(int e) { + char* p; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("print_error()"); +#endif /* USE_MANUAL_CALLSTACK */ + p = error_string(e); + fprintf(stderr,"%s\n",p); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ +} + +void print_version() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("print_version()"); +#endif /* USE_MANUAL_CALLSTACK */ + printf( + "SETI@home client.\n" + "Version: %d.%02d\n", + gmajor_version, gminor_version + ); + printf( + "\nSETI@home is sponsored by individual donors around the world.\n" + "If you'd like to contribute to the project,\n" + "please visit the SETI@home web site at\n" + "http://setiathome.ssl.berkeley.edu.\n" + "The project is also sponsored by the Planetary Society,\n" + "the University of California, Sun Microsystems, Paramount Pictures,\n" + "Fujifilm Computer Products, Informix, Engineering Design Team Inc,\n" + "The Santa Cruz Operation (SCO), Intel, Quantum Corporation,\n" + "and the SETI Institute.\n\n" + "SETI@home was developed by David Gedye (Founder),\n" + "David Anderson (Director), Dan Werthimer (Chief Scientist),\n" + "Hiram Clawson, Jeff Cobb, Charlie Fenton,\n" + "Eric Heien, Eric Korpela, Matt Lebofsky,\n" + "Tetsuji 'Maverick' Rai and Rom Walton\n" + ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ +} + +extern double sigma_thresh; +extern double f_PowerThresh; +extern double f_PeakPowerThresh; +extern double chi_sq_thresh; +bool notranspose_flag=false; +bool default_functions_flag=false; + +int run_stage; + + +typedef seti_error boinc_error; + +//void atexit_handler(void) { +// if (run_stage == GRXINIT) { +// fprintf(stderr,"Staring in non-graphical mode"); +// fflush(stderr); +// fclose(stderr); +// g_argv[g_argc]="-nographics"; +// execv(g_argv[0],g_argv); +// SETIERROR(UNHANDLED_SIGNAL, "from atexit_handler()"); +// } +//} + +extern APP_INIT_DATA app_init_data; + +int main(int argc, char** argv) { + int retval = 0, i; + FORCE_FRAME_POINTER; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("main()"); +#endif /* USE_MANUAL_CALLSTACK */ + run_stage=PREGRX; + g_argc=argc; +#ifdef ANDROID + argv0=argv[0]; +#endif + + if (!(g_argv=(char **)calloc(argc+2,sizeof(char *)))) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ + exit(MALLOC_FAILED); + } + + + setbuf(stdout, 0); + + bool standalone = false; + g_argv[0]=argv[0]; + + for (i=1; i1) call_stack.set_verbose(true); +#endif /* USE_MANUAL_CALLSTACK */ + + try { + + // Initialize Diagnostics + // + unsigned long dwDiagnosticsFlags = 0; + + dwDiagnosticsFlags = + BOINC_DIAG_DUMPCALLSTACKENABLED | + BOINC_DIAG_HEAPCHECKENABLED | + BOINC_DIAG_TRACETOSTDERR | + BOINC_DIAG_REDIRECTSTDERR; + + retval = boinc_init_diagnostics(dwDiagnosticsFlags); + if (retval) { + SETIERROR(retval, "from boinc_init_diagnostics()"); + } + +#if defined(__APPLE__) && !defined(__ppc__) + setMacIcon(argv[0], MacAppIconData, sizeof(MacAppIconData)); +#ifdef __i386__ + rlimit rlp; + + getrlimit(RLIMIT_STACK, &rlp); + rlp.rlim_cur = rlp.rlim_max; + setrlimit(RLIMIT_STACK, &rlp); +#endif +#endif + + // Initialize BOINC + // + + boinc_parse_init_data_file(); + boinc_get_init_data(app_init_data); +#ifdef BOINC_APP_GRAPHICS + sah_graphics_init(app_init_data); +#endif + retval = boinc_init(); + if (retval) { + SETIERROR(retval, "from boinc_init()"); + } + worker(); + } + catch (seti_error e) { + e.print(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ + exit(static_cast(e)); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ + return 0; +} + +#ifdef _WIN32 + + +// +// Function: WinMain +// +// Purpose: Application entry point, used instead of main so that on Win9x platforms +// windows do not appear for each instance executing on the system. +// +// Date: 01/29/04 +// +int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode) { + LPSTR command_line; + char* argv[100]; + int argc, retval; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("WinMain()"); +#endif /* USE_MANUAL_CALLSTACK */ + + command_line = GetCommandLine(); + argc = parse_command_line(command_line,argv); + retval = main(argc, argv); + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ + return retval; +} + + +#endif diff --git a/client/malloc_a.cpp b/client/malloc_a.cpp new file mode 100644 index 0000000..0cbce5c --- /dev/null +++ b/client/malloc_a.cpp @@ -0,0 +1,165 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: malloc_a.cpp,v 1.6.2.5 2007/05/31 22:03:10 korpela Exp $ +#include "sah_config.h" + +#include +#include +#include +#ifdef HAVE_MEMORY_H +#include +#endif +#ifdef HAVE_MALLOC_H +#include +#endif + +//JWS: fftwf_malloc() is inadequate for AVX, XOP, and future SIMD > 128 bit +//#ifdef USE_FFTWF +//#include +//#endif + +#include "diagnostics.h" + +#include "malloc_a.h" + +// for processor portability (e.g. 32/64/etc, bit processors) +typedef size_t PointerArith; + +// malloc_a and free_a are used to allocate one memory block + +// Allocates memory on N-byte boundary +// +// When fftwf is used, we use fftwf_malloc and ignore the alignment setting, +// since this guarantees proper alignment for SIMD types. +// +// On WIN32, we use _aligned_malloc() +// +// Where memalign() is available, we use it. +// +// If none of the above, we use our own algorithm. +// +// Layout in memory of the pointers and buffer: +// +// +-- malloc'd memory pointer +// | +// | +-- save malloc'd memory pointer here for use with free_a() +// V V +// +--------+---+------------------- ... +// | unused |ptr| aligned buffer +// +--------+---+------------------- ... +// ^ +// | +// +-- aligned memory pointer returned from malloc_a() +// +// +// +void *malloc_a(size_t size, size_t alignment) { + void *palignedMem; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("malloc_a()"); +#endif +//#if defined(USE_FFTWF) +// return fftwf_malloc(size); +//#elif defined(HAVE__ALIGNED_MALLOC) +#if defined(HAVE__ALIGNED_MALLOC) + palignedMem=_aligned_malloc(size,alignment); +#elif defined(HAVE_POSIX_MEMALIGN) + if (posix_memalign(&palignedMem,alignment,size)) palignedMem=NULL; +#elif defined(HAVE_MEMALIGN) + palignedMem=memalign(alignment,size); +#else + PointerArith byteAlignment; + void *pmem; + void **pp; + + // ensure byteAlignment is positive (if alignment is 0, make it 1) + if (alignment < 1) { + alignment = 1; + } + byteAlignment = alignment - 1; + + pmem = (void *) malloc(size + byteAlignment + sizeof(void *)); // allocate memory + if (pmem == NULL) return NULL; + + // align memory on N byte boundary + palignedMem = (void *) (((PointerArith) pmem + byteAlignment + sizeof(void *)) & ~(byteAlignment)); + + pp = (void **) palignedMem; + pp[-1] = pmem; // store original address + +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return palignedMem; // return aligned memory +} + +//Frees memory that was allocated with malloc_a +void free_a(void *palignedMem) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("free_a()"); +#endif +//#if defined(USE_FFTWF) +// fftwf_free(palignedMem); +//#elif defined(HAVE__ALIGNED_FREE) +#if defined(HAVE__ALIGNED_FREE) + _aligned_free(palignedMem); +#elif defined(HAVE_MEMALIGN) || defined(HAVE_POSIX_MEMALIGN) + free(palignedMem); +#else + void **pp; + + if (palignedMem == NULL) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return; + } + pp = (void **) palignedMem; + + //pp[-1] pts to original address of malloc'd memory + free(pp[-1]); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +void *calloc_a(size_t size, size_t nitems, size_t alignment) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("calloc_a"); +#endif + void* p = malloc_a(size*nitems, alignment); + if (p) + memset(p, 0, size*nitems); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return p; +} + diff --git a/client/malloc_a.h b/client/malloc_a.h new file mode 100644 index 0000000..46c2541 --- /dev/null +++ b/client/malloc_a.h @@ -0,0 +1,34 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: malloc_a.h,v 1.5.2.2 2005/06/26 19:55:43 korpela Exp $ +// memory alignment multiple for large arrays +#define MEM_ALIGN 128 + +void* malloc_a(size_t size, size_t alignment); +void* calloc_a(size_t size, size_t nitems, size_t alignment); +void free_a(void *palignedMem); diff --git a/client/progress.cpp b/client/progress.cpp new file mode 100644 index 0000000..5a8df3f --- /dev/null +++ b/client/progress.cpp @@ -0,0 +1,241 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// progress.C + +#include "sah_config.h" + +#include +#include +#include +#include + +#include "diagnostics.h" +#include "util.h" +#include "s_util.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + + +#include "progress.h" +#include "analyzePoT.h" +#include "seti.h" +#include "chirpfft.h" + +double NormalizedToSpike = 0.0; + +double triplet_units; +double pulse_units; +double spike_units; +double gauss_units; + + +// fraction_done sets the boinc_fraction_done() with a smooth transition +// from using "progress" to "remaining" to determine the fraction done. +// The speed of the transition is determine by PROG_POWER. 6 means that +// "remaining" is the dominant term for about the final 1/6th of the run. +#define PROG_POWER 6 +void fraction_done(double progress,double remaining) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fraction_done"); +#endif + double prog2=1.0-remaining; + progress=std::min(progress,1.0); + double prog=progress*(1.0-pow(prog2,PROG_POWER))+prog2*pow(prog2,PROG_POWER); + boinc_fraction_done(prog); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +void reset_units() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("reset_units()"); +#endif + triplet_units=0; + pulse_units=0; + spike_units=0; + gauss_units=0; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +float GetProgressUnitSize(int NumDataPoints, int num_cfft, long ac_fft_len) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("GetProgressUnitSize()"); +#endif + // A ProgressUnit is defined as the computation time of a + // detection algorithm on the entire data block at a + // given chirpfft pair. + + // Spike detection takes place for every FFT length and at + // any slew rate. PoT detctors, on the other hand, may opt + // to not execute if slew rate and/or FFT length limits are + // not met. + + + int i, ThisPoTLen, ThisPulsePoTLen, DummyOverlap; + + double NumProgressUnits; + double LastChirpRate = 0.0f; + + double TotalSpikeProgressUnits = 0.0; + double TotalGaussianProgressUnits = 0.0; + double TotalPulseProgressUnits = 0.0; + double TotalTripletProgressUnits = 0.0; + double TotalChirpProgressUnits = 0.0; + double rv; + NumProgressUnits = 0.0; + + for (i = 0; i < num_cfft; i++) { + + // FFTs and spike finding + TotalSpikeProgressUnits += SpikeProgressUnits(ChirpFftPairs[i].FftLen); + + // Autocorr FFTs and finding + if ((long)ChirpFftPairs[i].FftLen == ac_fft_len) { + TotalSpikeProgressUnits += SpikeProgressUnits(ChirpFftPairs[i].FftLen); + } + + // Chirping + if(ChirpFftPairs[i].ChirpRate != LastChirpRate) { + TotalChirpProgressUnits += ChirpProgressUnits(); + LastChirpRate = ChirpFftPairs[i].ChirpRate; + } + + ThisPoTLen = NumDataPoints / ChirpFftPairs[i].FftLen; + + // Gaussians.... + if (ChirpFftPairs[i].GaussFit) { + TotalGaussianProgressUnits += GaussianProgressUnits(); + } + + // Pulses and Triplets.... + GetPulsePoTLen(ThisPoTLen, &ThisPulsePoTLen, &DummyOverlap); +#ifdef USE_PULSE + if(ChirpFftPairs[i].PulseFind) + TotalPulseProgressUnits += PulseProgressUnits(ThisPulsePoTLen, ChirpFftPairs[i].FftLen - 1); +#endif +#ifdef USE_TRIPLET + if(ThisPulsePoTLen >= PoTInfo.TripletMin && ThisPulsePoTLen <= PoTInfo.TripletMax) + TotalTripletProgressUnits += TripletProgressUnits(); +#endif + + } + + NumProgressUnits = TotalChirpProgressUnits + + TotalSpikeProgressUnits + + TotalGaussianProgressUnits + + TotalPulseProgressUnits + + TotalTripletProgressUnits; + +/* + fprintf(stderr, "%f ChirpProgressUnits (%f\%)\n", TotalChirpProgressUnits, TotalChirpProgressUnits/NumProgressUnits); + fprintf(stderr, "%f SpikeProgressUnits (%f\%)\n", TotalSpikeProgressUnits, TotalSpikeProgressUnits/NumProgressUnits); + fprintf(stderr, "%f GaussianProgressUnits (%f\%)\n", TotalGaussianProgressUnits, TotalGaussianProgressUnits/NumProgressUnits); + fprintf(stderr, "%f TripletProgressUnits (%f\%)\n", TotalTripletProgressUnits, TotalTripletProgressUnits/NumProgressUnits); + fprintf(stderr, "%f PulseProgressUnits (%f\%)\n", TotalPulseProgressUnits, TotalPulseProgressUnits/NumProgressUnits); + fprintf(stderr, "%f NumProgressUnits\n", NumProgressUnits); +*/ + + // Add a fudge factor of 0.01% to make sure we do not hit 100% done too soon + rv=(1.0f/(float)(NumProgressUnits + NumProgressUnits * 0.0001)); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + + + // Algorithm specific functions that return the number of progress + // units for the entire data block for some chirp/fft pair. All other + // algorithms are normalized to fft/spike finding, which is said + // to take 1.0 progress units. + + // If progress us updated at finer intervals than the computation + // on the entire data block, care must be taken to divide the + // return value by the number of such intervals in a data block. + // Eg, if you update for each FFT bin, divide the number of units + // by FFT length. + +double SpikeProgressUnits(int FftLen) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("SpikeProgressUnits()"); +#endif + spike_units+=(1.0+log((double)FftLen)/11.783); + double rv=(1.0+log((double)FftLen)/11.783); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +double GaussianProgressUnits() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("GaussianProgressUnits()"); +#endif + gauss_units+=(14.5*0.6); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return(14.5*0.6); +} + +// Pulse finding is an (n^2)log(n) computation. The final factor +// is a scaling factor and can be tuned. +double PulseProgressUnits(double PulsePoTLen, int FftLen) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("PulseProgressUnits()"); +#endif + pulse_units+=(PulsePoTLen * PulsePoTLen * log(PulsePoTLen) * FftLen / 2.65e6/4); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return(PulsePoTLen * PulsePoTLen * log(PulsePoTLen) * FftLen / 2.65e6/4); +} + +double TripletProgressUnits() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("TripletProgressUnits()"); +#endif + triplet_units+=0.1; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return(0.1); +} + +double ChirpProgressUnits() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ChirpProgressUnits()"); + call_stack.exit(); +#endif + return (2.0); +} diff --git a/client/progress.h b/client/progress.h new file mode 100644 index 0000000..ba022be --- /dev/null +++ b/client/progress.h @@ -0,0 +1,44 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// progress.h + +float GetProgressUnitSize(int NumDataPoints, int num_cfft, long ac_fft_len); +double SpikeProgressUnits(int FftLen); +double GaussianProgressUnits(); +double PulseProgressUnits(double PulsePoTLen, int FftLen); +double TripletProgressUnits(); +double ChirpProgressUnits(); + +void fraction_done(double progress,double remaining); + +extern double triplet_units; +extern double pulse_units; +extern double spike_units; +extern double gauss_units; + +void reset_units(); diff --git a/client/pulsefind.cpp b/client/pulsefind.cpp new file mode 100644 index 0000000..51aad37 --- /dev/null +++ b/client/pulsefind.cpp @@ -0,0 +1,1503 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + + +/* + * $Id: pulsefind.cpp,v 1.16.2.16 2007/08/10 00:38:48 korpela Exp $ + * + */ + +#include "sah_config.h" + +#include +#include +#include +#include +#include +#include + +#include "diagnostics.h" +#include "util.h" +#include "s_util.h" +#include "boinc_api.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + +#include "seti.h" +#include "seti_header.h" +#include "analyzePoT.h" +#include "analyzeReport.h" +#include "worker.h" +#include "malloc_a.h" +#include "lcgamm.h" +#include "pulsefind.h" +#ifdef __arm__ +#include "vector/fp_arm.h" +#endif + +//#define DEBUG_TRIPLET_VERBOSE +//#define DEBUG_PULSE_VERBOSE +//#define DEBUG_PULSE_BOUNDS + + +/********************** + * + * find_triplets - Analyzes the input signal for a triplet signal. + * + * Written by Eric Heien. + */ +int find_triplets( const float *power, int len_power, float triplet_thresh, int time_bin, int freq_bin ) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("find_triplets()"); +#endif + static int *binsAboveThreshold; + int i,n,numBinsAboveThreshold=0,p,q,blksize; + float midpoint,mean_power=0,peak_power,period,total=0.0f,partial; + + if (!binsAboveThreshold) { + binsAboveThreshold=(int *)malloc_a(PoTInfo.TripletMax*sizeof(int),MEM_ALIGN); + if (!binsAboveThreshold) SETIERROR(MALLOC_FAILED, "!binsAboveThreshold"); + } + + /* Get all the bins that are above the threshold, and find the power array mean value */ +#ifdef DEBUG_TRIPLET_VERBOSE + fprintf(stderr, "In find_triplets()... PulsePotLen = %d triplet_thresh = %f TOffset = %d PoT = %d\n", len_power, triplet_thresh, time_bin, freq_bin); +#endif + + blksize = UNSTDMAX(1, UNSTDMIN(pow2((unsigned int) sqrt((float) (len_power / 32)) * 32), 512)); + int b; + for(b=0;b= triplet_thresh ) { + binsAboveThreshold[numBinsAboveThreshold] = i; + numBinsAboveThreshold++; + } + } + analysis_state.FLOP_counter+=10.0+len_power; + + /* Check each bin combination for a triplet */ + if (numBinsAboveThreshold>2) { + for( i=0;i peak_power ) + peak_power = power[binsAboveThreshold[n]]; + + p = binsAboveThreshold[i]; + while( (power[p] >= triplet_thresh) && (p <= (static_cast(floor(midpoint)))) ) { /* Check if there is a pulse "off" in between init and midpoint */ + p++; + } + + q = static_cast(floor(midpoint))+1; + while( (power[q] >= triplet_thresh) && (q <= binsAboveThreshold[n])) { /* Check if there is a pulse "off" in between midpoint and end */ + q++; + } + + if( p >= static_cast(floor(midpoint)) || q >= binsAboveThreshold[n]) { + /* if this pulse doesn't have an "off" between all the three spikes, it's dropped */ + } else if( (midpoint - floor(midpoint)) > 0.1f ) { /* if it's spread among two bins */ + if( power[(int)midpoint] >= triplet_thresh ) { + if( power[(int)midpoint] > peak_power ) + peak_power = power[(int)midpoint]; + + ReportTripletEvent( peak_power/mean_power, mean_power, period, midpoint,time_bin, freq_bin, len_power, power, 1 ); + } + + if( power[(int)(midpoint+1.0f)] >= triplet_thresh ) { + if( power[(int)(midpoint+1.0f)] > peak_power ) + peak_power = power[(int)(midpoint+1.0f)]; + + ReportTripletEvent( peak_power/mean_power, mean_power, period, midpoint,time_bin, freq_bin, len_power, power, 1 ); + } + } else { /* otherwise just check the single midpoint bin */ + if( power[(int)midpoint] >= triplet_thresh ) { + if( power[(int)midpoint] > peak_power ) + peak_power = power[(int)midpoint]; + + ReportTripletEvent( peak_power/mean_power, mean_power, period, midpoint,time_bin, freq_bin, len_power, power, 1 ); + } + } + } + } + } + analysis_state.FLOP_counter+=(10.0*numBinsAboveThreshold*numBinsAboveThreshold); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return (0); +} + + + +/********************** + * + * Pulse finding + * + * + * Default folding subroutines, FPU optimized + * + */ +float sw_sum3_t31(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sw_sum3_t31()"); +#endif + float sum1, sum2, tmax2, tmax1; + int i = P->di; + float *one = ss[0]; + float *two = ss[0]+P->tmp0; + float *three = ss[0]+P->tmp1; + tmax2 = tmax1 = float(0.0); + + if ( i & 1 ) { + i -= 1; + tmax1 = one[i] + two[i]; + tmax1 += three[i]; + P->dest[i] = tmax1; + } + switch (i) { + case 30: + sum1 = one[29] + two[29]; sum2 = one[28] + two[28]; + sum1 += three[29]; sum2 += three[28]; + P->dest[29] = sum1; P->dest[28] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 28: + sum1 = one[27] + two[27]; sum2 = one[26] + two[26]; + sum1 += three[27]; sum2 += three[26]; + P->dest[27] = sum1; P->dest[26] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 26: + sum1 = one[25] + two[25]; sum2 = one[24] + two[24]; + sum1 += three[25]; sum2 += three[24]; + P->dest[25] = sum1; P->dest[24] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 24: + sum1 = one[23] + two[23]; sum2 = one[22] + two[22]; + sum1 += three[23]; sum2 += three[22]; + P->dest[23] = sum1; P->dest[22] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 22: + sum1 = one[21] + two[21]; sum2 = one[20] + two[20]; + sum1 += three[21]; sum2 += three[20]; + P->dest[21] = sum1; P->dest[20] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 20: + sum1 = one[19] + two[19]; sum2 = one[18] + two[18]; + sum1 += three[19]; sum2 += three[18]; + P->dest[19] = sum1; P->dest[18] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 18: + sum1 = one[17] + two[17]; sum2 = one[16] + two[16]; + sum1 += three[17]; sum2 += three[16]; + P->dest[17] = sum1; P->dest[16] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 16: + sum1 = one[15] + two[15]; sum2 = one[14] + two[14]; + sum1 += three[15]; sum2 += three[14]; + P->dest[15] = sum1; P->dest[14] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 14: + sum1 = one[13] + two[13]; sum2 = one[12] + two[12]; + sum1 += three[13]; sum2 += three[12]; + P->dest[13] = sum1; P->dest[12] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 12: + sum1 = one[11] + two[11]; sum2 = one[10] + two[10]; + sum1 += three[11]; sum2 += three[10]; + P->dest[11] = sum1; P->dest[10] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 10: + sum1 = one[9] + two[9]; sum2 = one[8] + two[8]; + sum1 += three[9]; sum2 += three[8]; + P->dest[9] = sum1; P->dest[8] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 8: + sum1 = one[7] + two[7]; sum2 = one[6] + two[6]; + sum1 += three[7]; sum2 += three[6]; + P->dest[7] = sum1; P->dest[6] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 6: + sum1 = one[5] + two[5]; sum2 = one[4] + two[4]; + sum1 += three[5]; sum2 += three[4]; + P->dest[5] = sum1; P->dest[4] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 4: + sum1 = one[3] + two[3]; sum2 = one[2] + two[2]; + sum1 += three[3]; sum2 += three[2]; + P->dest[3] = sum1; P->dest[2] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 2: + sum1 = one[1] + two[1]; sum2 = one[0] + two[0]; + sum1 += three[1]; sum2 += three[0]; + P->dest[1] = sum1; P->dest[0] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (tmax1 > tmax2) return tmax1; + return tmax2; +} +// +// use for higher sum3 folds +// +float top_sum3(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("top_sum3()"); +#endif + float sum1, sum2, tmaxB, tmax; + int i; + float *one = ss[0]; + float *two = ss[0]+P->tmp0; + float *three = ss[0]+P->tmp1; + tmaxB = tmax = float(0.0); + + for (i = 0 ; i < P->di-21; i += 22) { + sum1 = one[i+0] + two[i+0]; sum2 = one[i+1] + two[i+1]; + sum1 += three[i+0]; sum2 += three[i+1]; + P->dest[i+0] = sum1; P->dest[i+1] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+2] + two[i+2]; sum2 = one[i+3] + two[i+3]; + sum1 += three[i+2]; sum2 += three[i+3]; + P->dest[i+2] = sum1; P->dest[i+3] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+4] + two[i+4]; sum2 = one[i+5] + two[i+5]; + sum1 += three[i+4]; sum2 += three[i+5]; + P->dest[i+4] = sum1; P->dest[i+5] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+6] + two[i+6]; sum2 = one[i+7] + two[i+7]; + sum1 += three[i+6]; sum2 += three[i+7]; + P->dest[i+6] = sum1; P->dest[i+7] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+8] + two[i+8]; sum2 = one[i+9] + two[i+9]; + sum1 += three[i+8]; sum2 += three[i+9]; + P->dest[i+8] = sum1; P->dest[i+9] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+10] + two[i+10]; sum2 = one[i+11] + two[i+11]; + sum1 += three[i+10]; sum2 += three[i+11]; + P->dest[i+10] = sum1; P->dest[i+11] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+12] + two[i+12]; sum2 = one[i+13] + two[i+13]; + sum1 += three[i+12]; sum2 += three[i+13]; + P->dest[i+12] = sum1; P->dest[i+13] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+14] + two[i+14]; sum2 = one[i+15] + two[i+15]; + sum1 += three[i+14]; sum2 += three[i+15]; + P->dest[i+14] = sum1; P->dest[i+15] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+16] + two[i+16]; sum2 = one[i+17] + two[i+17]; + sum1 += three[i+16]; sum2 += three[i+17]; + P->dest[i+16] = sum1; P->dest[i+17] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+18] + two[i+18]; sum2 = one[i+19] + two[i+19]; + sum1 += three[i+18]; sum2 += three[i+19]; + P->dest[i+18] = sum1; P->dest[i+19] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+20] + two[i+20]; sum2 = one[i+21] + two[i+21]; + sum1 += three[i+20]; sum2 += three[i+21]; + P->dest[i+20] = sum1; P->dest[i+21] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + } + for ( ; i < P->di; i++) { + sum1 = one[i] + two[i] + three[i]; + P->dest[i] = sum1; + if (sum1 > tmax) tmax = sum1; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (tmax > tmaxB) return tmax; + return tmaxB; +} + +sum_func swi3tb[FOLDTBLEN] = { + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, top_sum3 +}; +// +// +float sw_sum4_t31(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sw_sum4_t31()"); +#endif + float sum1, sum2, tmax2, tmax1; + int i = P->di; + float *one = ss[0]; + float *two = ss[0]+P->tmp0; + float *three = ss[0]+P->tmp1; + float *four = ss[0]+P->tmp2; + tmax2 = tmax1 = float(0.0); + + if ( i & 1 ) { + i -= 1; + tmax1 = one[i] + two[i]; sum2 = three[i] + four[i]; + tmax1 += sum2; + P->dest[i] = tmax1; + } + switch (i) { + case 30: + sum1 = one[29] + two[29]; sum2 = one[28] + two[28]; + sum1 += three[29]; sum2 += three[28]; + sum1 += four[29]; sum2 += four[28]; + P->dest[29] = sum1; P->dest[28] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 28: + sum1 = one[27] + two[27]; sum2 = one[26] + two[26]; + sum1 += three[27]; sum2 += three[26]; + sum1 += four[27]; sum2 += four[26]; + P->dest[27] = sum1; P->dest[26] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 26: + sum1 = one[25] + two[25]; sum2 = one[24] + two[24]; + sum1 += three[25]; sum2 += three[24]; + sum1 += four[25]; sum2 += four[24]; + P->dest[25] = sum1; P->dest[24] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 24: + sum1 = one[23] + two[23]; sum2 = one[22] + two[22]; + sum1 += three[23]; sum2 += three[22]; + sum1 += four[23]; sum2 += four[22]; + P->dest[23] = sum1; P->dest[22] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 22: + sum1 = one[21] + two[21]; sum2 = one[20] + two[20]; + sum1 += three[21]; sum2 += three[20]; + sum1 += four[21]; sum2 += four[20]; + P->dest[21] = sum1; P->dest[20] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 20: + sum1 = one[19] + two[19]; sum2 = one[18] + two[18]; + sum1 += three[19]; sum2 += three[18]; + sum1 += four[19]; sum2 += four[18]; + P->dest[19] = sum1; P->dest[18] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 18: + sum1 = one[17] + two[17]; sum2 = one[16] + two[16]; + sum1 += three[17]; sum2 += three[16]; + sum1 += four[17]; sum2 += four[16]; + P->dest[17] = sum1; P->dest[16] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 16: + sum1 = one[15] + two[15]; sum2 = one[14] + two[14]; + sum1 += three[15]; sum2 += three[14]; + sum1 += four[15]; sum2 += four[14]; + P->dest[15] = sum1; P->dest[14] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 14: + sum1 = one[13] + two[13]; sum2 = one[12] + two[12]; + sum1 += three[13]; sum2 += three[12]; + sum1 += four[13]; sum2 += four[12]; + P->dest[13] = sum1; P->dest[12] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 12: + sum1 = one[11] + two[11]; sum2 = one[10] + two[10]; + sum1 += three[11]; sum2 += three[10]; + sum1 += four[11]; sum2 += four[10]; + P->dest[11] = sum1; P->dest[10] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 10: + sum1 = one[9] + two[9]; sum2 = one[8] + two[8]; + sum1 += three[9]; sum2 += three[8]; + sum1 += four[9]; sum2 += four[8]; + P->dest[9] = sum1; P->dest[8] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 8: + sum1 = one[7] + two[7]; sum2 = one[6] + two[6]; + sum1 += three[7]; sum2 += three[6]; + sum1 += four[7]; sum2 += four[6]; + P->dest[7] = sum1; P->dest[6] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 6: + sum1 = one[5] + two[5]; sum2 = one[4] + two[4]; + sum1 += three[5]; sum2 += three[4]; + sum1 += four[5]; sum2 += four[4]; + P->dest[5] = sum1; P->dest[4] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 4: + sum1 = one[3] + two[3]; sum2 = one[2] + two[2]; + sum1 += three[3]; sum2 += three[2]; + sum1 += four[3]; sum2 += four[2]; + P->dest[3] = sum1; P->dest[2] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 2: + sum1 = one[1] + two[1]; sum2 = one[0] + two[0]; + sum1 += three[1]; sum2 += three[0]; + sum1 += four[1]; sum2 += four[0]; + P->dest[1] = sum1; P->dest[0] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (tmax1 > tmax2) return tmax1; + return tmax2; +} +// +// use for higher sum4 folds +// +float top_sum4(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("top_sum4()"); +#endif + float sum1, sum2, tmaxB, tmax; + int i; + float *one = ss[0]; + float *two = ss[0]+P->tmp0; + float *three = ss[0]+P->tmp1; + float *four = ss[0]+P->tmp2; + tmaxB = tmax = float(0.0); + + for (i = 0 ; i < P->di-15; i += 16) { + sum1 = one[i+0] + two[i+0]; sum2 = one[i+1] + two[i+1]; + sum1 += three[i+0]; sum2 += three[i+1]; + sum1 += four[i+0]; sum2 += four[i+1]; + P->dest[i+0] = sum1; P->dest[i+1] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+2] + two[i+2]; sum2 = one[i+3] + two[i+3]; + sum1 += three[i+2]; sum2 += three[i+3]; + sum1 += four[i+2]; sum2 += four[i+3]; + P->dest[i+2] = sum1; P->dest[i+3] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+4] + two[i+4]; sum2 = one[i+5] + two[i+5]; + sum1 += three[i+4]; sum2 += three[i+5]; + sum1 += four[i+4]; sum2 += four[i+5]; + P->dest[i+4] = sum1; P->dest[i+5] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+6] + two[i+6]; sum2 = one[i+7] + two[i+7]; + sum1 += three[i+6]; sum2 += three[i+7]; + sum1 += four[i+6]; sum2 += four[i+7]; + P->dest[i+6] = sum1; P->dest[i+7] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+8] + two[i+8]; sum2 = one[i+9] + two[i+9]; + sum1 += three[i+8]; sum2 += three[i+9]; + sum1 += four[i+8]; sum2 += four[i+9]; + P->dest[i+8] = sum1; P->dest[i+9] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+10] + two[i+10]; sum2 = one[i+11] + two[i+11]; + sum1 += three[i+10]; sum2 += three[i+11]; + sum1 += four[i+10]; sum2 += four[i+11]; + P->dest[i+10] = sum1; P->dest[i+11] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+12] + two[i+12]; sum2 = one[i+13] + two[i+13]; + sum1 += three[i+12]; sum2 += three[i+13]; + sum1 += four[i+12]; sum2 += four[i+13]; + P->dest[i+12] = sum1; P->dest[i+13] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+14] + two[i+14]; sum2 = one[i+15] + two[i+15]; + sum1 += three[i+14]; sum2 += three[i+15]; + sum1 += four[i+14]; sum2 += four[i+15]; + P->dest[i+14] = sum1; P->dest[i+15] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + } + for ( ; i < P->di; i++) { + sum1 = (one[i] + two[i] ); sum2 = (three[i] + four[i] ); + sum1 += sum2; + P->dest[i] = sum1; + if (sum1 > tmax) tmax = sum1; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (tmax > tmaxB) return tmax; + return tmaxB; +} +// +sum_func swi4tb[FOLDTBLEN] = { + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, top_sum4 +}; +// +// +float sw_sum5_t31(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sw_sum5_t31()"); +#endif + float sum1, sum2, tmax2, tmax1; + int i = P->di; + float *one = ss[0]; + float *two = ss[0]+P->tmp0; + float *three = ss[0]+P->tmp1; + float *four = ss[0]+P->tmp2; + float *five = ss[0]+P->tmp3; + tmax2 = tmax1 = float(0.0); + + if ( i & 1 ) { + i -= 1; + tmax1 = one[i] + two[i]; sum2 = three[i] + four[i]; + tmax1 += five[i]; + tmax1 += sum2; + P->dest[i] = tmax1; + } + switch (i) { + case 30: + sum1 = one[29] + two[29]; sum2 = one[28] + two[28]; + sum1 += three[29]; sum2 += three[28]; + sum1 += four[29]; sum2 += four[28]; + sum1 += five[29]; sum2 += five[28]; + P->dest[29] = sum1; P->dest[28] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 28: + sum1 = one[27] + two[27]; sum2 = one[26] + two[26]; + sum1 += three[27]; sum2 += three[26]; + sum1 += four[27]; sum2 += four[26]; + sum1 += five[27]; sum2 += five[26]; + P->dest[27] = sum1; P->dest[26] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 26: + sum1 = one[25] + two[25]; sum2 = one[24] + two[24]; + sum1 += three[25]; sum2 += three[24]; + sum1 += four[25]; sum2 += four[24]; + sum1 += five[25]; sum2 += five[24]; + P->dest[25] = sum1; P->dest[24] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 24: + sum1 = one[23] + two[23]; sum2 = one[22] + two[22]; + sum1 += three[23]; sum2 += three[22]; + sum1 += four[23]; sum2 += four[22]; + sum1 += five[23]; sum2 += five[22]; + P->dest[23] = sum1; P->dest[22] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 22: + sum1 = one[21] + two[21]; sum2 = one[20] + two[20]; + sum1 += three[21]; sum2 += three[20]; + sum1 += four[21]; sum2 += four[20]; + sum1 += five[21]; sum2 += five[20]; + P->dest[21] = sum1; P->dest[20] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 20: + sum1 = one[19] + two[19]; sum2 = one[18] + two[18]; + sum1 += three[19]; sum2 += three[18]; + sum1 += four[19]; sum2 += four[18]; + sum1 += five[19]; sum2 += five[18]; + P->dest[19] = sum1; P->dest[18] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 18: + sum1 = one[17] + two[17]; sum2 = one[16] + two[16]; + sum1 += three[17]; sum2 += three[16]; + sum1 += four[17]; sum2 += four[16]; + sum1 += five[17]; sum2 += five[16]; + P->dest[17] = sum1; P->dest[16] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 16: + sum1 = one[15] + two[15]; sum2 = one[14] + two[14]; + sum1 += three[15]; sum2 += three[14]; + sum1 += four[15]; sum2 += four[14]; + sum1 += five[15]; sum2 += five[14]; + P->dest[15] = sum1; P->dest[14] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 14: + sum1 = one[13] + two[13]; sum2 = one[12] + two[12]; + sum1 += three[13]; sum2 += three[12]; + sum1 += four[13]; sum2 += four[12]; + sum1 += five[13]; sum2 += five[12]; + P->dest[13] = sum1; P->dest[12] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 12: + sum1 = one[11] + two[11]; sum2 = one[10] + two[10]; + sum1 += three[11]; sum2 += three[10]; + sum1 += four[11]; sum2 += four[10]; + sum1 += five[11]; sum2 += five[10]; + P->dest[11] = sum1; P->dest[10] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 10: + sum1 = one[9] + two[9]; sum2 = one[8] + two[8]; + sum1 += three[9]; sum2 += three[8]; + sum1 += four[9]; sum2 += four[8]; + sum1 += five[9]; sum2 += five[8]; + P->dest[9] = sum1; P->dest[8] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 8: + sum1 = one[7] + two[7]; sum2 = one[6] + two[6]; + sum1 += three[7]; sum2 += three[6]; + sum1 += four[7]; sum2 += four[6]; + sum1 += five[7]; sum2 += five[6]; + P->dest[7] = sum1; P->dest[6] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 6: + sum1 = one[5] + two[5]; sum2 = one[4] + two[4]; + sum1 += three[5]; sum2 += three[4]; + sum1 += four[5]; sum2 += four[4]; + sum1 += five[5]; sum2 += five[4]; + P->dest[5] = sum1; P->dest[4] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 4: + sum1 = one[3] + two[3]; sum2 = one[2] + two[2]; + sum1 += three[3]; sum2 += three[2]; + sum1 += four[3]; sum2 += four[2]; + sum1 += five[3]; sum2 += five[2]; + P->dest[3] = sum1; P->dest[2] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 2: + sum1 = one[1] + two[1]; sum2 = one[0] + two[0]; + sum1 += three[1]; sum2 += three[0]; + sum1 += four[1]; sum2 += four[0]; + sum1 += five[1]; sum2 += five[0]; + P->dest[1] = sum1; P->dest[0] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (tmax1 > tmax2) return tmax1; + return tmax2; +} +// +// use for higher sum5 folds +// +float top_sum5(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("top_sum5()"); +#endif + float sum1, sum2, tmaxB, tmax; + int i; + float *one = ss[0]; + float *two = ss[0]+P->tmp0; + float *three = ss[0]+P->tmp1; + float *four = ss[0]+P->tmp2; + float *five = ss[0]+P->tmp3; + tmaxB = tmax = float(0.0); + + for (i = 0 ; i < P->di-15; i += 16) { + sum1 = one[i+0] + two[i+0]; sum2 = one[i+1] + two[i+1]; + sum1 += three[i+0]; sum2 += three[i+1]; + sum1 += four[i+0]; sum2 += four[i+1]; + sum1 += five[i+0]; sum2 += five[i+1]; + P->dest[i+0] = sum1; P->dest[i+1] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+2] + two[i+2]; sum2 = one[i+3] + two[i+3]; + sum1 += three[i+2]; sum2 += three[i+3]; + sum1 += four[i+2]; sum2 += four[i+3]; + sum1 += five[i+2]; sum2 += five[i+3]; + P->dest[i+2] = sum1; P->dest[i+3] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+4] + two[i+4]; sum2 = one[i+5] + two[i+5]; + sum1 += three[i+4]; sum2 += three[i+5]; + sum1 += four[i+4]; sum2 += four[i+5]; + sum1 += five[i+4]; sum2 += five[i+5]; + P->dest[i+4] = sum1; P->dest[i+5] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+6] + two[i+6]; sum2 = one[i+7] + two[i+7]; + sum1 += three[i+6]; sum2 += three[i+7]; + sum1 += four[i+6]; sum2 += four[i+7]; + sum1 += five[i+6]; sum2 += five[i+7]; + P->dest[i+6] = sum1; P->dest[i+7] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+8] + two[i+8]; sum2 = one[i+9] + two[i+9]; + sum1 += three[i+8]; sum2 += three[i+9]; + sum1 += four[i+8]; sum2 += four[i+9]; + sum1 += five[i+8]; sum2 += five[i+9]; + P->dest[i+8] = sum1; P->dest[i+9] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+10] + two[i+10]; sum2 = one[i+11] + two[i+11]; + sum1 += three[i+10]; sum2 += three[i+11]; + sum1 += four[i+10]; sum2 += four[i+11]; + sum1 += five[i+10]; sum2 += five[i+11]; + P->dest[i+10] = sum1; P->dest[i+11] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+12] + two[i+12]; sum2 = one[i+13] + two[i+13]; + sum1 += three[i+12]; sum2 += three[i+13]; + sum1 += four[i+12]; sum2 += four[i+13]; + sum1 += five[i+12]; sum2 += five[i+13]; + P->dest[i+12] = sum1; P->dest[i+13] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+14] + two[i+14]; sum2 = one[i+15] + two[i+15]; + sum1 += three[i+14]; sum2 += three[i+15]; + sum1 += four[i+14]; sum2 += four[i+15]; + sum1 += five[i+14]; sum2 += five[i+15]; + P->dest[i+14] = sum1; P->dest[i+15] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + } + for ( ; i < P->di; i++) { + sum1 = (one[i] + two[i] ); sum2 = (three[i] + four[i] ); + sum1 += five[i]; + sum1 += sum2; + P->dest[i] = sum1; + if (sum1 > tmax) tmax = sum1; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (tmax > tmaxB) return tmax; + return tmaxB; +} +// +// +sum_func swi5tb[FOLDTBLEN] = { + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, top_sum5 +}; +// +// +float sw_sum2_t31(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sw_sum2_t31"); +#endif + float sum1, sum2, tmax2, tmax1; + int i = P->di; + float *one = ss[1]+P->offset; + float *two = ss[1]+P->tmp0; + tmax2 = tmax1 = float(0.0); + + if ( i & 1 ) { + i -= 1; + tmax1 = one[i] + two[i]; + P->dest[i] = tmax1; + } + switch (i) { + case 30: + sum1 = one[29] + two[29]; sum2 = one[28] + two[28]; + P->dest[29] = sum1; P->dest[28] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 28: + sum1 = one[27] + two[27]; sum2 = one[26] + two[26]; + P->dest[27] = sum1; P->dest[26] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 26: + sum1 = one[25] + two[25]; sum2 = one[24] + two[24]; + P->dest[25] = sum1; P->dest[24] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 24: + sum1 = one[23] + two[23]; sum2 = one[22] + two[22]; + P->dest[23] = sum1; P->dest[22] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 22: + sum1 = one[21] + two[21]; sum2 = one[20] + two[20]; + P->dest[21] = sum1; P->dest[20] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 20: + sum1 = one[19] + two[19]; sum2 = one[18] + two[18]; + P->dest[19] = sum1; P->dest[18] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 18: + sum1 = one[17] + two[17]; sum2 = one[16] + two[16]; + P->dest[17] = sum1; P->dest[16] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 16: + sum1 = one[15] + two[15]; sum2 = one[14] + two[14]; + P->dest[15] = sum1; P->dest[14] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 14: + sum1 = one[13] + two[13]; sum2 = one[12] + two[12]; + P->dest[13] = sum1; P->dest[12] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 12: + sum1 = one[11] + two[11]; sum2 = one[10] + two[10]; + P->dest[11] = sum1; P->dest[10] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 10: + sum1 = one[9] + two[9]; sum2 = one[8] + two[8]; + P->dest[9] = sum1; P->dest[8] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 8: + sum1 = one[7] + two[7]; sum2 = one[6] + two[6]; + P->dest[7] = sum1; P->dest[6] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 6: + sum1 = one[5] + two[5]; sum2 = one[4] + two[4]; + P->dest[5] = sum1; P->dest[4] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 4: + sum1 = one[3] + two[3]; sum2 = one[2] + two[2]; + P->dest[3] = sum1; P->dest[2] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + case 2: + sum1 = one[1] + two[1]; sum2 = one[0] + two[0]; + P->dest[1] = sum1; P->dest[0] = sum2; + if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (tmax1 > tmax2) return tmax1; + return tmax2; +} +// +// use for higher sum2 folds +// +float top_sum2(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("top_sum2()"); +#endif + float sum1, sum2, tmaxB, tmax; + int i; + float *one = ss[1]+P->offset; + float *two = ss[1]+P->tmp0; + tmaxB = tmax = float(0.0); + + for (i = 0 ; i < P->di-21; i += 22) { + sum1 = one[i+0] + two[i+0]; sum2 = one[i+1] + two[i+1]; + P->dest[i+0] = sum1; P->dest[i+1] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+2] + two[i+2]; sum2 = one[i+3] + two[i+3]; + P->dest[i+2] = sum1; P->dest[i+3] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+4] + two[i+4]; sum2 = one[i+5] + two[i+5]; + P->dest[i+4] = sum1; P->dest[i+5] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+6] + two[i+6]; sum2 = one[i+7] + two[i+7]; + P->dest[i+6] = sum1; P->dest[i+7] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+8] + two[i+8]; sum2 = one[i+9] + two[i+9]; + P->dest[i+8] = sum1; P->dest[i+9] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+10] + two[i+10]; sum2 = one[i+11] + two[i+11]; + P->dest[i+10] = sum1; P->dest[i+11] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+12] + two[i+12]; sum2 = one[i+13] + two[i+13]; + P->dest[i+12] = sum1; P->dest[i+13] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+14] + two[i+14]; sum2 = one[i+15] + two[i+15]; + P->dest[i+14] = sum1; P->dest[i+15] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+16] + two[i+16]; sum2 = one[i+17] + two[i+17]; + P->dest[i+16] = sum1; P->dest[i+17] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+18] + two[i+18]; sum2 = one[i+19] + two[i+19]; + P->dest[i+18] = sum1; P->dest[i+19] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + + sum1 = one[i+20] + two[i+20]; sum2 = one[i+21] + two[i+21]; + P->dest[i+20] = sum1; P->dest[i+21] = sum2; + if (sum1 > tmax) tmax = sum1; if (sum2 > tmaxB) tmaxB = sum2; + } + for ( ; i < P->di; i++) { + sum1 = one[i] + two[i]; + P->dest[i] = sum1; + if (sum1 > tmax) tmax = sum1; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + if (tmax > tmaxB) return tmax; + return tmaxB; +} + +sum_func swi2tb[FOLDTBLEN] = { + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, top_sum2 +}; +// +// +FoldSet swifold = {swi3tb, swi4tb, swi5tb, swi2tb, swi2tb, "FPU opt"}; + +// Arrays from which folding subroutines will be chosen during execution. +// Other sets can be inserted to replace the defaults. +// + +sum_func sumsel3[FOLDTBLEN] = { + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, + sw_sum3_t31, sw_sum3_t31, sw_sum3_t31, top_sum3 +}; +sum_func sumsel4[FOLDTBLEN] = { + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, + sw_sum4_t31, sw_sum4_t31, sw_sum4_t31, top_sum4 +}; +sum_func sumsel5[FOLDTBLEN] = { + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, + sw_sum5_t31, sw_sum5_t31, sw_sum5_t31, top_sum5 +}; +sum_func sumsel2[FOLDTBLEN] = { + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, top_sum2 +}; +sum_func sumsel2AL[FOLDTBLEN] = { + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, + sw_sum2_t31, sw_sum2_t31, sw_sum2_t31, top_sum2 +}; + +FoldSet Foldmain = {sumsel3, sumsel4, sumsel5, sumsel2, sumsel2AL, "opt FPU"}; + +/********************** + * + * Routine to copy fold subroutine tables. + * + */ +int CopyFoldSet(FoldSet *dst, FoldSet *src) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("CopyFoldSet()"); +#endif + int i, j3, j4, j5, j2, j2AL; + + j3 = j4 = j5 = j2 = j2AL = 0; + + for (i = 0; i < FOLDTBLEN; i++) { + + if (src->f3[i] != 0) { + dst->f3[i] = src->f3[i]; + j3 = i; + } else dst->f3[i] = src->f3[j3]; + + if (src->f4[i] != 0) { + dst->f4[i] = src->f4[i]; + j4 = i; + } else dst->f4[i] = src->f4[j4]; + + if (src->f5[i] != 0) { + dst->f5[i] = src->f5[i]; + j5 = i; + } else dst->f5[i] = src->f5[j5]; + + if (src->f2[i] != 0) { + dst->f2[i] = src->f2[i]; + j2 = i; + } else dst->f2[i] = src->f2[j2]; + + if (src->f2AL[i] != 0) { + dst->f2AL[i] = src->f2AL[i]; + j2AL = i; + } else dst->f2AL[i] = src->f2AL[j2AL]; + } + dst->name = src->name; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +/********************** + * + * t_funct - Caching routine for calls to invert_lcgf, return cache value if present + * + * This version caches and returns the threshold factor for dis_thresh rather than cur_thresh. + * + * The threshold factor assumes folding subroutines which do NOT divide the sums by num_adds. + */ +float t_funct(int m, int n, int x) { + static struct tftab { + int n; + float y; + } + *t_funct_tab; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("t_funct()"); +#endif + + float c_dis_thresh = (float)swi.analysis_cfg.pulse_display_thresh; + + if (!t_funct_tab) { + int tablen = (PoTInfo.PulseMax+2)/3 + + 3*(int)(log((float)PoTInfo.PulseMax)/log(2.0)-3) - 1; + t_funct_tab=(struct tftab *)malloc_a(tablen*sizeof(struct tftab),MEM_ALIGN); + if (!t_funct_tab) SETIERROR(MALLOC_FAILED, "!t_funct_tab"); + memset(t_funct_tab, 0, tablen*sizeof(struct tftab)); + } + if (t_funct_tab[x].n!=n) { + t_funct_tab[x].n=n; + t_funct_tab[x].y = (invert_lcgf((float)(-PoTInfo.PulseThresh - log((float)m)), + (float)n, (float)1e-4) - n) * c_dis_thresh + n; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return t_funct_tab[x].y; +} + +/********************** + * + * Preplanning routine called from find_pulse() + * + */ +int plan_PulsePoT(PoTPlan * PSeq, int PulsePotLen, float *div, int *dbinoffs) { + float period; + int ndivs; + int i, j, di, dbins, offset; + int num_adds_2; + long p; + unsigned long cperiod; + int num_adds; + register float tmp_max,t1; + int res=1; + int k = 0; // plan index +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("plan_PulsePoT()"); +#endif + + for (i = 32, ndivs = 1; i <= PulsePotLen; ndivs++, i *= 2); + + int32_t thePotLen = PulsePotLen; + + // Periods from PulsePotLen/3 to PulsePotLen/4, and power of 2 fractions of. + // then (len/4 to len/5) and finally (len/5 to len/6) + // + int32_t firstP, lastP; + for(num_adds = 3; num_adds <= 5; num_adds++) { + int num_adds_minus1; + switch(num_adds) { + case 3: lastP = (thePotLen*2)/3; firstP = (thePotLen*1)/2; num_adds_minus1 = 2; break; + case 4: lastP = (thePotLen*3)/4; firstP = (thePotLen*3)/5; num_adds_minus1 = 3; break; + case 5: lastP = (thePotLen*4)/5; firstP = (thePotLen*4)/6; num_adds_minus1 = 4; break; + } + + for (p = lastP ; p > firstP ; p--) { + int tabofst = ndivs*3+2-num_adds; + PSeq[k].dest = div+dbinoffs[0]; // Output storage + PSeq[k].cperiod = cperiod = p*(C3X2TO14 / num_adds_minus1); + PSeq[k].tmp0 = (int)((cperiod+C3X2TO13)/C3X2TO14); + PSeq[k].tmp1 = (int)((cperiod*2+C3X2TO13)/C3X2TO14); + PSeq[k].di = di = (int)cperiod/C3X2TO14; + PSeq[k].na = num_adds; + PSeq[k].thresh = t_funct(di, num_adds, di+tabofst); + + switch(num_adds) { + case 3: + PSeq[k].fun_ptr = (di < FOLDTBLEN) ? sumsel3[di] : sumsel3[FOLDTBLEN-1]; + break; + case 4: + PSeq[k].tmp2 = (int)((cperiod*3+C3X2TO13)/C3X2TO14); + PSeq[k].fun_ptr = (di < FOLDTBLEN) ? sumsel4[di] : sumsel4[FOLDTBLEN-1]; + break; + case 5: + PSeq[k].tmp2 = (int)((cperiod*3+C3X2TO13)/C3X2TO14); + PSeq[k].tmp3 = (int)((cperiod*4+C3X2TO13)/C3X2TO14); + PSeq[k].fun_ptr = (di < FOLDTBLEN) ? sumsel5[di] : sumsel5[FOLDTBLEN-1]; + break; + } + + k++; // next plan + num_adds_2 = 2* num_adds; + + for (j = 1; j < ndivs ; j++) { + tabofst -= 3; + PSeq[k].offset = dbinoffs[j-1]; + PSeq[k].dest = div+dbinoffs[j]; + PSeq[k].cperiod = PSeq[k-1].cperiod/2; + PSeq[k].tmp0 = di & 1; + PSeq[k].di = di = PSeq[k].cperiod/C3X2TO14; + PSeq[k].tmp0 += di + PSeq[k].offset; //PSeq[k].offset + (PSeq[k].cperiod+C3X2TO13)/C3X2TO14 + if (PSeq[k].tmp0 & 3) PSeq[k].fun_ptr = (di < FOLDTBLEN) ? sumsel2[di] : sumsel2[FOLDTBLEN-1]; + else PSeq[k].fun_ptr = (di < FOLDTBLEN) ? sumsel2AL[di] : sumsel2AL[FOLDTBLEN-1]; + PSeq[k].na = num_adds_2; + PSeq[k].thresh = t_funct(di, num_adds_2, di+tabofst); + + k++; // next plan + num_adds_2 *=2; + } // for (j = 1; j < ndivs + } // for (p = lastP + } // for(num_adds = + PSeq[k].di = 0; // stop +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return (k); +} + +/********************** + * + * find_pulse - uses a folding algorithm to find repeating pulses + * Initially folds by prime number then by powers of two. + * + * Initial code by Eric Korpela + * Major revisions and optimization by Ben Herndon + * Further revised by Joe Segur + * + */ +int find_pulse(const float * fp_PulsePot, int PulsePotLen, + float pulse_thresh, int TOffset, int FOffset) { + static float *div,*FoldedPOT; + static int *dbinoffs, PrevPPL, PrevPoTln; + static PoTPlan *PSeq; + static float rcfg_dis_thresh = 1.0f / (float)swi.analysis_cfg.pulse_display_thresh; + PoTPlan PTPln = {0} ; + float *SrcSel[2]; + float period; + int blksize; + int ndivs; + int i, j, di, maxs = 0; + int num_adds, num_adds_2; + long p; + float max=0,maxd=0,avg=0,maxp=0, snr=0, fthresh=0,total=0.0f,partial; + register float tmp_max,t1; + int res=1; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("find_pulse()"); +#endif + + // debug possible heap corruption -- jeffc +#ifdef _WIN32 + BOINCASSERT(_CrtCheckMemory()); +#endif + +#ifdef DEBUG_PULSE_VERBOSE + fprintf(stderr, "In find_pulse()... PulsePotLen = %d pulse_thresh = %f TOffset = %d PoT = %d\n", PulsePotLen, pulse_thresh, TOffset, FOffset); +#endif + + // boinc_worker_timer(); + + // Create internal arrays.... + if (!div) { + int n, maxdivs = 1; + for (i = 32; i <= PoTInfo.PulseMax; maxdivs++, i *= 2); + div=(float *)calloc_a(((PoTInfo.PulseMax*7/4)+maxdivs*MEM_ALIGN/sizeof(float)), sizeof(float), MEM_ALIGN); + FoldedPOT=(float *)malloc_a((PoTInfo.PulseMax+1)*sizeof(float)/3, MEM_ALIGN); + dbinoffs=(int *)malloc_a(maxdivs*sizeof(int), MEM_ALIGN); + for (i = 32, n = 1; i <= PPLANMAX; n++, i *= 2); + i = ((PPLANMAX*2)/3)-((PPLANMAX*2)/4); + i += ((PPLANMAX*3)/4)-((PPLANMAX*3)/5); + i += ((PPLANMAX*4)/5)-((PPLANMAX*4)/6); + i *= n; + PSeq = (PoTPlan *)malloc_a((i+1)*sizeof(PoTPlan), MEM_ALIGN); + if ((!div) || (!FoldedPOT) || (!dbinoffs) || (!PSeq)) + SETIERROR(MALLOC_FAILED, "(!div) || (!FoldedPOT) || (!dbinoffs) || (!PSeq)"); + if (t_funct(6,1000,0)<0) SETIERROR(MALLOC_FAILED, "t_funct(6,1000,0)<0");; + } + + SrcSel[0] = (float *)fp_PulsePot; // source of data for 3, 4, 5 folds + SrcSel[1] = div; // source of data for 2 folds + +/* Uncomment this block if res > 1 is ever actually used + + // Rebin to lower resolution if required + if (res <= 1) { + memcpy(div,fp_PulsePot,PulsePotLen*sizeof(float)); + } else { + for (j=0;jdis_thresh) { + // unscale for reporting + tmp_max /= PSeq[k].na; + cur_thresh = (dis_thresh / PSeq[k].na - avg) * rcfg_dis_thresh + avg; + + ReportPulseEvent(tmp_max/avg,avg,res*(float)PSeq[k].cperiod/(float)C3X2TO14, + TOffset+PulsePotLen/2,FOffset, + (tmp_max-avg)*(float)sqrt((float)PSeq[k].na)/avg, + (cur_thresh-avg)*(float)sqrt((float)PSeq[k].na)/avg, + PSeq[k].dest, PSeq[k].na, 0); + + if ((tmp_max>cur_thresh) && ((t1=tmp_max-cur_thresh)>maxd)) { + maxp = (float)PSeq[k].cperiod/(float)C3X2TO14; + maxd = t1; + maxs = PSeq[k].na; + max = tmp_max; + snr = (float)((tmp_max-avg)*sqrt((float)PSeq[k].na)/avg); + fthresh=(float)((cur_thresh-avg)*sqrt((float)PSeq[k].na)/avg); + memcpy(FoldedPOT, PSeq[k].dest, PSeq[k].di*sizeof(float)); + } + } + } // for ( k = + } + else { // If not plan, + + // Periods from PulsePotLen/3 to PulsePotLen/4, and power of 2 fractions of. + // then (len/4 to len/5) and finally (len/5 to len/6) + // + int32_t firstP, lastP; + for(num_adds = 3; num_adds <= 5; num_adds++) { + int num_adds_minus1; + switch(num_adds) { + case 3: lastP = (thePotLen*2)/3; firstP = (thePotLen*1)/2; num_adds_minus1 = 2; break; + case 4: lastP = (thePotLen*3)/4; firstP = (thePotLen*3)/5; num_adds_minus1 = 3; break; + case 5: lastP = (thePotLen*4)/5; firstP = (thePotLen*4)/6; num_adds_minus1 = 4; break; + } + + for (p = lastP ; p > firstP ; p--) { + float cur_thresh, dis_thresh; + int tabofst, mper, perdiv; + + tabofst = ndivs*3+2-num_adds; + mper = p * (12/num_adds_minus1); + perdiv = num_adds_minus1; + PTPln.tmp0 = (int)((mper + 6)/12); // round(period) + PTPln.tmp1 = (int)((mper * 2 + 6)/12); // round(period*2) + PTPln.di = (int)p/perdiv; // (int)period + PTPln.dest = div+dbinoffs[0]; // Output storage + dis_thresh = t_funct(PTPln.di, num_adds, PTPln.di+tabofst)*avg; + + switch(num_adds) { + case 3: + tmp_max = (PTPln.di < FOLDTBLEN) ? sumsel3[PTPln.di](SrcSel, &PTPln) : sumsel3[FOLDTBLEN-1](SrcSel, &PTPln); + break; + case 4: + PTPln.tmp2 = (int)((mper * 3 + 6)/12); // round(period*3) + tmp_max = (PTPln.di < FOLDTBLEN) ? sumsel4[PTPln.di](SrcSel, &PTPln) : sumsel4[FOLDTBLEN-1](SrcSel, &PTPln); + break; + case 5: + PTPln.tmp2 = (int)((mper * 3 + 6)/12); // round(period*3) + PTPln.tmp3 = (int)((mper * 4 + 6)/12); // round(period*4) + tmp_max = (PTPln.di < FOLDTBLEN) ? sumsel5[PTPln.di](SrcSel, &PTPln) : sumsel5[FOLDTBLEN-1](SrcSel, &PTPln); + break; + } + + if (tmp_max>dis_thresh) { + // unscale for reporting + tmp_max /= num_adds; + cur_thresh = (dis_thresh / num_adds - avg) * rcfg_dis_thresh + avg; + + ReportPulseEvent(tmp_max/avg,avg,((float)p)/(float)perdiv*res, + TOffset+PulsePotLen/2,FOffset, + (tmp_max-avg)*(float)sqrt((float)num_adds)/avg, + (cur_thresh-avg)*(float)sqrt((float)num_adds)/avg, + PTPln.dest, num_adds, 0); + + if ((tmp_max>cur_thresh) && ((t1=tmp_max-cur_thresh)>maxd)) { + maxp = (float)p/(float)perdiv; + maxd = t1; + maxs = num_adds; + max = tmp_max; + snr = (float)((tmp_max-avg)*sqrt((float)num_adds)/avg); + fthresh=(float)((cur_thresh-avg)*sqrt((float)num_adds)/avg); + memcpy(FoldedPOT, PTPln.dest, PTPln.di*sizeof(float)); + } + } + + num_adds_2 = 2* num_adds; + + for (j = 1; j < ndivs ; j++) { + PTPln.offset = dbinoffs[j-1]; + PTPln.dest = div+dbinoffs[j]; + perdiv *=2; + PTPln.tmp0 = PTPln.di & 1; + PTPln.di /= 2; + PTPln.tmp0 += PTPln.di + PTPln.offset; + tabofst -=3; + dis_thresh = t_funct(PTPln.di, num_adds_2, PTPln.di+tabofst) * avg; + + if (PTPln.tmp0 & 3) + tmp_max = (PTPln.di < FOLDTBLEN) ? sumsel2[PTPln.di](SrcSel, &PTPln) : sumsel2[FOLDTBLEN-1](SrcSel, &PTPln); + else + tmp_max = (PTPln.di < FOLDTBLEN) ? sumsel2AL[PTPln.di](SrcSel, &PTPln) : sumsel2AL[FOLDTBLEN-1](SrcSel, &PTPln); + + if (tmp_max>dis_thresh) { + // unscale for reporting + tmp_max /= num_adds_2; + cur_thresh = (dis_thresh / num_adds_2 - avg) * rcfg_dis_thresh + avg; + + ReportPulseEvent(tmp_max/avg,avg,((float)p)/(float)perdiv*res, + TOffset+PulsePotLen/2,FOffset, + (tmp_max-avg)*(float)sqrt((float)num_adds_2)/avg, + (cur_thresh-avg)*(float)sqrt((float)num_adds_2)/avg, + PTPln.dest, num_adds_2, 0); + + if ((tmp_max>cur_thresh) && ((t1=tmp_max-cur_thresh)>maxd)) { + maxp = (float)p/(float)perdiv; + maxd = t1; + maxs = num_adds_2; + max = tmp_max; + snr = (float)((tmp_max-avg)*sqrt((float)num_adds_2)/avg); + fthresh = (float)((cur_thresh-avg)*sqrt((float)num_adds_2)/avg); + memcpy(FoldedPOT, PTPln.dest, PTPln.di*sizeof(float)); + } + } + + num_adds_2 *=2; + } // for (j = 1; j < ndivs + } // for (p = lastP + } // for(num_adds = + } + + analysis_state.FLOP_counter+=(PulsePotLen*0.1818181818182+400.0)*PulsePotLen; + if (maxp!=0) + ReportPulseEvent(max/avg,avg,maxp*res,TOffset+PulsePotLen/2,FOffset, + snr, fthresh, FoldedPOT, maxs, 1); + + // debug possible heap corruption -- jeffc +#ifdef _WIN32 + BOINCASSERT(_CrtCheckMemory()); +#endif + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + diff --git a/client/pulsefind.h b/client/pulsefind.h new file mode 100644 index 0000000..cc4c093 --- /dev/null +++ b/client/pulsefind.h @@ -0,0 +1,96 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: pulsefind.h,v 1.3.2.3 2007/06/08 03:09:45 korpela Exp $ +// +#ifndef _PULSEFIND_H_ +#define _PULSEFIND_H_ + +// constants for integerized period in preplanning +#define C3X2TO14 0xC000 +#define C3X2TO13 0x6000 + +// constant for preplan limit +#define PPLANMAX 511 + +typedef float (*sum_func)( float *[], struct PoTPlan *); + +struct PoTPlan { + int di; // count 0 = done + float *dest; // (destination) + int tmp0; // Tmp0 [+offset for 2sum] + union {int tmp1; int offset; }; // Tmp1 for 3,4,5sum - source offset for 2sum + int tmp2; // Tmp2 + int tmp3; // Tmp3 + sum_func fun_ptr; // pointer to sum routine + unsigned long cperiod; // *0xC000 + float thresh; // invert_lcgf() + int na; // num_adds or num_adds_2 +}; + + +// std::max is SLOW +// - Not really. GCC x64 just generates a "maxsd" instruction for either +// this macro or std::max(). x86 version generates fucomi followed by, +// fcmovbe for either. Oh well, it doesn't hurt anything to use a +// macro. +#define UNSTDMAX(a,b) (((a) > (b)) ? (a) : (b)) + +#define FOLDTBLEN 32 + +struct FoldSet { + sum_func *f3; // to table for fold by 3 + sum_func *f4; // to table for fold by 4 + sum_func *f5; // to table for fold by 5 + sum_func *f2; // to table for fold by 2 + sum_func *f2AL; // to table for fold by 2 needing tmp0 aligned + const char *name; // to string literal name of set +}; + + +// forward declare folding sets + +extern FoldSet vfpFoldMain; // in analyzeFuncs_neon.cpp +extern FoldSet neonFoldMain; // in analyzeFuncs_neon.cpp +extern FoldSet AVXfold_a; // in analyzeFuncs_avx.cpp +extern FoldSet AVXfold_a; // in analyzeFuncs_avx.cpp +extern FoldSet AVXfold_c; // in analyzeFuncs_avx.cpp +extern FoldSet sse_ben_fold; // in analyzeFuncs_sse.cpp +extern FoldSet BHSSEfold; // in analyzeFuncs_sse.cpp +extern FoldSet AKSSEfold; // in analyzeFuncs_sse.cpp +extern FoldSet AKavfold; // in analyzeFuncs_altivec.cpp +extern FoldSet swifold; // in Pulsefind - default set +extern FoldSet Foldmain; // in Pulsefind - used set + +// routines in pulsefind.cpp + +int find_triplets(const float * fp_PulsePot, int PulsePotLen, float triplet_thresh, int TOffset, int ul_PoT); + +int find_pulse(const float * fp_PulsePot, int PulsePotLen, float pulse_thresh, int TOffset, int ul_PoT); + +int CopyFoldSet(FoldSet *dst, FoldSet *src); +#endif diff --git a/client/s_util.cpp b/client/s_util.cpp new file mode 100644 index 0000000..640e4bb --- /dev/null +++ b/client/s_util.cpp @@ -0,0 +1,318 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// util.C +// +// $Id: s_util.cpp,v 1.10.2.4 2006/12/14 22:21:47 korpela Exp $ +// + +#include "sah_config.h" + +#include +#include +#include +#include +#include +#include +#include +#include "diagnostics.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_SIGNAL_H +#include +#endif + +#include "timecvt.h" +#include "util.h" +#include "s_util.h" + +const char * const seti_error::message[]={ + "Success", + "Can't create file -- disk full?", + "Can't read from file", + "Can't write to file -- disk full?", + "Can't allocate memory", + "Can't open file", + "Bad workunit header", + "Garbled encoded workunit", + "Garbled binary workunit", + "result_overflow", + "Unhandled signal", + "atexit() failure", + "Vectorized functions unsupported", + "Floating point failure" +}; + +void seti_error::print() const { + std::cerr << "SETI@home error " << -value << " " ; + if ((value <= atexit_failure) && (value >=0)) { + std::cerr << message[value] ; + } else { + std::cerr << "Unknown error" ; + } + + std::cerr << std::endl << data << std::endl; + std::cerr << "File: " << file << std::endl; + std::cerr << "Line: " << line << std::endl; + std::cerr << std::endl; +#ifdef USE_MANUAL_CALLSTACK + call_stack.print_stack(); +#endif +} + +void strip_cr(char*p ) { + char* q = strchr(p, '\n'); + if (q) *q = 0; +} + +// Encode a range of bytes into printable chars, and write to file. +// Encodes 3 bytes into 4 chars. +// May read up to two bytes past end. + +void encode(unsigned char* bin, int nbytes, FILE* f) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("encode()"); +#endif + int count=0, offset=0, nleft; + unsigned char c0, c1, c2, c3; + for (nleft = nbytes; nleft > 0; nleft -= 3) { + c0 = bin[offset]&0x3f; // 6 + c1 = (bin[offset]>>6) | (bin[offset+1]<<2)&0x3f; // 2+4 + c2 = ((bin[offset+1]>>4)&0xf) | (bin[offset+2]<<4)&0x3f;// 4+2 + c3 = bin[offset+2]>>2; // 6 + c0 += 0x20; + c1 += 0x20; + c2 += 0x20; + c3 += 0x20; + fprintf(f, "%c%c%c%c", c0, c1, c2, c3); + offset += 3; + count += 4; + if (count == 64) { + count = 0; + fprintf(f, "\n"); + } + } + fprintf(f, "\n"); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +// Read from file, decode into bytes, put in array. +// May write up to two bytes past end of array. +int decode(unsigned char* bin, int nbytes, FILE* f) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("decode()"); +#endif + unsigned char buf[256], *p, c0, c1, c2; + int i, n, m, nleft = nbytes, offset=0; + int nbadlines = 0; + while (1) { + if (nleft <= 0) break; + p = (unsigned char*)fgets((char*)buf, 256, f); + if (!p) { + SETIERROR(BAD_DECODE, "file ended too soon"); + } + n = (int)strlen((char*)buf)-1; + if (n%4) { + nbadlines++; + if (nbadlines == 100) { + SETIERROR(BAD_DECODE, "too many bad lines - rejecting file"); + } + n = 64; + fprintf(stderr, "encoded line has bad length: %s\n", buf); + } + m = (n/4)*3; + if (m > nleft+2) { + //fprintf(stderr, "encoded line too long\n"); + //return BAD_DECODE; + n = ((nleft+2)/3)*4; + } + p = buf; + for (i=0; i>2 | p[2]<<4; // 4 + 4 + c2 = p[2]>>4 | p[3]<<2; // 2 + 6 + p += 4; + bin[offset++] = c0; + bin[offset++] = c1; + bin[offset++] = c2; + nleft -= 3; + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +// Read from file, put in array. +int read_bin_data(unsigned char* bin, int nbytes, FILE* f) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("read_bin_data()"); +#endif + int i; + size_t n; + + for(i=0; i < nbytes; i += 256) { + n = fread((void *)(bin+i), 256, 1, f); + if (!n) { + SETIERROR(BAD_BIN_READ,"file ended too soon"); + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +// see the doc on binary data representation + +void bits_to_floats(unsigned char* raw, sah_complex* data, int nsamples, int bits_per_sample) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("bits_to_floats"); +#endif + int i, j, k=0; + unsigned char c; + const float v2[2]={-1.0,1.0}; + const float v4[4]={-3.3358750,-1.0,1.0,3.3358750}; + switch (bits_per_sample) { + case 2: + for (i=0; i>1)&1]; + data[k][1] = v2[(c&1)]; + k++; + c >>= 2; + } + } + break; + case 4: + for (i=0; i>2)&3]; + data[k][1] = v4[c&3]; + k++; + c >>= 4; + } + } + break; + case 8: + for (i=0; i((c>>4)&15)-7.5f; + data[k][1] = static_cast(c&15)-7.5f; + k++; + } + break; + case 16: + for (i=0; i(sc); + sc = raw[i]; + data[k][1] = static_cast(sc); + k++; + } + break; + default: + fprintf(stderr,"Unsupported bit depth (%d)\n",bits_per_sample); + throw BAD_DECODE; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +int float_to_uchar(float float_element[], unsigned char char_element[], + long num_elements, float scale_factor) { + long i, test_int; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("float_to_uchar()"); +#endif + + for(i = 0; i < num_elements; i++) { + test_int = ROUND(float_element[i]/scale_factor); + if(test_int >= 0 && test_int <= 255) + char_element[i] = (unsigned)test_int; + else + char_element[i] = test_int < 0 ? 0 : 255; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +char* error_string(int e) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("error_string()"); +#endif + char* p; + static char buf[256]; + + switch(e) { + case CANT_CREATE_FILE: + sprintf(buf, "Can't create file - disk full?"); + p = buf; + break; + case WRITE_FAILED: p = "Can't write to file - disk full?"; break; + case MALLOC_FAILED: p = "Can't allocate memory"; break; + case FOPEN_FAILED: + sprintf(buf, "Can't open file"); + p = buf; + break; + case BAD_HEADER: p = "Bad file header"; break; + case BAD_DECODE: p = "Can't decode data"; break; + + default: sprintf(buf, "Unknown error %d", e); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return buf; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return p; +} + diff --git a/client/s_util.h b/client/s_util.h new file mode 100644 index 0000000..c21ffae --- /dev/null +++ b/client/s_util.h @@ -0,0 +1,155 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: s_util.h,v 1.12.2.10 2006/09/07 00:26:51 korpela Exp $ +#ifndef _UTIL_H +#define _UTIL_H + +#include +#include +#include +#include "track_mem.h" + +typedef float sah_complex[2]; + +// The following is a complete list of #defines used in the code: +// TEXT_UI +// textual UI using printf, scanf +// NOTE: the above are not mutually exclusive +// _WIN32 +// windows environment. does not imply GUI +// _WIN_NT_98 +// Win NT or 98 environment +// TEST_VERSION +// include extra command-line options +// HAVE_* +// (POSIX only) presence or absence of functions, .h files +// as generated by configure script + +// client file names +#define OUTFILE_FILENAME "result.sah" +#define STATE_FILENAME "state.sah" +#define WU_FILENAME "work_unit.sah" +#define CFFT_FILENAME "cfft.sah" + +#define INF 0x7fffffff +#define ROUND(a) ((a) - (long)(a) > .5 ? (long)(a) + 1 : (long)(a)) + +#define TASK_SETI 2 + +class seti_error { + public: + typedef enum { + success=0, + cant_create_file, + read_failed, + write_failed, + malloc_failed, + fopen_failed, + bad_header, + bad_decode, + bad_bin_read, + result_overflow, + unhandled_signal, + atexit_failure, + unsupported_function, + floating_point_fail, + } errors; + static const char * const message[]; + seti_error(int e, const char *s=0) : value(-e), data(s) {}; + seti_error(int e, const char *f, int l, const char *s=0) : value(-e), file(f), line(l), data(s) {}; + seti_error(const seti_error &e) : value(e.value), file(e.file), line(e.line), data(e.data) {}; + operator int() const { return -value; }; + void print() const; + private: + int value; + std::string file; + int line; + std::string data; +}; + + + +// error codes +#define SUCCESS 0 +#define CANT_CREATE_FILE (-seti_error::cant_create_file) +#define READ_FAILED (-seti_error::read_failed) +#define WRITE_FAILED (-seti_error::write_failed) +#define MALLOC_FAILED (-seti_error::malloc_failed) +#define FOPEN_FAILED (-seti_error::fopen_failed) +#define BAD_HEADER (-seti_error::bad_header) +#define BAD_DECODE (-seti_error::bad_decode) +#define BAD_BIN_READ (-seti_error::bad_bin_read) +#define RESULT_OVERFLOW (-seti_error::result_overflow) +#define UNHANDLED_SIGNAL (-seti_error::unhandled_signal) +#define UNSUPPORTED_FUNCTION (-seti_error::unsupported_function) +#define FP_ERROR (-seti_error::floating_point_fail) +#define ATEXIT_FAILURE (-seti_error::atexit_failure) + +#ifdef HAVE_MALLOC_H +#include +#endif +#ifdef HAVE_MEMORY_H +#include +#endif +#ifdef HAVE_ALLOCA_H +#include +#endif + +// The MS & intel compilers don't allow alloca in try/catch blocks +#ifndef FORCE_FRAME_POINTER +#if ( defined(HAVE_ALLOCA) || defined(HAVE_ALLOCA_H) || defined(_WIN32) ) && !( defined(__INTEL_COMPILER) || defined (_MSC_VER) ) +#define FORCE_FRAME_POINTER alloca(16) +#else +#define FORCE_FRAME_POINTER (0) +#endif +#endif + + +// macro so we can get file and line info. +#define SETIERROR( err, errmsg ) do { \ + FORCE_FRAME_POINTER; \ + throw seti_error( err, __FILE__, __LINE__, errmsg ); \ +} while (0) + +#define CHECKPOINT_SKIPPED (0) + +//#include "seti_header.h" + +extern void strip_cr(char*p ); + +extern void encode(unsigned char* bin, int nbytes, FILE* f); +extern int decode(unsigned char* bin, int nbytes, FILE* f); +extern int read_bin_data(unsigned char* bin, int nbytes, FILE* f); +extern void bits_to_floats(unsigned char* raw, sah_complex *data, int nsamples, int bits_per_sample=2); +extern int float_to_uchar( + float float_element[], unsigned char char_element[], + long num_elements, float scale_factor + ); +extern char* error_string(int); + +#endif diff --git a/client/sah_gfx.cpp b/client/sah_gfx.cpp new file mode 100644 index 0000000..93b0fa1 --- /dev/null +++ b/client/sah_gfx.cpp @@ -0,0 +1,863 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// Copyright 2003 Regents of the University of California + + +// Here's a summary of the various functions for initializing graphics +// and responding to user preferences changes: +// +// SAH_GRAPHICS::worker_thread_init() +// (called from worker thread once, at start) +// +// SAH_GRAPHICS_BASE::worker_thread_init +// set prefs to defaults +// parse_project_prefs() (from data already in mem) +// initialize graph buffers +// +// app_graphics_thread_init +// (called from SetMode when create window) +// +// SAH_GRAPHICS::graphics_thread_init() +// SAH_GRAPHICS_BASE::graphics_thread_init() +// init_camera() +// init_lights() +// app_resize(); +// setup_given_prefs() +// +// app_graphics_reread_prefs +// (called from event loop when get REREAD_PREFS msg +// and we have an open window) +// +// SAH_GRAPHICS::reread_prefs() +// SAH_GRAPHICS_BASE::reread_prefs() +// boinc_parse_init_data_file() +// boinc_get_init_data() +// parse_project_prefs() +// setup_given_prefs() +// +// SAH_GRAPHICS::setup_given_prefs() +// SAH_GRAPHICS_BASE::setup_given_prefs() +// init starfield +// init logos +// initialize graph, progress bar structures + +#include "sah_config.h" + +#ifdef _WIN32 +#include "boinc_win.h" +#include // Header File For The OpenGL32 Library +#include // Header File For The GLu32 Library +#if !defined(__MINGW32__) && !defined(_MSC_VER) + #include // Header File For The Glaux Library +#endif +#if defined(HAVE_GLUT_H) +#include +#elif defined(HAVE_GL_GLUT_H) +#include +#elif defined(HAVE_FREEGLUT_H) +#include +#elif defined(HAVE_GL_FREEGLUT_H) +#include +#else +#include +#endif +#endif + +#ifndef _WIN32 +#include +#include +#include +#include + +#ifdef __APPLE_CC__ +#include +#include +#include +#include +#include +#include +#include +#endif + +#ifdef HAVE_GL_H +#include "gl.h" +#elif defined(HAVE_GL_GL_H) +#include +#elif defined(HAVE_OPENGL_GL_H) +#include +#endif + +#ifdef HAVE_GLU_H +#include "glu.h" +#elif defined(HAVE_GL_GLU_H) +#include +#elif defined(HAVE_OPENGL_GLU_H) +#include +#endif + +#ifdef HAVE_GLUT_H +#include "glut.h" +#elif defined(HAVE_GL_GLUT_H) +#include +#elif defined(HAVE_OPENGL_GLUT_H) +#include +#elif defined(HAVE_GLUT_GLUT_H) +#include +#endif +#endif + +#include "util.h" +#include "str_util.h" +#include "str_replace.h" +#include "boinc_api.h" +#include "graphics2.h" +#include "gutil.h" +#include "timecvt.h" +#include "sah_gfx.h" + +bool mouse_down = false; +int mouse_x, mouse_y; + +static void ra_string(float x, char* p) { + int hr = (int) x; + float fmin = x-hr; + int min = (int)(fmin*60); + float fsec = fmin*60 - min; + int sec = (int)(fsec*60); + sprintf(p, "%2d hr %2d' %2d\" RA", hr, min, sec); +} + +static void dec_string(float x, char* p) { + int deg = (int) x; + float fmin = x-deg; + int min = (int)(fmin*60); + float fsec = fmin*60 - min; + int sec = (int)(fsec*60); + sprintf(p, "%s%d deg %2d' %2d\" Dec", (x<0?"-":"+"), deg, abs(min), abs(sec)); +} + +void SAH_GRAPHICS::init_text_panels() { + float pos[3], size[2]; + COLOR color; + double dtheta; + double char_height = 0.15; + double line_width = 2.0; + double line_spacing = 0.3; + double margin = 0.2; + color.a = graph_alpha; + double lum = .6; + double sat = .9; + + double hue = start_hue + hue_change*.33; + HLStoRGB(hue, lum, sat, color); + + pos[0] = -1; + pos[1] = -1; + pos[2] = -2; + size[0] = 4.9; + size[1] = 3.; + dtheta = .3; + text_panels[0].init( + pos, size, color, dtheta, char_height, line_width, line_spacing, margin + ); + + hue = start_hue + hue_change*.66; + if (hue > 1) hue -= 1; + if (hue < 1) hue += 1; + HLStoRGB(hue, lum, sat, color); + pos[0] = -3; + pos[1] = 0; + pos[2] = -1.8; + dtheta = -.6; + text_panels[1].init( + pos, size, color, dtheta, char_height, line_width, line_spacing, margin + ); +} + +void SAH_GRAPHICS::get_data_info_string(char* buf) { + char ra_buf[256], dec_buf[256]; + static const char *locations[]= { + "Arecibo 403MHz Line Feed", + "Arecibo 1.42GHz Flat Feed", + "Arecibo 1.42GHz Gregorian Feed", + "Unknown" + }; + int s4_id=3; + + if (gdata->ready) { + s4_id = gdata->wu.s4_id; + // starting after the 3rd receiver_cfg entry, the long form + // name appears in receiver_cfg->name + if (s4_id>2) { + if (strlen(gdata->wu.receiver_name)==0) { + locations[0]="SETI@home Multi-Beam"; + } else { + locations[0]=gdata->wu.receiver_name; + } + s4_id=0; + } + ra_string(gdata->wu.start_ra, ra_buf); + dec_string(gdata->wu.start_dec, dec_buf); + sprintf(buf, "From: %s, %s\n" + "Recorded on: %s\n" + "Recorded at: %s\n" + "Base frequency: %.9f GHz", + ra_buf, dec_buf, + short_jd_string(gdata->wu.time_recorded), + locations[s4_id], + gdata->wu.subband_base/1e9 + ); + } else { + strcpy( buf, "" ); + } +} + +void SAH_GRAPHICS::get_user_info_string(char* buf) { + sprintf( buf, + "Name: %s\n" + "Team: %s\n" + "Total credit: %.2f\n", + app_init_data.user_name, + app_init_data.team_name, + app_init_data.user_total_credit + ); +} + +void SAH_GRAPHICS::get_analysis_info_string(char* buf) { + if (gdata->ready) { + sprintf(buf, + "%s\n" + "Doppler drift rate %6.4f Hz/sec Resolution %5.3f Hz\n", + gdata->status, + gdata->fft_info.chirp_rate, gdata->wu.subband_sample_rate/gdata->fft_info.fft_len + ); + } else { + strcpy( buf, "" ); + } +} + +// decide what type of signal to display. +// If there's anything new (dirty) display it. +// Otherwise cycle through the types +// +int SAH_GRAPHICS::choose_signal_to_display(double time_of_day) { + int choices[3], nchoices; + + if (gdata->gi.dirty) { + gdata->gi.dirty = false; + return 0; + } else if (gdata->pi.dirty) { + gdata->pi.dirty = false; + return 1; + } else if (gdata->ti.dirty) { + gdata->ti.dirty = false; + return 2; + } else { + nchoices = 0; + if (gdata->gi.peak_power) { + choices[nchoices++] = 0; + } + if (gdata->pi.peak_power) { + choices[nchoices++] = 1; + } + if (gdata->ti.peak_power) { + choices[nchoices++] = 2; + } + if (nchoices == 0) return -1; + if (nchoices == 1) return choices[0]; + int i = (int)fmod(time_of_day/5., (double)nchoices); // rotate every 5 seconds + return choices[i]; + } +} + +void SAH_GRAPHICS::render_pillars(double time_of_day, double dt) { + int i; + float pos[3]; + double cur_cpu_time; + double max = 0, d; + float pulseData[PULSE_POT_LEN]; + float tripletData[TRIPLET_POT_LEN]; + float gaussFunc[GAUSS_POT_LEN]; + char buf[512],time_buf[256]; + const char *TitleText="SETI@home 8"; + + + int s4_id=3; + + if (gdata && gdata->ready) { + s4_id=gdata->wu.s4_id; + if ((s4_id > 2) && (s4_id < 17)) { + TitleText="SETI@home Version 8"; + } else if (s4_id >= 17) { + time_t t=time(0); + struct tm *tm=localtime(&t); + if (tm->tm_year >= 116) { + TitleText="SETI@home/Breakthrough!"; + } else { + TitleText="SETI@home Version 8"; + } + } + } + + draw_pillars(); + + // draw User and Data text + // + mode_lines(); + + glColor3f(1., 1., 1.); // white text + pos[0] = 2; + pos[1] = 2.15; + pos[2] = 0; + draw_text_line(pos, 0.2, 2.0, "Data info"); + pos[0] = 1.2; + pos[1] -= 0.2; + + get_data_info_string(buf); + + draw_text(pos, 0.1, 1.0, 0.15, buf ); + pos[0] = 2; + pos[1] = .8; + draw_text_line(pos, 0.2, 2.0, "User info"); + pos[0] = 1.2; + pos[1] -= .2; + + get_user_info_string(buf); + draw_text(pos, 0.1, 1.0, 0.15, buf); + pos[0] = -2.75; + pos[1] = 2.15; + draw_text_line(pos, 0.2, 2.0, TitleText); + pos[0] = -3.5; + pos[1] = 1.9; + + get_analysis_info_string(buf); + draw_text(pos, 0.1, 1.0, 0.15, buf); + + // draw CPU time and progress bars + // + pos[1] = 0.3; + cur_cpu_time=gdata->cpu_time; + ndays_to_string(cur_cpu_time/SECONDS_PER_DAY, 0, time_buf ); + sprintf(buf, "Overall %.3f%% done CPU time: %s", floor(gdata->progress*100000)/1000, time_buf); + draw_text_line(pos, 0.1, 1.0, buf); + mode_unshaded(); + + inner_progress.draw(gdata->local_progress); + outer_progress.draw(gdata->progress); + + // draw current or best signal + // + + if (!gdata->ready) return; + glColor3f(1., 1., 1.); + mode_unshaded(); + + pos[0] = -3.5; + pos[1] = 1.6; + pos[2] = 0.; + + switch (choose_signal_to_display(time_of_day)) { + case 0: + if (gdata->gi.peak_power) { + sprintf( buf, "%sGaussian: power %5.2f, fit %5.3f, score %5.3f", + gdata->gi.is_best?"Best ":"New ", + gdata->gi.peak_power, gdata->gi.chisqr, gdata->gi.score ); + draw_text(pos, 0.1, 1.0, 0.15, buf); + + for (i=0;igi.pot[i] > max) max = gdata->gi.pot[i]; + } + for (i=0;igi.fft_ind)/gdata->gi.sigma; + gaussFunc[i] = (gdata->gi.mean_power + gdata->gi.peak_power*exp(-d*d*0.693))/max; + } + rnd_graph.draw(gdata->gi.pot, GAUSS_POT_LEN); + sin_graph.draw(gaussFunc, GAUSS_POT_LEN); + } + break; + case 1: + if (gdata->pi.peak_power) { + sprintf( buf, "%sPulse: power %5.2f, period %6.4f, score %5.2f", + gdata->pi.is_best?"Best ":"New ", + gdata->pi.peak_power, gdata->pi.period, gdata->pi.score ); + draw_text(pos, 0.1, 1.0, 0.15, buf); + + for (i=0;ipi.pot_max[i]/255.0; + } + rnd_graph.draw(pulseData, PULSE_POT_LEN); + } + break; + case 2: + if (gdata->ti.peak_power) { + sprintf( + buf, "%sTriplet: power %5.2f, period %6.4f", + gdata->ti.is_best?"Best ":"New ", + gdata->ti.peak_power, gdata->ti.period + ); + draw_text(pos, 0.1, 1.0, 0.15, buf); + for (i=0;iti.pot_max[i]/255.0; + } + rnd_graph.add_tick(gdata->ti.tpotind0_0, 0); + rnd_graph.add_tick(gdata->ti.tpotind1_0, 1); + rnd_graph.add_tick(gdata->ti.tpotind2_0, 2); + rnd_graph.draw(tripletData, TRIPLET_POT_LEN, true); + } + break; + } +} +extern float* white; +void SAH_GRAPHICS::render_headsup(double time_of_day, double dt) { + double cur_cpu_time; + COLOR color; + color.a = .7; + double lum = .5; + double sat = .5; + double hue = start_hue + hue_change/2.; + if (hue > 1) hue -= 1; + if (hue < 1) hue += 1; + HLStoRGB(hue, lum, sat, color); + + mode_ortho(); + GLfloat char_height = 0.015; + GLfloat line_width = 0.25; + GLfloat line_spacing = 0.03; + GLfloat margin = 0.2; + char buf[512], time_buf[256]; + + float pos[3] = {0, 0.7, 1.0}; + + mode_unshaded(); + + //float pos1[3] = {.03,.94,1.0}; + //float pos2[3] = {.97,.94,1.0}; + float pos1[3] = {0, .62, 1.0}; + float pos2[3] = {1, .71, 1.0}; + + get_analysis_info_string(buf); + draw_text(pos1, char_height, line_width, line_spacing, buf); + + get_user_info_string(buf); + get_data_info_string(time_buf); + strcat(buf, time_buf); + draw_text_right(pos2, char_height, line_width, line_spacing, buf); + + cur_cpu_time=gdata->cpu_time; + ndays_to_string(cur_cpu_time/SECONDS_PER_DAY, 0, time_buf ); + sprintf(buf, "Overall %.3f%% done CPU time: %s", floor(gdata->progress*100000)/1000, time_buf); + draw_text(pos, char_height, line_width, line_spacing, buf); + + outer_progress_2d.draw(gdata->progress); + glColor4f(1,1,1,1); + + if (gdata->ready) { + double max = 0, d; + float pulseData[PULSE_POT_LEN]; + float tripletData[TRIPLET_POT_LEN]; + float gaussFunc[GAUSS_POT_LEN]; + char buf[256]; + int choice; + int i; + + choice = choose_signal_to_display(time_of_day); + pos[1]=.47; + switch (choice) { + case 0: + if (gdata->gi.peak_power) { + sprintf( buf, "%sGaussian: power %5.2f, fit %5.3f, score %5.3f", + gdata->gi.is_best?"Best ":"", + gdata->gi.peak_power, gdata->gi.chisqr, gdata->gi.score ); + draw_text(pos, char_height, line_width, line_spacing, buf); + + for (i=0;igi.pot[i] > max) max = gdata->gi.pot[i]; + } + for (i=0;igi.fft_ind)/gdata->gi.sigma; + gaussFunc[i] = (gdata->gi.mean_power + gdata->gi.peak_power*exp(-d*d*0.693))/max; + } + sin_graph.draw(gaussFunc, GAUSS_POT_LEN); + rnd_graph.draw(gdata->gi.pot, GAUSS_POT_LEN); + } + break; + case 1: + if (gdata->pi.peak_power) { + sprintf( + buf, "%sPulse: power %5.2f, period %6.4f, score %5.2f", + gdata->pi.is_best?"Best ":"", + gdata->pi.peak_power, gdata->pi.period, gdata->pi.score + ); + draw_text(pos, char_height, line_width, line_spacing, buf); + + for (i=0;ipi.pot_max[i]/255.0; + } + rnd_graph.draw(pulseData, PULSE_POT_LEN); + } + break; + case 2: + if (gdata->ti.peak_power) { + sprintf( + buf, "Best Triplet: power %5.2f, period %6.4f", + gdata->ti.peak_power, gdata->ti.period + ); + draw_text(pos, char_height, line_width, line_spacing, buf); + for (i=0;iti.pot_max[i]/255.0; + } + rnd_graph.add_tick(gdata->ti.tpotind0_0, 1 ); + rnd_graph.add_tick(gdata->ti.tpotind1_0, 1 ); + rnd_graph.add_tick(gdata->ti.tpotind2_0, 1 ); + rnd_graph.draw(tripletData, TRIPLET_POT_LEN); + } + break; + } + } + + ortho_done(); +} + +void SAH_GRAPHICS::render_panels(double time_of_day, double dt) { + double cur_cpu_time; + char buf[512],time_buf[256]; + + float pos[3] = {0., 0., 0.}; + int i; + MOVING_TEXT_PANEL tp[2]; + + get_user_info_string(buf); + get_data_info_string(time_buf); + strcat(buf, time_buf); + text_panels[0].set_text(0, buf); + + get_analysis_info_string(buf); + text_panels[1].set_text(0, buf); + + cur_cpu_time=gdata->cpu_time; + ndays_to_string(cur_cpu_time/SECONDS_PER_DAY, 0, time_buf ); + sprintf(buf, "Overall %.3f%% done CPU time: %s", floor(gdata->progress*100000)/1000, time_buf); + text_panels[1].set_text(6, buf); + + text_panels[1].get_pos(8, pos); + pos[2]+=.01; + outer_progress_2d.set_pos(pos); + + pos[0] = 0.03; + pos[1] = 0.76; + pos[2] = 0; + + mode_unshaded(); + + outer_progress_2d.draw(gdata->progress); + glColor4f(1,1,1,1); + + if (gdata->ready) { + double max = 0, d; + float pulseData[PULSE_POT_LEN]; + float tripletData[TRIPLET_POT_LEN]; + //float pos[3] = {.03, .94-(2.*line_spacing), 0.}; + float gaussFunc[GAUSS_POT_LEN]; + char buf[256]; + int choice; + int i; + + choice = choose_signal_to_display(time_of_day); + strcpy(buf, ""); + switch (choice) { + case 0: + if (gdata->gi.peak_power) { + sprintf( buf, "%sGaussian: power %5.2f, fit %5.3f, score %5.3f", + gdata->gi.is_best?"Best ":"", + gdata->gi.peak_power, gdata->gi.chisqr, gdata->gi.score + ); + + for (i=0;igi.pot[i] > max) max = gdata->gi.pot[i]; + } + for (i=0;igi.fft_ind)/gdata->gi.sigma; + gaussFunc[i] = (gdata->gi.mean_power + gdata->gi.peak_power*exp(-d*d*0.693))/max; + } + + text_panels[1].get_pos(4, pos); + rnd_graph.set_pos(pos); + text_panels[1].get_pos(4, pos); + pos[2] -= -.01; + sin_graph.set_pos(pos); + sin_graph.draw(gaussFunc, GAUSS_POT_LEN); + rnd_graph.draw(gdata->gi.pot, GAUSS_POT_LEN); + } + break; + case 1: + if (gdata->pi.peak_power) { + sprintf( buf, "%sPulse: peak_power %5.2f, period %6.4f, score %5.2f", + gdata->pi.is_best?"Best ":"", + gdata->pi.peak_power, gdata->pi.period, gdata->pi.score + ); + + for (i=0;ipi.pot_max[i]/255.0; + } + + text_panels[1].get_pos(4, pos); + rnd_graph.set_pos(pos); + rnd_graph.draw(pulseData, PULSE_POT_LEN); + } + break; + case 2: + if (gdata->ti.peak_power) { + sprintf( + buf, "Best Triplet: power %5.2f, period %6.4f", + gdata->ti.peak_power, gdata->ti.period + ); + for (i=0;iti.pot_max[i]/255.0; + } + + text_panels[1].get_pos(4, pos); + rnd_graph.set_pos(pos); + + rnd_graph.add_tick(gdata->ti.tpotind0_0, 0); + rnd_graph.add_tick(gdata->ti.tpotind1_0, 1); + rnd_graph.add_tick(gdata->ti.tpotind2_0, 2); + rnd_graph.draw(tripletData, TRIPLET_POT_LEN); + } + break; + } + text_panels[1].set_text(5, buf); + } + for (i=0; i<2; i++) { + tp[i] = text_panels[i]; + } + + MOVING_TEXT_PANEL::sort(tp, 2); + for (i=0; i<2; i++) { + tp[i].draw(); + } + for (i=0; i<2; i++) { + text_panels[i].move(dt); + } + +} + +void app_graphics_render(int x, int y, double t) { + sah_graphics.render(x, y, t); +} + +void app_graphics_init() { + sah_graphics.graphics_thread_init(); +} + +void SAH_GRAPHICS::data_struct_init() { + SAH_GRAPHICS_BASE::data_struct_init(); +} + +// Name is misleading - this gets called each time the app switches mode +// +void SAH_GRAPHICS::graphics_thread_init() { + SAH_GRAPHICS_BASE::graphics_thread_init(); + setup_given_prefs(); +} + +void SAH_GRAPHICS::setup_given_prefs() { + float pos[3], size[3]; + float outer[] = {1.0, 0., 0.2, 0.4}; + float inner[] = {0.2, 0.0, 0.7, 0.9}; + + float red[] = {1., 0., 0., 1.}; + float green[] = {0., 1., 0., 1.}; + float white[] = {1., 1., 1., 1.}; + float reda[] = {1., 0, 0, .8}; + + pos[0] = -3.5; + pos[1] = 0.8; + pos[2] = -.4; + size[0] = 4.; + size[1] = .5; + size[2] = .4; + + SAH_GRAPHICS_BASE::setup_given_prefs(); + + switch (text_style) { + case TEXT_STYLE_PILLARS: + rnd_graph.init(pos, size, red, green); + pos[2] = -.2; + size[2] = .1; + sin_graph.init(pos, size, white, white); + pos[0] = -1.5; + pos[1] = 1.95; + pos[2] = 0; + inner_progress.init(pos, 1.0, 0.07, 0.05, outer, inner); + + pos[0] = -3.5; + pos[1] = 0.60; + pos[2] = 0; + outer_progress.init(pos, 4., 0.1, 0.08, outer,inner); + break; + case TEXT_STYLE_HEADSUP: + pos[0] = .03; + pos[1] = .5; + pos[2] = 1; + size[0] = .4; + size[1] = .08; + size[2] = 0; + rnd_graph.init(pos, size, reda, green); + size[2]=0; + pos[2]=0; + sin_graph.init(pos, size, white, white); + pos[0] = .03; + pos[1] = 0.67; + pos[2] = 0; + outer_progress_2d.init(pos,.4,.02,.015,outer,inner); + break; + case TEXT_STYLE_PANELS: + init_text_panels(); + size[0] = 3; + size[1] = .5; + size[2] = .1; + rnd_graph.init(pos, size, reda, green); + size[2]=.05; + sin_graph.init(pos, size, white, white); + pos[0] = .03; + pos[1] = .745; + pos[2] = 0; + outer[3]=.7; + outer_progress_2d.init(pos,3,.2,.15,outer,inner); + break; + } + + pos[0] = -3.50; + pos[1] = -2.50; + pos[2] = -2.00; + size[0] = 7.00; + size[1] = 2.00; + size[2] = 4.00; + rarray.init_display( + graph_style, pos, size, start_hue, hue_change, graph_alpha, + "Frequency (Hz)","Power","Time (sec)" + ); +} + +void app_graphics_resize(int w, int h) { + sah_graphics.resize(w, h); +} + +void boinc_app_mouse_move(int x, int y, int left, int middle, int right) { + if (left) { + sah_graphics.pitch_angle += (y-mouse_y)*.1; + sah_graphics.roll_angle += (x-mouse_x)*.1; + mouse_y = y; + mouse_x = x; + } else if (right) { + double d = (y-mouse_y); + sah_graphics.viewpoint_distance *= exp(d/100.); + mouse_y = y; + mouse_x = x; + } else { + mouse_down = false; + } +} + +void boinc_app_mouse_button(int x, int y, int which, int is_down) { + if (is_down) { + mouse_down = true; + mouse_x = x; + mouse_y = y; + } else { + mouse_down = false; + } +} + +void boinc_app_key_press(int, int) {} + +void boinc_app_key_release(int, int) {} + +static void app_init_camera(double dist) { + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective( + 45.0, // field of view in degree + 1.0, // aspect ratio + 1.0, // Z near clip + 1000.0 // Z far + ); + + set_viewpoint(dist); +} + +void SAH_GRAPHICS::render(int xs, int ys, double time_of_day) { + static double last_time=0; + double dt = 0; + + if (!sah_shmem) { + sah_shmem = (SAH_SHMEM*)boinc_graphics_get_shmem("setiathome"); + gdata = &(sah_shmem->gdata); + setup_given_prefs(); + } + if (!gdata) { + fprintf(stderr, "shared memory segment missing\n"); + exit(1); + } + gdata->countdown = 5; + + if (last_time != 0) { + dt = time_of_day - last_time; + } + last_time = time_of_day; + + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + if (starfield_size) { + starfield.update_stars(dt); + } + + render_logos(); + app_init_camera(viewpoint_distance); + scale_screen(width, height); + + start_rotate(); + incr_rotate(dt); + + render_background(); + + switch (text_style) { + case TEXT_STYLE_PILLARS: + render_pillars(time_of_day, dt); + break; + case TEXT_STYLE_PANELS: + render_panels(time_of_day, dt); + break; + case TEXT_STYLE_HEADSUP: + render_headsup(time_of_day, dt); + break; + } + render_3d_graph(time_of_day); + end_rotate(); + glFlush(); +} diff --git a/client/sah_gfx.h b/client/sah_gfx.h new file mode 100644 index 0000000..9f7602a --- /dev/null +++ b/client/sah_gfx.h @@ -0,0 +1,70 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +#ifndef SAH_GFX_H +#define SAH_GFX_H + +#include "gdata.h" +#include "reduce.h" +#include "gutil.h" +#include "sah_gfx_base.h" + + +// SAH_GRAPHICS combines all the info needed to draw S@h graphics: +// - user preferences (GRAPHICS_PREFS) +// - generic project graphics (SAH_GRAPHICS_BASE) +// - data from the analysis (GDATA) +// - internal state +// Its member functions do the rendering +// +class SAH_GRAPHICS: public SAH_GRAPHICS_BASE { + PROGRESS inner_progress; + PROGRESS outer_progress; + PROGRESS_2D outer_progress_2d; // outer progress for 2D display + RIBBON_GRAPH rnd_graph; + RIBBON_GRAPH sin_graph; + MOVING_TEXT_PANEL text_panels[3]; + void render_pillars(double, double); + void render_panels(double, double); + void render_headsup(double, double); + void init_text_panels(); + void get_data_info_string(char*); + void get_user_info_string(char*); + void get_analysis_info_string(char*); + int choose_signal_to_display(double time_of_day); +public: + void render(int x, int y, double t); + void data_struct_init(); + void graphics_thread_init(); + void reread_prefs(); + void setup_given_prefs(); +}; + +extern SAH_GRAPHICS sah_graphics; + +#endif + diff --git a/client/sah_gfx_base.cpp b/client/sah_gfx_base.cpp new file mode 100644 index 0000000..a5b8728 --- /dev/null +++ b/client/sah_gfx_base.cpp @@ -0,0 +1,394 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +#include "sah_config.h" + +#ifdef _WIN32 +#include "boinc_win.h" +#include // Header File For The OpenGL32 Library +#include // Header File For The GLu32 Library +#if !defined(__MINGW32__) && !defined(_MSC_VER) + #include // Header File For The Glaux Library +#endif +#include +#endif + +#ifndef _WIN32 +#include +#include + +#ifdef __APPLE_CC__ +#include +#include +#include +#include +#include +#include +#include +#endif +#endif + +#ifdef HAVE_IEEEFP_H +#include +#endif + +#include "s_util.h" +#include "db/db_table.h" +#include "db/schema_master.h" +#include "boinc_gl.h" +#include "parse.h" +#include "graphics2.h" +#include "sah_gfx_base.h" +#include "gutil.h" +#include "reduce.h" +#include "graphics_data.h" +#include "filesys.h" + +#define PI2 (2*3.1415926) + +#define SETI_LOGO_FILENAME "seti_logo" +#define USER_LOGO_FILENAME "user_logo" +#define SPONSOR_LOGO_FILENAME "sponsor_logo" +#define BACKGROUND_FILENAME "background" +#define SPONSOR_BKG_FILENAME "sponsor_bkg" + +// maximum resolutions for power graph +#define MAX_GRAPH_RES_X 200 +#define MAX_GRAPH_RES_Y 100 + +extern bool mouse_down; + +using namespace std; + +// The following must agree with the strings in +// project_specific_prefs.inc +// + +void GRAPHICS_PREFS::parse_project_prefs(char *buf) { + std::string text; + + if (!buf) return; + if (parse_str(buf, "", text)) { + if (!strcmp(text.c_str(), "Pillars")) text_style = TEXT_STYLE_PILLARS; + if (!strcmp(text.c_str(), "Panels")) text_style = TEXT_STYLE_PANELS; + if (!strcmp(text.c_str(), "Heads-up")) text_style = TEXT_STYLE_HEADSUP; + } + + if (parse_str(buf, "", text)) { + if (!strcmp(text.c_str(), "Rectangles")) graph_style = GRAPH_STYLE_RECTANGLES; + if (!strcmp(text.c_str(), "Wireframe")) graph_style = GRAPH_STYLE_WIREFRAME; + if (!strcmp(text.c_str(), "Surface")) graph_style = GRAPH_STYLE_SURFACE; + if (!strcmp(text.c_str(), "Planes")) graph_style = GRAPH_STYLE_PLANES; + } + parse_double(buf, "", max_fps); + parse_double(buf, "", max_cpu); + parse_double(buf, "", grow_time); + parse_double(buf, "", hold_time); + parse_double(buf, "", graph_alpha); + parse_double(buf, "", roll_period); + parse_double(buf, "", roll_range); + parse_double(buf, "", pitch_period); + parse_double(buf, "", pitch_range); + parse_int(buf, "", starfield_size); + parse_double(buf, "", starfield_speed); + parse_double(buf, "", start_hue); + parse_double(buf, "", hue_change); +} + +void GRAPHICS_PREFS::defaults() { + text_style = TEXT_STYLE_PILLARS; + graph_style = GRAPH_STYLE_RECTANGLES; + max_fps = 20; + max_cpu = 30; + grow_time = 10; + hold_time = 10; + graph_alpha = 0.7; + + pitch_period = 100; + pitch_range = 20; + roll_period = 300; + roll_range = 30; + starfield_size = 2000; + starfield_speed = 40.0f; + + start_hue = 0.2; + hue_change = 0.7; +} + +SAH_GRAPHICS_BASE::SAH_GRAPHICS_BASE() : + GRAPHICS_PREFS(), + //GDATA(), + roll_angle(0),roll_phase(0), + pitch_angle(0),pitch_phase(0),starfield(),seti_logo_texture(), + user_logo_texture(), background_texture(),viewpoint_distance(1.0) +{ + data_struct_init(); +} + +void SAH_GRAPHICS_BASE::start_rotate() { + if (roll_period == 0 && pitch_period == 0) return; + glPushMatrix(); + if (pitch_period) { + glRotated(pitch_angle + pitch_range*sin(pitch_phase), 1., 0., 0); + } + if (roll_period) { + glRotated(roll_angle + roll_range*sin(roll_phase), 0., 1., 0); + } +} + +void SAH_GRAPHICS_BASE::incr_rotate(double dt) { + if (mouse_down) return; + pitch_phase += PI2*(dt/pitch_period); + if (pitch_phase > PI2) pitch_phase -= PI2; + roll_phase += PI2*(dt/roll_period); + if (roll_phase > PI2) roll_phase -= PI2; +} + +void SAH_GRAPHICS_BASE::end_rotate() { + if (roll_period == 0 && pitch_period == 0) return; + glPopMatrix(); +} + +// A note on our coordinates: +// X should be between -4 and 4 +// Y should be between -3 and 3 +// Z should be centered around zero (graph is -2 to +2) + +void SAH_GRAPHICS_BASE::draw_pillars() { + float pos[3]; + GLfloat violet[] = {0.6, 0.3, .8, 1.0}; + GLfloat white[] = {1.0, 1.0, 1.0, 1.0}; + COLOR color; + double lum = .5; + double sat = .5; + double hue = start_hue + hue_change/2.; + if (hue > 1) hue -= 1; + if (hue < 1) hue += 1; + HLStoRGB(hue, lum, sat, color); + color.a = 1.0; + GLfloat graphColor[4] = {color.r,color.g,color.b,color.a}; + + pos[0] = pos[1] = pos[2] = 0; + mode_shaded(graphColor); + pos[0] = -3.50; pos[1] = 0; + drawCylinder(false, pos, 7.00, .10); + drawSphere(pos, .10); + pos[0] = 3.5; drawSphere(pos, .1); + + pos[0] = -3.50; pos[1] = 2.50; + drawCylinder(false, pos, 7.00, .10); + drawSphere(pos, .10); + pos[0] = 3.5; drawSphere(pos, .1); + + pos[0] = 1.00; pos[1] = 1.25; + drawCylinder(false, pos, 2.50, .10); + pos[0] = 3.5; drawSphere(pos, .1); + + pos[0] = 1.00; pos[1] = 0; + drawCylinder(true, pos, 2.50, .10); +} + +void set_viewpoint(double dist) { + double x, y, z; + x = 0; + y = 3.0*dist; + z = 11.0*dist; + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + gluLookAt( + x, y, z, // eye position + 0,-.8,0, // where we're looking + 0.0, 1.0, 0. // up is in positive Y direction + ); + +} + + +static void initlights() { + GLfloat ambient[] = {1., 1., 1., 1.0}; + GLfloat position[] = {-13.0, 6.0, 20.0, 1.0}; + GLfloat dir[] = {-1, -.5, -3, 1.0}; + glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); + glLightfv(GL_LIGHT0, GL_POSITION, position); + glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, dir); +} + +void SAH_GRAPHICS_BASE::render_logos() { + float pos[3] = {.03, .03, 0}; + float size[3] = {.27, .3, 0}; + bool any = seti_logo_texture.present || user_logo_texture.present; + + if (any) { + mode_ortho(); + mode_unshaded(); + } + + //draw texture justified at bottom left relative to coords + if (seti_logo_texture.present) { + seti_logo_texture.draw(pos, size, ALIGN_BOTTOM, ALIGN_BOTTOM); + } + + float pos2[3] = {.7, .03, 0}; + float size2[3] = {.27, .3, 0}; + //draw texture justified at bottom right relative to coords + if (user_logo_texture.present) { + user_logo_texture.draw(pos2, size2, ALIGN_TOP, ALIGN_BOTTOM); + } + if (any) { + ortho_done(); + } +} + +void SAH_GRAPHICS_BASE::render_background() { + float pos[3], size[3]; + // draw image behind graph, if any + // + if (background_texture.present) { + mode_texture(); + pos[0] = -3; pos[1] = -3; pos[2] = -2; + size[0] = 6; size[1] = 6; size[2] = 0; + background_texture.draw(pos, size, ALIGN_CENTER, ALIGN_CENTER); + } +} + +void SAH_GRAPHICS_BASE::render_3d_graph(double time_of_day) { + double elapsed_time,frac_done; + + if (rarray.start_time == 0) { + rarray.start_time = time_of_day; + } + elapsed_time = time_of_day - rarray.start_time; + if (elapsed_time >= grow_time) { + frac_done = 1.0; + } else { + frac_done = elapsed_time/grow_time; + } + rarray.draw_axes(); + rarray.draw_labels(); + + rarray.draw_part(frac_done); + if (elapsed_time >= grow_time + hold_time) { + memcpy(&rarray, &sah_shmem->rarray_data, sizeof(REDUCED_ARRAY_DATA)); + rarray.start_time = time_of_day; + rarray.new_array(); + } +} + + +// this sets up the shared data structures, +// don't make any OpenGL calls from here +// This is called before BOINC initialization, +// so don't do any BOINC-related stuff +// +void SAH_GRAPHICS_BASE::data_struct_init() { + defaults(); + srand(time(NULL)); +} + +// this is called from the graphics thread; +// it does OpenGL initialization. +// This is always called after init_worker_thread(), +// so the graphics prefs are in place. +// +void SAH_GRAPHICS_BASE::graphics_thread_init() { + boinc_get_init_data(app_init_data); + parse_project_prefs(app_init_data.project_preferences); + + glShadeModel(GL_SMOOTH); // Enable Smooth Shading + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background + glClearDepth(1.0f); // Depth Buffer Setup + glEnable(GL_DEPTH_TEST); // Enables Depth Testing + glEnable(GL_LINE_SMOOTH); + glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); + glEnable(GL_BLEND); + glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do + glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations + initlights(); + + int viewport[4]; + get_viewport(viewport); + int w = viewport[2]; + int h = viewport[3]; + resize(w,h); +} + +void SAH_GRAPHICS_BASE::resize(int w, int h) { + //float fontsize = (w/35.0f>14) ? 14 : w/35.0f; + //int weight = (700>w*35.0f/24.0f) ? 700 : w*35.0f/24.0f; + //listBase=MyCreateFont("Ariel",fontsize,weight); + height=h; + width=w; + glViewport(0, 0, w, h); +} + +void SAH_GRAPHICS_BASE::setup_given_prefs() { + char filename[256],bkg_filename[256]; + + boinc_max_fps = max_fps; + boinc_max_gfx_cpu_frac = max_cpu/100.; + if (starfield_size) { + starfield.build_stars(starfield_size, starfield_speed); + } + seti_logo_texture.present = false; + user_logo_texture.present = false; + background_texture.present = false; + + double fsize=0; + boinc_resolve_filename(SETI_LOGO_FILENAME, filename, sizeof(filename)); + if (!file_size(filename,fsize) && (fsize>4096)) { + seti_logo_texture.load_image_file(filename); + } else { + fprintf(stderr,"Warning: unable to load JPEG file. File size=%d\n",(int)fsize); + seti_logo_texture.present=false; + } + if (gdata) { + int s4_id=gdata->wu.s4_id; + if (s4_id >= 17) { + time_t t=time(0); + struct tm *tm=localtime(&t); + if (tm->tm_year >= 116) { + boinc_resolve_filename(SPONSOR_LOGO_FILENAME, filename, sizeof(filename)); + boinc_resolve_filename(SPONSOR_BKG_FILENAME, bkg_filename, sizeof(bkg_filename)); + if (!boinc_file_exists(filename)) + boinc_resolve_filename(USER_LOGO_FILENAME, filename, sizeof(filename)); + if (!boinc_file_exists(bkg_filename)) + boinc_resolve_filename(BACKGROUND_FILENAME, bkg_filename, sizeof(bkg_filename)); + } else { + boinc_resolve_filename(USER_LOGO_FILENAME, filename, sizeof(filename)); + boinc_resolve_filename(BACKGROUND_FILENAME, bkg_filename, sizeof(bkg_filename)); + } + } else { + boinc_resolve_filename(USER_LOGO_FILENAME, filename, sizeof(filename)); + boinc_resolve_filename(BACKGROUND_FILENAME, bkg_filename, sizeof(filename)); + } + } else { + boinc_resolve_filename(USER_LOGO_FILENAME, filename, sizeof(filename)); + boinc_resolve_filename(BACKGROUND_FILENAME, bkg_filename, sizeof(filename)); + } + user_logo_texture.load_image_file(filename); + background_texture.load_image_file(bkg_filename); +} diff --git a/client/sah_gfx_base.h b/client/sah_gfx_base.h new file mode 100644 index 0000000..009c700 --- /dev/null +++ b/client/sah_gfx_base.h @@ -0,0 +1,101 @@ + +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +#include +#include "boinc_api.h" + +#include "gutil.h" +#include "gdata.h" +#include "graphics_data.h" + +#include "reduce.h" + +typedef enum { + TEXT_STYLE_PILLARS, // panels delimited by cylinders + TEXT_STYLE_PANELS, // rotating panels + TEXT_STYLE_HEADSUP // 2D text in corners +} TEXT_STYLE; + +// User's graphics-related per-project preferences for SETI@home +// +struct GRAPHICS_PREFS { + TEXT_STYLE text_style; + GRAPH_STYLE graph_style; + double max_fps; // max frames per second + double max_cpu; // max pct of CPU + double graph_alpha; + double pitch_period; + double pitch_range; // degrees + double roll_period; + double roll_range; + int starfield_size; + double starfield_speed; + double start_hue, hue_change; // determine graph colors + double grow_time; + double hold_time; + + void parse_project_prefs(char*); + void defaults(); + GRAPHICS_PREFS() { defaults(); }; +}; + +class SAH_GRAPHICS_BASE: /* public GDATA, */ public GRAPHICS_PREFS { +public: + double roll_angle; + double roll_phase; + double pitch_angle; + double pitch_phase; + STARFIELD starfield; + TEXTURE_DESC seti_logo_texture; + TEXTURE_DESC user_logo_texture; + TEXTURE_DESC background_texture; + APP_INIT_DATA app_init_data; + double viewpoint_distance; + int width, height; + REDUCED_ARRAY_RENDER rarray; + SAH_SHMEM* sah_shmem; + GDATA* gdata; + + SAH_GRAPHICS_BASE(); + void data_struct_init(); + void graphics_thread_init(); + void reread_prefs(); + void setup_given_prefs(); + + void resize(int, int); + void start_rotate(); + void incr_rotate(double dt); + void end_rotate(); + void draw_pillars(); + void render_logos(); + void render_background(); + void render_3d_graph(double time_of_day); +}; + +extern void set_viewpoint(double); +extern bool nographics(); diff --git a/client/sah_gfx_main.cpp b/client/sah_gfx_main.cpp new file mode 100644 index 0000000..ad4a52c --- /dev/null +++ b/client/sah_gfx_main.cpp @@ -0,0 +1,67 @@ + +// Copyright 2007 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +#include "sah_gfx_main.h" +#include "boinc_api.h" +#include "graphics2.h" + +extern double progress; +SAH_SHMEM* sah_shmem; +REDUCED_ARRAY_GEN rarray; +GDATA* sah_graphics; +bool nographics_flag = false; + +void update_shmem() { + if (sah_graphics->countdown > 0) { + sah_graphics->countdown--; + boinc_wu_cpu_time(sah_graphics->cpu_time); + sah_graphics->progress=progress; + } +} + +void sah_graphics_init(APP_INIT_DATA& app_init_data) { + if (nographics_flag) return; + if ((app_init_data.host_info.m_nbytes != 0) && + (app_init_data.host_info.m_nbytes <= (double)(48*1024*1024)) + ) { + fprintf(stderr,"Low memory machine... Disabling graphics.\n"); + fprintf(stderr,"%f <= %f\n",app_init_data.host_info.m_nbytes,(double)48*1024*1024); + nographics_flag = true; + return; + } + sah_shmem = (SAH_SHMEM*)boinc_graphics_make_shmem("setiathome", sizeof(SAH_SHMEM)); + if (!sah_shmem) { + sah_shmem=(SAH_SHMEM*)boinc_graphics_get_shmem("setiathome"); + } + if (!sah_shmem) { + nographics_flag = true; + return; + } + sah_graphics = &(sah_shmem->gdata); + boinc_register_timer_callback(update_shmem); +} diff --git a/client/sah_gfx_main.h b/client/sah_gfx_main.h new file mode 100644 index 0000000..5a12bc9 --- /dev/null +++ b/client/sah_gfx_main.h @@ -0,0 +1,43 @@ +// Copyright 2007 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +#include +#include "gdata.h" +#include "boinc_api.h" + +extern SAH_SHMEM* sah_shmem; +extern REDUCED_ARRAY_GEN rarray; +extern GDATA* sah_graphics; +extern bool nographics_flag; + +inline bool nographics() { + if (nographics_flag) return true; + if (!sah_graphics) return true; + if (!sah_graphics->countdown) return true; + return false; +} +extern void sah_graphics_init(APP_INIT_DATA&); diff --git a/client/sah_version.cpp b/client/sah_version.cpp new file mode 100644 index 0000000..deca954 --- /dev/null +++ b/client/sah_version.cpp @@ -0,0 +1,32 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: sah_version.cpp,v 1.1.2.1 2007/05/31 22:08:12 korpela Exp $ +#include "sah_config.h" +int gmajor_version = VERSION_MAJOR; +int gminor_version = VERSION_MINOR; + diff --git a/client/sah_version.h b/client/sah_version.h new file mode 100644 index 0000000..8ee221b --- /dev/null +++ b/client/sah_version.h @@ -0,0 +1,31 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +//$Id: sah_version.h,v 1.1.2.1 2007/05/31 22:08:12 korpela Exp $ +extern int gmajor_version; +extern int gminor_version; + diff --git a/client/seti.cpp b/client/seti.cpp new file mode 100644 index 0000000..bc14289 --- /dev/null +++ b/client/seti.cpp @@ -0,0 +1,1187 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// seti.C +// $Id: seti.cpp,v 1.60.2.19 2007/08/10 00:38:49 korpela Exp $ +// +// SETI-specific logic for reading/writing checkpoint files +// and parsing WU files. +// +// Files: +// state.txt +// the last chirp rate / FFT len finished, if any +// outfile.txt +// The append-only result file +// +// What finally gets sent back as the result file is: +// - the generic result header, with the final CPU time filled in +// - the SETI-specific part of the WU header +// - the contents of outfile.txt + +#include "sah_config.h" + +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include + +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + +#ifdef HAVE_IEEEFP_H +#include +#endif + +#include "boinc_api.h" +#include "str_util.h" +#include "str_replace.h" + +#include "diagnostics.h" +#include "parse.h" +#include "filesys.h" +#include "s_util.h" +#include "seti_header.h" +#include "analyze.h" +#include "analyzeFuncs.h" +#include "vector/analyzeFuncs_vector.h" +#include "pulsefind.h" +#include "analyzeReport.h" +#include "analyzePoT.h" +#include "malloc_a.h" +#include "chirpfft.h" +#include "worker.h" + +#include "seti.h" + +#define DATA_ASCII 1 +#define DATA_ENCODED 2 +#define DATA_SUN_BINARY 3 + +APP_INIT_DATA app_init_data; + +ANALYSIS_STATE analysis_state; +static int wrote_header; +double LOAD_STORE_ADJUSTMENT=2.85; +double SETUP_FLOPS=1.42e+10/2.85; + +SPIKE_INFO::SPIKE_INFO() : track_mem("SPIKE_INFO"),s(), score(0), bin(0), fft_ind(0) {} + +SPIKE_INFO::~SPIKE_INFO() {} + +SPIKE_INFO::SPIKE_INFO(const SPIKE_INFO &si) : track_mem("SPIKE_INFO"), +s(si.s), score(si.score), bin(si.bin), fft_ind(si.fft_ind) {} + +SPIKE_INFO &SPIKE_INFO::operator =(const SPIKE_INFO &si) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("SPIKE_INFO::operator ="); +#endif + if (&si != this) { + s=si.s; + score=si.score; + bin=si.bin; + fft_ind=si.fft_ind; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return *this; +} + +AUTOCORR_INFO::AUTOCORR_INFO() : track_mem("AUTOCORR_INFO"),a(), score(0), bin(0), fft_ind(0) {} + +AUTOCORR_INFO::~AUTOCORR_INFO() {} + +AUTOCORR_INFO::AUTOCORR_INFO(const AUTOCORR_INFO &ai) : track_mem("AUTOCORR_INFO"), +a(ai.a), score(ai.score), bin(ai.bin), fft_ind(ai.fft_ind) {} + +AUTOCORR_INFO &AUTOCORR_INFO::operator =(const AUTOCORR_INFO &ai) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("AUTOCORR_INFO::operator ="); +#endif + if (&ai != this) { + a=ai.a; + score=ai.score; + bin=ai.bin; + fft_ind=ai.fft_ind; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return *this; +} + + +GAUSS_INFO::GAUSS_INFO() : track_mem("GAUSS_INFO"), +g(), score(0), display_power_thresh(0), bin(0), fft_ind(0) { +} + +GAUSS_INFO::~GAUSS_INFO() {} + +GAUSS_INFO::GAUSS_INFO(const GAUSS_INFO &gi) : track_mem("GAUSS_INFO"), +g(gi.g), score(gi.score), bin(gi.bin), fft_ind(gi.fft_ind) { +} + +GAUSS_INFO &GAUSS_INFO::operator =(const GAUSS_INFO &gi) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("GAUSS_INFO::operator ="); +#endif + if (&gi != this) { + g=gi.g; + score=gi.score; + bin=gi.bin; + fft_ind=gi.fft_ind; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return *this; +} + +PULSE_INFO::PULSE_INFO() : track_mem("PULSE_INFO"), p(), score(0), freq_bin(0), time_bin(0) { + +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("PULSE_INFO::PULSE_INFO()"); +#endif +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + pot_min = (unsigned int *)calloc_a(swi.analysis_cfg.pulse_pot_length, sizeof(unsigned int), MEM_ALIGN); + if (pot_min == NULL) SETIERROR(MALLOC_FAILED, "new PULSE_INFO pot_min == NULL"); + pot_max = (unsigned int *)calloc_a(swi.analysis_cfg.pulse_pot_length, sizeof(unsigned int), MEM_ALIGN); + if (pot_max == NULL) SETIERROR(MALLOC_FAILED, "new PULSE_INFO pot_max == NULL"); + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +PULSE_INFO::~PULSE_INFO() { +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("PULSE_INFO::~PULSE_INFO()"); +#endif + free_a(pot_min); + free_a(pot_max); + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +PULSE_INFO::PULSE_INFO(const PULSE_INFO &pi) : track_mem("PULSE_INFO"), +p(pi.p), score(pi.score), freq_bin(pi.freq_bin), time_bin(pi.time_bin) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("PULSE_INFO::PULSE_INFO(const PULSE_INFO &pi)"); +#endif +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + pot_min = (unsigned int *)calloc_a(swi.analysis_cfg.pulse_pot_length, sizeof(unsigned int), MEM_ALIGN); + if (pot_min == NULL) SETIERROR(MALLOC_FAILED, "copied PULSE_INFO pot_min == NULL"); + pot_max = (unsigned int *)calloc_a(swi.analysis_cfg.pulse_pot_length, sizeof(unsigned int), MEM_ALIGN); + if (pot_max == NULL) SETIERROR(MALLOC_FAILED, "copied PULSE_INFO pot_max == NULL"); + + memcpy(pot_min,pi.pot_min,(swi.analysis_cfg.pulse_pot_length * sizeof(unsigned int))); + memcpy(pot_max,pi.pot_max,(swi.analysis_cfg.pulse_pot_length * sizeof(unsigned int))); + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +PULSE_INFO &PULSE_INFO::operator =(const PULSE_INFO &pi) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("PULSE_INFO::operator ="); +#endif +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + if (&pi != this) { + p=pi.p; + score=pi.score; + freq_bin=pi.freq_bin; + time_bin=pi.time_bin; + + memcpy(pot_min,pi.pot_min,(swi.analysis_cfg.pulse_pot_length * sizeof(unsigned int))); + memcpy(pot_max,pi.pot_max,(swi.analysis_cfg.pulse_pot_length * sizeof(unsigned int))); + } + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return *this; +} + +TRIPLET_INFO::TRIPLET_INFO() : track_mem("TRIPLET_INFO"), +t(), score(0), bperiod(0), freq_bin(0), tpotind0_0(0), tpotind0_1(0), +tpotind1_0(0), tpotind1_1(0), tpotind2_0(0), tpotind2_1(0), time_bin(0), +scale(0) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("TRIPLET_INFO::TRIPLET_INFO()"); +#endif +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + pot_min = (unsigned int *)calloc_a(swi.analysis_cfg.triplet_pot_length, sizeof(unsigned int), MEM_ALIGN); + if (pot_min == NULL) SETIERROR(MALLOC_FAILED, "new TRIPLET_INFO pot_min == NULL"); + pot_max = (unsigned int *)calloc_a(swi.analysis_cfg.triplet_pot_length, sizeof(unsigned int), MEM_ALIGN); + if (pot_max == NULL) SETIERROR(MALLOC_FAILED, "new TRIPLET_INFO pot_max == NULL"); + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +TRIPLET_INFO::TRIPLET_INFO(const TRIPLET_INFO &ti) : track_mem("TRIPLET_INFO"), t(ti.t), score(ti.score), + + bperiod(ti.bperiod), freq_bin(ti.freq_bin), + tpotind0_0(ti.tpotind0_0), tpotind0_1(ti.tpotind0_1), + tpotind1_0(ti.tpotind1_0), tpotind1_1(ti.tpotind1_1), + tpotind2_0(ti.tpotind2_0), tpotind2_1(ti.tpotind2_1), + time_bin(ti.time_bin), scale(ti.scale) + +{ +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("TRIPLET_INFO::TRIPLET_INFO(const TRIPLET_INFO &ti)"); +#endif +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + pot_min = (unsigned int *)calloc_a(swi.analysis_cfg.triplet_pot_length, sizeof(unsigned int), MEM_ALIGN); + if (pot_min == NULL) SETIERROR(MALLOC_FAILED, "copied TRIPLET_INFO pot_min == NULL"); + pot_max = (unsigned int *)calloc_a(swi.analysis_cfg.triplet_pot_length, sizeof(unsigned int), MEM_ALIGN); + if (pot_max == NULL) SETIERROR(MALLOC_FAILED, "copied TRIPLET_INFO pot_max == NULL"); + memcpy(pot_min,ti.pot_min,(swi.analysis_cfg.triplet_pot_length * sizeof(unsigned int))); + memcpy(pot_max,ti.pot_max,(swi.analysis_cfg.triplet_pot_length * sizeof(unsigned int))); + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +TRIPLET_INFO &TRIPLET_INFO::operator =(const TRIPLET_INFO &ti) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("TRIPLET_INFO::operator ="); +#endif +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + if (&ti != this) { + t=ti.t; + score=ti.score; + bperiod=ti.bperiod; + freq_bin=ti.freq_bin; + tpotind0_0=ti.tpotind0_0; + tpotind0_1=ti.tpotind0_1; + tpotind1_0=ti.tpotind1_0; + tpotind1_1=ti.tpotind1_1; + tpotind2_0=ti.tpotind2_0; + tpotind2_1=ti.tpotind2_1; + time_bin=ti.time_bin; + + memcpy(pot_min,ti.pot_min,(swi.analysis_cfg.triplet_pot_length * sizeof(unsigned int))); + memcpy(pot_max,ti.pot_max,(swi.analysis_cfg.triplet_pot_length * sizeof(unsigned int))); + } + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return *this; +} + + +TRIPLET_INFO::~TRIPLET_INFO() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("TRIPLET_INFO::~TRIPLET_INFO()"); +#endif +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + free_a(pot_min); + free_a(pot_max); + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +// Do SETI-specific initialization for a work unit. +// - prepare outfile for appending +// - reset scores +int seti_init_state() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("seti_init_state()"); +#endif + analysis_state.icfft= 0; + analysis_state.PoT_freq_bin = -1; + analysis_state.PoT_activity = POT_INACTIVE; + progress = 0.0; + reset_high_scores(); + std::string path; + + boinc_resolve_filename_s(OUTFILE_FILENAME, path); + if (outfile.open(path.c_str(), "ab")) SETIERROR(CANT_CREATE_FILE," in seti_init_state()"); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// This gets called at the start of each chirp/fft pair. +int result_group_start() { + wrote_header = 0; + return 0; +} + +// This gets called prior to writing an entry in the output file. +// Write the chirp/fft parameters if not done already. + +int result_group_write_header() { + if (wrote_header) return 0; + wrote_header = 1; + int retval = outfile.printf( "\n", + analysis_state.icfft, + ChirpFftPairs[analysis_state.icfft].ChirpRate, + ChirpFftPairs[analysis_state.icfft].FftLen + ); + if (retval < 0) SETIERROR(WRITE_FAILED,"in result_group_write_header()"); + return 0; +} + + +// this gets called at the end of each chirp/fft pair +// Rewrite the state file, +// and write an end-of-group record to log file +// if anything was written for this group. +int result_group_end() { + int retval=0; + + if (wrote_header) { + retval = outfile.printf( "\n", + analysis_state.icfft, + ChirpFftPairs[analysis_state.icfft].ChirpRate, + ChirpFftPairs[analysis_state.icfft].FftLen); + if (retval < 0) SETIERROR(WRITE_FAILED,"in result_group_end"); + } + + return 0; +} + + +int checkpoint(BOOLEAN force_checkpoint) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("checkpoint()"); +#endif + int retval=0, i, l=xml_indent_level; + xml_indent_level=0; +// Making state_file static to avoid overhead of reallocating of buffers on +// every call. + static MFILE state_file; + char buf[2048]; + std::string enc_field, str; + + // The user may have set preferences for a long time between + // checkpoints to reduce disk access. + if (!force_checkpoint) { + if (!boinc_time_to_checkpoint()) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return CHECKPOINT_SKIPPED; + } + } + + fflush(stderr); + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + if (state_file.open(STATE_FILENAME, "wb")) SETIERROR(CANT_CREATE_FILE,"in checkpoint()"); + retval = state_file.printf( + "%d\n" + "%e\n" + "%d\n" + "%.8f\n" + "%d\n" + "%d\n" + "%d\n" + "%f\n" + "%d\n" + "%d\n" + "%d\n" + "%d\n" + "%d\n", + analysis_state.icfft, + ChirpFftPairs[analysis_state.icfft].ChirpRate, + ChirpFftPairs[analysis_state.icfft].FftLen, + std::min(progress,0.9999999), + analysis_state.PoT_freq_bin, + analysis_state.PoT_activity, + signal_count, + analysis_state.FLOP_counter, + spike_count, + autocorr_count, + pulse_count, + gaussian_count, + triplet_count + ); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + + // checkpoint the best spike thus far (if any) + if(best_spike->s.fft_len) { + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + // the spike proper + str = best_spike->s.print_xml(0,0,1); + retval = (int)state_file.write(str.c_str(), str.size(), 1); + // ancillary data + retval = state_file.printf( + "%f\n" + "%d\n" + "%d\n", + best_spike->score, + best_spike->bin, + best_spike->fft_ind); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + } + + // checkpoint the best autocorr thus far (if any) + if(best_autocorr->a.fft_len) { + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + // the autocorr proper + str = best_autocorr->a.print_xml(0,0,1); + retval = (int)state_file.write(str.c_str(), str.size(), 1); + // ancillary data + retval = state_file.printf( + "%f\n" + "%d\n" + "%d\n", + best_autocorr->score, + best_autocorr->bin, + best_autocorr->fft_ind); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + } + + // checkpoint the best gaussian thus far (if any) + if(best_gauss->g.fft_len || best_gauss->score) { + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + // the gaussian proper + str = best_gauss->g.print_xml(0,0,1); + retval = (int)state_file.write(str.c_str(), str.size(), 1); + // ancillary data + retval = state_file.printf( + "%f\n" + "%f\n" + "%d\n" + "%d\n", + best_gauss->score, + best_gauss->display_power_thresh, + best_gauss->bin, + best_gauss->fft_ind); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + } + + // checkpoint the best pulse thus far (if any) + // The check for len_prof is a kludge. + if(best_pulse->p.fft_len) { + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + // the pulse proper + str = best_pulse->p.print_xml(0,0,1); + retval = (int)state_file.write(str.c_str(), str.size(), 1); + // ancillary data + retval = state_file.printf( + "%f\n" + "%d\n" + "%d\n", + best_pulse->score, + best_pulse->freq_bin, + best_pulse->time_bin); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + } + + // checkpoint the best triplet thus far (if any) + if(best_triplet->t.fft_len) { + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + // the triplet proper + str = best_triplet->t.print_xml(0,0,1); + retval = (int)state_file.write(str.c_str(), str.size(), 1); + + // ancillary data + retval = state_file.printf( + "%f\n" + "%f\n" + "%d\n" + "%d\n" + "%d\n" + "%d\n" + "%d\n" + "%d\n" + "%d\n" + "%f\n" + "%f\n", + best_triplet->score, + best_triplet->bperiod, + best_triplet->tpotind0_0, + best_triplet->tpotind0_1, + best_triplet->tpotind1_0, + best_triplet->tpotind1_1, + best_triplet->tpotind2_0, + best_triplet->tpotind2_1, + best_triplet->freq_bin, + best_triplet->time_bin, + best_triplet->scale); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + + // convert min PoT to chars, encode, and print + for (i=0; ipot_min[i]; + } + enc_field=xml_encode_string(buf, swi.analysis_cfg.triplet_pot_length, _x_csv); + retval = state_file.printf( + "", + enc_field.size(), xml_encoding_names[_x_csv] + ); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + state_file.write(enc_field.c_str(), enc_field.size(), 1); + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + + // convert max PoT to chars, encode, and print + for (i=0; ipot_max[i]; + } + enc_field=xml_encode_string(buf, swi.analysis_cfg.triplet_pot_length, _x_csv); + state_file.printf( + "", + enc_field.size(), xml_encoding_names[_x_csv] + ); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + state_file.write(enc_field.c_str(), enc_field.size(), 1); + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + retval = state_file.printf("\n"); + if (retval < 0) SETIERROR(WRITE_FAILED,"in checkpoint()"); + } + + if (BaseLineSmooth != NULL) { + for (i=0;i%s\n", + BaseLineSmoothFuncs[i].nom); + break; + } + } + } + + if (GetPowerSpectrum != NULL) { + for (i=0;i%s\n", + GetPowerSpectrumFuncs[i].nom); + break; + } + } + } + + if (ChirpData != NULL) { + for (i=0;i%s\n", + ChirpDataFuncs[i].nom); + break; + } + } + } + + if (Transpose != NULL) { + for (i=0;i%s\n", + TransposeFuncs[i].nom); + break; + } + } + } + + if (strlen(Foldmain.name) != 0) { + state_file.printf("%s\n", + Foldmain.name); + } + + // The result (outfile) and state mfiles are now synchronized. + // Flush them both. + retval = outfile.flush(); + if (retval) SETIERROR(WRITE_FAILED,"in checkpoint()"); + retval = state_file.flush(); + if (retval) SETIERROR(WRITE_FAILED,"in checkpoint()"); + retval = state_file.close(); + if (retval) SETIERROR(WRITE_FAILED,"in checkpoint()"); + boinc_checkpoint_completed(); + xml_indent_level=l; + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// Read the state file and set analysis_state accordingly. +// Note: The state of analysis is saved in two places: +// 1) at the end of processing the data for any given +// chirp/fft pair. In this case, the icfft index +// needs to be set for the *next* chirp/fft pair. +// If analysis was in this state when saved, +// PoT_freq_bin will have been set to -1. +// 2) at the end of PoT processing for any given +// frequency bin (for any given chirp/fft pair). +// This is indicated by PoT_freq_bin containing +// something other than -1. It will contain the +// frequency bin just completed. In this case, we +// are *not* finished processing for the current +// chirp/fft pair and we do not increment icfft to +// the next pair. We do however increment PoT_freq_bin +// to the next frequency bin. +// +int parse_state_file(ANALYSIS_STATE& as) { + static char buf[8192]; + std::string fname; + int ncfft, fl, PoT_freq_bin, PoT_activity; + double cr=0,flops=0; + FILE* state_file; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("parse_state_file()"); +#endif +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif + + ncfft = -1; + progress = 0.0; + PoT_freq_bin = -1; + PoT_activity = POT_INACTIVE; + state_file = boinc_fopen(STATE_FILENAME, "rb"); + if (!state_file) SETIERROR(FOPEN_FAILED,"in parse_state_file()"); + + // main parsing loop + while (fgets(buf, sizeof(buf), state_file)) { + if (parse_int(buf, "", ncfft)) continue; + else if (parse_double(buf, "", cr)) continue; + else if (parse_int(buf, "", fl)) continue; + else if (parse_double(buf, "", progress)) continue; + else if (parse_int(buf, "", PoT_freq_bin)) continue; + else if (parse_int(buf, "", PoT_activity)) continue; + else if (parse_int(buf, "", signal_count)) continue; + else if (parse_double(buf, "", flops)) continue; + else if (parse_int(buf, "", spike_count)) continue; + else if (parse_int(buf, "", autocorr_count)) continue; + else if (parse_int(buf, "", pulse_count)) continue; + else if (parse_int(buf, "", gaussian_count)) continue; + else if (parse_int(buf, "", triplet_count)) continue; + // best spike + else if (xml_match_tag(buf, "")) { + while (fgets(buf, sizeof(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + // spike proper + else if (xml_match_tag(buf, "")) { + char *p = buf + strlen(buf); + while(fgets(p, sizeof(buf)-(int)strlen(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + p += strlen(p); + } + best_spike->s.parse_xml(buf); + } + // ancillary data + else if (parse_double(buf, "", best_spike->score)) continue; + else if (parse_int(buf, "", best_spike->bin)) continue; + else if (parse_int(buf, "", best_spike->fft_ind)) continue; + } // end while in best_spike + } // end if in best_spike + + // best autocorr + else if (xml_match_tag(buf, "")) { + while (fgets(buf, sizeof(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + // autocorr proper + else if (xml_match_tag(buf, "")) { + char *p = buf + strlen(buf); + while(fgets(p, sizeof(buf)-(int)strlen(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + p += strlen(p); + } + best_autocorr->a.parse_xml(buf); + } + // ancillary data + else if (parse_double(buf, "", best_autocorr->score)) continue; + else if (parse_int(buf, "", best_autocorr->bin)) continue; + else if (parse_int(buf, "", best_autocorr->fft_ind)) continue; + } // end while in best_autocorr + } // end if in best_autocorr + + // best gaussian.. + else if (xml_match_tag(buf, "")) { + while (fgets(buf, sizeof(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + // gaussian proper + else if (xml_match_tag(buf, "")) { + char *p = buf + strlen(buf); + while(fgets(p, sizeof(buf)-(int)strlen(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + p += strlen(p); + } + best_gauss->g.parse_xml(buf); + } + // ancillary data + else if (parse_double(buf, "", best_gauss->score)) continue; + else if (parse_double(buf, "", + best_gauss->display_power_thresh)) continue; + else if (parse_int(buf, "", best_gauss->bin)) continue ; + else if (parse_int(buf, "", best_gauss->fft_ind)) continue; + } // end while in best_gaissian + } // end if in best_gaussian + + // best pulse + else if (xml_match_tag(buf, "")) { + while (fgets(buf, sizeof(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + // pulse proper + else if (xml_match_tag(buf, "")) { + char *p = buf + strlen(buf); + while(fgets(p, sizeof(buf)-(int)strlen(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + p += strlen(p); + } + best_pulse->p.parse_xml(buf); + } + // ancillary data + else if (parse_double(buf, "", best_pulse->score)) continue; + else if (parse_int(buf, "", best_pulse->freq_bin)) continue; + else if (parse_int(buf, "", best_pulse->time_bin)) continue; + } // end while in best_pulse + } // end if in best_pulse + + // best triplet + else if (xml_match_tag(buf, "")) { + while (fgets(buf, sizeof(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + // triplet proper + else if (xml_match_tag(buf, "")) { + char *p = buf + strlen(buf); + while(fgets(p, sizeof(buf)-(int)strlen(buf), state_file)) { + if (xml_match_tag(buf, "")) break; + p += strlen(p); + } + best_triplet->t.parse_xml(buf); + } + // ancillary data + else if (parse_double(buf, "", best_triplet->score)) continue; + else if (parse_double(buf, "", best_triplet->bperiod)) continue; + else if (parse_int(buf, "", best_triplet->tpotind0_0)) continue; + else if (parse_int(buf, "", best_triplet->tpotind0_1)) continue; + else if (parse_int(buf, "", best_triplet->tpotind1_0)) continue; + else if (parse_int(buf, "", best_triplet->tpotind1_1)) continue; + else if (parse_int(buf, "", best_triplet->tpotind2_0)) continue; + else if (parse_int(buf, "", best_triplet->tpotind2_1)) continue; + else if (parse_int(buf, "", best_triplet->freq_bin)) continue; + else if (parse_double(buf, "", best_triplet->time_bin)) continue; + else if (parse_double(buf, "", best_triplet->scale)) continue; + else if (xml_match_tag(buf, " pot_min( + xml_decode_field(buf,"bt_pot_min") + ); + int i; + for (i=0; ipot_min[i] = pot_min[i]; + } + } // end Min PoT + else if (xml_match_tag(buf, " pot_max( + xml_decode_field(buf,"bt_pot_max") + ); + int i; + for (i=0; ipot_max[i] = pot_max[i]; + } + } // end Max PoT + } // end while in best_triplet + } // end if in best_triplet + + // Restore best functions that were determined earlier. + else if (parse_str(buf,"",fname)) { + int i; + for (i=0;i",fname)) { + int i; + for (i=0;i",fname)) { + int i; + for (i=0;i",fname)) { + int i; + for (i=0;i",fname)) { + int i; + for (i=0;iname)==0) { + CopyFoldSet(&Foldmain,FoldSubs[i].fsp); + found_folding=true; + break; + } + } + } + + } // end main parsing loop + + fclose(state_file); + + analysis_state.FLOP_counter=flops; + reload_graphics_state(); // so we can draw best_of signals + + // Adjust for restart - go 1 step beyond the checkpoint. + as.PoT_activity = PoT_activity; + if(PoT_freq_bin == -1) { + as.icfft = ncfft+1; + as.PoT_freq_bin = PoT_freq_bin; + } else { + as.icfft = ncfft; + as.PoT_freq_bin = PoT_freq_bin+1; + } + +// debug possible heap corruption -- jeffc +#ifdef _WIN32 +BOINCASSERT(_CrtCheckMemory()); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// On entry, analysis_state.data points to malloced data +// and outfile is not open. +// On exit, these are freed and closed +int seti_do_work() { + int retval=0; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("seti_do_work()"); +#endif + retval = seti_analyze(analysis_state); + free_a(analysis_state.data); + analysis_state.data = 0; + + if( swi.data_type == DATA_ENCODED ) { + free_a(analysis_state.savedWUData); + analysis_state.savedWUData = 0; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return retval; +} + +// on success, swi.data points to malloced data. +int seti_parse_data(FILE* f, ANALYSIS_STATE& state) { + unsigned long nbytes, nsamples,samples_per_byte; + sah_complex *data; + unsigned long i; + char *p, buf[256]; + sah_complex *bin_data=0; + int retval=0; + FORCE_FRAME_POINTER; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("seti_parse_data()"); +#endif + + nsamples = swi.nsamples; + samples_per_byte=(8/swi.bits_per_sample); + data = (sah_complex *)malloc_a(nsamples*sizeof(sah_complex), MEM_ALIGN); + bin_data = (sah_complex *)malloc_a(nsamples*sizeof(sah_complex), MEM_ALIGN); + if (!data) SETIERROR(MALLOC_FAILED, "!data"); + if (!bin_data) SETIERROR(MALLOC_FAILED, "!bin_data"); + + switch(swi.data_type) { + case DATA_ASCII: + for (i=0; i datav( + xml_decode_field(tmpbuf,"data") + ); + + memcpy(bin_data,&(datav[0]),datav.size()); + if (datav.size() < nbytes) throw BAD_DECODE; + } catch (int i) { + retval=i; + if (data) free_a(data); + if (bin_data) free_a(bin_data); + SETIERROR(i,"in seti_parse_data()"); + } + bits_to_floats((unsigned char *)bin_data, data, nsamples,swi.bits_per_sample); + memcpy(bin_data,data,nsamples*sizeof(sah_complex)); + state.savedWUData = bin_data; + break; + } + state.npoints = nsamples; + state.data = data; + +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) { + strlcpy(sah_graphics->wu.receiver_name,swi.receiver_cfg.name,255); + sah_graphics->wu.s4_id = swi.receiver_cfg.s4_id; + sah_graphics->wu.time_recorded = swi.time_recorded; + sah_graphics->wu.subband_base = swi.subband_base; + sah_graphics->wu.start_ra = swi.start_ra; + sah_graphics->wu.start_dec = swi.start_dec; + sah_graphics->wu.subband_sample_rate = swi.subband_sample_rate; + sah_graphics->ready = true; + } +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +int seti_parse_wu(FILE* f, ANALYSIS_STATE& state) { + int retval=0; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("seti_parse_wu()"); +#endif + retval = seti_parse_wu_header(f); + if (retval) SETIERROR(retval,"from seti_parse_wu_header()"); + retval=seti_parse_data(f, state); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return retval; +} + +void final_report() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("final_report()"); +#endif + if(verbose>0){ + { + int fft=(best_spike->s.fft_len>1024)?(best_spike->s.fft_len/1024):(best_spike->s.fft_len); + char symbol=(best_spike->s.fft_len>1024)?('k'):(' '); + fprintf(stderr,"\nBest spike: peak=%.7g, time=%.4g, d_freq=%.12g, chirp=%.5g, fft_len=%d%c\n", + best_spike->s.peak_power,(best_spike->s.time-swi.time_recorded)*86400,best_spike->s.detection_freq,best_spike->s.chirp_rate,fft,symbol); + } + if(swi.analysis_cfg.autocorr_fftlen){ + int fft=(best_autocorr->a.fft_len>1024)?(best_autocorr->a.fft_len/1024):(best_autocorr->a.fft_len); + char symbol=(best_autocorr->a.fft_len>1024)?('k'):(' '); + fprintf(stderr,"Best autocorr: peak=%.7g, time=%.4g, delay=%.5g, d_freq=%.12g, chirp=%.5g, fft_len=%d%c\n", + best_autocorr->a.peak_power,(best_autocorr->a.time-swi.time_recorded)*86400,best_autocorr->a.delay,best_autocorr->a.detection_freq, + best_autocorr->a.chirp_rate,fft,symbol); + } + { + int fft=(best_gauss->g.fft_len>1024)?(best_gauss->g.fft_len/1024):(best_gauss->g.fft_len); + char symbol=(best_gauss->g.fft_len>1024)?('k'):(' '); + fprintf(stderr,"Best gaussian: peak=%.7g, mean=%.7g, ChiSq=%.7g, time=%.4g, d_freq=%.12g,\n\tscore=%.7g, null_hyp=%.7g, chirp=%.5g, fft_len=%d%c\n", + best_gauss->g.peak_power,best_gauss->g.mean_power,best_gauss->g.chisqr,(best_gauss->g.time-swi.time_recorded)*86400,best_gauss->g.detection_freq, + best_gauss->score,best_gauss->g.null_chisqr,best_gauss->g.chirp_rate,fft,symbol); + } + { + int fft=(best_pulse->p.fft_len>1024)?(best_pulse->p.fft_len/1024):(best_pulse->p.fft_len); + char symbol=(best_pulse->p.fft_len>1024)?('k'):(' '); + fprintf(stderr,"Best pulse: peak=%.7g, time=%.4g, period=%.4g, d_freq=%.12g, score=%.4g, chirp=%.5g, fft_len=%d%c\n", + best_pulse->p.peak_power,(best_pulse->p.time-swi.time_recorded)*86400,best_pulse->p.period,best_pulse->p.detection_freq, + best_pulse->score,best_pulse->p.chirp_rate,fft,symbol); + } + { + int fft=(best_triplet->t.fft_len>1024)?(best_triplet->t.fft_len/1024):(best_triplet->t.fft_len); + char symbol=(best_triplet->t.fft_len>1024)?('k'):(' '); + fprintf(stderr,"Best triplet: peak=%.7g, time=%.4g, period=%.4g, d_freq=%.12g, chirp=%.5g, fft_len=%d%c\n", + best_triplet->t.peak_power,(best_triplet->t.time-swi.time_recorded)*86400,best_triplet->t.period,best_triplet->t.detection_freq, + best_triplet->t.chirp_rate,fft,symbol); + } + } + + fprintf(stderr,"\nFlopcounter: %f\n\n", analysis_state.FLOP_counter); + fprintf(stderr,"Spike count: %d\n", spike_count); + fprintf(stderr,"Autocorr count: %d\n", autocorr_count); + fprintf(stderr,"Pulse count: %d\n", pulse_count); + fprintf(stderr,"Triplet count: %d\n", triplet_count); + fprintf(stderr,"Gaussian count: %d\n", gaussian_count); + fflush(stderr); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +unsigned int pow2(unsigned int num){ +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("pow2()"); +#endif + unsigned int n = num > 0 ? num - 1 : 0; + n |= n >> 1; + n |= n >> 2; + n |= n >> 4; + n |= n >> 8; + n |= n >> 16; +#if SIZEOF_INT > 4 + n |= n >> 32; +#endif + n++; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return n >> 1; +} diff --git a/client/seti.h b/client/seti.h new file mode 100644 index 0000000..f2ba9f4 --- /dev/null +++ b/client/seti.h @@ -0,0 +1,267 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: seti.h,v 1.19.2.27 2007/08/10 00:38:49 korpela Exp $ +#ifndef _SETI_H +#define _SETI_H + +#ifdef _WIN32 +#include "boinc_win.h" +#endif +#include +#include "boinc_api.h" +#include "diagnostics.h" + +extern APP_INIT_DATA app_init_data; + +#include "analyze.h" +#ifndef AP_CLIENT +#include "seti_header.h" +#endif +#include "malloc_a.h" + +// Define 64 bit integer types. +#ifdef HAVE_INTTYPES_H +// Most gnu platforms +#include +typedef int64_t sh_sint8_t; +typedef uint64_t sh_uint8_t; + +#ifdef PRId64 +// If print formats are defined +#define SINT8_FMT "%"PRId64 +#define SINT8_FMT_CAST(x) (x) +#define UINT8_FMT "%"PRIu64 +#define UINT8_FMT_CAST(x) (x) +#else +// play it safe. It'll work through 49 bits at least. +#define SINT8_FMT "%20.0f" +#define SINT8_FMT_CAST(x) static_cast(x) +#define UINT8_FMT "%20.0f" +#define UINT8_FMT_CAST(x) static_cast(x) +#endif + +#elif SIZEOF_LONG_INT >= 8 +// other L64 +typedef long sh_sint8_t; +typedef unsigned long sh_uint8_t; +#define SINT8_FMT "%ld" +#define SINT8_FMT_CAST(x) (x) +#define UINT8_FMT "%lu" +#define UINT8_FMT_CAST(x) (x) + +#elif defined(LLONG_MAX) || defined(HAVE_LONG_LONG) +// systems with long long, but no inttypes.h +typedef long long sh_sint8_t; +typedef unsigned long long sh_uint8_t; +// again play it safe +#define SINT8_FMT "%20.0f" +#define SINT8_FMT_CAST(x) static_cast(x) +#define UINT8_FMT "%20.0f" +#define UINT8_FMT_CAST(x) static_cast(x) + +#elif defined(HAVE__INT64) || \ + (defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS >= 64)) +// Probably, but not necessarily MSC. +typedef _int64 sh_sint8_t; +typedef unsigned _int64 sh_uint8_t; +#ifdef _MSC_VER +// leave it to microsoft to be different. +#define SINT8_FMT "%I64d" +#define SINT8_FMT_CAST(x) (x) +#define UINT8_FMT "%I64u" +#define UINT8_FMT_CAST(x) (x) +#else +#define SINT8_FMT "%20.0f" +#define SINT8_FMT_CAST(x) static_cast(x) +#define UINT8_FMT "%20.0f" +#define UINT8_FMT_CAST(x) static_cast(x) +#endif + +#elif defined(HAVE_LONG_DOUBLE) +typedef long double sh_sint8_t; +typedef long double sh_uint8_t; +#define SINT8_FMT "%20.0lf" +#define SINT8_FMT_CAST(x) (x) +#define UINT8_FMT "%20.0lf" +#define UINT8_FMT_CAST(x) (x) + +#else +typedef double sh_sint8_t; +typedef double sh_uint8_t; +#define SINT8_FMT "%20.0f" +#define SINT8_FMT_CAST(x) static_cast(x) +#define UINT8_FMT "%20.0f" +#define UINT8_FMT_CAST(x) static_cast(x) + +#endif // HAVE_INTTYPES_H + +// make a consistent int32_t +#ifndef HAVE_INT32_T +#ifdef HAVE__INT32 +typedef _int32 int32_t; +#else +typedef long int32_t; +#endif +#endif + + +#ifdef HAVE_MALLOC_H +#include +#endif +#ifdef HAVE_MEMORY_H +#include +#endif +#ifdef HAVE_ALLOCA_H +#include +#endif + +// Adjustement to flops counter to make FLOPS include floating point loads and +// stores. +extern double LOAD_STORE_ADJUSTMENT; +extern double SETUP_FLOPS; + + +typedef float sah_complex[2]; + +struct ANALYSIS_STATE { + sah_complex *data; + sah_complex *savedWUData; // Save the original WU data + int npoints; + int icfft; + int PoT_freq_bin; // where we are in PoT analysis for this icfft + // ... will be -1 if no PoT analysis in progress + int PoT_activity; + int doing_pulse; + double FLOP_counter; +}; + +extern bool notranspose_flag; +extern bool default_functions_flag; +extern int verbose; +extern int seti_init_state(); +extern int seti_do_work(); +extern int result_group_start(); +extern int result_group_write_header(); +extern int result_group_end(); +extern int checkpoint(BOOLEAN force_checkpoint=0); +extern int seti_parse_wu(FILE*, ANALYSIS_STATE&); +extern int parse_state_file(ANALYSIS_STATE& as); +extern void final_report(); + +extern ANALYSIS_STATE analysis_state; +#ifndef AP_CLIENT +extern SETI_WU_INFO swi; +#endif + +#ifdef BOINC_APP_GRAPHICS +#include "reduce.h" +#include "graphics2.h" +#endif + +#ifndef AP_CLIENT +struct SPIKE_INFO : public track_mem { +public : + SPIKE_INFO(); + ~SPIKE_INFO(); + SPIKE_INFO(const SPIKE_INFO &si); + SPIKE_INFO &operator =(const SPIKE_INFO &si); + spike s; + double score; // calc in ReportEvents() + int bin; // assigned in ReportEvents() + int fft_ind; // assigned in ReportEvents() +}; + +struct AUTOCORR_INFO : public track_mem { +public : + AUTOCORR_INFO(); + ~AUTOCORR_INFO(); + AUTOCORR_INFO(const AUTOCORR_INFO &si); + AUTOCORR_INFO &operator =(const AUTOCORR_INFO &si); + autocorr a; + double score; // calc in ReportEvents() + int bin; // assigned in ReportEvents() + int fft_ind; // assigned in ReportEvents() +}; + +struct GAUSS_INFO : public track_mem { +public : + GAUSS_INFO(); + ~GAUSS_INFO(); + GAUSS_INFO(const GAUSS_INFO &gi); + GAUSS_INFO &operator =(const GAUSS_INFO &gi); + gaussian g; + double score; // calc in ReportGaussEvent() + double display_power_thresh; // calc in gaussfit() + int bin; // assigned in ReportGaussEvent() + int fft_ind; // assigned in ReportGaussEvent() + //float * pot; +}; + +struct PULSE_INFO : public track_mem { +public : + PULSE_INFO(); + ~PULSE_INFO(); + PULSE_INFO(const PULSE_INFO &pi); + PULSE_INFO &operator =(const PULSE_INFO &pi); + pulse p; + double score; // calc in ReportPulseEvent() + int freq_bin; // assigned in ReportPulseEvent() + int time_bin; // assigned in ReportPulseEvent() + unsigned int * pot_min; // Scaled 0-255 for display + unsigned int * pot_max; // Scaled 0-255 for display +}; + +struct TRIPLET_INFO : public track_mem { +public : + TRIPLET_INFO(); + ~TRIPLET_INFO(); + TRIPLET_INFO(const TRIPLET_INFO &ti); + TRIPLET_INFO &operator =(const TRIPLET_INFO &ti); + triplet t; + double score; // assigned in ReportTripletEvent() + double bperiod; // probably deprecated - remove sometime + int freq_bin; // assigned in ReportTripletEvent() + // ticks below assigned in ReportTripletEvent() + int tpotind0_0; // index into pot_min/pot_max arrays + int tpotind0_1; // of start/end of first element of triplet + int tpotind1_0; // second element + int tpotind1_1; + int tpotind2_0; // and third element + int tpotind2_1; + double time_bin; // calc in ReportTripletEvent() + double scale; // Scale from PoT bins to TRIPLET_POT_LEN + unsigned int * pot_min; // Scaled 0-255 for display + unsigned int * pot_max; // Scaled 0-255 for display +}; +#endif +#define UNSTDMAX(a,b) (((a) > (b)) ? (a) : (b)) +#define UNSTDMIN(a,b) (((a) < (b)) ? (a) : (b)) + +unsigned int pow2(unsigned int num); + +#endif diff --git a/client/seti_header.cpp b/client/seti_header.cpp new file mode 100644 index 0000000..c5014bd --- /dev/null +++ b/client/seti_header.cpp @@ -0,0 +1,336 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +/* + * + * $Id: seti_header.cpp,v 1.22.2.6 2007/05/31 22:03:11 korpela Exp $ + * + */ + +#include "sah_config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "diagnostics.h" +#include "util.h" +#include "s_util.h" + +#ifdef HAVE_IEEEFP_H +#include +#endif + +#include "seti.h" +#include "analyze.h" +#include "timecvt.h" +#include "parse.h" +#include "../db/db_table.h" +#include "../db/schema_master.h" +#include "seti_header.h" +#include "analyzePoT.h" +#include "analyzeReport.h" +#include "chirpfft.h" +#ifdef __arm__ +#include "vector/fp_arm.h" +#endif + +// Write a SETI work unit header to a file + +char *receivers[]={"invalid","synthetic","ao1420"}; +char *datatypes[]={"invalid","ascii","encoded","sun_binary"}; + +SETI_WU_INFO::SETI_WU_INFO(const workunit &w) : + track_mem("SETI_WU_INFO"), + data_class(0), + start_ra(w.group_info->data_desc.start_ra), + start_dec(w.group_info->data_desc.start_dec), + end_ra(w.group_info->data_desc.end_ra), + end_dec(w.group_info->data_desc.end_dec), + true_angle_range(w.group_info->data_desc.true_angle_range), + time_recorded(w.group_info->data_desc.time_recorded_jd), + subband_center(w.subband_desc.center), + subband_base(w.subband_desc.base), + subband_sample_rate(w.subband_desc.sample_rate), + fft_len(w.group_info->splitter_cfg->fft_len), + ifft_len(w.group_info->splitter_cfg->ifft_len), + subband_number(w.subband_desc.number), + receiver_cfg(w.group_info->receiver_cfg), + nsamples(w.group_info->data_desc.nsamples), + bits_per_sample(w.group_info->splitter_cfg->wu_bits_per_sample), + position_history(w.group_info->data_desc.coords.begin()), + num_positions(w.group_info->data_desc.coords.size()), + analysis_cfg(w.group_info->analysis_cfg), + beam_width(w.group_info->receiver_cfg->beam_width), +wu(&w) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("SETI_WU_INFO::SETI_WU_INFO(const workunit &w)"); +#endif /* USE_MANUAL_CALLSTACK */ + // Adjust beam width for frequency + beam_width*=(w.group_info->receiver_cfg->center_freq*1e+6/subband_center); + if (bits_per_sample == 0) bits_per_sample=2; + + if (!strcmp(w.group_info->splitter_cfg->data_type,"ascii")) data_type = DATA_ASCII; + else if (!strcmp(w.group_info->splitter_cfg->data_type,"encoded")) data_type = DATA_ENCODED; + else if (!strcmp(w.group_info->splitter_cfg->data_type,"sun_binary")) data_type = DATA_SUN_BINARY; + splitter_version=(int)floor(w.group_info->splitter_cfg->version)*0x100; + splitter_version+=(int)((w.group_info->splitter_cfg->version)*0x100) & 0xff; + angle_range=true_angle_range; + sprintf(tape_version,"%8.2f",w.group_info->recorder_cfg->version); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ +} + +SETI_WU_INFO::SETI_WU_INFO() : + track_mem("SETI_WU_INFO"), + data_class(0), + start_ra(0), + start_dec(0), + end_ra(0), + end_dec(0), + true_angle_range(0), + time_recorded(0), + subband_center(0), + subband_base(0), + subband_sample_rate(0), + fft_len(0), + ifft_len(0), + subband_number(0), + nsamples(0), + bits_per_sample(2), + position_history(), + num_positions(0), + beam_width(0) +{ + data_type = DATA_ASCII; + splitter_version=0; + angle_range=0; + tape_version[0]=0; +} +SETI_WU_INFO::SETI_WU_INFO(const SETI_WU_INFO &s) : + track_mem("SETI_WU_INFO"), + data_type(s.data_type), + data_class(s.data_class), + splitter_version(s.splitter_version), + start_ra(s.start_ra), + start_dec(s.start_dec), + end_ra(s.end_ra), + end_dec(s.end_dec), + angle_range(s.true_angle_range), + true_angle_range(s.true_angle_range), + time_recorded(s.time_recorded), + subband_center(s.subband_center), + subband_base(s.subband_base), + subband_sample_rate(s.subband_sample_rate), + fft_len(s.fft_len), + ifft_len(s.ifft_len), + subband_number(s.subband_number), + receiver_cfg(s.receiver_cfg), + nsamples(s.nsamples), + bits_per_sample(s.bits_per_sample), + position_history(s.position_history), + num_positions(s.num_positions), + analysis_cfg(s.analysis_cfg), + beam_width(s.beam_width), +wu(s.wu) { + strcpy(tape_version,s.tape_version); +} + +int seti_write_wu_header(FILE *file, int output_xml) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("seti_write_wu_header()"); +#endif /* USE_MANUAL_CALLSTACK */ + + fprintf(file,"%s",swi.wu->print_xml().c_str()); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ + return 0; +} + +int seti_write_wu_header(FILE *file, int output_xml, SETI_WU_INFO &swi) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("seti_write_wu_header()"); +#endif /* USE_MANUAL_CALLSTACK */ + + fprintf(file,"%s",swi.wu->print_xml().c_str()); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ + return 0; +} + +SETI_WU_INFO swi; + +static workunit *wu; + +int seti_parse_wu_header(FILE* f) { + char buf[256]; + int found=0; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("seti_parse_wu_header(FILE *)"); +#endif /* USE_MANUAL_CALLSTACK */ + + std::string buffer(""); + buffer.reserve(10*1024); + + swi.data_type=0; + + // Allow old style headers to be parsed correctly. + // jeffc - need this? + //swi.fft_len=2048; + //swi.ifft_len=8; + + do { + fgets(buf, 256, f); + } while (!feof(f) && !xml_match_tag(buf,"= 0) { + return (int)(nbins*freq/sample_rate); + } else { + return (int)(nbins/2-(freq/sample_rate)); + } +} + +float cnvt_fftind_time(int fft_ind, int fft_len) { + return (float)(fft_ind*(fft_len/swi.subband_sample_rate)); +} + +float cnvt_gauss_offset_time(int offset) { + float dur = (float)(swi.nsamples/swi.subband_sample_rate); + return (float)(offset*dur/swi.analysis_cfg.gauss_pot_length); +} + +// need to properly handle frequency rollover when calculating detection +// frequency +double calc_detection_freq(double freq, double chirp_rate, double t_offset) { + double fft_ratio=1.0/swi.wu->group_info->splitter_cfg->ifft_len; + double lowerlim=swi.subband_base-0.5*swi.subband_sample_rate*fft_ratio; + double upperlim=lowerlim+swi.subband_sample_rate; + double detection_freq=freq+chirp_rate*t_offset; + while (detection_freq < lowerlim) detection_freq+=swi.subband_sample_rate; + while (detection_freq > upperlim) detection_freq-=swi.subband_sample_rate; + return detection_freq; +} diff --git a/client/seti_header.h b/client/seti_header.h new file mode 100644 index 0000000..6b82c05 --- /dev/null +++ b/client/seti_header.h @@ -0,0 +1,132 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +/* + * + * $Id: seti_header.h,v 1.7.2.5 2007/05/31 22:03:11 korpela Exp $ + * + */ + +#ifndef SETI_HEADER_H +#define SETI_HEADER_H + +#ifndef _WIN32 +#include +#include +#endif + +#include "timecvt.h" +#include "db/db_table.h" +#include "db/schema_master.h" +#undef USE_MYSQL + +#define SRC_SYNTHETIC 1 +#define SRC_ARECIBO_1420 2 +#define NUM_SRCS 3 + +#define DATA_ASCII 1 +#define DATA_ENCODED 2 +#define DATA_SUN_BINARY 3 + +#define MAX_SCOPE_STRINGS 32 +#define MAX_NUM_FFTS 64 +#define MAX_CFFT_PARAMS 2 + +// Variables of type ChirpFftTable_t (usually an array of such +// variables) indicate a range of chirp rates and the FFT +// lenghts (spectral resolutions) that we wish to process within +// said chirp range. +typedef struct { + double MaxChirpRate; + // Upper bound for this range. + // Lower bound is MaxChirpRate of the previous + // ChirpFftTable_t element. Lower bound + // of first ChirpFftTable_t element is assumed to be zero. + unsigned char DoFft[MAX_NUM_FFTS]; // Boolean - do this FFT length while in + // this chirp range +} +ChirpFftTable_t; + + +struct SCOPE_STRING : public track_mem { + TIME st; + double alt, az; + double ra, dec; + SCOPE_STRING() : track_mem("SCOPE_STRING") {} +}; + +struct SETI_WU_INFO : public track_mem { + int data_type; + int data_class; + int splitter_version; + double start_ra; // 0 .. 24 + double start_dec; // -90 .. 90 + double end_ra; + double end_dec; + double angle_range; // in degrees (only for 0.1 degree beam) + double true_angle_range; // in degrees + double time_recorded; // in Julian form + double subband_center; // Hz This parameter is deprecated in favor of + // subband_base + double subband_base; // center freq of bin 0. + double subband_sample_rate; + int fft_len; + int ifft_len; + int subband_number; + receiver_config receiver_cfg; + unsigned long nsamples; + unsigned int bits_per_sample; + std::vector::const_iterator position_history; + size_t num_positions; // number_of_positions in history array + char tape_version[16]; + analysis_config analysis_cfg; + int num_fft_lengths; + int analysis_fft_lengths[32]; + double beam_width; + ChirpFftTable_t chirp_fft_table[MAX_CFFT_PARAMS]; + const workunit *wu; + SETI_WU_INFO(); + SETI_WU_INFO(const workunit &w); + SETI_WU_INFO(const SETI_WU_INFO &s); +}; + +extern int seti_write_wu_header(FILE*, int); +extern int seti_write_wu_header(FILE*, int, SETI_WU_INFO swi); +extern int seti_parse_wu_header(FILE*); +extern int seti_parse_wu_header(FILE*, SETI_WU_INFO &swi); + +extern float cnvt_fftlen_hz(int); +extern double cnvt_bin_hz(int, int); +extern double cnvt_bin_hz_offset(int, int); +extern float cnvt_fftind_time(int, int); +extern float cnvt_gauss_offset_time(int offset); +extern int cnvt_hz_bin(float freq, float sample_rate, int nbins); +extern double calc_detection_freq(double freq, double chirp_rate, double + t_offset); + +#endif + diff --git a/client/sincos.h b/client/sincos.h new file mode 100644 index 0000000..161f840 --- /dev/null +++ b/client/sincos.h @@ -0,0 +1,102 @@ +// Copyright 2005 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// seti.C +// $Id: sincos.h,v 1.2.2.2 2005/06/26 19:55:47 korpela Exp $ +// + + +/* Implement the sincos[f] function on machines that don't have it */ +#ifndef _SINCOS_H_ +#define _SINCOS_H_ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These are outside of the #ifndefs because on some machines sinf and cosf */ +/* are in libstdc++, but are not defined in the system header . */ +void sincos(double angle, double *s, double *c); +void sincosf(float angle, float *s, float *c); +float sinf(float angle); +float cosf(float angle); +float atanf(float angle); + +#ifndef HAVE_SINCOSF +inline void sincosf(float angle, float *s, float *c) { +/* do we have sincos? If so use it since it's likely to */ +/* be faster than separate computation */ +#ifdef HAVE_SINCOS + float sd,cd; + sincos(angle,&sd,&cd); + *s=(float)sd; + *c=(float)cd; +/* if we don't have sincos, how about sinf and cosf? */ +#elif defined(HAVE_SINF) && defined(HAVE_COSF) + *s=sinf(angle); + *c=cosf(angle); +/* as a last resort, compute the old fashioned way */ +#else + *s=(float)sin(angle); + *c=(float)cos(angle); +#endif +} +#endif + +#ifndef HAVE_SINCOS +inline void sincos(double angle, double *s, double *c) { +/* this is the obvious implementation. Is there a */ +/* better trickier way? */ + *s=sin(angle); + *c=cos(angle); +} +#endif + +#ifndef HAVE_SINF +inline float sinf(float angle) { + return (float)sin(angle); +} +#endif + +#ifndef HAVE_COSF +inline float cosf(float angle) { + return (float)cos(angle); +} +#endif + +#ifndef HAVE_ATANF +inline float atanf(float angle) { + return (float)atan(angle); +} +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/client/spike.cpp b/client/spike.cpp new file mode 100644 index 0000000..4f75186 --- /dev/null +++ b/client/spike.cpp @@ -0,0 +1,163 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + + +#include "sah_config.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOINC_APP_GRAPHICS +#include "graphics2.h" +#endif + +#include "util.h" +#include "s_util.h" +#include "analyze.h" +#include "gaussfit.h" +#include "seti.h" +#include "chirpfft.h" +#include "analyzeReport.h" +#include "analyzePoT.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + +#include "../db/schema_master.h" + +int FindSpikes( + float * fp_PowerSpectrum, + int ul_NumDataPoints, + int fft_num, + SETI_WU_INFO& swi +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("FindSpikes()"); +#endif + //int i, j, k, m, bin, retval; + int i, j, k, m, retval, blksize; + float temp, partial; + //float total, MeanPower, spike_score; + float total, MeanPower; + SPIKE_INFO si; + + i = j = k = m = 0; + total = 0.0f; + blksize = UNSTDMAX(8, UNSTDMIN(pow2((unsigned int) sqrt((float) (ul_NumDataPoints / 32)) * 32), 512)); + + for(int b = 0; b < ul_NumDataPoints/blksize; b++) { + partial = 0.0f; + for(i = 0; i < blksize; i++) { + partial += fp_PowerSpectrum[b*blksize+i]; + } + total += partial; + } + MeanPower = total / ul_NumDataPoints; + + // Here we extract the spikes_to_report highest power events, + // outputing them as we go. + // Index usage: + // i : walk power spectrum us_NumToReport times + // j : walks power spectrum for each i + // k : marks current high power candidate while j walks on + // m : marks the current tail of the high power hit "list" + + + for (i = 0; i < swi.analysis_cfg.spikes_per_spectrum; i++) { + + temp = 0.0; + + // Walk the array, looking for the first/next highest power. + // Start j at 1, in order to skip the DC (ie 0) bin. + // NOTE: this is a simple scan for high powers. Nice and fast + // for a very low i. If i is substantial, this code should be + // replaced with an index (q)sort. Do *not* sort the power + // spectrum itself in place - it's used elsewhere. + for (j = 1; j < ul_NumDataPoints; j++) { + + if (fp_PowerSpectrum[j] > temp) { + if (fp_PowerSpectrum[j] < fp_PowerSpectrum[m] || m == 0) { + temp = fp_PowerSpectrum[j]; + k = j; + } + } + } // temp now = first/next highest power and k = it's bin number + + m = k; // save the "lowest" highest. + + // spike info + si.s.peak_power = temp/MeanPower; + si.s.mean_power = 1.0; + si.bin = k; + si.fft_ind = fft_num; + si.s.chirp_rate = ChirpFftPairs[analysis_state.icfft].ChirpRate; + si.s.fft_len = ChirpFftPairs[analysis_state.icfft].FftLen; + si.s.freq = cnvt_bin_hz(si.bin, si.s.fft_len); + double t_offset=((double)si.fft_ind+0.5)*(double)si.s.fft_len/ + swi.subband_sample_rate; + si.s.detection_freq=calc_detection_freq(si.s.freq,si.s.chirp_rate,t_offset); + si.s.time = swi.time_recorded + t_offset / 86400.0; + time_to_ra_dec(si.s.time, &si.s.ra, &si.s.decl); + + // Score used for "best of" and graphics. + si.score = si.s.peak_power / SPIKE_SCORE_HIGH; + si.score = si.score > 0.0 ? log10(si.score) : -12.0; + // if best_spike.s.fft_len == 0, there is not yet a first spike + if (si.score > best_spike->score || best_spike->s.fft_len == 0) { + *best_spike = si; + if(verbose>=2){ + fprintf(stderr,"New best spike:score:%.5g, power: %.5g, index=%d, fft_len=%d, ifft=%d,icfft=%d\n", + si.score,si.s.peak_power,si.bin,si.s.fft_len,si.fft_ind,analysis_state.icfft); + } +#ifdef BOINC_APP_GRAPHICS + if (!nographics()) sah_graphics->si.copy(&si); +#endif + } + + // Report a signal if it excceeds threshold. + if (si.s.peak_power > (swi.analysis_cfg.spike_thresh)) { + if(verbose>=1){ + int fft=(si.s.fft_len>1024)?(si.s.fft_len/1024):(si.s.fft_len); + char symbol=(si.s.fft_len>1024)?('k'):(' '); + fprintf(stderr,"Spike: peak=%.7g, time=%.4g, d_freq=%.12g, chirp=%.5g, fft_len=%d%c\n", + si.s.peak_power,(si.s.time-swi.time_recorded)*86400,si.s.detection_freq,si.s.chirp_rate,fft,symbol); + } + retval = result_spike(si); + if (retval) SETIERROR(retval,"from result_spike()"); + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + diff --git a/client/spike.h b/client/spike.h new file mode 100644 index 0000000..a4bc31e --- /dev/null +++ b/client/spike.h @@ -0,0 +1,34 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +int FindSpikes( + float * fp_PowerSpectrum, + int ul_NumDataPoints, + int fft_num, + SETI_WU_INFO& swi +); + diff --git a/client/test_workunits/init_data.xml b/client/test_workunits/init_data.xml new file mode 100644 index 0000000..4578808 --- /dev/null +++ b/client/test_workunits/init_data.xml @@ -0,0 +1,77 @@ + +0 +0 +0 +0 +987 +0 +0.000000 +0.000000 +0.000000 +0.000000 +0.000000 +60.000000 +0.000000 +0.000000 +0.000000 +0.000000 +0.000000 +0.000000 +0.000000 + + 0 + + + + 0 + + + + 0.000000 + 0.000000 + 0.000000 + 0.000000 + 134217728.000000 + 0.000000 + 0.000000 + 0.000000 + 0.000000 + + + + + + 0 + + 0 + + 0 + + + + + + + 0 + 0.000000 + 0.000000 + 0.000000 + 0.000000 + 0.000000 + 0.000010 + 0.250000 + 1 + 60.000000 + 0.000000 + 0.000000 + 0.000000 + 0.000000 + 0.000000 + 50.000000 + 90.000000 + 0.000000 + 1000000000000.000000 + 1000000000000.000000 + 100.000000 + + diff --git a/client/test_workunits/reference_result_unit.sah b/client/test_workunits/reference_result_unit.sah new file mode 100644 index 0000000..bd18166 --- /dev/null +++ b/client/test_workunits/reference_result_unit.sah @@ -0,0 +1,763 @@ + + + reference.wu + + + + 0 + 0 + 0 + 0 + 0 + 0 + + reference_group + + 14.853 + 28.55 + 14.911 + 28.58 + 0.775 + Fri Mar 3 08:36:01 2000 + 2451606.85836 + 1048576 + + + + 14.853 + 28.55 + + + + 14.856 + 28.56 + + + + 14.858 + 28.56 + + + + 14.861 + 28.56 + + + + 14.864 + 28.56 + + + + 14.867 + 28.56 + + + + 14.869 + 28.56 + + + + 14.872 + 28.56 + + + + 14.875 + 28.56 + + + + 14.878 + 28.57 + + + + 14.881 + 28.57 + + + + 14.883 + 28.57 + + + + 14.886 + 28.57 + + + + 14.889 + 28.57 + + + + 14.892 + 28.57 + + + + 14.895 + 28.57 + + + + 14.897 + 28.57 + + + + 14.9 + 28.57 + + + + 14.903 + 28.58 + + + + 14.906 + 28.58 + + + + 14.909 + 28.58 + + + + 14.911 + 28.58 + + + + + 1 + ao_1420 + 0.1 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 0 + + 7.4,5.4,-49.1,-1091,0,0,0,0,0,0,0,0,0 + + + -5146.7,66.1,14.3,317.7,0,0,0,0,0,0,0,0,0 + + 0 + 0 + 0 + 0 + + + sah_recorder + 2 + 2500000 + 0 + 1.4 + + + 0.17 + encoded + 2048 + 8 + fft + hanning + 1048576 + 0 + randomize + 16 + 1.04999995 + 2 + + + 22 + 1 + 17.8 + 1 + 131072 + 2.1 + 1.42 + 3 + 3.2 + 64 + 20 + 0.5 + 40960 + 16 + 8192 + 256 + 8.25 + 131072 + 16 + 256 + 0.5 + 1 + 0.0021 + 0.0105 + 0.333 + 262136 + 8192 + 32768 + + + 20 + 262136 + + + 50 + 65528 + + + 1 + 30 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + 0 + 0 + 0 + + + 145 +
1418920288.09
+ 1418916015.62 + 9765.62 +
+0 +
+ + 8.6426544189453 + 0.0078867627307773 + + 14.89751995747 + 28.57 + 0 + 1418924789.4192 + 1418924863.1228 + 0 + 128 + 0.9168656437853 + 0 + 0 + 0 + 0.54394906759262 + + + 22.395553588867 + 1 + + 14.909502836654 + 28.58 + 0 + 1418919354.6705 + 1418919461.2933 + 0 + 131072 + 1.0592016409052 + 0 + 0 + 0 + + + 22.535062789917 + 1 + + 14.909502836654 + 28.58 + 0 + 1418919354.298 + 1418919461.2929 + 0 + 131072 + 1.0628986797914 + 0 + 0 + 0 + + + 22.378698348999 + 1 + + 14.871418063004 + 28.56 + 0 + 1418917122.4032 + 1418917201.1763 + 0 + 131072 + 2.3476196927567 + 0 + 0 + 0 + + + 22.364013671875 + 1 + + 14.906409847822 + 28.58 + 0 + 1418923767.2001 + 1418924030.2402 + 0 + 32768 + 2.7505969313559 + 0 + 0 + 0 + + + 22.462213516235 + 1 + + 14.906409847822 + 28.58 + 0 + 1418923761.5376 + 1418924030.2345 + 0 + 32768 + 2.8097495535356 + 0 + 0 + 0 + + + 22.140769958496 + 1 + + 14.90148701969 + 28.574956732299 + 0 + 1418918761.3811 + 1418918419.0097 + 0 + 131072 + -3.9244067777343 + 0 + 0 + 0 + + + 22.104068756104 + 1 + + 14.864150850996 + 28.56 + 0 + 1418916487.2415 + 1418916408.0466 + 0 + 131072 + -3.9336493749498 + 0 + 0 + 0 + + + 23.334712982178 + 1 + + 14.864150850996 + 28.56 + 0 + 1418916487.316 + 1418916408.0467 + 0 + 131072 + -3.9373464138361 + 0 + 0 + 0 + + + 23.518535614014 + 1 + + 14.864150850996 + 28.56 + 0 + 1418916487.3905 + 1418916408.0468 + 0 + 131072 + -3.9410434527223 + 0 + 0 + 0 + + + 22.629072189331 + 1 + + 14.864150850996 + 28.56 + 0 + 1418916487.465 + 1418916408.0469 + 0 + 131072 + -3.9447404916085 + 0 + 0 + 0 + + + 22.818777084351 + 1 + + 14.856922413057 + 28.56 + 0 + 1418918910.9886 + 1418918946.4799 + 0 + 131072 + 5.2886141267535 + 0 + 0 + 0 + + + 23.786548614502 + 1 + + 14.856922413057 + 28.56 + 0 + 1418918910.9886 + 1418918946.4924 + 0 + 131072 + 5.2904626461966 + 0 + 0 + 0 + + + 17.814907073975 + 1 + + 14.856922413057 + 28.56 + 0 + 2.6451981543415 + 1418920288.09 + 1418920199.1446 + 0 + 131072 + -13.253884407138 + 0 + 0 + 0 + + + 22.051849365234 + 1 + + 14.879185317697 + 28.57 + 0 + 1418924855.9529 + 1418924025.883 + 0 + 131072 + -17.669997356741 + 0 + 0 + 0 + + + 10.885553359985 + 0.0038262107409537 + + 14.859288741085 + 28.56 + 0 + 1418919067.3762 + 1418918701.9642 + 0 + 64 + -31.14940113594 + 0 + 0 + 0 + 4.2041363716125 + + + 3.1083626747131 + 0.57625639438629 + + 14.883054389246 + 28.57 + 0 + 1418915821.905 + 1418917957.8961 + 0 + 16384 + 39.173824038504 + 0 + 0 + 0 + 3.5095455646515 + 1.4116749763489 + 2.1085500717163 + 0 + 9.5103559494019 + + 7,9,13,28,18,7,3,7,1,0,28,33,5,1,8,15,13,12,2,14,13,2,6,57,14,9,0,22,0, + 59,2,63,255,200,71,60,24,83,75,2,52,31,0,6,11,27,7,0,1,21,3,62,1,41,52, + 2,19,3,17,8,24,41,28,18 + + + + + 3.3304581642151 + 0.56233322620392 + + 14.884025293173 + 28.57 + 0 + 1418915821.905 + 1418918023.6189 + 0 + 16384 + 39.173824038504 + 0 + 0 + 0 + 3.5095455646515 + 1.3641883134842 + 2.1419405937195 + 0 + 9.5103559494019 + + 7,9,13,28,18,7,3,7,1,0,28,33,5,1,8,15,13,12,2,14,13,2,6,57,14,9,0,22,0, + 59,2,63,255,200,71,60,24,83,75,2,52,31,0,6,11,27,7,0,1,21,3,62,1,41,52, + 2,19,3,17,8,24,41,28,18 + + + + + 3.202214717865 + 0.56919771432877 + + 14.884996197099 + 28.57 + 0 + 1418915821.905 + 1418918089.3417 + 0 + 16384 + 39.173824038504 + 0 + 0 + 0 + 3.5095455646515 + 1.411563873291 + 2.1597337722778 + 0 + 9.5103559494019 + + 7,9,13,28,18,7,3,7,1,0,28,33,5,1,8,15,13,12,2,14,13,2,6,57,14,9,0,22,0, + 59,2,63,255,200,71,60,24,83,75,2,52,31,0,6,11,27,7,0,1,21,3,62,1,41,52, + 2,19,3,17,8,24,41,28,18 + + + + + 3.2735865116119 + 0.52121621370316 + + 14.896431365397 + 28.57 + 0 + 1418916015.024 + 1418919872.9451 + 0 + 16384 + 49.451592142226 + 0 + 0 + 0 + 3.5095455646515 + 1.3751286268234 + 2.3200657367706 + 0 + 9.5516929626465 + + 13,63,10,5,12,6,7,5,8,8,2,14,6,24,41,10,22,5,4,20,13,0,12,18,27,12,12, + 16,18,9,29,1,1,28,7,2,13,1,1,32,47,96,9,4,4,71,193,127,255,87,35,42,12, + 28,12,5,22,12,19,27,10,11,26,18 + + + + + 3.6199193000793 + 0.51788127422333 + + 14.897117952021 + 28.57 + 0 + 1418916015.024 + 1418919955.9112 + 0 + 16384 + 49.451592142226 + 0 + 0 + 0 + 3.5095455646515 + 1.2605501413345 + 2.2607674598694 + 0 + 9.5516929626465 + + 13,63,10,5,12,6,7,5,8,8,2,14,6,24,41,10,22,5,4,20,13,0,12,18,27,12,12, + 16,18,9,29,1,1,28,7,2,13,1,1,32,47,96,9,4,4,71,193,127,255,87,35,42,12, + 28,12,5,22,12,19,27,10,11,26,18 + + + + + 3.5863273143768 + 0.52562576532364 + + 14.898088855948 + 28.57 + 0 + 1418916015.024 + 1418920038.8772 + 0 + 16384 + 49.451592142226 + 0 + 0 + 0 + 3.5095455646515 + 1.3370245695114 + 2.2789671421051 + 0 + 9.5516929626465 + + 13,63,10,5,12,6,7,5,8,8,2,14,6,24,41,10,22,5,4,20,13,0,12,18,27,12,12, + 16,18,9,29,1,1,28,7,2,13,1,1,32,47,96,9,4,4,71,193,127,255,87,35,42,12, + 28,12,5,22,12,19,27,10,11,26,18 + + + + + 23.786548614502 + 1 + + 14.856922413057 + 28.56 + 0 + 1418918910.9886 + 1418918946.4924 + 0 + 131072 + 5.2904626461966 + 0 + 0 + 0 + + + 17.814907073975 + 1 + + 14.856922413057 + 28.56 + 0 + 2.6451981543415 + 1418920288.09 + 1418920199.1446 + 0 + 131072 + -13.253884407138 + 0 + 0 + 0 + + + 3.6199193000793 + 0.51788127422333 + + 14.897117952021 + 28.57 + 0 + 1418916015.024 + 1418919955.9112 + 0 + 16384 + 49.451592142226 + 0 + 0 + 0 + 3.5095455646515 + 1.2605501413345 + 2.2607674598694 + 0 + 9.5516929626465 + + 13,63,10,5,12,6,7,5,8,8,2,14,6,24,41,10,22,5,4,20,13,0,12,18,27,12,12, + 16,18,9,29,1,1,28,7,2,13,1,1,32,47,96,9,4,4,71,193,127,255,87,35,42,12, + 28,12,5,22,12,19,27,10,11,26,18 + + + + 5.9889302253723 + 0.033245835453272 + + 14.907301879412 + 28.58 + 0 + 1418921813.9569 + 1418918839.5513 + 0 + 512 + -30.690968314047 + 0 + 0 + 0 + 2.3592972755432 + 13.391654968262 + 13.4002161026 + 0 + 45 + + 40,10,41,34,32,255,28,55,33,38,21,22,40,30,23,22,36,43,16,21,21,11,17, + 23,12,17,38,26,0,23,53,24,25,21,15,29,3,22,46,34,36,31,28,26,51 + + + + 10.885553359985 + 0.0038262107409537 + + 14.859288741085 + 28.56 + 0 + 1418919067.3762 + 1418918701.9642 + 0 + 64 + -31.14940113594 + 0 + 0 + 0 + 4.2041363716125 + +8.00 +
\ No newline at end of file diff --git a/client/test_workunits/reference_work_unit.sah b/client/test_workunits/reference_work_unit.sah new file mode 100644 index 0000000..26efee8 --- /dev/null +++ b/client/test_workunits/reference_work_unit.sah @@ -0,0 +1,5676 @@ + +setiathome_v8 + +reference.wu + + reference_group + + 14.853 + 28.55 + 14.911 + 28.58 + 0.775 + Fri Mar 3 08:36:01 2000 + 2451606.85836 + 1048576 + + + + 14.853 + 28.55 + + + + 14.856 + 28.56 + + + + 14.858 + 28.56 + + + + 14.861 + 28.56 + + + + 14.864 + 28.56 + + + + 14.867 + 28.56 + + + + 14.869 + 28.56 + + + + 14.872 + 28.56 + + + + 14.875 + 28.56 + + + + 14.878 + 28.57 + + + + 14.881 + 28.57 + + + + 14.883 + 28.57 + + + + 14.886 + 28.57 + + + + 14.889 + 28.57 + + + + 14.892 + 28.57 + + + + 14.895 + 28.57 + + + + 14.897 + 28.57 + + + + 14.900 + 28.57 + + + + 14.903 + 28.58 + + + + 14.906 + 28.58 + + + + 14.909 + 28.58 + + + + 14.911 + 28.58 + + + + + 1 + ao_1420 + 0.10000 + 1420.0 + 18.3538056 + -66.7552222 + 497.0 + 168.0 + 0.0 + 7.4,5.4,-49.1,-1091.0,0,0,0,0,0,0,0,0,0 + -5146.7,66.1,14.3,317.7,0,0,0,0,0,0,0,0,0 + + + sah_recorder + 2 + 2500000.0 + 1.40 + + + 0.17 + encoded + 2048 + 8 + fft + hanning + 1048576 + 0 + randomize + 16 + 1.04999995 + 2 + + + 22.0 + 1 + 17.8 + 1 + 131072 + 2.100 + 1.420 + 3.0 + 3.2 + 64 + 20.0 + 0.5 + 40960 + 16 + 8192 + 256 + 8.250 + 16 + 131072 + 256 + 0.5 + 1 + 0.0021 # should be beams/s rather and degrees + 0.0105 # should be beams/s rather and degrees + 0.333 + 262136 + 8192 # should be seconds + 32768 # should be seconds + + + 20.0 + 262136 + + + 50.0 + 65528 + + + 1 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 +;P%$X^6X;6HB J!A'W$3@HT3R9W@EAP.%O +=OFF>GB%Q++[;G&"H?#/,[')J]2T-Y".\]NWXYZX$LH^4&>J98GRA3YMO]$5],9[ +* ;2&B6SB@!LA"(P%R=G?Q5L)NJ$' +\2/_%$VI3F0M4NR+2\(CZ%%5.HB"LBPR397B+Q*O HEJD!HO_PZMZ*96! +N ]#&I)Y1_)5X9B R>]ZW%SP^KU=ZW;PCB>?@>V23;."G86G[J*:2U]\*N<=N.64 ++4-U&>NQ.:KV(,QC4;CA%F_/P <9Z"_MD1+E^U00B+?M2$'>ZD;@6:A/XN1,K0Z; +>+F(X8J_JNE)DD$DO&ZJ?M9I64:&CI'S]H)-A?.UN1^8/3T^'AF*[3%I@,)[(H@CLKMG<@POMY5)NSPG'!CO6$O +*+X"$X*R94IO,NU4?\[)$3PJL,RN%]]Z-1(MZ;DJ*3!MZ]ZNA2%Y"! ;J(G&K8!5 +M$I>T$M,;'C>(1XCQZ/P^,0*;(H$EO(ZD>MS5\E:2!DAQAA[,;&'!Y<55)Q6G;L1<[->5 EW\=8VYY4+#QE#P +!1TJ"4(1P@*KD)YTK(O^\IQ3" 27,1FI(,$Z;_'G*91R?H4MBPN-V,RJL[IH< N7 +!EDPK1M^V>+P>#7A5E1+O"@Y^4.=YO%#FC?%YY1W=N\21C%( 8HH(Q;Q7XP3^:8! +1)V%RGG6!^'7-P5&J1Q]>)@. + + diff --git a/client/test_workunits/seti_logo b/client/test_workunits/seti_logo new file mode 100644 index 0000000..006f324 Binary files /dev/null and b/client/test_workunits/seti_logo differ diff --git a/client/test_workunits/sponsor_bkg b/client/test_workunits/sponsor_bkg new file mode 100755 index 0000000..4b5be62 Binary files /dev/null and b/client/test_workunits/sponsor_bkg differ diff --git a/client/test_workunits/sponsor_logo b/client/test_workunits/sponsor_logo new file mode 100644 index 0000000..a79d981 Binary files /dev/null and b/client/test_workunits/sponsor_logo differ diff --git a/client/timecvt.cpp b/client/timecvt.cpp new file mode 100644 index 0000000..2320e8c --- /dev/null +++ b/client/timecvt.cpp @@ -0,0 +1,202 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +/* + * + * timecvt.c + * + * Time conversion routines. + * + * $Id: timecvt.cpp,v 1.6.2.4 2007/02/22 02:28:42 vonkorff Exp $ + * + */ + +#include "sah_config.h" +#include "str_util.h" +#include "str_replace.h" + +#include +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include "diagnostics.h" + + +#include "util.h" +#include "s_util.h" +#include "timecvt.h" + +void timecvt_start() {} + +static void trim_newline(char*p) { + int n = (int)strlen(p); + if (n && (p[n-1]=='\n')) { + p[n-1] = 0; + } +} + +char* jd_string(double jd) { + static char buf[256], datestr[64]; + time_t tmptime; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("jd_string"); +#endif /* USE_MANUAL_CALLSTACK */ + + if ( jd > JD0 ) { + tmptime=jd_to_time_t(jd); + strlcpy(datestr, asctime(gmtime(&tmptime)), sizeof(datestr)); + trim_newline(datestr); + sprintf(buf, "%14.5f (%s)", jd, datestr); + } else { + sprintf(buf,"%14.5f",jd); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ + return buf; +} + +// output in human-readable form +// +char* short_jd_string(double jd) { + static char buf[256]; + time_t tmptime; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("short_jd_string()"); +#endif /* USE_MANUAL_CALLSTACK */ + + if ( jd > JD0) { + tmptime=jd_to_time_t(jd); + strlcpy(buf, asctime(gmtime(&tmptime)),sizeof(buf)); + trim_newline(buf); + } else { + strlcpy(buf,"Unknown",sizeof(buf)); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ + return buf; +} + +void st_to_ut(TIME *st) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("st_to_ut()"); +#endif /* USE_MANUAL_CALLSTACK */ + double hour=((double)st->h)+((double)st->m)/60+((double)st->s)/3600 + +((double)st->c)/360000; + if (st->tz !=0) { + hour-=st->tz; + st->tz=0; + if (hour<0) { + hour+=24; + st->d--; + if (st->d<1) { + st->y--; + st->d+=NUM_DAYS(st->y); + } + } + if (hour>=24) { + hour-=24; + st->d++; + if (st->d>NUM_DAYS(st->y)) { + st->d-=NUM_DAYS(st->y); + st->y++; + } + } + st->h=(int)hour; + hour-=st->h; + hour*=60; + st->m=(int)hour; + hour-=st->m; + hour*=60; + st->s=(int)hour; + hour-=st->s; + hour*=100; + st->c=(int)hour; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ +} + +double ut_to_jd(long year, long month, long day, double hour) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ut_to_jd"); +#endif /* USE_MANUAL_CALLSTACK */ + double jd; + long l=(month-14)/12; + jd=(double)(day-32075L+1461L*(year+4800L+l)/4+367l*(month-2-l*12)/12- + 3*((year+4900l+l)/100)/4); + jd+=(hour/24-0.5); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ + return(jd); +} + +double time_t_to_jd(time_t unix_time) { + return (((double)unix_time)/SECONDS_PER_DAY+JD0); +} + +time_t jd_to_time_t(double jd) { + return ((time_t)((jd-JD0)*SECONDS_PER_DAY)); +} + + +void st_time_convert(TIME *st) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("st_time_convert"); +#endif /* USE_MANUAL_CALLSTACK */ + /* Fix Y2K Bug */ + if (st->y < 90) { + st->y+=2000; + } else if (st->y < 100) { + st->y+=1900; + } + + /* Convert time zome time into UT */ + st_to_ut(st); + + /* Fill in julian date field */ + { + double hour=((double)st->h)+((double)st->m)/60+((double)st->s)/3600 + +((double)st->c)/360000; + st->jd=ut_to_jd(st->y,1,st->d,hour); + } + + /* Fill in unix_time field */ + st->unix_time=jd_to_time_t(st->jd); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif /* USE_MANUAL_CALLSTACK */ +} +void timecvt_end() {} + diff --git a/client/timecvt.h b/client/timecvt.h new file mode 100644 index 0000000..28cbd1d --- /dev/null +++ b/client/timecvt.h @@ -0,0 +1,87 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +/* + * + * timecvt.h + * + * Time conversion routines. + * + * $Id: timecvt.h,v 1.3.2.2 2005/10/09 18:24:22 korpela Exp $ + * + */ + +#ifndef TIMECVT_H +#define TIMECVT_H + +#include + +struct TIME { + int y,d,h,m,s,c; + double tz; + double jd; + time_t unix_time; + TIME operator -(const TIME &b) const; +}; + + + +#ifdef __MWERKS__ +// Note: Although Macintosh time is based on 1/1/1904, the +//MetroWerks Standard Libraries time routines use a base of 1/1/1900. +//#define JD0 2416480.5 /* Time at 0:00 GMT 1904 Jan 1 */ +#define JD0 2415020.5 /* Time at 0:00 GMT 1900 Jan 1 */ +#else +#define JD0 2440587.5 /* Time at 0:00 GMT 1970 Jan 1 */ +#endif + +#define SECONDS_PER_DAY 86400 + +#define ISLEAP(y) ((!((y) % 4) && ((y) % 100)) || !((y) % 400)) +#define NUM_DAYS(year) (365+ISLEAP(year)) + +extern char* jd_string(double jd); +extern char* short_jd_string(double jd); +extern double ut_to_jd(long year, long month, long day, double hour); +extern double time_t_to_jd(time_t unix_time); +extern time_t jd_to_time_t(double jd); +extern void st_time_convert(TIME *st); + +inline TIME TIME::operator -(const TIME &b) const { + TIME r; + r.tz=tz-b.tz; + r.jd=jd-b.jd; + r.unix_time=jd_to_time_t(r.jd); + if (r.tz != 0) { + r.jd-=(r.tz/24); + r.unix_time-=((long)(r.tz)*3600); + r.tz=0; + } + return r; +} + +#endif diff --git a/client/vector/analyzeFuncs_altivec.cpp b/client/vector/analyzeFuncs_altivec.cpp new file mode 100644 index 0000000..6995103 --- /dev/null +++ b/client/vector/analyzeFuncs_altivec.cpp @@ -0,0 +1,1795 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: analyzeFuncs_altivec.cpp,v 1.1.2.4 2006/12/14 22:21:59 korpela Exp $ +// + +// This file is empty is USE_ALTIVEC is not defined +#include "sah_config.h" + +#if defined(__ppc__) && defined(USE_ALTIVEC) + +#define INVALID_CHIRP 2e+20 + +#include "analyzeFuncs.h" +#include "analyzeFuncs_vector.h" +#include "analyzePoT.h" +#include "analyzeReport.h" +#include "gaussfit.h" +#include "s_util.h" +#include "pulsefind.h" + +#include +#include +#include + +// polynomial coefficients for sine / cosine approximation in the chirp routine +#define SS1 ((vector float) (1.5707963268)) +#define SS2 ((vector float) (-0.6466386396)) +#define SS3 ((vector float) (0.0679105987)) +#define SS4 ((vector float) (-0.0011573807)) +#define CC1 ((vector float) (-1.2341299769)) +#define CC2 ((vector float) (0.2465220241)) +#define CC3 ((vector float) (-0.0123926179)) + +#define ZERO ((vector float) (0)) +#define ONE ((vector float) (1.0)) +#define TWO ((vector float) (2.0)) +#define RECIP_TWO ((vector float) (0.5)) +#define RECIP_THREE ((vector float) (1.0 / 3.0)) +#define RECIP_FOUR ((vector float) (0.25)) +#define RECIP_FIVE ((vector float) (0.2)) + +// 2^52 (used by quickRound) +#define TWO_TO_52 4.503599627370496e15 + + + +static bool checked=false; +static bool hasAltiVec=false; + +bool AltiVec_Available( void ) +{ + if (!checked) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("AltiVec_Available()"); +#endif + checked=true; + long cpuAttributes; + OSErr err = Gestalt( gestaltPowerPCProcessorFeatures, &cpuAttributes ); + + if( noErr == err ) + hasAltiVec = ( 1 << gestaltPowerPCHasVectorInstructions) & cpuAttributes; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + } + return hasAltiVec; +} + +inline vector float vec_fpsplat(float f_Constant) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("vec_fpsplat()"); +#endif + vector unsigned char vuc_Splat; + vector float vf_Constant; + vuc_Splat = vec_lvsl(0, &f_Constant); + vf_Constant = vec_lde(0, &f_Constant); + vuc_Splat = (vector unsigned char) vec_splat((vector float) vuc_Splat, 0); + vf_Constant = vec_perm(vf_Constant, vf_Constant, vuc_Splat); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return vf_Constant; +} + +inline vector float vec_rsqrt(vector float v) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("vec_rsqrt()"); +#endif + const vector float _0 = (vector float)(-.0); + // obtain estimate + vector float y = vec_rsqrte(v); + // two rounds of Newton-Raphson + y = vec_madd(vec_nmsub(v,vec_madd(y,y,_0),(vector float)(1.0)),vec_madd(y,(vector float)(0.5),_0),y); + y = vec_madd(vec_nmsub(v,vec_madd(y,y,_0),(vector float)(1.0)),vec_madd(y,(vector float)(0.5),_0),y); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return y; +} + +inline vector float vec_sqrt(vector float v) { + vector float y; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("vec_rsqrt()"); +#endif + const vector float _0 = (vector float)(-.0); + y=vec_sel(vec_madd(v,vec_rsqrt(v),_0),_0,vec_cmpeq(v,_0)); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return y; +} + +inline vector float vec_recip(vector float v) { + // obtain estimate + vector float estimate = vec_re( v ); + vector float y; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("vec_recip"); +#endif + // one round of Newton-Raphson + y=vec_madd( vec_nmsub( estimate, v, (vector float) (1.0) ), estimate, estimate ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return y; +} + +int v_vTranspose(int i, int j, float *in, float *out) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_vTranspose"); +#endif + if (AltiVec_Available()) { + vSgetmo(j, i, (vector float *) in, (vector float *) out); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } else { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return UNSUPPORTED_FUNCTION; + } +} + +int v_vGetPowerSpectrum( + sah_complex* FreqData, + float* PowerSpectrum, + int NumDataPoints +) { + int i, vEnd; + const vector unsigned char real = (vector unsigned char) (0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27); + const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31); + + if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_vGetPowerSpectrum()"); +#endif + analysis_state.FLOP_counter+=3.0*NumDataPoints; + + vEnd = NumDataPoints - (NumDataPoints & 3); + for (i = 0; i < vEnd; i += 4) { + const float *f = (const float *) (FreqData + i); + float *p = PowerSpectrum + i; + vector float f1, f2; + vector float re1, im1; + vector float p1; + + f1 = vec_ld(0, f); + f2 = vec_ld(16, f); + re1 = vec_perm(f1, f2, real); + im1 = vec_perm(f1, f2, imag); + p1 = vec_madd(re1, re1, vec_madd(im1, im1, ZERO)); + vec_st(p1, 0, p); + } + + // handle tail elements, although in practice this never happens + for (; i < NumDataPoints; i++) { + PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0] + + FreqData[i][1] * FreqData[i][1]; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +int v_vGetPowerSpectrumG4( + sah_complex* FreqData, + float* PowerSpectrum, + int NumDataPoints + ) { + int i = 0, vEnd; + const vector unsigned char real = (vector unsigned char) (0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27); + const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31); + + if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_vGetPowerSpectrumG4()"); +#endif + analysis_state.FLOP_counter+=3.0*NumDataPoints; + + vEnd = NumDataPoints - (NumDataPoints & 15); + for (i = 0; i < vEnd; i += 16) { + const float *f = (const float *) (FreqData + i); + float *p = PowerSpectrum + i; + vector float f1, f2, f3, f4, f5, f6, f7, f8; + vector float re1, im1, re2, im2, re3, im3, re4, im4; + vector float p1, p2, p3, p4; + + // prefetch next 512 bytes into L1 cache + vec_dstt(f, 0x10020100, 0); + + f1 = vec_ld(0, f); + f2 = vec_ld(16, f); + f3 = vec_ld(32, f); + f4 = vec_ld(48, f); + f5 = vec_ld(64, f); + f6 = vec_ld(80, f); + f7 = vec_ld(96, f); + f8 = vec_ld(112, f); + re1 = vec_perm(f1, f2, real); + im1 = vec_perm(f1, f2, imag); + re2 = vec_perm(f3, f4, real); + im2 = vec_perm(f3, f4, imag); + re3 = vec_perm(f5, f6, real); + im3 = vec_perm(f5, f6, imag); + re4 = vec_perm(f7, f8, real); + im4 = vec_perm(f7, f8, imag); + + // zero out a spot for our power data in the cache + __dcbz(0, p); + __dcbz(32, p); + + p1 = vec_madd(re1, re1, vec_madd(im1, im1, ZERO)); + p2 = vec_madd(re2, re2, vec_madd(im2, im2, ZERO)); + p3 = vec_madd(re3, re3, vec_madd(im3, im3, ZERO)); + p4 = vec_madd(re4, re4, vec_madd(im4, im4, ZERO)); + vec_st(p1, 0, p); + vec_st(p2, 16, p); + vec_st(p3, 32, p); + vec_st(p4, 48, p); + } + + vEnd = NumDataPoints - (NumDataPoints & 3); + for (; i < vEnd; i += 4) { + const float *f = (const float *) (FreqData + i); + float *p = PowerSpectrum + i; + vector float f1, f2; + vector float re1, im1; + vector float p1; + + f1 = vec_ld(0, f); + f2 = vec_ld(16, f); + re1 = vec_perm(f1, f2, real); + im1 = vec_perm(f1, f2, imag); + p1 = vec_madd(re1, re1, vec_madd(im1, im1, ZERO)); + vec_st(p1, 0, p); + } + + // handle tail elements, although in practice this never happens + for (; i < NumDataPoints; i++) { + PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0] + + FreqData[i][1] * FreqData[i][1]; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + + +// quickRound +// +// Quickly round a value to the nearest integer. This is done by adding a large +// value (which depends on the format of an IEEE double precision variable) and +// then subtracting it again to extract the fractional part of the variable. +// +// If x is positive, roundVal must be TWO_TO_52. +// If x is negative, roundVal must be -TWO_TO_52. +// +// NOTE: This function does not do any fancy IEEE compliant arithmetic (like +// handling NaN etc. or preserving the sign of +/-0). +// +// NOTE: Make sure that you don't use any compiler flags that will cancel +// out the operations. +inline double +quickRound(double x, double roundVal) +{ +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("quickRound()"); +#endif + double rv=(x + roundVal) - roundVal; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + + +// chirp +// +// Increase the frequency of the input signal over time. +// +// Note that the input angle is calculated in double-precision. The angle +// becomes so large that single-precision arithmetic is insufficient for the +// accuracy that we need. We can only convert to single-precision after +// reducing the range to (-0.5, 0.5). +// +// The algorithm used to generate the sine / cosine values is based on that +// described in "A Fast, Vectorizable Algorithm for Producing Single-Precision +// Sine-Cosine Pairs" by Marcus H. Mendenhall. The paper is available at: +// http://arxiv.org/pdf/cs.MS/0406049 +// +// Differences from the implementation in the paper: +// 1. The arguments are not scaled by 1/(2 pi) because the original chirp +// algorithm multiplies the chirp rate by (2 pi). +// 2. The slower version of the algorithm has been used (as if FASTER_SINCOS +// had not been defined for the code in the paper). +// 3. The loop has been unrolled once so the variables have been renamed to make +// things more readable. +// 4. The "struct phase" data type is not used. +// 5. The rounding of the input value to the range (-0.5, 0.5) is done in +// double-precision as mentioned above, and not via Altivec. +int v_vChirpData( + sah_complex* cx_DataArray, + sah_complex* cx_ChirpDataArray, + int chirp_rate_ind, + double chirp_rate, + int ul_NumDataPoints, + double sample_rate +) { +// int offset, int numPoints, double chirpRate + int i; + + if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_vChirpData()"); +#endif + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, + cx_DataArray, + (int)ul_NumDataPoints * sizeof(sah_complex) + ); + } else { + int vEnd; + const vector unsigned char real = (vector unsigned char) (0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27); + const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31); + double rate = chirp_rate * 0.5 / (sample_rate * sample_rate); + double roundVal = rate >= 0.0 ? TWO_TO_52 : -TWO_TO_52; + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + for (i = 0; i < vEnd; i += 8) { + const float *d = (const float *) (cx_DataArray + i); + float *c = (float *) (cx_ChirpDataArray + i); + double a1 = i; + double a2 = i + 1.0; + double a3 = i + 2.0; + double a4 = i + 3.0; + double a5 = i + 4.0; + double a6 = i + 5.0; + double a7 = i + 6.0; + double a8 = i + 7.0; + float v[8] __attribute__ ((aligned (16))); + vector float d1, d2, d3, d4; + vector float cd1, cd2, cd3, cd4; + vector float dre1, dre2; + vector float dim1, dim2; + vector float cre1, cre2; + vector float cim1, cim2; + vector float x1, x2; + vector float y1, y2; + vector float s1, s2; + vector float c1, c2; + vector float m1, m2; + + // load the signal to be chirped + d1 = vec_ld(0, d); + d2 = vec_ld(16, d); + d3 = vec_ld(32, d); + d4 = vec_ld(48, d); + + // calculate the input angle + a1 *= a1 * rate; a2 *= a2 * rate; + a3 *= a3 * rate; a4 *= a4 * rate; + a5 *= a5 * rate; a6 *= a6 * rate; + a7 *= a7 * rate; a8 *= a8 * rate; + + // reduce the angle to the range (-0.5, 0.5) and store to + // memory so we can load it into the vector unit + v[0] = a1 - quickRound(a1, roundVal); + v[1] = a2 - quickRound(a2, roundVal); + v[2] = a3 - quickRound(a3, roundVal); + v[3] = a4 - quickRound(a4, roundVal); + v[4] = a5 - quickRound(a5, roundVal); + v[5] = a6 - quickRound(a6, roundVal); + v[6] = a7 - quickRound(a7, roundVal); + v[7] = a8 - quickRound(a8, roundVal); + + // load angle into the vector unit + x1 = vec_ld(0, v); + x2 = vec_ld(16, v); + + // square to the range [0, 0.25) + y1 = vec_madd(x1, x1, ZERO); + y2 = vec_madd(x2, x2, ZERO); + + // perform the initial polynomial approximations + s1 = vec_madd(x1, + vec_madd(y1, + vec_madd(y1, + vec_madd(y1, SS4, SS3), + SS2), + SS1), + ZERO); + s2 = vec_madd(x2, + vec_madd(y2, + vec_madd(y2, + vec_madd(y2, SS4, SS3), + SS2), + SS1), + ZERO); + c1 = vec_madd(y1, + vec_madd(y1, vec_madd(y1, CC3, CC2), CC1), + ONE); + c2 = vec_madd(y2, + vec_madd(y2, vec_madd(y2, CC3, CC2), CC1), + ONE); + + // permute the loaded data into separate real and complex vectors + dre1 = vec_perm(d1, d2, real); + dim1 = vec_perm(d1, d2, imag); + dre2 = vec_perm(d3, d4, real); + dim2 = vec_perm(d3, d4, imag); + + // perform first angle doubling + x1 = vec_nmsub(s1, s1, vec_madd(c1, c1, ZERO)); + x2 = vec_nmsub(s2, s2, vec_madd(c2, c2, ZERO)); + y1 = vec_madd(TWO, vec_madd(s1, c1, ZERO), ZERO); + y2 = vec_madd(TWO, vec_madd(s2, c2, ZERO), ZERO); + + // calculate scaling factor to correct the magnitude +// m1 = vec_nmsub(y1, y1, vec_nmsub(x1, x1, TWO)); +// m2 = vec_nmsub(y2, y2, vec_nmsub(x2, x2, TWO)); + m1 = vec_recip(vec_madd(y1, y1, vec_madd(x1, x1, ZERO))); + m2 = vec_recip(vec_madd(y2, y2, vec_madd(x2, x2, ZERO))); + + // perform second angle doubling + c1 = vec_nmsub(y1, y1, vec_madd(x1, x1, ZERO)); + c2 = vec_nmsub(y2, y2, vec_madd(x2, x2, ZERO)); + s1 = vec_madd(TWO, vec_madd(y1, x1, ZERO), ZERO); + s2 = vec_madd(TWO, vec_madd(y2, x2, ZERO), ZERO); + + // correct the magnitude (final sine / cosine approximations) + s1 = vec_madd(s1, m1, ZERO); + s2 = vec_madd(s2, m2, ZERO); + c1 = vec_madd(c1, m1, ZERO); + c2 = vec_madd(c2, m2, ZERO); + + // chirp the data + cre1 = vec_nmsub(dim1, s1, vec_madd(dre1, c1, ZERO)); + cre2 = vec_nmsub(dim2, s2, vec_madd(dre2, c2, ZERO)); + cim1 = vec_madd(dim1, c1, vec_madd(dre1, s1, ZERO)); + cim2 = vec_madd(dim2, c2, vec_madd(dre2, s2, ZERO)); + + // permute into interleaved form + cd1 = vec_mergeh(cre1,cim1); + cd2 = vec_mergel(cre1,cim1); + cd3 = vec_mergeh(cre2,cim2); + cd4 = vec_mergel(cre2,cim2); + + // store chirped values + vec_st(cd1, 0, c); + vec_st(cd2, 16, c); + vec_st(cd3, 32, c); + vec_st(cd4, 48, c); + } + + // handle tail elements with scalar code + for (; i < ul_NumDataPoints; ++i) { + double angle = rate * i * i * 0.5; + double s = sin(angle); + double c = cos(angle); + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +int v_vChirpDataG4( + sah_complex* cx_DataArray, + sah_complex* cx_ChirpDataArray, + int chirp_rate_ind, + double chirp_rate, + int ul_NumDataPoints, + double sample_rate + ) { + // int offset, int numPoints, double chirpRate + int i; + if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_vChirpDataG4()"); +#endif + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, + cx_DataArray, + (int)ul_NumDataPoints * sizeof(sah_complex) + ); + } else { + int vEnd; + const vector unsigned char real = (vector unsigned char) (0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27); + const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31); + double rate = chirp_rate * 0.5 / (sample_rate * sample_rate); + double roundVal = rate >= 0.0 ? TWO_TO_52 : -TWO_TO_52; + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + for (i = 0; i < vEnd; i += 8) { + const float *d = (const float *) (cx_DataArray + i); + float *c = (float *) (cx_ChirpDataArray + i); + double a1 = i; + double a2 = i + 1.0; + double a3 = i + 2.0; + double a4 = i + 3.0; + double a5 = i + 4.0; + double a6 = i + 5.0; + double a7 = i + 6.0; + double a8 = i + 7.0; + float v[8] __attribute__ ((aligned (16))); + vector float d1, d2, d3, d4; + vector float cd1, cd2, cd3, cd4; + vector float dre1, dre2; + vector float dim1, dim2; + vector float cre1, cre2; + vector float cim1, cim2; + vector float x1, x2; + vector float y1, y2; + vector float s1, s2; + vector float c1, c2; + vector float m1, m2; + + // prefetch next 256 bytes into L1 cache + vec_dstt(d, 0x10010100, 0); + + // load the signal to be chirped + d1 = vec_ld(0, d); + d2 = vec_ld(16, d); + d3 = vec_ld(32, d); + d4 = vec_ld(48, d); + + // calculate the input angle + a1 *= a1 * rate; a2 *= a2 * rate; + a3 *= a3 * rate; a4 *= a4 * rate; + a5 *= a5 * rate; a6 *= a6 * rate; + a7 *= a7 * rate; a8 *= a8 * rate; + + // reduce the angle to the range (-0.5, 0.5) and store to + // memory so we can load it into the vector unit + v[0] = a1 - quickRound(a1, roundVal); + v[1] = a2 - quickRound(a2, roundVal); + v[2] = a3 - quickRound(a3, roundVal); + v[3] = a4 - quickRound(a4, roundVal); + v[4] = a5 - quickRound(a5, roundVal); + v[5] = a6 - quickRound(a6, roundVal); + v[6] = a7 - quickRound(a7, roundVal); + v[7] = a8 - quickRound(a8, roundVal); + + // load angle into the vector unit + x1 = vec_ld(0, v); + x2 = vec_ld(16, v); + + // square to the range [0, 0.25) + y1 = vec_madd(x1, x1, ZERO); + y2 = vec_madd(x2, x2, ZERO); + + // perform the initial polynomial approximations + s1 = vec_madd(x1, + vec_madd(y1, + vec_madd(y1, + vec_madd(y1, SS4, SS3), + SS2), + SS1), + ZERO); + s2 = vec_madd(x2, + vec_madd(y2, + vec_madd(y2, + vec_madd(y2, SS4, SS3), + SS2), + SS1), + ZERO); + c1 = vec_madd(y1, + vec_madd(y1, vec_madd(y1, CC3, CC2), CC1), + ONE); + c2 = vec_madd(y2, + vec_madd(y2, vec_madd(y2, CC3, CC2), CC1), + ONE); + + // permute the loaded data into separate real and complex vectors + dre1 = vec_perm(d1, d2, real); + dim1 = vec_perm(d1, d2, imag); + dre2 = vec_perm(d3, d4, real); + dim2 = vec_perm(d3, d4, imag); + + // perform first angle doubling + x1 = vec_nmsub(s1, s1, vec_madd(c1, c1, ZERO)); + x2 = vec_nmsub(s2, s2, vec_madd(c2, c2, ZERO)); + y1 = vec_madd(TWO, vec_madd(s1, c1, ZERO), ZERO); + y2 = vec_madd(TWO, vec_madd(s2, c2, ZERO), ZERO); + + // calculate scaling factor to correct the magnitude + // m1 = vec_nmsub(y1, y1, vec_nmsub(x1, x1, TWO)); + // m2 = vec_nmsub(y2, y2, vec_nmsub(x2, x2, TWO)); + m1 = vec_recip(vec_madd(y1, y1, vec_madd(x1, x1, ZERO))); + m2 = vec_recip(vec_madd(y2, y2, vec_madd(x2, x2, ZERO))); + + // zero out a spot for our chirped data in the cache + __dcbz(0, c); + __dcbz(32, c); + + // perform second angle doubling + c1 = vec_nmsub(y1, y1, vec_madd(x1, x1, ZERO)); + c2 = vec_nmsub(y2, y2, vec_madd(x2, x2, ZERO)); + s1 = vec_madd(TWO, vec_madd(y1, x1, ZERO), ZERO); + s2 = vec_madd(TWO, vec_madd(y2, x2, ZERO), ZERO); + + // correct the magnitude (final sine / cosine approximations) + s1 = vec_madd(s1, m1, ZERO); + s2 = vec_madd(s2, m2, ZERO); + c1 = vec_madd(c1, m1, ZERO); + c2 = vec_madd(c2, m2, ZERO); + + // chirp the data + cre1 = vec_nmsub(dim1, s1, vec_madd(dre1, c1, ZERO)); + cre2 = vec_nmsub(dim2, s2, vec_madd(dre2, c2, ZERO)); + cim1 = vec_madd(dim1, c1, vec_madd(dre1, s1, ZERO)); + cim2 = vec_madd(dim2, c2, vec_madd(dre2, s2, ZERO)); + + // permute into interleaved form + cd1 = vec_mergeh(cre1,cim1); + cd2 = vec_mergel(cre1,cim1); + cd3 = vec_mergeh(cre2,cim2); + cd4 = vec_mergel(cre2,cim2); + + // store chirped values + vec_st(cd1, 0, c); + vec_st(cd2, 16, c); + vec_st(cd3, 32, c); + vec_st(cd4, 48, c); + } + + // handle tail elements with scalar code + for (; i < ul_NumDataPoints; ++i) { + double angle = rate * i * i * 0.5; + double s = sin(angle); + double c = cos(angle); + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +int v_vChirpDataG5( + sah_complex* cx_DataArray, + sah_complex* cx_ChirpDataArray, + int chirp_rate_ind, + double chirp_rate, + int ul_NumDataPoints, + double sample_rate + ) { + // int offset, int numPoints, double chirpRate + int i; + if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_vChirpDataG5()"); +#endif + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, + cx_DataArray, + (int)ul_NumDataPoints * sizeof(sah_complex) + ); + } else { + int vEnd; + const vector unsigned char real = (vector unsigned char) (0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27); + const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31); + double rate = chirp_rate * 0.5 / (sample_rate * sample_rate); + double roundVal = rate >= 0.0 ? TWO_TO_52 : -TWO_TO_52; + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 15); + for (i = 0; i < vEnd; i += 16) { + const float *d = (const float *) (cx_DataArray + i); + float *c = (float *) (cx_ChirpDataArray + i); + double a1 = i; + double a2 = i + 1.0; + double a3 = i + 2.0; + double a4 = i + 3.0; + double a5 = i + 4.0; + double a6 = i + 5.0; + double a7 = i + 6.0; + double a8 = i + 7.0; + double a9 = i + 8.0; + double a10 = i + 9.0; + double a11 = i + 10.0; + double a12 = i + 11.0; + double a13 = i + 12.0; + double a14 = i + 13.0; + double a15 = i + 14.0; + double a16 = i + 15.0; + float v[16] __attribute__ ((aligned (16))); + vector float d1, d2, d3, d4, d5, d6, d7, d8; + vector float cd1, cd2, cd3, cd4, cd5, cd6, cd7, cd8; + vector float dre1, dre2, dre3, dre4; + vector float dim1, dim2, dim3, dim4; + vector float cre1, cre2, cre3, cre4; + vector float cim1, cim2, cim3, cim4; + vector float x1, x2, x3, x4; + vector float y1, y2, y3, y4; + vector float s1, s2, s3, s4; + vector float c1, c2, c3, c4; + vector float m1, m2, m3, m4; + + // load the signal to be chirped + d1 = vec_ld(0, d); + d2 = vec_ld(16, d); + d3 = vec_ld(32, d); + d4 = vec_ld(48, d); + d5 = vec_ld(64, d); + d6 = vec_ld(80, d); + d7 = vec_ld(96, d); + d8 = vec_ld(112, d); + + // calculate the input angle + a1 *= a1 * rate; a2 *= a2 * rate; + a3 *= a3 * rate; a4 *= a4 * rate; + a5 *= a5 * rate; a6 *= a6 * rate; + a7 *= a7 * rate; a8 *= a8 * rate; + a9 *= a9 * rate; a10 *= a10 * rate; + a11 *= a11 * rate; a12 *= a12 * rate; + a13 *= a13 * rate; a14 *= a14 * rate; + a15 *= a15 * rate; a16 *= a16 * rate; + + // reduce the angle to the range (-0.5, 0.5) and store to + // memory so we can load it into the vector unit + v[0] = a1 - quickRound(a1, roundVal); + v[1] = a2 - quickRound(a2, roundVal); + v[2] = a3 - quickRound(a3, roundVal); + v[3] = a4 - quickRound(a4, roundVal); + v[4] = a5 - quickRound(a5, roundVal); + v[5] = a6 - quickRound(a6, roundVal); + v[6] = a7 - quickRound(a7, roundVal); + v[7] = a8 - quickRound(a8, roundVal); + v[8] = a9 - quickRound(a9, roundVal); + v[9] = a10 - quickRound(a10, roundVal); + v[10] = a11 - quickRound(a11, roundVal); + v[11] = a12 - quickRound(a12, roundVal); + v[12] = a13 - quickRound(a13, roundVal); + v[13] = a14 - quickRound(a14, roundVal); + v[14] = a15 - quickRound(a15, roundVal); + v[15] = a16 - quickRound(a16, roundVal); + + // load angle into the vector unit + x1 = vec_ld(0, v); + x2 = vec_ld(16, v); + x3 = vec_ld(32, v); + x4 = vec_ld(48, v); + + // square to the range [0, 0.25) + y1 = vec_madd(x1, x1, ZERO); + y2 = vec_madd(x2, x2, ZERO); + y3 = vec_madd(x3, x3, ZERO); + y4 = vec_madd(x4, x4, ZERO); + + // perform the initial polynomial approximations + s1 = vec_madd(x1, + vec_madd(y1, + vec_madd(y1, + vec_madd(y1, SS4, SS3), + SS2), + SS1), + ZERO); + s2 = vec_madd(x2, + vec_madd(y2, + vec_madd(y2, + vec_madd(y2, SS4, SS3), + SS2), + SS1), + ZERO); + c1 = vec_madd(y1, + vec_madd(y1, vec_madd(y1, CC3, CC2), CC1), + ONE); + c2 = vec_madd(y2, + vec_madd(y2, vec_madd(y2, CC3, CC2), CC1), + ONE); + s3 = vec_madd(x3, + vec_madd(y3, + vec_madd(y3, + vec_madd(y3, SS4, SS3), + SS2), + SS1), + ZERO); + s4 = vec_madd(x4, + vec_madd(y4, + vec_madd(y4, + vec_madd(y4, SS4, SS3), + SS2), + SS1), + ZERO); + c3 = vec_madd(y3, + vec_madd(y3, vec_madd(y3, CC3, CC2), CC1), + ONE); + c4 = vec_madd(y4, + vec_madd(y4, vec_madd(y4, CC3, CC2), CC1), + ONE); + + // permute the loaded data into separate real and complex vectors + dre1 = vec_perm(d1, d2, real); + dim1 = vec_perm(d1, d2, imag); + dre2 = vec_perm(d3, d4, real); + dim2 = vec_perm(d3, d4, imag); + dre3 = vec_perm(d5, d6, real); + dim3 = vec_perm(d5, d6, imag); + dre4 = vec_perm(d7, d8, real); + dim4 = vec_perm(d7, d8, imag); + + // perform first angle doubling + x1 = vec_nmsub(s1, s1, vec_madd(c1, c1, ZERO)); + x2 = vec_nmsub(s2, s2, vec_madd(c2, c2, ZERO)); + y1 = vec_madd(TWO, vec_madd(s1, c1, ZERO), ZERO); + y2 = vec_madd(TWO, vec_madd(s2, c2, ZERO), ZERO); + x3 = vec_nmsub(s3, s3, vec_madd(c3, c3, ZERO)); + x4 = vec_nmsub(s4, s4, vec_madd(c4, c4, ZERO)); + y3 = vec_madd(TWO, vec_madd(s3, c3, ZERO), ZERO); + y4 = vec_madd(TWO, vec_madd(s4, c4, ZERO), ZERO); + + // calculate scaling factor to correct the magnitude + // m1 = vec_nmsub(y1, y1, vec_nmsub(x1, x1, TWO)); + // m2 = vec_nmsub(y2, y2, vec_nmsub(x2, x2, TWO)); + m1 = vec_recip(vec_madd(y1, y1, vec_madd(x1, x1, ZERO))); + m2 = vec_recip(vec_madd(y2, y2, vec_madd(x2, x2, ZERO))); + m3 = vec_recip(vec_madd(y3, y3, vec_madd(x3, x3, ZERO))); + m4 = vec_recip(vec_madd(y4, y4, vec_madd(x4, x4, ZERO))); + + // perform second angle doubling + c1 = vec_nmsub(y1, y1, vec_madd(x1, x1, ZERO)); + c2 = vec_nmsub(y2, y2, vec_madd(x2, x2, ZERO)); + s1 = vec_madd(TWO, vec_madd(y1, x1, ZERO), ZERO); + s2 = vec_madd(TWO, vec_madd(y2, x2, ZERO), ZERO); + c3 = vec_nmsub(y3, y3, vec_madd(x3, x3, ZERO)); + c4 = vec_nmsub(y4, y4, vec_madd(x4, x4, ZERO)); + s3 = vec_madd(TWO, vec_madd(y3, x3, ZERO), ZERO); + s4 = vec_madd(TWO, vec_madd(y4, x4, ZERO), ZERO); + + // correct the magnitude (final sine / cosine approximations) + s1 = vec_madd(s1, m1, ZERO); + s2 = vec_madd(s2, m2, ZERO); + c1 = vec_madd(c1, m1, ZERO); + c2 = vec_madd(c2, m2, ZERO); + s3 = vec_madd(s3, m3, ZERO); + s4 = vec_madd(s4, m4, ZERO); + c3 = vec_madd(c3, m3, ZERO); + c4 = vec_madd(c4, m4, ZERO); + + // chirp the data + cre1 = vec_nmsub(dim1, s1, vec_madd(dre1, c1, ZERO)); + cre2 = vec_nmsub(dim2, s2, vec_madd(dre2, c2, ZERO)); + cim1 = vec_madd(dim1, c1, vec_madd(dre1, s1, ZERO)); + cim2 = vec_madd(dim2, c2, vec_madd(dre2, s2, ZERO)); + cre3 = vec_nmsub(dim3, s3, vec_madd(dre3, c3, ZERO)); + cre4 = vec_nmsub(dim4, s4, vec_madd(dre4, c4, ZERO)); + cim3 = vec_madd(dim3, c3, vec_madd(dre3, s3, ZERO)); + cim4 = vec_madd(dim4, c4, vec_madd(dre4, s4, ZERO)); + + // permute into interleaved form + cd1 = vec_mergeh(cre1,cim1); + cd2 = vec_mergel(cre1,cim1); + cd3 = vec_mergeh(cre2,cim2); + cd4 = vec_mergel(cre2,cim2); + cd5 = vec_mergeh(cre3,cim3); + cd6 = vec_mergel(cre3,cim3); + cd7 = vec_mergeh(cre4,cim4); + cd8 = vec_mergel(cre4,cim4); + + // store chirped values + vec_st(cd1, 0, c); + vec_st(cd2, 16, c); + vec_st(cd3, 32, c); + vec_st(cd4, 48, c); + vec_st(cd5, 64, c); + vec_st(cd6, 80, c); + vec_st(cd7, 96, c); + vec_st(cd8, 112, c); + } + + // handle tail elements with scalar code + for (; i < ul_NumDataPoints; ++i) { + double angle = rate * i * i * 0.5; + double s = sin(angle); + double c = cos(angle); + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +float f_vGetChiSq( + float fp_PoT[], + int ul_PowerLen, + int ul_TOffset, + float f_PeakPower, + float f_MeanPower, + float f_weight[], + float *xsq_null=0 +) { + // We calculate our assumed gaussian powers + // on the fly as we try to fit them to the + // actual powers at each point along the PoT. + + if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("f_vGetChiSq()"); +#endif + int i; + int vEnd, vul_PowerLen; + float f_ChiSq=0,f_null_hyp=0, f_PredictedPower; + vector float v_PeakPower, v_MeanPower, v_rMeanPower, v_rebin; + vector float v_TempChiSq = ZERO, v_ChiSq, v_temp_null_hyp = ZERO, v_null_hyp, v_PredictedPower, v_weight; + double rebin=swi.nsamples/ChirpFftPairs[analysis_state.icfft].FftLen + /ul_PowerLen; + + // splat Altivec versions of function constants + v_PeakPower = vec_fpsplat(f_PeakPower); + v_MeanPower = vec_fpsplat(f_MeanPower); + v_rMeanPower = vec_fpsplat(1.0f / f_MeanPower); + v_rebin = vec_fpsplat((float) rebin); + + // set up unaligned loads for weight array + int offwt = PoTInfo.GaussTOffsetStop - 1 - ul_TOffset; + vector float msqwt = vec_ld(0, f_weight + offwt); + vector unsigned char maskwt = vec_add(vec_lvsl(-1L, f_weight + offwt), vec_splat_u8(1)); + + vul_PowerLen = ul_PowerLen - (ul_PowerLen & 0x3); + for (i = 0; i < vul_PowerLen; i += 4) { + const float *p = fp_PoT + i; + const float *wt = f_weight + offwt + i; + vector float lsqwt = vec_ld(15, wt); + vector float v_PoT = vec_ld(0, p); + vector float v_weight = vec_perm(msqwt, lsqwt, maskwt); + vector float v_noise, v_rnoise; + + v_PredictedPower = vec_madd(v_PeakPower, v_weight, v_MeanPower); + v_PredictedPower = vec_madd(v_PredictedPower, v_rMeanPower, ZERO); + v_noise = vec_madd(vec_sqrt(vec_sub(vec_max(v_PredictedPower, ONE), ONE)), TWO, ONE); + v_rnoise = vec_recip(v_noise); + + v_TempChiSq = vec_madd(vec_madd(vec_madd(vec_nmsub(v_PoT, v_rMeanPower, v_PredictedPower), + vec_nmsub(v_PoT, v_rMeanPower, v_PredictedPower), + ZERO), + v_rnoise, ZERO), + v_rebin, + v_TempChiSq); + v_temp_null_hyp = vec_madd(vec_madd(vec_madd(vec_nmsub(v_PoT, v_rMeanPower, ONE), + vec_nmsub(v_PoT, v_rMeanPower, ONE), + ZERO), + v_rnoise, ZERO), + v_rebin, + v_temp_null_hyp); + + msqwt = lsqwt; + } + v_ChiSq = v_TempChiSq; + v_null_hyp = v_temp_null_hyp; + + // handle tail elements + for (; i < ul_PowerLen; i++) { + f_PredictedPower = f_MeanPower + f_PeakPower * f_weight[offwt+i] ; + // ChiSq in this realm is: + // sum[0:i]( (observed power - expected power)^2 / expected variance ) + // The power of a signal is: + // power = (noise + signal)^2 = noise^2 + signal^2 + 2*noise*signal + // With mean power normalization, noise becomes 1, leaving: + // power = signal^2 +or- 2*signal + 1 + f_PredictedPower/=f_MeanPower; + double signal=f_PredictedPower; + double noise=(2.0*sqrt(std::max(f_PredictedPower,1.0f)-1)+1); + + f_ChiSq += + (static_cast(rebin)*SQUARE(fp_PoT[i]/f_MeanPower - signal)/noise); + f_null_hyp+= + (static_cast(rebin)*SQUARE(fp_PoT[i]/f_MeanPower-1)/noise); + } + + // sum vector and scalar elements + float *vp_ChiSq = (float *) &v_ChiSq; + float *vp_null_hyp = (float *) &v_null_hyp; + f_ChiSq += vp_ChiSq[0] + vp_ChiSq[1] + vp_ChiSq[2] + vp_ChiSq[3]; + f_null_hyp += vp_null_hyp[0] + vp_null_hyp[1] + vp_null_hyp[2] + vp_null_hyp[3]; + + analysis_state.FLOP_counter+=20.0*ul_PowerLen+5; + f_ChiSq/=ul_PowerLen; + f_null_hyp/=ul_PowerLen; + + if (xsq_null) *xsq_null=f_null_hyp; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return f_ChiSq; +} + + +float f_vGetTrueMean( + float fp_PoT[], + int ul_PowerLen, + float f_TotalPower, + int ul_TOffset, + int ul_ExcludeLen + ) { + // TrueMean is the mean power of the data set minus all power + // out to ExcludeLen from our current TOffset. + if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("f_vGetTrueMean()"); +#endif + int i, i_start, i_lim, vStart, vEnd; + float f_ExcludePower = 0; + vector float v_TempExcludePower = ZERO, v_ExcludePower; + + // take care that we do not add to exclude power beyond PoT bounds! + i_start = std::max(ul_TOffset - ul_ExcludeLen, 0); + i_lim = std::min(ul_TOffset + ul_ExcludeLen + 1, swi.analysis_cfg.gauss_pot_length); + + vStart = i_start + 3; + vStart = vStart - (vStart & 3); + vEnd = i_lim - (i_lim & 3); + + // handle leading elements + for (i = i_start; i < vStart; i++) { + f_ExcludePower += fp_PoT[i]; + } + for (; i < vEnd; i += 4) { + v_TempExcludePower = vec_add(vec_ld(0, fp_PoT + i), v_TempExcludePower); + } + v_ExcludePower = v_TempExcludePower; + // handle tail elements + for (; i < i_lim; i++) { + f_ExcludePower += fp_PoT[i]; + } + + // sum vector and scalar elements + float *vp_ExcludePower = (float *) &v_ExcludePower; + f_ExcludePower += vp_ExcludePower[0] + vp_ExcludePower[1] + vp_ExcludePower[2] + vp_ExcludePower[3]; + + analysis_state.FLOP_counter+=(double)(i_lim-i_start+5); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return((f_TotalPower - f_ExcludePower) / (ul_PowerLen - (i - i_start))); +} + + + + + +int vGaussFit( + float * fp_PoT, + int ul_FftLength, + int ul_PoT +) { + int i, retval; + BOOLEAN b_IsAPeak; + float f_NormMaxPower; + float f_null_hyp; + + if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("vGaussFit()"); +#endif + int ul_TOffset; + int iSigma = static_cast(floor(PoTInfo.GaussSigma+0.5)); + double diSigma = iSigma; + float f_GroupSum, f_GroupMax; + int i_f, iPeakLoc; + + float f_TotalPower, + f_TrueMean, + f_ChiSq, + f_PeakPower; + float f_rMeanPower; + float f_TotalPowerOverTrueMeanElems; + vector float v_TotalPower; + vector float v_rMeanPower; + vector float v_PowerThresh; + + // For setiathome the Sigma and Gaussian PoT length don't change during + // a run of the application, so these frequently used values can be + // precalculated and kept. + static float f_PeakScaleFactor; + static float *f_weight; + static float *f_vweight; + static float *f_PeakFilter; + static float *f_BoxFilter; + static float *f_corr; + static float *f_swsum; + static float f_rTrueMeanElems = 1.0f / (swi.analysis_cfg.gauss_pot_length - (4*iSigma+1)); + + if (!f_weight) { + f_PeakScaleFactor = f_GetPeakScaleFactor(static_cast(PoTInfo.GaussSigma)); + // Altivec code uses double-sided f_weight to make memory accesses simpler + f_vweight = reinterpret_cast(malloc((2*PoTInfo.GaussTOffsetStop-1)*sizeof(float))); + if (!f_vweight) SETIERROR(MALLOC_FAILED, "!f_vweight"); + f_vweight[PoTInfo.GaussTOffsetStop-1] = 1; + + f_PeakFilter = reinterpret_cast(malloc((2*iSigma+1)*sizeof(float))); + if (!f_PeakFilter) SETIERROR(MALLOC_FAILED, "!f_PeakFilter"); + f_BoxFilter = reinterpret_cast(malloc((4*iSigma+1)*sizeof(float))); + if (!f_BoxFilter) SETIERROR(MALLOC_FAILED, "!f_BoxFilter"); + f_PeakFilter[iSigma] = f_PeakScaleFactor; + f_BoxFilter[2*iSigma] = f_rTrueMeanElems; + + f_weight = reinterpret_cast(malloc(PoTInfo.GaussTOffsetStop*sizeof(float))); + if (!f_weight) SETIERROR(MALLOC_FAILED, "!f_weight"); + f_weight[0] = 1; + + for (i = 1; i <= iSigma; i++) { + float weight = static_cast(EXP(i, 0, PoTInfo.GaussSigmaSq)); + f_vweight[PoTInfo.GaussTOffsetStop-1+i] = weight; + f_vweight[PoTInfo.GaussTOffsetStop-1-i] = weight; + f_PeakFilter[iSigma+i] = weight * f_PeakScaleFactor; + f_PeakFilter[iSigma-i] = weight * f_PeakScaleFactor; + f_BoxFilter[2*iSigma+i] = f_rTrueMeanElems; + f_BoxFilter[2*iSigma-i] = f_rTrueMeanElems; + + f_weight[i] = weight; + } + + for (; i <= 2*iSigma; i++) { + float weight = static_cast(EXP(i, 0, PoTInfo.GaussSigmaSq)); + f_vweight[PoTInfo.GaussTOffsetStop-1+i] = weight; + f_vweight[PoTInfo.GaussTOffsetStop-1-i] = weight; + f_BoxFilter[2*iSigma+i] = f_rTrueMeanElems; + f_BoxFilter[2*iSigma-i] = f_rTrueMeanElems; + + f_weight[i] = weight; + } + + for (; i < PoTInfo.GaussTOffsetStop; i++) { + float weight = static_cast(EXP(i, 0, PoTInfo.GaussSigmaSq)); + f_vweight[PoTInfo.GaussTOffsetStop-1+i] = weight; + f_vweight[PoTInfo.GaussTOffsetStop-1-i] = weight; + + f_weight[i] = weight; + } + } + + // Find reciprocal of mean over power-of-time array + // Assumes that swi.analysis_cfg.gauss_pot_length is a multiple of 4 + v_TotalPower = ZERO; + for (i = 0; i < swi.analysis_cfg.gauss_pot_length; i += 4) { + const float *p = fp_PoT + i; + vector float v_PoT = vec_ld(0, p); + v_TotalPower = vec_add(v_TotalPower, v_PoT); + } + v_TotalPower = vec_add(v_TotalPower, vec_sld(v_TotalPower, v_TotalPower, 8)); + v_TotalPower = vec_add(v_TotalPower, vec_sld(v_TotalPower, v_TotalPower, 4)); + v_rMeanPower = vec_madd(vec_recip(v_TotalPower), + vec_fpsplat((float) swi.analysis_cfg.gauss_pot_length), ZERO); + + // Normalize power-of-time and check for the existence + // of at least 1 peak. + b_IsAPeak = false; + v_PowerThresh = vec_fpsplat(PoTInfo.GaussPowerThresh); + for (i = 0; i < swi.analysis_cfg.gauss_pot_length; i += 4) { + float *p = fp_PoT + i; + vector float v_PoT = vec_ld(0, p); + v_PoT = vec_madd(v_PoT, v_rMeanPower, ZERO); + b_IsAPeak |= vec_any_gt(v_PoT, v_PowerThresh); + vec_st(v_PoT, 0, p); + } + analysis_state.FLOP_counter+=3.0*swi.analysis_cfg.gauss_pot_length+2; + + if (!b_IsAPeak) { + //printf("no peak\n"); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; // no peak - bail on this PoT + } + + // Recalculate Total Power across normalized array. + // Given that powers are positive, f_TotalPower will + // end up being == swi.analysis_cfg.gauss_pot_length. + f_TotalPower = 0; + f_NormMaxPower = 0; + // Also locate group with the highest sum for use in second bailout check. + f_GroupSum = 0; + f_GroupMax = 0; + for (i = 0, i_f = -iSigma; i < swi.analysis_cfg.gauss_pot_length; i++, i_f++) { + f_TotalPower += fp_PoT[i]; + if(fp_PoT[i] > f_NormMaxPower) f_NormMaxPower = fp_PoT[i]; + f_GroupSum += fp_PoT[i] - ((i_f < 0) ? 0.0f : fp_PoT[i_f]); + if (f_GroupSum > f_GroupMax) { + f_GroupMax = f_GroupSum; + iPeakLoc = i - iSigma/2; + } + } + f_TotalPowerOverTrueMeanElems = f_TotalPower * f_rTrueMeanElems; + + // Check at the group peak location whether data may contain Gaussians + // (but only after the first hurry-up Gaussian has been set for graphics) + + if (best_gauss->display_power_thresh != 0) { + iPeakLoc = std::max(PoTInfo.GaussTOffsetStart, + (std::min(PoTInfo.GaussTOffsetStop - 1, iPeakLoc))); + + f_TrueMean = f_vGetTrueMean( + fp_PoT, + swi.analysis_cfg.gauss_pot_length, + f_TotalPower, + iPeakLoc, + 2 * iSigma + ); + + f_PeakPower = f_GetPeak( + fp_PoT, + iPeakLoc, + iSigma, + f_TrueMean, + f_PeakScaleFactor, + f_weight + ); + + analysis_state.FLOP_counter+=5.0*swi.analysis_cfg.gauss_pot_length+5; + + if (f_PeakPower < f_TrueMean * best_gauss->display_power_thresh*0.5f) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; // not even a weak peak at max group - bail on this PoT + } + } + + f_corr = reinterpret_cast(malloc((PoTInfo.GaussTOffsetStop - PoTInfo.GaussTOffsetStart)*sizeof(float))); + f_swsum = reinterpret_cast(malloc((swi.analysis_cfg.gauss_pot_length-4*iSigma)*sizeof(float))); + conv(fp_PoT, 1, f_PeakFilter, 1, f_corr, 1, + PoTInfo.GaussTOffsetStop - PoTInfo.GaussTOffsetStart, 2*iSigma+1); + conv(fp_PoT, 1, f_BoxFilter, 1, f_swsum, 1, + swi.analysis_cfg.gauss_pot_length-4*iSigma, 4*iSigma+1); + + // slide dynamic gaussian across the Power Of Time array + double loop_flops = 0; + float display_power_thresh = best_gauss->display_power_thresh; + float f_tempTotalPowerOverTrueMeanElems = f_TotalPowerOverTrueMeanElems; + for (ul_TOffset = PoTInfo.GaussTOffsetStart; + ul_TOffset < PoTInfo.GaussTOffsetStop; + ul_TOffset++ + ) { + + // TrueMean is the mean power of the data set minus all power + // out to 2 sigma from our current TOffset. + if ((ul_TOffset - 2 * iSigma) < 0 || (ul_TOffset + 2 * iSigma) >= swi.analysis_cfg.gauss_pot_length) { + f_TrueMean = f_vGetTrueMean( + fp_PoT, + swi.analysis_cfg.gauss_pot_length, + f_TotalPower, + ul_TOffset, + 2 * iSigma + ); + } else { + f_TrueMean = f_tempTotalPowerOverTrueMeanElems - f_swsum[ul_TOffset - 2 * iSigma]; + loop_flops+=4.0*diSigma+6.0; + } + + f_PeakPower = f_corr[ul_TOffset-iSigma] - f_TrueMean; + loop_flops+=6.0*diSigma; + + // worth looking at ? + if (f_PeakPower < f_TrueMean * display_power_thresh) { + continue; + } + + // bump up the display threshold to its final value. + // We could bump it up only to the gaussian just found, + // but that would cause a lot of time waste + // computing chisq etc. + if (display_power_thresh == 0) { + display_power_thresh = best_gauss->display_power_thresh = PoTInfo.GaussPeakPowerThresh/3; + } + + f_ChiSq = f_vGetChiSq( + fp_PoT, + swi.analysis_cfg.gauss_pot_length, + ul_TOffset, + f_PeakPower, + f_TrueMean, + f_vweight, + &f_null_hyp + ); + + retval = ChooseGaussEvent( + ul_TOffset, + f_PeakPower, + f_TrueMean, + f_ChiSq, + f_null_hyp, + ul_PoT, + static_cast(PoTInfo.GaussSigma), + f_NormMaxPower, + fp_PoT + ); + if (retval) SETIERROR(retval,"from ChooseGaussEvent"); + + } // End of sliding gaussian + + analysis_state.FLOP_counter+=loop_flops; + free(f_corr); + free(f_swsum); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + +} // End of vGaussFit() + + +/********************** +* +* Subroutines for pulse folding, refactored by Joe Segur from code by Alex Kan +* +*/ +inline vector unsigned int vec_uisplat(unsigned int ui_Constant) { + vector unsigned char vuc_Splat; + vector unsigned int vui_Constant; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("vec_uisplat()"); +#endif + vuc_Splat = vec_lvsl(0, &ui_Constant); + vui_Constant = vec_lde(0, &ui_Constant); + vuc_Splat = (vector unsigned char) vec_splat((vector unsigned int) vuc_Splat, 0); + vui_Constant = vec_perm(vui_Constant, vui_Constant, vuc_Splat); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return vui_Constant; +} + +/********************** +* +* foldArrayBy2 - Perform "folds" on 2 adjacent parts of the power over time +* array. Each element in the "folded" array is the sum of the 2 elements +* in the power over time array. Array is folded in-place. +* +* Assumes 16-byte alignment of input array, but offsets within the array may be +* arbitrary. +* +*/ +float foldArrayBy2SPA(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy2SPA()"); +#endif + float max; + int vEnd; + vector float tempMaxV = ZERO, maxV; + vector float msq2 = vec_ld(0, ss[1]+P->tmp0); + vector float msqz; + vector unsigned char mask2 = vec_add(vec_lvsl(-1L, ss[1]+P->tmp0), vec_splat_u8(1)); + vector unsigned int tailelem = {0, 1, 2, 3}; + vector unsigned int taillim = vec_uisplat(((P->di-1)&0x3) + 1); + vector unsigned int tailmask; + int i = 0, index = 0; + + // int d_elemsWritten = 0; + const float *p1 = ss[1]+P->offset, *p2 = ss[1]+P->tmp0; + float *pst = P->dest; + vector float lsq2, x1, x2, xs, zst; + +#define F2_STAGE1 x1 = vec_ld(0, p1); lsq2 = vec_ld(15, p2); i += 4; p1 += 4; p2 += 4; +#define F2_STAGE2 x2 = vec_perm(msq2, lsq2, mask2); msq2 = lsq2; xs = vec_add(x1, x2); + // was vec_madd(xs, RECIP_TWO, ZERO); +#define F2_STAGE3 zst = xs; +#define F2_STAGE4 tempMaxV = vec_max(tempMaxV, zst); vec_st(zst, index, pst); pst += 4; + + // software pipelined main loop - omit last stage of tail element + if (P->di-i >= 12) { + F2_STAGE1; + F2_STAGE2; F2_STAGE1; + F2_STAGE3; F2_STAGE2; F2_STAGE1; + while (i < P->di) { + F2_STAGE4; F2_STAGE3; F2_STAGE2; F2_STAGE1; + } + F2_STAGE4; F2_STAGE3; F2_STAGE2; + F2_STAGE4; F2_STAGE3; +// F2_STAGE4; + } else { + // main loop + while (i < P->di-4) { + F2_STAGE1; F2_STAGE2; F2_STAGE3; F2_STAGE4; + } + F2_STAGE1; F2_STAGE2; F2_STAGE3; + } + +#undef F2_STAGE1 +#undef F2_STAGE2 +#undef F2_STAGE3 +#undef F2_STAGE4 + + tailmask = (vector unsigned int) vec_cmplt(tailelem, taillim); + zst = vec_and(zst, (vector float) tailmask); + tempMaxV = vec_max(tempMaxV, zst); + vec_st(zst, index, pst); + + // take the maximum across max and maxV and return it + tempMaxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 8)); + maxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 4)); + float *maxVp = (float *) &maxV; + max = *maxVp; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +/* Assumes 16-byte alignment of both halves of input array +*/ +float foldArrayBy2SPAL(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy2SPAL()"); +#endif + float max; + int vEnd; + vector float tempMaxV = ZERO, maxV; + vector unsigned int tailelem = {0, 1, 2, 3}; + vector unsigned int taillim = vec_uisplat(((P->di-1)&0x3) + 1); + vector unsigned int tailmask; + int i = 0, index = 0; + + // int d_elemsWritten = 0; + const float *p1 = ss[1]+P->offset + i, *p2 = ss[1]+P->tmp0 + i; + float *pst = P->dest + i; + vector float lsq1, lsq2, x1, x2, xs, lsqz, zst; + +#define F2_STAGE1 x1 = vec_ld(0, p1); x2 = vec_ld(0, p2); i += 4; p1 += 4; p2 += 4; +#define F2_STAGE2 xs = vec_add(x1, x2); + // was vec_madd(xs, RECIP_TWO, ZERO); +#define F2_STAGE3 zst = xs; +#define F2_STAGE4 tempMaxV = vec_max(tempMaxV, zst); vec_st(zst, index, pst); pst += 4; + + // software pipelined main loop - omit last stage of tail element + if (P->di-i >= 12) { + F2_STAGE1; + F2_STAGE2; F2_STAGE1; + F2_STAGE3; F2_STAGE2; F2_STAGE1; + while (i < P->di) { + F2_STAGE4; F2_STAGE3; F2_STAGE2; F2_STAGE1; + } + F2_STAGE4; F2_STAGE3; F2_STAGE2; + F2_STAGE4; F2_STAGE3; + // F2_STAGE4; + } else { + // main loop + while (i < P->di-4) { + F2_STAGE1; F2_STAGE2; F2_STAGE3; F2_STAGE4; + } + F2_STAGE1; F2_STAGE2; F2_STAGE3; + } + +#undef F2_STAGE1 +#undef F2_STAGE2 +#undef F2_STAGE3 +#undef F2_STAGE4 + + tailmask = (vector unsigned int) vec_cmplt(tailelem, taillim); + zst = vec_and(zst, (vector float) tailmask); + tempMaxV = vec_max(tempMaxV, zst); + vec_st(zst, index, pst); + + // take the maximum across max and maxV and return it + tempMaxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 8)); + maxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 4)); + float *maxVp = (float *) &maxV; + max = *maxVp; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + + +/********************** +* +* foldArrayBy3 - Perform "folds" on 3 adjacent parts of the power over time +* array. Each element in the "folded" array is the sum of the 3 elements +* in the power over time array. +* +* Assumes 16-byte alignment of input and output arrays. +* +*/ +float foldArrayBy3SP(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy3SP()"); +#endif + float max; + int vEnd; + vector float tempMaxV = ZERO, maxV; + vector float msq2 = vec_ld(0, ss[0]+P->tmp0); + vector float msq3 = vec_ld(0, ss[0]+P->tmp1); + vector unsigned char mask2 = vec_add(vec_lvsl(-1L, ss[0]+P->tmp0), vec_splat_u8(1)); + vector unsigned char mask3 = vec_add(vec_lvsl(-1L, ss[0]+P->tmp1), vec_splat_u8(1)); + vector unsigned int tailelem = {0, 1, 2, 3}; + vector unsigned int taillim = vec_uisplat(((P->di-1)&0x3) + 1); + vector unsigned int tailmask; + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1; + float *pst = P->dest; + vector float lsq2, lsq3, x1, x2, x3, xs12, xs, z; + +#define F3_STAGE1 lsq2 = vec_ld(15, p2); i += 4; p2 += 4; x1 = vec_ld(0, p1); x2 = vec_perm(msq2, lsq2, mask2); lsq3 = vec_ld(15, p3); p1 += 4; msq2 = lsq2; p3 += 4; xs12 = vec_add(x1, x2); x3 = vec_perm(msq3, lsq3, mask3); msq3 = lsq3; +#define F3_STAGE2 xs = vec_add(xs12, x3); + // was vec_madd(xs, RECIP_THREE, ZERO); +#define F3_STAGE3 z = xs; +#define F3_STAGE4 tempMaxV = vec_max(tempMaxV, z); vec_st(z, 0, pst); pst += 4; + + // software pipelined main loop + if (P->di-i >= 12) { + F3_STAGE1; + F3_STAGE2; F3_STAGE1; + F3_STAGE3; F3_STAGE2; F3_STAGE1; + while (i < P->di) { + F3_STAGE4; F3_STAGE3; F3_STAGE2; F3_STAGE1; + } + F3_STAGE4; F3_STAGE3; F3_STAGE2; + F3_STAGE4; F3_STAGE3; +// F3_STAGE4; + } else { + // main loop + while (i < P->di-4) { + F3_STAGE1; F3_STAGE2; F3_STAGE3; F3_STAGE4; + } + F3_STAGE1; F3_STAGE2; F3_STAGE3; + } + +#undef F3_STAGE1 +#undef F3_STAGE2 +#undef F3_STAGE3 +#undef F3_STAGE4 + + tailmask = (vector unsigned int) vec_cmplt(tailelem, taillim); + z = vec_and(z, (vector float) tailmask); + tempMaxV = vec_max(tempMaxV, z); + vec_st(z, 0, pst); + + // take the maximum across max and maxV and return it + tempMaxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 8)); + maxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 4)); + float *maxVp = (float *) &maxV; + max = *maxVp; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + + +/********************** +* +* foldArrayBy4 - Perform "folds" on 4 adjacent parts of the power over time +* array. Each element in the "folded" array is the sum of the 4 elements +* in the power over time array. +* +* Assumes 16-byte alignment of input and output arrays. +* +*/ +float foldArrayBy4SP(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy4SP()"); +#endif + float max; + int vEnd; + vector float tempMaxV = ZERO, maxV; + vector float msq2 = vec_ld(0, ss[0]+P->tmp0); + vector float msq3 = vec_ld(0, ss[0]+P->tmp1); + vector float msq4 = vec_ld(0, ss[0]+P->tmp2); + vector unsigned char mask2 = vec_add(vec_lvsl(-1L, ss[0]+P->tmp0), vec_splat_u8(1)); + vector unsigned char mask3 = vec_add(vec_lvsl(-1L, ss[0]+P->tmp1), vec_splat_u8(1)); + vector unsigned char mask4 = vec_add(vec_lvsl(-1L, ss[0]+P->tmp2), vec_splat_u8(1)); + vector unsigned int tailelem = {0, 1, 2, 3}; + vector unsigned int taillim = vec_uisplat(((P->di-1)&0x3) + 1); + vector unsigned int tailmask; + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2; + float *pst = P->dest; + vector float lsq2, lsq3, lsq4, x1, x2, x3, x4, xs12, xs34, xs, z; + +#define F4_STAGE1 lsq2 = vec_ld(15, p2); lsq3 = vec_ld(15, p3); lsq4 = vec_ld(15, p4); i += 4; p2 += 4; p3 += 4; p4 += 4; x1 = vec_ld(0, p1); x2 = vec_perm(msq2, lsq2, mask2); x3 = vec_perm(msq3, lsq3, mask3); x4 = vec_perm(msq4, lsq4, mask4); p1 += 4; msq2 = lsq2; msq3 = lsq3; msq4 = lsq4; xs12 = vec_add(x1, x2); xs34 = vec_add(x3, x4); +#define F4_STAGE2 xs = vec_add(xs12, xs34); + // was vec_madd(xs, RECIP_FOUR, ZERO); +#define F4_STAGE3 z = xs; +#define F4_STAGE4 tempMaxV = vec_max(tempMaxV, z); vec_st(z, 0, pst); pst += 4; + + // software pipelined main loop + if (P->di-i >= 12) { + F4_STAGE1; + F4_STAGE2; F4_STAGE1; + F4_STAGE3; F4_STAGE2; F4_STAGE1; + while (i < P->di) { + F4_STAGE4; F4_STAGE3; F4_STAGE2; F4_STAGE1; + } + F4_STAGE4; F4_STAGE3; F4_STAGE2; + F4_STAGE4; F4_STAGE3; +// F4_STAGE4; + } else { + // main loop + while (i < P->di-4) { + F4_STAGE1; F4_STAGE2; F4_STAGE3; F4_STAGE4; + } + F4_STAGE1; F4_STAGE2; F4_STAGE3; + } + +#undef F4_STAGE1 +#undef F4_STAGE2 +#undef F4_STAGE3 +#undef F4_STAGE4 + + tailmask = (vector unsigned int) vec_cmplt(tailelem, taillim); + z = vec_and(z, (vector float) tailmask); + tempMaxV = vec_max(tempMaxV, z); + vec_st(z, 0, pst); + + // take the maximum across max and maxV and return it + tempMaxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 8)); + maxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 4)); + float *maxVp = (float *) &maxV; + max = *maxVp; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + + +/********************** +* +* foldArrayBy5 - Perform "folds" on 5 adjacent parts of the power over time +* array. Each element in the "folded" array is the sum of the 5 elements +* in the power over time array. +* +* Assumes 16-byte alignment of input and output arrays. +* +*/ +float foldArrayBy5SP(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy5SP()"); +#endif + float max; + int vEnd; + vector float tempMaxV = ZERO, maxV; + vector float msq2 = vec_ld(0, ss[0]+P->tmp0); + vector float msq3 = vec_ld(0, ss[0]+P->tmp1); + vector float msq4 = vec_ld(0, ss[0]+P->tmp2); + vector float msq5 = vec_ld(0, ss[0]+P->tmp3); + vector unsigned char mask2 = vec_add(vec_lvsl(-1L, ss[0]+P->tmp0), vec_splat_u8(1)); + vector unsigned char mask3 = vec_add(vec_lvsl(-1L, ss[0]+P->tmp1), vec_splat_u8(1)); + vector unsigned char mask4 = vec_add(vec_lvsl(-1L, ss[0]+P->tmp2), vec_splat_u8(1)); + vector unsigned char mask5 = vec_add(vec_lvsl(-1L, ss[0]+P->tmp3), vec_splat_u8(1)); + vector unsigned int tailelem = {0, 1, 2, 3}; + vector unsigned int taillim = vec_uisplat(((P->di-1)&0x3) + 1); + vector unsigned int tailmask; + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2, *p5 = ss[0]+P->tmp3; + float *pst = P->dest; + vector float lsq2, lsq3, lsq4, lsq5, x1, x2, x3, x4, x5, xs12, xs34, xs345, xs, z; + +#define F5_STAGE1 lsq3 = vec_ld(15, p3); lsq4 = vec_ld(15, p4); i += 4; p3 += 4; p4 += 4; lsq2 = vec_ld(15, p2); x3 = vec_perm(msq3, lsq3, mask3); x4 = vec_perm(msq4, lsq4, mask4); lsq5 = vec_ld(15, p5); p2 += 4; msq3 = lsq3; msq4 = lsq4; p5 += 4; x1 = vec_ld(0, p1); x2 = vec_perm(msq2, lsq2, mask2); xs34 = vec_add(x3, x4); x5 = vec_perm(msq5, lsq5, mask5); p1 += 4; msq2 = lsq2; msq5 = lsq5; +#define F5_STAGE2 xs12 = vec_add(x1, x2); xs345 = vec_add(xs34, x5); +#define F5_STAGE3 xs = vec_add(xs12, xs345); + // was vec_madd(xs, RECIP_FIVE, ZERO); +#define F5_STAGE4 z = xs; +#define F5_STAGE5 tempMaxV = vec_max(tempMaxV, z); vec_st(z, 0, pst); pst += 4; + + // software pipelined main loop + if (P->di-i >= 16) { + F5_STAGE1; + F5_STAGE2; F5_STAGE1; + F5_STAGE3; F5_STAGE2; F5_STAGE1; + F5_STAGE4; F5_STAGE3; F5_STAGE2; F5_STAGE1; + while (i < P->di) { + F5_STAGE5; F5_STAGE4; F5_STAGE3; F5_STAGE2; F5_STAGE1; + } + F5_STAGE5; F5_STAGE4; F5_STAGE3; F5_STAGE2; + F5_STAGE5; F5_STAGE4; F5_STAGE3; + F5_STAGE5; F5_STAGE4; +// F5_STAGE5; + } else { + // main loop + while (i < P->di-4) { + F5_STAGE1; F5_STAGE2; F5_STAGE3; F5_STAGE4; F5_STAGE5; + } + F5_STAGE1; F5_STAGE2; F5_STAGE3; F5_STAGE4; + } + +#undef F5_STAGE1 +#undef F5_STAGE2 +#undef F5_STAGE3 +#undef F5_STAGE4 +#undef F5_STAGE5 + + tailmask = (vector unsigned int) vec_cmplt(tailelem, taillim); + z = vec_and(z, (vector float) tailmask); + tempMaxV = vec_max(tempMaxV, z); + vec_st(z, 0, pst); + + // take the maximum across max and maxV and return it + tempMaxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 8)); + maxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 4)); + float *maxVp = (float *) &maxV; + max = *maxVp; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AKavTB3[FOLDTBLEN] = { foldArrayBy3SP }; +sum_func AKavTB4[FOLDTBLEN] = { foldArrayBy4SP }; +sum_func AKavTB5[FOLDTBLEN] = { foldArrayBy5SP }; +sum_func AKavTB2[FOLDTBLEN] = { foldArrayBy2SPA }; +sum_func AKavTB2AL[FOLDTBLEN] = { foldArrayBy2SPAL }; + +FoldSet AKavfold = {AKavTB3, AKavTB4, AKavTB5, AKavTB2, AKavTB2AL, "AK AltiVec"}; + + +#endif diff --git a/client/vector/analyzeFuncs_avx.cpp b/client/vector/analyzeFuncs_avx.cpp new file mode 100644 index 0000000..e55eea7 --- /dev/null +++ b/client/vector/analyzeFuncs_avx.cpp @@ -0,0 +1,1511 @@ +/****************** + * + * analyzeFuncs_avx.cpp + * + * Description: Intel AVX optimzized functions + * CPUs: Intel Core iX xxxx+ + * + */ + +// Copyright 2011 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#define USE_MATH_DEFINES + +#include "sah_config.h" + +//JWS: For a release build using this module, compile with -mavx on GCC 4.4 or +// later or whatever is equivalent for the compiler used. Define USE_AVX and +// USE_INTRINSICS also. +// +// For tests on x86 hardware without AVX capability, Intel provides an SDE +// (Software Development Emulator) to do runtime replacement of AVX instructions +// or an avxintrin_emu.h header file which does compile-time replacement of the +// AVX intrinsics. For that latter method, define AVX_EMU to get the header +// file included and build for SSE3 or better. + +// The following is empty if USE_AVX and USE_INTRINSICS are not both defined +#if defined(USE_AVX) && defined (USE_INTRINSICS) + +#include +#include + +#ifdef AVX_EMU +#include "avxintrin_emu.h" +#elif defined(_MSC_VER) +#include +#else +#ifdef __clang__ +#define __AVX__ 1 +#endif +#include +#endif + +#include "s_util.h" +#include "analyzeFuncs_vector.h" +#include "analyzeFuncs.h" +#include "x86_ops.h" +#include "pulsefind.h" + +#ifndef M_PI + #define M_PI 3.14159265358979323846 +#endif + +// ============================================================================= +// JWS: Four variant chirp functions, first expands constants in memory +// +// Using Mendenhall Faster SinCos, coding based on +// v_vChirpData for SSE3 by: Alex Kan +// +int avx_ChirpData_a( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + const double chirp_rate, + int ul_NumDataPoints, + const double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("avx_ChirpData_a()"); +#endif + int i, vEnd; + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + const double srate = chirp_rate * 0.5 / (sample_rate * sample_rate); + + __m256 ss1fA = _mm256_set1_ps(1.5707963235f); + __m256 ss2fA = _mm256_set1_ps(-0.645963615f); + __m256 ss3fA = _mm256_set1_ps(0.0796819754f); + __m256 ss4fA = _mm256_set1_ps(-0.0046075748f); + __m256 cc1fA = _mm256_set1_ps(-1.2336977925f); + __m256 cc2fA = _mm256_set1_ps(0.2536086171f); + __m256 cc3fA = _mm256_set1_ps(-0.0204391631f); + __m256 oneA = _mm256_set1_ps(1.0f); + __m256 twoA = _mm256_set1_ps(2.0f); + __m256d eightA = _mm256_set1_pd(8.0); + + __m256d rate = _mm256_broadcast_sd(&srate); + __m256d roundVal = _mm256_set1_pd((srate >= 0.0) ? TWO_TO_52 : -TWO_TO_52); + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + __m256d di1 = _mm256_set_pd(5.0, 1.0, 4.0, 0.0); // set time patterns for eventual moveldup/movehdup + __m256d di2 = _mm256_set_pd(7.0, 3.0, 6.0, 2.0); + + for (i = 0; i < vEnd; i += 8) { + const float *data = (const float *) (cx_DataArray + i); + float *chirped = (float *) (cx_ChirpDataArray + i); + + __m256d a1, a2; + __m256 d1, d2; + __m256 cd1, cd2; + __m256 td1, td2; + __m256 x; + __m256 y; + __m256 z; + __m256 s; + __m256 c; + __m256 m; + + // load the signal to be chirped + prefetchnta((const void *)( data+64 )); + d1 = _mm256_load_ps(data); + d2 = _mm256_load_ps(data+8); + + // calculate the input angles + a1 = _mm256_mul_pd(_mm256_mul_pd(di1, di1), rate); + a2 = _mm256_mul_pd(_mm256_mul_pd(di2, di2), rate); + + // update time values for next iteration + di1 = _mm256_add_pd(di1, eightA); + di2 = _mm256_add_pd(di2, eightA); + + // reduce the angles to the range (-0.5, 0.5) + a1 = _mm256_sub_pd(a1, _mm256_sub_pd(_mm256_add_pd(a1, roundVal), roundVal)); + a2 = _mm256_sub_pd(a2, _mm256_sub_pd(_mm256_add_pd(a2, roundVal), roundVal)); + + // convert the 2 packed doubles to packed single + x = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm256_cvtpd_ps(a1)), _mm256_cvtpd_ps(a2), 1); + + // square to the range [0, 0.25) + y = _mm256_mul_ps(x, x); + + // perform the initial polynomial approximations + z = _mm256_mul_ps(y, y); + s = _mm256_mul_ps(_mm256_add_ps(_mm256_mul_ps(_mm256_add_ps(_mm256_mul_ps(y, ss4fA), + ss3fA), + z), + _mm256_add_ps(_mm256_mul_ps(y, ss2fA), + ss1fA)), + x); + c = _mm256_add_ps(_mm256_mul_ps(_mm256_add_ps(_mm256_mul_ps(y, cc3fA), + cc2fA), + z), + _mm256_add_ps(_mm256_mul_ps(y, cc1fA), + oneA)); + + // perform first angle doubling + x = _mm256_sub_ps(_mm256_mul_ps(c, c), _mm256_mul_ps(s, s)); + y = _mm256_mul_ps(_mm256_mul_ps(s, c), twoA); + + // calculate scaling factor to correct the magnitude + m = _mm256_sub_ps(_mm256_sub_ps(twoA, _mm256_mul_ps(x, x)), _mm256_mul_ps(y, y)); + + // perform second angle doubling + c = _mm256_sub_ps(_mm256_mul_ps(x, x), _mm256_mul_ps(y, y)); + s = _mm256_mul_ps(_mm256_mul_ps(y, x), twoA); + + // correct the magnitude (final sine / cosine approximations) + s = _mm256_mul_ps(s, m); + c = _mm256_mul_ps(c, m); // c7 c3 c6 c2 c5 c1 c4 c0 + + // chirp the data + cd1 = _mm256_moveldup_ps(c); // c3 c3 c2 c2 c1 c1 c0 c0 + cd2 = _mm256_movehdup_ps(c); // c7 c7 c6 c6 c5 c5 c4 c4 + cd1 = _mm256_mul_ps(cd1, d1); // c3.i3 c3.r3 c2.i2 c2.r2 c1.i1 c1.r1 c0.i0 c0.r0 + cd2 = _mm256_mul_ps(cd2, d2); // c7.i7 c7.r7 c6.i6 c6.r6 c5.i5 c5.r5 c4.i4 c4.r4 + d1 = _mm256_shuffle_ps(d1, d1, 0xb1); + d2 = _mm256_shuffle_ps(d2, d2, 0xb1); + td1 = _mm256_moveldup_ps(s); + td2 = _mm256_movehdup_ps(s); + td1 = _mm256_mul_ps(td1, d1); + td2 = _mm256_mul_ps(td2, d2); + cd1 = _mm256_addsub_ps(cd1, td1); + cd2 = _mm256_addsub_ps(cd2, td2); + + // store chirped values + _mm256_stream_ps(chirped, cd1); + _mm256_stream_ps(chirped+8, cd2); + } + _mm256_zeroupper (); + _mm_sfence(); + + // handle tail elements with scalar code + for ( ; i < ul_NumDataPoints; ++i) { + double angle = srate * i * i * 0.5; + angle -= floor(angle); + angle *= M_PI * 2; + double s = sin(angle); + double c = cos(angle); + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// JWS: Second variant, using vbroadcast to expand constants when used +int avx_ChirpData_b( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + const double chirp_rate, + int ul_NumDataPoints, + const double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("avx_ChirpData_b()"); +#endif + int i, vEnd; + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + const double srate = chirp_rate * 0.5 / (sample_rate * sample_rate); + + const float ss1f = 1.5707963235f; + const float ss2f = -0.645963615f; + const float ss3f = 0.0796819754f; + const float ss4f = -0.0046075748f; + const float cc1f = -1.2336977925f; + const float cc2f = 0.2536086171f; + const float cc3f = -0.0204391631f; + const float one = 1.0f; + const float two = 2.0f; + const double eight = 8.0; + + __m256d rate = _mm256_broadcast_sd(&srate); + __m256d roundVal = _mm256_set1_pd((srate >= 0.0) ? TWO_TO_52 : -TWO_TO_52); + + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + + // main vectorised loop + __m256d di1 = _mm256_set_pd(5.0, 1.0, 4.0, 0.0); // set time patterns for eventual moveldup/movehdup + __m256d di2 = _mm256_set_pd(7.0, 3.0, 6.0, 2.0); + + for (i = 0; i < vEnd; i += 8) { + const float *data = (const float *) (cx_DataArray + i); + float *chirped = (float *) (cx_ChirpDataArray + i); + + __m256d a1, a2; + __m256 d1, d2; + __m256 cd1, cd2; + __m256 td1, td2; + __m256 x; + __m256 y; + __m256 z; + __m256 s; + __m256 c; + __m256 m; + + // load the signal to be chirped + prefetchnta((const void *)( data+64 )); + d1 = _mm256_load_ps(data); + d2 = _mm256_load_ps(data+8); + + // calculate the input angles + a1 = _mm256_mul_pd(_mm256_mul_pd(di1, di1), rate); + a2 = _mm256_mul_pd(_mm256_mul_pd(di2, di2), rate); + + // update time values for next iteration + di1 = _mm256_add_pd(di1, _mm256_broadcast_sd(&eight)); + di2 = _mm256_add_pd(di2, _mm256_broadcast_sd(&eight)); + + // reduce the angles to the range (-0.5, 0.5) + a1 = _mm256_sub_pd(a1, _mm256_sub_pd(_mm256_add_pd(a1, roundVal), roundVal)); + a2 = _mm256_sub_pd(a2, _mm256_sub_pd(_mm256_add_pd(a2, roundVal), roundVal)); + + // convert the 2 packed doubles to packed single + x = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm256_cvtpd_ps(a1)), _mm256_cvtpd_ps(a2), 1); + + // square to the range [0, 0.25) + y = _mm256_mul_ps(x, x); + + // perform the initial polynomial approximations + z = _mm256_mul_ps(y, y); + s = _mm256_mul_ps(_mm256_add_ps(_mm256_mul_ps(_mm256_add_ps(_mm256_mul_ps(y, _mm256_broadcast_ss(&ss4f)), + _mm256_broadcast_ss(&ss3f)), + z), + _mm256_add_ps(_mm256_mul_ps(y, _mm256_broadcast_ss(&ss2f)), + _mm256_broadcast_ss(&ss1f))), + x); + c = _mm256_add_ps(_mm256_mul_ps(_mm256_add_ps(_mm256_mul_ps(y, _mm256_broadcast_ss(&cc3f)), + _mm256_broadcast_ss(&cc2f)), + z), + _mm256_add_ps(_mm256_mul_ps(y, _mm256_broadcast_ss(&cc1f)), + _mm256_broadcast_ss(&one))); + + // perform first angle doubling + x = _mm256_sub_ps(_mm256_mul_ps(c, c), _mm256_mul_ps(s, s)); + y = _mm256_mul_ps(_mm256_mul_ps(s, c), _mm256_broadcast_ss(&two)); + + // calculate scaling factor to correct the magnitude + m = _mm256_sub_ps(_mm256_sub_ps(_mm256_broadcast_ss(&two), _mm256_mul_ps(x, x)), _mm256_mul_ps(y, y)); + + // perform second angle doubling + c = _mm256_sub_ps(_mm256_mul_ps(x, x), _mm256_mul_ps(y, y)); + s = _mm256_mul_ps(_mm256_mul_ps(y, x), _mm256_broadcast_ss(&two)); + + // correct the magnitude (final sine / cosine approximations) + s = _mm256_mul_ps(s, m); + c = _mm256_mul_ps(c, m); + + // chirp the data + cd1 = _mm256_moveldup_ps(c); + cd2 = _mm256_movehdup_ps(c); + cd1 = _mm256_mul_ps(cd1, d1); + cd2 = _mm256_mul_ps(cd2, d2); + d1 = _mm256_shuffle_ps(d1, d1, 0xb1); + d2 = _mm256_shuffle_ps(d2, d2, 0xb1); + td1 = _mm256_moveldup_ps(s); + td2 = _mm256_movehdup_ps(s); + td1 = _mm256_mul_ps(td1, d1); + td2 = _mm256_mul_ps(td2, d2); + cd1 = _mm256_addsub_ps(cd1, td1); + cd2 = _mm256_addsub_ps(cd2, td2); + + // store chirped values + _mm256_stream_ps(chirped, cd1); + _mm256_stream_ps(chirped+8, cd2); + } + _mm256_zeroupper(); + _mm_sfence(); + + // never happens, handle tail elements with scalar code + for ( ; i < ul_NumDataPoints; ++i) { + double angle = srate * i * i * 0.5; + angle -= floor(angle); + angle *= M_PI * 2; + double s = sin(angle); + double c = cos(angle); + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// Third variant, like the first but instruction sequences modified so most instructions +// are not dependent on results of immediately preceding instruction. +// This may not have much effect on CPUs with excellent out of order capability. +int avx_ChirpData_c( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + const double chirp_rate, + int ul_NumDataPoints, + const double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("avx_ChirpData_c()"); +#endif + int i, vEnd; + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + const double srate = chirp_rate * 0.5 / (sample_rate * sample_rate); + + __m256 ss1fA = _mm256_set1_ps(1.5707963235f); + __m256 ss2fA = _mm256_set1_ps(-0.645963615f); + __m256 ss3fA = _mm256_set1_ps(0.0796819754f); + __m256 ss4fA = _mm256_set1_ps(-0.0046075748f); + __m256 cc1fA = _mm256_set1_ps(-1.2336977925f); + __m256 cc2fA = _mm256_set1_ps(0.2536086171f); + __m256 cc3fA = _mm256_set1_ps(-0.0204391631f); + __m256 oneA = _mm256_set1_ps(1.0f); + __m256 twoA = _mm256_set1_ps(2.0f); + __m256d eightA = _mm256_set1_pd(8.0); + + __m256d rate = _mm256_broadcast_sd(&srate); + __m256d roundVal = _mm256_set1_pd((srate >= 0.0) ? TWO_TO_52 : -TWO_TO_52); + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + __m256d di1 = _mm256_set_pd(5.0, 1.0, 4.0, 0.0); // set time patterns for eventual moveldup/movehdup + __m256d di2 = _mm256_set_pd(7.0, 3.0, 6.0, 2.0); + + for (i = 0; i < vEnd; i += 8) { + const float *data = (const float *) (cx_DataArray + i); + float *chirped = (float *) (cx_ChirpDataArray + i); + + __m256d a1, a2; + __m256 d1, d2; + __m256 cd1, cd2; + __m256 td1, td2; + __m256 v; + __m256 w; + __m256 x; + __m256 y; + __m256 z; + __m256 s; + __m256 c; + __m256 m; + + // load the signal to be chirped + prefetchnta((const void *)( data+64 )); + d1 = _mm256_load_ps(data); + d2 = _mm256_load_ps(data+8); + + // calculate the input angles + a1 = _mm256_mul_pd(di1, di1); + a2 = _mm256_mul_pd(di2, di2); + a1 = _mm256_mul_pd(a1, rate); + a2 = _mm256_mul_pd(a2, rate); + + // reduce the angles to the range (-0.5, 0.5) + a1 = _mm256_sub_pd(a1, _mm256_sub_pd(_mm256_add_pd(a1, roundVal), roundVal)); + a2 = _mm256_sub_pd(a2, _mm256_sub_pd(_mm256_add_pd(a2, roundVal), roundVal)); + + // update time values for next iteration + di1 = _mm256_add_pd(di1, eightA); + di2 = _mm256_add_pd(di2, eightA); + + // convert the 2 packed doubles to packed single + y = _mm256_castps128_ps256(_mm256_cvtpd_ps(a1)); + x = _mm256_insertf128_ps(y, _mm256_cvtpd_ps(a2), 1); + + // square to the range [0, 0.25) + y = _mm256_mul_ps(x, x); + + // perform the initial polynomial approximations with interleaved Estrin sequences + z = _mm256_mul_ps(y, y); + s = _mm256_mul_ps(y, ss4fA); + c = _mm256_mul_ps(y, cc3fA); + s = _mm256_add_ps(s, ss3fA); + c = _mm256_add_ps(c, cc2fA); + s = _mm256_mul_ps(s, z); + c = _mm256_mul_ps(c, z); + v = _mm256_mul_ps(y, ss2fA); + w = _mm256_mul_ps(y, cc1fA); + v = _mm256_add_ps(v, ss1fA); + w = _mm256_add_ps(w, oneA); + s = _mm256_add_ps(s, v); + c = _mm256_add_ps(c, w); + s = _mm256_mul_ps(s, x); + + // perform first angle doubling + v = _mm256_mul_ps(c, c); + w = _mm256_mul_ps(s, s); + y = _mm256_mul_ps(s, c); + x = _mm256_sub_ps(v, w); + y = _mm256_mul_ps(y, twoA); + + // calculate scaling factor to correct the magnitude + // and interleave the second angle doubling + v = _mm256_mul_ps(x, x); + w = _mm256_mul_ps(y, y); + m = _mm256_sub_ps(twoA, v); + c = _mm256_sub_ps(v, w); + s = _mm256_mul_ps(y, x); + m = _mm256_sub_ps(m, w); + s = _mm256_mul_ps(s, twoA); + + // correct the magnitude (final sine / cosine approximations) + c = _mm256_mul_ps(c, m); + s = _mm256_mul_ps(s, m); + + // chirp the data + cd1 = _mm256_moveldup_ps(c); + td1 = _mm256_moveldup_ps(s); + cd2 = _mm256_movehdup_ps(c); + td2 = _mm256_movehdup_ps(s); + cd1 = _mm256_mul_ps(cd1, d1); + cd2 = _mm256_mul_ps(cd2, d2); + d1 = _mm256_shuffle_ps(d1, d1, 0xb1); + d2 = _mm256_shuffle_ps(d2, d2, 0xb1); + td1 = _mm256_mul_ps(td1, d1); + td2 = _mm256_mul_ps(td2, d2); + cd1 = _mm256_addsub_ps(cd1, td1); + cd2 = _mm256_addsub_ps(cd2, td2); + + // store chirped values + _mm256_stream_ps(chirped, cd1); + _mm256_stream_ps(chirped+8, cd2); + } + _mm256_zeroupper (); + _mm_sfence(); + + // handle tail elements with scalar code + for ( ; i < ul_NumDataPoints; ++i) { + double angle = srate * i * i * 0.5; + angle -= floor(angle); + angle *= M_PI * 2; + double s = sin(angle); + double c = cos(angle); + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// Fourth variant, like third but using _mm256_round_pd for angle reduction. +int avx_ChirpData_d( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + const double chirp_rate, + int ul_NumDataPoints, + const double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("avx_ChirpData_d()"); +#endif + int i, vEnd; + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + const double srate = chirp_rate * 0.5 / (sample_rate * sample_rate); + + __m256 ss1fA = _mm256_set1_ps(1.5707963235f); + __m256 ss2fA = _mm256_set1_ps(-0.645963615f); + __m256 ss3fA = _mm256_set1_ps(0.0796819754f); + __m256 ss4fA = _mm256_set1_ps(-0.0046075748f); + __m256 cc1fA = _mm256_set1_ps(-1.2336977925f); + __m256 cc2fA = _mm256_set1_ps(0.2536086171f); + __m256 cc3fA = _mm256_set1_ps(-0.0204391631f); + __m256 oneA = _mm256_set1_ps(1.0f); + __m256 twoA = _mm256_set1_ps(2.0f); + __m256d eightA = _mm256_set1_pd(8.0); + + __m256d rate = _mm256_broadcast_sd(&srate); + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + __m256d di1 = _mm256_set_pd(5.0, 1.0, 4.0, 0.0); + __m256d di2 = _mm256_set_pd(7.0, 3.0, 6.0, 2.0); + + for (i = 0; i < vEnd; i += 8) { + const float *data = (const float *) (cx_DataArray + i); + float *chirped = (float *) (cx_ChirpDataArray + i); + + __m256d a1, a2; + __m256 d1, d2; + __m256 cd1, cd2; + __m256 td1, td2; + __m256 v; + __m256 w; + __m256 x; + __m256 y; + __m256 z; + __m256 s; + __m256 c; + __m256 m; + + // load the signal to be chirped + prefetchnta((const void *)( data+64 )); + d1 = _mm256_load_ps(data); + d2 = _mm256_load_ps(data+8); + + // calculate the input angles + a1 = _mm256_mul_pd(di1, di1); + a2 = _mm256_mul_pd(di2, di2); + a1 = _mm256_mul_pd(a1, rate); + a2 = _mm256_mul_pd(a2, rate); + + // reduce the angles to the range (-0.5, 0.5) + a1 = _mm256_sub_pd(a1, _mm256_round_pd(a1, 0)); // round to nearest + a2 = _mm256_sub_pd(a2, _mm256_round_pd(a2, 0)); + + // update time values for next iteration + di1 = _mm256_add_pd(di1, eightA); + di2 = _mm256_add_pd(di2, eightA); + + // convert the 2 packed doubles to packed single + y = _mm256_castps128_ps256(_mm256_cvtpd_ps(a1)); + x = _mm256_insertf128_ps(y, _mm256_cvtpd_ps(a2), 1); + + // square to the range [0, 0.25) + y = _mm256_mul_ps(x, x); + + // perform the initial polynomial approximations with interleaved Estrin sequences + z = _mm256_mul_ps(y, y); + s = _mm256_mul_ps(y, ss4fA); + c = _mm256_mul_ps(y, cc3fA); + s = _mm256_add_ps(s, ss3fA); + c = _mm256_add_ps(c, cc2fA); + s = _mm256_mul_ps(s, z); + c = _mm256_mul_ps(c, z); + v = _mm256_mul_ps(y, ss2fA); + w = _mm256_mul_ps(y, cc1fA); + v = _mm256_add_ps(v, ss1fA); + w = _mm256_add_ps(w, oneA); + s = _mm256_add_ps(s, v); + c = _mm256_add_ps(c, w); + s = _mm256_mul_ps(s, x); + + // perform first angle doubling + v = _mm256_mul_ps(c, c); + w = _mm256_mul_ps(s, s); + y = _mm256_mul_ps(s, c); + x = _mm256_sub_ps(v, w); + y = _mm256_mul_ps(y, twoA); + + // calculate scaling factor to correct the magnitude + // and interleave the second angle doubling + v = _mm256_mul_ps(x, x); + w = _mm256_mul_ps(y, y); + m = _mm256_sub_ps(twoA, v); + c = _mm256_sub_ps(v, w); + s = _mm256_mul_ps(y, x); + m = _mm256_sub_ps(m, w); + s = _mm256_mul_ps(s, twoA); + + // correct the magnitude (final sine / cosine approximations) + c = _mm256_mul_ps(c, m); + s = _mm256_mul_ps(s, m); + + // chirp the data + cd1 = _mm256_moveldup_ps(c); + td1 = _mm256_moveldup_ps(s); + cd2 = _mm256_movehdup_ps(c); + td2 = _mm256_movehdup_ps(s); + cd1 = _mm256_mul_ps(cd1, d1); + cd2 = _mm256_mul_ps(cd2, d2); + d1 = _mm256_shuffle_ps(d1, d1, 0xb1); + d2 = _mm256_shuffle_ps(d2, d2, 0xb1); + td1 = _mm256_mul_ps(td1, d1); + td2 = _mm256_mul_ps(td2, d2); + cd1 = _mm256_addsub_ps(cd1, td1); + cd2 = _mm256_addsub_ps(cd2, td2); + + // store chirped values + _mm256_stream_ps(chirped, cd1); + _mm256_stream_ps(chirped+8, cd2); + } + _mm256_zeroupper (); + _mm_sfence(); + + // handle tail elements with scalar code + for ( ; i < ul_NumDataPoints; ++i) { + double angle = srate * i * i * 0.5; + angle -= floor(angle); + angle *= M_PI * 2; + double s = sin(angle); + double c = cos(angle); + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +// ============================================================================= +// JWS: AVX transpose functions +// + +inline void v_avxSubTranspose4x8ntw(float *in, float *out, int xline, int yline) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_avxSubTranspose4x8ntw()"); +#endif + // Do two simultaneous 4x4 transposes in the YMM registers, non-temporal writes. + // Input is 8 rows of 4 floats, output is 4 columns of 8 floats. + // An sfence is needed after using this sub to ensure global visibilty of the writes. + + __m256 r04 = _mm256_insertf128_ps(_mm256_castps128_ps256(*((__m128*)(in+0*xline))), (*((__m128*)(in+4*xline))), 0x1); // a0b0c0d0a4b4c4d4 + __m256 r26 = _mm256_insertf128_ps(_mm256_castps128_ps256(*((__m128*)(in+2*xline))), (*((__m128*)(in+6*xline))), 0x1); // a2b2c2d2a6b6c6d6 + __m256 r15 = _mm256_insertf128_ps(_mm256_castps128_ps256(*((__m128*)(in+1*xline))), (*((__m128*)(in+5*xline))), 0x1); // a1b1c1d1a5b5c5d5 + __m256 r37 = _mm256_insertf128_ps(_mm256_castps128_ps256(*((__m128*)(in+3*xline))), (*((__m128*)(in+7*xline))), 0x1); // a3b3c3d3a7b7c7d7 + + __m256 c01e = _mm256_unpacklo_ps(r04, r26); // a0a2b0b2a4a6b4b6 + __m256 c23e = _mm256_unpackhi_ps(r04, r26); // c0c2d0d2c4c6d4d6 + __m256 c01o = _mm256_unpacklo_ps(r15, r37); // a1a3b1b3a5a7b5b7 + __m256 c23o = _mm256_unpackhi_ps(r15, r37); // c1c3d1d3c5c7d5d7 + + _mm256_stream_ps(out+0*yline, _mm256_unpacklo_ps(c01e, c01o)); // a0a1a2a3a4a5a6a7 + _mm256_stream_ps(out+1*yline, _mm256_unpackhi_ps(c01e, c01o)); // b0b1b2b3b4b5b6b7 + _mm256_stream_ps(out+2*yline, _mm256_unpacklo_ps(c23e, c23o)); // c0c1c2c3c4c5c6c7 + _mm256_stream_ps(out+3*yline, _mm256_unpackhi_ps(c23e, c23o)); // d0d1d2d3d4d5d6d7 +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +int v_avxTranspose4x8ntw(int x, int y, float *in, float *out) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_avxTranspose4x8ntw()"); +#endif + int i,j; + + for (j=0;jdi) - 1) & 7); + __m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f); + __m256 taillim = _mm256_broadcast_ss(&lim); + __m256 maxV = _mm256_setzero_ps(); + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1; + float *pst = P->dest; + __m256 x1, x2, tailmask; + + // No unroll, Sandy Bridge has a limited uop cache which should be conserved. + while (i < P->di-8) { + x1 = _mm256_load_ps(p1+i); + x2 = _mm256_add_ps(x1, *(__m256*)(p2+i)); + x1 = _mm256_add_ps(x2, *(__m256*)(p3+i)); + _mm256_store_ps(pst+i, x1); + maxV = _mm256_max_ps(maxV, x1); + i += 8; + } + x1 = _mm256_load_ps(p1+i); + x2 = _mm256_add_ps(x1, *(__m256*)(p2+i)); + x1 = _mm256_add_ps(x2, *(__m256*)(p3+i)); + + tailmask = _mm256_cmp_ps(taillim, tailelem, 0x0d); // taillim floats >= tailelem floats + _mm256_maskstore_ps(pst+i, AVX_MASKSTORE_TYPECAST(tailmask), x1); + x2 = _mm256_and_ps(x1, tailmask); + maxV = _mm256_max_ps(maxV, x2); + x1 = _mm256_permute2f128_ps(maxV, maxV, 0x81); + maxV = _mm256_max_ps(maxV, x1); // max in low 4 + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0xee)); // in low 2 + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01)); // 1 + float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV)); + _mm256_zeroupper(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AVXTBa3[FOLDTBLEN] = {foldBy3}; + + +float foldBy4(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldBy4()"); +#endif + const float lim = (float)(((P->di) - 1) & 7); + __m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f); + __m256 taillim = _mm256_broadcast_ss(&lim); + __m256 maxV = _mm256_setzero_ps(); + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2; + float *pst = P->dest; + __m256 x1, x2, tailmask; + + while (i < P->di-8) { + x1 = _mm256_load_ps(p1+i); + x2 = _mm256_add_ps(x1, *(__m256*)(p2+i)); + x1 = _mm256_add_ps(x2, *(__m256*)(p3+i)); + x2 = _mm256_add_ps(x1, *(__m256*)(p4+i)); + _mm256_store_ps(pst+i, x2); + maxV = _mm256_max_ps(maxV, x2); + i += 8; + } + x1 = _mm256_load_ps(p1+i); + x2 = _mm256_add_ps(x1, *(__m256*)(p2+i)); + x1 = _mm256_add_ps(x2, *(__m256*)(p3+i)); + x2 = _mm256_add_ps(x1, *(__m256*)(p4+i)); + + tailmask = _mm256_cmp_ps(taillim, tailelem, 0x0d); + _mm256_maskstore_ps(pst+i, AVX_MASKSTORE_TYPECAST(tailmask), x2); + x1 = _mm256_and_ps(x2, tailmask); + maxV = _mm256_max_ps(maxV, x1); + x2 = _mm256_permute2f128_ps(maxV, maxV, 0x81); + maxV = _mm256_max_ps(maxV, x2); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0xee)); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01)); + float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV)); + _mm256_zeroupper(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AVXTBa4[FOLDTBLEN] = {foldBy4}; + + +float foldBy5(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldBy5()"); +#endif + const float lim = (float)(((P->di) - 1) & 7); + __m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f); + __m256 taillim = _mm256_broadcast_ss(&lim); + __m256 maxV = _mm256_setzero_ps(); + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2, *p5 = ss[0]+P->tmp3; + float *pst = P->dest; + __m256 x1, x2, tailmask; + + while (i < P->di-8) { + x1 = _mm256_load_ps(p1+i); + x2 = _mm256_add_ps(x1, *(__m256*)(p2+i)); + x1 = _mm256_add_ps(x2, *(__m256*)(p3+i)); + x2 = _mm256_add_ps(x1, *(__m256*)(p4+i)); + x1 = _mm256_add_ps(x2, *(__m256*)(p5+i)); + _mm256_store_ps(pst+i, x1); + maxV = _mm256_max_ps(maxV, x1); + i += 8; + } + x1 = _mm256_load_ps(p1+i); + x2 = _mm256_add_ps(x1, *(__m256*)(p2+i)); + x1 = _mm256_add_ps(x2, *(__m256*)(p3+i)); + x2 = _mm256_add_ps(x1, *(__m256*)(p4+i)); + x1 = _mm256_add_ps(x2, *(__m256*)(p5+i)); + + tailmask = _mm256_cmp_ps(taillim, tailelem, 0x0d); + _mm256_maskstore_ps(pst+i, AVX_MASKSTORE_TYPECAST(tailmask), x1); + x2 = _mm256_and_ps(x1, tailmask); + maxV = _mm256_max_ps(maxV, x2); + x1 = _mm256_permute2f128_ps(maxV, maxV, 0x81); + maxV = _mm256_max_ps(maxV, x1); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0xee)); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01)); + float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV)); + _mm256_zeroupper(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AVXTBa5[FOLDTBLEN] = {foldBy5}; + + +float foldBy2(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldBy2()"); +#endif + const float lim = (float)(((P->di) - 1) & 7); + __m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f); + __m256 taillim = _mm256_broadcast_ss(&lim); + __m256 maxV = _mm256_setzero_ps(); + int i = 0; + + const float *p1 = ss[1]+P->offset, *p2 = ss[1]+P->tmp0; + float *pst = P->dest; + __m256 x1, x2, tailmask; + + while (i < P->di-8) { + x1 = _mm256_load_ps(p1+i); + x2 = _mm256_add_ps(x1, *(__m256*)(p2+i)); + _mm256_store_ps(pst+i, x2); + maxV = _mm256_max_ps(maxV, x2); + i += 8; + } + x1 = _mm256_load_ps(p1+i); + x2 = _mm256_add_ps(x1, *(__m256*)(p2+i)); + + tailmask = _mm256_cmp_ps(taillim, tailelem, 0x0d); + _mm256_maskstore_ps(pst+i, AVX_MASKSTORE_TYPECAST(tailmask), x2); + x1 = _mm256_and_ps(x2, tailmask); + maxV = _mm256_max_ps(maxV, x1); + x2 = _mm256_permute2f128_ps(maxV, maxV, 0x81); + maxV = _mm256_max_ps(maxV, x2); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0xee)); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01)); + float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV)); + _mm256_zeroupper(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AVXTBa2[FOLDTBLEN] = {foldBy2}; + +FoldSet AVXfold_a = {AVXTBa3, AVXTBa4, AVXTBa5, AVXTBa2, AVXTBa2, "JS AVX_a"}; + + + +// Alternate set using 16 byte unaligned loads and inserts for the probably unaligned +// elements, based on Intel optimization recommendations. +float foldBy3c(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldBy3c()"); +#endif + const float lim = (float)(((P->di) - 1) & 7); + __m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f); + __m256 taillim = _mm256_broadcast_ss(&lim); + __m256 maxV = _mm256_setzero_ps(); + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1; + float *pst = P->dest; + __m256 x1, x2, tailmask; + + while (i < P->di-8) { + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p2+i)), _mm_load_ps(p2+i+4), 1); + x1 = _mm256_add_ps(x2, *(__m256*)(p1+i)); + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p3+i)), _mm_load_ps(p3+i+4), 1); + x1 = _mm256_add_ps(x1, x2); + _mm256_store_ps(pst+i, x1); + maxV = _mm256_max_ps(maxV, x1); + i += 8; + } + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p2+i)), _mm_load_ps(p2+i+4), 1); + x1 = _mm256_add_ps(x2, *(__m256*)(p1+i)); + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p3+i)), _mm_load_ps(p3+i+4), 1); + x1 = _mm256_add_ps(x1, x2); + + tailmask = _mm256_cmp_ps(taillim, tailelem, 0x0d); + _mm256_maskstore_ps(pst+i, AVX_MASKSTORE_TYPECAST(tailmask), x1); + x2 = _mm256_and_ps(x1, tailmask); + maxV = _mm256_max_ps(maxV, x2); + x1 = _mm256_permute2f128_ps(maxV, maxV, 0x81); + maxV = _mm256_max_ps(maxV, x1); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0xee)); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01)); + float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV)); + _mm256_zeroupper(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AVXTBc3[FOLDTBLEN] = {foldBy3c}; + + +float foldBy4c(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldBy4c"); +#endif + const float lim = (float)(((P->di) - 1) & 7); + __m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f); + __m256 taillim = _mm256_broadcast_ss(&lim); + __m256 maxV = _mm256_setzero_ps(); + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2; + float *pst = P->dest; + __m256 x1, x2, tailmask; + + while (i < P->di-8) { + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p2+i)), _mm_load_ps(p2+i+4), 1); + x2 = _mm256_add_ps(x1, *(__m256*)(p1+i)); + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p3+i)), _mm_load_ps(p3+i+4), 1); + x2 = _mm256_add_ps(x2, x1); + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p4+i)), _mm_load_ps(p4+i+4), 1); + x2 = _mm256_add_ps(x2, x1); + _mm256_store_ps(pst+i, x2); + maxV = _mm256_max_ps(maxV, x2); + i += 8; + } + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p2+i)), _mm_load_ps(p2+i+4), 1); + x2 = _mm256_add_ps(x1, *(__m256*)(p1+i)); + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p3+i)), _mm_load_ps(p3+i+4), 1); + x2 = _mm256_add_ps(x2, x1); + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p4+i)), _mm_load_ps(p4+i+4), 1); + x2 = _mm256_add_ps(x2, x1); + + tailmask = _mm256_cmp_ps(taillim, tailelem, 0x0d); + _mm256_maskstore_ps(pst+i, AVX_MASKSTORE_TYPECAST(tailmask), x2); + x1 = _mm256_and_ps(x2, tailmask); + maxV = _mm256_max_ps(maxV, x1); + x2 = _mm256_permute2f128_ps(maxV, maxV, 0x81); + maxV = _mm256_max_ps(maxV, x2); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0xee)); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01)); + float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV)); + _mm256_zeroupper(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AVXTBc4[FOLDTBLEN] = {foldBy4c}; + + +float foldBy5c(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldBy5c()"); +#endif + const float lim = (float)(((P->di) - 1) & 7); + __m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f); + __m256 taillim = _mm256_broadcast_ss(&lim); + __m256 maxV = _mm256_setzero_ps(); + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2, *p5 = ss[0]+P->tmp3; + float *pst = P->dest; + __m256 x1, x2, tailmask; + + while (i < P->di-8) { + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p2+i)), _mm_load_ps(p2+i+4), 1); + x1 = _mm256_add_ps(x1, *(__m256*)(p1+i)); + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p3+i)), _mm_load_ps(p3+i+4), 1); + x1 = _mm256_add_ps(x1, x2); + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p4+i)), _mm_load_ps(p4+i+4), 1); + x1 = _mm256_add_ps(x1, x2); + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p5+i)), _mm_load_ps(p5+i+4), 1); + x1 = _mm256_add_ps(x1, x2); + _mm256_store_ps(pst+i, x1); + maxV = _mm256_max_ps(maxV, x1); + i += 8; + } + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p2+i)), _mm_load_ps(p2+i+4), 1); + x1 = _mm256_add_ps(x1, *(__m256*)(p1+i)); + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p3+i)), _mm_load_ps(p3+i+4), 1); + x1 = _mm256_add_ps(x1, x2); + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p4+i)), _mm_load_ps(p4+i+4), 1); + x1 = _mm256_add_ps(x1, x2); + x2 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p5+i)), _mm_load_ps(p5+i+4), 1); + x1 = _mm256_add_ps(x1, x2); + + tailmask = _mm256_cmp_ps(taillim, tailelem, 0x0d); + _mm256_maskstore_ps(pst+i, AVX_MASKSTORE_TYPECAST(tailmask), x1); + x2 = _mm256_and_ps(x1, tailmask); + maxV = _mm256_max_ps(maxV, x2); + x1 = _mm256_permute2f128_ps(maxV, maxV, 0x81); + maxV = _mm256_max_ps(maxV, x1); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0xee)); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01)); + float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV)); + _mm256_zeroupper(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AVXTBc5[FOLDTBLEN] = {foldBy5c}; + + +float foldBy2c(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldBy2c()"); +#endif + const float lim = (float)(((P->di) - 1) & 7); + __m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f); + __m256 taillim = _mm256_broadcast_ss(&lim); + __m256 maxV = _mm256_setzero_ps(); + int i = 0; + + const float *p1 = ss[1]+P->offset, *p2 = ss[1]+P->tmp0; + float *pst = P->dest; + __m256 x1, x2, tailmask; + + while (i < P->di-8) { + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p2+i)), _mm_load_ps(p2+i+4), 1); + x2 = _mm256_add_ps(x1, *(__m256*)(p1+i)); + _mm256_store_ps(pst+i, x2); + maxV = _mm256_max_ps(maxV, x2); + i += 8; + } + x1 = _mm256_insertf128_ps(_mm256_castps128_ps256(_mm_loadu_ps(p2+i)), _mm_load_ps(p2+i+4), 1); + x2 = _mm256_add_ps(x1, *(__m256*)(p1+i)); + + tailmask = _mm256_cmp_ps(taillim, tailelem, 0x0d); + _mm256_maskstore_ps(pst+i, AVX_MASKSTORE_TYPECAST(tailmask), x2); + x1 = _mm256_and_ps(x2, tailmask); + maxV = _mm256_max_ps(maxV, x1); + x2 = _mm256_permute2f128_ps(maxV, maxV, 0x81); + maxV = _mm256_max_ps(maxV, x2); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0xee)); + maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01)); + float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV)); + _mm256_zeroupper(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AVXTBc2[FOLDTBLEN] = {foldBy2c}; + +FoldSet AVXfold_c = {AVXTBc3, AVXTBc4, AVXTBc5, AVXTBc2, AVXTBc2, "JS AVX_c"}; + + + +#endif // (USE_AVX) && (USE_INTRINSICS) diff --git a/client/vector/analyzeFuncs_fpu.cpp b/client/vector/analyzeFuncs_fpu.cpp new file mode 100644 index 0000000..878a1a9 --- /dev/null +++ b/client/vector/analyzeFuncs_fpu.cpp @@ -0,0 +1,369 @@ +// Copyright 2007 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#include "sah_config.h" +#include +#include +#include "analyzeFuncs.h" +#include "analyzeFuncs_vector.h" +#include "sincos.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +// ********************************************************* +// +// JWS: FPU chirp using Flemming Pedersen (CERN) fast double sincos, +// http://pedersen.web.cern.ch/pedersen/project-leir-dsp-bc/matlab/fast_sine_cosine/fast_sine_cosine.doc +// Similar to Marcus Mendenhall Faster SinCos except no final adjustment +// because doubles produce good accuracy without. +// +// Includes quick FPU rounding developed for sse1 version. +// +inline void set_up_fastfrac(double roundVal) { +// this routine only exists for compilers that can't tell that a value is +// being popped from the FP stack and then immediately reloaded. +#if defined(_MSC_VER) && !defined(_WIN64) + __asm fld roundVal; // get roundVal +#endif +} + +inline void clean_up_fastfrac() { +// this routine only exists for compilers than needed set_up_fastfrac() +#if defined(_MSC_VER) && !defined(_WIN64) + __asm fstp st(0); // pop roundVal off FPU stack +#endif +} + +// This routine should work as long as x86_64 supports x87 instructions. +// After that the illegal instruction trap should take care of it. +inline double fastfrac(double val, double roundVal) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fastfrac()"); +#endif + // reduce val to the range (-0.5, 0.5) using "val - round(val)" +#if defined(_MSC_VER) && !defined(_WIN64) + __asm { + fld val // get angle + fadd st(0), st(1) // + roundVal + fsub st(0), st(1) // - roundVal, integer in st(0) + fsubr val // angle - integer + fstp val // store reduced angle + } + +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + __asm__ __volatile__( + "fadd %2,%0\n" // + roundVal +" fsub %2,%0\n" // - roundVal, integer in st(0) +" fsubr %3,%0\n" // angle - integer + : "=&t" (val) + : "0" (val), "f" (roundVal), "f" (val) + ); +#elif defined(_WIN64)//R: doesn't correctly work for ARM + val -= ((val + roundVal) - roundVal); // TODO: ADD CHECK THAT THIS WORKS +#else + val -= floor(val + 0.5); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return val; +} + +static unsigned short fpucw1; + +inline void set_extended_precision() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("set_extended_precision()"); +#endif + // Windows and *BSD operate the X87 FPU so it rounds at mantissa bit 53, the + // quick rounding algorithm needs rounding at the last bit. + unsigned short fpucw2; +#if defined(_MSC_VER) && !defined(_WIN64) // MSVC no inline assembly for 64 bit + __asm fnstcw fpucw1; + fpucw2 = fpucw1 | 0x300; + __asm fldcw fpucw2; +#elif defined(__GNUC__) && (defined(_WIN32) || defined(_WIN64) || defined(_BSD)) + __asm__ __volatile__ ("fnstcw %0" : "=m" (fpucw1)); + fpucw2 = fpucw1 | 0x300; + __asm__ __volatile__ ("fldcw %0" : : "m" (fpucw2)); +#else + // Nothing necessary for linux, osx, _WIN64 VC++ and most everything else. +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +inline void restore_fpucw() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("restore_fpucw()"); +#endif +#if defined(_MSC_VER) && !defined(_WIN64) + __asm fldcw fpucw1; +#elif defined(__GNUC__) && (defined(_WIN32) || defined(_WIN64) || defined(_BSD)) + __asm__ __volatile__ ("fldcw %0" : : "m" (fpucw1)); +#else + // NADA +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +double z; + +int fpu_ChirpData ( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fpu_ChirpData()"); +#endif + if (ChirpRateInd == 0) { + memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + double srate = ChirpRate * 0.5 / (sample_rate * sample_rate); + + +#if (!defined(__GNUC__) && defined(_WIN64)) || \ + (defined(__GNUC__) && !(defined(__i386__) || defined(__x86_64__))) + double roundVal = (srate >= 0.0) ? TWO_TO_52 : -TWO_TO_52; +#else + double roundVal = (srate >= 0.0) ? ROUNDX87 : -ROUNDX87; +#endif + + int i, j, vEnd; + unsigned short fpucw1, fpucw2; + + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + + // main loop + for (i = 0; i < vEnd; i += 8) { + double angles[8], dtemp; + double cd1, cd2, cd3; + double x, y; + double s, c; + float real, imag; + + dtemp = double( i ); + angles[0] = dtemp+0.0; + angles[1] = dtemp+1.0; + angles[2] = dtemp+2.0; + angles[3] = dtemp+3.0; + angles[4] = dtemp+4.0; + angles[5] = dtemp+5.0; + angles[6] = dtemp+6.0; + angles[7] = dtemp+7.0; + + // calculate the input angle + angles[0] *= angles[0] * srate; // angle^2 * rate + angles[1] *= angles[1] * srate; + angles[2] *= angles[2] * srate; + angles[3] *= angles[3] * srate; + angles[4] *= angles[4] * srate; + angles[5] *= angles[5] * srate; + angles[6] *= angles[6] * srate; + angles[7] *= angles[7] * srate; + + // Do 8 angles to amortize the time cost of precision switching. + set_extended_precision(); + set_up_fastfrac(roundVal); + angles[0]=fastfrac(angles[0],roundVal); + angles[1]=fastfrac(angles[1],roundVal); + angles[2]=fastfrac(angles[2],roundVal); + angles[3]=fastfrac(angles[3],roundVal); + angles[4]=fastfrac(angles[4],roundVal); + angles[5]=fastfrac(angles[5],roundVal); + angles[6]=fastfrac(angles[6],roundVal); + angles[7]=fastfrac(angles[7],roundVal); + clean_up_fastfrac(); + restore_fpucw(); + + for ( j = 0; j < 8; j++ ) { + + // square angle to the range [0, 0.25) + y = angles[j] * angles[j]; + + // perform the initial polynomial approximations + s = y * FS4; + c = y * FC3; + s += FS3; + c += FC2; + s *= y; + c *= y; + s += FS2; + c += FC1; + s *= y; + c *= y; + s += FS1; + s *= angles[j]; + c += 1; + + // perform first angle doubling + x = c * c - s * s; + y = s * c * 2; + cd1 = x * y; + cd2 = x * x; + cd3 = y * y; + + // perform second angle doubling + s = cd1 * 2; + c = cd2 - cd3; + + // chirp and store + real = (float)(cx_DataArray[i + j][0] * c - cx_DataArray[i + j][1] * s); + imag = (float)(cx_DataArray[i + j][0] * s + cx_DataArray[i + j][1] * c); + cx_ChirpDataArray[i + j][0] = real; + cx_ChirpDataArray[i + j][1] = imag; + + } + } + + if( i < ul_NumDataPoints) { + // use original routine to finish up any tailings (max stride-1 elements) + v_ChirpData(cx_DataArray+i, cx_ChirpDataArray+i + , ChirpRateInd, ChirpRate, ul_NumDataPoints-i, sample_rate); + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +// opt_v_ChirpData +// 8-10-06 BENH - Unrolled loop 3 times to allow for FPU latency & reduce loop overhead +//..............- Removed conditionals from loop +// xx-xx-03 ERICK - Created function +// +extern void CalcTrigArray (int len, int ChirpRateInd); +int fpu_opt_ChirpData ( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + +){ +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("fpu_opt_ChirpData()"); +#endif + float chirp_sign; // BENH - Pulled conditional out of loop + if ( ChirpRateInd == 0 ) + { + memcpy( cx_ChirpDataArray, cx_DataArray, int( ul_NumDataPoints * sizeof(sah_complex)) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return ( 0 ); + } + + // calculate trigonometric array this function returns w/o doing + // anything when sign of chirp_rate_ind reverses. so we have to take care + // of it. + // + double recip_sample_rate=1.0/sample_rate; + chirp_sign = ( ChirpRateInd >= 0 ) ? 1 : -1; + + const int stride = 2; + int i = 0; + int last = ul_NumDataPoints - ( stride - 1 ); + // what we do depends on how much memory we have... + // If we have more than 64MB, we'll cache the chirp table. If not + // we'll calculate it each time. + bool CacheChirpCalc=((app_init_data.host_info.m_nbytes == 0) || + (app_init_data.host_info.m_nbytes >= MIN_TRIGARRAY_MEMORY)); + // calculate trigonometric array + // this function returns w/o doing nothing when sign of chirp_rate_ind + // reverses. so we have to take care of it. + if ( CacheChirpCalc ){ + CalcTrigArray(ul_NumDataPoints, ChirpRateInd ); + for ( ; i < last ; i += stride ){ + register double c1, c2, d1, d2; + register float R1, R2, I1, I2, t1, t2; + + c1 = CurrentTrig[i + 0].Cos; + d1 = CurrentTrig[i + 0].Sin * chirp_sign; // BENH - opt - avoid branch by multiply + c2 = CurrentTrig[i + 1].Cos; + d2 = CurrentTrig[i + 1].Sin * chirp_sign; + + // d = (chirp_rate_ind >0)? CurrentTrig[i].Sin : + // -CurrentTrig[i].Sin; Sometimes chirping is done in place. We + // don't want to overwrite data prematurely. + // + R1 = cx_DataArray[i + 0][0] * c1; + t1 = cx_DataArray[i + 0][1] * d1; + I1 = cx_DataArray[i + 0][0] * d1; + t2 = cx_DataArray[i + 0][1] * c1; + cx_ChirpDataArray[i + 0][0] = R1 - t1; + cx_ChirpDataArray[i + 0][1] = I1 + t2; + R2 = cx_DataArray[i + 1][0] * c2; + t1 = cx_DataArray[i + 1][1] * d2; + I2 = cx_DataArray[i + 1][0] * d2; + t2 = cx_DataArray[i + 1][1] * c2; + cx_ChirpDataArray[i + 1][0] = R2 - t1; + cx_ChirpDataArray[i + 1][1] = I2 + t2; + } + } +// cx_ChirpDataArray[64][1] = 3.012345; + + // Too little memory to cache sin/cos or just falling out of + // 'CacheChirpCalc' loop + // use original routine to finish up any tailings (max stride-1 elements) + for( ;i < ul_NumDataPoints; i++) { + double dd,cc; + double time=static_cast(i)*recip_sample_rate; + // since ang is getting moded by 2pi, we calculate "ang mod 2pi" + // before the call to sincos() inorder to reduce roundoff error. + // (Bug submitted by Tetsuji "Maverick" Rai) + double ang = 0.5*ChirpRate*time*time; + float c, d, real, imag; + ang -= floor(ang); + ang *= M_PI*2; + sincos(ang,&dd,&cc); + c=cc; + d=dd; + // Sometimes chirping is done in place. + // We don't want to overwrite data prematurely. + real = cx_DataArray[i][0] * c - cx_DataArray[i][1] * d; + imag = cx_DataArray[i][0] * d + cx_DataArray[i][1] * c; + cx_ChirpDataArray[i][0] = real; + cx_ChirpDataArray[i][1] = imag; + } + +//R count_flops( 12 * ul_NumDataPoints ); + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return ( 0 ); +} diff --git a/client/vector/analyzeFuncs_mmx.cpp b/client/vector/analyzeFuncs_mmx.cpp new file mode 100644 index 0000000..fa9359c --- /dev/null +++ b/client/vector/analyzeFuncs_mmx.cpp @@ -0,0 +1,119 @@ +/****************** + * + * opt_mmx.cpp + * + * Description: Intel & AMD MMX optimized functions + * CPUs: Intel Pentium II and beyond, AMD K6 - and beyond + * + */ + +// Copyright 2006 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "x86_ops.h" + +typedef __m64 MMX; + +#define s_begin() _mm_empty() +#define s_end() _mm_empty() + +#define s_get64( ptr ) *( (MMX *) (ptr) ) +#define s_put64( ptr, aa ) ( *((MMX *) (ptr)) = aa ) +#define s_put64nc _mm_stream_pi + + +// +// +// +void __fastcall copy_MMX(char *dest, const char *src, int blocks) + { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("copy_MMX()"); +#endif + MMX m0,m1,m2,m3,m4,m5,m6,m7; + + MMX *m_src = (MMX *)src; + MMX *m_dst = (MMX *)dest; + s_begin(); + while( blocks-- ) + { + m0 = s_get64( m_src + 0 ); + m1 = s_get64( m_src + 1 ); + m2 = s_get64( m_src + 2 ); + m3 = s_get64( m_src + 3 ); + m4 = s_get64( m_src + 4 ); + m5 = s_get64( m_src + 5 ); + m6 = s_get64( m_src + 6 ); + m7 = s_get64( m_src + 7 ); + m_src += 8; + s_put64( m_dst + 0, m0 ); + s_put64( m_dst + 1, m1 ); + s_put64( m_dst + 2, m2 ); + s_put64( m_dst + 3, m3 ); + s_put64( m_dst + 4, m4 ); + s_put64( m_dst + 5, m5 ); + s_put64( m_dst + 6, m6 ); + s_put64( m_dst + 7, m7 ); + m_dst += 8; + } + s_end(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.end(); +#endif + } + +// +// copyMMXnt - Use Non temporal writes, +// only available with 3DNow+ and SSE+ - Athlon and Pentium III +// +void __fastcall copy_MMXnt(char *dest, const char *src, int blocks) + { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("copy_MMXnt()"); +#endif + MMX m0,m1,m2,m3,m4,m5,m6,m7; + + MMX *m_src = (MMX *)src; + MMX *m_dst = (MMX *)dest; + s_begin(); + while( blocks-- ) + { + s_fetch( m_src + 16 ); + m0 = s_get64( m_src + 0 ); + m1 = s_get64( m_src + 1 ); + m2 = s_get64( m_src + 2 ); + m3 = s_get64( m_src + 3 ); + m4 = s_get64( m_src + 4 ); + m5 = s_get64( m_src + 5 ); + m6 = s_get64( m_src + 6 ); + m7 = s_get64( m_src + 7 ); + m_src += 8; + s_put64nc( m_dst + 0, m0 ); + s_put64nc( m_dst + 1, m1 ); + s_put64nc( m_dst + 2, m2 ); + s_put64nc( m_dst + 3, m3 ); + s_put64nc( m_dst + 4, m4 ); + s_put64nc( m_dst + 5, m5 ); + s_put64nc( m_dst + 6, m6 ); + s_put64nc( m_dst + 7, m7 ); + m_dst += 8; + } + s_end(); + s_fence_writes(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + } diff --git a/client/vector/analyzeFuncs_neon.S b/client/vector/analyzeFuncs_neon.S new file mode 100644 index 0000000..7d387f3 --- /dev/null +++ b/client/vector/analyzeFuncs_neon.S @@ -0,0 +1,2716 @@ +// Copyright (c) 1999-2011 Regents of the University of California +// +// FFTW: Copyright (c) 2003,2006 Matteo Frigo +// Copyright (c) 2003,2006 Massachusets Institute of Technology +// +// fft8g.[cpp,h]: Copyright (c) 1995-2001 Takya Ooura +// +// ASMLIB: Copyright (c) 2004 Agner Fog + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any later +// version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions +// as an alternative to FFTW and distribute a linked executable and +// source code. You must obey the GNU General Public License in all +// respects for all of the code used other than the FFT library itself. +// Any modification required to support these libraries must be distributed +// under the terms of this license. If you modify this program, you may extend +// this exception to your version of the program, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. Please be aware that FFTW and ASMLIB are not covered by +// this exception, therefore you may not use FFTW and ASMLIB in any derivative +// work so modified without permission of the authors of those packages. + +#ifdef __arm__ +/* + * neon_ChirpData.S + * Author: Mateusz Szpakowski + */ + + +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + .syntax unified +#endif + + .arch armv7-a + .fpu neon + +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + .eabi_attribute 27, 3 + .eabi_attribute 28, 1 +#endif + +/* + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 +*/ + + .eabi_attribute 23, 1 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 2 + .eabi_attribute 30, 2 + .eabi_attribute 18, 4 + .text + .align 2 +.Lhalfd: + .double 0.5 +.LroundVal: + .double 4503599627370496.0 + .align 4 +.Linc8d: + .double 0,1,2,3,4,5,6,7 +.Lsinapprox: + .float 1.5707963268,1.5707963268,1.5707963268,1.5707963268 + .float -0.6466386396,-0.6466386396,-0.6466386396,-0.6466386396 + .float 0.0679105987,0.0679105987,0.0679105987,0.0679105987 + .float -0.0011573807,-0.0011573807,-0.0011573807,-0.0011573807 +.Lcosapprox: + .float 1.0,1.0,1.0,1.0 + .float -1.2341299769,-1.2341299769,-1.2341299769,-1.2341299769 + .float 0.2465220241,0.2465220241,0.2465220241,0.2465220241 + .float -0.0123926179,-0.0123926179,-0.0123926179,-0.0123926179 +.Ltwosq: + .float 2.0,2.0,2.0,2.0 + .float 2.0,2.0,2.0,2.0 + .float 2.0,2.0,2.0,2.0 + .float 2.0,2.0,2.0,2.0 + + .align 2 + .global _Z14neon_ChirpDataPA2_fS0_idid + .type _Z14neon_ChirpDataPA2_fS0_idid, %function +_Z14neon_ChirpDataPA2_fS0_idid: + push {r4,r5,r6,r7,r8,r9,r10,r11,r12,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} +#ifdef ANDROID +#define stargidx (40+64) + /* r0 - input data + * r1 - output data + * r2 - chirprateind + * sp[0-1] - chirp_rate + * sp[2] - numDataPoints + * sp[4-5] - sample_rate + */ +#else +//R: cause few params now in registers stack should be shorter by 20 bytes +#define stargidx (40+64) +//R: armhf like Parallella use registers instead of stack to pass params so another expected pattern of registers use +/* + r0 - input data + r1 - output data + r2 - chirprateind + r3 - numDataPoints + d0 - chirp_rate + d1 - sample_rate +*/ +//R: seems r12 isn't in use in original function so use it to preserve numDataPoins value (r3) + mov r12,r3 + vmov.f64 d9, d0 + vmov.f64 d10, d1 +#endif + tst r2,r2 + bne .Lrealfunc + mov r3,r0 // swap addresses + mov r0,r1 + mov r1,r3 +#ifdef ANDROID + ldr r2,[sp,#stargidx+8] // numDataPoints +#else + mov r2,r12 +#endif + lsl r2,r2,#3 + bl memcpy(PLT) + b .Lendoffunc + /* + * real functions + */ +.Lrealfunc: + ldr r4,.LGOT1 +.LPIC1: + add r4,pc,r4 + ldr r5,.LGOT1+4 + ldr r5,[r4,r5] +#ifdef ANDROID + ldr r3,[sp,#stargidx+8] // numDataPoints +#else + mov r3,r12 +#endif + + add r6,r3,r3,lsl #1 + lsl r6,r6,#2 + fldd d0,[r5,#32] + fmsr s4,r6 + fuitod d1,s4 + faddd d0,d0,d1 + fstd d0,[r5,#32] + + add r3,r0,r3,lsl #3 + sub r3,r3,#8*15 + + fldd d11,.Lhalfd +#ifdef ANDROID //R: for armhf these doubles already in registers + fldd d9,[sp,#stargidx] // chirp_rate + fldd d10,[sp,#stargidx+16] // sample_rate +#endif + fmuld d10,d10,d10 + fmuld d9,d9,d11 + fdivd d9,d9,d10 + + fldd d10,.LroundVal + fsubd d11,d11,d11 // zero + fcmpd d9,d11 + fmstat + fnegdmi d10,d10 // negate is negative srate +#ifdef ANDROID + sub sp,sp,#16+64 +#else //R: for armhf stack has different size so attempting to account for that + sub sp,sp,#16+64 +#endif + add r7,sp,#16 + add r11,sp,#16+32 + fstmiad sp,{d9,d10} + + mov r4,#0 // i + + adr r5,.Linc8d + adr r6,.Lsinapprox + adr r10,.Lcosapprox + adr r9,.Ltwosq + + cmp r0,r3 + bhs .Lendmainloop +.Lmainloop: + add r8,r4,#8 + fmsr s8,r4 + fmsr s9,r8 + fuitod d0,s8 + fuitod d1,s9 + fldmiad r5,{d8,d9,d10,d11,d12,d13,d14,d15} + fldmiad sp,{d2,d3} + faddd d16,d8,d0 + faddd d17,d9,d0 + faddd d18,d10,d0 + faddd d19,d11,d0 + faddd d20,d12,d0 + faddd d21,d13,d0 + faddd d22,d14,d0 + faddd d23,d15,d0 + faddd d24,d8,d1 + faddd d25,d9,d1 + faddd d26,d10,d1 + faddd d27,d11,d1 + faddd d28,d12,d1 + faddd d29,d13,d1 + faddd d30,d14,d1 + faddd d31,d15,d1 + // square of i + fmuld d16,d16,d16 + fmuld d17,d17,d17 + fmuld d18,d18,d18 + fmuld d19,d19,d19 + fmuld d20,d20,d20 + fmuld d21,d21,d21 + fmuld d22,d22,d22 + fmuld d23,d23,d23 + fmuld d24,d24,d24 + fmuld d25,d25,d25 + fmuld d26,d26,d26 + fmuld d27,d27,d27 + fmuld d28,d28,d28 + fmuld d29,d29,d29 + fmuld d30,d30,d30 + fmuld d31,d31,d31 + // multiply by srate + fmuld d16,d16,d2 + fmuld d17,d17,d2 + fmuld d18,d18,d2 + fmuld d19,d19,d2 + fmuld d20,d20,d2 + fmuld d21,d21,d2 + fmuld d22,d22,d2 + fmuld d23,d23,d2 + fmuld d24,d24,d2 + fmuld d25,d25,d2 + fmuld d26,d26,d2 + fmuld d27,d27,d2 + fmuld d28,d28,d2 + fmuld d29,d29,d2 + fmuld d30,d30,d2 + fmuld d31,d31,d2 + + // rounding to -0.5/+0.5 + faddd d8,d16,d3 + faddd d9,d17,d3 + faddd d10,d18,d3 + faddd d11,d19,d3 + faddd d12,d20,d3 + faddd d13,d21,d3 + faddd d14,d22,d3 + faddd d15,d23,d3 + fsubd d8,d8,d3 + fsubd d9,d9,d3 + fsubd d10,d10,d3 + fsubd d11,d11,d3 + fsubd d12,d12,d3 + fsubd d13,d13,d3 + fsubd d14,d14,d3 + fsubd d15,d15,d3 + fsubd d16,d16,d8 + fsubd d17,d17,d9 + fsubd d18,d18,d10 + fsubd d19,d19,d11 + fsubd d20,d20,d12 + fsubd d21,d21,d13 + fsubd d22,d22,d14 + fsubd d23,d23,d15 + + faddd d8,d24,d3 + faddd d9,d25,d3 + faddd d10,d26,d3 + faddd d11,d27,d3 + faddd d12,d28,d3 + faddd d13,d29,d3 + faddd d14,d30,d3 + faddd d15,d31,d3 + fsubd d8,d8,d3 + fsubd d9,d9,d3 + fsubd d10,d10,d3 + fsubd d11,d11,d3 + fsubd d12,d12,d3 + fsubd d13,d13,d3 + fsubd d14,d14,d3 + fsubd d15,d15,d3 + fsubd d24,d24,d8 + fsubd d25,d25,d9 + fsubd d26,d26,d10 + fsubd d27,d27,d11 + fsubd d28,d28,d12 + fsubd d29,d29,d13 + fsubd d30,d30,d14 + fsubd d31,d31,d15 + // to single precision + fcvtsd s0,d16 + fcvtsd s1,d17 + fcvtsd s2,d18 + fcvtsd s3,d19 + fcvtsd s4,d20 + fcvtsd s5,d21 + fcvtsd s6,d22 + fcvtsd s7,d23 + fcvtsd s8,d24 + fcvtsd s9,d25 + fcvtsd s10,d26 + fcvtsd s11,d27 + fcvtsd s12,d28 + fcvtsd s13,d29 + fcvtsd s14,d30 + fcvtsd s15,d31 + + //fldmias r6,{s8,s9,s10,s11,s12,s13,s14,s15} + vldmia r6,{q8,q9,q10,q11} + // square of y + vmul.f32 q4,q0,q0 + vmul.f32 q5,q1,q1 + vmul.f32 q6,q2,q2 + vmul.f32 q7,q3,q3 + // sine + vmul.f32 q12,q4,q11 + vmul.f32 q13,q5,q11 + vmul.f32 q14,q6,q11 + vmul.f32 q15,q7,q11 + vadd.f32 q12,q12,q10 + vadd.f32 q13,q13,q10 + vadd.f32 q14,q14,q10 + vadd.f32 q15,q15,q10 + vmul.f32 q12,q12,q4 + vmul.f32 q13,q13,q5 + vmul.f32 q14,q14,q6 + vmul.f32 q15,q15,q7 + vadd.f32 q12,q12,q9 + vadd.f32 q13,q13,q9 + vadd.f32 q14,q14,q9 + vadd.f32 q15,q15,q9 + vmul.f32 q12,q12,q4 + vmul.f32 q13,q13,q5 + vmul.f32 q14,q14,q6 + vmul.f32 q15,q15,q7 + vadd.f32 q12,q12,q8 + vadd.f32 q13,q13,q8 + vadd.f32 q14,q14,q8 + vadd.f32 q15,q15,q8 + vmul.f32 q12,q12,q0 + vmul.f32 q13,q13,q1 + vmul.f32 q14,q14,q2 + vmul.f32 q15,q15,q3 + vldmia r10,{q0,q1,q2,q3} + // cosine + vmul.f32 q8,q4,q3 + vmul.f32 q9,q5,q3 + vmul.f32 q10,q6,q3 + vmul.f32 q11,q7,q3 + vadd.f32 q8,q8,q2 + vadd.f32 q9,q9,q2 + vadd.f32 q10,q10,q2 + vadd.f32 q11,q11,q2 + vmul.f32 q8,q8,q4 + vmul.f32 q9,q9,q5 + vmul.f32 q10,q10,q6 + vmul.f32 q11,q11,q7 + vadd.f32 q8,q8,q1 + vadd.f32 q9,q9,q1 + vadd.f32 q10,q10,q1 + vadd.f32 q11,q11,q1 + vmul.f32 q8,q8,q4 + vmul.f32 q9,q9,q5 + vmul.f32 q10,q10,q6 + vmul.f32 q11,q11,q7 + vadd.f32 q8,q8,q0 + vadd.f32 q9,q9,q0 + vadd.f32 q10,q10,q0 + vadd.f32 q11,q11,q0 + // q8-q11 - cosine, q12-q15 - sine + // doubling cosine/sine + vmul.f32 q4,q8,q12 // c*s + vmul.f32 q5,q9,q13 + vmul.f32 q6,q10,q14 + vmul.f32 q7,q11,q15 + vmul.f32 q0,q8,q8 // c*c + vmul.f32 q1,q9,q9 + vmul.f32 q2,q10,q10 + vmul.f32 q3,q11,q11 + vmls.f32 q0,q12,q12 // c*c-s*s + vmls.f32 q1,q13,q13 + vmls.f32 q2,q14,q14 + vmls.f32 q3,q15,q15 + vadd.f32 q4,q4,q4 // 2*c*s + vadd.f32 q5,q5,q5 + vadd.f32 q6,q6,q6 + vadd.f32 q7,q7,q7 + // next doubling cosine/sine + vmul.f32 q8,q0,q4 // cd1 = x*y + vmul.f32 q9,q1,q5 + vmul.f32 q10,q2,q6 + vmul.f32 q11,q3,q7 + vmul.f32 q4,q4,q4 // cd3 = y*y + vmul.f32 q5,q5,q5 + vmul.f32 q6,q6,q6 + vmul.f32 q7,q7,q7 + vmul.f32 q0,q0,q0 // cd2 = x*x + vmul.f32 q1,q1,q1 + vmul.f32 q2,q2,q2 + vmul.f32 q3,q3,q3 + vadd.f32 q12,q0,q4 // norm = cd2+cd3 + vadd.f32 q13,q1,q5 + vadd.f32 q14,q2,q6 + vadd.f32 q15,q3,q7 + vadd.f32 q8,q8,q8 // s = cd1*2 + vadd.f32 q9,q9,q9 + vadd.f32 q10,q10,q10 + vadd.f32 q11,q11,q11 + vsub.f32 q0,q0,q4 // c = cd2-cd3 + vsub.f32 q1,q1,q5 + vsub.f32 q2,q2,q6 + vsub.f32 q3,q3,q7 + // c - q0-q3, s - q8-q11, norm - q12-q15 + vstmia r7,{q8,q9,q10,q11} + vldmia r9,{q4,q5,q6,q7} + // reciprocal of magnitude + // iter 1: invmag = 2.0-mag + vsub.f32 q4,q4,q12 + vsub.f32 q5,q5,q13 + vsub.f32 q6,q6,q14 + vsub.f32 q7,q7,q15 + // iter 2: invmag = invmag*(2.0-mag*invmag) + vrecps.f32 q8,q4,q12 + vrecps.f32 q9,q5,q13 + vrecps.f32 q10,q6,q14 + vrecps.f32 q11,q7,q15 + vmul.f32 q4,q4,q8 + vmul.f32 q5,q5,q9 + vmul.f32 q6,q6,q10 + vmul.f32 q7,q7,q11 + vldmia r7,{q8,q9,q10,q11} + // invnorm - q4-q7 + // correct cosine/sine + vmul.f32 q0,q0,q4 + vmul.f32 q1,q1,q5 + vmul.f32 q2,q2,q6 + vmul.f32 q3,q3,q7 + vmul.f32 q8,q8,q4 + vmul.f32 q9,q9,q5 + vmul.f32 q10,q10,q6 + vmul.f32 q11,q11,q7 + vzip.32 q0,q8 + vzip.32 q1,q9 + vzip.32 q2,q10 + vzip.32 q3,q11 + vstmia r7,{q2,q3} + vstmia r11,{q10,q11} + // multiply by data + pld [r0,#256] + vldmia r0!,{q12,q13,q14,q15} + vmul.f32 q4,q12,q0 + vmul.f32 q5,q13,q8 + vmul.f32 q6,q14,q1 + vmul.f32 q7,q15,q9 + vrev64.32 q2,q0 + vrev64.32 q10,q8 + vrev64.32 q3,q1 + vrev64.32 q11,q9 + vmul.f32 q2,q2,q12 + vmul.f32 q10,q10,q13 + vmul.f32 q3,q3,q14 + vmul.f32 q11,q11,q15 + fnegs s17,s17 + fnegs s19,s19 + fnegs s21,s21 + fnegs s23,s23 + fnegs s25,s25 + fnegs s27,s27 + fnegs s29,s29 + fnegs s31,s31 + vtrn.32 q4,q2 + vtrn.32 q5,q10 + vtrn.32 q6,q3 + vtrn.32 q7,q11 + vadd.f32 q4,q4,q2 + vadd.f32 q5,q5,q10 + vadd.f32 q6,q6,q3 + vadd.f32 q7,q7,q11 + vstmia r1!,{q4,q5,q6,q7} + vldmia r7,{q0,q1} + vldmia r11,{q8,q9} + pld [r0,#256] + vldmia r0!,{q12,q13,q14,q15} + vmul.f32 q4,q12,q0 + vmul.f32 q5,q13,q8 + vmul.f32 q6,q14,q1 + vmul.f32 q7,q15,q9 + vrev64.32 q2,q0 + vrev64.32 q10,q8 + vrev64.32 q3,q1 + vrev64.32 q11,q9 + vmul.f32 q2,q2,q12 + vmul.f32 q10,q10,q13 + vmul.f32 q3,q3,q14 + vmul.f32 q11,q11,q15 + fnegs s17,s17 + fnegs s19,s19 + fnegs s21,s21 + fnegs s23,s23 + fnegs s25,s25 + fnegs s27,s27 + fnegs s29,s29 + fnegs s31,s31 + vtrn.32 q4,q2 + vtrn.32 q5,q10 + vtrn.32 q6,q3 + vtrn.32 q7,q11 + vadd.f32 q4,q4,q2 + vadd.f32 q5,q5,q10 + vadd.f32 q6,q6,q3 + vadd.f32 q7,q7,q11 + vstmia r1!,{q4,q5,q6,q7} + + add r4,r4,#16 + cmp r0,r3 + blo .Lmainloop +.Lendmainloop: + add r3,r3,#8*15 + cmp r0,r3 + bhs .Lendsmallloop + adr r6,.Lsincosapprox +.Lsmallloop: + fmsr s24,r4 + fldmiad sp,{d9,d10} + fuitod d0,s24 + // square of i + fmuld d0,d0,d0 + // multiply by srate + fmuld d0,d0,d9 + // rounding to -0.5/+0.5 + faddd d12,d0,d10 + fsubd d12,d12,d10 + fsubd d0,d0,d12 + fcvtsd s24,d0 + + fldmias r6,{s8,s9,s10,s11,s12,s13,s14,s15} + // square of y + fmuls s0,s24,s24 + // sine/cosine + fmuls s16,s0,s11 + fmuls s17,s0,s15 + fadds s16,s16,s10 + fadds s17,s17,s14 + fmuls s16,s16,s0 + fmuls s17,s17,s0 + fadds s16,s16,s9 + fadds s17,s17,s13 + fmuls s16,s16,s0 + fmuls s17,s17,s0 + fadds s16,s16,s8 + fadds s17,s17,s12 // s16 - sine + fmuls s16,s16,s24 // s17 - cosine + // doubling cosine/sine + fmuls s18,s16,s17 + fmuls s19,s16,s16 + fmuls s20,s17,s17 + fadds s18,s18,s18 // y=2*s*c + fsubs s19,s20,s19 // x=c*c-s*s + fmuls s21,s18,s19 // cd1 + fmuls s22,s19,s19 // cd2 + fmuls s23,s18,s18 // cd3 + fsubs s8,s22,s23 // c + fadds s9,s21,s21 // s + // compute 1.0/norm + fadds s10,s22,s23 // mag + // reciprocal + flds s11,.Ltwos + // iter1: invmag = 2.0-mag + fsubs s12,s11,s10 + // iter2: invmag = invmag*(2.0-invmag*mag) + fmuls s13,s12,s10 + fsubs s13,s11,s13 + fmuls s12,s12,s13 + // iter3: invmag = invmag*(2.0-invmag*mag) + fmuls s13,s12,s10 + fsubs s13,s11,s13 + fmuls s12,s12,s13 + // correct cosine/sine + fmuls s8,s8,s12 + fmuls s9,s9,s12 + // multiply data + fldmias r0!,{s14,s15} + fmuls s6,s14,s8 + fmuls s7,s14,s9 + fnmacs s6,s15,s9 + fmacs s7,s15,s8 + fstmias r1!,{s6,s7} + + add r4,r4,#1 + cmp r0,r3 + blo .Lsmallloop +.Lendsmallloop: +#ifdef ANDROID + add sp,sp,#16+64 +#else + add sp,sp,#16+64 +#endif +.Lendoffunc: + mov r0,#0 + vpop {d8,d9,d10,d11,d12,d13,d14,d15} + pop {r4,r5,r6,r7,r8,r9,r10,r11,r12,lr} + bx lr + + .align 2 +.LGOT1: + .word _GLOBAL_OFFSET_TABLE_-(.LPIC1+8) + .word analysis_state(GOT) + .align 2 +.Ltwos: + .float 2.0 +.Lsincosapprox: + .float 1.5707963268,-0.6466386396,0.0679105987,-0.0011573807 // sine + .float 1.0,-1.2341299769,0.2465220241,-0.0123926179 // cosine +/* + * neon_FoldSubs.S + * Author: Mateusz Szpakowski + */ + .align 2 + /***** + * fold array by 3 + ******/ + .global neon_foldArrayBy3_ll31 + .type neon_foldArrayBy3_ll31, %function +neon_foldArrayBy3_ll31: + push {r4,r5,r6,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + ldrd r4,[r1] // di,dest + add r6,r0,r4,lsl #2 // end + + veor.i32 q12,q12,q12 + sub r6,r6,#4*15 + cmp r0,r6 + bhs .Lendf3loop1 +.Lf3loop1: +.macro FOLDBY3_CORE + vldmia r0!,{q0,q1,q2,q3} + vldmia r2!,{q4,q5,q6,q7} + vldmia r3!,{q8,q9,q10,q11} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 q3,q3,q7 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 q3,q3,q11 + vstmia r5!,{q0,q1,q2,q3} + + vmax.f32 q13,q0,q1 + vmax.f32 q14,q2,q3 + vmax.f32 q12,q12,q13 + vmax.f32 q12,q12,q14 +.endm + FOLDBY3_CORE + + cmp r0,r6 + blo .Lf3loop1 +.Lendf3loop1: + and r4,r4,#15 + cmp r4,#8 + blo .Lf3lt8 + beq .Lf3eq8 + + cmp r4,#12 + blo .Lf3lt12 + beq .Lf3eq12 + + cmp r4,#14 + blo .Lf3lt14 + beq .Lf3eq14 + // 15 elems + vldmia r0!,{q0,q1,q2} + vldmia r0!,{s12,s13,s14} + vldmia r2!,{q4,q5,q6} + vldmia r2!,{s28,s29,s30} + vldmia r3!,{q8,q9,q10} + vldmia r3!,{d22} + vldmia r3!, {s15} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 d6,d6,d14 + vadd.f32 s14,s14,s30 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 d6,d6,d22 + vadd.f32 s14,s14,s15 + + vstmia r5!,{q0,q1,q2} + vstmia r5!,{s12,s13,s14} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 q12,q12,q3 + + b .Lf3end +.Lf3eq14: + // 14 elems + vldmia r0!,{q0,q1,q2} + vldmia r0!,{d6} + vldmia r2!,{q4,q5,q6} + vldmia r2!,{d14} + vldmia r3!,{q8,q9,q10} + vldmia r3!,{d22} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 d6,d6,d14 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 d6,d6,d22 + vstmia r5!,{q0,q1,q2} + vstmia r5!,{d6} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 d24,d24,d6 + + b .Lf3end +.Lf3lt14: + // 13 elems + vldmia r0!,{q0,q1,q2} + vldmia r0!,{s12} + vldmia r2!,{q4,q5,q6} + vldmia r2!,{s13} + vldmia r3!,{q8,q9,q10} + vldmia r3!,{s14} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + fadds s12,s12,s13 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + fadds s12,s12,s14 + vstmia r5!,{q0,q1,q2} + vstmia r5!,{s12} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 d24,d24,d6 + + b .Lf3end +.Lf3eq12: + // 12 elems + vldmia r0!,{q0,q1,q2} + vldmia r2!,{q4,q5,q6} + vldmia r3!,{q8,q9,q10} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vstmia r5!,{q0,q1,q2} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + + b .Lf3end +.Lf3lt12: + cmp r4,#10 + blo .Lf3lt10 + beq .Lf3eq10 + // 11 elems + vldmia r0!,{q0,q1} + vldmia r0!,{s8,s9,s10} + vldmia r2!,{q4,q5} + vldmia r2!,{s24,s25,s26} + vldmia r3!,{q8,q9} + vldmia r3!,{d20} + vldmia r3!,{s11} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 d4,d4,d12 + vadd.f32 s10,s10,s26 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 d4,d4,d20 + vadd.f32 s10,s10,s11 + vstmia r5!,{q0,q1} + vstmia r5!,{s8,s9,s10} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + + b .Lf3end +.Lf3eq10: + // 10 elems + vldmia r0!,{q0,q1} + vldmia r0!,{d4} + vldmia r2!,{q4,q5} + vldmia r2!,{d12} + vldmia r3!,{q8,q9} + vldmia r3!,{d20} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 d4,d4,d12 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 d4,d4,d20 + vstmia r5!,{q0,q1} + vstmia r5!,{d4} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 d24,d24,d4 + + b .Lf3end +.Lf3lt10: + // 9 elems + vldmia r0!,{q0,q1} + vldmia r0!,{s8} + vldmia r2!,{q4,q5} + vldmia r2!,{s9} + vldmia r3!,{q8,q9} + vldmia r3!,{s10} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + fadds s8,s8,s9 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + fadds s8,s8,s10 + vstmia r5!,{q0,q1} + vstmia r5!,{s8} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 d24,d24,d4 + + b .Lf3end +.Lf3eq8: + // 8 elems + vldmia r0!,{q0,q1} + vldmia r2!,{q4,q5} + vldmia r3!,{q8,q9} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vstmia r5!,{q0,q1} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + + b .Lf3end +.Lf3lt8: + cmp r4,#4 + blo .Lf3lt4 + beq .Lf3eq4 + + cmp r4,#6 + blo .Lf3lt6 + beq .Lf3eq6 + // 7 elems + vldmia r0!,{q0} + vldmia r0!,{s4,s5,s6} + vldmia r2!,{q4} + vldmia r2!,{s20,s21,s22} + vldmia r3!,{q8} + vldmia r3!,{d18} + vldmia r3!,{s7} + + vadd.f32 q0,q0,q4 + vadd.f32 d2,d2,d10 + vadd.f32 s6,s6,s22 + vadd.f32 q0,q0,q8 + vadd.f32 d2,d2,d18 + vadd.f32 s6,s6,s7 + vstmia r5!,{q0} + vstmia r5!,{s4,s5,s6} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + + b .Lf3end +.Lf3eq6: + // 6 elems + vldmia r0!,{q0} + vldmia r0!,{d2} + vldmia r2!,{q4} + vldmia r2!,{d10} + vldmia r3!,{q8} + vldmia r3!,{d18} + + vadd.f32 q0,q0,q4 + vadd.f32 d2,d2,d10 + vadd.f32 q0,q0,q8 + vadd.f32 d2,d2,d18 + vstmia r5!,{q0} + vstmia r5!,{d2} + + vmax.f32 q12,q12,q0 + vmax.f32 d24,d24,d2 + + b .Lf3end +.Lf3lt6: + // 5 elems + vldmia r0!,{q0} + vldmia r0!,{s4} + vldmia r2!,{q4} + vldmia r2!,{s20} + vldmia r3!,{q8} + vldmia r3!,{s5} + + vadd.f32 q0,q0,q4 + fadds s4,s4,s20 + vadd.f32 q0,q0,q8 + fadds s4,s4,s5 + vstmia r5!,{q0} + vstmia r5!,{s4} + + vmax.f32 q12,q12,q0 + vmax.f32 d24,d24,d2 + + b .Lf3end +.Lf3eq4: + // 4 elems + vldmia r0!,{q0} + vldmia r2!,{q4} + vldmia r3!,{q8} + + vadd.f32 q0,q0,q4 + vadd.f32 q0,q0,q8 + vstmia r5!,{q0} + + vmax.f32 q12,q12,q0 + + b .Lf3end +.Lf3lt4: + cmp r4,#2 + blo .Lf3lt2 + beq .Lf3eq2 + // 3 elems + vldmia r0!,{s0,s1,s2} + vldmia r2!,{s16,s17,s18} + vldmia r3!,{d16} + vldmia r3!,{s3} + + vadd.f32 d0,d0,d8 + vadd.f32 s2,s2,s18 + vadd.f32 d0,d0,d16 + vadd.f32 s2,s2,s3 + vstmia r5!,{s0,s1,s2} + + vmax.f32 q12,q12,q0 + + b .Lf3end +.Lf3eq2: + // 2 elems + vldmia r0!,{d0} + vldmia r2!,{d4} + vldmia r3!,{d8} + + vadd.f32 d0,d0,d4 + vadd.f32 d0,d0,d8 + vstmia r5!,{d0} + + vmax.f32 d24,d24,d0 + + b .Lf3end +.Lf3lt2: + cmp r4,#0 + beq .Lf3eq0 + + vldmia r0!,{s0} + vldmia r2!,{s1} + vldmia r3!,{s2} + + vadd.f32 s0,s0,s1 + vadd.f32 s0,s0,s2 + vstmia r5!,{s0} + + vmax.f32 d24,d24,d0 +.Lf3eq0: +.Lf3end: + vpmax.f32 d24,d24,d25 + vpmax.f32 d0,d24,d24 + + fmrs r0,s0 + vpop {d8,d9,d10,d11,d12,d13,d14,d15} + pop {r4,r5,r6,lr} + bx lr + + + .global neon_foldArrayBy3_lge31 + .type neon_foldArrayBy3_lge31, %function +neon_foldArrayBy3_lge31: + push {r4,r5,r6,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + ldrd r4,[r1] // di,dest + add r6,r0,r4,lsl #2 // end + + veor.i32 q12,q12,q12 + sub r6,r6,#4*31 + cmp r0,r6 + bhs .Lendf3loop2 +.Lf3loop2: + FOLDBY3_CORE + FOLDBY3_CORE + + cmp r0,r6 + blo .Lf3loop2 +.Lendf3loop2: + add r6,r6,#4*16 + cmp r0,r6 + bhs .Lendf3loop1 +.Lf3loop3: + FOLDBY3_CORE + + cmp r0,r6 + blo .Lf3loop3 +.Lendf3loop3: + b .Lendf3loop1 + +.Lfoldby3sel: +.rept 31 + .word neon_foldArrayBy3_ll31 +.endr + .word neon_foldArrayBy3_lge31 + + /****** + * fold array by 4 + ******/ + .global neon_foldArrayBy4_ll31 + .type neon_foldArrayBy4_ll31, %function +neon_foldArrayBy4_ll31: + push {r4,r5,r6,r7,r8,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + ldr r6,[r1,#16] // tmp2 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + add r6,r0,r6,lsl #2 + ldrd r4,[r1] // di,dest + add r7,r0,r4,lsl #2 // end + + veor.i32 q12,q12,q12 + sub r7,r7,#4*15 + cmp r0,r7 + bhs .Lendf4loop1 +.Lf4loop1: +.macro FOLDBY4_CORE + vldmia r0!,{q0,q1,q2,q3} + vldmia r2!,{q4,q5,q6,q7} + vldmia r3!,{q8,q9,q10,q11} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 q3,q3,q7 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 q3,q3,q11 + vldmia r6!,{q8,q9,q10,q11} + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 q3,q3,q11 + vstmia r5!,{q0,q1,q2,q3} + + vmax.f32 q13,q0,q1 + vmax.f32 q14,q2,q3 + vmax.f32 q12,q12,q13 + vmax.f32 q12,q12,q14 +.endm + FOLDBY4_CORE + + cmp r0,r7 + blo .Lf4loop1 +.Lendf4loop1: + and r4,r4,#15 + cmp r4,#8 + blo .Lf4lt8 + beq .Lf4eq8 + + cmp r4,#12 + blo .Lf4lt12 + beq .Lf4eq12 + + cmp r4,#14 + blo .Lf4lt14 + beq .Lf4eq14 + // 15 elems + vldmia r0!,{q0,q1,q2} + vldmia r0!,{s12,s13,s14} + vldmia r2!,{q4,q5,q6} + vldmia r2!,{s28,s29,s30} + vldmia r3!,{q8,q9,q10} + vldmia r3!,{d22} + vldmia r3, {s15} + vldmia r6!,{q13,q14,q15} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 d6,d6,d14 + vadd.f32 s14,s14,s30 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 d6,d6,d22 + vadd.f32 s14,s14,s15 + vldmia r6!,{s16,s17,s18} + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + vadd.f32 d6,d6,d8 + vadd.f32 s14,s14,s18 + + vstmia r5!,{q0,q1,q2} + vstmia r5!,{s12,s13,s14} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 q12,q12,q3 + + b .Lf4end +.Lf4eq14: + // 14 elems + vldmia r0!,{q0,q1,q2} + vldmia r0!,{d6} + vldmia r2!,{q4,q5,q6} + vldmia r2!,{d14} + vldmia r3!,{q8,q9,q10} + vldmia r3!,{d22} + vldmia r6!,{q13,q14,q15} + vldmia r6!,{d7} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 d6,d6,d14 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 d6,d6,d22 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + vadd.f32 d6,d6,d7 + vstmia r5!,{q0,q1,q2} + vstmia r5!,{d6} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 d24,d24,d6 + + b .Lf4end +.Lf4lt14: + // 13 elems + vldmia r0!,{q0,q1,q2} + vldmia r0!,{s12} + vldmia r2!,{q4,q5,q6} + vldmia r2!,{s13} + vldmia r3!,{q8,q9,q10} + vldmia r3!,{s14} + vldmia r6!,{q13,q14,q15} + vldmia r6!,{s15} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + fadds s12,s12,s13 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + fadds s12,s12,s14 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + fadds s12,s12,s15 + vstmia r5!,{q0,q1,q2} + vstmia r5!,{s12} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 d24,d24,d6 + + b .Lf4end +.Lf4eq12: + // 12 elems + vldmia r0!,{q0,q1,q2} + vldmia r2!,{q4,q5,q6} + vldmia r3!,{q8,q9,q10} + vldmia r6!,{q13,q14,q15} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + vstmia r5!,{q0,q1,q2} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + + b .Lf4end +.Lf4lt12: + cmp r4,#10 + blo .Lf4lt10 + beq .Lf4eq10 + // 11 elems + vldmia r0!,{q0,q1} + vldmia r0!,{s8,s9,s10} + vldmia r2!,{q4,q5} + vldmia r2!,{s24,s25,s26} + vldmia r3!,{q8,q9} + vldmia r3!,{d20} + vldmia r3!,{s11} + vldmia r6!,{q13,q14} + vldmia r6!,{s12,s13,s14} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 d4,d4,d12 + vadd.f32 s10,s10,s26 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 d4,d4,d20 + vadd.f32 s10,s10,s11 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 d4,d4,d6 + vadd.f32 s10,s10,s14 + vstmia r5!,{q0,q1} + vstmia r5!,{s8,s9,s10} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + + b .Lf4end +.Lf4eq10: + // 10 elems + vldmia r0!,{q0,q1} + vldmia r0!,{d4} + vldmia r2!,{q4,q5} + vldmia r2!,{d12} + vldmia r3!,{q8,q9} + vldmia r3!,{d20} + vldmia r6!,{q13,q14} + vldmia r6!,{d5} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 d4,d4,d12 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 d4,d4,d20 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 d4,d4,d5 + vstmia r5!,{q0,q1} + vstmia r5!,{d4} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 d24,d24,d4 + + b .Lf4end +.Lf4lt10: + // 9 elems + vldmia r0!,{q0,q1} + vldmia r0!,{s8} + vldmia r2!,{q4,q5} + vldmia r2!,{s9} + vldmia r3!,{q8,q9} + vldmia r3!,{s10} + vldmia r6!,{q13,q14} + vldmia r6!,{s11} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + fadds s8,s8,s9 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + fadds s8,s8,s10 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + fadds s8,s8,s11 + vstmia r5!,{q0,q1} + vstmia r5!,{s8} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 d24,d24,d4 + + b .Lf4end +.Lf4eq8: + // 8 elems + vldmia r0!,{q0,q1} + vldmia r2!,{q4,q5} + vldmia r3!,{q8,q9} + vldmia r6!,{q13,q14} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vstmia r5!,{q0,q1} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + + b .Lf4end +.Lf4lt8: + cmp r4,#4 + blo .Lf4lt4 + beq .Lf4eq4 + + cmp r4,#6 + blo .Lf4lt6 + beq .Lf4eq6 + // 7 elems + vldmia r0!,{q0} + vldmia r0!,{s4,s5,s6} + vldmia r2!,{q4} + vldmia r2!,{s20,s21,s22} + vldmia r3!,{q8} + vldmia r3!,{d18} + vldmia r3!,{s7} + vldmia r6!,{q13} + vldmia r6!,{s8,s9,s10} + + vadd.f32 q0,q0,q4 + vadd.f32 d2,d2,d10 + vadd.f32 s6,s6,s22 + vadd.f32 q0,q0,q8 + vadd.f32 d2,d2,d18 + vadd.f32 s6,s6,s7 + vadd.f32 q0,q0,q13 + vadd.f32 d2,d2,d4 + vadd.f32 s6,s6,s10 + vstmia r5!,{q0} + vstmia r5!,{s4,s5,s6} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + + b .Lf4end +.Lf4eq6: + // 6 elems + vldmia r0!,{q0} + vldmia r0!,{d2} + vldmia r2!,{q4} + vldmia r2!,{d10} + vldmia r3!,{q8} + vldmia r3!,{d18} + vldmia r6!,{q13} + vldmia r6!,{d3} + + vadd.f32 q0,q0,q4 + vadd.f32 d2,d2,d10 + vadd.f32 q0,q0,q8 + vadd.f32 d2,d2,d18 + vadd.f32 q0,q0,q13 + vadd.f32 d2,d2,d3 + vstmia r5!,{q0} + vstmia r5!,{d2} + + vmax.f32 q12,q12,q0 + vmax.f32 d24,d24,d2 + + b .Lf4end +.Lf4lt6: + // 5 elems + vldmia r0!,{q0} + vldmia r0!,{s4} + vldmia r2!,{q4} + vldmia r2!,{s20} + vldmia r3!,{q8} + vldmia r3!,{s5} + vldmia r6!,{q13} + vldmia r6!,{s6} + + vadd.f32 q0,q0,q4 + fadds s4,s4,s20 + vadd.f32 q0,q0,q8 + fadds s4,s4,s5 + vadd.f32 q0,q0,q13 + fadds s4,s4,s6 + vstmia r5!,{q0} + vstmia r5!,{s4} + + vmax.f32 q12,q12,q0 + vmax.f32 d24,d24,d2 + + b .Lf4end +.Lf4eq4: + // 4 elems + vldmia r0!,{q0} + vldmia r2!,{q4} + vldmia r3!,{q8} + vldmia r6!,{q13} + + vadd.f32 q0,q0,q4 + vadd.f32 q0,q0,q8 + vadd.f32 q0,q0,q13 + vstmia r5!,{q0} + + vmax.f32 q12,q12,q0 + + b .Lf4end +.Lf4lt4: + cmp r4,#2 + blo .Lf4lt2 + beq .Lf4eq2 + // 3 elems + vldmia r0!,{s0,s1,s2} + vldmia r2!,{s16,s17,s18} + vldmia r3!,{d16} + vldmia r3!,{s3} + vldmia r6!,{s4,s5,s6} + + vadd.f32 d0,d0,d8 + vadd.f32 s2,s2,s18 + vadd.f32 d0,d0,d16 + vadd.f32 s2,s2,s3 + vadd.f32 d0,d0,d2 + vadd.f32 s2,s2,s6 + vstmia r5!,{s0,s1,s2} + + vmax.f32 q12,q12,q0 + + b .Lf4end +.Lf4eq2: + // 2 elems + vldmia r0!,{d0} + vldmia r2!,{d4} + vldmia r3!,{d8} + vldmia r6!,{d12} + + vadd.f32 d0,d0,d4 + vadd.f32 d0,d0,d8 + vadd.f32 d0,d0,d12 + vstmia r5!,{d0} + + vmax.f32 d24,d24,d0 + + b .Lf4end +.Lf4lt2: + cmp r4,#0 + beq .Lf4eq0 + + vldmia r0!,{s0} + vldmia r2!,{s1} + vldmia r3!,{s2} + vldmia r6!,{s3} + + vadd.f32 s0,s0,s1 + vadd.f32 s0,s0,s2 + vadd.f32 s0,s0,s3 + vstmia r5!,{s0} + + vmax.f32 d24,d24,d0 +.Lf4eq0: +.Lf4end: + vpmax.f32 d24,d24,d25 + vpmax.f32 d0,d24,d24 + + fmrs r0,s0 + vpop {d8,d9,d10,d11,d12,d13,d14,d15} + pop {r4,r5,r6,r7,r8,lr} + bx lr + + + .global neon_foldArrayBy4_lge31 + .type neon_foldArrayBy4_lge31, %function +neon_foldArrayBy4_lge31: + push {r4,r5,r6,r7,r8,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + ldr r6,[r1,#16] // tmp2 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + add r6,r0,r6,lsl #2 + ldrd r4,[r1] // di,dest + add r7,r0,r4,lsl #2 // end + + veor.i32 q12,q12,q12 + sub r7,r7,#4*31 + cmp r0,r7 + bhs .Lendf4loop2 +.Lf4loop2: + FOLDBY4_CORE + FOLDBY4_CORE + + cmp r0,r7 + blo .Lf4loop2 +.Lendf4loop2: + add r7,r7,#4*16 + cmp r0,r7 + bhs .Lendf4loop1 +.Lf4loop3: + FOLDBY4_CORE + + cmp r0,r7 + blo .Lf4loop3 +.Lendf4loop3: + b .Lendf4loop1 + +.Lfoldby4sel: +.rept 31 + .word neon_foldArrayBy4_ll31 +.endr + .word neon_foldArrayBy4_lge31 + + /****** + * fold array by 5 + ******/ + .global neon_foldArrayBy5_ll31 + .type neon_foldArrayBy5_ll31, %function +neon_foldArrayBy5_ll31: + push {r4,r5,r6,r7,r8,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + ldrd r6,[r1,#16] // tmp2 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + add r6,r0,r6,lsl #2 + add r7,r0,r7,lsl #2 + ldrd r4,[r1] // di,dest + add r8,r0,r4,lsl #2 // end + + veor.i32 q12,q12,q12 + sub r8,r8,#4*15 + cmp r0,r8 + bhs .Lendf5loop1 +.Lf5loop1: +.macro FOLDBY5_CORE + vldmia r0!,{q0,q1,q2,q3} + vldmia r2!,{q4,q5,q6,q7} + vldmia r3!,{q8,q9,q10,q11} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 q3,q3,q7 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 q3,q3,q11 + vldmia r6!,{q8,q9,q10,q11} + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 q3,q3,q11 + vldmia r7!,{q8,q9,q10,q11} + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 q3,q3,q11 + vstmia r5!,{q0,q1,q2,q3} + + vmax.f32 q13,q0,q1 + vmax.f32 q14,q2,q3 + vmax.f32 q12,q12,q13 + vmax.f32 q12,q12,q14 +.endm + FOLDBY5_CORE + + cmp r0,r8 + blo .Lf5loop1 +.Lendf5loop1: + and r4,r4,#15 + cmp r4,#8 + blo .Lf5lt8 + beq .Lf5eq8 + + cmp r4,#12 + blo .Lf5lt12 + beq .Lf5eq12 + + cmp r4,#14 + blo .Lf5lt14 + beq .Lf5eq14 + // 15 elems + vldmia r0!,{q0,q1,q2} + vldmia r0!,{s12,s13,s14} + vldmia r2!,{q4,q5,q6} + vldmia r2!,{s28,s29,s30} + vldmia r3!,{q8,q9,q10} + vldmia r3!,{d22} + vldmia r3, {s15} + vldmia r6!,{q13,q14,q15} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 d6,d6,d14 + vadd.f32 s14,s14,s30 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 d6,d6,d22 + vadd.f32 s14,s14,s15 + vldmia r6!,{s16,s17,s18} + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + vadd.f32 d6,d6,d8 + vadd.f32 s14,s14,s18 + vldmia r7!,{q13,q14,q15} + vldmia r7!,{s16,s17,s18} + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + vadd.f32 d6,d6,d8 + vadd.f32 s14,s14,s18 + + vstmia r5!,{q0,q1,q2} + vstmia r5!,{s12,s13,s14} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 q12,q12,q3 + + b .Lf5end +.Lf5eq14: + // 14 elems + vldmia r0!,{q0,q1,q2} + vldmia r0!,{d6} + vldmia r2!,{q4,q5,q6} + vldmia r2!,{d14} + vldmia r3!,{q8,q9,q10} + vldmia r3!,{d22} + vldmia r6!,{q13,q14,q15} + vldmia r6!,{d7} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 d6,d6,d14 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + vadd.f32 d6,d6,d22 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + vadd.f32 d6,d6,d7 + vldmia r7!,{q13,q14,q15} + vldmia r7!,{d7} + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + vadd.f32 d6,d6,d7 + vstmia r5!,{q0,q1,q2} + vstmia r5!,{d6} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 d24,d24,d6 + + b .Lf5end +.Lf5lt14: + // 13 elems + vldmia r0!,{q0,q1,q2} + vldmia r0!,{s12} + vldmia r2!,{q4,q5,q6} + vldmia r2!,{s13} + vldmia r3!,{q8,q9,q10} + vldmia r3!,{s14} + vldmia r6!,{q13,q14,q15} + vldmia r6!,{s15} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + fadds s12,s12,s13 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q2,q2,q10 + fadds s12,s12,s14 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + fadds s12,s12,s15 + vldmia r7!,{q13,q14,q15} + vldmia r7!,{s15} + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + fadds s12,s12,s15 + vstmia r5!,{q0,q1,q2} + vstmia r5!,{s12} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 d24,d24,d6 + + b .Lf5end +.Lf5eq12: + // 12 elems + vldmia r0!,{q0,q1,q2} + vldmia r2!,{q3,q4,q5} + vldmia r3!,{q6,q7,q8} + vldmia r6!,{q9,q10,q11} + vldmia r7!,{q13,q14,q15} + + vadd.f32 q0,q0,q3 + vadd.f32 q1,q1,q4 + vadd.f32 q2,q2,q5 + vadd.f32 q0,q0,q6 + vadd.f32 q1,q1,q7 + vadd.f32 q2,q2,q8 + vadd.f32 q0,q0,q9 + vadd.f32 q1,q1,q10 + vadd.f32 q2,q2,q11 + vadd.f32 q0,q0,q13 + vadd.f32 q1,q1,q14 + vadd.f32 q2,q2,q15 + vstmia r5!,{q0,q1,q2} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + + b .Lf5end +.Lf5lt12: + cmp r4,#10 + blo .Lf5lt10 + beq .Lf5eq10 + // 11 elems + vldmia r0!,{q0,q1} + vldmia r0!,{s8,s9,s10} + vldmia r2!,{q7,q8} + vldmia r2!,{d6} + vldmia r2!,{s11} + vldmia r3!,{q9,q10} + vldmia r3!,{s14,s15,s16} + vldmia r6!,{q11} + vldmia r6!,{q13} + vldmia r6!,{s18,s19,s20} + vldmia r7!,{q14} + vldmia r7!,{q15} + vldmia r7!,{s22,s23,s24} + + vadd.f32 q0,q0,q7 + vadd.f32 q1,q1,q8 + vadd.f32 d4,d4,d6 + vadd.f32 s10,s10,s11 + vadd.f32 q0,q0,q9 + vadd.f32 q1,q1,q10 + vadd.f32 d4,d4,d7 + vadd.f32 s10,s10,s16 + vadd.f32 q0,q0,q11 + vadd.f32 q1,q1,q13 + vadd.f32 d4,d4,d9 + vadd.f32 s10,s10,s20 + vadd.f32 q0,q0,q14 + vadd.f32 q1,q1,q15 + vadd.f32 d4,d4,d11 + vadd.f32 s10,s10,s24 + vstmia r5!,{q0,q1} + vstmia r5!,{s8,s9,s10} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + + b .Lf5end +.Lf5eq10: + // 10 elems + vldmia r0!,{q0,q1} + vldmia r0!,{d4} + vldmia r2!,{q3,q4} + vldmia r2!,{d5} + vldmia r3!,{q5,q6} + vldmia r3!,{d14} + vldmia r6!,{q8,q9} + vldmia r6!,{d15} + vldmia r7!,{q10,q11} + vldmia r7!,{d26} + + vadd.f32 q0,q0,q3 + vadd.f32 q1,q1,q4 + vadd.f32 d4,d4,d5 + vadd.f32 q0,q0,q5 + vadd.f32 q1,q1,q6 + vadd.f32 d4,d4,d14 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 d4,d4,d15 + vadd.f32 q0,q0,q10 + vadd.f32 q1,q1,q11 + vadd.f32 d4,d4,d26 + vstmia r5!,{q0,q1} + vstmia r5!,{d4} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 d24,d24,d4 + + b .Lf5end +.Lf5lt10: + // 9 elems + vldmia r0!,{q0,q1} + vldmia r0!,{s8} + vldmia r2!,{q4,q5} + vldmia r2!,{s9} + vldmia r3!,{q6,q7} + vldmia r3!,{s10} + vldmia r6!,{q8,q9} + vldmia r6!,{s11} + vldmia r7!,{q10,q11} + vldmia r7!,{s12} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + fadds s8,s8,s9 + vadd.f32 q0,q0,q6 + vadd.f32 q1,q1,q7 + fadds s8,s8,s10 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + fadds s8,s8,s11 + vadd.f32 q0,q0,q10 + vadd.f32 q1,q1,q11 + fadds s8,s8,s12 + vstmia r5!,{q0,q1} + vstmia r5!,{s8} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 d24,d24,d4 + + b .Lf5end +.Lf5eq8: + // 8 elems + vldmia r0!,{q0,q1} + vldmia r2!,{q2,q3} + vldmia r3!,{q4,q5} + vldmia r6!,{q8,q9} + vldmia r7!,{q10,q11} + + vadd.f32 q0,q0,q2 + vadd.f32 q1,q1,q3 + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q0,q0,q8 + vadd.f32 q1,q1,q9 + vadd.f32 q0,q0,q10 + vadd.f32 q1,q1,q11 + vstmia r5!,{q0,q1} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + + b .Lf5end +.Lf5lt8: + cmp r4,#4 + blo .Lf5lt4 + beq .Lf5eq4 + + cmp r4,#6 + blo .Lf5lt6 + beq .Lf5eq6 + // 7 elems + vldmia r0!,{q0} + vldmia r0!,{s4,s5,s6} + vldmia r2!,{q2} + vldmia r2!,{d6} + vldmia r2!,{s7} + vldmia r3!,{q4} + vldmia r3!,{s20,s21,s22} + vldmia r6!,{q6} + vldmia r6!,{s28,s29,s30} + vldmia r7!,{q8} + vldmia r7!,{d7} + vldmia r7!,{s31} + + vadd.f32 q0,q0,q2 + vadd.f32 d2,d2,d6 + vadd.f32 s6,s6,s7 + vadd.f32 q0,q0,q4 + vadd.f32 d2,d2,d10 + vadd.f32 s6,s6,s22 + vadd.f32 q0,q0,q6 + vadd.f32 d2,d2,d14 + vadd.f32 s6,s6,s30 + vadd.f32 q0,q0,q8 + vadd.f32 d2,d2,d7 + vadd.f32 s6,s6,s31 + vstmia r5!,{q0} + vstmia r5!,{s4,s5,s6} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + + b .Lf5end +.Lf5eq6: + // 6 elems + vldmia r0!,{q0} + vldmia r0!,{d2} + vldmia r2!,{q2} + vldmia r2!,{d6} + vldmia r3!,{q4} + vldmia r3!,{d10} + vldmia r6!,{q6} + vldmia r6!,{d14} + vldmia r7!,{q8} + vldmia r7!,{d15} + + vadd.f32 q0,q0,q2 + vadd.f32 d2,d2,d6 + vadd.f32 q0,q0,q4 + vadd.f32 d2,d2,d10 + vadd.f32 q0,q0,q6 + vadd.f32 d2,d2,d14 + vadd.f32 q0,q0,q8 + vadd.f32 d2,d2,d15 + vstmia r5!,{q0} + vstmia r5!,{d2} + + vmax.f32 q12,q12,q0 + vmax.f32 d24,d24,d2 + + b .Lf5end +.Lf5lt6: + // 5 elems + vldmia r0!,{q0} + vldmia r0!,{s4} + vldmia r2!,{q2} + vldmia r2!,{s5} + vldmia r3!,{q4} + vldmia r3!,{s6} + vldmia r6!,{q6} + vldmia r6!,{s7} + vldmia r7!,{q8} + vldmia r7!,{s12} + + vadd.f32 q0,q0,q2 + fadds s4,s4,s5 + vadd.f32 q0,q0,q4 + fadds s4,s4,s6 + vadd.f32 q0,q0,q6 + fadds s4,s4,s7 + vadd.f32 q0,q0,q8 + fadds s4,s4,s12 + vstmia r5!,{q0} + vstmia r5!,{s4} + + vmax.f32 q12,q12,q0 + vmax.f32 d24,d24,d2 + + b .Lf5end +.Lf5eq4: + // 4 elems + vldmia r0!,{q0} + vldmia r2!,{q4} + vldmia r3!,{q8} + vldmia r6!,{q13} + vldmia r7!,{q14} + + vadd.f32 q0,q0,q4 + vadd.f32 q0,q0,q8 + vadd.f32 q0,q0,q13 + vadd.f32 q0,q0,q14 + vstmia r5!,{q0} + + vmax.f32 q12,q12,q0 + + b .Lf5end +.Lf5lt4: + cmp r4,#2 + blo .Lf5lt2 + beq .Lf5eq2 + // 3 elems + vldmia r0!,{s0,s1,s2} + vldmia r2!,{d2} + vldmia r2!,{s3} + vldmia r3!,{s6,s7,s8} + vldmia r6!,{s10,s11,s12} + vldmia r7!,{s14,s15,s16} + + vadd.f32 d0,d0,d2 + vadd.f32 s2,s2,s3 + vadd.f32 d0,d0,d3 + vadd.f32 s2,s2,s8 + vadd.f32 d0,d0,d5 + vadd.f32 s2,s2,s12 + vadd.f32 d0,d0,d7 + vadd.f32 s2,s2,s16 + vstmia r5!,{s0,s1,s2} + + vmax.f32 q12,q12,q0 + + b .Lf5end +.Lf5eq2: + // 2 elems + vldmia r0!,{d0} + vldmia r2!,{d4} + vldmia r3!,{d8} + vldmia r6!,{d12} + vldmia r7!,{d13} + + vadd.f32 d0,d0,d4 + vadd.f32 d0,d0,d8 + vadd.f32 d0,d0,d12 + vadd.f32 d0,d0,d13 + vstmia r5!,{d0} + + vmax.f32 d24,d24,d0 + + b .Lf5end +.Lf5lt2: + cmp r4,#0 + beq .Lf5eq0 + + vldmia r0!,{s0} + vldmia r2!,{s1} + vldmia r3!,{s2} + vldmia r6!,{s3} + vldmia r7!,{s4} + + vadd.f32 s0,s0,s1 + vadd.f32 s0,s0,s2 + vadd.f32 s0,s0,s3 + vadd.f32 s0,s0,s4 + vstmia r5!,{s0} + + vmax.f32 d24,d24,d0 +.Lf5eq0: +.Lf5end: + vpmax.f32 d24,d24,d25 + vpmax.f32 d0,d24,d24 + + fmrs r0,s0 + vpop {d8,d9,d10,d11,d12,d13,d14,d15} + pop {r4,r5,r6,r7,r8,lr} + bx lr + +.Lfoldby5sel: +.rept 31 + .word neon_foldArrayBy5_ll31 +.endr + .word neon_foldArrayBy5_lge31 + + + .global neon_foldArrayBy5_lge31 + .type neon_foldArrayBy5_lge31, %function +neon_foldArrayBy5_lge31: + push {r4,r5,r6,r7,r8,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + ldrd r6,[r1,#16] // tmp2 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + add r6,r0,r6,lsl #2 + add r7,r0,r7,lsl #2 + ldrd r4,[r1] // di,dest + add r8,r0,r4,lsl #2 // end + + veor.i32 q12,q12,q12 + sub r8,r8,#4*31 + cmp r0,r8 + bhs .Lendf5loop2 +.Lf5loop2: + FOLDBY5_CORE + FOLDBY5_CORE + + cmp r0,r8 + blo .Lf5loop2 +.Lendf5loop2: + add r8,r8,#4*16 + cmp r0,r8 + bhs .Lendf5loop1 +.Lf5loop3: + FOLDBY5_CORE + + cmp r0,r8 + blo .Lf5loop3 +.Lendf5loop3: + b .Lendf5loop1 + + + /***** + * fold array by 2 + ******/ + .global neon_foldArrayBy2_ll31 + .type neon_foldArrayBy2_ll31, %function +neon_foldArrayBy2_ll31: + push {r4,r5,r6,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + + ldr r0,[r0,#4] // ss1 + ldrd r2,[r1,#8] // tmp0 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + ldrd r4,[r1] // di,dest + add r6,r2,r4,lsl #2 // end + + veor.i32 q12,q12,q12 + sub r6,r6,#4*15 + cmp r2,r6 + bhs .Lendf2loop1 +.Lf2loop1: +.macro FOLDBY2_CORE + vldmia r2!,{q0,q1,q2,q3} + vldmia r3!,{q4,q5,q6,q7} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 q3,q3,q7 + vstmia r5!,{q0,q1,q2,q3} + + vmax.f32 q13,q0,q1 + vmax.f32 q14,q2,q3 + vmax.f32 q12,q12,q13 + vmax.f32 q12,q12,q14 +.endm + FOLDBY2_CORE + + cmp r2,r6 + blo .Lf2loop1 +.Lendf2loop1: + and r4,r4,#15 + cmp r4,#8 + blo .Lf2lt8 + beq .Lf2eq8 + + cmp r4,#12 + blo .Lf2lt12 + beq .Lf2eq12 + + cmp r4,#14 + blo .Lf2lt14 + beq .Lf2eq14 + // 15 elems + vldmia r2!,{q0,q1,q2} + vldmia r2!,{s12,s13,s14} + vldmia r3!,{q4,q5,q6} + vldmia r3!,{s28,s29} + vldmia r3!,{s15} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 d6,d6,d14 + vadd.f32 s14,s14,s15 + vstmia r5!,{q0,q1,q2} + vstmia r5!,{s12,s13,s14} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 q12,q12,q3 + + b .Lf2end +.Lf2eq14: + // 14 elems + vldmia r2!,{q0,q1,q2} + vldmia r2!,{d6} + vldmia r3!,{q4,q5,q6} + vldmia r3!,{d14} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vadd.f32 d6,d6,d14 + vstmia r5!,{q0,q1,q2} + vstmia r5!,{d6} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 d24,d24,d6 + + b .Lf2end +.Lf2lt14: + // 13 elems + vldmia r2!,{q0,q1,q2} + vldmia r2!,{s12} + vldmia r3!,{q4,q5,q6} + vldmia r3!,{s13} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + fadds s12,s12,s13 + vstmia r5!,{q0,q1,q2} + vstmia r5!,{s12} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + vmax.f32 d24,d24,d6 + + b .Lf2end +.Lf2eq12: + // 12 elems + vldmia r2!,{q0,q1,q2} + vldmia r3!,{q4,q5,q6} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 q2,q2,q6 + vstmia r5!,{q0,q1,q2} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + + b .Lf2end +.Lf2lt12: + cmp r4,#10 + blo .Lf2lt10 + beq .Lf2eq10 + // 11 elems + vldmia r2!,{q0,q1} + vldmia r2!,{s8,s9,s10} + vldmia r3!,{q4,q5} + vldmia r3!,{s24,s25} + vldmia r3!,{s11} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 d4,d4,d12 + vadd.f32 s10,s10,s11 + vstmia r5!,{q0,q1} + vstmia r5!,{s8,s9,s10} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 q12,q12,q2 + + b .Lf2end +.Lf2eq10: + // 10 elems + vldmia r2!,{q0,q1} + vldmia r2!,{d4} + vldmia r3!,{q4,q5} + vldmia r3!,{d12} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vadd.f32 d4,d4,d12 + vstmia r5!,{q0,q1} + vstmia r5!,{d4} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 d24,d24,d4 + + b .Lf2end +.Lf2lt10: + // 9 elems + vldmia r2!,{q0,q1} + vldmia r2!,{s8} + vldmia r3!,{q4,q5} + vldmia r3!,{s9} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + fadds s8,s8,s9 + vstmia r5!,{q0,q1} + vstmia r5!,{s8} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + vmax.f32 d24,d24,d4 + + b .Lf2end +.Lf2eq8: + // 8 elems + vldmia r2!,{q0,q1} + vldmia r3!,{q4,q5} + + vadd.f32 q0,q0,q4 + vadd.f32 q1,q1,q5 + vstmia r5!,{q0,q1} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + + b .Lf2end +.Lf2lt8: + cmp r4,#4 + blo .Lf2lt4 + beq .Lf2eq4 + + cmp r4,#6 + blo .Lf2lt6 + beq .Lf2eq6 + // 7 elems + vldmia r2!,{q0} + vldmia r2!,{s4,s5,s6} + vldmia r3!,{q4} + vldmia r3!,{s20,s21} + vldmia r3!,{s7} + + vadd.f32 q0,q0,q4 + vadd.f32 d2,d2,d10 + vadd.f32 s6,s6,s7 + vstmia r5!,{q0} + vstmia r5!,{s4,s5,s6} + + vmax.f32 q12,q12,q0 + vmax.f32 q12,q12,q1 + + b .Lf2end +.Lf2eq6: + // 6 elems + vldmia r2!,{q0} + vldmia r2!,{d2} + vldmia r3!,{q4} + vldmia r3!,{d10} + + vadd.f32 q0,q0,q4 + vadd.f32 d2,d2,d10 + vstmia r5!,{q0} + vstmia r5!,{d2} + + vmax.f32 q12,q12,q0 + vmax.f32 d24,d24,d2 + + b .Lf2end +.Lf2lt6: + // 5 elems + vldmia r2!,{q0} + vldmia r2!,{s4} + vldmia r3!,{q4} + vldmia r3!,{s5} + + vadd.f32 q0,q0,q4 + fadds s4,s4,s5 + vstmia r5!,{q0} + vstmia r5!,{s4} + + vmax.f32 q12,q12,q0 + vmax.f32 d24,d24,d2 + + b .Lf2end +.Lf2eq4: + // 4 elems + vldmia r2!,{q0} + vldmia r3!,{q4} + + vadd.f32 q0,q0,q4 + vstmia r5!,{q0} + + vmax.f32 q12,q12,q0 + + b .Lf2end +.Lf2lt4: + cmp r4,#2 + blo .Lf2lt2 + beq .Lf2eq2 + // 3 elems + vldmia r2!,{s0,s1,s2} + vldmia r3!,{s16,s17} + vldmia r3!,{s3} + + vadd.f32 d0,d0,d8 + vadd.f32 s2,s2,s3 + vstmia r5!,{s0,s1,s2} + + vmax.f32 q12,q12,q0 + + b .Lf2end +.Lf2eq2: + // 2 elems + vldmia r2!,{d0} + vldmia r3!,{d4} + + vadd.f32 d0,d0,d4 + vstmia r5!,{d0} + + vmax.f32 d24,d24,d0 + + b .Lf2end +.Lf2lt2: + cmp r4,#0 + beq .Lf2eq0 + + vldmia r2!,{s0} + vldmia r3!,{s1} + + vadd.f32 s0,s0,s1 + vstmia r5!,{s0} + + vmax.f32 d24,d24,d0 +.Lf2eq0: +.Lf2end: + vpmax.f32 d24,d24,d25 + vpmax.f32 d0,d24,d24 + + fmrs r0,s0 + vpop {d8,d9,d10,d11,d12,d13,d14,d15} + pop {r4,r5,r6,lr} + bx lr + + + .global neon_foldArrayBy2_lge31 + .type neon_foldArrayBy2_lge31, %function +neon_foldArrayBy2_lge31: + push {r4,r5,r6,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + + ldr r0,[r0,#4] // ss1 + ldrd r2,[r1,#8] // tmp0 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + ldrd r4,[r1] // di,dest + add r6,r2,r4,lsl #2 // end + + veor.i32 q12,q12,q12 + sub r6,r6,#4*31 + cmp r2,r6 + bhs .Lendf2loop2 +.Lf2loop2: + FOLDBY2_CORE + FOLDBY2_CORE + + cmp r2,r6 + blo .Lf2loop2 +.Lendf2loop2: + add r6,r6,#4*16 + cmp r2,r6 + bhs .Lendf2loop1 +.Lf2loop3: + FOLDBY2_CORE + + cmp r2,r6 + blo .Lf2loop3 +.Lendf2loop3: + b .Lendf2loop1 + +.Lfoldby2sel: +.rept 31 + .word neon_foldArrayBy2_ll31 +.endr + .word neon_foldArrayBy2_lge31 + + .align 2 +.Lname: + .string "opt NEON" + + .align 2 + .global neonFoldMain +neonFoldMain: + .word .Lfoldby3sel + .word .Lfoldby4sel + .word .Lfoldby5sel + .word .Lfoldby2sel + .word .Lfoldby2sel + .word .Lname + /* + + + * _Z21neon_GetPowerSpectrumPA2_fPfi.S + * Author: Mateusz Szpakowski + */ + + .align 2 + .global _Z21neon_GetPowerSpectrumPA2_fPfi + .type _Z21neon_GetPowerSpectrumPA2_fPfi, %function +_Z21neon_GetPowerSpectrumPA2_fPfi: + push {r4,r5} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + ldr r3,.LGOTa +.LPICa: + add r3,pc,r3 + ldr r4,.LGOTa+4 + ldr r4,[r3,r4] + add r5,r2,r2,lsl #1 + fldd d0,[r4,#32] + fmsr s4,r5 + fuitod d1,s4 + faddd d0,d0,d1 + fstd d0,[r4,#32] + + cmp r2,#4096 + blo .Lsecondversion + + add r2,r0,r2, lsl #3 + sub r2,r2,#31*8 + /* r0 - freqData + * r1 - PowerSpectrum + * r2 - end of freqData + */ + cmp r0,r2 + bhs .Lendmainloopa +.Lmainloopa: + pld [r0,#128] + vldmia r0!,{q0,q1,q2,q3,q4,q5,q6,q7} + vmul.f32 q0,q0,q0 + vmul.f32 q1,q1,q1 + vmul.f32 q2,q2,q2 + vmul.f32 q3,q3,q3 + vmul.f32 q4,q4,q4 + vmul.f32 q5,q5,q5 + vmul.f32 q6,q6,q6 + vmul.f32 q7,q7,q7 + vpadd.f32 d16,d0,d1 + vpadd.f32 d17,d2,d3 + vpadd.f32 d18,d4,d5 + vpadd.f32 d19,d6,d7 + vpadd.f32 d20,d8,d9 + vpadd.f32 d21,d10,d11 + vpadd.f32 d22,d12,d13 + vpadd.f32 d23,d14,d15 + + pld [r0,#128] + vldmia r0!,{q0,q1,q2,q3,q4,q5,q6,q7} + vstmia r1!,{q8,q9,q10,q11} + vmul.f32 q0,q0,q0 + vmul.f32 q1,q1,q1 + vmul.f32 q2,q2,q2 + vmul.f32 q3,q3,q3 + vmul.f32 q4,q4,q4 + vmul.f32 q5,q5,q5 + vmul.f32 q6,q6,q6 + vmul.f32 q7,q7,q7 + vpadd.f32 d16,d0,d1 + vpadd.f32 d17,d2,d3 + vpadd.f32 d18,d4,d5 + vpadd.f32 d19,d6,d7 + vpadd.f32 d20,d8,d9 + vpadd.f32 d21,d10,d11 + vpadd.f32 d22,d12,d13 + vpadd.f32 d23,d14,d15 + vstmia r1!,{q8,q9,q10,q11} + + cmp r0,r2 + blo .Lmainloopa + +.Lendmainloopa: + add r2,r2,#8*24 + bhs .Lendsmallloopa +.Lsmallloopa: + vldmia r0!,{q0,q1,q2,q3} + vmul.f32 q0,q0,q0 + vmul.f32 q1,q1,q1 + vmul.f32 q2,q2,q2 + vmul.f32 q3,q3,q3 + vpadd.f32 d16,d0,d1 + vpadd.f32 d17,d2,d3 + vpadd.f32 d18,d4,d5 + vpadd.f32 d19,d6,d7 + vstmia r1!,{q8,q9,q10,q11} + cmp r0,r2 + blo .Lsmallloopa +.Lendsmallloopa: + add r2,r2,#8*7 + cmp r0,r2 + beq .Lendmicroloop +.Lmicroloop: + fldmias r0!,{s0,s1} + fmuls s2,s0,s0 + fmacs s2,s1,s1 + fstmias r1!,{s2} + + cmp r0,r2 + blo .Lmicroloop +.Lendmicroloop: + mov r0,#0 + vpop {d8,d9,d10,d11,d12,d13,d14,d15} + pop {r4,r5} + bx lr + + + /* + * second version + */ +.Lsecondversion: + add r2,r0,r2, lsl #3 + sub r2,r2,#31*8 + /* r0 - freqData + * r1 - PowerSpectrum + * r2 - end of freqData + */ + cmp r0,r2 + bhs .Lendmainloop2 +.Lmainloop2: + vldmia r0!,{q0,q1,q2,q3,q4,q5,q6,q7} + vldmia r0!,{q8,q9,q10,q11,q12,q13,q14,q15} + vuzp.32 q0,q1 + vuzp.32 q2,q3 + vuzp.32 q4,q5 + vuzp.32 q6,q7 + vuzp.32 q8,q9 + vuzp.32 q10,q11 + vuzp.32 q12,q13 + vuzp.32 q14,q15 + vmul.f32 q0,q0,q0 + vmul.f32 q2,q2,q2 + vmul.f32 q4,q4,q4 + vmul.f32 q6,q6,q6 + vmul.f32 q8,q8,q8 + vmul.f32 q10,q10,q10 + vmul.f32 q12,q12,q12 + vmul.f32 q14,q14,q14 + vmla.f32 q0,q1,q1 + vmla.f32 q2,q3,q3 + vmla.f32 q4,q5,q5 + vmla.f32 q6,q7,q7 + vmla.f32 q8,q9,q9 + vmla.f32 q10,q11,q11 + vmla.f32 q12,q13,q13 + vmla.f32 q14,q15,q15 + vstmia r1!,{q0} + vstmia r1!,{q2} + vstmia r1!,{q4} + vstmia r1!,{q6} + vstmia r1!,{q8} + vstmia r1!,{q10} + vstmia r1!,{q12} + vstmia r1!,{q14} + + cmp r0,r2 + blo .Lmainloop2 + +.Lendmainloop2: + add r2,r2,#8*24 + bhs .Lendsmallloop2 +.Lsmallloop2: + vldmia r0!,{q0,q1,q2,q3} + vmul.f32 q0,q0,q0 + vmul.f32 q1,q1,q1 + vmul.f32 q2,q2,q2 + vmul.f32 q3,q3,q3 + vpadd.f32 d16,d0,d1 + vpadd.f32 d17,d2,d3 + vpadd.f32 d18,d4,d5 + vpadd.f32 d19,d6,d7 + vstmia r1!,{q8,q9,q10,q11} + cmp r0,r2 + blo .Lsmallloop2 +.Lendsmallloop2: + add r2,r2,#8*7 + cmp r0,r2 + beq .Lendmicroloop +.Lmicroloop2: + fldmias r0!,{s0,s1} + fmuls s2,s0,s0 + fmacs s2,s1,s1 + fstmias r1!,{s2} + + cmp r0,r2 + blo .Lmicroloop2 + b .Lendmicroloop + + .align 2 +.LGOTa: + .word _GLOBAL_OFFSET_TABLE_-(.LPICa+8) + .word analysis_state(GOT) + +#endif // __arm__ diff --git a/client/vector/analyzeFuncs_sse.cpp b/client/vector/analyzeFuncs_sse.cpp new file mode 100644 index 0000000..24756de --- /dev/null +++ b/client/vector/analyzeFuncs_sse.cpp @@ -0,0 +1,3543 @@ + +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: analyzeFuncs_sse.cpp,v 1.1.2.10 2007/06/08 03:09:47 korpela Exp $ +// + +// This file is empty is __i386__ is not defined +#include "sah_config.h" +#include +#include + +#if defined(__i386__) || defined(__x86_64__) || defined(USE_SSE) + +#define INVALID_CHIRP 2e+20 + +#include "analyzeFuncs.h" +#include "analyzeFuncs_vector.h" +#include "analyzePoT.h" +#include "analyzeReport.h" +#include "gaussfit.h" +#include "s_util.h" +#include "diagnostics.h" +#include "asmlib.h" +#include "pulsefind.h" + +#include "x86_ops.h" +#include "x86_float4.h" + +static bool checked=false; +static bool hasSSE=false; + +bool boinc_has_sse( void ) { +#ifdef USE_ASMLIB + static bool hasSSE = (InstructionSet() >= 3) ? true : false; + return hasSSE; +#else + return true; +#endif +} + +template +inline void v_pfsubTranspose(float *in, float *out, int xline, int yline) { + // Transpose an X by X subsection of a XLINE by YLINE matrix into the + // appropriate part of a YLINE by XLINE matrix. "IN" points to the first + // (lowest address) element of the input submatrix. "OUT" points to the + // first (lowest address) element of the output submatrix. +#ifdef USE_MANUAL_CALLSTACK + static char name[64]; + if (name[0]==0) sprintf(name,"v_pfsubTranspose<%d>()",x); + call_stack.enter(name); +#endif + int i,j; + float *p; + register float tmp[x*x]; + for (j=0;j(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in, out, xline, yline); +#endif + prefetcht0(in+0*xline+4); + prefetcht0(in+1*xline+4); + prefetcht0(in+2*xline+4); + prefetcht0(in+3*xline+4); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +int v_vTranspose4(int x, int y, float *in, float *out) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_vTranspose4()"); +#endif + int i,j; + for (j=0;j(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in, out, xline, yline); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +int v_vTranspose4np(int x, int y, float *in, float *out) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_vTranspose4np()"); +#endif + int i,j; + for (j=0;j= 0.0) ? TWO_TO_52 : -TWO_TO_52; +#else + // For X87 FPU + double roundVal = (srate >= 0.0) ? ROUNDX87 : -ROUNDX87; +#endif + int i, vEnd; + unsigned short fpucw1, fpucw2; + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + for (i = 0; i < vEnd; i += 8) { + const float *data = (const float *) (fp_DataArray + i); + float *chirped = (float *) (fp_ChirpDataArray + i); + double angles[8], dtemp; + ALIGNED(float, 16) v_angle[4], v_angle2[4]; +// float __attribute__ ((aligned (16))) v_angle[4], v_angle2[4]; + + __m128 d1, d2; + __m128 cd1, cd2, cd3; + __m128 td1, td2; + __m128 x; + __m128 y; + __m128 s; + __m128 c; + __m128 m; + + prefetchnta((const void *)( data+32 )); + + dtemp = double( i ); + angles[0] = dtemp+0.0; + angles[1] = dtemp+1.0; + angles[2] = dtemp+2.0; + angles[3] = dtemp+3.0; + angles[4] = dtemp+4.0; + angles[5] = dtemp+5.0; + angles[6] = dtemp+6.0; + angles[7] = dtemp+7.0; + + // calculate the input angle + angles[0] *= angles[0] * srate; // angle^2 * rate + angles[1] *= angles[1] * srate; + angles[2] *= angles[2] * srate; + angles[3] *= angles[3] * srate; + angles[4] *= angles[4] * srate; + angles[5] *= angles[5] * srate; + angles[6] *= angles[6] * srate; + angles[7] *= angles[7] * srate; + + // reduce the angle to the range (-0.5, 0.5) + // convert doubles into singles + // This does "angles - round(angles)" + set_extended_precision(); + set_up_fastfrac(roundVal); + v_angle[0] = fastfrac(angles[0],roundVal); + v_angle[1] = fastfrac(angles[1],roundVal); + v_angle[2] = fastfrac(angles[2],roundVal); + v_angle[3] = fastfrac(angles[3],roundVal); + v_angle2[0] = fastfrac(angles[4],roundVal); + v_angle2[1] = fastfrac(angles[5],roundVal); + v_angle2[2] = fastfrac(angles[6],roundVal); + v_angle2[3] = fastfrac(angles[7],roundVal); + clean_up_fastfrac(); + restore_fpucw(); + + x = _mm_load_ps( v_angle ); + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations + s = _mm_mul_ps(y, SS4); + c = _mm_mul_ps(y, CC3); + s = _mm_add_ps(s, SS3); + c = _mm_add_ps(c, CC2); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS2); + c = _mm_add_ps(c, CC1); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS1); + s = _mm_mul_ps(s, x); + c = _mm_add_ps(c, ONE); + + // perform first angle doubling + cd1 = _mm_mul_ps(s, c); + cd2 = _mm_mul_ps(c, c); + cd3 = _mm_mul_ps(s, s); + y = _mm_mul_ps(cd1, TWO); + x = _mm_sub_ps(cd2, cd3); + + // load the signal to be chirped + d1 = _mm_load_ps(data); + d2 = _mm_load_ps(data+4); + + // calculate scaling factor to correct the magnitude + // m1 = vec_nmsub(y1, y1, vec_nmsub(x1, x1, TWO)); + // m2 = vec_nmsub(y2, y2, vec_nmsub(x2, x2, TWO)); + cd1 = _mm_mul_ps(x, y); + cd2 = _mm_mul_ps(x, x); + cd3 = _mm_mul_ps(y, y); + m = vec_recip1(_mm_add_ps(cd2, cd3 )); //scaling factor + + // perform second angle doubling + s = _mm_mul_ps(cd1, TWO); + c = _mm_sub_ps(cd2, cd3); + + // correct the magnitude (final sine / cosine approximations) + c = _mm_mul_ps(c, m); + s = _mm_mul_ps(s, m); + + x = d1; + y = d2; + x = _mm_shuffle_ps(x, x, 0xB1); + y = _mm_shuffle_ps(y, y, 0xB1); + x = _mm_mul_ps(x, R_NEG); + y = _mm_mul_ps(y, R_NEG); + cd1 = _mm_shuffle_ps(c, c, 0x50); // 01 01 00 00 AaBb => BBbb => c3c3c4c4 + cd2 = _mm_shuffle_ps(c, c, 0xfa); // 11 11 10 10 AaBb => AAaa => c1c1c2c2 + td1 = _mm_shuffle_ps(s, s, 0x50); + td2 = _mm_shuffle_ps(s, s, 0xfa); + + cd1 = _mm_mul_ps(cd1, d1); + cd2 = _mm_mul_ps(cd2, d2); + td1 = _mm_mul_ps(td1, x); + td2 = _mm_mul_ps(td2, y); + + cd1 = _mm_add_ps(cd1, td1); + cd2 = _mm_add_ps(cd2, td2); + + // store chirped values + _mm_stream_ps(chirped+0, cd1); + _mm_stream_ps(chirped+4, cd2); + + // Retrieve second set of reduced angles + x = _mm_load_ps( v_angle2 ); + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations + s = _mm_mul_ps(y, SS4); + c = _mm_mul_ps(y, CC3); + s = _mm_add_ps(s, SS3); + c = _mm_add_ps(c, CC2); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS2); + c = _mm_add_ps(c, CC1); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS1); + s = _mm_mul_ps(s, x); + c = _mm_add_ps(c, ONE); + + // perform first angle doubling + cd1 = _mm_mul_ps(s, c); + cd2 = _mm_mul_ps(c, c); + cd3 = _mm_mul_ps(s, s); + y = _mm_mul_ps(cd1, TWO); + x = _mm_sub_ps(cd2, cd3); + + // load the signal to be chirped + d1 = _mm_load_ps(data+8); + d2 = _mm_load_ps(data+12); + + // calculate scaling factor to correct the magnitude + // m1 = vec_nmsub(y1, y1, vec_nmsub(x1, x1, TWO)); + // m2 = vec_nmsub(y2, y2, vec_nmsub(x2, x2, TWO)); + cd1 = _mm_mul_ps(x, y); + cd2 = _mm_mul_ps(x, x); + cd3 = _mm_mul_ps(y, y); + m = vec_recip1(_mm_add_ps(cd2, cd3 )); //scaling factor + + // perform second angle doubling + s = _mm_mul_ps(cd1, TWO); + c = _mm_sub_ps(cd2, cd3); + + // correct the magnitude (final sine / cosine approximations) + c = _mm_mul_ps(c, m); + s = _mm_mul_ps(s, m); + + x = d1; + y = d2; + x = _mm_shuffle_ps(x, x, 0xB1); + y = _mm_shuffle_ps(y, y, 0xB1); + x = _mm_mul_ps(x, R_NEG); + y = _mm_mul_ps(y, R_NEG); + cd1 = _mm_shuffle_ps(c, c, 0x50); // 01 01 00 00 AaBb => BBbb => c3c3c4c4 + cd2 = _mm_shuffle_ps(c, c, 0xfa); // 11 11 10 10 AaBb => AAaa => c1c1c2c2 + td1 = _mm_shuffle_ps(s, s, 0x50); + td2 = _mm_shuffle_ps(s, s, 0xfa); + + cd1 = _mm_mul_ps(cd1, d1); + cd2 = _mm_mul_ps(cd2, d2); + td1 = _mm_mul_ps(td1, x); + td2 = _mm_mul_ps(td2, y); + + cd1 = _mm_add_ps(cd1, td1); + cd2 = _mm_add_ps(cd2, td2); + + // store chirped values + _mm_stream_ps(chirped+8, cd1); + _mm_stream_ps(chirped+12, cd2); + } + _mm_sfence(); + + if ( i < ul_NumDataPoints) { + // use original routine to finish up any tailings (max stride-1 elements) + v_ChirpData(fp_DataArray+i, fp_ChirpDataArray+i + , ChirpRateInd, ChirpRate, ul_NumDataPoints-i, sample_rate); + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +/*************************************************** + * + * Alternate chirp function using Faster SinCos and Estrin method + * for polynomial calculations. Derived from version 8 Alex Kan code. + */ +int sse1_ChirpData_ak8e( + sah_complex * fp_DataArray, + sah_complex * fp_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse1_ChirpData_ak8e()"); +#endif + if (ChirpRateInd == 0) { + memcpy(fp_ChirpDataArray, fp_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + double srate = ChirpRate * 0.5 / (sample_rate * sample_rate); +#if defined(_LP64) || defined(_WIN64) || (defined(__GNUC__) && defined(__SSE_MATH__)) + // For scalar XMM code or any FPU with 64 bit registers + double roundVal = (srate >= 0.0) ? TWO_TO_52 : -TWO_TO_52; +#else + // For X87 FPU + double roundVal = (srate >= 0.0) ? ROUNDX87 : -ROUNDX87; +#endif + int i, vEnd; + unsigned short fpucw1, fpucw2; + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + + for (i = 0; i < vEnd; i += 8) { + const float *data = (const float *) (fp_DataArray + i); + float *chirped = (float *) (fp_ChirpDataArray + i); + double angles[8], dtemp; + + ALIGNED(float, 16) v_angle[4], v_angle2[4]; + + __m128 d1, d2; + __m128 cd1, cd2, cd3; + __m128 td1, td2; + __m128 v; + __m128 w; + __m128 x; + __m128 y; + __m128 z; + __m128 s; + __m128 c; + __m128 m; + + prefetchnta((const void *)( data+32 )); + + dtemp = double( i ); + angles[0] = dtemp+0.0; + angles[1] = dtemp+1.0; + angles[2] = dtemp+2.0; + angles[3] = dtemp+3.0; + angles[4] = dtemp+4.0; + angles[5] = dtemp+5.0; + angles[6] = dtemp+6.0; + angles[7] = dtemp+7.0; + + // calculate the input angle + angles[0] *= angles[0] * srate; // angle^2 * rate + angles[1] *= angles[1] * srate; + angles[2] *= angles[2] * srate; + angles[3] *= angles[3] * srate; + angles[4] *= angles[4] * srate; + angles[5] *= angles[5] * srate; + angles[6] *= angles[6] * srate; + angles[7] *= angles[7] * srate; + + // reduce the angle to the range (-0.5, 0.5) + // convert doubles into singles + // This does "angles - round(angles)" + set_extended_precision(); + set_up_fastfrac(roundVal); + v_angle[0] = fastfrac(angles[0],roundVal); + v_angle[1] = fastfrac(angles[1],roundVal); + v_angle[2] = fastfrac(angles[2],roundVal); + v_angle[3] = fastfrac(angles[3],roundVal); + v_angle2[0] = fastfrac(angles[4],roundVal); + v_angle2[1] = fastfrac(angles[5],roundVal); + v_angle2[2] = fastfrac(angles[6],roundVal); + v_angle2[3] = fastfrac(angles[7],roundVal); + clean_up_fastfrac(); + restore_fpucw(); + + x = _mm_load_ps( v_angle ); + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations with interleaved Estrin sequences + z = _mm_mul_ps(y, y); + s = _mm_mul_ps(y, SS4F); + c = _mm_mul_ps(y, CC3F); + s = _mm_add_ps(s, SS3F); + c = _mm_add_ps(c, CC2F); + s = _mm_mul_ps(s, z); + c = _mm_mul_ps(c, z); + v = _mm_mul_ps(y, SS2F); + w = _mm_mul_ps(y, CC1F); + v = _mm_add_ps(v, SS1F); + w = _mm_add_ps(w, ONE); + s = _mm_add_ps(s, v); + c = _mm_add_ps(c, w); + s = _mm_mul_ps(s, x); + + // perform first angle doubling + cd1 = _mm_mul_ps(s, c); + cd2 = _mm_mul_ps(c, c); + cd3 = _mm_mul_ps(s, s); + y = _mm_mul_ps(cd1, TWO); + x = _mm_sub_ps(cd2, cd3); + + // load the signal to be chirped + d1 = _mm_load_ps(data); + d2 = _mm_load_ps(data+4); + + // calculate scaling factor to correct the magnitude + // and perform second angle doubling + cd2 = _mm_mul_ps(x, x); + cd3 = _mm_mul_ps(y, y); + c = _mm_sub_ps(TWO, cd2); + cd1 = _mm_mul_ps(x, y); + m = _mm_sub_ps(c, cd3); + s = _mm_mul_ps(cd1, TWO); + c = _mm_sub_ps(cd2, cd3); + + // correct the magnitude (final sine / cosine approximations) + s = _mm_mul_ps(s, m); + c = _mm_mul_ps(c, m); + + x = d1; + y = d2; + x = _mm_shuffle_ps(x, x, 0xB1); + y = _mm_shuffle_ps(y, y, 0xB1); + x = _mm_mul_ps(x, R_NEG); + y = _mm_mul_ps(y, R_NEG); + cd1 = _mm_shuffle_ps(c, c, 0x50); + cd2 = _mm_shuffle_ps(c, c, 0xfa); + td1 = _mm_shuffle_ps(s, s, 0x50); + td2 = _mm_shuffle_ps(s, s, 0xfa); + + cd1 = _mm_mul_ps(cd1, d1); + cd2 = _mm_mul_ps(cd2, d2); + td1 = _mm_mul_ps(td1, x); + td2 = _mm_mul_ps(td2, y); + + cd1 = _mm_add_ps(cd1, td1); + cd2 = _mm_add_ps(cd2, td2); + + // store chirped values + _mm_stream_ps(chirped+0, cd1); + _mm_stream_ps(chirped+4, cd2); + + // Retrieve second set of reduced angles + x = _mm_load_ps( v_angle2 ); + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations with interleaved Estrin sequences + z = _mm_mul_ps(y, y); + s = _mm_mul_ps(y, SS4F); + c = _mm_mul_ps(y, CC3F); + s = _mm_add_ps(s, SS3F); + c = _mm_add_ps(c, CC2F); + s = _mm_mul_ps(s, z); + c = _mm_mul_ps(c, z); + v = _mm_mul_ps(y, SS2F); + w = _mm_mul_ps(y, CC1F); + v = _mm_add_ps(v, SS1F); + w = _mm_add_ps(w, ONE); + s = _mm_add_ps(s, v); + c = _mm_add_ps(c, w); + s = _mm_mul_ps(s, x); + + // perform first angle doubling + cd1 = _mm_mul_ps(s, c); + cd2 = _mm_mul_ps(c, c); + cd3 = _mm_mul_ps(s, s); + y = _mm_mul_ps(cd1, TWO); + x = _mm_sub_ps(cd2, cd3); + + // load the signal to be chirped + d1 = _mm_load_ps(data+8); + d2 = _mm_load_ps(data+12); + + // calculate scaling factor to correct the magnitude + // and perform second angle doubling + cd2 = _mm_mul_ps(x, x); + cd3 = _mm_mul_ps(y, y); + c = _mm_sub_ps(TWO, cd2); + cd1 = _mm_mul_ps(x, y); + m = _mm_sub_ps(c, cd3); + s = _mm_mul_ps(cd1, TWO); + c = _mm_sub_ps(cd2, cd3); + + // correct the magnitude (final sine / cosine approximations) + c = _mm_mul_ps(c, m); + s = _mm_mul_ps(s, m); + + x = d1; + y = d2; + x = _mm_shuffle_ps(x, x, 0xB1); + y = _mm_shuffle_ps(y, y, 0xB1); + x = _mm_mul_ps(x, R_NEG); + y = _mm_mul_ps(y, R_NEG); + cd1 = _mm_shuffle_ps(c, c, 0x50); // 01 01 00 00 AaBb => BBbb => c3c3c4c4 + cd2 = _mm_shuffle_ps(c, c, 0xfa); // 11 11 10 10 AaBb => AAaa => c1c1c2c2 + td1 = _mm_shuffle_ps(s, s, 0x50); + td2 = _mm_shuffle_ps(s, s, 0xfa); + + cd1 = _mm_mul_ps(cd1, d1); + cd2 = _mm_mul_ps(cd2, d2); + td1 = _mm_mul_ps(td1, x); + td2 = _mm_mul_ps(td2, y); + + cd1 = _mm_add_ps(cd1, td1); + cd2 = _mm_add_ps(cd2, td2); + + // store chirped values + _mm_stream_ps(chirped+8, cd1); + _mm_stream_ps(chirped+12, cd2); + } + _mm_sfence(); + + if ( i < ul_NumDataPoints) { + // use original routine to finish up any tailings (max stride-1 elements) + v_ChirpData(fp_DataArray+i, fp_ChirpDataArray+i + , ChirpRateInd, ChirpRate, ul_NumDataPoints-i, sample_rate); + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +/*************************************************** + * + * Alternate chirp function using Faster SinCos and Horner method + * for polynomial calculations. Derived from version 8 Alex Kan code. + */ +int sse1_ChirpData_ak8h( + sah_complex * fp_DataArray, + sah_complex * fp_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate +) { + +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse1_ChirpData_ak8h()"); +#endif + if (ChirpRateInd == 0) { + memcpy(fp_ChirpDataArray, fp_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + double srate = ChirpRate * 0.5 / (sample_rate * sample_rate); +#if defined(_LP64) || defined(_WIN64) || (defined(__GNUC__) && defined(__SSE_MATH__)) + // For scalar XMM code or any FPU with 64 bit registers + double roundVal = (srate >= 0.0) ? TWO_TO_52 : -TWO_TO_52; +#else + // For X87 FPU + double roundVal = (srate >= 0.0) ? ROUNDX87 : -ROUNDX87; +#endif + int i, vEnd; + unsigned short fpucw1, fpucw2; + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 7); + + for (i = 0; i < vEnd; i += 8) { + const float *data = (const float *) (fp_DataArray + i); + float *chirped = (float *) (fp_ChirpDataArray + i); + double angles[8], dtemp; + + ALIGNED(float, 16) v_angle[4], v_angle2[4]; + + __m128 d1, d2; + __m128 cd1, cd2, cd3; + __m128 td1, td2; + __m128 x; + __m128 y; + __m128 s; + __m128 c; + __m128 m; + + prefetchnta((const void *)( data+32 )); + + dtemp = double( i ); + angles[0] = dtemp+0.0; + angles[1] = dtemp+1.0; + angles[2] = dtemp+2.0; + angles[3] = dtemp+3.0; + angles[4] = dtemp+4.0; + angles[5] = dtemp+5.0; + angles[6] = dtemp+6.0; + angles[7] = dtemp+7.0; + + // calculate the input angle + angles[0] *= angles[0] * srate; // angle^2 * rate + angles[1] *= angles[1] * srate; + angles[2] *= angles[2] * srate; + angles[3] *= angles[3] * srate; + angles[4] *= angles[4] * srate; + angles[5] *= angles[5] * srate; + angles[6] *= angles[6] * srate; + angles[7] *= angles[7] * srate; + + // reduce the angle to the range (-0.5, 0.5) + // convert doubles into singles + // This does "angles - round(angles)" + set_extended_precision(); + set_up_fastfrac(roundVal); + v_angle[0] = fastfrac(angles[0],roundVal); + v_angle[1] = fastfrac(angles[1],roundVal); + v_angle[2] = fastfrac(angles[2],roundVal); + v_angle[3] = fastfrac(angles[3],roundVal); + v_angle2[0] = fastfrac(angles[4],roundVal); + v_angle2[1] = fastfrac(angles[5],roundVal); + v_angle2[2] = fastfrac(angles[6],roundVal); + v_angle2[3] = fastfrac(angles[7],roundVal); + clean_up_fastfrac(); + restore_fpucw(); + + x = _mm_load_ps( v_angle ); + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations using interleaved Horner sequences + s = _mm_mul_ps(y, SS4F); + c = _mm_mul_ps(y, CC3F); + s = _mm_add_ps(s, SS3F); + c = _mm_add_ps(c, CC2F); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS2F); + c = _mm_add_ps(c, CC1F); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS1F); + c = _mm_add_ps(c, ONE); + s = _mm_mul_ps(s, x); + + // perform first angle doubling + cd1 = _mm_mul_ps(s, c); + cd2 = _mm_mul_ps(c, c); + cd3 = _mm_mul_ps(s, s); + y = _mm_mul_ps(cd1, TWO); + x = _mm_sub_ps(cd2, cd3); + + // load the signal to be chirped + d1 = _mm_load_ps(data); + d2 = _mm_load_ps(data+4); + + // calculate scaling factor to correct the magnitude + // and perform second angle doubling + cd2 = _mm_mul_ps(x, x); + cd3 = _mm_mul_ps(y, y); + c = _mm_sub_ps(TWO, cd2); + cd1 = _mm_mul_ps(x, y); + m = _mm_sub_ps(c, cd3); + s = _mm_mul_ps(cd1, TWO); + c = _mm_sub_ps(cd2, cd3); + + // correct the magnitude (final sine / cosine approximations) + s = _mm_mul_ps(s, m); + c = _mm_mul_ps(c, m); + + x = d1; + y = d2; + x = _mm_shuffle_ps(x, x, 0xB1); + y = _mm_shuffle_ps(y, y, 0xB1); + x = _mm_mul_ps(x, R_NEG); + y = _mm_mul_ps(y, R_NEG); + cd1 = _mm_shuffle_ps(c, c, 0x50); + cd2 = _mm_shuffle_ps(c, c, 0xfa); + td1 = _mm_shuffle_ps(s, s, 0x50); + td2 = _mm_shuffle_ps(s, s, 0xfa); + + cd1 = _mm_mul_ps(cd1, d1); + cd2 = _mm_mul_ps(cd2, d2); + td1 = _mm_mul_ps(td1, x); + td2 = _mm_mul_ps(td2, y); + + cd1 = _mm_add_ps(cd1, td1); + cd2 = _mm_add_ps(cd2, td2); + + // store chirped values + _mm_stream_ps(chirped+0, cd1); + _mm_stream_ps(chirped+4, cd2); + + // Retrieve second set of reduced angles + x = _mm_load_ps( v_angle2 ); + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations using interleaved Horner sequences + s = _mm_mul_ps(y, SS4F); + c = _mm_mul_ps(y, CC3F); + s = _mm_add_ps(s, SS3F); + c = _mm_add_ps(c, CC2F); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS2F); + c = _mm_add_ps(c, CC1F); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS1F); + c = _mm_add_ps(c, ONE); + s = _mm_mul_ps(s, x); + + // perform first angle doubling + cd1 = _mm_mul_ps(s, c); + cd2 = _mm_mul_ps(c, c); + cd3 = _mm_mul_ps(s, s); + y = _mm_mul_ps(cd1, TWO); + x = _mm_sub_ps(cd2, cd3); + + // load the signal to be chirped + d1 = _mm_load_ps(data+8); + d2 = _mm_load_ps(data+12); + + // calculate scaling factor to correct the magnitude + // and perform second angle doubling + cd2 = _mm_mul_ps(x, x); + cd3 = _mm_mul_ps(y, y); + c = _mm_sub_ps(TWO, cd2); + cd1 = _mm_mul_ps(x, y); + m = _mm_sub_ps(c, cd3); + s = _mm_mul_ps(cd1, TWO); + c = _mm_sub_ps(cd2, cd3); + + // correct the magnitude (final sine / cosine approximations) + c = _mm_mul_ps(c, m); + s = _mm_mul_ps(s, m); + + x = d1; + y = d2; + x = _mm_shuffle_ps(x, x, 0xB1); + y = _mm_shuffle_ps(y, y, 0xB1); + x = _mm_mul_ps(x, R_NEG); + y = _mm_mul_ps(y, R_NEG); + cd1 = _mm_shuffle_ps(c, c, 0x50); // 01 01 00 00 AaBb => BBbb => c3c3c4c4 + cd2 = _mm_shuffle_ps(c, c, 0xfa); // 11 11 10 10 AaBb => AAaa => c1c1c2c2 + td1 = _mm_shuffle_ps(s, s, 0x50); + td2 = _mm_shuffle_ps(s, s, 0xfa); + + cd1 = _mm_mul_ps(cd1, d1); + cd2 = _mm_mul_ps(cd2, d2); + td1 = _mm_mul_ps(td1, x); + td2 = _mm_mul_ps(td2, y); + + cd1 = _mm_add_ps(cd1, td1); + cd2 = _mm_add_ps(cd2, td2); + + // store chirped values + _mm_stream_ps(chirped+8, cd1); + _mm_stream_ps(chirped+12, cd2); + } + _mm_sfence(); + + if ( i < ul_NumDataPoints) { + // use original routine to finish up any tailings (max stride-1 elements) + v_ChirpData(fp_DataArray+i, fp_ChirpDataArray+i + , ChirpRateInd, ChirpRate, ul_NumDataPoints-i, sample_rate); + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + + +/********************************************************************* + * + * SSE Folding subroutine sets + * + */ +// These functions reduce an array length by a factor of 3, 4, 5, +// or 2 by summing and return the maximum of the summed values. +// Since each adjacent float is added to the next, simd works well. +// To keep multiple FPU or SSE units in any processor busy we try to +// avoid dependancy chains ( x += a, x += b, x += c) where each +// computation must wait til previous sum is computed. +// having two maximums running from two colums of numbers +// avoids a single max register from being the bottleneck + +int sse_mask1[] = {4, 1, 2, 3, 0, 0, 0, 0 }; +int sse_mask2[] = {4, 4, 4, 4, 4, 1, 2, 3 }; + +// ALIGN_SIMD unsigned int sse_partMask[][4] = { +ALIGNED(unsigned int, 16) sse_partMask[][4] = { + { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF }, // 0 + { 0xFFFFFFFF,0x00000000,0x00000000,0x00000000 }, // 1 + { 0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000 }, // 2 + { 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0x00000000 }, // 3 + { 0x00000000,0x00000000,0x00000000,0x00000000 }, // 4 + }; + +#define SSE_MASK(idx) (*(__m128 *)&sse_partMask[idx]) + + +// maxp2f - +// function: Given a 4 packed float input, return the max among them +// concept: Ben Herndon +// +inline float s_maxp2f( __m128 max1 ) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("s_maxp2f()"); +#endif + float tMax; + __m128 maxReg = max1; + + maxReg = _mm_movehl_ps( maxReg, max1 ); + maxReg = _mm_max_ps( maxReg, max1 ); // [0][1] vs [3][4] + max1 = _mm_shuffle_ps( maxReg, maxReg, 1 ); + maxReg = _mm_max_ss( maxReg, max1 ); // [1] vs [0] + + _mm_store_ss( &tMax, maxReg ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return ( tMax ); +} + +#if defined(__clang__) +#define s_getU( aaaa, ptr ) \ + aaaa = _mm_loadl_pi(aaaa, (__m64*)(ptr)); \ + aaaa = _mm_loadh_pi(aaaa, ((__m64 *)(ptr))+1) +#else +#define s_getU( aaaa, ptr ) \ + aaaa = _mm_loadh_pi( _mm_loadl_pi(aaaa, (__m64 *)ptr), ((__m64 *)(ptr))+1 ) +#endif + +#define s_putU( ptr, aaaa ) \ + _mm_storel_pi((__m64 *)ptr, aaaa), _mm_storeh_pi( ((__m64 *)ptr)+1 , aaaa) + + +/****************** + * + * ben SSE folding + * + * Description: Intel & AMD SSE optimized folding + * CPUs: Intel Pentium III and beyond, AMD Athlon model 6 - and beyond + * + * Original code by Ben Herndon, modified by Joe Segur + * + */ + +// +// fold by 2 +// +float sse_sum2(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_sum2()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i, length = P->di; + float *ptr1 = ss[1]+P->offset; + float *ptr2 = ss[1]+P->tmp0; + float *sums = P->dest; + + max1 = max2 = ZERO; + + const int stride = 8; + + for (i = 0; i < length-(stride - 1); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + s_getU(sum1, &ptr1[i + 0] ); + s_getU(sum2, &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + s_putU( &sums[i + 0], sum1 ); + s_putU( &sums[i +4], sum2 ); + } + + int mask1 = sse_mask1[ length-i]; + int mask2 = sse_mask2[ length-i]; + s_getU(sum1, &ptr1[i + 0] ); + s_getU(sum2, &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + sum1 = _mm_and_ps(sum1, SSE_MASK( mask1 ) ); + sum2 = _mm_and_ps(sum2, SSE_MASK( mask2 ) ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + s_putU( &sums[i + 0], sum1 ); + s_putU( &sums[i +4], sum2 ); + + float rv= s_maxp2f( _mm_max_ps( max1, max2 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +// +// fold by 3s +// +float sse_sum3(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_sum3()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i, length = P->di; + float *ptr1 = ss[0]; + float *ptr2 = ss[0]+P->tmp0; + float *ptr3 = ss[0]+P->tmp1; + float *sums = P->dest; + + max1 = max2 = ZERO; + + const int stride = 8; + for (i = 0; i < length-(stride - 1); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + s_getU(sum1, &ptr1[i + 0] ); + s_getU(sum2, &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + s_putU( &sums[i + 0], sum1 ); + s_putU( &sums[i +4], sum2 ); + } + + int mask1 = sse_mask1[ length-i]; + int mask2 = sse_mask2[ length-i]; + s_getU(sum1, &ptr1[i + 0] ); + s_getU(sum2, &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + sum1 = _mm_and_ps(sum1, SSE_MASK( mask1 ) ); + sum2 = _mm_and_ps(sum2, SSE_MASK( mask2 ) ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + s_putU( &sums[i + 0], sum1 ); + s_putU( &sums[i +4], sum2 ); + + float rv= s_maxp2f( _mm_max_ps( max1, max2 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +// +// fold by 4 +// +float sse_sum4(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_sum4()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i, length = P->di; + float *ptr1 = ss[0]; + float *ptr2 = ss[0]+P->tmp0; + float *ptr3 = ss[0]+P->tmp1; + float *ptr4 = ss[0]+P->tmp2; + float *sums = P->dest; + + max1 = max2 = ZERO; + + const int stride = 8; + for (i = 0; i < length-(stride - 1); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + s_getU(sum1, &ptr1[i + 0] ); + s_getU(sum2, &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 0] ); + s_getU(tmp2, &ptr4[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + s_putU( &sums[i + 0], sum1 ); + s_putU( &sums[i +4], sum2 ); + } + + int mask1 = sse_mask1[ length-i]; + int mask2 = sse_mask2[ length-i]; + s_getU(sum1, &ptr1[i + 0] ); + s_getU(sum2, &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 0] ); + s_getU(tmp2, &ptr4[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + sum1 = _mm_and_ps(sum1, SSE_MASK( mask1 ) ); + sum2 = _mm_and_ps(sum2, SSE_MASK( mask2 ) ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + s_putU( &sums[i + 0], sum1 ); + s_putU( &sums[i +4], sum2 ); + + float rv= s_maxp2f( _mm_max_ps( max1, max2 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +// +// fold by 5 +// +float sse_sum5(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_sum5()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i, length = P->di; + float *ptr1 = ss[0]; + float *ptr2 = ss[0]+P->tmp0; + float *ptr3 = ss[0]+P->tmp1; + float *ptr4 = ss[0]+P->tmp2; + float *ptr5 = ss[0]+P->tmp3; + float *sums = P->dest; + + max1 = max2 = ZERO; + + const int stride = 8; + for (i = 0; i < length-(stride - 1); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + s_getU(sum1, &ptr1[i + 0] ); + s_getU(sum2, &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 0] ); + s_getU(tmp2, &ptr4[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr5[i + 0] ); + s_getU(tmp2, &ptr5[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + s_putU( &sums[i + 0], sum1 ); + s_putU( &sums[i +4], sum2 ); + } + + int mask1 = sse_mask1[ length-i]; + int mask2 = sse_mask2[ length-i]; + s_getU(sum1, &ptr1[i + 0] ); + s_getU(sum2, &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 0] ); + s_getU(tmp2, &ptr4[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr5[i + 0] ); + s_getU(tmp2, &ptr5[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + sum1 = _mm_and_ps(sum1, SSE_MASK( mask1 ) ); + sum2 = _mm_and_ps(sum2, SSE_MASK( mask2 ) ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + s_putU( &sums[i + 0], sum1 ); + s_putU( &sums[i +4], sum2 ); + + float rv= s_maxp2f( _mm_max_ps( max1, max2 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +sum_func sse_list3[FOLDTBLEN] = { + sse_sum3, sse_sum3, sse_sum3, sse_sum3, + sse_sum3, sse_sum3, sse_sum3, sse_sum3, + sse_sum3, sse_sum3, sse_sum3, sse_sum3, + sse_sum3, sse_sum3, sse_sum3, sse_sum3, + sse_sum3, sse_sum3, sse_sum3, sse_sum3, + sse_sum3, sse_sum3, sse_sum3, sse_sum3, + sse_sum3, sse_sum3, sse_sum3, sse_sum3, + sse_sum3, sse_sum3, sse_sum3, sse_sum3 + }; +sum_func sse_list4[FOLDTBLEN] = { + sse_sum4, sse_sum4, sse_sum4, sse_sum4, + sse_sum4, sse_sum4, sse_sum4, sse_sum4, + sse_sum4, sse_sum4, sse_sum4, sse_sum4, + sse_sum4, sse_sum4, sse_sum4, sse_sum4, + sse_sum4, sse_sum4, sse_sum4, sse_sum4, + sse_sum4, sse_sum4, sse_sum4, sse_sum4, + sse_sum4, sse_sum4, sse_sum4, sse_sum4, + sse_sum4, sse_sum4, sse_sum4, sse_sum4 + }; +sum_func sse_list5[FOLDTBLEN] = { + sse_sum5, sse_sum5, sse_sum5, sse_sum5, + sse_sum5, sse_sum5, sse_sum5, sse_sum5, + sse_sum5, sse_sum5, sse_sum5, sse_sum5, + sse_sum5, sse_sum5, sse_sum5, sse_sum5, + sse_sum5, sse_sum5, sse_sum5, sse_sum5, + sse_sum5, sse_sum5, sse_sum5, sse_sum5, + sse_sum5, sse_sum5, sse_sum5, sse_sum5, + sse_sum5, sse_sum5, sse_sum5, sse_sum5 + }; +sum_func sse_list2[FOLDTBLEN] = { + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2 + }; +sum_func sse_list2_L[FOLDTBLEN] = { + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2, + sse_sum2, sse_sum2, sse_sum2, sse_sum2 + }; + +FoldSet sse_ben_fold = {sse_list3, sse_list4, sse_list5, sse_list2, sse_list2_L, "ben SSE"}; + + + +/****************** + * + * BH SSE folding + * + * Description: Intel & AMD SSE optimized folding + * CPUs: Intel Pentium III and beyond, AMD Athlon model 6 - and beyond + * + * Original code by Ben Herndon, modified by Joe Segur + * + */ + +int sse_msks1[] = {4, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +int sse_msks2[] = {4, 4, 4, 4, 4, 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +//ALIGN_SIMD float sse_foldLim[][4] = { +ALIGNED(float, 16) sse_foldLim[][4] = { + { 0.0f, 0.0f, 0.0f, 0.0f }, // 0 + { 0.0f, 1e37f, 1e37f, 1e37f }, // 1 + { 0.0f, 0.0f, 1e37f, 1e37f }, // 2 + { 0.0f, 0.0f, 0.0f, 1e37f }, // 3 + { 1e37f, 1e37f, 1e37f, 1e37f }, // 4 + }; + +#define SSE_LIM(idx) (*(__m128 *)&sse_foldLim[idx]) + + +// +// Fold by 3 versions +// +float sse_pulPoTf3u(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf2u()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + + const int stride = 24; + for (i = 0; i < P->di - ( stride - 1 ); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i + 4], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 8] ); + sum2 = _mm_load_ps( &ptr1[i + 12] ); + s_getU(tmp1, &ptr2[i + 8] ); + s_getU(tmp2, &ptr2[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 8] ); + s_getU(tmp2, &ptr3[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 8], sum1 ); + _mm_store_ps( &P->dest[i + 12], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 16] ); + sum2 = _mm_load_ps( &ptr1[i + 20] ); + s_getU(tmp1, &ptr2[i + 16] ); + s_getU(tmp2, &ptr2[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 16] ); + s_getU(tmp2, &ptr3[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 16], sum1 ); + _mm_store_ps( &P->dest[i + 20], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + s_getU(tmp1, &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr3[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf3(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf3()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + + const int stride = 8; + for (i = 0; i < P->di - (stride - 1); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i + 4], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + s_getU(tmp1, &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr3[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf3L8(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf3L8()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + + // SSE Pipeline #1 SSE Pipeline #2 + // + int mask1 = sse_msks1[ P->di ]; + int mask2 = sse_msks2[ P->di ]; + sum1 = _mm_load_ps( &ptr1[0] ); + sum2 = _mm_load_ps( &ptr1[4] ); + s_getU(tmp1, &ptr2[0] ); + s_getU(tmp2, &ptr2[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[0] ); + s_getU(tmp2, &ptr3[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + _mm_store_ps( &P->dest[0], sum1 ); + _mm_store_ps( &P->dest[4], sum2 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + sum2 = _mm_sub_ps(sum2, SSE_LIM( mask2 ) ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + + float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +sum_func BHSSETB3[FOLDTBLEN] = + { + sse_pulPoTf3L8, sse_pulPoTf3L8, sse_pulPoTf3L8, sse_pulPoTf3L8, + sse_pulPoTf3L8, sse_pulPoTf3L8, sse_pulPoTf3L8, sse_pulPoTf3L8, + sse_pulPoTf3L8, sse_pulPoTf3, sse_pulPoTf3, sse_pulPoTf3, + sse_pulPoTf3, sse_pulPoTf3, sse_pulPoTf3, sse_pulPoTf3, + sse_pulPoTf3, sse_pulPoTf3, sse_pulPoTf3, sse_pulPoTf3, + sse_pulPoTf3, sse_pulPoTf3, sse_pulPoTf3, sse_pulPoTf3, + sse_pulPoTf3u + }; + +// +// Fold by 4 versions +// +float sse_pulPoTf4u(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf4u()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + float *ptr4 = ss[0] + P->tmp2; + + const int stride = 24; + for (i = 0; i < P->di - ( stride - 1 ); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 0] ); + s_getU(tmp2, &ptr4[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i + 4], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 8] ); + sum2 = _mm_load_ps( &ptr1[i + 12] ); + s_getU(tmp1, &ptr2[i + 8] ); + s_getU(tmp2, &ptr2[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 8] ); + s_getU(tmp2, &ptr3[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 8] ); + s_getU(tmp2, &ptr4[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 8], sum1 ); + _mm_store_ps( &P->dest[i + 12], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 16] ); + sum2 = _mm_load_ps( &ptr1[i + 20] ); + s_getU(tmp1, &ptr2[i + 16] ); + s_getU(tmp2, &ptr2[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 16] ); + s_getU(tmp2, &ptr3[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 16] ); + s_getU(tmp2, &ptr4[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 16], sum1 ); + _mm_store_ps( &P->dest[i + 20], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + s_getU(tmp1, &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr3[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr4[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf4(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf4()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + float *ptr4 = ss[0] + P->tmp2; + + const int stride = 8; + for (i = 0; i < P->di - ( stride - 1 ); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 0] ); + s_getU(tmp2, &ptr4[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i + 4], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + s_getU(tmp1, &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr3[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr4[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv=( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + + +float sse_pulPoTf4L8(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf4L8()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + float *ptr4 = ss[0] + P->tmp2; + + // SSE Pipeline #1 SSE Pipeline #2 + // + int mask1 = sse_msks1[ P->di ]; + int mask2 = sse_msks2[ P->di ]; + sum1 = _mm_load_ps( &ptr1[0] ); + sum2 = _mm_load_ps( &ptr1[4] ); + s_getU(tmp1, &ptr2[0] ); + s_getU(tmp2, &ptr2[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[0] ); + s_getU(tmp2, &ptr3[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[0] ); + s_getU(tmp2, &ptr4[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + _mm_store_ps( &P->dest[0], sum1 ); + _mm_store_ps( &P->dest[4], sum2 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + sum2 = _mm_sub_ps(sum2, SSE_LIM( mask2 ) ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + + float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +sum_func BHSSETB4[FOLDTBLEN] = { + sse_pulPoTf4L8, sse_pulPoTf4L8, sse_pulPoTf4L8, sse_pulPoTf4L8, + sse_pulPoTf4L8, sse_pulPoTf4L8, sse_pulPoTf4L8, sse_pulPoTf4L8, + sse_pulPoTf4L8, sse_pulPoTf4, sse_pulPoTf4, sse_pulPoTf4, + sse_pulPoTf4, sse_pulPoTf4, sse_pulPoTf4, sse_pulPoTf4, + sse_pulPoTf4, sse_pulPoTf4, sse_pulPoTf4, sse_pulPoTf4, + sse_pulPoTf4, sse_pulPoTf4, sse_pulPoTf4, sse_pulPoTf4, + sse_pulPoTf4u + }; + +// +// Fold by 5 versions +// +float sse_pulPoTf5u(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf5u()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + float *ptr4 = ss[0] + P->tmp2; + float *ptr5 = ss[0] + P->tmp3; + + const int stride = 24; + for (i = 0; i < P->di - ( stride - 1 ); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 0] ); + s_getU(tmp2, &ptr4[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr5[i + 0] ); + s_getU(tmp2, &ptr5[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i + 4], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 8] ); + sum2 = _mm_load_ps( &ptr1[i + 12] ); + s_getU(tmp1, &ptr2[i + 8] ); + s_getU(tmp2, &ptr2[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 8] ); + s_getU(tmp2, &ptr3[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 8] ); + s_getU(tmp2, &ptr4[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr5[i + 8] ); + s_getU(tmp2, &ptr5[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 8], sum1 ); + _mm_store_ps( &P->dest[i + 12], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 16] ); + sum2 = _mm_load_ps( &ptr1[i + 20] ); + s_getU(tmp1, &ptr2[i + 16] ); + s_getU(tmp2, &ptr2[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 16] ); + s_getU(tmp2, &ptr3[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 16] ); + s_getU(tmp2, &ptr4[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr5[i + 16] ); + s_getU(tmp2, &ptr5[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 16], sum1 ); + _mm_store_ps( &P->dest[i + 20], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + s_getU(tmp1, &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr3[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr4[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr5[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv=( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf5(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf5()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + float *ptr4 = ss[0] + P->tmp2; + float *ptr5 = ss[0] + P->tmp3; + + const int stride = 8; + for (i = 0; i < P->di - ( stride - 1 ); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[i + 0] ); + s_getU(tmp2, &ptr3[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[i + 0] ); + s_getU(tmp2, &ptr4[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr5[i + 0] ); + s_getU(tmp2, &ptr5[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i + 4], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + s_getU(tmp1, &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr3[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr4[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr5[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv=( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf5L8(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf5L8()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + float *ptr4 = ss[0] + P->tmp2; + float *ptr5 = ss[0] + P->tmp3; + + // SSE Pipeline #1 SSE Pipeline #2 + // + int mask1 = sse_msks1[ P->di ]; + int mask2 = sse_msks2[ P->di ]; + sum1 = _mm_load_ps( &ptr1[0] ); + sum2 = _mm_load_ps( &ptr1[4] ); + s_getU(tmp1, &ptr2[0] ); + s_getU(tmp2, &ptr2[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr3[0] ); + s_getU(tmp2, &ptr3[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr4[0] ); + s_getU(tmp2, &ptr4[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + s_getU(tmp1, &ptr5[0] ); + s_getU(tmp2, &ptr5[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + _mm_store_ps( &P->dest[0], sum1 ); + _mm_store_ps( &P->dest[4], sum2 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + sum2 = _mm_sub_ps(sum2, SSE_LIM( mask2 ) ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + + float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf5L4(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf5L4()"); +#endif + __m128 sum1, sum2, max1, max2; + __m128 tmp1, tmp2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[0]; + float *ptr2 = ss[0] + P->tmp0; + float *ptr3 = ss[0] + P->tmp1; + float *ptr4 = ss[0] + P->tmp2; + float *ptr5 = ss[0] + P->tmp3; + + int mask1 = sse_msks1[ P->di ]; + sum1 = _mm_load_ps( &ptr1[0] ); + s_getU(tmp1, &ptr2[0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr3[0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr4[0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + s_getU(tmp1, &ptr5[0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +sum_func BHSSETB5[FOLDTBLEN] = { + sse_pulPoTf5L4, sse_pulPoTf5L4, sse_pulPoTf5L4, sse_pulPoTf5L4, + sse_pulPoTf5L4, sse_pulPoTf5L8, sse_pulPoTf5L8, sse_pulPoTf5L8, + sse_pulPoTf5L8, sse_pulPoTf5, sse_pulPoTf5, sse_pulPoTf5, + sse_pulPoTf5, sse_pulPoTf5, sse_pulPoTf5, sse_pulPoTf5, + sse_pulPoTf5, sse_pulPoTf5, sse_pulPoTf5, sse_pulPoTf5, + sse_pulPoTf5, sse_pulPoTf5, sse_pulPoTf5, sse_pulPoTf5, + sse_pulPoTf5u + }; + +// +// Fold by 2 versions +// +float sse_pulPoTf2u(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf2u()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[1]+P->offset; + float *ptr2 = ss[1]+P->tmp0; + + const int stride = 24; + + for (i = 0; i < P->di - ( stride - 1 ); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i +4], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 8] ); + sum2 = _mm_load_ps( &ptr1[i + 12] ); + s_getU(tmp1, &ptr2[i + 8] ); + s_getU(tmp2, &ptr2[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 8], sum1 ); + _mm_store_ps( &P->dest[i +12], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 16] ); + sum2 = _mm_load_ps( &ptr1[i + 20] ); + s_getU(tmp1, &ptr2[i + 16] ); + s_getU(tmp2, &ptr2[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 16], sum1 ); + _mm_store_ps( &P->dest[i +20], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + s_getU(tmp1, &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf2(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf2()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[1]+P->offset; + float *ptr2 = ss[1]+P->tmp0; + + const int stride = 8; + + for (i = 0; i < P->di - ( stride - 1 ); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + s_getU(tmp1, &ptr2[i + 0] ); + s_getU(tmp2, &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i +4], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + s_getU(tmp1, &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf2L8(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf2L8()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[1]+P->offset; + float *ptr2 = ss[1]+P->tmp0; + + // SSE Pipeline #1 SSE Pipeline #2 + // + int mask1 = sse_msks1[ P->di ]; + int mask2 = sse_msks2[ P->di ]; + sum1 = _mm_load_ps( &ptr1[0] ); + sum2 = _mm_load_ps( &ptr1[4] ); + s_getU(tmp1, &ptr2[0] ); + s_getU(tmp2, &ptr2[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + _mm_store_ps( &P->dest[0], sum1 ); + _mm_store_ps( &P->dest[4], sum2 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + sum2 = _mm_sub_ps(sum2, SSE_LIM( mask2 ) ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + + float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf2L4(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf2L4()"); +#endif + __m128 sum1, tmp1, max1; + int i; + + max1 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[1]+P->offset; + float *ptr2 = ss[1]+P->tmp0; + + // + int mask1 = sse_msks1[ P->di ]; + sum1 = _mm_load_ps( &ptr1[0] ); + s_getU(tmp1, &ptr2[0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +sum_func BHSSETB2[FOLDTBLEN] = { + sse_pulPoTf2L4, sse_pulPoTf2L4, sse_pulPoTf2L4, sse_pulPoTf2L4, + sse_pulPoTf2L4, sse_pulPoTf2L8, sse_pulPoTf2L8, sse_pulPoTf2L8, + sse_pulPoTf2L8, sse_pulPoTf2, sse_pulPoTf2, sse_pulPoTf2, + sse_pulPoTf2, sse_pulPoTf2, sse_pulPoTf2, sse_pulPoTf2, + sse_pulPoTf2, sse_pulPoTf2, sse_pulPoTf2, sse_pulPoTf2, + sse_pulPoTf2, sse_pulPoTf2, sse_pulPoTf2, sse_pulPoTf2, + sse_pulPoTf2u, sse_pulPoTf2u, sse_pulPoTf2u, sse_pulPoTf2u, + sse_pulPoTf2u, sse_pulPoTf2u, sse_pulPoTf2u, sse_pulPoTf2u + }; + + +// versions for tmp0 aligned +// +float sse_pulPoTf2ALu(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf2ALu()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[1]+P->offset; + float *ptr2 = ss[1]+P->tmp0; + + const int stride = 24; + + for (i = 0; i < P->di - ( stride - 1 ); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + tmp1 = _mm_load_ps( &ptr2[i + 0] ); + tmp2 = _mm_load_ps( &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i +4], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 8] ); + sum2 = _mm_load_ps( &ptr1[i + 12] ); + tmp1 = _mm_load_ps( &ptr2[i + 8] ); + tmp2 = _mm_load_ps( &ptr2[i + 12] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 8], sum1 ); + _mm_store_ps( &P->dest[i +12], sum2 ); + + sum1 = _mm_load_ps( &ptr1[i + 16] ); + sum2 = _mm_load_ps( &ptr1[i + 20] ); + tmp1 = _mm_load_ps( &ptr2[i + 16] ); + tmp2 = _mm_load_ps( &ptr2[i + 20] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 16], sum1 ); + _mm_store_ps( &P->dest[i +20], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + tmp1 = _mm_load_ps( &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf2AL(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf2AL()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[1]+P->offset; + float *ptr2 = ss[1]+P->tmp0; + + const int stride = 8; + + for (i = 0; i < P->di - ( stride - 1 ); i += stride ) { + // SSE Pipeline #1 SSE Pipeline #2 + // + sum1 = _mm_load_ps( &ptr1[i + 0] ); + sum2 = _mm_load_ps( &ptr1[i + 4] ); + tmp1 = _mm_load_ps( &ptr2[i + 0] ); + tmp2 = _mm_load_ps( &ptr2[i + 4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + _mm_store_ps( &P->dest[i +4], sum2 ); + } + max1 = _mm_max_ps( max1, max2 ); + for ( ; i < P->di ; i += 4) { + int mask1 = sse_msks1[ P->di-i]; + sum1 = _mm_load_ps( &ptr1[i + 0] ); + tmp1 = _mm_load_ps( &ptr2[i + 0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[i + 0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + } + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + + +float sse_pulPoTf2AL8(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf2AL8()"); +#endif + __m128 sum1, sum2, tmp1, tmp2, max1, max2; + int i; + + max1 = max2 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[1]+P->offset; + float *ptr2 = ss[1]+P->tmp0; + + // SSE Pipeline #1 SSE Pipeline #2 + // + int mask1 = sse_msks1[ P->di ]; + int mask2 = sse_msks2[ P->di ]; + sum1 = _mm_load_ps( &ptr1[0] ); + sum2 = _mm_load_ps( &ptr1[4] ); + tmp1 = _mm_load_ps( &ptr2[0] ); + tmp2 = _mm_load_ps( &ptr2[4] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + sum2 = _mm_add_ps( sum2, tmp2 ); + _mm_store_ps( &P->dest[0], sum1 ); + _mm_store_ps( &P->dest[4], sum2 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + sum2 = _mm_sub_ps(sum2, SSE_LIM( mask2 ) ); + max1 = _mm_max_ps( max1, sum1 ); + max2 = _mm_max_ps( max2, sum2 ); + + float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +float sse_pulPoTf2AL4(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse_pulPoTf2AL4()"); +#endif + __m128 sum1, tmp1, max1; + int i; + + max1 = _mm_set_ps1( 0.0 ); + float *ptr1 = ss[1]+P->offset; + float *ptr2 = ss[1]+P->tmp0; + + // + int mask1 = sse_msks1[ P->di]; + sum1 = _mm_load_ps( &ptr1[0] ); + tmp1 = _mm_load_ps( &ptr2[0] ); + sum1 = _mm_add_ps( sum1, tmp1 ); + _mm_store_ps( &P->dest[0], sum1 ); + sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) ); + max1 = _mm_max_ps( max1, sum1 ); + + float rv= ( s_maxp2f( max1 ) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + +sum_func BHSSETB2AL[FOLDTBLEN] = { + sse_pulPoTf2AL4, sse_pulPoTf2AL4, sse_pulPoTf2AL4, sse_pulPoTf2AL4, + sse_pulPoTf2AL4, sse_pulPoTf2AL8, sse_pulPoTf2AL8, sse_pulPoTf2AL8, + sse_pulPoTf2AL8, sse_pulPoTf2AL, sse_pulPoTf2AL, sse_pulPoTf2AL, + sse_pulPoTf2AL, sse_pulPoTf2AL, sse_pulPoTf2AL, sse_pulPoTf2AL, + sse_pulPoTf2AL, sse_pulPoTf2AL, sse_pulPoTf2AL, sse_pulPoTf2AL, + sse_pulPoTf2AL, sse_pulPoTf2AL, sse_pulPoTf2AL, sse_pulPoTf2AL, + sse_pulPoTf2ALu + }; + + +FoldSet BHSSEfold = {BHSSETB3, BHSSETB4, BHSSETB5, BHSSETB2, BHSSETB2AL, "BH SSE"}; + +/************************************* + * + * SSE folding subroutines from SSE2 by Alex Kan + * + * Modified by Joe Segur + * + */ + +typedef union submask { + float f[4]; + __m128 v; +}; + +submask tailmask[4] = { + { 0.0f, 0.0f, 0.0f, 0.0f}, + { 0.0f, 1e37f, 1e37f, 1e37f}, + { 0.0f, 0.0f, 1e37f, 1e37f}, + { 0.0f, 0.0f, 0.0f, 1e37f} + }; + + +float foldArrayBy3(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy3()"); +#endif + float max; + __m128 maxV = ZERO; + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1; + float *pst = P->dest; + __m128 x1, x2, x3, xs12, xs; + + while (i < P->di-4) { + x1 = _mm_load_ps(p1+i); + x2 = _mm_loadu_ps(p2+i); + x3 = _mm_loadu_ps(p3+i); + xs12 = _mm_add_ps(x1, x2); + xs = _mm_add_ps(xs12, x3); + _mm_store_ps(pst+i, xs); + maxV = _mm_max_ps(maxV, xs); + i += 4; + } + x1 = _mm_load_ps(p1+i); + x2 = _mm_loadu_ps(p2+i); + x3 = _mm_loadu_ps(p3+i); + xs12 = _mm_add_ps(x1, x2); + xs = _mm_add_ps(xs12, x3); + + _mm_store_ps(pst+i, xs); + xs = _mm_sub_ps(xs, tailmask[P->di & 0x3].v); + maxV = _mm_max_ps(maxV, xs); + + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x4e)); + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39)); + _mm_store_ss(&max, maxV); + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + + +float foldArrayBy3LO(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy3LO()"); +#endif + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1; + float *pst = P->dest; + float max = 0.0f; + int i = 0; + + while (i < P->di) { + pst[i] = p1[i] + p2[i] + p3[i]; + if (pst[i] > max) max = pst[i]; + i += 1; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} +sum_func AKSSETB3[FOLDTBLEN] = { + foldArrayBy3LO, foldArrayBy3LO, foldArrayBy3LO, foldArrayBy3LO, + foldArrayBy3LO, foldArrayBy3LO, foldArrayBy3LO, foldArrayBy3LO, + foldArrayBy3, foldArrayBy3LO, foldArrayBy3LO, foldArrayBy3LO, + foldArrayBy3 + }; + +float foldArrayBy4(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy4()"); +#endif + float max; + __m128 maxV = ZERO; + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2; + float *pst = P->dest; + __m128 x1, x2, x3, x4, xs12, xs34, xs; + + while (i < P->di-4) { + x1 = _mm_load_ps(p1+i); + x2 = _mm_loadu_ps(p2+i); + x3 = _mm_loadu_ps(p3+i); + x4 = _mm_loadu_ps(p4+i); + xs12 = _mm_add_ps(x1, x2); + xs34 = _mm_add_ps(x3, x4); + xs = _mm_add_ps(xs12, xs34); + _mm_store_ps(pst+i, xs); + maxV = _mm_max_ps(maxV, xs); + i += 4; + } + x1 = _mm_load_ps(p1+i); + x2 = _mm_loadu_ps(p2+i); + x3 = _mm_loadu_ps(p3+i); + x4 = _mm_loadu_ps(p4+i); + xs12 = _mm_add_ps(x1, x2); + xs34 = _mm_add_ps(x3, x4); + xs = _mm_add_ps(xs12, xs34); + + _mm_store_ps(pst+i, xs); + xs = _mm_sub_ps(xs, tailmask[P->di & 0x3].v); + maxV = _mm_max_ps(maxV, xs); + + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x4e)); + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39)); + _mm_store_ss(&max, maxV); + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +float foldArrayBy4LO(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy4LO()"); +#endif + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2; + float *pst = P->dest; + float max = 0.0f; + int i = 0; + + while (i < P->di) { + pst[i] = p1[i] + p2[i] + p3[i] + p4[i]; + if (pst[i] > max) max = pst[i]; + i += 1; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} +sum_func AKSSETB4[FOLDTBLEN] = { + foldArrayBy4LO, foldArrayBy4LO, foldArrayBy4LO, foldArrayBy4LO, + foldArrayBy4LO, foldArrayBy4LO, foldArrayBy4LO, foldArrayBy4LO, + foldArrayBy4, foldArrayBy4LO, foldArrayBy4LO, foldArrayBy4LO, + foldArrayBy4 + }; + +float foldArrayBy5(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy5()"); +#endif + float max; + __m128 maxV = ZERO; + int i = 0; + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2, *p5 = ss[0]+P->tmp3; + float *pst = P->dest; + __m128 x1, x2, x3, x4, x5, xs12, xs34, xs125, xs; + + while (i < P->di-4) { + x1 = _mm_load_ps(p1+i); + x2 = _mm_loadu_ps(p2+i); + x3 = _mm_loadu_ps(p3+i); + x4 = _mm_loadu_ps(p4+i); + x5 = _mm_loadu_ps(p5+i); + xs12 = _mm_add_ps(x1, x2); + xs34 = _mm_add_ps(x3, x4); + xs125 = _mm_add_ps(xs12, x5); + xs = _mm_add_ps(xs34, xs125); + _mm_store_ps(pst+i, xs); + maxV = _mm_max_ps(maxV, xs); + i += 4; + } + x1 = _mm_load_ps(p1+i); + x2 = _mm_loadu_ps(p2+i); + x3 = _mm_loadu_ps(p3+i); + x4 = _mm_loadu_ps(p4+i); + x5 = _mm_loadu_ps(p5+i); + xs12 = _mm_add_ps(x1, x2); + xs34 = _mm_add_ps(x3, x4); + xs125 = _mm_add_ps(xs12, x5); + xs = _mm_add_ps(xs34, xs125); + + _mm_store_ps(pst+i, xs); + xs = _mm_sub_ps(xs, tailmask[P->di & 0x3].v); + maxV = _mm_max_ps(maxV, xs); + + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x4e)); + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39)); + _mm_store_ss(&max, maxV); + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +float foldArrayBy5LO(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy5LO()"); +#endif + + const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2, *p5 = ss[0]+P->tmp3; + float *pst = P->dest; + float max = 0.0f; + int i = 0; + + while (i < P->di) { + pst[i] = p1[i] + p2[i] + p3[i] + p4[i] + p5[i]; + if (pst[i] > max) max = pst[i]; + i += 1; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +sum_func AKSSETB5[FOLDTBLEN] = { + foldArrayBy5LO, foldArrayBy5LO, foldArrayBy5LO, foldArrayBy5LO, + foldArrayBy5LO, foldArrayBy5LO, foldArrayBy5LO, foldArrayBy5LO, + foldArrayBy5, foldArrayBy5LO, foldArrayBy5LO, foldArrayBy5LO, + foldArrayBy5 + }; + +// 2A version allows non-aligned tmp0 + +float foldArrayBy2A(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("FoldArrayBy2A()"); +#endif + float max; + __m128 maxV = ZERO; + int i = 0; + + const float *p1 = ss[1]+P->offset, *p2 = ss[1]+P->tmp0; + float *pst = P->dest; + __m128 x1, x2, xs; + + while (i < P->di-4) { + x1 = _mm_load_ps(p1+i); + x2 = _mm_loadu_ps(p2+i); + xs = _mm_add_ps(x1, x2); + _mm_store_ps(pst+i, xs); + maxV = _mm_max_ps(maxV, xs); + i += 4; + } + x1 = _mm_load_ps(p1+i); + x2 = _mm_loadu_ps(p2+i); + xs = _mm_add_ps(x1, x2); + + _mm_store_ps(pst+i, xs); + xs = _mm_sub_ps(xs, tailmask[P->di & 0x3].v); + maxV = _mm_max_ps(maxV, xs); + + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x4e)); + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39)); + _mm_store_ss(&max, maxV); + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +// 2AL version requires aligned tmp0 + + +float foldArrayBy2AL(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy2AL()"); +#endif + float max; + __m128 maxV = ZERO; + int i = 0; + + const float *p1 = ss[1]+P->offset, *p2 = ss[1]+P->tmp0; + float *pst = P->dest; + __m128 x1, x2, xs; + + while (i < P->di-4) { + x1 = _mm_load_ps(p1+i); + x2 = _mm_load_ps(p2+i); + xs = _mm_add_ps(x1, x2); + _mm_store_ps(pst+i, xs); + maxV = _mm_max_ps(maxV, xs); + i += 4; + } + x1 = _mm_load_ps(p1+i); + x2 = _mm_load_ps(p2+i); + xs = _mm_add_ps(x1, x2); + + _mm_store_ps(pst+i, xs); + xs = _mm_sub_ps(xs, tailmask[P->di & 0x3].v); + maxV = _mm_max_ps(maxV, xs); + + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x4e)); + maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39)); + _mm_store_ss(&max, maxV); + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} + +float foldArrayBy2LO(float *ss[], struct PoTPlan *P) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("foldArrayBy2LO()"); +#endif + + const float *p1 = ss[1]+P->offset, *p2 = ss[1]+P->tmp0; + float *pst = P->dest; + float max = 0.0f; + int i = 0; + + while (i < P->di) { + pst[i] = p1[i] + p2[i]; + if (pst[i] > max) max = pst[i]; + i += 1; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return max; +} +sum_func AKSSETB2[FOLDTBLEN] = { + foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, + foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, + foldArrayBy2A, foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, + foldArrayBy2A + }; + +sum_func AKSSETB2AL[FOLDTBLEN] = { + foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, + foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, + foldArrayBy2AL, foldArrayBy2LO, foldArrayBy2LO, foldArrayBy2LO, + foldArrayBy2AL + }; + +FoldSet AKSSEfold = {AKSSETB3, AKSSETB4, AKSSETB5, AKSSETB2, AKSSETB2AL, "AK SSE"}; + + +#endif // USE_INTRINSICS + +#endif // (__i386__) || (__x86_64__) + + diff --git a/client/vector/analyzeFuncs_sse2.cpp b/client/vector/analyzeFuncs_sse2.cpp new file mode 100644 index 0000000..04d6f32 --- /dev/null +++ b/client/vector/analyzeFuncs_sse2.cpp @@ -0,0 +1,353 @@ +/****************** + * + * analyzeFuncs_SSE2.cpp + * + * Description: Intel & AMD SSE2 optimzized functions + * CPUs: Intel Pentium IV, AMD Athlon Model 6+, AMD Athlon 64 + */ + +// Copyright 2007 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "sah_config.h" + +// The following is empty if USE_INTRINSICS is not defined +#ifdef USE_INTRINSICS +#include +#include +#include + +#include "s_util.h" +#include "x86_float4.h" +#include "analyzeFuncs_vector.h" +#include "analyzeFuncs.h" + + +__inline __m128 vec_recip2(__m128 v) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("vec_recip2()"); +#endif + // obtain estimate + __m128 estimate = _mm_rcp_ps( v ); + // one round of Newton-Raphson + __m128 rv=_mm_add_ps(_mm_mul_ps(_mm_sub_ps(ONE, _mm_mul_ps(estimate, v)), estimate), estimate); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; +} + + +// ============================================================================= +// +// sse2_vChirpData +// version by: Alex Kan - SSE2 mods (haddsum removal) BH +// http://tbp.berkeley.edu/~alexkan/seti/ +// +int sse2_ChirpData_ak( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + double chirp_rate, + int ul_NumDataPoints, + double sample_rate +) { + int i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse2_ChirpData_ak()"); +#endif + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + int vEnd; + double srate = chirp_rate * 0.5 / (sample_rate * sample_rate); + __m128d rate = _mm_set1_pd(chirp_rate * 0.5 / (sample_rate * sample_rate)); + __m128d roundVal = _mm_set1_pd(srate >= 0.0 ? TWO_TO_52 : -TWO_TO_52); + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 3); + for (i = 0; i < vEnd; i += 4) { + const float *data = (const float *) (cx_DataArray + i); + float *chirped = (float *) (cx_ChirpDataArray + i); + __m128d di = _mm_set1_pd(i); + __m128d a1 = _mm_add_pd(_mm_set_pd(1.0, 0.0), di); + __m128d a2 = _mm_add_pd(_mm_set_pd(3.0, 2.0), di); + __m128d x1, y1; + + __m128 d1, d2; + __m128 cd1, cd2; + __m128 td1, td2; + __m128 x; + __m128 y; + __m128 s; + __m128 c; + __m128 m; + + // load the signal to be chirped + prefetchnta((const void *)( data+32 )); + d1 = _mm_load_ps(data); + d2 = _mm_load_ps(data+4); + + // calculate the input angle + a1 = _mm_mul_pd(a1, a1); + a2 = _mm_mul_pd(a2, a2); + a1 = _mm_mul_pd(a1, rate); + a2 = _mm_mul_pd(a2, rate); + + // reduce the angle to the range (-0.5, 0.5) + x1 = _mm_add_pd(a1, roundVal); + y1 = _mm_add_pd(a2, roundVal); + x1 = _mm_sub_pd(x1, roundVal); + y1 = _mm_sub_pd(y1, roundVal); + a1 = _mm_sub_pd(a1, x1); + a2 = _mm_sub_pd(a2, y1); + + // convert pair of packed double into packed single + x = _mm_movelh_ps(_mm_cvtpd_ps(a1), _mm_cvtpd_ps(a2)); + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations + s = _mm_mul_ps(y, SS4); + c = _mm_mul_ps(y, CC3); + s = _mm_add_ps(s, SS3); + c = _mm_add_ps(c, CC2); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS2); + c = _mm_add_ps(c, CC1); + s = _mm_mul_ps(s, y); + c = _mm_mul_ps(c, y); + s = _mm_add_ps(s, SS1); + s = _mm_mul_ps(s, x); + c = _mm_add_ps(c, ONE); + + // perform first angle doubling + x = _mm_sub_ps(_mm_mul_ps(c, c), _mm_mul_ps(s, s)); + y = _mm_mul_ps(_mm_mul_ps(s, c), TWO); + + // calculate scaling factor to correct the magnitude + // m1 = vec_nmsub(y1, y1, vec_nmsub(x1, x1, TWO)); + // m2 = vec_nmsub(y2, y2, vec_nmsub(x2, x2, TWO)); + m = vec_recip2(_mm_add_ps(_mm_mul_ps(x, x), _mm_mul_ps(y, y))); + + // perform second angle doubling + c = _mm_sub_ps(_mm_mul_ps(x, x), _mm_mul_ps(y, y)); + s = _mm_mul_ps(_mm_mul_ps(y, x), TWO); + + // correct the magnitude (final sine / cosine approximations) + c = _mm_mul_ps(c, m); + s = _mm_mul_ps(s, m); + +/* c1 c2 c3 c4 + s1 s2 s3 s4 + + R1 i1 R2 I2 R3 i3 R4 i4 + + R1 * c1 + (i1 * s1 * -1) + i1 * c1 + R1 * s1 + R2 * c2 + (i2 * s2 * -1) + i2 * c2 + R2 * s2 +*/ + + x = d1; + y = d2; + x = _mm_shuffle_ps(x, x, 0xB1); + y = _mm_shuffle_ps(y, y, 0xB1); + x = _mm_mul_ps(x, R_NEG); + y = _mm_mul_ps(y, R_NEG); + cd1 = _mm_shuffle_ps(c, c, 0x50); // 01 01 00 00 AaBb => BBbb => c3c3c4c4 + cd2 = _mm_shuffle_ps(c, c, 0xfa); // 11 11 10 10 AaBb => AAaa => c1c1c2c2 + td1 = _mm_shuffle_ps(s, s, 0x50); + td2 = _mm_shuffle_ps(s, s, 0xfa); + + cd1 = _mm_mul_ps(cd1, d1); + cd2 = _mm_mul_ps(cd2, d2); + td1 = _mm_mul_ps(td1, x); + td2 = _mm_mul_ps(td2, y); + + cd1 = _mm_add_ps(cd1, td1); + cd2 = _mm_add_ps(cd2, td2); + + // store chirped values + _mm_stream_ps(chirped+0, cd1); + _mm_stream_ps(chirped+4, cd2); + } + _mm_sfence(); + + if( i < ul_NumDataPoints) { + // use original routine to finish up any tailings (max stride-1 elements) + v_ChirpData(cx_DataArray+i, cx_ChirpDataArray+i + , chirp_rate_ind, chirp_rate, ul_NumDataPoints-i, sample_rate); + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// ============================================================================= +// +// JWS: alternate SSE2 chirp +// +// Using Mendenhall Faster SinCos, coding based on +// version 8 v_vChirpData for SSE3 by Alex Kan +// +int sse2_ChirpData_ak8( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + const double chirp_rate, + int ul_NumDataPoints, + const double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse2_ChirpData_ak8()"); +#endif + int i, vEnd; + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + const double srate = chirp_rate * 0.5 / (sample_rate * sample_rate); + + __m128d dfourv = _mm_set1_pd(4.0); + + __m128d rate = _mm_set1_pd(srate); + __m128d roundVal = _mm_set1_pd((srate >= 0.0) ? TWO_TO_52 : -TWO_TO_52); + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 3); + __m128d di1 = _mm_set_pd(1.0, 0.0); + __m128d di2 = _mm_set_pd(3.0, 2.0); + + for (i = 0; i < vEnd; i += 4) { + const float *data = (const float *) (cx_DataArray + i); + float *chirped = (float *) (cx_ChirpDataArray + i); + + __m128d a1, a2; + __m128 d1, d2; + __m128 x; + __m128 y; + __m128 z; + __m128 s; + __m128 c; + __m128 m; + + // load the signal to be chirped + prefetchnta((const void *)( data+32 )); + d1 = _mm_load_ps(data); + d2 = _mm_load_ps(data+4); + + // calculate the input angles + a1 = _mm_mul_pd(_mm_mul_pd(di1, di1), rate); + a2 = _mm_mul_pd(_mm_mul_pd(di2, di2), rate); + + // update time values for next iteration + di1 = _mm_add_pd(di1, dfourv); + di2 = _mm_add_pd(di2, dfourv); + + // reduce the angles to the range (-0.5, 0.5) + a1 = _mm_sub_pd(a1, _mm_sub_pd(_mm_add_pd(a1, roundVal), roundVal)); + a2 = _mm_sub_pd(a2, _mm_sub_pd(_mm_add_pd(a2, roundVal), roundVal)); + + // convert the 2 packed doubles to packed single + x = _mm_movelh_ps(_mm_cvtpd_ps(a1), _mm_cvtpd_ps(a2)); + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations + z = _mm_mul_ps(y, y); + s = _mm_mul_ps(_mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(y, SS4F), + SS3F), + z), + _mm_add_ps(_mm_mul_ps(y, SS2F), + SS1F)), + x); + c = _mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(y, CC3F), + CC2F), + z), + _mm_add_ps(_mm_mul_ps(y, CC1F), + ONE)); + + // perform first angle doubling + x = _mm_sub_ps(_mm_mul_ps(c, c), _mm_mul_ps(s, s)); + y = _mm_mul_ps(_mm_mul_ps(s, c), TWO); + + // calculate scaling factor to correct the magnitude + m = _mm_sub_ps(_mm_sub_ps(TWO, _mm_mul_ps(x, x)), _mm_mul_ps(y, y)); + + // perform second angle doubling + c = _mm_sub_ps(_mm_mul_ps(x, x), _mm_mul_ps(y, y)); + s = _mm_mul_ps(_mm_mul_ps(y, x), TWO); + + // correct the magnitude (final sine / cosine approximations) + s = _mm_mul_ps(s, m); + c = _mm_mul_ps(c, m); + + // chirp the data + x = _mm_mul_ps(_mm_shuffle_ps(d1, d1, 0xb1), R_NEG); + y = _mm_mul_ps(_mm_shuffle_ps(d2, d2, 0xb1), R_NEG); + + d1 = _mm_mul_ps(d1, _mm_shuffle_ps(c, c, 0x50)); + d2 = _mm_mul_ps(d2, _mm_shuffle_ps(c, c, 0xfa)); + x = _mm_mul_ps(x, _mm_shuffle_ps(s, s, 0x50)); + y = _mm_mul_ps(y, _mm_shuffle_ps(s, s, 0xfa)); + + // store chirped values + _mm_stream_ps(chirped+0, _mm_add_ps(d1, x)); + _mm_stream_ps(chirped+4, _mm_add_ps(d2, y)); + } + _mm_sfence(); + + // handle tail elements with scalar code + for ( ; i < ul_NumDataPoints; ++i) { + double angle = srate * i * i * 0.5; + angle -= floor(angle); + angle *= M_PI * 2; + double s = sin(angle); + double c = cos(angle); + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + +#endif // USE_INTRINSICS diff --git a/client/vector/analyzeFuncs_sse3.cpp b/client/vector/analyzeFuncs_sse3.cpp new file mode 100644 index 0000000..0ef13e5 --- /dev/null +++ b/client/vector/analyzeFuncs_sse3.cpp @@ -0,0 +1,354 @@ +/****************** + * + * analyzeFuncs_SSE3.cpp + * + * Description: Intel SSE3 (Prescott New Instruction) optimzized functions + * CPUs: Intel Pentium IV Model 3+ + * + */ + +// Copyright 2007 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "sah_config.h" + +// The following is empty if USE_INTRINSICS is not defined +#ifdef USE_INTRINSICS + +#include +#include + +#ifdef HAVE_INTRIN_H +#include +#endif +#ifdef HAVE_PMMINTRIN_H +#include +#endif +#include +#include + +#include "s_util.h" +#include "x86_float4.h" +#include "analyzeFuncs_vector.h" +#include "analyzeFuncs.h" + + +__inline __m128 vec_recip3(__m128 v) + { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("vec_recip3()"); +#endif + // obtain estimate + __m128 estimate = _mm_rcp_ps( v ); + // one round of Newton-Raphson + __m128 rv=_mm_add_ps(_mm_mul_ps(_mm_sub_ps(ONE, _mm_mul_ps(estimate, v)), estimate), estimate); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return rv; + } + +// ============================================================================= +// +// sse3_vChirpData +// version by: Alex Kan +// http://tbp.berkeley.edu/~alexkan/seti/ +// +int sse3_ChirpData_ak( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + double chirp_rate, + int ul_NumDataPoints, + double sample_rate +) { + int i; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse3_ChirpData_ak()"); +#endif + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + int vEnd; + double srate = chirp_rate * 0.5 / (sample_rate * sample_rate); + __m128d rate = _mm_set1_pd(chirp_rate * 0.5 / (sample_rate * sample_rate)); + __m128d roundVal = _mm_set1_pd(srate >= 0.0 ? TWO_TO_52 : -TWO_TO_52); + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 3); + for (i = 0; i < vEnd; i += 4) { + const float *data = (const float *) (cx_DataArray + i); + float *chirped = (float *) (cx_ChirpDataArray + i); + __m128d di = _mm_set1_pd(i); + __m128d a1 = _mm_add_pd(_mm_set_pd(1.0, 0.0), di); + __m128d a2 = _mm_add_pd(_mm_set_pd(3.0, 2.0), di); + + __m128 d1, d2; + __m128 cd1, cd2; + __m128 td1, td2; + __m128 x; + __m128 y; + __m128 s; + __m128 c; + __m128 m; + + // load the signal to be chirped + prefetchnta((const void *)( data+32 )); + d1 = _mm_load_ps(data); + d2 = _mm_load_ps(data+4); + + // calculate the input angle + a1 = _mm_mul_pd(_mm_mul_pd(a1, a1), rate); + a2 = _mm_mul_pd(_mm_mul_pd(a2, a2), rate); + + // reduce the angle to the range (-0.5, 0.5) + a1 = _mm_sub_pd(a1, _mm_sub_pd(_mm_add_pd(a1, roundVal), roundVal)); + a2 = _mm_sub_pd(a2, _mm_sub_pd(_mm_add_pd(a2, roundVal), roundVal)); + + // convert pair of packed double into packed single + x = _mm_movelh_ps(_mm_cvtpd_ps(a1), _mm_cvtpd_ps(a2)); + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations + s = _mm_mul_ps(_mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(y, SS4), + SS3), + y), + SS2), + y), + SS1), + x); + c = _mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(y, CC3), + CC2), + y), + CC1), + y), + ONE); + + // perform first angle doubling + x = _mm_sub_ps(_mm_mul_ps(c, c), _mm_mul_ps(s, s)); + y = _mm_mul_ps(_mm_mul_ps(s, c), TWO); + + // calculate scaling factor to correct the magnitude + // m1 = vec_nmsub(y1, y1, vec_nmsub(x1, x1, TWO)); + // m2 = vec_nmsub(y2, y2, vec_nmsub(x2, x2, TWO)); + m = vec_recip3(_mm_add_ps(_mm_mul_ps(x, x), _mm_mul_ps(y, y))); + + // perform second angle doubling + c = _mm_sub_ps(_mm_mul_ps(x, x), _mm_mul_ps(y, y)); + s = _mm_mul_ps(_mm_mul_ps(y, x), TWO); + + // correct the magnitude (final sine / cosine approximations) + s = _mm_mul_ps(s, m); + c = _mm_mul_ps(c, m); + + // chirp the data + cd1 = _mm_shuffle_ps(c, c, 0x50); + cd2 = _mm_shuffle_ps(c, c, 0xfa); + cd1 = _mm_mul_ps(cd1, d1); + cd2 = _mm_mul_ps(cd2, d2); + d1 = _mm_shuffle_ps(d1, d1, 0xb1); + d2 = _mm_shuffle_ps(d2, d2, 0xb1); + td1 = _mm_shuffle_ps(s, s, 0x50); + td2 = _mm_shuffle_ps(s, s, 0xfa); + td1 = _mm_mul_ps(td1, d1); + td2 = _mm_mul_ps(td2, d2); + cd1 = _mm_addsub_ps(cd1, td1); + cd2 = _mm_addsub_ps(cd2, td2); + + // store chirped values + _mm_stream_ps(chirped, cd1); + _mm_stream_ps(chirped+4, cd2); + } + _mm_sfence(); + + // handle tail elements with scalar code + for ( ; i < ul_NumDataPoints; ++i) { + double angle = srate * i * i * 0.5; + double s = sin(angle); + double c = cos(angle); + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; + +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// ============================================================================= +// +// JWS: alternate SSE3 chirp +// +// Using Mendenhall Faster SinCos, coding based on +// version 8 v_vChirpData for SSE3 by Alex Kan +// + +int sse3_ChirpData_ak8( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + double chirp_rate, + int ul_NumDataPoints, + double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sse3_ChirpData_ak8()"); +#endif + int i; + + if (chirp_rate_ind == 0) { + memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) ); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + int vEnd; + double srate = chirp_rate * 0.5 / (sample_rate * sample_rate); + __m128d rate = _mm_set1_pd(chirp_rate * 0.5 / (sample_rate * sample_rate)); + __m128d roundVal = _mm_set1_pd(srate >= 0.0 ? TWO_TO_52 : -TWO_TO_52); + __m128d DFOUR = _mm_set_pd(4.0, 4.0); + + + // main vectorised loop + vEnd = ul_NumDataPoints - (ul_NumDataPoints & 3); + __m128d di1 = _mm_set_pd(2.0, 0.0); // set time patterns for eventual moveldup/movehdup + __m128d di2 = _mm_set_pd(3.0, 1.0); + + for (i = 0; i < vEnd; i += 4) { + const float *d = (const float *) (cx_DataArray + i); + float *cd = (float *) (cx_ChirpDataArray + i); + + __m128d a1, a2; + + __m128 d1, d2; + __m128 cd1, cd2; + __m128 td1, td2; + + __m128 x; + __m128 y; + __m128 z; + __m128 s; + __m128 c; + __m128 m; + + // load the signal to be chirped + d1 = _mm_load_ps(d); + d2 = _mm_load_ps(d+4); + + // calculate the input angle + a1 = _mm_mul_pd(_mm_mul_pd(di1, di1), rate); + a2 = _mm_mul_pd(_mm_mul_pd(di2, di2), rate); + + // update times for next + di1 = _mm_add_pd(di1, DFOUR); + di2 = _mm_add_pd(di2, DFOUR); + + // reduce the angle to the range (-0.5, 0.5) + a1 = _mm_sub_pd(a1, _mm_sub_pd(_mm_add_pd(a1, roundVal), roundVal)); + a2 = _mm_sub_pd(a2, _mm_sub_pd(_mm_add_pd(a2, roundVal), roundVal)); + + // convert pair of packed double into packed single + x = _mm_movelh_ps(_mm_cvtpd_ps(a1), _mm_cvtpd_ps(a2)); // 3 1 2 0 + + // square to the range [0, 0.25) + y = _mm_mul_ps(x, x); + + // perform the initial polynomial approximations, Estrin's method + z = _mm_mul_ps(y, y); + + s = _mm_mul_ps(_mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(y, SS4F), + SS3F), + z), + _mm_add_ps(_mm_mul_ps(y, SS2F), + SS1F)), + x); + c = _mm_add_ps(_mm_mul_ps(_mm_add_ps(_mm_mul_ps(y, CC3F), + CC2F), + z), + _mm_add_ps(_mm_mul_ps(y, CC1F), + ONE)); + + // perform first angle doubling + x = _mm_sub_ps(_mm_mul_ps(c, c), _mm_mul_ps(s, s)); + y = _mm_mul_ps(_mm_mul_ps(s, c), TWO); + + // calculate scaling factor to correct the magnitude + m = _mm_sub_ps(_mm_sub_ps(TWO, _mm_mul_ps(x, x)), _mm_mul_ps(y, y)); + + // perform second angle doubling + c = _mm_sub_ps(_mm_mul_ps(x, x), _mm_mul_ps(y, y)); + s = _mm_mul_ps(_mm_mul_ps(y, x), TWO); + + // correct the magnitude (final sine / cosine approximations) + c = _mm_mul_ps(c, m); // c3 c1 c2 c0 + s = _mm_mul_ps(s, m); + + // chirp the data + cd1 = _mm_moveldup_ps(c); // c1 c1 c0 c0 + cd2 = _mm_movehdup_ps(c); // c3 c3 c2 c2 + cd1 = _mm_mul_ps(cd1, d1); // c1.i1 c1.r1 c0.i0 c0.r0 + cd2 = _mm_mul_ps(cd2, d2); // c3.i3 c3.r3 c2.i2 c2.r2 + d1 = _mm_shuffle_ps(d1, d1, 0xb1); + d2 = _mm_shuffle_ps(d2, d2, 0xb1); + td1 = _mm_moveldup_ps(s); + td2 = _mm_movehdup_ps(s); + td1 = _mm_mul_ps(td1, d1); + td2 = _mm_mul_ps(td2, d2); + cd1 = _mm_addsub_ps(cd1, td1); + cd2 = _mm_addsub_ps(cd2, td2); + + // store chirped values + _mm_stream_ps(cd, cd1); + _mm_stream_ps(cd+4, cd2); + } + + // handle tail elements with scalar code + for (; i < ul_NumDataPoints; ++i) { + double angle = srate * i * i * 0.5; + double s = sin(angle); + double c = cos(angle); + + float re = cx_DataArray[i][0]; + float im = cx_DataArray[i][1]; + + cx_ChirpDataArray[i][0] = re * c - im * s; + cx_ChirpDataArray[i][1] = re * s + im * c; + } + analysis_state.FLOP_counter+=12.0*ul_NumDataPoints; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + + +#endif // USE_INTRINSICS diff --git a/client/vector/analyzeFuncs_vector.cpp b/client/vector/analyzeFuncs_vector.cpp new file mode 100644 index 0000000..08968db --- /dev/null +++ b/client/vector/analyzeFuncs_vector.cpp @@ -0,0 +1,1678 @@ + +// Copyright (c) 1999-2006 Regents of the University of California +// +// FFTW: Copyright (c) 2003,2006 Matteo Frigo +// Copyright (c) 2003,2006 Massachusets Institute of Technology +// +// fft8g.[cpp,h]: Copyright (c) 1995-2001 Takya Ooura + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any later +// version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions +// as an alternative to FFTW and distribute a linked executable and +// source code. You must obey the GNU General Public License in all +// respects for all of the code used other than the FFT library itself. +// Any modification required to support these libraries must be distributed +// under the terms of this license. If you modify this program, you may extend +// this exception to your version of the program, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. Please be aware that FFTW is not covered by this exception, +// therefore you may not use FFTW in any derivative work so modified without +// permission of the authors of FFTW. +// +// $Id: analyzeFuncs_vector.cpp,v 1.1.2.29 2007/08/16 10:13:56 charlief Exp $ + +#include "sah_config.h" + +#ifdef _WIN32 +#define uint32_t unsigned long +#endif +#include +#include +#include +#ifdef __APPLE_CC__ +#define isnan std::isnan +#endif +#include +#include +#ifdef HAVE_FLOAT_H +#include +#endif +#ifdef HAVE_FLOATINGPOINT_H +#include +#endif +#ifdef HAVE_IEEEFP_H +#include +#endif +#include + +#include "util.h" +#include "s_util.h" +#include "boinc_api.h" +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif +#include "diagnostics.h" +#include "filesys.h" +#include "str_replace.h" +#include "sighandler.h" +#include "analyzeFuncs.h" +#include "analyzeFuncs_vector.h" + +#include "hires_timer.h" + +#include "chirpfft.h" +#include "analyzePoT.h" +#include "pulsefind.h" +#include "sincos.h" +#ifdef USE_ASMLIB +#include "asmlib.h" +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#ifdef __APPLE_CC__ +#include +#ifdef HAVE___ISNAN +#define isnotnan(x) (!isnan(x)) +#else +#define isnotnan(x) ((x) == (x)) +#endif +#endif + + +#ifndef __APPLE_CC__ +#if defined(HAVE__ISNAN) +#define isnotnan(x) (!_isnan(x)) +#elif defined(HAVE_ISNAN) +#define isnotnan(x) (!isnan(x)) +#elif defined(HAVE___ISNAN) +#define isnotnan(x) (!__isnan(x)) +#else +#define isnotnan(x) ((x) == (x)) +#endif +#endif + +static bool do_print; + +// Bit patterns to compare host capabilities and what SIMD capability a routine needs +#define BA_ANY 0x00000001 // any CPU OK +#define BA_MMX 0x00000002 +#define BA_SSE 0x00000004 +#define BA_SSE2 0x00000008 +#define BA_SSE3 0x00000010 +#define BA_3Dnow 0x00000020 +#define BA_3DnowP 0x00000040 +#define BA_MMX_P 0x00000080 +#define BA_SSSE3 0x00000100 +#define BA_SSE41 0x00000200 +#define BA_SSE4a 0x00000400 +#define BA_SSE42 0x00000800 +#define BA_XOP 0x00001001 +#define BA_AVX 0x00002000 +#define BA_FMA 0x00004000 +#define BA_FMA4 0x00008000 +#define BA_ALTVC 0x00100000 +#define BA_NEON 0x00200000 +#define BA_VFP 0x00400000 +#define BA_VFPV3 0x00800000 +#define BA_VFPV3D16 0x01000000 +#define BA_VFPV4 0x02000000 +#define BA_VFPV4D16 0x04000000 + +uint32_t CPUCaps = BA_ANY; + +/*********************************** + *JWS: Temporary hack for AVX support, based on section 2.2 of Intel 319433-010.pdf + * (Intel® Advanced Vector Extensions Programming Reference) + * + * Note this does not check for whether the CPU supports cpuid, etc. so must + * not be used unless such details have already been confirmed. + */ +#if defined(USE_AVX) + +int avxSupported(void) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("avxSupported()"); +#endif + int retval = 1; +#if defined(__APPLE_CC__) + int avx1=0; + int avx2=0; + size_t length=sizeof(int); + int error; + error=sysctlbyname("hw.optional.avx1_0",&avx1,&length,NULL,0); + error=sysctlbyname("hw.optional.avx2_0",&avx2,&length,NULL,0); + retval=(avx1||avx2); +#elif defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ > 3)) || (__GNUC__ > 4)) +#if defined(__i386__) && (defined(__PIC__) || defined(__pic__)) +// EBX can't be clobbered on linux PIC. + __asm__ ( "pushl %ebx \n\t" ); +#endif + __asm__ ( "\n\t" + "movl $1, %%eax \n\t" + "cpuid \n\t" + "andl $0x18000000, %%ecx \n\t" + "cmpl $0x18000000, %%ecx \n\t" + "jne 1f \n\t" + "xorl %%ecx, %%ecx \n\t" + "xgetbv \n\t" + "andl $6, %%eax \n\t" + "cmpl $6, %%eax \n\t" + "jne 1f \n\t" + "movl $1, %0 \n\t" + "jmp 2f \n\t" + "1: \n\t" + "movl $0, %0 \n\t" + "2: \n\t" +# if defined(_WIN64) || defined(__LP64__) || defined (__x86_64__) + : "=g" (retval) :: "%rax", "%rbx", "%rcx", "%rdx" +# elif defined(__i386__) && (defined(__PIC__) || defined(__pic__)) + "popl %%ebx \n\t" + : "=g" (retval) :: "%eax", "%ecx", "%edx" +# else + : "=g" (retval) :: "%eax", "%ebx", "%ecx", "%edx" +# endif + ); +#elif (_MSC_VER >= 1600) && !defined(_WIN64) + _asm { + mov eax, 1 + cpuid + and ecx, 018000000H + cmp ecx, 018000000H + jne NOSUPPORT + xor ecx, ecx + xgetbv + and eax, 06H + cmp eax, 06H + jne NOSUPPORT + mov retval, 1 + jmp DONE + NOSUPPORT: + mov retval, 0 + DONE: + }; +#endif // compiler +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return retval; +} +#endif // USE_AVX + +/********************** + */ +void SetCapabilities(void) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("SetCapabilities()"); +#endif + +#if defined(__APPLE_CC__) + // OS X assumes MMX, SSE and SSE2 are present on Intel processors + // SSE3 and Altivec are optional +#if defined(__i386__) || defined(__x86_64__) + CPUCaps |= (BA_MMX|BA_SSE|BA_SSE2); + int sse3flag=0; + size_t length=sizeof(sse3flag); + int error=sysctlbyname("hw.optional.sse3",&sse3flag,&length,NULL,0); + if (sse3flag && !error) CPUCaps |= BA_SSE3; +#else // PowerPC + int altivecflag=0; + size_t length=sizeof(altivecflag); + int error=sysctlbyname("hw.optional.altivec",&altivecflag,&length,NULL,0); + if (altivecflag && !error) CPUCaps |= BA_ALTVC; +#endif + +#elif defined( USE_BHCPUID ) + CPU_INFO theCPU; + + if (theCPU.mmx()) CPUCaps |= BA_MMX; + if (theCPU.sse()) CPUCaps |= BA_SSE; + if (theCPU.sse2()) CPUCaps |= BA_SSE2; + if (theCPU.sse3()) CPUCaps |= BA_SSE3; + if (theCPU._3Dnow()) CPUCaps |= BA_3Dnow; + if (theCPU._3DnowPlus()) CPUCaps |= BA_3DnowP; + if (theCPU.mmxPlus()) CPUCaps |= BA_MMX_P; + +#elif defined( USE_ASMLIB ) + int dp = DetectProcessor(); + if (dp & 0x00800000) CPUCaps |= BA_MMX; + if ((dp & 0x02000800) == 0x02000800) CPUCaps |= BA_SSE; + if ((dp & 0x04000800) == 0x04000800) CPUCaps |= BA_SSE2; + if ((dp & 0x08000800) == 0x08000800) CPUCaps |= BA_SSE3; + if (dp & 0x80000000) CPUCaps |= BA_3Dnow; + if (dp & 0x40000000) CPUCaps |= BA_3DnowP; + if (dp & 0x20000000) CPUCaps |= BA_MMX_P; +#if defined(USE_AVX) + if ((dp & 0x00000800) && avxSupported()) CPUCaps |= BA_AVX; +#endif + +#elif defined(__i386__) || defined (__x86_64__) || defined(_M_X64) + /* we're hoping to rely on signal handling to keep us out of trouble */ + CPUCaps |= (BA_MMX | BA_SSE | BA_SSE2 | BA_SSE3 | BA_3Dnow | BA_3DnowP | BA_MMX_P ); +#if defined(USE_AVX) + CPUCaps |= BA_AVX; +#endif + +#elif defined(USE_ALTIVEC) + CPUCaps |= BA_ALTVC; + +#elif (defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)) || defined(__aarch64__) + +#if defined(ANDROID) || defined(__linux__) + // if strlen(p_features) is 0 or p_features doesn't contain "vfp" assume + // either BOINC is screwed up or we're running stand alone. + size_t len=strlen(app_init_data.host_info.p_features); + if ((len==0) || (strstr(app_init_data.host_info.p_features,"vfp") == 0)) { + if (do_print) fprintf(stderr,"Getting CPU Capabilities from /proc/cpuinfo\n"); + app_init_data.host_info.p_features[0]=0; + char buf[256]; + FILE *cpuinfo=boinc_fopen("/proc/cpuinfo","r"); + if (cpuinfo) { + while (fgets(buf,sizeof(buf),cpuinfo)) { + if (strstr(buf, "Features")==buf) { + strlcpy(app_init_data.host_info.p_features,strstr(buf,":")+1,sizeof(app_init_data.host_info.p_features)); + break; + } + } + fclose(cpuinfo); + } else { + fprintf(stderr,"Could not open /proc/cpuinfo\n"); + } + len=strlen(app_init_data.host_info.p_features); + if (len == 0) fprintf(stderr,"Didn't find 'Features' line\n"); + } + + // ensure the features list ends with a space. + if ((app_init_data.host_info.p_features[len-1] != ' ') && + (len timings; + timings.reserve(1000); + int best; + double best_timing, best_accuracy; + + if (k == 1) { + if (do_print) fprintf(stderr,"%32s (no other)%s\n", + BaseLineSmoothFuncs[0].nom, + (verbose>1) ? "\n": ""); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return v_BaseLineSmooth; + } + sah_complex *indata=(sah_complex *)malloc_a(NumDataPoints*sizeof(sah_complex),MEM_ALIGN); + sah_complex *outdata=(sah_complex *)malloc_a(NumDataPoints*sizeof(sah_complex),MEM_ALIGN); + sah_complex *save=(sah_complex *)malloc_a(NumDataPoints*sizeof(sah_complex),MEM_ALIGN); + + FORCE_FRAME_POINTER; + if (!indata || !outdata || !save) { + if (indata) + free_a(indata); + if (outdata) + free_a(outdata); + if (save) + free_a(save); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return v_BaseLineSmooth; + } + for (i=0;i(RAND_MAX/2))?-1.0f:1.0f; + indata[i][1]=((rand()&RAND_MAX)>(RAND_MAX/2))?-1.0f:1.0f; + } +#if !defined(USE_ASMLIB) && !defined(__APPLE_CC__) + install_sighandler(); + for (i=0;i1) + fprintf(stderr,"%32s not supported on CPU\n", + BaseLineSmoothFuncs[i].nom); + continue; + } + + j=0; + timing=0; + while ((j<100) && ((j<20) || (timing<(10*timer.resolution())))) { + memcpy(outdata,indata,NumDataPoints*sizeof(sah_complex)); + timer.start(); + rv=BaseLineSmoothFuncs[i].func(outdata,NumDataPoints,8192,32768); + onetime=timer.stop(); + timing+=onetime; + timings.push_back(onetime); +#if !defined(USE_ASMLIB) && !defined(__APPLE_CC__) + if (rv) siglongjmp(jb,1); +#else + if (rv) break; +#endif + j++; + } + if (rv) continue; + std::sort(timings.begin(),timings.end()); + timing=timings[timings.size()/2]; + if (timing==0) timing=std::accumulate(timings.begin(),timings.end(),0.0)/timings.size(); + timings.clear(); + if (i==0) { + accuracy=0; + memcpy(save,outdata,NumDataPoints*sizeof(sah_complex)); + } else { + accuracy=0; + for (j=0;j1) { + fprintf(stderr,"%32s %8.6f %7.5f test\n",BaseLineSmoothFuncs[i].nom,timing,accuracy); + fflush(stderr); + } + if ((timing1) { + fprintf(stderr,"%32s faulted\n",BaseLineSmoothFuncs[i].nom); + fflush(stderr); + } + } + } + uninstall_sighandler(); +#else + } +#endif + free_a(indata); + free_a(outdata); + free_a(save); + if (do_print) + fprintf(stderr,"%32s %8.6f %7.5f %s\n", + BaseLineSmoothFuncs[best].nom, + best_timing, + best_accuracy, + (verbose>1) ? " choice\n": ""); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return baseline_smooth; +} + +GetPowerSpectrum_func ChooseGetPowerSpectrum() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ChooseGetPowerSpectrum()"); +#endif + if (default_functions_flag) { + if (do_print) + fprintf(stderr,"%32s (default)\n",GetPowerSpectrumFuncs[0].nom); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return GetPowerSpectrumFuncs[0].func; + } // else + hires_timer timer; + GetPowerSpectrum_func get_power_spectrum; + int i,j,rv; + double speed=1e+6,timing,onetime,accuracy; + std::vector timings; + timings.reserve(1000); + int NumDataPoints=128*1024; + int best; + double best_timing, best_accuracy; + sah_complex *indata=(sah_complex *)malloc_a(NumDataPoints*sizeof(sah_complex),MEM_ALIGN); + float *outdata=(float *)malloc_a(NumDataPoints*sizeof(float),MEM_ALIGN); + float *save=(float *)malloc_a(NumDataPoints*sizeof(float),MEM_ALIGN); + + FORCE_FRAME_POINTER; + if (!indata || !outdata || !save) { + if (indata) + free_a(indata); + if (outdata) + free_a(outdata); + if (save) + free_a(save); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return v_GetPowerSpectrum; + } + for (i=0;i1) + fprintf(stderr,"%32s not supported on CPU\n", + GetPowerSpectrumFuncs[i].nom); + continue; + } + j=0; + timing=0; + while ((j<100) && ((j<20) || (timing<(10*timer.resolution())))) { + memset(outdata,0,NumDataPoints*sizeof(float)); + timer.start(); + rv=GetPowerSpectrumFuncs[i].func(indata,outdata,NumDataPoints); + onetime=timer.stop(); + timing+=onetime; + timings.push_back(onetime); +#if !defined(USE_ASMLIB) && !defined(__APPLE_CC__) + if (rv) siglongjmp(jb,1); +#else + if (rv) break; +#endif + j++; + } + if (rv) continue; + + std::sort(timings.begin(),timings.end()); + timing=timings[timings.size()/2]; + if (timing==0) timing=std::accumulate(timings.begin(),timings.end(),0.0)/timings.size(); + timings.clear(); + if (i==0) { + accuracy=0; + memcpy(save,outdata,NumDataPoints*sizeof(float)); + } else { + accuracy=0; + for (j=0;j1) { + fprintf(stderr,"%32s %8.6f %7.5f test\n",GetPowerSpectrumFuncs[i].nom,timing,accuracy); + fflush(stderr); + } + if ((timing1) { + fprintf(stderr,"%32s faulted\n",GetPowerSpectrumFuncs[i].nom); + fflush(stderr); + } + } + } + uninstall_sighandler(); +#else + } +#endif + free_a(indata); + free_a(outdata); + free_a(save); + if (do_print) + fprintf(stderr,"%32s %8.6f %7.5f %s\n", + GetPowerSpectrumFuncs[best].nom, + best_timing, + best_accuracy, + (verbose>1) ? " choice\n": ""); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return get_power_spectrum; +} + +extern void CalcTrigArray(int len, int ChirpRateInd); +extern void FreeTrigArray(); +extern void InitTrigArray(int len, double ChirpStep, int InitInd, double SampleRate); + +ChirpData_func ChooseChirpData() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ChooseChirpData()"); +#endif + bool CacheChirpCalc=((app_init_data.host_info.m_nbytes == 0) || + (app_init_data.host_info.m_nbytes >= MIN_TRIGARRAY_MEMORY)); + if (default_functions_flag) { + if (do_print) + fprintf(stderr,"%32s (default)\n",ChirpDataFuncs[0].nom); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return ChirpDataFuncs[0].func; + } // else + hires_timer timer; + ChirpData_func chirp_data; + int i,j,rv,k = sizeof(ChirpDataFuncs)/sizeof(CDtb); + double speed=1e+6,timing,accuracy,onetime; + std::vector timings; + timings.reserve(1000); + int NumDataPoints=1024*1024; + int best; + double best_timing, best_accuracy; + FORCE_FRAME_POINTER; + + if (k == 1) { + if (do_print) fprintf(stderr,"%32s (no other)\n",ChirpDataFuncs[0].nom); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return v_ChirpData; + } + sah_complex *indata=(sah_complex *)malloc_a(NumDataPoints*sizeof(sah_complex),MEM_ALIGN); + sah_complex *outdata=(sah_complex *)malloc_a(NumDataPoints*sizeof(sah_complex),MEM_ALIGN); + sah_complex *test=(sah_complex *)malloc_a(NumDataPoints*sizeof(sah_complex),MEM_ALIGN); + + if (!indata || !outdata || !test) { + if (indata) + free_a(indata); + if (outdata) + free_a(outdata); + if (test) + free_a(test); + fprintf(stderr,"Memory allocation failed in ChooseChirp\n"); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return v_ChirpData; + } + //JWS: Generate indata as the chirp of flat line (constant) data + for (i=0;i(i)*recip_sample_rate; + ang=0.5*chirp_rate*time*time; + ang -= floor(ang); + ang *= M_PI*2; + sincos(ang,&dd,&cc); + // Notionally: + // c=cc; + // d=dd; + // indata[i][0] = save[i][0] * c - save[i][1] * d; + // indata[i][1] = save[i][0] * d + save[i][1] * c; + indata[i][0] = static_cast(cc); + indata[i][1] = static_cast(dd); + } + +#if !defined(USE_ASMLIB) && !defined(__APPLE_CC__) + install_sighandler(); + for (i=0;i1) + fprintf(stderr,"%32s not supported on CPU\n", + ChirpDataFuncs[i].nom); + continue; + } + j=0; + timing=0; + if (CacheChirpCalc) { + // Give the cached functions something to on the first call. + FreeTrigArray(); + InitTrigArray(NumDataPoints, MinChirpStep,TESTCHIRPIND-1,swi.subband_sample_rate); + } + int ind=TESTCHIRPIND; + while ((j<100) && ((j<20) || (timing<(10*timer.resolution())))) { + memset(outdata,0,NumDataPoints*sizeof(sah_complex)); +#if 0 + fprintf(stderr,"before Chirp test:%32s \n",ChirpDataFuncs[i].nom); + for(int k=0;k<3;k++){ + fprintf(stderr,"in[%d].xy=(%7.5f,%7.5f)]\n",k,indata[k][0],indata[k][1]); + } +#endif + timer.start(); + rv=ChirpDataFuncs[i].func(indata,outdata,ind,MinChirpStep*ind,NumDataPoints,swi.subband_sample_rate); + onetime=timer.stop(); +#if 0 + fprintf(stderr,"after Chirp test:%32s \n",ChirpDataFuncs[i].nom); + for(int k=0;k<3;k++){ + fprintf(stderr,"out[%d].xy=(%7.5f,%7.5f)]\n",k,outdata[k][0],outdata[k][1]); + } +#endif + + timing+=onetime; + timings.push_back(onetime); +#if !defined(USE_ASMLIB) && !defined(__APPLE_CC__) + if (rv) siglongjmp(jb,1); +#else + if (rv) break; +#endif + if (j==1) memcpy(test,outdata,NumDataPoints*sizeof(sah_complex)); + if (ind>0) { + ind*=-1; + } else { + ind=-1*(ind-2); + } + j++; + } + if (rv) continue; + std::sort(timings.begin(),timings.end()); + timing=timings[timings.size()/2]; + if (timing==0) timing=std::accumulate(timings.begin(),timings.end(),0.0)/timings.size(); + timings.clear(); + accuracy=0; + //JWS: indata is positive chirp of constant at TESTCHIRPIND, test was copied + // at -TESTCHIRPIND so we check for deviation from flat + for (j=0;j1) fprintf(stderr,"%32s %8.6f %7g test\n",ChirpDataFuncs[i].nom,timing,accuracy); + if (verbose>1) { + fprintf(stderr,"%32s %8.6f %7.5f test\n",ChirpDataFuncs[i].nom,timing,accuracy); + fflush(stderr); + } + if ((timing1) { + fprintf(stderr,"%32s faulted\n",ChirpDataFuncs[i].nom); + fflush(stderr); + } + // reinstall_sighandler(); + } + } + uninstall_sighandler(); +#else + } +#endif + free_a(indata); + free_a(outdata); + free_a(test); + if (do_print) + fprintf(stderr,"%32s %8.6f %7.5f %s\n", + ChirpDataFuncs[best].nom, + best_timing, + best_accuracy, + (verbose>1) ? " choice\n": ""); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return chirp_data; +} + +Transpose_func ChooseTranspose() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ChooseTranspose()"); +#endif + if (default_functions_flag || !use_transposed_pot) { + if (do_print && use_transposed_pot) + fprintf(stderr,"%32s (default)\n",TransposeFuncs[2].nom); //JWS: v_Transpose4 is the default +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return TransposeFuncs[2].func; + } // else + hires_timer timer; + Transpose_func transpose; + int i,j,rv; + double speed=1e+6,timing,onetime,accuracy; + std::vector timings; + timings.reserve(1000); + int NumDataPoints=1024*1024; + int best; + double best_timing, best_accuracy; + float *indata=(float *)malloc_a(NumDataPoints*sizeof(float),MEM_ALIGN); + float *outdata=(float *)malloc_a(NumDataPoints*sizeof(float),MEM_ALIGN); + float *save=(float *)malloc_a(NumDataPoints*sizeof(float),MEM_ALIGN); + + FORCE_FRAME_POINTER; + if (!indata || !outdata || !save) { + if (indata) + free_a(indata); + if (outdata) + free_a(outdata); + if (save) + free_a(save); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return v_Transpose; + } + for (i=0;i1) + fprintf(stderr,"%32s not supported on CPU\n", + TransposeFuncs[i].nom); + continue; + } + j=0; + timing=0; + int ind=0; + while ((j<100) && ((j<20) || (timing<(10*timer.resolution())))) { + memset(outdata,0,NumDataPoints*sizeof(float)); + timer.start(); + rv=TransposeFuncs[i].func(16384,64,indata,outdata); + onetime=timer.stop(); + timing+=onetime; + timings.push_back(onetime); +#if !defined(USE_ASMLIB) && !defined(__APPLE_CC__) + if (rv) siglongjmp(jb,1); +#else + if (rv) break; +#endif + j++; + } + if (rv) continue; + std::sort(timings.begin(),timings.end()); + timing=timings[timings.size()/2]; + if (timing==0) timing=std::accumulate(timings.begin(),timings.end(),0.0)/timings.size(); + timings.clear(); + if (i==0) { + accuracy=0; + memcpy(save,outdata,NumDataPoints*sizeof(float)); + } else { + accuracy=0; + for (j=0;j1) { + fprintf(stderr,"%32s %8.6f %7.5f test\n",TransposeFuncs[i].nom,timing,accuracy); + fflush(stderr); + } + if ((timing1) { + fprintf(stderr,"%32s faulted\n",TransposeFuncs[i].nom); + fflush(stderr); + } + } + } + uninstall_sighandler(); +#else + } +#endif + free_a(indata); + free_a(outdata); + free_a(save); + if (do_print) + fprintf(stderr,"%32s %8.6f %7.5f %s\n", + TransposeFuncs[best].nom, + best_timing, + best_accuracy, + (verbose>1) ? " choice\n": ""); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return transpose; +} + +/******************************************** + * + * Testing folding subroutines + * + */ +// dummy folding routine +float dmyFld(float *ss[], struct PoTPlan *P) {return 1.0f;} + +// tables to hold function pointers of set under test +sum_func fold3test[FOLDTBLEN] = { + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, +}; +sum_func fold4test[FOLDTBLEN] = { + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, +}; +sum_func fold5test[FOLDTBLEN] = { + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, +}; +sum_func fold2test[FOLDTBLEN] = { + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, +}; +sum_func fold2ALtest[FOLDTBLEN] = { + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, + dmyFld, dmyFld, dmyFld, dmyFld, +}; + +FoldSet TestFoldSet = {fold3test, fold4test, fold5test, fold2test, fold2ALtest, ""}; + +/********************** + * + * Generate preplanned sequence of folds + * + */ +int planFoldTest(PoTPlan * PSeq, float *div, int FFTtbl[][5]) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("planFoldTest()"); +#endif + float period; + int i, iL, j, di, ndivs; + int num_adds, num_adds_2; + int FftLength, PulsePoTLen; + int dbinoffs[32] = {0}; + int k = 0; // plan index + + for (iL = 0; iL < 32; iL++) { + if ((FftLength = FFTtbl[iL][0]) == 0) continue; + PulsePoTLen = FFTtbl[iL][4]; + + for (i = 32, ndivs = 1; i <= PulsePoTLen; ndivs++, i *= 2); + + period = (float)((int)((PulsePoTLen * 2) / 3)) * 0.5f; + for (i = 1; i < ndivs; i++, period *= 0.5f) { + dbinoffs[i] = (((int)(period + 0.5f) + + (MEM_ALIGN/sizeof(float)) - 1) & + -(MEM_ALIGN/sizeof(float))) + + dbinoffs[i - 1]; + } + + int32_t PoTL = PulsePoTLen; + + // Periods from PulsePoTLen/3 to PulsePoTLen/4, and power of 2 fractions of. + // then (len/4 to len/5) and finally (len/5 to len/6) + // + // For quick testing we select about one from each range at FFT length 8, two at 16, + // four at 32, etc. + // + int32_t firstP, lastP, iP, iLim; + for(num_adds = 3; num_adds <= 5; num_adds++) { + float rnum_adds_minus1; + float fP, fStep; + + iLim = FFTtbl[iL][num_adds - 2]; + switch(num_adds) { + case 3: lastP = (PoTL * 2) / 3; firstP = (PoTL * 1) / 2; rnum_adds_minus1 = 0.5f; break; + case 4: lastP = (PoTL * 3) / 4; firstP = (PoTL * 3) / 5; rnum_adds_minus1 = 1.0f / 3.0f; break; + case 5: lastP = (PoTL * 4) / 5; firstP = (PoTL * 4) / 6; rnum_adds_minus1 = 0.25f; break; + } + fStep = (float)(lastP - firstP) / (float)(iLim); + fP = fabs((float)(lastP) - (fStep / 3.0f)); + + for (iP = 0; iP < iLim; iP++, fP -= fStep) { + PSeq[k].dest = div + dbinoffs[0]; // Output storage + PSeq[k].di = di = (int)(fP * rnum_adds_minus1); + PSeq[k].tmp0 = (int)(fP * 1.0f * rnum_adds_minus1 + 0.5f); + PSeq[k].tmp1 = (int)(fP * 2.0f * rnum_adds_minus1 + 0.5f); + + switch(num_adds) { + case 3: + PSeq[k].fun_ptr = (di < FOLDTBLEN) ? fold3test[di] : fold3test[FOLDTBLEN-1]; + break; + case 4: + PSeq[k].tmp2 = (int)(fP * 3.0f * rnum_adds_minus1 + 0.5f); + PSeq[k].fun_ptr = (di < FOLDTBLEN) ? fold4test[di] : fold4test[FOLDTBLEN-1]; + break; + case 5: + PSeq[k].tmp2 = (int)(fP * 3.0f * rnum_adds_minus1 + 0.5f); + PSeq[k].tmp3 = (int)(fP * 4.0f * rnum_adds_minus1 + 0.5f); + PSeq[k].fun_ptr = (di < FOLDTBLEN) ? fold5test[di] : fold5test[FOLDTBLEN-1]; + break; + } + // When built with DevC++/MinGW and signal handling enabled, the first calculation + // of PSeq[0].tmp0 somehow produces an 0x80000000 value. This hack repeats the + // calculation, which gets the right value. + if (k == 0 && PSeq[k].tmp0 < 1) PSeq[k].tmp0 = (int)(fP * 1.0f * rnum_adds_minus1 + 0.5f); + + k++; // next plan + num_adds_2 = 2 * num_adds; + + for (j = 1; j < ndivs ; j++) { + PSeq[k].offset = dbinoffs[j - 1]; + PSeq[k].dest = div + dbinoffs[j]; + PSeq[k].tmp0 = di & 1; + di /= 2; + PSeq[k].tmp0 += di + PSeq[k].offset; + PSeq[k].di = di; + if (PSeq[k].tmp0 & 3) PSeq[k].fun_ptr = (di < FOLDTBLEN) ? fold2test[di] : fold2test[FOLDTBLEN-1]; + else PSeq[k].fun_ptr = (di < FOLDTBLEN) ? fold2ALtest[di] : fold2ALtest[FOLDTBLEN-1]; + + k++; // next plan + num_adds_2 *= 2; + } // for (j = + } // for (iP = + } // for(num_adds = + } // for(iL = + PSeq[k].di = 0; // stop +/* + for (int iDmp = 0; iDmp < 4; iDmp++) { + fprintf(stderr,"di= %d dest= %d ptr= %d tmp0= %d tmp1= %d\n", + PSeq[iDmp].di, PSeq[iDmp].dest, PSeq[iDmp].fun_ptr, PSeq[iDmp].tmp0, PSeq[iDmp].tmp1); + } +*/ +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return (k); +} + + +/********************** + * + * Test folding subroutine sets and choose best + * + */ +int ChooseFoldSubs(ChirpFftPair_t * ChirpFftPairs, int num_cfft, int nsamples) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ChooseFoldSubs()"); +#endif + if (default_functions_flag) { + if (do_print) + fprintf(stderr,"%24s folding (default)\n",Foldmain.name); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } // else + hires_timer timer; + int i, iL, j, k, ndivs, NumPlans = 0, MaxPulsePoT = PoTInfo.PulseMax; + double onetime, timing, best_timing, speed = 1e+6; + double accuracy, best_accuracy, errmax, dTmp = 1e+30; + std::vector timings; + timings.reserve(1000); + int best; + int PoTLen, PulsePoTLen, Overlap, FFTtbl[32][5] = {0, 0, 0, 0, 0}; + double NumSamples = nsamples; + float *SrcSel[2]; + + // Get the count of chirp/fft pairs for each FFT length where Pulse finding + // will be done. + for (i = 0; i < num_cfft; i++) { + if (ChirpFftPairs[i].PulseFind) { + for (iL = 0, j = ChirpFftPairs[i].FftLen; j ; iL++, j >>= 1); + FFTtbl[iL][0] = ChirpFftPairs[i].FftLen; + FFTtbl[iL][2] += 1; + } + } + + // For testing, the chirp/fft table may just be a short list. If so, add the FFT + // length to the counts to simulate distribution for a full table. (This also affects + // very high angle range WUs, but Pulse folding is a small factor there so looser + // testing will have very little effect.) + if (num_cfft < 14) { + for (iL = 0; iL < 32; iL++) FFTtbl[iL][2] += FFTtbl[iL][0]; + } + + // Scale the counts so the minimum is 1. Use the scaled value directly for fold + // sequences starting with a fold by 4. Adjust the values for fold by 3 and + // fold by 5 to get close to the 10, 9, 8 ratios. Add the PoT length values to + // the table, and tot up the needed number of PoTPlans. + for (iL = 0; iL < 32; iL++) { + if ((FFTtbl[iL][0]) && ((double)FFTtbl[iL][2] < dTmp)) dTmp = (double)FFTtbl[iL][2]; + } + for (iL = 0; iL < 32; iL++) { + if (FFTtbl[iL][0]) { + FFTtbl[iL][2] = (int)((double)FFTtbl[iL][2] / dTmp + 0.5); + FFTtbl[iL][1] = (int)((double)FFTtbl[iL][2] * 10.0 / 9.0 + 0.5); + FFTtbl[iL][3] = FFTtbl[iL][2] + FFTtbl[iL][2] - FFTtbl[iL][1]; + PoTLen = (int)(NumSamples / FFTtbl[iL][0] + 0.5); + GetPulsePoTLen(PoTLen, &PulsePoTLen, &Overlap); + FFTtbl[iL][4] = PulsePoTLen; + for (i = 32, ndivs = 1; i <= PulsePoTLen; ndivs++, i *= 2); + NumPlans += 3 * FFTtbl[iL][2] * ndivs; + } + } + if (NumPlans == 0) { + // No pulse finding in this WU, abort test. +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; + } + + // At some angle ranges the total number of test folds may be too few to get good + // timing measurements. Scale up so there are at least 16K test folds. + while (NumPlans < 16384) { + for (iL = 0; iL < 32; iL++) { + FFTtbl[iL][1] *= 2; + FFTtbl[iL][2] *= 2; + FFTtbl[iL][3] *= 2; + } + NumPlans *= 2; + } + +// fprintf(stderr, "Calculated Preplans = %d\n", NumPlans); +// NumPlans *= 2; // temporary safety measure + + + // Now we know what we're doing - allocate memory in which to do it. + PoTPlan *PlanBuf = (PoTPlan *)malloc_a((NumPlans + 1) * sizeof(PoTPlan), MEM_ALIGN); + float *indata = (float *)malloc_a(MaxPulsePoT * sizeof(float), MEM_ALIGN); + float *outdata = (float *)malloc_a(MaxPulsePoT * sizeof(float), MEM_ALIGN); + float *maxdata = (float *)malloc_a(NumPlans * sizeof(float), MEM_ALIGN); + float *save = (float *)malloc_a(NumPlans * sizeof(float), MEM_ALIGN); + + FORCE_FRAME_POINTER; + if (!PlanBuf || !indata || !outdata || !maxdata || !save) { + if (PlanBuf) + free_a(PlanBuf); + if (indata) + free_a(indata); + if (outdata) + free_a(outdata); + if (maxdata) + free_a(maxdata); + if (save) + free_a(save); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; // Can't test, make no change + } + + SrcSel[0] = indata; + SrcSel[1] = outdata; + + // Generate PowerSpectrum random data + srand(11); + for (i = 0; i < MaxPulsePoT; i++) { + float fr1 = (float)(rand()) / RAND_MAX; + float fr2 = (float)(rand()) / RAND_MAX; + indata[i] = fr1 * fr1 + fr2 * fr2; + } + +#if !defined(USE_ASMLIB) && !defined(__APPLE_CC__) + install_sighandler(); + for (i=0;(i*sizeof(FolSub))1) + fprintf(stderr,"%24s folding not supported on CPU\n", + FoldSubs[i].fsp->name); + continue; + } + j = 0; + timing = 0; + CopyFoldSet(&TestFoldSet, FoldSubs[i].fsp); + int n = planFoldTest(PlanBuf, outdata, FFTtbl); +// if (!i) fprintf(stderr, "Actual Preplans = %d\n", n); + while ((j < 100) && ((j < 10) || ((timing) < (10 * timer.resolution())))) { + memset(outdata, 0, MaxPulsePoT * sizeof(float)); + memset(maxdata, 0, NumPlans * sizeof(float)); + maxdata[0] = -1.234f; + timer.start(); + for ( k = 0; PlanBuf[k].di; k++) { + maxdata[k] = PlanBuf[k].fun_ptr(SrcSel, &PlanBuf[k]); + } + onetime = timer.stop(); + timing+=onetime; + timings.push_back(onetime); +#if !defined(USE_ASMLIB) && !defined(__APPLE_CC__) + if (maxdata[0] < 0) siglongjmp(jb,1); +#else + if (maxdata[0] < 0) break; +#endif + j++; + } + std::sort(timings.begin(),timings.end()); + timing=timings[timings.size()/2]; + if (timing==0) timing=std::accumulate(timings.begin(),timings.end(),0.0)/timings.size(); + timings.clear(); + accuracy = 0; + errmax = 0; + if (i == 0) { + memcpy(save, maxdata, NumPlans * sizeof(float)); + } else { + for (j = 0; j < NumPlans; j++) { + // a zero max should never happen, but be safe... + if (save[j]) { + double relerr = fabs((save[j] - maxdata[j]) / save[j]); + accuracy += relerr; + if (relerr > errmax) errmax = relerr; + } + } + } + accuracy /= NumPlans; + if (verbose>1) { + fprintf(stderr, "%24s folding %8.6f %7.5f test\n", FoldSubs[i].fsp->name, timing, accuracy); + fflush(stderr); + } + if ((timing < speed) && isnotnan(accuracy) && (accuracy < 1e-6) && (errmax < 1e-4)) { + speed = timing; + best = i; + best_timing = timing; + best_accuracy = accuracy; + } +#if !defined(USE_ASMLIB) && !defined(__APPLE_CC__) + } else { + // reinstall_sighandler(); + if (verbose>1) { + fprintf(stderr, "%24s folding faulted\n", FoldSubs[i].fsp->name); + fflush(stderr); + } + } + } + uninstall_sighandler(); +#else + } +#endif + free_a(PlanBuf); + free_a(indata); + free_a(outdata); + free_a(maxdata); + free_a(save); + if (do_print) + fprintf(stderr, "%24s folding %8.6f %7.5f %s\n", + FoldSubs[best].fsp->name, + best_timing, + best_accuracy, + (verbose>1) ? " choice\n": ""); + CopyFoldSet(&Foldmain, FoldSubs[best].fsp); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + + + +void ChooseFunctions(BaseLineSmooth_func *baseline_smooth, + GetPowerSpectrum_func *get_power_spectrum, + ChirpData_func *chirp_data, + Transpose_func *transpose, + ChirpFftPair_t * ChirpFftPairs, + int num_cfft, + int nsamples, + bool print_choices) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("ChooseFunctions()"); +#endif + do_print=print_choices; + if (verbose>1) do_print = true; + if (TestBoincSignalHandling()) { + SetCapabilities(); + hires_timer durtimer; + double TestDur=0; + if (do_print) { + fprintf(stderr,"Optimal function choices:\n"); + fprintf(stderr,"--------------------------------------------------------\n"); + fprintf(stderr,"%32s %8s %7s\n","name","timing","error"); + fprintf(stderr,"--------------------------------------------------------\n"); + fflush(stderr); + } + durtimer.start(); +#ifdef ANDROID + // low memory android is a special case because android will kill + // without warning to free memory. Testing the functions could trigger + // a loop. So we'll choose what fits the processor and return + if (app_init_data.host_info.m_nbytes && + (app_init_data.host_info.m_nbytes < MIN_TRIGARRAY_MEMORY)) { + *baseline_smooth=v_BaseLineSmooth; + found_baseline_smooth=true; + if (do_print) fprintf(stderr,"%32s (no other)\n", + "v_BaseLineSmooth"); +#if defined(__VFP_FP__) && !defined(__SOFTFP__) +#ifdef USE_NEON + if (CPUCaps & BA_NEON) { + *get_power_spectrum=vfp_GetPowerSpectrum; + found_get_power_spectrum=true; + if (do_print) fprintf(stderr,"%32s (CPU Caps)\n", + "vfp_GetPowerSpectrum"); + *chirp_data=neon_ChirpData; + found_chirp_data=true; + if (do_print) fprintf(stderr,"%32s (CPU Caps)\n", + "neon_ChirpData"); + } else +#endif + if (CPUCaps & BA_VFP) { + *get_power_spectrum=vfp_GetPowerSpectrum; + found_get_power_spectrum=true; + if (do_print) fprintf(stderr,"%32s (CPU Caps)\n", + "vfp_GetPowerSpectrum"); + *chirp_data=vfp_ChirpData; + found_chirp_data=true; + if (do_print) fprintf(stderr,"%32s (CPU Caps)\n", + "vfp_ChirpData"); + } else { +#endif + *get_power_spectrum=v_GetPowerSpectrum; + found_get_power_spectrum=true; + if (do_print) fprintf(stderr,"%32s (default)\n", + "v_GetPowerSpectrum"); + *chirp_data=v_ChirpData; + found_chirp_data=true; + if (do_print) fprintf(stderr,"%32s (default)\n", + "v_ChirpData"); +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + } +#endif + *transpose=v_Transpose4; + found_transpose=true; + if (do_print) fprintf(stderr,"%32s (default)\n", + "v_Transpose4"); +#if defined(__VFP_FP__) && !defined(__SOFTFP__) +#ifdef USE_NEON + if (CPUCaps & BA_NEON) { + CopyFoldSet(&Foldmain, &neonFoldMain); + found_folding=true; + if (do_print) fprintf(stderr,"%32s (CPU Caps)\n", + "opt NEON folding"); + } else +#endif + if (CPUCaps & BA_VFP) { + CopyFoldSet(&Foldmain, &vfpFoldMain); + found_folding=true; + if (do_print) fprintf(stderr,"%32s (CPU Caps)\n", + "opt VFP folding"); + } else { +#endif + CopyFoldSet(&Foldmain, &swifold); + found_folding=true; + if (do_print) fprintf(stderr,"%32s (default)\n", + "swifold"); +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + } +#endif + TestDur+=durtimer.stop(); + if (verbose>1) + fprintf(stderr,"%32s %8.2f seconds\n\n","Test duration",TestDur); + if (do_print) { + fflush(stderr); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return; + } +#endif + if (!found_baseline_smooth) { + *baseline_smooth=ChooseBaseLineSmooth(); + } else { + if (do_print) fprintf(stderr,"BaseLineSmooth retrieved from state file\n"); + *baseline_smooth=*BaseLineSmooth; + } + fflush(stderr); + if (!found_get_power_spectrum) { + *get_power_spectrum=ChooseGetPowerSpectrum(); + } else { + if (do_print) fprintf(stderr,"GetPowerSpectrum retrieved from state file\n"); + *get_power_spectrum=*GetPowerSpectrum; + } + fflush(stderr); + if (!found_chirp_data) { + *chirp_data=ChooseChirpData(); + } else { + if (do_print) fprintf(stderr,"ChirpData retrieved from state file\n"); + *chirp_data=*ChirpData; + } + fflush(stderr); + if (!found_transpose) { + *transpose=ChooseTranspose(); + } else { + if (do_print) fprintf(stderr,"Transpose retrieved from state file\n"); + *transpose=*Transpose; + } + fflush(stderr); + // ChooseFoldSubs is inconsistent in that it directly sets a global + // variable. Maybe we should make it consistent with the others + // at some point. --EK + if (!found_folding) { + ChooseFoldSubs(ChirpFftPairs, num_cfft, nsamples); + } else { + if (do_print) fprintf(stderr,"Folding Subs retrieved from state file\n"); + } + fflush(stderr); + TestDur+=durtimer.stop(); + if (verbose>1) + fprintf(stderr,"%32s %8.2f seconds\n\n","Test duration",TestDur); + } + + if (do_print) { + fflush(stderr); + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + diff --git a/client/vector/analyzeFuncs_vector.h b/client/vector/analyzeFuncs_vector.h new file mode 100644 index 0000000..49d1dd7 --- /dev/null +++ b/client/vector/analyzeFuncs_vector.h @@ -0,0 +1,398 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: analyzeFuncs_vector.h,v 1.1.2.9 2007/06/08 03:09:47 korpela Exp $ +#ifndef ANALYZEFUNCS_VECTOR_H +#define ANALYZEFUNCS_VECTOR_H + +#ifdef HAVE_CPU_FEATURES_H +#include +#endif + +#include "chirpfft.h" +#include "pulsefind.h" + +#define TWO_TO_52 4.503599627370496e15 +// 2^52+2^51 recommended by AMD optimization manual, scaled to 2^64+2^63 for X87 +#define ROUNDX87 6755399441055744.0 * 2048.0 + +// Flemming Pedersen (CERN) SinCos polynomial coefficients +#define FS1 1.5707963267948966 +#define FS2 -0.64596348437163809 +#define FS3 0.079679708649230657 +#define FS4 -0.0046002309092153379 +#define FC1 -1.2336979844380824 +#define FC2 0.25360671639164339 +#define FC3 -0.020427240364907607 + + +typedef int (*BaseLineSmooth_func)(sah_complex *, int, int, int); +typedef int (*GetPowerSpectrum_func)(sah_complex *, float*, int); +typedef int (*ChirpData_func)(sah_complex *, sah_complex *, int, double, int, double); +typedef int (*Transpose_func)(int, int , float *, float *); + +struct BLStb { + BaseLineSmooth_func func; + int ba; + const char * const nom; +}; + +extern const int num_BLS; +extern bool found_baseline_smooth; + +extern BLStb BaseLineSmoothFuncs[]; + +struct GPStb { + GetPowerSpectrum_func func; + int ba; + const char * const nom; +}; + +extern const int num_GPS; +extern bool found_get_power_spectrum; + +extern GPStb GetPowerSpectrumFuncs[]; + +struct CDtb { + ChirpData_func func; + int ba; + const char * const nom; +}; + +extern const int num_CD; +extern bool found_chirp_data; + +extern CDtb ChirpDataFuncs[]; + +struct TPtb { + Transpose_func func; + int ba; + const char * const nom; +}; + +extern const int num_TP; +extern bool found_transpose; + +extern TPtb TransposeFuncs[]; + +struct FolSub { + FoldSet *fsp; + int ba; +}; + +extern FolSub FoldSubs[]; + +extern const int num_FS; +extern bool found_folding; + +extern void ChooseFunctions( + BaseLineSmooth_func *, + GetPowerSpectrum_func *, + ChirpData_func *, + Transpose_func *, + ChirpFftPair_t * ChirpFftPairs, + int num_cfft, + int nsamples, + bool print_choice); + +#if defined(__i386__) || defined(__x86_64__) || defined(USE_SSE) +extern double fastfrac( double val, double returnVal) +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 3)) + __attribute__ ((__optimize__ ("-fno-fast-math"))); +#define SUPPORTS_ATTRIB_OPT 1 +#else + ; +#undef SUPPORTS_ATTRIB_OPT +#endif +#endif + +extern int v_vBaseLineSmooth( + sah_complex * cx_DataIn, + int ul_NumDataPoints, + int ul_BoxCarLength, + int ul_TimeLength + ); + +extern int v_vGetPowerSpectrum( + sah_complex * cx_FreqData, + float * fp_PowerSpectrum, + int ul_NumDataPoints + ); + +extern int v_vChirpData( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +extern int fpu_ChirpData ( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate +); +extern int fpu_opt_ChirpData ( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate +); +#if defined(__i386__) || defined(__x86_64__) || defined(USE_SSE) +extern int v_vChirpData_x86_64( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +extern int sse1_ChirpData_ak( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +extern int sse1_ChirpData_ak8e( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +extern int sse1_ChirpData_ak8h( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +extern int sse2_ChirpData_ak( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +extern int sse2_ChirpData_ak8( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +extern int sse3_ChirpData_ak( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +extern int sse3_ChirpData_ak8( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +#endif + +extern int v_vTranspose(int i, int j, float *in, float *out); +#if defined(__i386__) || defined(__x86_64__) || defined(USE_SSE) || \ + (defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)) || defined(__aarch64__) +extern int v_pfTranspose2(int i, int j, float *in, float *out); +extern int v_pfTranspose4(int i, int j, float *in, float *out); +extern int v_pfTranspose8(int i, int j, float *in, float *out); +#endif +#if defined(__i386__) || defined(__x86_64__) || defined(USE_SSE) +extern int v_vTranspose4(int i, int j, float *in, float *out); +extern int v_vTranspose4np(int i, int j, float *in, float *out); +extern int v_vTranspose4ntw(int i, int j, float *in, float *out); +extern int v_vTranspose4x8ntw(int i, int j, float *in, float *out); +extern int v_vTranspose4x16ntw(int i, int j, float *in, float *out); +extern int v_vpfTranspose8x4ntw(int i, int j, float *in, float *out); +#endif +#if (defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)) || defined(__aarch64__) +extern int v_vfpTranspose2(int i, int j, float *in, float *out); +#endif +#ifdef USE_FFTWF +extern int fftwf_transpose(int i, int j, float *in, float *out); +#endif + + +#if defined(__i386__) || defined(__x86_64__) || defined(USE_SSE) +extern int v_vGetPowerSpectrumUnrolled( + sah_complex * cx_FreqData, + float * fp_PowerSpectrum, + int ul_NumDataPoints + ); +extern int v_vGetPowerSpectrum2( + sah_complex * cx_FreqData, + float * fp_PowerSpectrum, + int ul_NumDataPoints + ); +extern int v_vGetPowerSpectrumUnrolled2( + sah_complex * cx_FreqData, + float * fp_PowerSpectrum, + int ul_NumDataPoints + ); +#endif + +#ifdef USE_ALTIVEC +extern int v_vGetPowerSpectrumG4( + sah_complex * cx_FreqData, + float * fp_PowerSpectrum, + int ul_NumDataPoints + ); + + +extern int v_vChirpDataG4( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); + +extern int v_vChirpDataG5( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +#endif + +#if defined(__x86_64__) || defined(_M_AMD64) +extern int v_vChirpData_x86_64( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate + ); +#endif + +#if defined(USE_AVX) +extern int avxSupported(void); + +extern int avx_ChirpData_a( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + const double chirp_rate, + int ul_NumDataPoints, + const double sample_rate +); +extern int avx_ChirpData_b( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + const double chirp_rate, + int ul_NumDataPoints, + const double sample_rate +); +extern int avx_ChirpData_c( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + const double chirp_rate, + int ul_NumDataPoints, + const double sample_rate +); +extern int avx_ChirpData_d( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int chirp_rate_ind, + const double chirp_rate, + int ul_NumDataPoints, + const double sample_rate +); +extern int v_avxTranspose4x8ntw(int x, int y, float *in, float *out); +extern int v_avxTranspose4x16ntw(int x, int y, float *in, float *out); +extern int v_avxTranspose8x4ntw(int x, int y, float *in, float *out); +extern int v_avxTranspose8x8ntw_a(int x, int y, float *in, float *out); +extern int v_avxTranspose8x8ntw_b(int x,int y, float *in, float *out +); +extern int v_avxGetPowerSpectrum( + sah_complex* FreqData, + float* PowerSpectrum, + int NumDataPoints +); +#endif + +#if (defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)) || defined(__aarch64__) +#ifdef USE_NEON +extern int neon_GetPowerSpectrum( + sah_complex * cx_FreqData, + float * fp_PowerSpectrum, + int ul_NumDataPoints + ); +#endif +extern int vfp_GetPowerSpectrum( + sah_complex * cx_FreqData, + float * fp_PowerSpectrum, + int ul_NumDataPoints + ); + +extern int vfp_ChirpData ( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate +); +#ifdef USE_NEON +extern int neon_ChirpData ( + sah_complex * cx_DataArray, + sah_complex * cx_ChirpDataArray, + int ChirpRateInd, + double ChirpRate, + int ul_NumDataPoints, + double sample_rate +); +#endif +#endif + +#endif diff --git a/client/vector/analyzeFuncs_vfp.S b/client/vector/analyzeFuncs_vfp.S new file mode 100644 index 0000000..0fb5bc7 --- /dev/null +++ b/client/vector/analyzeFuncs_vfp.S @@ -0,0 +1,2255 @@ +// Copyright (c) 1999-2011 Regents of the University of California +// +// FFTW: Copyright (c) 2003,2006 Matteo Frigo +// Copyright (c) 2003,2006 Massachusets Institute of Technology +// +// fft8g.[cpp,h]: Copyright (c) 1995-2001 Takya Ooura +// +// ASMLIB: Copyright (c) 2004 Agner Fog + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any later +// version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions +// as an alternative to FFTW and distribute a linked executable and +// source code. You must obey the GNU General Public License in all +// respects for all of the code used other than the FFT library itself. +// Any modification required to support these libraries must be distributed +// under the terms of this license. If you modify this program, you may extend +// this exception to your version of the program, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. Please be aware that FFTW and ASMLIB are not covered by +// this exception, therefore you may not use FFTW and ASMLIB in any derivative +// work so modified without permission of the authors of those packages. + +#ifdef __arm__ +/* + * vfp_ChirpData.S + * Author: Mateusz Szpakowski + */ + +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + .syntax unified +#endif + .arch armv6 + .fpu vfp +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + .eabi_attribute 27, 3 + .eabi_attribute 28, 1 +#endif + +/* + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 +*/ + .eabi_attribute 23, 1 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 2 + .eabi_attribute 30, 2 + .eabi_attribute 18, 4 + .text + .align 2 +.Lhalfd: + .double 0.5 +.LroundVal: + .double 4503599627370496.0 +.Linc8d: + .double 0,1,2,3,4,5,6,7 +.Lsincosapprox: + .float 1.5707963268,-0.6466386396,0.0679105987,-0.0011573807 // sine + .float 1.0,-1.2341299769,0.2465220241,-0.0123926179 // cosine + + .align 2 + .global _Z13vfp_ChirpDataPA2_fS0_idid + .type _Z13vfp_ChirpDataPA2_fS0_idid, %function +_Z13vfp_ChirpDataPA2_fS0_idid: + push {r4,r5,r6,r7,r8,r9,lr} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} +#ifdef ANDROID +#define stargidx (24+64) + /* r0 - input data + * r1 - output data + * r2 - chirprateind + * sp[0-1] - chirp_rate + * sp[2] - numDataPoints + * sp[4-5] - sample_rate + */ +#else //R: armhf pass params in registers instead + /* r0 - input data + * r1 - output data + * r2 - chirprateind + * d0 - chirp_rate + * r3 - numDataPoints (stored in r9 for function lifetime) + * d1 - sample_rate + */ + + mov r9,r3 + vmov.f64 d9,d0 + vmov.f64 d10,d1 +#endif + + tst r2,r2 + bne .Lrealfunc + mov r3,r0 // swap addresses + mov r0,r1 + mov r1,r3 +#ifdef ANDROID + ldr r2,[sp,#stargidx+8] // numDataPoints +#else + mov r2,r9 +#endif + lsl r2,r2,#3 + bl memcpy(PLT) + b .Lendoffunc + /* + * real functions + */ +.Lrealfunc: + ldr r4,.LGOT1 +.LPIC1: + add r4,pc,r4 + ldr r5,.LGOT1+4 + ldr r5,[r4,r5] +#ifdef ANDROID + ldr r3,[sp,#stargidx+8] // numDataPoints +#else + mov r3,r9 +#endif + add r6,r3,r3,lsl #1 + lsl r6,r6,#2 + fldd d0,[r5,#32] + fmsr s4,r6 + fuitod d1,s4 + faddd d0,d0,d1 + fstd d0,[r5,#32] + + add r3,r0,r3,lsl #3 + sub r3,r3,#8*7 + + fldd d11,.Lhalfd +#ifdef ANDROID + fldd d9,[sp,#stargidx] // chirp_rate + fldd d10,[sp,#stargidx+16] // sample_rate +#endif //R: for armhf d9 and d10 already loaded + + fmuld d10,d10,d10 + fmuld d9,d9,d11 + fdivd d9,d9,d10 + + fldd d10,.LroundVal + fsubd d11,d11,d11 // zero + fcmpd d9,d11 + fmstat + fnegdmi d10,d10 // negate is negative srate + + sub sp,sp,#24+32+8 + add r7,sp,#24 + fstmiad sp,{d9,d10} + + mov r4,#0 // i + + adr r5,.Linc8d + adr r6,.Lsincosapprox + adr r8,.Lsincosapprox+4*4 + + cmp r0,r3 + bhs .Lendmainloop +.Lmainloop: + fmsr s24,r4 + fuitod d8,s24 + fldmiad r5,{d0,d1,d2,d3,d4,d5,d6,d7} + fldmiad sp,{d9,d10} + faddd d0,d0,d8 + faddd d1,d1,d8 + faddd d2,d2,d8 + faddd d3,d3,d8 + faddd d4,d4,d8 + faddd d5,d5,d8 + faddd d6,d6,d8 + faddd d7,d7,d8 + // square of i + fmuld d0,d0,d0 + fmuld d1,d1,d1 + fmuld d2,d2,d2 + fmuld d3,d3,d3 + fmuld d4,d4,d4 + fmuld d5,d5,d5 + fmuld d6,d6,d6 + fmuld d7,d7,d7 + // multiply by srate + fmuld d0,d0,d9 + fmuld d1,d1,d9 + fmuld d2,d2,d9 + fmuld d3,d3,d9 + fmuld d4,d4,d9 + fmuld d5,d5,d9 + fmuld d6,d6,d9 + fmuld d7,d7,d9 + + // rounding to -0.5/+0.5 + faddd d12,d0,d10 + faddd d13,d1,d10 + faddd d14,d2,d10 + faddd d15,d3,d10 + fsubd d12,d12,d10 + fsubd d13,d13,d10 + fsubd d14,d14,d10 + fsubd d15,d15,d10 + fsubd d0,d0,d12 + fsubd d1,d1,d13 + fsubd d2,d2,d14 + fsubd d3,d3,d15 + // second half of xxxx + faddd d12,d4,d10 + faddd d13,d5,d10 + faddd d14,d6,d10 + faddd d15,d7,d10 + fsubd d12,d12,d10 + fsubd d13,d13,d10 + fsubd d14,d14,d10 + fsubd d15,d15,d10 + fsubd d4,d4,d12 + fsubd d5,d5,d13 + fsubd d6,d6,d14 + fsubd d7,d7,d15 + // to single precision + fcvtsd s24,d0 + fcvtsd s25,d1 + fcvtsd s26,d2 + fcvtsd s27,d3 + fcvtsd s28,d4 + fcvtsd s29,d5 + fcvtsd s30,d6 + fcvtsd s31,d7 + + fldmias r6,{s16,s17,s18,s19} + // square of y + fmuls s0,s24,s24 + fmuls s1,s25,s25 + fmuls s2,s26,s26 + fmuls s3,s27,s27 + fmuls s4,s28,s28 + fmuls s5,s29,s29 + fmuls s6,s30,s30 + fmuls s7,s31,s31 + // sine + fmuls s8,s0,s19 + fmuls s9,s1,s19 + fmuls s10,s2,s19 + fmuls s11,s3,s19 + fmuls s12,s4,s19 + fmuls s13,s5,s19 + fmuls s14,s6,s19 + fmuls s15,s7,s19 + fadds s8,s8,s18 + fadds s9,s9,s18 + fadds s10,s10,s18 + fadds s11,s11,s18 + fadds s12,s12,s18 + fadds s13,s13,s18 + fadds s14,s14,s18 + fadds s15,s15,s18 + fmuls s8,s8,s0 + fmuls s9,s9,s1 + fmuls s10,s10,s2 + fmuls s11,s11,s3 + fmuls s12,s12,s4 + fmuls s13,s13,s5 + fmuls s14,s14,s6 + fmuls s15,s15,s7 + fadds s8,s8,s17 + fadds s9,s9,s17 + fadds s10,s10,s17 + fadds s11,s11,s17 + fadds s12,s12,s17 + fadds s13,s13,s17 + fadds s14,s14,s17 + fadds s15,s15,s17 + fmuls s8,s8,s0 + fmuls s9,s9,s1 + fmuls s10,s10,s2 + fmuls s11,s11,s3 + fmuls s12,s12,s4 + fmuls s13,s13,s5 + fmuls s14,s14,s6 + fmuls s15,s15,s7 + fadds s8,s8,s16 + fadds s9,s9,s16 + fadds s10,s10,s16 + fadds s11,s11,s16 + fadds s12,s12,s16 + fadds s13,s13,s16 + fadds s14,s14,s16 + fadds s15,s15,s16 + fmuls s8,s8,s24 + fmuls s9,s9,s25 + fmuls s10,s10,s26 + fmuls s11,s11,s27 + fmuls s12,s12,s28 + fmuls s13,s13,s29 + fmuls s14,s14,s30 + fmuls s15,s15,s31 + fldmias r8,{s24,s25,s26,s27} + // cosine + fmuls s16,s0,s27 + fmuls s17,s1,s27 + fmuls s18,s2,s27 + fmuls s19,s3,s27 + fmuls s20,s4,s27 + fmuls s21,s5,s27 + fmuls s22,s6,s27 + fmuls s23,s7,s27 + fadds s16,s16,s26 + fadds s17,s17,s26 + fadds s18,s18,s26 + fadds s19,s19,s26 + fadds s20,s20,s26 + fadds s21,s21,s26 + fadds s22,s22,s26 + fadds s23,s23,s26 + fmuls s16,s16,s0 + fmuls s17,s17,s1 + fmuls s18,s18,s2 + fmuls s19,s19,s3 + fmuls s20,s20,s4 + fmuls s21,s21,s5 + fmuls s22,s22,s6 + fmuls s23,s23,s7 + fadds s16,s16,s25 + fadds s17,s17,s25 + fadds s18,s18,s25 + fadds s19,s19,s25 + fadds s20,s20,s25 + fadds s21,s21,s25 + fadds s22,s22,s25 + fadds s23,s23,s25 + fmuls s16,s16,s0 + fmuls s17,s17,s1 + fmuls s18,s18,s2 + fmuls s19,s19,s3 + fmuls s20,s20,s4 + fmuls s21,s21,s5 + fmuls s22,s22,s6 + fmuls s23,s23,s7 + fadds s16,s16,s24 + fadds s17,s17,s24 + fadds s18,s18,s24 + fadds s19,s19,s24 + fadds s20,s20,s24 + fadds s21,s21,s24 + fadds s22,s22,s24 + fadds s23,s23,s24 + // load sine + // doubling cosine/sine + fmuls s0,s8,s16 // c*s + fmuls s1,s9,s17 + fmuls s2,s10,s18 + fmuls s3,s11,s19 + fmuls s4,s12,s20 + fmuls s5,s13,s21 + fmuls s6,s14,s22 + fmuls s7,s15,s23 + fmuls s16,s16,s16 // c*c + fmuls s17,s17,s17 + fmuls s18,s18,s18 + fmuls s19,s19,s19 + fmuls s20,s20,s20 + fmuls s21,s21,s21 + fmuls s22,s22,s22 + fmuls s23,s23,s23 + fnmacs s16,s8,s8 // c*c-s*s = x + fnmacs s17,s9,s9 + fnmacs s18,s10,s10 + fnmacs s19,s11,s11 + fnmacs s20,s12,s12 + fnmacs s21,s13,s13 + fnmacs s22,s14,s14 + fnmacs s23,s15,s15 + fadds s0,s0,s0 // 2*s*c = y + fadds s1,s1,s1 + fadds s2,s2,s2 + fadds s3,s3,s3 + fadds s4,s4,s4 + fadds s5,s5,s5 + fadds s6,s6,s6 + fadds s7,s7,s7 + fmuls s8,s0,s16 // cd1 = x*y + fmuls s9,s1,s17 + fmuls s10,s2,s18 + fmuls s11,s3,s19 + fmuls s12,s4,s20 + fmuls s13,s5,s21 + fmuls s14,s6,s22 + fmuls s15,s7,s23 + fmuls s0,s0,s0 // cd3 = y*y + fmuls s1,s1,s1 + fmuls s2,s2,s2 + fmuls s3,s3,s3 + fmuls s4,s4,s4 + fmuls s5,s5,s5 + fmuls s6,s6,s6 + fmuls s7,s7,s7 + fmuls s24,s16,s16 // cd2 = x*x + fmuls s25,s17,s17 + fmuls s26,s18,s18 + fmuls s27,s19,s19 + fmuls s28,s20,s20 + fmuls s29,s21,s21 + fmuls s30,s22,s22 + fmuls s31,s23,s23 + fadds s24,s24,s0 // norm = x*x+y*y + fadds s25,s25,s1 + fadds s26,s26,s2 + fadds s27,s27,s3 + fadds s28,s28,s4 + fadds s29,s29,s5 + fadds s30,s30,s6 + fadds s31,s31,s7 + fmscs s0,s16,s16 // c = x*x-y*y + fmscs s1,s17,s17 + fmscs s2,s18,s18 + fmscs s3,s19,s19 + fmscs s4,s20,s20 + fmscs s5,s21,s21 + fmscs s6,s22,s22 + fmscs s7,s23,s23 + fadds s16,s8,s8 // s = 2*x*y + fadds s17,s9,s9 + fadds s18,s10,s10 + fadds s19,s11,s11 + fadds s20,s12,s12 + fadds s21,s13,s13 + fadds s22,s14,s14 + fadds s23,s15,s15 + fsts s7,[sp,#24+64] + flds s7,.Ltwos + fstmias r7,{s16,s17,s18,s19,s20,s21,s22,s23} + // reciprocal of magnitude + // iter 1: invmag = 2.0-mag + fsubs s8,s7,s24 + fsubs s9,s7,s25 + fsubs s10,s7,s26 + fsubs s11,s7,s27 + fsubs s12,s7,s28 + fsubs s13,s7,s29 + fsubs s14,s7,s30 + fsubs s15,s7,s31 + // iter 2: invmag = invmag*(2.0-mag*invmag) + fmuls s16,s8,s24 + fmuls s17,s9,s25 + fmuls s18,s10,s26 + fmuls s19,s11,s27 + fmuls s20,s12,s28 + fmuls s21,s13,s29 + fmuls s22,s14,s30 + fmuls s23,s15,s31 + fsubs s16,s7,s16 + fsubs s17,s7,s17 + fsubs s18,s7,s18 + fsubs s19,s7,s19 + fsubs s20,s7,s20 + fsubs s21,s7,s21 + fsubs s22,s7,s22 + fsubs s23,s7,s23 + fmuls s8,s16,s8 + fmuls s9,s17,s9 + fmuls s10,s18,s10 + fmuls s11,s19,s11 + fmuls s12,s20,s12 + fmuls s13,s21,s13 + fmuls s14,s22,s14 + fmuls s15,s23,s15 + // iter 3: invmag = invmag*(2.0-mag*invmag) + fmuls s16,s8,s24 + fmuls s17,s9,s25 + fmuls s18,s10,s26 + fmuls s19,s11,s27 + fmuls s20,s12,s28 + fmuls s21,s13,s29 + fmuls s22,s14,s30 + fmuls s23,s15,s31 + fsubs s16,s7,s16 + fsubs s17,s7,s17 + fsubs s18,s7,s18 + fsubs s19,s7,s19 + fsubs s20,s7,s20 + fsubs s21,s7,s21 + fsubs s22,s7,s22 + fsubs s23,s7,s23 + fmuls s8,s16,s8 + fmuls s9,s17,s9 + fmuls s10,s18,s10 + fmuls s11,s19,s11 + fmuls s12,s20,s12 + fmuls s13,s21,s13 + fmuls s14,s22,s14 + fmuls s15,s23,s15 + // restore sine values + fldmias r7,{s16,s17,s18,s19,s20,s21,s22,s23} + // correct cosine/sine + flds s7,[sp,#24+64] + fmuls s0,s0,s8 + fmuls s1,s1,s9 + fmuls s2,s2,s10 + fmuls s3,s3,s11 + fmuls s4,s4,s12 + fmuls s5,s5,s13 + fmuls s6,s6,s14 + fmuls s7,s7,s15 + fmuls s16,s16,s8 + fmuls s17,s17,s9 + fmuls s18,s18,s10 + fmuls s19,s19,s11 + fmuls s20,s20,s12 + fmuls s21,s21,s13 + fmuls s22,s22,s14 + fmuls s23,s23,s15 + pld [r0,#128] + // multiply by data + fldmias r0!,{s8,s9,s10,s11,s12,s13,s14,s15} + fmuls s24,s8,s0 + fmuls s25,s9,s0 + fmuls s26,s10,s1 + fmuls s27,s11,s1 + fmuls s28,s12,s2 + fmuls s29,s13,s2 + fmuls s30,s14,s3 + fmuls s31,s15,s3 + fnmacs s24,s9,s16 + fmacs s25,s8,s16 + fnmacs s26,s11,s17 + fmacs s27,s10,s17 + fnmacs s28,s13,s18 + fmacs s29,s12,s18 + fnmacs s30,s15,s19 + fmacs s31,s14,s19 + fstmias r1!,{s24,s25,s26,s27,s28,s29,s30,s31} + pld [r0,#128] + fldmias r0!,{s8,s9,s10,s11,s12,s13,s14,s15} + fmuls s24,s8,s4 + fmuls s25,s9,s4 + fmuls s26,s10,s5 + fmuls s27,s11,s5 + fmuls s28,s12,s6 + fmuls s29,s13,s6 + fmuls s30,s14,s7 + fmuls s31,s15,s7 + fnmacs s24,s9,s20 + fmacs s25,s8,s20 + fnmacs s26,s11,s21 + fmacs s27,s10,s21 + fnmacs s28,s13,s22 + fmacs s29,s12,s22 + fnmacs s30,s15,s23 + fmacs s31,s14,s23 + fstmias r1!,{s24,s25,s26,s27,s28,s29,s30,s31} + + add r4,r4,#8 + cmp r0,r3 + blo .Lmainloop +.Lendmainloop: + add r3,r3,#8*7 + cmp r0,r3 + bhs .Lendsmallloop +.Lsmallloop: + fmsr s24,r4 + fldmiad sp,{d9,d10} + fuitod d0,s24 + // square of i + fmuld d0,d0,d0 + // multiply by srate + fmuld d0,d0,d9 + // rounding to -0.5/+0.5 + faddd d12,d0,d10 + fsubd d12,d12,d10 + fsubd d0,d0,d12 + fcvtsd s24,d0 + + fldmias r6,{s8,s9,s10,s11,s12,s13,s14,s15} + // square of y + fmuls s0,s24,s24 + // sine/cosine + fmuls s16,s0,s11 + fmuls s17,s0,s15 + fadds s16,s16,s10 + fadds s17,s17,s14 + fmuls s16,s16,s0 + fmuls s17,s17,s0 + fadds s16,s16,s9 + fadds s17,s17,s13 + fmuls s16,s16,s0 + fmuls s17,s17,s0 + fadds s16,s16,s8 + fadds s17,s17,s12 // s16 - sine + fmuls s16,s16,s24 // s17 - cosine + // doubling cosine/sine + fmuls s18,s16,s17 + fmuls s19,s16,s16 + fmuls s20,s17,s17 + fadds s18,s18,s18 // y=2*s*c + fsubs s19,s20,s19 // x=c*c-s*s + fmuls s21,s18,s19 // cd1 + fmuls s22,s19,s19 // cd2 + fmuls s23,s18,s18 // cd3 + fsubs s8,s22,s23 // c + fadds s9,s21,s21 // s + // compute 1.0/norm + fadds s10,s22,s23 // mag + // reciprocal + flds s11,.Ltwos + // iter1: invmag = 2.0-mag + fsubs s12,s11,s10 + // iter2: invmag = invmag*(2.0-invmag*mag) + fmuls s13,s12,s10 + fsubs s13,s11,s13 + fmuls s12,s12,s13 + // correct cosine/sine + fmuls s8,s8,s12 + fmuls s9,s9,s12 + // multiply data + fldmias r0!,{s14,s15} + fmuls s6,s14,s8 + fmuls s7,s14,s9 + fnmacs s6,s15,s9 + fmacs s7,s15,s8 + fstmias r1!,{s6,s7} + + add r4,r4,#1 + cmp r0,r3 + blo .Lsmallloop +.Lendsmallloop: + add sp,sp,#24+32+8 +.Lendoffunc: + mov r0,#0 + vpop {d8,d9,d10,d11,d12,d13,d14,d15} + pop {r4,r5,r6,r7,r8,r9,lr} + bx lr + + .align 2 +.LGOT1: + .word _GLOBAL_OFFSET_TABLE_-(.LPIC1+8) + .word analysis_state(GOT) +.Ltwos: + .float 2.0 +/* + * vfp_FoldSubs.S + * Author: Mateusz Szpakowski + */ + + .align 2 + /***** + * fold array by 3 + ******/ +.Lzeros: + .float 0.0,0.0 + + .global vfp_foldArrayBy3_ll31 + .type vfp_foldArrayBy3_ll31, %function +vfp_foldArrayBy3_ll31: + push {r4,r5,r6,lr} + vpush {d8,d9,d10,d11,d12} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + ldrd r4,[r1] // di,dest + add r6,r0,r4,lsl #2 // end + + fldd d12,.Lzeros + sub r6,r6,#4*7 + cmp r0,r6 + bhs .Lendf3loop2 +.Lf3loop2: +.macro FOLDBY3_CORE + fldmias r0!,{s0,s1,s2,s3,s4,s5,s6,s7} + fldmias r2!,{s8,s9,s10,s11,s12,s13,s14,s15} + fldmias r3!,{s16,s17,s18,s19,s20,s21,s22,s23} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s6,s6,s14 + fadds s7,s7,s15 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fadds s7,s7,s23 + fstmias r5!,{s0,s1,s2,s3,s4,s5,s6,s7} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcmpes s24,s6 + fcpysmi s25,s5 + fmstat + fcmpes s25,s7 + fcpysmi s24,s6 + fmstat + fcpysmi s25,s7 +.endm + FOLDBY3_CORE + + cmp r0,r6 + blo .Lf3loop2 +.Lendf3loop2: + and r4,r4,#7 + cmp r4,#4 + blo .Lf3lt4 + beq .Lf3eq4 + + cmp r4,#6 + blo .Lf3lt6 + beq .Lf3eq6 + + fldmias r0!,{s0,s1,s2,s3,s4,s5,s6} + fldmias r2!,{s8,s9,s10,s11,s12,s13,s14} + fldmias r3!,{s16,s17,s18,s19,s20,s21,s22} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s6,s6,s14 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fstmias r5!,{s0,s1,s2,s3,s4,s5,s6} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcmpes s24,s6 + fcpysmi s25,s5 + fmstat + fcpysmi s24,s6 + b .Lf3end +.Lf3eq6: + fldmias r0!,{s0,s1,s2,s3,s4,s5} + fldmias r2!,{s8,s9,s10,s11,s12,s13} + fldmias r3!,{s16,s17,s18,s19,s20,s21} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fadds s5,s5,s21 + fstmias r5!,{s0,s1,s2,s3,s4,s5} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcpysmi s25,s5 + b .Lf3end +.Lf3lt6: + fldmias r0!,{s0,s1,s2,s3,s4} + fldmias r2!,{s8,s9,s10,s11,s12} + fldmias r3!,{s16,s17,s18,s19,s20} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fstmias r5!,{s0,s1,s2,s3,s4} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcpysmi s24,s4 + b .Lf3end +.Lf3eq4: + fldmias r0!,{s0,s1,s2,s3} + fldmias r2!,{s8,s9,s10,s11} + fldmias r3!,{s16,s17,s18,s19} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fstmias r5!,{s0,s1,s2,s3} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcpysmi s25,s3 + b .Lf3end +.Lf3lt4: + cmp r4,#2 + blo .Lf3lt2 + beq .Lf3eq2 + + fldmias r0!,{s0,s1,s2} + fldmias r2!,{s8,s9,s10} + fldmias r3!,{s16,s17,s18} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fstmias r5!,{s0,s1,s2} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcpysmi s24,s2 + b .Lf3end +.Lf3eq2: + fldmias r0!,{s0,s1} + fldmias r2!,{s8,s9} + fldmias r3!,{s16,s17} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s0,s0,s16 + fadds s1,s1,s17 + fstmias r5!,{s0,s1} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcpysmi s25,s1 + b .Lf3end +.Lf3lt2: + cmp r4,#0 + beq .Lf3eq0 + fldmias r0!,{s0} + fldmias r2!,{s1} + fldmias r3!,{s2} + + fadds s0,s0,s1 + fadds s0,s0,s2 + fstmias r5!,{s0} + + fcmpes s24,s0 + fmstat + fcpysmi s24,s0 +.Lf3eq0: + +.Lf3end: + fcmpes s24,s25 + fmstat + fcpysmi s24,s25 + + fmrs r0,s24 + vpop {d8,d9,d10,d11,d12} + pop {r4,r5,r6,lr} + bx lr + +.Lzeros1: + .float 0.0,0.0 + + .global vfp_foldArrayBy3_lge31 + .type vfp_foldArrayBy3_lge31, %function +vfp_foldArrayBy3_lge31: + push {r4,r5,r6,lr} + vpush {d8,d9,d10,d11,d12} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + ldrd r4,[r1] // di,dest + add r6,r0,r4,lsl #2 // end + + fldd d12,.Lzeros1 + sub r6,r6,#4*31 + cmp r0,r6 + bhs .Lendf3loop4 +.Lf3loop4: + FOLDBY3_CORE + FOLDBY3_CORE + FOLDBY3_CORE + FOLDBY3_CORE + + cmp r0,r6 + blo .Lf3loop4 +.Lendf3loop4: + add r6,r6,#4*24 + cmp r0,r6 + bhs .Lendf3loop2 +.Lf3loop5: + FOLDBY3_CORE + + cmp r0,r6 + blo .Lf3loop5 +.Lendf3loop5: + b .Lendf3loop2 + +.Lfoldby3sel: +.rept 31 + .word vfp_foldArrayBy3_ll31 +.endr + .word vfp_foldArrayBy3_lge31 + +.Lzeros2: + .float 0.0,0.0 + /***** + * fold array by 4 + ******/ + .global vfp_foldArrayBy4_ll31 + .type vfp_foldArrayBy4_ll31, %function +vfp_foldArrayBy4_ll31: + push {r4,r5,r6,r7,r8,lr} + vpush {d8,d9,d10,d11,d12} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + ldr r6,[r1,#16] // tmp2 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + add r6,r0,r6,lsl #2 + ldrd r4,[r1] // di,dest + add r7,r0,r4,lsl #2 // end + + fldd d12,.Lzeros2 + sub r7,r7,#4*7 + cmp r0,r7 + bhs .Lendf4loop2 +.Lf4loop2: +.macro FOLDBY4_CORE + fldmias r0!,{s0,s1,s2,s3,s4,s5,s6,s7} + fldmias r2!,{s8,s9,s10,s11,s12,s13,s14,s15} + fldmias r3!,{s16,s17,s18,s19,s20,s21,s22,s23} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s6,s6,s14 + fadds s7,s7,s15 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fldmias r6!,{s8,s9,s10,s11,s12,s13,s14,s15} + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fadds s7,s7,s23 + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s6,s6,s14 + fadds s7,s7,s15 + + fstmias r5!,{s0,s1,s2,s3,s4,s5,s6,s7} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcmpes s24,s6 + fcpysmi s25,s5 + fmstat + fcmpes s25,s7 + fcpysmi s24,s6 + fmstat + fcpysmi s25,s7 +.endm + FOLDBY4_CORE + + cmp r0,r7 + blo .Lf4loop2 +.Lendf4loop2: + and r4,r4,#7 + cmp r4,#4 + blo .Lf4lt4 + beq .Lf4eq4 + + cmp r4,#6 + blo .Lf4lt6 + beq .Lf4eq6 + + fldmias r0!,{s0,s1,s2,s3,s4,s5,s6} + fldmias r2!,{s8,s9,s10,s11,s12,s13,s14} + fldmias r3!,{s16,s17,s18,s19,s20,s21,s22} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s6,s6,s14 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fldmias r6!,{s16,s17,s18,s19,s20,s21,s22} + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fstmias r5!,{s0,s1,s2,s3,s4,s5,s6} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcmpes s24,s6 + fcpysmi s25,s5 + fmstat + fcpysmi s24,s6 + b .Lf4end +.Lf4eq6: + fldmias r0!,{s0,s1,s2,s3,s4,s5} + fldmias r2!,{s6,s7,s8,s9,s10,s11} + fldmias r3!,{s12,s13,s14,s15,s16,s17} + fldmias r6!,{s18,s19,s20,s21,s22,s23} + + fadds s0,s0,s6 + fadds s1,s1,s7 + fadds s2,s2,s8 + fadds s3,s3,s9 + fadds s4,s4,s10 + fadds s5,s5,s11 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s2,s2,s14 + fadds s3,s3,s15 + fadds s4,s4,s16 + fadds s5,s5,s17 + fadds s0,s0,s18 + fadds s1,s1,s19 + fadds s2,s2,s20 + fadds s3,s3,s21 + fadds s4,s4,s22 + fadds s5,s5,s23 + fstmias r5!,{s0,s1,s2,s3,s4,s5} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcpysmi s25,s5 + b .Lf4end +.Lf4lt6: + fldmias r0!,{s0,s1,s2,s3,s4} + fldmias r2!,{s6,s7,s8,s9,s10} + fldmias r3!,{s12,s13,s14,s15,s16} + fldmias r6!,{s18,s19,s20,s21,s22} + + fadds s0,s0,s6 + fadds s1,s1,s7 + fadds s2,s2,s8 + fadds s3,s3,s9 + fadds s4,s4,s10 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s2,s2,s14 + fadds s3,s3,s15 + fadds s4,s4,s16 + fadds s0,s0,s18 + fadds s1,s1,s19 + fadds s2,s2,s20 + fadds s3,s3,s21 + fadds s4,s4,s22 + fstmias r5!,{s0,s1,s2,s3,s4} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcpysmi s24,s4 + b .Lf4end +.Lf4eq4: + fldmias r0!,{s0,s1,s2,s3} + fldmias r2!,{s6,s7,s8,s9} + fldmias r3!,{s12,s13,s14,s15} + fldmias r6!,{s18,s19,s20,s21} + + fadds s0,s0,s6 + fadds s1,s1,s7 + fadds s2,s2,s8 + fadds s3,s3,s9 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s2,s2,s14 + fadds s3,s3,s15 + fadds s0,s0,s18 + fadds s1,s1,s19 + fadds s2,s2,s20 + fadds s3,s3,s21 + fstmias r5!,{s0,s1,s2,s3} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcpysmi s25,s3 + b .Lf4end +.Lf4lt4: + cmp r4,#2 + blo .Lf4lt2 + beq .Lf4eq2 + + fldmias r0!,{s0,s1,s2} + fldmias r2!,{s6,s7,s8} + fldmias r3!,{s12,s13,s14} + fldmias r6!,{s18,s19,s20} + + fadds s0,s0,s6 + fadds s1,s1,s7 + fadds s2,s2,s8 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s2,s2,s14 + fadds s0,s0,s18 + fadds s1,s1,s19 + fadds s2,s2,s20 + fstmias r5!,{s0,s1,s2} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcpysmi s24,s2 + b .Lf4end +.Lf4eq2: + fldmias r0!,{s0,s1} + fldmias r2!,{s6,s7} + fldmias r3!,{s12,s13} + fldmias r6!,{s18,s19} + + fadds s0,s0,s6 + fadds s1,s1,s7 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s0,s0,s18 + fadds s1,s1,s19 + fstmias r5!,{s0,s1} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcpysmi s25,s1 + b .Lf4end +.Lf4lt2: + cmp r4,#0 + beq .Lf4eq0 + fldmias r0!,{s0} + fldmias r2!,{s1} + fldmias r3!,{s2} + fldmias r6!,{s3} + + fadds s0,s0,s1 + fadds s0,s0,s2 + fadds s0,s0,s3 + fstmias r5!,{s0} + + fcmpes s24,s0 + fmstat + fcpysmi s24,s0 +.Lf4eq0: + +.Lf4end: + fcmpes s24,s25 + fmstat + fcpysmi s24,s25 + + fmrs r0,s24 + vpop {d8,d9,d10,d11,d12} + pop {r4,r5,r6,r7,r8,lr} + bx lr + +.Lzeros2_1: + .float 0.0,0.0 + .global vfp_foldArrayBy4_lge31 + .type vfp_foldArrayBy4_lge31, %function +vfp_foldArrayBy4_lge31: + push {r4,r5,r6,r7,r8,lr} + vpush {d8,d9,d10,d11,d12} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + ldr r6,[r1,#16] // tmp2 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + add r6,r0,r6,lsl #2 + ldrd r4,[r1] // di,dest + add r7,r0,r4,lsl #2 // end + + fldd d12,.Lzeros2_1 + sub r7,r7,#4*31 + cmp r0,r7 + bhs .Lendf4loop4 +.Lf4loop4: + FOLDBY4_CORE + FOLDBY4_CORE + FOLDBY4_CORE + FOLDBY4_CORE + + cmp r0,r7 + blo .Lf4loop4 +.Lendf4loop4: + add r7,r7,#4*24 + cmp r0,r7 + bhs .Lendf4loop2 +.Lf4loop5: + FOLDBY4_CORE + + cmp r0,r7 + blo .Lf4loop5 +.Lendf4loop5: + b .Lendf4loop2 + +.Lfoldby4sel: +.rept 31 + .word vfp_foldArrayBy4_ll31 +.endr + .word vfp_foldArrayBy4_lge31 + +.Lzeros3: + .float 0.0,0.0 + /***** + * fold array by 5 + ******/ + .global vfp_foldArrayBy5_ll31 + .type vfp_foldArrayBy5_ll31, %function +vfp_foldArrayBy5_ll31: + push {r4,r5,r6,r7,r8,lr} + vpush {d8,d9,d10,d11,d12} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + ldrd r6,[r1,#16] // tmp2,tmp3 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + add r6,r0,r6,lsl #2 + add r7,r0,r7,lsl #2 + ldrd r4,[r1] // di,dest + add r8,r0,r4,lsl #2 // end + + fldd d12,.Lzeros3 + sub r8,r8,#4*7 + cmp r0,r8 + bhs .Lendf5loop2 +.Lf5loop2: +.macro FOLDBY5_CORE + fldmias r0!,{s0,s1,s2,s3,s4,s5,s6,s7} + fldmias r2!,{s8,s9,s10,s11,s12,s13,s14,s15} + fldmias r3!,{s16,s17,s18,s19,s20,s21,s22,s23} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s6,s6,s14 + fadds s7,s7,s15 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fldmias r6!,{s8,s9,s10,s11,s12,s13,s14,s15} + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fadds s7,s7,s23 + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fldmias r7!,{s16,s17,s18,s19,s20,s21,s22,s23} + fadds s5,s5,s13 + fadds s6,s6,s14 + fadds s7,s7,s15 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fadds s7,s7,s23 + + fstmias r5!,{s0,s1,s2,s3,s4,s5,s6,s7} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcmpes s24,s6 + fcpysmi s25,s5 + fmstat + fcmpes s25,s7 + fcpysmi s24,s6 + fmstat + fcpysmi s25,s7 +.endm + FOLDBY5_CORE + + cmp r0,r8 + blo .Lf5loop2 +.Lendf5loop2: + and r4,r4,#7 + cmp r4,#4 + blo .Lf5lt4 + beq .Lf5eq4 + + cmp r4,#6 + blo .Lf5lt6 + beq .Lf5eq6 + + fldmias r0!,{s0,s1,s2,s3,s4,s5,s6} + fldmias r2!,{s8,s9,s10,s11,s12,s13,s14} + fldmias r3!,{s16,s17,s18,s19,s20,s21,s22} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s6,s6,s14 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fldmias r6!,{s16,s17,s18,s19,s20,s21,s22} + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fldmias r7!,{s16,s17,s18,s19,s20,s21,s22} + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fadds s4,s4,s20 + fadds s5,s5,s21 + fadds s6,s6,s22 + fstmias r5!,{s0,s1,s2,s3,s4,s5,s6} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcmpes s24,s6 + fcpysmi s25,s5 + fmstat + fcpysmi s24,s6 + b .Lf5end +.Lf5eq6: + fldmias r0!,{s0,s1,s2,s3,s4,s5} + fldmias r2!,{s6,s7,s8,s9,s10,s11} + fldmias r3!,{s12,s13,s14,s15,s16,s17} + fldmias r6!,{s18,s19,s20,s21,s22,s23} + + fadds s0,s0,s6 + fadds s1,s1,s7 + fadds s2,s2,s8 + fadds s3,s3,s9 + fadds s4,s4,s10 + fadds s5,s5,s11 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s2,s2,s14 + fadds s3,s3,s15 + fadds s4,s4,s16 + fadds s5,s5,s17 + fadds s0,s0,s18 + fadds s1,s1,s19 + fadds s2,s2,s20 + fadds s3,s3,s21 + fadds s4,s4,s22 + fadds s5,s5,s23 + fldmias r7!,{s18,s19,s20,s21,s22,s23} + fadds s0,s0,s18 + fadds s1,s1,s19 + fadds s2,s2,s20 + fadds s3,s3,s21 + fadds s4,s4,s22 + fadds s5,s5,s23 + fstmias r5!,{s0,s1,s2,s3,s4,s5} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcpysmi s25,s5 + b .Lf5end +.Lf5lt6: + fldmias r0!,{s0,s1,s2,s3,s4} + fldmias r2!,{s6,s7,s8,s9,s10} + fldmias r3!,{s12,s13,s14,s15,s16} + fldmias r6!,{s18,s19,s20,s21,s22} + + fadds s0,s0,s6 + fadds s1,s1,s7 + fadds s2,s2,s8 + fadds s3,s3,s9 + fadds s4,s4,s10 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s2,s2,s14 + fadds s3,s3,s15 + fadds s4,s4,s16 + fadds s0,s0,s18 + fadds s1,s1,s19 + fadds s2,s2,s20 + fadds s3,s3,s21 + fadds s4,s4,s22 + fldmias r7!,{s18,s19,s20,s21,s22} + fadds s0,s0,s18 + fadds s1,s1,s19 + fadds s2,s2,s20 + fadds s3,s3,s21 + fadds s4,s4,s22 + fstmias r5!,{s0,s1,s2,s3,s4} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcpysmi s24,s4 + b .Lf5end +.Lf5eq4: + fldmias r0!,{s0,s1,s2,s3} + fldmias r2!,{s4,s5,s6,s7} + fldmias r3!,{s8,s9,s10,s11} + fldmias r6!,{s12,s13,s14,s15} + fldmias r7!,{s16,s17,s18,s19} + + fadds s0,s0,s4 + fadds s1,s1,s5 + fadds s2,s2,s6 + fadds s3,s3,s7 + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s2,s2,s14 + fadds s3,s3,s15 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fadds s3,s3,s19 + fstmias r5!,{s0,s1,s2,s3} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcpysmi s25,s3 + b .Lf5end +.Lf5lt4: + cmp r4,#2 + blo .Lf5lt2 + beq .Lf5eq2 + + fldmias r0!,{s0,s1,s2} + fldmias r2!,{s4,s5,s6} + fldmias r3!,{s8,s9,s10} + fldmias r6!,{s12,s13,s14} + fldmias r7!,{s16,s17,s18} + + fadds s0,s0,s4 + fadds s1,s1,s5 + fadds s2,s2,s6 + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s2,s2,s14 + fadds s0,s0,s16 + fadds s1,s1,s17 + fadds s2,s2,s18 + fstmias r5!,{s0,s1,s2} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcpysmi s24,s2 + b .Lf5end +.Lf5eq2: + fldmias r0!,{s0,s1} + fldmias r2!,{s4,s5} + fldmias r3!,{s8,s9} + fldmias r6!,{s12,s13} + fldmias r7!,{s16,s17} + + fadds s0,s0,s4 + fadds s1,s1,s5 + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s0,s0,s12 + fadds s1,s1,s13 + fadds s0,s0,s16 + fadds s1,s1,s17 + fstmias r5!,{s0,s1} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcpysmi s25,s1 + b .Lf5end +.Lf5lt2: + cmp r4,#0 + beq .Lf5eq0 + fldmias r0!,{s0} + fldmias r2!,{s1} + fldmias r3!,{s2} + fldmias r6!,{s3} + fldmias r7!,{s4} + + fadds s0,s0,s1 + fadds s0,s0,s2 + fadds s0,s0,s3 + fadds s0,s0,s4 + fstmias r5!,{s0} + + fcmpes s24,s0 + fmstat + fcpysmi s24,s0 +.Lf5eq0: + +.Lf5end: + fcmpes s24,s25 + fmstat + fcpysmi s24,s25 + + fmrs r0,s24 + vpop {d8,d9,d10,d11,d12} + pop {r4,r5,r6,r7,r8,lr} + bx lr + +.Lzeros3_1: + .float 0.0,0.0 + + .global vfp_foldArrayBy5_lge31 + .type vfp_foldArrayBy5_lge31, %function +vfp_foldArrayBy5_lge31: + push {r4,r5,r6,r7,r8,lr} + vpush {d8,d9,d10,d11,d12} + + ldr r0,[r0] // ss0 + ldrd r2,[r1,#8] // tmp0 + ldrd r6,[r1,#16] // tmp2,tmp3 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + add r6,r0,r6,lsl #2 + add r7,r0,r7,lsl #2 + ldrd r4,[r1] // di,dest + add r8,r0,r4,lsl #2 // end + + fldd d12,.Lzeros3_1 + sub r8,r8,#4*31 + cmp r0,r8 + bhs .Lendf5loop4 +.Lf5loop4: + FOLDBY5_CORE + FOLDBY5_CORE + FOLDBY5_CORE + FOLDBY5_CORE + + cmp r0,r8 + blo .Lf5loop4 +.Lendf5loop4: + add r8,r8,#4*24 + cmp r0,r8 + bhs .Lendf5loop2 +.Lf5loop5: + FOLDBY5_CORE + + cmp r0,r8 + blo .Lf5loop5 +.Lendf5loop5: + b .Lendf5loop2 + +.Lfoldby5sel: +.rept 31 + .word vfp_foldArrayBy5_ll31 +.endr + .word vfp_foldArrayBy5_lge31 + +.Lzeros4: + .float 0.0,0.0 + /***** + * fold array by 2 + ******/ + .global vfp_foldArrayBy2_ll31 + .type vfp_foldArrayBy2_ll31, %function +vfp_foldArrayBy2_ll31: + push {r4,r5,r6,lr} + vpush {d8,d9,d10,d11,d12} + + ldr r0,[r0,#4] // ss1 + ldrd r2,[r1,#8] // tmp0 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + ldrd r4,[r1] // di,dest + add r6,r2,r4,lsl #2 // end + + fldd d12,.Lzeros4 + sub r6,r6,#4*7 + cmp r2,r6 + bhs .Lendf2loop2 +.Lf2loop2: +.macro FOLDBY2_CORE + fldmias r2!,{s0,s1,s2,s3,s4,s5,s6,s7} + fldmias r3!,{s8,s9,s10,s11,s12,s13,s14,s15} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s6,s6,s14 + fadds s7,s7,s15 + fstmias r5!,{s0,s1,s2,s3,s4,s5,s6,s7} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcmpes s24,s6 + fcpysmi s25,s5 + fmstat + fcmpes s25,s7 + fcpysmi s24,s6 + fmstat + fcpysmi s25,s7 +.endm + FOLDBY2_CORE + + cmp r2,r6 + blo .Lf2loop2 +.Lendf2loop2: + and r4,r4,#7 + cmp r4,#4 + blo .Lf2lt4 + beq .Lf2eq4 + + cmp r4,#6 + blo .Lf2lt6 + beq .Lf2eq6 + + fldmias r2!,{s0,s1,s2,s3,s4,s5,s6} + fldmias r3!,{s8,s9,s10,s11,s12,s13,s14} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fadds s6,s6,s14 + fstmias r5!,{s0,s1,s2,s3,s4,s5,s6} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcmpes s24,s6 + fcpysmi s25,s5 + fmstat + fcpysmi s24,s6 + b .Lf2end +.Lf2eq6: + fldmias r2!,{s0,s1,s2,s3,s4,s5} + fldmias r3!,{s8,s9,s10,s11,s12,s13} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + fadds s5,s5,s13 + fstmias r5!,{s0,s1,s2,s3,s4,s5} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcmpes s25,s5 + fcpysmi s24,s4 + fmstat + fcpysmi s25,s5 + b .Lf2end +.Lf2lt6: + fldmias r2!,{s0,s1,s2,s3,s4} + fldmias r3!,{s8,s9,s10,s11,s12} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + fadds s4,s4,s12 + + fstmias r5!,{s0,s1,s2,s3,s4} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcmpes s24,s4 + fcpysmi s25,s3 + fmstat + fcpysmi s24,s4 + b .Lf2end +.Lf2eq4: + fldmias r2!,{s0,s1,s2,s3} + fldmias r3!,{s8,s9,s10,s11} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + fadds s3,s3,s11 + + fstmias r5!,{s0,s1,s2,s3} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcmpes s25,s3 + fcpysmi s24,s2 + fmstat + fcpysmi s25,s3 + b .Lf2end +.Lf2lt4: + cmp r4,#2 + blo .Lf2lt2 + beq .Lf2eq2 + + fldmias r2!,{s0,s1,s2} + fldmias r3!,{s8,s9,s10} + + fadds s0,s0,s8 + fadds s1,s1,s9 + fadds s2,s2,s10 + + fstmias r5!,{s0,s1,s2} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcmpes s24,s2 + fcpysmi s25,s1 + fmstat + fcpysmi s24,s2 + b .Lf2end +.Lf2eq2: + fldmias r2!,{s0,s1} + fldmias r3!,{s8,s9} + + fadds s0,s0,s8 + fadds s1,s1,s9 + + fstmias r5!,{s0,s1} + + fcmpes s24,s0 + fmstat + fcmpes s25,s1 + fcpysmi s24,s0 + fmstat + fcpysmi s25,s1 + b .Lf2end +.Lf2lt2: + cmp r4,#0 + beq .Lf2eq0 + fldmias r2!,{s0} + fldmias r3!,{s1} + + fadds s0,s0,s1 + fstmias r5!,{s0} + + fcmpes s24,s0 + fmstat + fcpysmi s24,s0 +.Lf2eq0: + +.Lf2end: + fcmpes s24,s25 + fmstat + fcpysmi s24,s25 + + fmrs r0,s24 + vpop {d8,d9,d10,d11,d12} + pop {r4,r5,r6,lr} + bx lr + + .global vfp_foldArrayBy2_lge31 + .type vfp_foldArrayBy2_lge31, %function +vfp_foldArrayBy2_lge31: + push {r4,r5,r6,lr} + vpush {d8,d9,d10,d11,d12} + + ldr r0,[r0,#4] // ss1 + ldrd r2,[r1,#8] // tmp0 + add r2,r0,r2,lsl #2 + add r3,r0,r3,lsl #2 + ldrd r4,[r1] // di,dest + add r6,r2,r4,lsl #2 // end + + fldd d12,.Lzeros4 + sub r6,r6,#4*31 + cmp r2,r6 + bhs .Lendf2loop4 +.Lf2loop4: + FOLDBY2_CORE + FOLDBY2_CORE + FOLDBY2_CORE + FOLDBY2_CORE + + cmp r2,r6 + blo .Lf2loop4 +.Lendf2loop4: + add r6,r6,#4*24 + cmp r2,r6 + bhs .Lendf2loop2 +.Lf2loop5: + FOLDBY2_CORE + + cmp r2,r6 + blo .Lf2loop5 + b .Lendf2loop2 + +.Lfoldby2sel: +.rept 31 + .word vfp_foldArrayBy2_ll31 +.endr + .word vfp_foldArrayBy2_lge31 + + .align 2 +.Lname: + .string "opt VFP" + + .align 2 + .global vfpFoldMain +vfpFoldMain: + .word .Lfoldby3sel + .word .Lfoldby4sel + .word .Lfoldby5sel + .word .Lfoldby2sel + .word .Lfoldby2sel + .word .Lname + /* + * vfp_GetPowerSpectrum.S + * Author: Mateusz Szpakowski + */ + .align 2 + .global _Z20vfp_GetPowerSpectrumPA2_fPfi + .type _Z20vfp_GetPowerSpectrumPA2_fPfi, %function +_Z20vfp_GetPowerSpectrumPA2_fPfi: + push {r4,r5} + vpush {d8,d9,d10,d11,d12,d13,d14,d15} + + ldr r3,.LGOTa +.LPICa: + add r3,pc,r3 + ldr r4,.LGOTa+4 + ldr r4,[r3,r4] + add r5,r2,r2,lsl #1 + fldd d0,[r4,#32] + fmsr s4,r5 + fuitod d1,s4 + faddd d0,d0,d1 + fstd d0,[r4,#32] + + add r2,r0,r2,lsl #3 + sub r2,r2,#15*8 + /* r0 - freqData + * r1 - PowerSpectrum + * r2 - end of freqData + */ + cmp r0,r2 + bhs .Lendmainloopa +.Lmainloopa: + pld [r0,#64] + fldmias r0!,{s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15} + fmuls s16,s0,s0 + fmuls s17,s2,s2 + fmuls s18,s4,s4 + fmuls s19,s6,s6 + fmuls s20,s8,s8 + fmuls s21,s10,s10 + fmuls s22,s12,s12 + fmuls s23,s14,s14 + fmacs s16,s1,s1 + fmacs s17,s3,s3 + fmacs s18,s5,s5 + fmacs s19,s7,s7 + fmacs s20,s9,s9 + fmacs s21,s11,s11 + fmacs s22,s13,s13 + fmacs s23,s15,s15 + + pld [r0,#64] + fldmias r0!,{s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15} + fstmias r1!,{s16,s17,s18,s19,s20,s21,s22,s23} + + fmuls s24,s0,s0 + fmuls s25,s2,s2 + fmuls s26,s4,s4 + fmuls s27,s6,s6 + fmuls s28,s8,s8 + fmuls s29,s10,s10 + fmuls s30,s12,s12 + fmuls s31,s14,s14 + fmacs s24,s1,s1 + fmacs s25,s3,s3 + fmacs s26,s5,s5 + fmacs s27,s7,s7 + fmacs s28,s9,s9 + fmacs s29,s11,s11 + fmacs s30,s13,s13 + fmacs s31,s15,s15 + fstmias r1!,{s24,s25,s26,s27,s28,s29,s30,s31} + + cmp r0,r2 + blo .Lmainloopa +.Lendmainloopa: + add r2,r2,#8*12 + bhs .Lendsmallloopa +.Lsmallloopa: + fldmias r0!,{s0,s1,s2,s3,s4,s5,s6,s7} + fmuls s16,s0,s0 + fmuls s17,s2,s2 + fmuls s18,s4,s4 + fmuls s19,s6,s6 + fmacs s16,s1,s1 + fmacs s17,s3,s3 + fmacs s18,s5,s5 + fmacs s19,s7,s7 + fstmias r1!,{s16,s17,s18,s19} + cmp r0,r2 + blo .Lsmallloopa +.Lendsmallloopa: + add r2,r2,#8*3 + cmp r0,r2 + beq .Lendmicroloop +.Lmicroloop: + fldmias r0!,{s0,s1} + fmuls s2,s0,s0 + fmacs s2,s1,s1 + fstmias r1!,{s2} + + cmp r0,r2 + blo .Lmicroloop + +.Lendmicroloop: + mov r0,#0 + vpop {d8,d9,d10,d11,d12,d13,d14,d15} + pop {r4,r5} + bx lr + + .align 2 +.LGOTa: + .word _GLOBAL_OFFSET_TABLE_-(.LPICa+8) + .word analysis_state(GOT) + +#endif // __arm__ diff --git a/client/vector/analyzeFuncs_vfp_aux.cpp b/client/vector/analyzeFuncs_vfp_aux.cpp new file mode 100644 index 0000000..a0fbb53 --- /dev/null +++ b/client/vector/analyzeFuncs_vfp_aux.cpp @@ -0,0 +1,254 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: analyzeFuncs_sse.cpp,v 1.1.2.10 2007/06/08 03:09:47 korpela Exp $ +// + +// This file is empty is __i386__ is not defined +#include "sah_config.h" +#include +#include + +#if (defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)) || defined(__aarch64__) + + +#define INVALID_CHIRP 2e+20 + +#include "analyzeFuncs.h" +#include "analyzeFuncs_vector.h" +#include "analyzePoT.h" +#include "analyzeReport.h" +#include "gaussfit.h" +#include "s_util.h" +#include "diagnostics.h" +#include "asmlib.h" +#include "pulsefind.h" +#include "fp_arm.h" + + +template +inline void v_pfsubTranspose(float *in, float *out, int xline, int yline) { + // Transpose an X by X subsection of a XLINE by YLINE matrix into the + // appropriate part of a YLINE by XLINE matrix. "IN" points to the first + // (lowest address) element of the input submatrix. "OUT" points to the + // first (lowest address) element of the output submatrix. +#ifdef USE_MANUAL_CALLSTACK + static char name[64]; + if (name[0]==0) sprintf(name,"v_pfsubTranspose<%d>()",x); + call_stack.enter(name); +#endif + int i,j; + float *p; + register float tmp[x*x]; + for (j=0;j(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in+j*x+i,out+y*i+j,x,y); + } + for (;i(in,out,x,y); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +int v_vfpTranspose2(int x, int y, float *in, float *out) { +// Attempts to improve cache hit ratio by transposing 4 elements at a time. +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("vfp_Transpose2()"); +#endif + int i,j; + for (j=0;j +#include +#include +#include + +#include "x86_ops.h" +#include "x86_float4.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#include "seti.h" +#include "s_util.h" +#include "worker.h" + +// chirp_rate is in Hz per second +int v_vChirpData_x86_64( + sah_complex * fp_DataArray, + sah_complex * fp_ChirpDataArray, + int ChirpRateInd, + double chirp_rate, + int ul_NumDataPoints, + double sample_rate +) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("v_vChirpData_x86_64()"); +#endif + double recsqtw_Sample_rate = (double)(1.0/(2.0*(sample_rate*sample_rate))); + static const int as [4] __attribute__((aligned(16)))= {INT_MIN, 0, INT_MIN, 0} ; // {-, +, -, +} + char *cblock = (char *)alloca(11*16); + cblock+=(16-((ssize_t)cblock % 16)); + x86_m128 *fblock=reinterpret_cast(cblock); + x86_m128d *dblock=reinterpret_cast(cblock); + #define CC dblock[0] + #define DD dblock[1] + #define cc fblock[2] + #define dd fblock[3] + #define ri fblock[4] + #define ri1 fblock[5] + #define ri2 fblock[6] + #define ss fblock[7] + #define zz fblock[8] + + memcpy(&(ss),as,sizeof(as)); + zz = _mm_setzero_ps (); + int i, j; + // float c, d, real, imag; + //float time; // using float causes too low precision + double time; + //float ang; // using float causes too low precision + double ang; + + double aC [] __attribute__((aligned(16))) = {0, 0}; + double aD [] __attribute__((aligned(16))) = {0, 0} ; + + //float chirpInvariant = (float)(0.5*chirp_rate/(sample_rate*sample_rate)); + double chirpInvariant = chirp_rate*recsqtw_Sample_rate; //using float causes too low precision + if (chirp_rate == 0) { + memcpy(fp_ChirpDataArray, + fp_DataArray, + (int)ul_NumDataPoints * 2 * sizeof(float) + ); // NOTE INT CAST + } else { + for (i = 0, j = 0; i < (ul_NumDataPoints - 2); i += 2, j += 2) { + + // _mm_prefetch (fp_DataArray + i + 32, _MM_HINT_T0); + _mm_prefetch ((char *) (fp_ChirpDataArray + i) + 384, _MM_HINT_T0); + + time = (double)j*j; + ang = time*chirpInvariant; + ang -= std::floor(ang); + ang *= M_PI*2.0; +//#ifndef HAVE_SINCOS + aC [0] = cos (ang); + aD [0] = sin (ang); +/*#else // using sincos causes too low precision + sincos (ang, aD + 0, aC + 0); +#endif */ + + time = (double)(j + 1)*(j + 1); + ang = chirpInvariant*time; + ang -= std::floor(ang); + ang *= M_PI*2.0; +//#ifndef HAVE_SINCOS + aC [1] = cos (ang); + aD [1] = sin (ang); +/*#else // using sincos causes too low precision + sincos (ang, aD + 1, aC + 1); +#endif */ + + CC = _mm_loadu_pd (aC); + DD = _mm_loadu_pd (aD); + + cc = _mm_cvtpd_ps (CC); + dd = _mm_cvtpd_ps (DD); + + cc = _mm_unpacklo_ps (cc, cc); + dd = _mm_unpacklo_ps (dd, dd); + + // Sometimes chirping is done in place. + // We don't want to overwrite data prematurely. + // real = fp_DataArray[i] * c - fp_DataArray[i+1] * d; + // imag = fp_DataArray[i] * d + fp_DataArray[i+1] * c; + ri1 = _mm_loadu_ps ((float *)(fp_DataArray + i)); + ri2 = _mm_shuffle_ps (ri1, ri1, _MM_SHUFFLE (2, 3, 0, 1)); + ri2 = _mm_xor_ps (ri2, ss); + ri1 = _mm_mul_ps (ri1, cc); + ri2 = _mm_mul_ps (ri2, dd); + ri = _mm_add_ps (ri1, ri2); + + // fp_ChirpDataArray[i] = real; + // fp_ChirpDataArray[i+1] = imag; + _mm_storeu_ps ((float *)(fp_ChirpDataArray + i), ri); + } + for (; i < ul_NumDataPoints; i ++, j++) { + + // _mm_prefetch (fp_DataArray + i + 16, _MM_HINT_T0); + _mm_prefetch ((char *) (fp_ChirpDataArray + i) + 384, _MM_HINT_T0); + + time = (double)j*j; + ang = chirpInvariant*time; + ang -= std::floor(ang); + ang *= M_PI*2.0; +//#ifndef HAVE_SINCOS + aC [0] = cos (ang); + aC [1] = sin (ang); +/*#else // using sincos causes too low precision + sincos (ang, aC + 0, aC + 1); +#endif */ + + CC = _mm_loadu_pd (aC); + + cc = _mm_cvtpd_ps (CC); + + cc = _mm_unpacklo_ps (cc, cc); + dd = _mm_movehl_ps (zz, cc); + + // Sometimes chirping is done in place. + // We don't want to overwrite data prematurely. + // real = fp_DataArray[i] * c - fp_DataArray[i+1] * d; + // imag = fp_DataArray[i] * d + fp_DataArray[i+1] * c; + ri1 = _mm_loadl_pi (zz, (__m64 *) (fp_DataArray + i)); + ri2 = _mm_shuffle_ps (ri1, ri1, _MM_SHUFFLE (2, 3, 0, 1)); + ri2 = _mm_xor_ps (ri2, ss); + ri1 = _mm_mul_ps (ri1, cc); + ri2 = _mm_mul_ps (ri2, dd); + ri = _mm_add_ps (ri1, ri2); + + // fp_ChirpDataArray[i] = real; + // fp_ChirpDataArray[i+1] = imag; + _mm_storel_pi ((__m64 *) (fp_ChirpDataArray + i), ri); + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} +#endif + diff --git a/client/vector/asmlib.h b/client/vector/asmlib.h new file mode 100644 index 0000000..63217e1 --- /dev/null +++ b/client/vector/asmlib.h @@ -0,0 +1,16 @@ +// ASMLIB.H © Agner Fog 2004 + +// Header file for asmlibM.lib, asmlibO.lib, and asmlibE.a +// See asmlib.txt for further details + +extern "C" int InstructionSet (void); // tell which instruction set is supported +extern "C" int DetectProcessor (void); // information about microprocessor features +extern "C" void ProcessorName (char * text); // ASCIIZ text describing microprocessor +extern "C" int Round (double x); // round to nearest or even +extern "C" int Truncate (double x); // truncation towards zero +extern "C" int ReadClock (void); // read microprocessor internal clock +extern "C" int MinI (int a, int b); // the smallest of two integers +extern "C" int MaxI (int a, int b); // the biggest of two integers +extern "C" double MinD (double a, double b); // the smallest of two double precision numbers +extern "C" double MaxD (double a, double b); // the biggest of two double precision numbers + diff --git a/client/vector/asmlib.zip b/client/vector/asmlib.zip new file mode 100644 index 0000000..6cc8eaa Binary files /dev/null and b/client/vector/asmlib.zip differ diff --git a/client/vector/asmlibe.a b/client/vector/asmlibe.a new file mode 100644 index 0000000..4b435de Binary files /dev/null and b/client/vector/asmlibe.a differ diff --git a/client/vector/asmlibm.lib b/client/vector/asmlibm.lib new file mode 100644 index 0000000..712b3aa Binary files /dev/null and b/client/vector/asmlibm.lib differ diff --git a/client/vector/avxcheck.asm b/client/vector/avxcheck.asm new file mode 100644 index 0000000..6de2591 --- /dev/null +++ b/client/vector/avxcheck.asm @@ -0,0 +1,36 @@ +; AVX detection based on section 2.2 of "Intel Advanced Vector Extensions Programming Reference" +; +; MASM source needed for 64 bit builds with MicroSoft tools + + +PUBLIC avxSupported + + +_TEXT SEGMENT + +avxSupported PROC + + mov eax, 1 + cpuid + and ecx, 018000000H + cmp ecx, 018000000H ; check both OSXSAVE and AVX feature flags + jne NOSUPPORT + xor ecx, ecx ; specify 0 for XFEATURE_ENABLED_MASK register + xgetbv ; result in EDX:EAX + and eax, 06H + cmp eax, 06H ; check OS has enabled both XMM and YMM state support + jne NOSUPPORT + mov eax, 1 + jmp DONE + + NOSUPPORT: + mov eax, 0 + + DONE: + ret + +avxSupported ENDP + +_TEXT ENDS + +END \ No newline at end of file diff --git a/client/vector/fp_arm.h b/client/vector/fp_arm.h new file mode 100644 index 0000000..e85ea35 --- /dev/null +++ b/client/vector/fp_arm.h @@ -0,0 +1,177 @@ +// Copyright (c) 1999-2013 Regents of the University of California +// +// FFTW: Copyright (c) 2003,2006 Matteo Frigo +// Copyright (c) 2003,2006 Massachusets Institute of Technology +// +// fft8g.[cpp,h]: Copyright (c) 1995-2001 Takya Ooura +// +// ASMLIB: Copyright (c) 2004 Agner Fog + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any later +// version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions +// as an alternative to FFTW and distribute a linked executable and +// source code. You must obey the GNU General Public License in all +// respects for all of the code used other than the FFT library itself. +// Any modification required to support these libraries must be distributed +// under the terms of this license. If you modify this program, you may extend +// this exception to your version of the program, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. Please be aware that FFTW and ASMLIB are not covered by +// this exception, therefore you may not use FFTW and ASMLIB in any derivative +// work so modified without permission of the authors of those packages. +// + +#if (defined(__arm__) || defined(__aarch64__)) +#include +#include +#include "s_util.h" +#include "sighandler.h" + +// Exception masks +#define _EM_INVALID 0x00000100 // Invalid Operation +#define _EM_ZERODIVIDE 0x00000200 // Divide by zero +#define _EM_OVERFLOW 0x00000400 // Overflow +#define _EM_UNDERFLOW 0x00000800 // Underflow +#define _EM_INEXACT 0x00001000 // Inexact result +#define _EM_DENORMAL 0x00008000 // Denormal result +#define _MCW_EM (_EM_INVALID|_EM_ZERODIVIDE|_EM_OVERFLOW|_EM_UNDERFLOW|_EM_INEXACT|_EM_DENORMAL) + +// Rounding control +#define _RC_CHOP 0x000c0000 // Truncate +#define _RC_DOWN 0x00080000 // Round down +#define _RC_UP 0x00040000 // Round up +#define _RC_NEAREST 0x00000000 // Round to nearest +#define _MCW_RC (_RC_CHOP|_RC_UP|_RC_DOWN|_RC_NEAREST) + +#define _NAN_DEFAULT 0x00200000 // Use default NaN rather than propogating NaN +#define _MCW_NAN _NAN_DEFAULT + +#define _FLUSH_TO_ZERO 0x00100000 // Replaces denormalized numbers with zero +#define _MCW_FLUSH_TO_ZERO _FLUSH_TO_ZERO + +#if 0 +These VFP vector mode has been deprecated +#define _VECTOR_LEN(x) ((((x)-1)&7)<<16) // Set length of vectors to x +#define _MCW_VECTOR_LEN_MASK _VECTOR_LEN(8) + +#define _VECTOR_STRIDE(x) (((x)==2)?(3<<20):0) +#define _MCW_VECTOR_STRIDE_MASK (3<<20) +#endif + +static unsigned int save_cw; +static unsigned int cw; + +inline static unsigned int controlfp(unsigned int flags, unsigned int mask) { + install_sighandler(); + FORCE_FRAME_POINTER; + if (sigsetjmp(jb,1)) { + uninstall_sighandler(); + cw=0; + save_cw=0; + fprintf(stderr,"User mode control of fp control register not allowed\n"); + } else { +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + __asm__ __volatile__ ( + "fmrx %0,fpscr\n" + : "=r" (cw) + ); +#endif + + save_cw=cw; + cw=(cw & ~mask) | (flags & mask); + +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + __asm__ __volatile__ ( + "fmxr fpscr,%0\n" + : : "r" (cw) + ); +#endif + uninstall_sighandler(); + } + return cw; +} + +inline static unsigned int restorefp() { + if (save_cw != 0) { +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + __asm__ __volatile__ ( + "fmxr fpscr,%0\n" + : : "r" (save_cw) + ); +#else + cw=save_cw; +#endif + } + return save_cw; +} + + +// ARM prefetch + +inline void pld(void *arg1,const int arg2=0) { + __asm__ __volatile__ ( +#ifndef __aarch64__ + "pld [%0,%1]\n" +#else + "prfm PLDL1STRM,[%0,%1]\n" +#endif + : + : "r" (arg1), "Jr" (arg2) + ); +} + + + +#if 0 +static const uint64_t arm_TWO_TO_52(0x4330000000000000); +static const uint64_t arm_SIGN_BIT(0x8000000000000000); +static const uint32_t arm_TWO_TO_23(0x4b000000); +static const uint32_t arm_FSIGN_BIT(0x80000000); + +#if defined(__VFP_FP__) && !defined(__SOFTFP__) + +inline static double arm_round(double x) { + register uint64_t s=*reinterpret_cast(&x) & arm_SIGN_BIT; + uint64_t a=s | arm_TWO_TO_52; + volatile register double d=*reinterpret_cast(&a); + return (x+d)-d; +} + +inline static float arm_round(float x) { + register uint32_t s=*reinterpret_cast(&x) & arm_FSIGN_BIT; + uint32_t a=s | arm_TWO_TO_23; + volatile register float d=*reinterpret_cast(&a); + return (x+d)-d; +} + +#define round(x) arm_round(x) + +inline static double arm_floor(double x) { + return round(x-0.5); +} + +inline static float arm_floor(float x) { + return round(x-0.5f); +} + +#define floor(x) arm_floor(x) +#endif + +#endif +#endif + diff --git a/client/vector/hires_timer.cpp b/client/vector/hires_timer.cpp new file mode 100644 index 0000000..31d5fd8 --- /dev/null +++ b/client/vector/hires_timer.cpp @@ -0,0 +1,362 @@ + +// Copyright (c) 1999-2006 Regents of the University of California +// +// FFTW: Copyright (c) 2003,2006 Matteo Frigo +// Copyright (c) 2003,2006 Massachusets Institute of Technology +// +// fft8g.[cpp,h]: Copyright (c) 1995-2001 Takya Ooura + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any later +// version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions +// as an alternative to FFTW and distribute a linked executable and +// source code. You must obey the GNU General Public License in all +// respects for all of the code used other than the FFT library itself. +// Any modification required to support these libraries must be distributed +// under the terms of this license. If you modify this program, you may extend +// this exception to your version of the program, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. Please be aware that FFTW is not covered by this exception, +// therefore you may not use FFTW in any derivative work so modified without +// permission of the authors of FFTW. +// + +// $Id: hires_timer.cpp,v 1.1.2.6 2006/09/07 00:26:56 korpela Exp $ + +#include "sah_config.h" +#include "sighandler.h" +#include "hires_timer.h" +#include "diagnostics.h" +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#include +#endif +#ifdef HAVE_MACH_MACH_TIME_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_SYSTM_H +#include +#endif +#ifdef HAVE_MACHINE_CPU_H +#include +#endif +#ifdef HAVE_LINUX_PERF_EVENT_H +#include +#endif + + +#if _MSC_VER >= 1400 +#include "intrin.h" // include intrinsic assembly functions +#endif + +#ifdef _WIN32 +#include "windows.h" +#endif + +#ifdef HAVE_LINUX_PERF_EVENT_H +static int fd_dev=-1; +static struct perf_event_attr attr; +#endif + + +#if defined(_WIN32) +static inline tick_t fallback_ticks() { + LARGE_INTEGER time; + FILETIME sysTime; + GetSystemTimeAsFileTime(&sysTime); + time.LowPart = sysTime.dwLowDateTime; + time.HighPart = sysTime.dwHighDateTime; + return static_cast(time.QuadPart); +} +#elif defined(HAVE_GETTIMEOFDAY) +static inline tick_t fallback_ticks() { + struct timeval tp; + gettimeofday(&tp,0); + return static_cast(tp.tv_sec)*1000000+tp.tv_usec; +} +#else +static inline tick_t fallback_ticks() { + return static_cast(time(0)); +} +#endif + +#ifdef _WIN32 +static inline tick_t get_ticks() { + LARGE_INTEGER rv; + QueryPerformanceCounter(&rv); + return static_cast(rv.QuadPart); +} +#elif defined(HAVE_HRTIME_T) && defined(HAVE_GETHRTIME) +static inline tick_t get_ticks() { + return gethrtime(); +} + +#elif defined(HAVE_MACH_ABSOLUTE_TIME) +static inline tick_t get_ticks() { + return mach_absolute_time(); +} + +#elif defined(HAVE_GET_CYCLECOUNT) +static inline tick_t get_ticks() { + return get_cyclecount(); +} + +#elif defined(HAVE_NANOTIME) +static inline tick_t get_ticks() { + struct timespec tsp; + nanotime(&tsp); + return static_cast(tsp.tv_sec)*static_cast(1000000000LL)+tsp.tv_nsec; +} + +#elif defined(__GNUC__) && defined(__i386__) +static inline tick_t get_ticks() { + register tick_t rv; + asm volatile ( + "rdtsc" + : "=A" (rv) + ); + return rv; +} + +#elif defined(__GNUC__) && defined(__x86_64__) +static inline tick_t get_ticks() { + register tick_t rv; + register unsigned int hi,lo; + asm volatile ( + "rdtsc" + : "=a" (lo), "=d" (hi) + : /* no inputs */ + : /* no clobbers */ + ); + rv=(static_cast(hi)<<32)|lo; + return rv; +} + +#elif defined(__GNUC__) && (defined(__ia64) || defined (__ia64__)) +static inline tick_t get_ticks() { + register tick_t rv; + asm volatile ( + "mov %0=ar.itc" + : "=r" (rv) + : /* no inputs */ + : /* no clobbers */ + ); + return rv; +} + +#elif defined(__GNUC__) && defined(__sparc) +static inline tick_t get_ticks() { + register long lo; + asm volatile ( +#ifdef __sparcv9 + "rd %%tick,%0" + : "=r" (lo) +#else + ".long %1\n" + "mov %%g1,%0\n" + : "=r" (lo) + : "i" (0x83410000) // rd %tick, %g1 +#endif + ); + return static_cast(lo); +} + +#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) +static inline tick_t get_ticks() { + register tick_t rv; + register unsigned int hi1,hi,lo; + do { + asm volatile ( + "mftbu %0\n\t" + "mftb %1\n\t" + "mftbu %2\n\t" /* don't forget to check overflow */ + : "=r" (hi), "=r" (lo), "=r" (hi1) + ); + } while (hi != hi1); + rv=(static_cast(hi)<<32)|lo; + return rv; +} + +#elif _MSC_VER >= 1400 && (defined(_M_X64) || defined(_M_AMD64)) +static inline tick_t get_ticks() { + return __rdtsc(); +} + +#elif defined(HAVE_LINUX_PERF_EVENT_H) +static inline tick_t get_ticks() { + int64_t result = 0; + int i=0; + while (read(fd_dev, &result, sizeof(result)) < sizeof(result)) { + i++; + if (i==100) raise(SIGILL); + } + return result; +} + +#elif defined(HAVE_CLOCK_GETTIME) + +#if defined(CLOCK_PROCESS_CPUTIME_ID) +#define METHOD CLOCK_PROCESS_CPUTIME_ID +#elif defined(CLOCK_MONOTONIC) +#define METHOD CLOCK_MONOTONIC +#elif defined(CLOCK_REALTIME) +#define METHOD CLOCK_REALTIME +#elif defined(CLOCK_SGI_CYCLE) +#define METHOD CLOCK_SGI_CYCLE +#endif + +static inline tick_t get_ticks() { + struct timespec t; + clock_gettime(METHOD, &t); + return static_cast(t.tv_nsec)+static_cast(t.tv_sec)*static_cast(1000000000LL); +} + + +#elif defined(HAVE_MICROTIME) +static inline tick_t get_ticks() { + struct timeval tsp; + microtime(&tsp); + return static_cast(tsp.tv_sec)*static_cast(1000000LL)+tsp.tv_usec; +} + +#else +static inline tick_t get_ticks() { + raise(SIGILL); + return static_cast(0); +} +#endif + + +hires_timer::hires_timer() : rollover(0),last_ticks(0),start_time(0.0) { +#ifdef HAVE_LINUX_PERF_EVENT_H + if (fd_dev == -1) {; + attr.type = PERF_TYPE_HARDWARE; +#ifdef PERF_COUNT_HW_REF_CPU_CYCLES + attr.config = PERF_COUNT_HW_REF_CPU_CYCLES; +#else + attr.config = PERF_COUNT_HW_CPU_CYCLES; +#endif + fd_dev = syscall(__NR_perf_event_open, &attr, 0, -1, -1, 0); + } +#endif + if (period==0) { + install_sighandler(); + if (setjmp(jb)) { + fprintf(stderr,"using fallback timer\n"); + use_fallback=1; + } else { + ticks(); + } + uninstall_sighandler(); + calibrate(); + } +} + +tick_t hires_timer::ticks() { + if (use_fallback) { + tick_t t=fallback_ticks(); + if (t < last_ticks) { + // Assume the rollover is a power of two + tick_t this_rollover=2; + unsigned long long u=last_ticks-t; + while (u>>=1) this_rollover<<=1; + rollover+=this_rollover; + // unfortunately a rollover probably returns a + // bogus elapsed time. + } + return (last_ticks=fallback_ticks()+rollover); + } else { + tick_t t=get_ticks(); + if (t < last_ticks) { + // Assume the rollover is a power of two + tick_t this_rollover=2; + unsigned long long u=last_ticks-t; + while (u>>=1) this_rollover<<=1; + rollover+=this_rollover; + } + return (last_ticks=get_ticks()+rollover); + } +} + +tick_t hires_timer::find_increment() { + int i; + tick_t delta=0; + for (i=0;i<64;i++) { + tick_t t1,t2=ticks(); + while ((t1=ticks()) <= t2) ; /* do nothing */ + delta+=(t1-t2); + } + return (delta/64); +} + +second_t hires_timer::find_frequency() { + time_t t1,t2=time(0); + tick_t start,fin; + // Beware time resets. + while ((t1=time(0)) <= t2) ; /* do nothing */ + start=ticks(); + while ((t2=time(0)) <= t1) ; /* do nothing */ + fin=ticks(); + return static_cast(fin-start)/(t2-t1); +} + +void hires_timer::calibrate() { + double freq=find_frequency(); + if (freq<=0) freq=find_frequency(); /* in case it rolled over */ + BOINCASSERT(freq > 0); + period=1.0/freq; + ticks_min_incr=find_increment(); + increment=period*ticks_min_incr; + if (increment < 1e-6) { + increment=1e-6; + ticks_min_incr=static_cast(floor((second_t)increment/period+0.5)); + } +} + +second_t hires_timer::period; +tick_t hires_timer::ticks_min_incr; +second_t hires_timer::increment; +int hires_timer::use_fallback; + + +#ifdef TEST_TIMER +#include +#include + +int main(void) { + hires_timer t; + t.start(); + printf("frequency:%f resolution:%f seconds:%f\n",t.frequency(),t.resolution(),t.seconds()); + while (t.elapsed() < t.resolution()) ; + printf("%f elapsed\n",t.elapsed()); + while (t.elapsed() < 10.0) ; /* do nothing */ + printf("%f elapsed\n",t.stop()); + return 0; +} +#endif diff --git a/client/vector/hires_timer.h b/client/vector/hires_timer.h new file mode 100644 index 0000000..44a33d6 --- /dev/null +++ b/client/vector/hires_timer.h @@ -0,0 +1,115 @@ + +// Copyright (c) 1999-2006 Regents of the University of California +// +// FFTW: Copyright (c) 2003,2006 Matteo Frigo +// Copyright (c) 2003,2006 Massachusets Institute of Technology +// +// fft8g.[cpp,h]: Copyright (c) 1995-2001 Takya Ooura + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any later +// version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions +// as an alternative to FFTW and distribute a linked executable and +// source code. You must obey the GNU General Public License in all +// respects for all of the code used other than the FFT library itself. +// Any modification required to support these libraries must be distributed +// under the terms of this license. If you modify this program, you may extend +// this exception to your version of the program, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. Please be aware that FFTW is not covered by this exception, +// therefore you may not use FFTW in any derivative work so modified without +// permission of the authors of FFTW. + +// $Id: hires_timer.h,v 1.1.2.4 2006/12/14 22:22:00 korpela Exp $ +// +#include "sah_config.h" +#include +#ifdef HAVE_INTTYPES_H +#include +#endif +#ifdef HAVE_STDINT_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#ifdef TIME_WITH_SYS_TIME +#include +#endif +#else +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_SYSCALL_H +#include +#endif +#ifdef HAVE_LINUX_PERF_EVENT_H +#include +#endif + + +#if defined(HAVE_HRTIME_T) && defined(HAVE_GETHRTIME) +typedef hrtime_t tick_t; +#elif defined(HAVE_INT_FAST64_T) +typedef int_fast64_t tick_t; +#elif defined(HAVE_INT64_T) +typedef int64_t tick_t; +#elif defined(HAVE__INT64) +typedef _int64 tick_t; +#elif defined(HAVE_LONG_LONG) +typedef long long tick_t; +#else +typedef double tick_t; +#endif + +typedef double second_t; + +class hires_timer { + public: + hires_timer(); + tick_t ticks(); // current time value in ticks + tick_t delta() const {return ticks_min_incr;}; + inline second_t seconds() {return (second_t)(ticks()*period);}; + inline second_t frequency() const {return 1.0/period;}; + inline second_t resolution() const {return (second_t)ticks_min_incr*period;}; + inline second_t start() { + register second_t tmp=seconds(); + do { + start_time=seconds(); + } while ((start_time-tmp) +#include + +#ifndef MAXSIG + +#ifdef NSIG +#define MAXSIG (NSIG+1) + +#elif defined(__linux__) +#define MAXSIG 64 + +#elif defined(SIGRTMAX) +#define MAXSIG SIGRTMAX + +#elif defined(_SIGRTMAX) +#define MAXSIG _SIGRTMAX + +#else +#define MAXSIG 32 +#endif + +#endif + +#if defined(HAVE_SIGJMP_BUF) +static sigjmp_buf jb; +#else +static jmp_buf jb; +#endif + +#if !defined(HAVE_SIGSETJMP) && !defined(sigsetjmp) +#define sigsetjmp(x,y) setjmp(x) +#endif + +#if !defined(HAVE_SIGLONGJMP) && !defined(siglongjmp) +#define siglongjmp(x,y) longjmp(x,y) +#endif +static int sc; + +typedef void (*signal_handler)(int); + +#if defined(HAVE_SYSV_SIGNAL) +#define signal(x,y) sysv_signal(x,y) +#elif defined(HAVE_BSD_SIGNAL) +#define signal(x,y) bsd_signal(x,y) +#endif + +/* all our signal handler does is jump to a place we've set */ +static void sighandler(int x) { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("sighandler()"); +#endif +#if defined(HAVE_SIGACTION) + sigset_t unblock; + sigemptyset(&unblock); + sigaddset(&unblock,x); + sigprocmask(SIG_UNBLOCK,&unblock,NULL); +#elif defined(HAVE_SYSV_SIGNAL) + // SYSV resets the handler but keeps signal unblocked + sysv_signal(x,sighandler); +#elif defined(HAVE_BSD_SIGNAL) + // BSD keeps the handler, but blocks the signal. + // Nothing should need to be done here. +#else + // who knows which version of signal this is. + // Do the safe thing. + signal(x,sighandler); +#endif + sc++; +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + siglongjmp(jb,1); +} + +/* flags to mark whether we've been installed already */ +static int installed[MAXSIG]; + +/* a place to save our the existing signal handlers */ +#ifdef HAVE_SIGACTION +static struct sigaction oldhandler[MAXSIG]; +#else +static signal_handler oldhandler[MAXSIG]; +#endif + +/* these are the signals we'll handle */ +static const int install_handler[]={ +#ifdef SIGILL + SIGILL, +#endif +#ifdef SIGPRIV + SIGPRIV, +#endif +#ifdef SIGSEGV + SIGSEGV, +#endif +#ifdef SIGBUS + SIGBUS, +#endif +#ifdef SIGIOT + SIGIOT, +#endif +#ifdef SIGABRT + SIGABRT, +#endif +#ifdef SIGSTKFLT + SIGSTKFLT, +#endif + 0 +}; + +/* Keep these as stubs even if signal handling is not enabled */ +static inline void install_sighandler() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("install_sighandler()"); +#endif +#ifdef HAVE_SIGACTION + struct sigaction new_action; + new_action.sa_handler=sighandler; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags=0; +#endif + int i=0,sig; + while ((sig=install_handler[i])!=0) { + if (!installed[sig]) { +#ifdef HAVE_SIGACTION + sigaction(sig,&new_action,oldhandler+sig); +#else + oldhandler[sig]=signal(sig,sighandler); +#endif + installed[sig]=1; + } + i++; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + + +static inline void uninstall_sighandler() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("install_sighandler()"); +#endif + /* Don't uninstall the windows signal handler! */ + int i=0,sig; + while ((sig=install_handler[i])!=0) { + if (installed[sig]) { +#ifdef HAVE_SIGACTION + sigaction(sig,oldhandler+sig,NULL); +#else + signal(sig,oldhandler[sig]); +#endif + installed[sig]=0; + } + i++; + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + +//static inline void reinstall_sighandler() { +// uninstall_sighandler(); +// install_sighandler(); +//} + +#endif /* SIGHANDLER_H */ diff --git a/client/vector/x86_float4.cpp b/client/vector/x86_float4.cpp new file mode 100644 index 0000000..b4f4d6d --- /dev/null +++ b/client/vector/x86_float4.cpp @@ -0,0 +1,77 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: x86_float4.cpp,v 1.1.2.5 2007/07/16 15:36:56 korpela Exp $ +// + +// This file is empty is __i386__ is not defined +#include "sah_config.h" +#include "math.h" +#include "limits.h" +#include "x86_ops.h" +#include "x86_float4.h" + +#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_AMD64) + +// polynomial coefficients for sine / cosine approximation in the chirp routine +const_float4 SS4F(-0.0046075748); +const_float4 CC3F(-0.0204391631); +const_float4 SS3F(0.0796819754); +const_float4 CC2F(0.2536086171); +const_float4 SS2F(-0.645963615); +const_float4 CC1F(-1.2336977925); +const_float4 SS1F(1.5707963235); +const_float4 ONE(1.0); +const_float4 TWO(2.0); + +const_float4 SS1(1.5707963268); +const_float4 SS2(-0.6466386396); +const_float4 SS3(0.0679105987); +const_float4 SS4(-0.0011573807); +const_float4 CC1(-1.2341299769); +const_float4 CC2(0.2465220241); +const_float4 CC3(-0.0123926179); + +const_float4 ZERO(0.0); +const_float4 THREE(3.0); +const_float4 RECIP_TWO(0.5); +const_float4 RECIP_THREE(1.0 / 3.0); +const_float4 RECIP_FOUR(0.25); +const_float4 RECIP_FIVE(0.2); +const_float4 RECIP_PI(1.0/M_PI); +const_float4 RECIP_TWOPI(0.5/M_PI); +const_float4 RECIP_HALFPI(2.0/M_PI); +const_float4 PI(M_PI); +const_float4 TWOPI(2.0*M_PI); +const_float4 HALFPI(0.5*M_PI); +const_float4 R_NEG(-1,1,-1,1); + +// 2^23 (used by round()) +const_float4 TWO_TO_23(8388608.0); +const_float4 INDGEN[]={const_float4(1,2,3,4),const_float4(5,6,7,8)}; + +#endif diff --git a/client/vector/x86_float4.h b/client/vector/x86_float4.h new file mode 100644 index 0000000..524d90e --- /dev/null +++ b/client/vector/x86_float4.h @@ -0,0 +1,266 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: x86_float4.h,v 1.1.2.4 2007/07/16 15:36:57 korpela Exp $ +// + +// This file is empty is __i386__ is not defined +// +#ifndef _X86_FLOAT4_H_ +#define _X86_FLOAT4_H_ + +#include "sah_config.h" + +#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_AMD64) + +#include "x86_ops.h" + +#ifndef M_PI + #define M_PI 3.14159265358979323846 +#endif + +struct float4; +struct const_float4; + +extern const_float4 SS1, SS2, SS3, SS4, CC1, CC2, CC3; +extern const_float4 SS1F, SS2F, SS3F, SS4F, CC1F, CC2F, CC3F; +extern const_float4 ZERO, ONE, TWO, THREE, RECIP_TWO; +extern const_float4 RECIP_THREE, RECIP_FOUR, RECIP_FIVE; +extern const_float4 RECIP_PI, RECIP_TWOPI, RECIP_HALFPI; +extern const_float4 R_NEG; +// 2^23 (used by quickRound) +extern const_float4 TWO_TO_23; +extern const_float4 INDGEN[2]; + +ALIGNED(static const int sign_bits[4],16)={INT_MIN, INT_MIN, INT_MIN, INT_MIN}; +ALIGNED(static const int other_bits[4],16)={INT_MAX, INT_MAX, INT_MAX, INT_MAX}; +#define SIGN_BITS (*(__m128i *)sign_bits) +#define OTHER_BITS (*(__m128i *)other_bits) + + + +struct float4 { + float4() {}; + float4(const __m128 b) { m=b; }; + float4(const float &fval) { +#ifdef USE_INTRINSICS + m=_mm_load1_ps(&fval); +#elif defined(__GNUC__) + __asm__ ( "shufps $0,%0,%0\n":"=x" (m):"0" (fval) ); +#endif + }; + float4(const float &f1, const float &f2, const float &f3, const float &f4) + { v[0]=f1; v[1]=f2; v[2]=f3; v[3]=f4; }; + float4(const float4 &b) { m=b.m; }; + float4(const const_float4 &b) { m=((float4 *)&b)->m; }; + inline float4 operator +(const float4 &f) const { + register float4 rv; +#ifdef USE_INTRINSICS + rv.m=_mm_add_ps(m,f.m); +#elif defined(__GNUC__) + __asm__ ( "addps %2,%0" : "=x" (rv.m) : "0" (m), "xm" (f.m) ); +#endif + return rv; + }; + inline float4 operator -(const float4 &f) const { + register float4 rv; +#ifdef USE_INTRINSICS + rv.m=_mm_sub_ps(m,f.m); +#elif defined(__GNUC__) + __asm__ ( "subps %2,%0" : "=x" (rv.m) : "0" (m), "xm" (f.m) ); +#endif + return rv; + }; + inline float4 operator *(const float4 &f) const { + register float4 rv; +#ifdef USE_INTRINSICS + rv.m=_mm_mul_ps(m,f.m); +#elif defined(__GNUC__) + __asm__ ( "mulps %2,%0" : "=x" (rv.m) : "0" (m), "xm" (f.m) ); +#endif + return rv; + }; + inline float4 operator |(const __m128i &b) const { + register float4 rv; +#ifdef USE_INTRINSICS + rv.m=_mm_or_ps(*(__m128 *)&b,m); +#elif defined(__GNUC__) + __asm__ ( "orps %2,%0" : "=x" (rv.m) : "0" (b), "xm" (m)); +#endif + return rv; + }; + inline float4 operator &(const __m128i &b) const { + register float4 rv; +#ifdef USE_INTRINSICS + rv.m=_mm_and_ps(*(__m128 *)&b,m); +#elif defined(__GNUC__) + __asm__ ( "andps %2,%0" : "=x" (rv.m) : "0" (b), "xm" (m)); +#endif + return rv; + }; + inline float4 &operator =(const float4 &b) { + m=b.m; + return *this; + }; + inline float4 &operator *=(const float4 &b) { +#ifdef USE_INTRINSICS + m=_mm_mul_ps(m,b.m); +#elif defined(__GNUC__) + __asm__ ( "mulps %2,%0" : "=x" (m) : "0" (m), "xm" (b.m) ); +#endif + return *this; + } + inline float4 &operator +=(const float4 &b) { +#ifdef USE_INTRINSICS + m=_mm_add_ps(m,b.m); +#elif defined(__GNUC__) + __asm__ ( "addps %2,%0" : "=x" (m) : "0" (m), "xm" (b.m) ); +#endif + return *this; + } + inline float4 &operator -=(const float4 &b) { +#ifdef USE_INTRINSICS + m=_mm_sub_ps(m,b.m); +#elif defined(__GNUC__) + __asm__ ( "subps %2,%0" : "=x" (m) : "0" (m), "xm" (b.m) ); +#endif + return *this; + } + inline float4 &operator /=(const float4 &b) { +#ifdef USE_INTRINSICS + m=_mm_div_ps(m,b.m); +#elif defined(__GNUC__) + __asm__ ( "divps %2,%0" : "=x" (m) : "0" (m), "xm" (b.m) ); +#endif + return *this; + } + inline operator __m128() {return m;}; + inline operator __m128i() {return *(__m128i *)&m; }; + inline float4 abs() const { + // clear the sign bits + return *this & OTHER_BITS; + }; + + inline float4 sign() const { + // return the sign bits + return *this & SIGN_BITS; + }; + inline float4 round() const { + // add and subtract the largest exactly + // representable integer value of the same sign + register float4 s(sign()); + register float4 a(s | (float4)TWO_TO_23); + a=(*this+a)-a; + return a; + }; + inline float4 ceil() const { + return (*this+RECIP_TWO).round(); + } + inline float4 floor() const { + return (*this-RECIP_TWO).round(); + } + inline float4 mod(const float4 &x) const { + register float4 nx(*this*x.recip()); + nx-=nx.round(); // [-0.5,0.5) + nx*=x; // [-x/2,x/2) + return nx; + } + inline float4 round_pos() const { + return ((*this+TWO_TO_23)-TWO_TO_23); + }; + inline float4 round_neg() const { + return ((*this-TWO_TO_23)+TWO_TO_23); + }; + inline void sincos(float4 &s, float4 &c) const { + register float4 x(*this*RECIP_TWOPI); + x-=x.round(); + register float4 x2(x*x); + register float4 t1(x2*SS4+SS3); + register float4 t2(x2*CC3+CC2); + t1*=x2; + t2*=x2; + t1+=SS2; + t2+=CC1; + t1*=x2; + t2*=x2; + t1+=SS1; + c=t2+ONE; + s=t1*x; + } + inline float4 sin() const { + register float4 x(*this*RECIP_TWOPI); + x-=x.round(); + register float4 x2(x*x); + return ((((x2*SS4+SS3)*x2+SS2)*x2+SS1)*x); + } + inline float4 cos() const { + register float4 x(*this*RECIP_TWOPI); + x-=x.round(); + x*=x; + return (((x*CC3+CC2)*x+CC1)*x+ONE); + } + template + inline float4 shuffle(float4 b) const { +#ifdef USE_INTRINSICS + return _mm_shuffle_ps(m,b.m,_MM_SHUFFLE(p3,p2,p1,p0)); +#elif defined(__GNUC__) + register float4 rv; + __asm__ ( "shufps %3,%2,%0" : "=x" (rv) : "0" (m), "x" (b.m), "i" (p0 | (p1 << 2) | (p2<<4) | (p3 << 6)) ); + return rv; +#endif + } + inline float4 rsqrt() const { + } + inline float4 sqrt() const { + } + inline float4 recip() const { + } + union { + ALIGNED(__m128 m,16); + float v[4]; + float f; + }; +} ; + +struct const_float4 : public float4 { + public: + inline const_float4() : float4() {}; + inline const_float4(const __m128 b) : float4() { m=b; }; + inline const_float4(const float &fval) : float4() { + v[0]=fval; v[1]=fval; v[2]=fval; v[3]=fval; + } + inline const_float4(const float &f1, const float &f2, const float &f3, const float &f4) + { v[0]=f1; v[1]=f2; v[2]=f3; v[3]=f4; }; + inline const_float4(const float4 &b) { m=b.m; }; + inline operator float4() const { return *this; }; + inline operator __m128() {return m;}; + inline operator __m128i() {return *(__m128i *)&m; }; +}; + +#endif +#endif + diff --git a/client/vector/x86_ops.h b/client/vector/x86_ops.h new file mode 100644 index 0000000..5a0c5da --- /dev/null +++ b/client/vector/x86_ops.h @@ -0,0 +1,201 @@ +// Copyright (c) 1999-2006 Regents of the University of California +// +// FFTW: Copyright (c) 2003,2006 Matteo Frigo +// Copyright (c) 2003,2006 Massachusets Institute of Technology +// +// fft8g.[cpp,h]: Copyright (c) 1995-2001 Takya Ooura + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any later +// version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions +// as an alternative to FFTW and distribute a linked executable and +// source code. You must obey the GNU General Public License in all +// respects for all of the code used other than the FFT library itself. +// Any modification required to support these libraries must be distributed +// under the terms of this license. If you modify this program, you may extend +// this exception to your version of the program, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. Please be aware that FFTW is not covered by this exception, +// therefore you may not use FFTW in any derivative work so modified without +// permission of the authors of FFTW. + +#ifndef _X86_OPS_H_ +#define _X86_OPS_H_ + +#if defined(_M_AMD64) || defined(__x86_64__) +// Make sure we use MMX,SSE/2/3 on x86_64 +#ifndef USE_MMX +#define USE_MMX 1 +#ifndef __MMX__ +#define __MMX__ +#endif +#endif +#ifndef USE_3DNOW +#define USE_3DNOW 1 +#define __3DNOW__ 1 +#endif +#ifndef USE_SSE +#define USE_SSE 1 +#define __SSE__ 1 +#endif +#ifndef USE_SSE2 +#define USE_SSE2 1 +#define __SSE2__ 1 +#endif +#ifndef USE_SSE3 +#define USE_SSE3 1 +#define __SSE3__ 1 +#endif +#endif + +#if defined(__GNUC__) +#define ALIGN_ATTR(x) __attribute__((aligned(x))) +#define ALIGN_DECL(x) +#else +#define ALIGN_ATTR(x) +#define ALIGN_DECL(x) __declspec(align(x)) +#endif + +// How to declare an aligned variable. +#define ALIGNED(decl,x) \ + ALIGN_DECL(x) decl ALIGN_ATTR(x) + + + +#if defined (_WIN64) && defined (_M_AMD64) +#ifdef HAVE_EMMINTRIN_H +#ifdef USE_SSE2 +#include +#endif +#endif +#elif defined(__SSE__) || defined(USE_SSE) || defined(__SSE2__) +// Make sure MSC doesn't use slow emulations +#undef _MM_FUNCTIONALITY +#undef _MM2_FUNCTIONALITY +#ifdef HAVE_EMMINTRIN_H +#ifdef USE_SSE2 +#if (__GNUC__ < 4) || ((__GNUC__ > 3) && defined(__SSE2__)) +#include +#endif +#endif +#endif +#ifdef HAVE_XMMINTRIN_H +#include +#endif +#endif + + +// We will use the defines __SSE__, __SSE2__ and __SSE3__ +// GCC defines these based upon command line args. +#if defined(USE_MMX) && !defined(__MMX__) +#define __MMX__ 1 +#endif +#if defined(USE_SSE) && !defined(__SSE__) +#define __SSE__ 1 +#endif +#if defined(USE_SSE2) && !defined(__SSE2__) +#define __SSE2__ 1 +#endif +#if defined(USE_SSE3) && !defined(__SSE3__) +#define __SSE3__ 1 +#endif + +#if defined(__MMX__) +// MMX instructions/macros here. +#endif + +#if defined(__3DNOW__) + +// 3DNOW functions/macros here +#ifdef HAVE_MM3DNOW_H +#include +#else +// #warning No 3DNow header available... +#endif + +#endif + +#if defined(__SSE3__) +// PNI specific functions/macros here. +#endif + +#if defined(__SSE2__) +// SSE2 specific functions/macros here. +#if defined(_MSC_VER) || defined(__clang__) +typedef __m128d x86_m128d; +#else +typedef double x86_m128d __attribute__ ((mode(V2DF))) __attribute__((aligned(16))); +#endif +#endif + +#if defined(__SSE__) +// SSE specific functions/macros here. +#if defined(_MSC_VER) || defined(__clang__) +typedef __m128 x86_m128; +typedef __m128i x86_m128i; +#else +typedef float x86_m128 __attribute__ ((mode(V4SF))) __attribute__((aligned(16))); +typedef int x86_m128i __attribute__ ((mode(V4SI))) __attribute__((aligned(16))); +#endif + +static inline void prefetcht0(const void *v) { +#ifdef USE_INTRINSICS + _mm_prefetch((const char *)v,_MM_HINT_T0); +#elif defined(__GNUC__) + __asm__ volatile ( "prefetcht0 %0" : : "m" (*(const char *)v) ); +#endif +} + +static inline void prefetcht1(const void *v) { +#ifdef USE_INTRINSICS + _mm_prefetch((const char *)v,_MM_HINT_T1); +#elif defined(__GNUC__) + __asm__ volatile ( "prefetcht1 %0" : : "m" (*(const char *)v) ); +#endif +} + +static inline void prefetcht2(const void *v) { +#ifdef USE_INTRINSICS + _mm_prefetch((const char *)v,_MM_HINT_T2); +#elif defined(__GNUC__) + __asm__ volatile ( "prefetcht2 %0" : : "m" (*(const char *)v) ); +#endif +} + +static inline void prefetchnta(const void *v) { +#ifdef USE_INTRINSICS + _mm_prefetch((const char *)v,_MM_HINT_NTA); +#elif defined(__GNUC__) + __asm__ volatile ( "prefetchnta %0" : : "m" (*(const char *)v) ); +#endif +} + +#endif + +#ifndef __m128d +#define __m128d x86_m128d +#endif + +#ifndef __m128i +#define __m128i x86_m128i +#endif + +#ifndef __m128 +#define __m128 x86_m128 +#endif + +#endif diff --git a/client/win-sah_config.h b/client/win-sah_config.h new file mode 100644 index 0000000..250693c --- /dev/null +++ b/client/win-sah_config.h @@ -0,0 +1,515 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +/* config.h. Generated by configure. */ + +#ifndef _SAH_WIN_CONFIG_H_ +#define _SAH_WIN_CONFIG_H_ + +#if _MSC_VER ==1900 + struct IUnknown;//R: to make clang toolchain in VS2015 happy (though it too green to be usable anyway; doesn't implement needed intrinsics) +#endif +#ifdef __MINGW32__ +#include +#endif +#include "boinc_win.h" + + +#ifndef AP_CLIENT +#ifdef __MINGW32__ +#include "seti_boinc_private.h" +#elif defined(_MSC_VER) +#include "win_build/seti_boinc_private.h" +#endif +#endif + +#ifdef _MSC_VER +#define HAVE_INTRIN_H 1 +#else +#define HAVE_IMMINTRIN_H 1 +#define HAVE_PMMINTRIN_H 1 +#endif +#ifndef AP_CLIENT +#define HAVE_XMMINTRIN_H 1 +#define HAVE_EMMINTRIN_H 1 +#define USE_INTRINSICS 1 +#define USE_SSE 1 +#define USE_SSE2 1 +#define USE_SSE3 1 +#define USE_AVX 1 +#endif +/* Define to 1 if you have the _aligned_malloc() function */ +#ifdef _MSC_VER +#if _MSC_VER == 1500 //R: VS2008 unable to build AVX + #undef USE_AVX +#endif +#define HAVE__ALIGNED_MALLOC 1 +#define HAVE__ALIGNED_FREE 1 +#endif + +/* Define to the typecast required for arg 2 of _mm256_maskstore_ps() */ +// TODO: Simply this mess. Should only need 1 #if and an #else +#if defined(_MSC_VER) +#define AVX_MASKSTORE_TYPECAST(x) (*reinterpret_cast<__m256i *>(&x)) +#elif (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5) \ + || ((__GNUC__ == 4) && (__GNUC_MINOR__ == 5) && (__GNUC_PATCHLEVEL__ > 2)) \ + || ((__GNUC__ == 4) && (__GNUC_MINOR__ == 4) && (__GNUC_PATCHLEVEL__ > 5))) +#define AVX_MASKSTORE_TYPECAST(x) *reinterpret_cast<__m256i *>(&x) +#elif defined(__GNUC__) +#define AVX_MASKSTORE_TYPECAST(x) static_cast<__m256>(x) +#else +#define AVX_MASKSTORE_TYPECAST(x) static_cast<__m256i>(x) +#endif + +// Deactivate AVX when it's definitely not supported. +#if defined(__GNUC__) && ( \ + (__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 4))) +#undef USE_AVX +#undef HAVE_IMMINTRIN_H +#endif + +#if defined(__GNUC__) +#define HAVE_DECL___BUILTIN_ALLOCA 1 +#define HAVE_DECL___BUILTIN_CLZ 1 +#define HAVE_DECL___BUILTIN_FFS 1 +#define HAVE_DECL___BUILTIN_POPCOUNT 1 +#define HAVE_DECL___BUILTIN_PREFETCH 1 +#define HAVE___BUILTIN_ALLOCA 1 +#define HAVE___BUILTIN_CLZ 1 +#define HAVE___BUILTIN_FFS 1 +#define HAVE___BUILTIN_POPCOUNT 1 +#define HAVE___BUILTIN_PREFETCH 1 +#endif + +/* Define to 1 if you have the alloca() function */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have the atanf() function */ +#define HAVE_ATANF 1 + +/* Define to 1 if you have the `atexit' function. */ +#define HAVE_ATEXIT 1 + +/* Define to 1 if you have the `atoll' function. */ +#ifdef __MINGW32__ +#define HAVE_ATOLL 1 +#endif + +/* Define to 1 if the system has the type `bool'. */ +#define HAVE_BOOL 1 + +/* Define to 1 if you have the cosf() function */ +#define HAVE_COSF 1 + +/* Define to 1 if you have the header file. */ +/* #define HAVE_DIRENT_H 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `floor' function. */ +#define HAVE_FLOOR 1 + +/* Define to 1 if you have the `fork' function. */ +//#define HAVE_FORK 1 + +/* Define to 1 if you have the `getcwd' function. */ +// #define HAVE_GETCWD 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_GLUT_GLUT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GL_FREEGLUT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GLUT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GLU_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GL_GLUT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_GL_GLU_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GL_GL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTTYPES_H */ + +#ifdef __MINGW32__ +#define HAVE_INT32_T 1 +#define HAVE_INT64_T 1 +#endif + +#define HAVE__ISNAN 1 + +/* Define to 1 if you have the `aio' library (-laio). */ +//#define HAVE_LIBAIO 1 + +/* Define to 1 if you have the `dl' library (-ldl). */ +//#define HAVE_LIBDL 1 + +/* Define to 1 if you have the `elf' library (-lelf). */ +//#define HAVE_LIBELF 1 + +/* Define to 1 if you have the `fftw' library (-lfftw). */ +#define HAVE_LIBFFTW 1 + +/* Define to 1 if you have the `GL' library (-lGL). */ +#define HAVE_LIBGL 1 + +/* Define to 1 if you have the `ICE' library (-lICE). */ +//#define HAVE_LIBICE 1 + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +//#define HAVE_LIBNSL 1 + +/* Define to 1 if you have the `rsaeuro' library (-lrsaeuro). */ +/* #undef HAVE_LIBRSAEURO */ + +/* Define to 1 if you have the `s4' library (-ls4). */ +/* #undef HAVE_LIBS4 */ + +/* Define to 1 if you have the `SM' library (-lSM). */ +//#define HAVE_LIBSM 1 + +/* Define to 1 if you have the `socket' library (-lsocket). */ +//#define HAVE_LIBSOCKET 1 + +/* Define to 1 if you have the `stdc++' library (-lstdc++). */ +//#define HAVE_LIBSTDC__ 1 + +/* Define to 1 if you have the `X11' library (-lX11). */ +//#define HAVE_LIBX11 1 + +/* Define to 1 if you have the `Xaw' library (-lXaw). */ +//#define HAVE_LIBXAW 1 + +/* Define to 1 if you have the `Xext' library (-lXext). */ +//#define HAVE_LIBXEXT 1 + +/* Define to 1 if you have the `Xmu' library (-lXmu). */ +//#define HAVE_LIBXMU 1 + +/* Define to 1 if you have the `Xt' library (-lXt). */ +/* #define HAVE_LIBXT 1 */ + +/* Define to 1 if you have the `z' library (-lz). */ +/* #define HAVE_LIBZ 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if long double works and has more range or precision than + double. */ +#define HAVE_LONG_DOUBLE 1 + +/* Define to 1 if the system has the type `long long'. */ +#ifdef __MINGW32__ +#define HAVE_LONG_LONG 1 +#endif + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `munmap' function. */ +/* #define HAVE_MUNMAP 1 */ + +/* Define if your C++ compiler supports namespaces */ +#define HAVE_NAMESPACES 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENGL_GLUT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENGL_GLU_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENGL_GL_H */ + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#define HAVE_REALLOC 1 + +/* Define to 1 if you have the sinf() function */ +#define HAVE_SINF 1 + +/* Define to 1 if you have the sincosf() function */ +/* #undef HAVE_SINCOSF */ + +/* Define to 1 if you have the `sqrt' function. */ +#define HAVE_SQRT 1 + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +/* #undef HAVE_STAT_EMPTY_STRING_BUG */ + +#if ( _MSC_VER > 1300 ) || defined(__MINGW32__) + /* Define to 1 if the max template is in namespace std. */ + #define HAVE_STD_MAX 1 + + /* Define to 1 if the min template is in namespace std. */ + #define HAVE_STD_MIN 1 +#endif + +/* Define to 1 if the transform template is in namespace std. */ +#define HAVE_STD_TRANSFORM 1 + +/* Define to 1 if stdbool.h conforms to C99. */ +/* #undef HAVE_STDBOOL_H */ + +/* Define to 1 if you have the header file. */ +#ifdef __MINGW32__ +#define HAVE_STDINT_H 1 +#endif + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +#ifdef __MINGW32__ +#define HAVE_STRCASECMP 1 +#endif + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +/* #define HAVE_STRINGS_H 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if `st_blocks' is member of `struct stat'. */ +/* #define HAVE_STRUCT_STAT_ST_BLOCKS 1 */ + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +/* #define HAVE_ST_BLOCKS 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_IOCTL_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_STATVFS_H 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TIME_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +/* #define HAVE_SYS_WAIT_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_UNISTD_H 1 */ + +/* Define to 1 if you have the `vfork' function. */ +/* #define HAVE_VFORK 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VFORK_H */ + +/* Define to 1 if `fork' works. */ +/* #define HAVE_WORKING_FORK 1 */ + +/* Define to 1 if `vfork' works. */ +/* #define HAVE_WORKING_VFORK 1 */ + +/* Define to 1 if the system has the type `_Bool'. */ +/* #undef HAVE__BOOL */ + +#ifndef __MINGW32__ + +/* Define to 1 if the system has the type `_int32'. */ +#define HAVE__INT32 1 + +/* Define to 1 if the system has the type `_int64'. */ +#define HAVE__INT64 1 + +#endif + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +/* #undef LSTAT_FOLLOWS_SLASHED_SYMLINK */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +#define MAJOR_IN_MKDEV 1 + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* Define for custom build identification in stderr */ + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT +#define PACKAGE_BUGREPORT "korpela@ssl.berkeley.edu" + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME +#define PACKAGE_NAME FILE_DESCRIPTION + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING +#define PACKAGE_STRING FILE_DESCRIPTION" " FILE_VERSION + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME +#define PACKAGE_TARNAME FILE_DESCRIPTION + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION +#define PACKAGE_VERSION FILE_VERSION + +#ifndef COMPILER_STRING +#ifdef __MINGW32__ +#define QUOTEME_(x) #x +#define QUOTEME(x) QUOTEME_(x) +#define COMPILER_STRING "DevC++/MinGW/g++ "\ + QUOTEME(__GNUC__) "."\ + QUOTEME(__GNUC_MINOR__) "."\ + QUOTEME(__GNUC_PATCHLEVEL__) +#elif defined(_MSC_VER) +#if _MSC_VER == 1500 + #define COMPILER_STRING "Visual Studio 2008/Microsoft Visual C++ 9" +#elif _MSC_VER ==1600 + #define COMPILER_STRING "Visual Studio 2010/Microsoft Visual C++ 10" +#elif _MSC_VER ==1900 + #define COMPILER_STRING "Visual Studio 2015/Microsoft Visual C++ 14" +#else + #define COMPILER_STRING "Visual Studio/Microsoft Visual C++" +#endif +#else +#define COMPILER_STRING "Unknown Compiler" +#endif +#endif + +#ifndef CUSTOM_STRING +#define CUSTOM_STRING "setiathome_v8 " FILE_VERSION " " COMPILER_STRING +#endif + +/* The size of a `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE sizeof (long double) + +/* The size of a `long int', as computed by sizeof. */ +#define SIZEOF_LONG_INT 4 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define to 1 if informix is installed */ +/* #undef USE_INFORMIX */ + +/* Define if MYSQL is installed */ +/* #undef USE_MYSQL */ + +/* SETI@home major version number */ +#define VERSION_MAJOR VER_MAJOR + +/* SETI@home minor version number */ +#define VERSION_MINOR VER_MINOR + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +#ifdef __MINGW32__ +#undef HAVE_SIGACTION +#undef HAVE_STRLCPY +#undef HAVE_STRLCAT +#endif + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#ifdef _MSC_VER +#undef inline +typedef ptrdiff_t ssize_t; +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +/* #undef malloc */ + +/* Define to `long' if does not define. */ +/* #undef off_t */ + +/* Define to `int' if does not define. */ +/* #undef pid_t */ + +/* Define to rpl_realloc if the replacement function should be used. */ +/* #undef realloc */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ + +/* Define as `fork' if `vfork' does not work. */ +/* #undef vfork */ + +#if defined(HAVE_LIBFFTW) +#define USE_FFTWF +#endif + +#if defined(USE_INFORMIX) && defined(USE_MYSQL) && defined(HAVE_NAMESPACES) +#define USE_NAMESPACES +#endif + +#endif diff --git a/client/worker.cpp b/client/worker.cpp new file mode 100644 index 0000000..dfd8389 --- /dev/null +++ b/client/worker.cpp @@ -0,0 +1,219 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// worker.C: SETI-independent worker logic +// $Id: worker.cpp,v 1.32.2.14 2007/08/10 00:38:49 korpela Exp $ +// +#include "sah_config.h" + + +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#ifndef _WIN32 +#include +#endif + +#ifdef BOINC_APP_GRAPHICS +#include "sah_gfx_main.h" +#endif +#include "s_util.h" +#include "seti_header.h" +#include "seti.h" +#include "worker.h" +#include "chirpfft.h" +#include "analyzeFuncs.h" +#include "analyzeReport.h" + +#include "filesys.h" +#include "boinc_api.h" + +#ifdef __arm__ +#include +#endif + +#include "worker.h" + +using std::string; + +int verbose=1; + +// this gets called first on all platforms +int common_init() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("common_init()"); +#endif +#ifdef ALLOW_CFFT_FILE + FILE* f; + f = boinc_fopen(CFFT_FILENAME, "r"); + if (f) { + cfft_file = &debug_cfft_file[0]; + fclose(f); + } +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +// Do this when start on a work unit for the first time. +// Creates result header file. +static int initialize_for_wu() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("initialize_for_wu()"); +#endif + int retval = 0; + FILE* f; + string path; + + boinc_resolve_filename_s(OUTFILE_FILENAME, path); + f = boinc_fopen(path.c_str(), "wb"); + if (!f) SETIERROR(FOPEN_FAILED,"in initialize_for_wu()"); + xml_indent(2); + fprintf(f, "\n"); + retval = seti_write_wu_header(f, 1); + fclose(f); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + + return retval; +} + +// parse input and state files +// +static int read_wu_state() { +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("read_wu_state()"); +#endif + FILE* f; + int retval=0; + string path; + FORCE_FRAME_POINTER; + + boinc_resolve_filename_s(WU_FILENAME, path); + f = boinc_fopen(path.c_str(), "rb"); + if (f) { +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) sprintf(sah_graphics->status, "Scanning data file\n"); +#endif + retval = seti_parse_wu(f, analysis_state); + fclose(f); + if (retval) SETIERROR(retval,"from seti_parse_wu() in read_wu_state()"); + } else { + char msg[1024]; + sprintf(msg,"(%s) in read_wu_state() errno=%d\n",path.c_str(),errno); + SETIERROR(FOPEN_FAILED,msg); + } + + retval = seti_init_state(); + if (retval) SETIERROR(retval,"from seti_init_state() in read_wu_state()"); + +#ifdef BOINC_APP_GRAPHICS + if (sah_graphics) sprintf(sah_graphics->status, "Scanning state file.\n"); +#endif + if (boinc_file_exists(STATE_FILENAME)) { + retval = parse_state_file(analysis_state); + } else { + retval = initialize_for_wu(); + if (retval) SETIERROR(retval,"from initialize_for_wu() in read_wu_state()"); + } + + boinc_fraction_done(progress*remaining+(1.0-remaining)*(1.0-remaining)); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + return 0; +} + +void worker() { + int retval=0; + run_stage=POSTINIT; + FORCE_FRAME_POINTER; +#ifdef USE_MANUAL_CALLSTACK + call_stack.enter("worker()"); +#endif +#if defined(__GNUC__) && defined (__i386__) + __asm__ __volatile__ ("andl $-16, %esp"); +#endif + +// Set up the FPU if necessary. +#if 0 +#ifdef __arm__ + controlfp(0,0xc00000); +#endif +#endif + + try { + retval = common_init(); + if (retval) SETIERROR(retval,"from common_init() in worker()"); + + retval = read_wu_state(); + if (retval) SETIERROR(retval,"from read_wu_state() in worker()"); + + retval = seti_do_work(); + if (retval) SETIERROR(retval,"from seti_do_work() in worker()"); +#if 0 //R: Set for PGO + exit(retval); +#else + boinc_finish(retval); +#endif + } + catch (seti_error e) { + if (e == RESULT_OVERFLOW) { + fprintf(stderr, "SETI@Home Informational message -9 result_overflow\n"); + fprintf(stderr, "NOTE: The number of results detected equals the storage space allocated.\n"); + final_report(); // add flop and signal counts + progress=1; + remaining=0; + boinc_fraction_done(progress); + checkpoint(true); // force a checkpoint +#if 1 //R: set 0 for PGO logging test + boinc_finish(0); +#endif +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + exit(0); // an overflow is not an app error + } else { + e.print(); +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif + exit(static_cast(e)); + } + } +#ifdef USE_MANUAL_CALLSTACK + call_stack.exit(); +#endif +} + diff --git a/client/worker.h b/client/worker.h new file mode 100644 index 0000000..f2a28ee --- /dev/null +++ b/client/worker.h @@ -0,0 +1,39 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// $Id: worker.h,v 1.5.2.2 2007/06/01 20:24:43 korpela Exp $ + +extern int common_init(); +extern void worker(); +extern char * cfft_file; +extern char debug_cfft_file[]; + +extern int run_stage; +#define PREGRX 0 +#define GRXINIT 1 +#define POSTINIT 2 + diff --git a/client/working_collect2_line_for_android_armv6-neon b/client/working_collect2_line_for_android_armv6-neon new file mode 100644 index 0000000..16cbb75 --- /dev/null +++ b/client/working_collect2_line_for_android_armv6-neon @@ -0,0 +1 @@ + /usr/arm-linux-androideabi/bin/../libexec/gcc/arm-linux-androideabi/4.6/collect2 --sysroot=/usr/arm-linux-androideabi/sysroot --eh-frame-hdr -dynamic-linker /system/bin/linker -X -m armelf_linux_eabi -z noexecstack -z relro -z now -o seti_boinc /usr/arm-linux-androideabi/sysroot/usr/lib/crtbegin_dynamic.o -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib/${targetarch} -L/usr/arm-linux-androideabi/sysroot/usr/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib/${targetarch} -L/usr/arm-linux-androideabi/sysroot/usr/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib -L/usr/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.6 -L/usr/arm-linux-androideabi/bin/../lib/gcc -L/usr/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/lib -L/usr/arm-linux-androideabi/sysroot/usr/lib seti_boinc-main.o seti_boinc-analyzeFuncs_vector.o seti_boinc-analyzeFuncs_fpu.o seti_boinc-analyzeFuncs_sse.o seti_boinc-analyzeFuncs_sse2.o seti_boinc-analyzeFuncs_sse3.o seti_boinc-analyzeFuncs_avx.o seti_boinc-analyzeFuncs_x86_64.o seti_boinc-analyzeFuncs_altivec.o analyzeFuncs_neon.o analyzeFuncs_vfp.o seti_boinc-analyzeFuncs_vfp_aux.o seti_boinc-x86_float4.o seti_boinc-hires_timer.o seti_boinc-analyzeFuncs.o seti_boinc-analyzeReport.o seti_boinc-analyzePoT.o seti_boinc-pulsefind.o seti_boinc-gaussfit.o seti_boinc-lcgamm.o seti_boinc-malloc_a.o seti_boinc-seti.o seti_boinc-seti_header.o seti_boinc-timecvt.o seti_boinc-s_util.o seti_boinc-sah_version.o seti_boinc-worker.o seti_boinc-chirpfft.o seti_boinc-spike.o seti_boinc-autocorr.o seti_boinc-progress.o seti_boinc-fft8g.o seti_boinc-gdata.o seti_boinc-schema_master.o seti_boinc-sqlrow.o seti_boinc-sqlblob.o seti_boinc-xml_util.o -lboinc_opencl -lboinc_api -lboinc -lfftw3f /usr/arm-linux-androideabi/arm-linux-androideabi/lib/libstdc++.a -lssl -lcrypto -Bdynamic -lm -Bstatic --whole-archive --no-whole-archive -lgcc -Bdynamic -llog -lc -ldl -Bstatic -lgcc /usr/arm-linux-androideabi/sysroot/usr/lib/crtend_android.o diff --git a/client/working_collect2_line_for_android_armv6-vfp b/client/working_collect2_line_for_android_armv6-vfp new file mode 100644 index 0000000..f2465f4 --- /dev/null +++ b/client/working_collect2_line_for_android_armv6-vfp @@ -0,0 +1 @@ + /usr/arm-linux-androideabi/bin/../libexec/gcc/arm-linux-androideabi/4.6/collect2 --sysroot=/usr/arm-linux-androideabi/sysroot --eh-frame-hdr -dynamic-linker /system/bin/linker -X -m armelf_linux_eabi -z noexecstack -z relro -z now -o seti_boinc /usr/arm-linux-androideabi/sysroot/usr/lib/crtbegin_dynamic.o -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib/${targetarch} -L/usr/arm-linux-androideabi/sysroot/usr/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib/${targetarch} -L/usr/arm-linux-androideabi/sysroot/usr/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib -L/usr/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.6 -L/usr/arm-linux-androideabi/bin/../lib/gcc -L/usr/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/lib -L/usr/arm-linux-androideabi/sysroot/usr/lib seti_boinc-main.o seti_boinc-analyzeFuncs_vector.o seti_boinc-analyzeFuncs_fpu.o seti_boinc-analyzeFuncs_sse.o seti_boinc-analyzeFuncs_sse2.o seti_boinc-analyzeFuncs_sse3.o seti_boinc-analyzeFuncs_avx.o seti_boinc-analyzeFuncs_x86_64.o seti_boinc-analyzeFuncs_altivec.o analyzeFuncs_vfp.o seti_boinc-analyzeFuncs_vfp_aux.o seti_boinc-x86_float4.o seti_boinc-hires_timer.o seti_boinc-analyzeFuncs.o seti_boinc-analyzeReport.o seti_boinc-analyzePoT.o seti_boinc-pulsefind.o seti_boinc-gaussfit.o seti_boinc-lcgamm.o seti_boinc-malloc_a.o seti_boinc-seti.o seti_boinc-seti_header.o seti_boinc-timecvt.o seti_boinc-s_util.o seti_boinc-sah_version.o seti_boinc-worker.o seti_boinc-chirpfft.o seti_boinc-spike.o seti_boinc-autocorr.o seti_boinc-progress.o seti_boinc-fft8g.o seti_boinc-gdata.o seti_boinc-schema_master.o seti_boinc-sqlrow.o seti_boinc-sqlblob.o seti_boinc-xml_util.o -lboinc_opencl -lboinc_api -lboinc -lfftw3f /usr/arm-linux-androideabi/arm-linux-androideabi/lib/libstdc++.a -lssl -lcrypto -Bdynamic -lm -Bstatic --whole-archive --no-whole-archive -lgcc -Bdynamic -llog -lc -ldl -Bstatic -lgcc /usr/arm-linux-androideabi/sysroot/usr/lib/crtend_android.o diff --git a/client/x86_64_graphics_link b/client/x86_64_graphics_link new file mode 100644 index 0000000..020ecd6 --- /dev/null +++ b/client/x86_64_graphics_link @@ -0,0 +1 @@ + g++ -g -Wall -I/usr/local/include -static-libgcc -g -Wall -I/usr/local/include -I/usr/include -I/usr/include/openssl -DHAVE_CONFIG_H -DTEXT_UI -DNDEBUG -DCLIENT -I../db -I../client -I../client/win_build -I/home/korpela/build/x86_64-linux/boinc -I/home/korpela/build/x86_64-linux/boinc/api -I/home/korpela/build/x86_64-linux/boinc/lib -I/home/korpela/build/x86_64-linux/boinc/sched -I/home/korpela/build/x86_64-linux/boinc/db -I/home/korpela/build/x86_64-linux/boinc/clientgui/mac -pthread -msse2 -mfpmath=sse -DUSE_SSE -DUSE_SSE2 -I/usr/ -g -Wall -I/usr/local/include -I/usr/include -I/usr/include/openssl -o seti_graphics seti_graphics-timecvt.o seti_graphics-sah_gfx.o seti_graphics-sah_gfx_base.o seti_graphics-graphics_main.o seti_graphics-sah_version.o -pthread -L/usr/local/lib -L/usr/lib64 -L/home/korpela/build/x86_64-linux/boinc/api -L/home/korpela/build/x86_64-linux/boinc/lib /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libstdc++.a /home/korpela/build/x86_64-linux/boinc/api/.libs/libboinc_graphics2.a /usr/lib64/libglut.so /usr/lib64/libGLU.so /usr/lib64/libGL.so /usr/lib64/libjpeg.a /home/korpela/build/x86_64-linux/boinc/api/.libs/libboinc_api.a /home/korpela/build/x86_64-linux/boinc/lib/.libs/libboinc.a /lib64/libssl.a /lib64/libcrypto.a -pthread /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libstdc++.a /usr/lib64/libm.a diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..a007d6d --- /dev/null +++ b/configure.ac @@ -0,0 +1,688 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. +# $Id: $ + + +AC_PREREQ(2.57) +AC_INIT(setiathome_v8, 8.00, korpela@ssl.berkeley.edu) +AC_CONFIG_MACRO_DIR([m4]) +svnrev="`svn info | grep Revision:`" + +if test -n "${svnrev}" ; then + AC_REVISION("${svnrev}") + AC_DEFINE_UNQUOTED(SVN_REV,"${svnrev}", + [Define to be the subversion revision number]) +else + AC_REVISION([$Revision: 1146 $]) + AC_DEFINE(SVN_REV,"$Revision: 1146 $", + [Define to be the subversion revision number]) +fi + +echo "WARNING! Changes have been made which are not compatible with SETI@home" +echo "v7. Do not use this version with the projects until v8 is released" + +AC_CANONICAL_TARGET +AM_INIT_AUTOMAKE(dist-zip) +AC_CONFIG_SRCDIR([client/analyze.h]) + +AC_CACHE_SAVE + +# Set up the prefix early. +if test "x$prefix" = "xNONE" ; then + prefix="${ac_default_prefix}" +fi +if test "x$exec_prefix" = "xNONE" ; then + exec_prefix="${ac_default_prefix}" +fi + + +# Make sure we use the same initial CFLAGS and CXXFLAGS unless otherwise told. +if test -z "${CXXFLAGS}" +then + CXXFLAGS="${CFLAGS}" +elif test -z "${CFLAGS}" +then + CFLAGS="${CXXFLAGS}" +fi + +# make sure $includedir is in CFLAGS and $libdir is in LDFLAGS. +tmpinc="`eval echo ${includedir}`" +tmplib="`eval echo ${libdir}`" +if test -z "`echo ${CFLAGS} | grep ${tmpinc}`" ; then + CFLAGS="${CFLAGS} -I${tmpinc}" +fi +if test -z "`echo ${CXXFLAGS} | grep ${tmpinc}`" ; then + CXXFLAGS="${CXXFLAGS} -I${tmpinc}" +fi +if test -z "`echo ${LDFLAGS} | grep ${tmplib}`" ; then + LDFLAGS="${LDFLAGS} -L${tmplib}" +fi + +AC_ARG_ENABLE(intrinsics, + AS_HELP_STRING([--disable-intrinsics], + [disable use of intrinsics in SIMD code])) + + +if test "x$enable_intrinsics" != xno ; then + enable_intrinsics=yes +fi + +AC_ARG_ENABLE(graphics, + AC_HELP_STRING([--disable-graphics], + [disable building the client graphics])) + +if test "x$enable_graphics" != xno ; then + enable_graphics=yes +else + enable_graphics=no +fi + + +AC_ARG_ENABLE(tests, + AC_HELP_STRING([--disable-tests], + [disable tests (fakedata and hires_timer_test)]), + [], + [enable_tests=yes]) + +AC_ARG_ENABLE(server, + AC_HELP_STRING([--disable-server], + [disable building the seti@home server components]), + [], + [enable_server=yes]) + + +AC_ARG_ENABLE(client, + AC_HELP_STRING([--disable-client], + [disable building the client]), + [], + [enable_client=yes]) + +AC_ARG_ENABLE(static-client, + AC_HELP_STRING([--disable-static-client], + [allow dynamic libraries to be used in the client]), + [enable_static_client=${enableval}], + [enable_static_client=yes]) + +m4_divert_once([HELP_ENABLE], + AC_HELP_STRING([], [Default: --enable-server --enable-client: + builds both server and client])) + +if test "${enable_server}" = yes ; then + if test "${enable_client}" = yes ; then + configured_to_build='server & client' + else + configured_to_build='server only' + fi +else + if test "${enable_client}" = yes ; then + configured_to_build='client only' + else + AC_MSG_WARN([Youve disabled both the server and the client. Nothing useful will be built]) + fi +fi + +AC_MSG_NOTICE(["--- Configuring SETI_BOINC AC_PACKAGE_VERSION (${configured_to_build}) ---"]) + + +AC_COPYRIGHT([ +Copyright (C) 2004 Regents of the University of California + +SETI_BOINC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +more details. + +You should have received a copy of the GNU General Public License along +with SETI_BOINC; see the file COPYING. If not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +Contributor(s): +]) + +major_version=`echo AC_PACKAGE_VERSION | sed 's/\..*//'` +minor_version=`echo AC_PACKAGE_VERSION | sed 's/.*\.//' | sed 's/^0//'` +AC_SUBST([MAJOR_VERSION], [$major_version]) +AC_SUBST([MINOR_VERSION], [$minor_version]) +AC_DEFINE_UNQUOTED([VERSION_MAJOR],$major_version, [SETI@home major version number]) +AC_DEFINE_UNQUOTED([VERSION_MINOR],$minor_version, [SETI@home minor version number]) +AC_DEFINE_UNQUOTED([SAH_APP_NAME],["$PACKAGE_NAME"], [Define to the BOINC application name for setiathome]) +SAH_TOP_DIR=`pwd` +AC_SUBST([SAH_TOP_DIR]) + +AM_MAINTAINER_MODE + +# Checks for programs. +PATH="/usr/xpg4/bin:${PATH}" +AC_PROG_CXX +AC_PROG_CXXCPP +AM_PROG_CC_C_O +AM_PROG_AS +AC_PROG_AWK +AC_PROG_LN_S +AC_PATH_PROG(TR,[tr]) +AC_PATH_PROGS(AR,[ar lib]) +AC_PATH_PROG(GREP,[grep]) +AC_PATH_PROG(AUTOCONF,[autoconf]) +AC_PATH_PROG(AUTOHEADER,[autoheader]) +AC_PATH_PROGS(INDENT,[astyle indent]) +AC_PATH_PROGS(CP,[cp copy]) +AC_PATH_PROGS(LN,[ln cp copy]) +AC_PATH_PROG(SORT,[sort]) +AC_PATH_PROG(UNIQ,[uniq]) +AC_PATH_PROG(CAT,[cat type]) +AC_PATH_PROG(MV,[mv]) +AC_PATH_PROGS(RM,[rm Rm del erase delete]) + +AC_LIBTOOL_DLOPEN +AC_LIBTOOL_WIN32_DLL +AM_PROG_LIBTOOL +AC_SUBST(PICFLAGS,${lt_prog_compiler_pic}) +AC_SUBST(SED) +AC_C_BIGENDIAN +AX_C_FLOAT_WORDS_BIGENDIAN + +SAH_OPTION_BITNESS + +SAH_REQUIRES([boinc],[SAH_CHECK_BOINC],["${no_boinc}" = yes], +[ +ERROR: trying to build the seti_boinc client or server but BOINC was not +found. +You can get boinc at http://boinc.ssl.berkeley.edu/ +], +[exit 1]) +AC_SUBST([BOINCDIR]) + +dnl Determine the BOINC platform given the target arch-platform-os. +BOINC_PLATFORM + +if test -n `echo $INDENT | grep astyle` +then + AC_SUBST([INDENT_FLAGS],["--c --indent-classes --indent-switches --brackets=attach --convert-tabs"]) +else + AC_SUBST([INDENT_FLAGS],["-kr"]) +fi +AC_PROG_MAKE_SET +SAH_DLLEXT +SAH_LIBEXT +if test -n "$EXEEXT" +then + DOTEXEEXT=".$EXEEXT" +fi +AC_SUBST(DOTEXEEXT) +AC_SYS_LARGEFILE +AX_PTHREAD([AC_DEFINE(HAVE_PTHREAD,1, [Have pthread])]) + +if test "x$enable_client" = xyes ; then + +# find the right flag for building a static app +if test "x$enable_static_client" != xno ; then + svldflags="$LDFLAGS" + SAH_CHECK_LDFLAG([-static],[LDSTATIC=-static]) + LDFLAGS="$svldflags" +fi + +# Check libraries required or desired for seti_boinc app +# Checks for libraries. +APP_LDFLAGS="$LDSTATIC $LDFLAGS" +APP_CFLAGS="$CFLAGS" +AC_CHECK_LIB([log],[__android_log_print], + [APP_LIBS="-llog ${APP_LIBS}"]) + +dnl AC_CHECK_LIB([corkscrew],[unwind_backtrace_signal_arch], +dnl [APP_LIBS="-lcorkscrew ${APP_LIBS}"]) + +AC_CHECK_LIB([m], [sin],[ + AC_DEFINE([HAVE_LIBM],[1],[Define to 1 if you have the math library]) + APP_LIBS="-lm ${APP_LIBS}" +]) +SAH_CHECK_MATH_FUNCS([sqrt floor sinf cosf sincos sincosf atanf isnan _isnan __isnan __isnanf _isnanf isnanf]) +AC_CHECK_LIB([fftw3f], [fftwf_plan_dft_1d], [ + AC_DEFINE([HAVE_LIBFFTW3F],[1],[Define to 1 if you have the fftw3f library]) + APP_LIBS="-lfftw3f ${APP_LIBS}" +], +[], +[-lm]) +AC_CHECK_LIB([fftw3], [fftwf_plan_dft_1d], [ + AC_DEFINE([HAVE_LIBFFTW3F],[1],[Define to 1 if you have the fftw3f library]) + APP_LIBS="-lfftw3 ${APP_LIBS}" +], +[], +[-lm]) +AC_CHECK_LIB([cpufeatures], [android_getCpuFeatures], [ + AC_DEFINE([HAVE_LIBCPUFEATURES],[1],[Define to 1 if you have the cpufeatures library]) + APP_LIBS="-lcpufeatures ${APP_LIBS}" +], +[], +[-lm]) +AC_ARG_ENABLE(neon, + AC_HELP_STRING([--disable-neon], + [Disable neon instruction set on ARM devices]), + [enable_neon=${enableval}], + [enable_neon=yes]) +if test "x${enable_neon}" = xyes ; then + AC_DEFINE([USE_NEON],1,[Define to 1 to enable neon instructions on ARM devices]) +fi + +SAH_CHECK_ASMLIB +APP_LIBS="${ASMLIB_LIBS} ${APP_LIBS}" +APP_CFLAGS="${ASMLIB_CFLAGS} ${APP_CFLAGS}" +APP_LDFLAGS="${ASMLIB_LDFLAGS} ${APP_LDFLAGS}" + +# Check for additional optimization flags +SAH_OPTIMIZATIONS + +# Check for intel performance primatives +SAH_CHECK_IPP +if test x$found_ipp = xyes ; then + APP_LDFLAGS="-L${IPPDIR}/lib ${APP_LDFLAGS}" + APP_LIBS="-lippcore -lippsmerged ${APP_LIBS}" + APP_CFLAGS="-I${IPPDIR}/include ${APP_CFLAGS}" +fi + +AC_SUBST([APP_LIBS]) +AC_SUBST([APP_LDFLAGS]) +AC_SUBST([APP_CFLAGS]) + +if test "$enable_graphics" = yes ; then + SAH_GRX_LIBS + AX_CHECK_GL + AX_CHECK_GLU + AX_CHECK_GLUT + if test "$no_gl" = yes -o "$no_glu" = yes -o "$no_glut" = yes ; then + have_glut=no + enable_graphics=no + AC_MSG_WARN([ +================================================================================ +WARNING: GL/GLU/GLUT not found. + +The GL, GLU, and GLUT libraries are required in order to build the graphical +parts of the BOINC application API library. + +==> only building non-graphical parts of the BOINC API Library for now. + +================================================================================ + ]) +else + AC_DEFINE([BOINC_APP_GRAPHICS],1,[Define to 1 to build a graphical application]) + SAH_GRX_INCLUDES + GRAPHICS_CFLAGS="${GRX_CFLAGS} ${GL_CFLAGS} ${GLU_CFLAGS} ${GLUT_CFLAGS}" + GRAPHICS_LIBS="${GL_LIBS} ${GLU_LIBS} ${GLUT_LIBS} ${GRX_LIBS} -ljpeg" + +case ${target} in + powerpc-apple*) GRAPHICS_LIBS="${GRAPHICS_LIBS} -framework AppKit -framework CoreServices" + ;; +esac + GRAPHICS_LIBS_RAW="${PTHREAD_CFLAGS} -L${BOINCDIR}/api -L${BOINCDIR}/lib -lboinc_graphics2 -lboinc ${GRAPHICS_LIBS}" +dnl SAH_RAW_LDFLAGS(["${PTHREAD_CFLAGS} -L${BOINCDIR}/api -L${BOINCDIR}/lib -lboinc_graphics2 -lboinc ${GRAPHICS_LIBS}"],[GRAPHICS_LIBS_RAW]) + have_glut=yes + enable_graphics=yes + fi +fi +AC_SUBST([LDSTATIC]) +AC_SUBST([GRAPHICS_CFLAGS]) +AC_SUBST([GRAPHICS_LIBS]) +AC_SUBST([GRAPHICS_LIBS_RAW]) + +AC_CACHE_SAVE + +fi + +dnl SAH_CHECK_LIB([c],[atexit], +dnl AC_DEFINE([HAVE_LIBC],[1],[Define to 1 if you have the c library])) +dnl SAH_CHECK_LIB([pthread],[pthread_join], +dnl AC_DEFINE([HAVE_LIBPTHREAD],[1],[Define to 1 if you have the pthread library])) +dnl AC_CHECK_LIB([gcc],[sscanf], +dnl AC_DEFINE([HAVE_LIBGCC],[1],[Define to 1 if you have the gcc library])) +dnl SAH_CHECK_LIB([gcc_eh],[_Unwind_Resume], +dnl AC_DEFINE([HAVE_LIBGCC_EH],[1],[Define to 1 if you have the gcc_eh library])) +dnl SAH_CHECK_LIB([gcc_s],[sscanf], +dnl AC_DEFINE([HAVE_LIBGCC_S],[1],[Define to 1 if you have the gcc_s library])) +dnl AC_CHECK_LIB([stdc++],[sscanf], +dnl AC_DEFINE([HAVE_LIBSTDC__],[1],[Define to 1 if you have the stdc++ library])) +dnl AC_CHECK_LIB([z], [uncompress], +dnl AC_DEFINE([HAVE_LIBZ],[1],[Define to 1 if you have the z library])) +dnl AC_CHECK_LIB([socket], [bind], +dnl AC_DEFINE([HAVE_LIBSOCKET],[1],[Define to 1 if you have the socket library])) +dnl AC_CHECK_LIB([rt], [sched_get_priority_min], +dnl AC_DEFINE([HAVE_LIBRT],[1],[Define to 1 if you have the rt library])) +dnl AC_CHECK_LIB([nsl], [gethostbyname], +dnl AC_DEFINE([HAVE_LIBNSL],[1],[Define to 1 if you have the nsl library])) +dnl AC_CHECK_LIB([elf], [elf_hash], +dnl AC_DEFINE([HAVE_LIBELF],[1],[Define to 1 if you have the elf library])) +dnl AC_CHECK_LIB([aio], [aio_fork], +dnl AC_DEFINE([HAVE_LIBAIO],[1],[Define to 1 if you have the aio library])) +CHECK_SSL +AC_CHECK_LIB([ssl], [fopen], + [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} -L${SSLDIR}/lib ${sah_lib_last}"]) +AC_CHECK_LIB([crypto], [RSA_new], + [BOINC_EXTRA_LIBS="${BOINC_EXTRA_LIBS} -L${SSLDIR}/lib ${sah_lib_last}"]) + +dnl AC_CHECK_LIB([dl], [dlopen], +dnl AC_DEFINE([HAVE_LIBDL],[1],[Define to 1 if you have the dl library])) +AC_LANG(C++) + +case ${target} in + *-apple-darwin*) CLIENT_EXTRA_LIBS="${CLIENT_EXTRA_LIBS} -framework Accelerate -framework CoreServices" + ;; +esac + + +if test "${ac_cv_cxx_compiler_gnu}" = "yes" ; then + gcc_version_string="`${CXX} --version | head -1`" + AC_DEFINE_UNQUOTED([COMPILER_STRING],"$gcc_version_string",[Define to a string identifying your compiler]) +else if test -n "${CXX}" ; then + AC_DEFINE_UNQUOTED([COMPILER_STRING],"$CXX",[Define to a string identifying your compiler]) +else if test -n "${CC}" ; then + AC_DEFINE_UNQUOTED([COMPILER_STRING],"$CC",[Define to a string identifying your compiler]) +fi +fi +fi + + + +SAH_SERVER_REQUIRES([mysql],[SAH_CHECK_MYSQL],["${no_mysql}" = yes]) +SAH_SERVER_REQUIRES([informix],[SAH_CHECK_INFORMIX],["${no_informix}" = yes]) +SAH_SERVER_REQUIRES([setilib],[SAH_FIND_SETILIB],["${no_setilib}" = yes]) +SAH_SERVER_REQUIRES([healpix],[SAH_CHECK_HEALPIX],["${no_healpix}" = yes]) +SAH_SERVER_REQUIRES([cfitsio],[SAH_CHECK_CFITSIO],["${no_cfitsio}" = yes]) +SAH_SERVER_REQUIRES([seti_gbt],[SAH_CHECK_SETI_GBT],["${no_seti_gbt}" = yes]) + +# Checks for header files. +AC_HEADER_STDC +SAH_LARGEFILE_BREAKS_CXX +SAH_HEADER_STDCXX +AC_HEADER_SYS_WAIT +AC_HEADER_TIME +AC_CHECK_HEADERS([mmap.h mman.h sys/mman.h fcntl.h inttypes.h limits.h memory.h alloca.h malloc.h stdlib.h string.h strings.h errno.h sys/time.h sys/types.h sys/ioctl.h sys/statvfs.h unistd.h dirent.h math.h float.h ieeefp.h floatingpoint.h complex.h fftw3.h setjmp.h signal.h mach/mach_time.h sys/param.h sys/systm.h machine/cpu.h sys/syscall.h cpu-features.h sys/cpu-features.h machine/cpu-features.h linux/perf_event.h]) +save_cxxflags="${CXXFLAGS}" +save_cppflags="${CPPFLAGS}" +CXXFLAGS="${CXXFLAGS} -msse3" +CPPFLAGS="${CPPFLAGS} -msse3" +AC_CHECK_HEADERS([intrin.h x86intrin.h pmmintrin.h xmmintrin.h emmintrin.h]) +CXXFLAGS="${save_cxxflags} -mavx" +CPPFLAGS="${save_cppflags} -mavx" +AC_CHECK_HEADERS([immintrin.h avxintrin.h]) +CXXFLAGS="${save_cxxflags}" +CPPFLAGS="${save_cppflags}" +if test "x$enable_intrinsics" != "xno" ; then + if test "x$ac_cv_header_xmmintrin_h" != "xno" -o "x$ac_cv_header_emmintrin_h" != "xno" ; then + AC_DEFINE([USE_INTRINSICS],[1],[Define to 1 to use SIMD intrinsics rather than inline assembly]) + fi +fi +AC_CACHE_SAVE + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_C_LONG_DOUBLE +AC_TYPE_OFF_T +AC_TYPE_SIZE_T +AC_STRUCT_ST_BLOCKS +AC_STRUCT_TM +AC_CHECK_SIZEOF([short]) +AC_CHECK_SIZEOF([int]) +AC_CHECK_SIZEOF([long int]) +AC_CHECK_SIZEOF([float]) +AC_CHECK_SIZEOF([double]) +AC_CHECK_SIZEOF([long double]) +AC_CHECK_TYPES([long long,_int64,int64_t,bool,_int32, _uint32, int32_t, uint32_t, hrtime_t, uint_fast64_t, uint64_t, _uint64, u_int64_t, ptrdiff_t, ssize_t, off64_t]) +AC_CHECK_TYPES([sigjmp_buf, jmp_buf], [], [], [[#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#ifdef HAVE_SIGNAL_H +# include +#endif +#ifdef HAVE_SETJMP_H +# include +#endif +]]) +CXXFLAGS="${save_cxxflags} -mavx" +CPPFLAGS="${save_cppflags} -mavx" +AC_CHECK_TYPES([__m256,_m256,__m256d,_m256d,__m256i,_m256i],[],[],[[#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif +#define __AVX__ 1 +#if defined(HAVE_IMMINTRIN_H) +#include +#elif defined(HAVE_AVXINTRIN_H) +#include +#elif defined(HAVE_X86INTRIN_H) +#include +#elif defined(HAVE_INTRIN_H) +#include +#endif +]]) +CXXFLAGS="${save_cxxflags}" +CPPFLAGS="${save_cppflags}" + +AC_CACHE_SAVE + +# Checks for library functions. +AC_LANG(C) +AC_FUNC_FORK +AC_HEADER_MAJOR +AC_FUNC_ALLOCA +if test "${ac_cv_func_alloca_works}" = "yes" ; then + ac_cv_func_alloca="yes" +fi +AC_FUNC_STAT +AC_FUNC_STRFTIME +AC_CHECK_DECLS([__builtin_alloca,__builtin_popcount,__builtin_prefetch,__builtin_clz,__builtin_ffs,__builtin_isnan], + [],[],[[ +#include +#include +]]) +if test "${ac_cv_have_decl___builtin_alloca}" = "yes" ; then + ac_cv_func___builtin_alloca="yes" +fi +if test "${ac_cv_have_decl___builtin_popcount}" = "yes" ; then + ac_cv_func___builtin_popcount="yes" +fi +if test "${ac_cv_have_decl___builtin_prefetch}" = "yes" ; then + ac_cv_func___builtin_prefetch="yes" +fi +if test "${ac_cv_have_decl___builtin_clz}" = "yes" ; then + ac_cv_func___builtin_clz="yes" +fi +if test "${ac_cv_have_decl___builtin_ffs}" = "yes" ; then + ac_cv_func___builtin_ffs="yes" +fi +if test "${ac_cv_have_decl___builtin_isnan}" = "yes" ; then + ac_cv_func___builtin_isnan="yes" +fi + +AC_CHECK_FUNCS([ _aligned_malloc alloca _alloca __builtin_alloca __builtin_popcount __builtin_prefetch __builtin_clz __builtin_ffs posix_memalign memalign atexit exit _exit getcwd memset munmap putenv strchr strstr strcasestr atoll dlopen gethrtime mach_absolute_time get_cyclecount clock_gettime nanotime microtime gettimeofday sqrt floor sinf cosf sincos sincosf atanf isnan _isnan __isnan __builtin_isnan isnanf _isnanf __isnanf siglongjmp sigsetjmp sigaction sysv_signal bsd_signal ]) +SAH_CHECK_NAMESPACES +AH_TEMPLATE([HAVE_STD_MIN],[Define to 1 if min is in namespace std::]) +AH_TEMPLATE([HAVE_STD_MAX],[Define to 1 if max is in namespace std::]) +AH_TEMPLATE([HAVE_STD_TRANSFORM],[Define to 1 if transform is in namespace std::]) +SAH_FUNCS_IN_NAMESPACE([['min(0,0)'] ['max(0,0)'] ['transform((char *)0,(char *)0,(char *)0,(int(*)(int))malloc)']],std) + +SAH_AVX + +AM_CONDITIONAL(USE_MY_IMAGELIBS, [false]) +AM_CONDITIONAL(USE_MY_GLUT, [false]) +AM_CONDITIONAL(ENABLE_TESTS, [test "${enable_tests}" = yes]) +AM_CONDITIONAL(ENABLE_SERVER, [test "${enable_server}" = yes]) +AM_CONDITIONAL(ENABLE_CLIENT, [test "${enable_client}" = yes]) +AM_CONDITIONAL(ENABLE_GUI, [test "${enable_graphics}" = yes]) +AM_CONDITIONAL(LINUX, [test -n "`echo ${target} | grep linux`"]) +AM_CONDITIONAL(I386, [test -n "`echo ${target} | $EGREP 'i.86|x86_64|amd64'`" -a $COMPILER_MODEL_BITS -eq 32]) +AM_CONDITIONAL(X86_64, [test -n "`echo ${target} | $EGREP 'i.86|x86_64|amd64'`" -a $COMPILER_MODEL_BITS -eq 64 ]) +AM_CONDITIONAL(PPC, [test -n "`echo ${target} | grep 'powerpc'`" -o -n "`echo ${target} | grep 'ppc'`" ]) +AM_CONDITIONAL(AVX, [test "x${have_avx}" = "xyes"]) +if test "x${avx_type}" != "x" ; then + AC_DEFINE_UNQUOTED([AVX_MASKSTORE_TYPECAST(x)],[reinterpret_cast<$avx_type>(x)], + [Define to the typecast required for arg 2 of _mm256_maskstore_ps()]) +else + AC_DEFINE_UNQUOTED([AVX_MASKSTORE_TYPECAST(x)],[(x)], + [Define to the typecast required for arg 2 of _mm256_maskstore_ps()]) +fi + +AC_ARG_WITH([float-abi], + AC_HELP_STRING([--with-float-abi=], + [set -mfloat-abi parameter for gcc]), + [FP_ABI_FLAGS="-mfloat-abi=$withval"],[ + if test "x$FP_ABI_FLAGS" = "x" && test "x`echo ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} | grep mfloat-ab`" = "x" ; then + case $host in + arm-*-armhf|arm-*-gnueabihf) + FP_ABI_FLAGS="-mfloat-abi=hard" + ;; + arm-*-armel|arm-*-androideabi|arm-*-gnueabi) + FP_ABI_FLAGS="-mfloat-abi=softfp" + ;; + *) FP_ABI_FLAGS= + ;; + esac + fi +]) + +AC_ARG_WITH([fpu], + AC_HELP_STRING([--with-fpu=], + [set -mfpu parameter for gcc]), + [FP_FLAGS="-mfpu=$withval"],[ + if test "x$FP_ABI_FLAGS" != "x-mfloat-abi=soft" && ! ( echo ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} | grep "mfloat-abi=soft[[ $]]" >/dev/null ) ; then + if test "x$FP_FLAGS" = "x" && ! ( echo ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} | grep mfpu >/dev/null ) ; then + case $host in + arm-*-armhf|arm-*-armel|arm-*-androideabi) + FP_FLAGS="-mfpu=vfp" + ;; + *) FP_FLAGS= + ;; + esac + fi + fi +]) + + +AC_SUBST([FP_ABI_FLAGS]) +AC_SUBST([FP_FLAGS]) + +AC_CACHE_SAVE + +AH_TOP([ +#ifndef _SAH_CONFIG_H_ +#define _SAH_CONFIG_H_ + +#if defined(__linux__) && !defined(ANDROID) +#define _POSIX_C_SOURCE 1 +#endif + +#ifdef _WIN32 +#include "win-sah_config.h" +#else +]) + + +AH_BOTTOM([ + +/* Define USE_NAMESPACES if you may access more than one database from the + * same program + */ + +#endif + +/* + * Use fftw if we have the library + */ +#if defined(HAVE_LIBFFTW3F) && defined(HAVE_FFTW3_H) +#define USE_FFTWF +#endif + +#if defined(USE_INFORMIX) && defined(USE_MYSQL) && defined(HAVE_NAMESPACES) +#define USE_NAMESPACES +#endif + +#if !defined(CUSTOM_STRING) && defined(COMPILER_STRING) +#define CUSTOM_STRING PACKAGE_STRING" "SVN_REV" "COMPILER_STRING +#endif + +#include "std_fixes.h" + +#endif +]) + +AC_SUBST([CLIENT_EXTRA_LIBS]) + +AC_CONFIG_FILES([Makefile + glut/Makefile + image_libs/Makefile + jpeglib/Makefile + client/Makefile + tools/Makefile + db/Makefile + db/tools/Makefile + db/schema_to_class + assimilator/Makefile + validate/Makefile + splitter_pfb/Makefile + splitter_fft/Makefile + ]) +AC_CONFIG_HEADERS([sah_config.h]) + +AC_OUTPUT +chmod +x db/schema_to_class diff --git a/configure.ac.public b/configure.ac.public new file mode 100644 index 0000000..c590496 --- /dev/null +++ b/configure.ac.public @@ -0,0 +1,141 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + + +AC_PREREQ(2.57) +AC_INIT(setiathome, 4.0, ports@setiathome.ssl.berkeley.edu) +AC_CONFIG_SRCDIR([client/analyze.h]) +AC_CONFIG_HEADER([config.h]) + +major_version=`echo AC_PACKAGE_VERSION | sed 's/\..*//'` +minor_version=`echo AC_PACKAGE_VERSION | sed 's/.*\.//' | sed 's/^0//'` +AC_SUBST([MAJOR_VERSION], [$major_version]) +AC_SUBST([MINOR_VERSION], [$minor_version]) +AC_DEFINE_UNQUOTED([VERSION_MAJOR],$major_version, [SETI@home major version number]) +AC_DEFINE_UNQUOTED([VERSION_MINOR],$minor_version, [SETI@home minor version number]) +AC_DEFINE_UNQUOTED([SAH_APP_NAME],["$PACKAGE_NAME"], [Define to the BOINC application name for setiathome]) + +AC_CANONICAL_HOST + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CXXCPP +AC_PROG_AWK +AC_PROG_RANLIB +AC_PATH_PROG(SED,[sed]) +AC_PATH_PROG(TR,[tr]) +AC_PATH_PROGS(AR,[ar lib]) +AC_PATH_PROG(AUTOCONF,[autoconf]) +AC_PATH_PROG(AUTOHEADER,[autoheader]) +AC_PATH_PROGS(INDENT,[astyle indent]) +AC_PATH_PROG(SORT,[sort]) +AC_PATH_PROG(UNIQ,[uniq]) +AC_PATH_PROG(CAT,[cat type]) +AC_PATH_PROG(MV,[mv]) +AC_PATH_PROGS(RM,[rm Rm del erase delete]) +if test -n `echo $INDENT | grep astyle` +then + AC_SUBST([INDENT_FLAGS],["--c --indent-classes --indent-switches --brackets=attach --convert-tabs"]) +else + AC_SUBST([INDENT_FLAGS],["-kr"]) +fi +AC_PROG_MAKE_SET +SAH_DLLEXT +SAH_LIBEXT +if test -n "$EXEEXT" +then + DOTEXEEXT=".$EXEEXT" +fi +AC_SUBST(DOTEXEEXT) +AC_SYS_LARGEFILE + +# Checks for libraries. +AC_LANG(C++) +AC_CHECK_LIB([cygipc],[shmget]) +AC_CHECK_LIB([aio], [aio_fork]) +AC_CHECK_LIB([dl], [dlclose]) +AC_CHECK_LIB([elf], [elf_hash]) +AC_CHECK_LIB([fftw], [fftw_create_plan]) +AC_CHECK_LIB([m], [sin]) +AC_CHECK_LIB([nsl], [gethostbyname]) +AC_CHECK_LIB([socket], [bind]) +AC_CHECK_LIB([z], [uncompress]) +AC_CHECK_LIB([stdc++], [main]) +SAH_GRX_LIBS +SAH_CHECK_BOINC +SAH_CHECK_MYSQL +SAH_CHECK_INFORMIX +SAH_FIND_S4PATH +AC_CACHE_SAVE + +# Checks for header files. +AC_HEADER_STDC +SAH_LARGEFILE_BREAKS_CXX +SAH_HEADER_STDCXX +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h memory.h stdlib.h string.h strings.h sys/ioctl.h sys/statvfs.h sys/time.h unistd.h dirent.h]) +SAH_GRX_INCLUDES +AC_CACHE_SAVE + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STDBOOL +AC_C_CONST +AC_C_INLINE +AC_C_LONG_DOUBLE +AC_TYPE_OFF_T +AC_TYPE_SIZE_T +AC_STRUCT_ST_BLOCKS +AC_STRUCT_TM +AC_CHECK_SIZEOF([long int]) +AC_CHECK_SIZEOF([long double]) +AC_CHECK_TYPES([long long,_int64,bool]) +AC_CACHE_SAVE + +# Checks for library functions. +AC_LANG(C) +AC_FUNC_FORK +AC_HEADER_MAJOR +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_FUNC_STAT +AC_FUNC_STRFTIME +AC_CHECK_FUNCS([atexit floor getcwd memset munmap putenv sqrt strchr strstr atoll]) +SAH_CHECK_NAMESPACES +AH_TEMPLATE([HAVE_STD_MIN],[Define to 1 if min is in namespace std::]) +AH_TEMPLATE([HAVE_STD_MAX],[Define to 1 if max is in namespace std::]) +AH_TEMPLATE([HAVE_STD_TRANSFORM],[Define to 1 if transform is in namespace std::]) +SAH_FUNCS_IN_NAMESPACE([['min(0,0)'] ['max(0,0)'] ['transform((char *)0,(char *)0,(char *)0,(int(*)(int))malloc)']],std) + +AC_CACHE_SAVE + +AH_TOP([ +#ifndef _SAH_CONFIG_H_ +#define _SAH_CONFIG_H_ + +#ifdef _WIN32 +#include "win-config.h" +#endif +]) + + +AH_BOTTOM([ + +/* Define USE_NAMESPACES if you may access more than one database from the + * same program + */ +#if defined(USE_INFORMIX) && defined(USE_MYSQL) && defined(HAVE_NAMESPACES) +#define USE_NAMESPACES +#endif + +#include "std_fixes.h" + +#endif +]) + +AC_CONFIG_FILES([Makefile + client/Makefile + db/Makefile + db/schema_to_class + ]) +AC_OUTPUT +chmod +x db/schema_to_class diff --git a/db/Makefile.in b/db/Makefile.in new file mode 100644 index 0000000..871fac5 --- /dev/null +++ b/db/Makefile.in @@ -0,0 +1,74 @@ +# $Id: Makefile.in,v 1.14.2.1 2007/03/13 17:41:27 vonkorff Exp $ +# +# + +@SET_MAKE@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +LIBEXT = @LIBEXT@ +DLLEXT = @DLLEXT@ +DOTEXEEXT = @DOTEXEEXT@ + + +SUFFIXES = .ec .cpp .c .@OBJEXT@ .@DLLEXT@ .@LIBEXT@ @DOTEXEEXT@ + +BOINCDIR = @BOINCDIR@ +INFORMIXDIR = @INFORMIXDIR@ +MYSQL_LIBS = @MYSQL_LIBS@ +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +INFORMIX_CFLAGS = @INFORMIX_CFLAGS@ + +DBLIBS=@INFORMIX_LIBS@ @MYSQL_LIBS@ -lsocket -lm -lstdc++ @PTHREAD_LIBS@ + +CC = @CC@ +CXX = @CXX@ +CFLAGS = @CFLAGS@ -I.. -I$(BOINCDIR) -I$(BOINCDIR)/lib -I$(BOINCDIR)/api $(INFORMIX_CFLAGS) $(MYSQL_CFLAGS) @PTHREAD_CFLAGS@ +CXXFLAGS = $(CFLAGS) + +.cpp.@OBJEXT@: + $(CXX) $(CXXFLAGS) -o $*.@OBJEXT@ -c $< + + +all: dependencies app_config.@OBJEXT@ schema_master_client.@OBJEXT@ sqlrow_client.@OBJEXT@ schema_master.@OBJEXT@ sqlrow.@OBJEXT@ sqlifx.@OBJEXT@ sqlblob.@OBJEXT@ sqlint8.@OBJEXT@ xml_util.@OBJEXT@ + +schema_master.cpp: schema_master.sql find_references.awk schema_to_class.awk + chmod +x schema_to_class + ./schema_to_class schema_master.sql + +schema_master.h: schema_master.sql find_references.awk schema_to_class.awk + chmod +x schema_to_class + ./schema_to_class schema_master.sql + + +schema_master_client.@OBJEXT@: schema_master.cpp schema_master.h db_table.h Makefile + $(CXX) $(CXXFLAGS) -DCLIENT -c -o schema_master_client.@OBJEXT@ schema_master.cpp + +sqlrow_client.@OBJEXT@: sqlrow.cpp sqlrow.h Makefile + $(CXX) $(CXXFLAGS) -DCLIENT -c -o sqlrow_client.@OBJEXT@ sqlrow.cpp + +schema_master.@OBJEXT@: schema_master.cpp schema_master.h db_table.h + +sqlifx.cpp: sqlifx.ec + $(INFORMIXDIR)/bin/esql -e $< + mv $*.c $*.cpp + +sqlifx.@OBJEXT@: sqlifx.cpp + +xml_util.@OBJEXT@: xml_util.cpp + +app_config.@OBJEXT@: app_config.cpp + +.ec.cpp: + $(INFORMIXDIR)/bin/esql -e $< + mv $*.c $*.cpp + +Makefile: Makefile.in ../config.status ../configure ../configure.ac + (cd ..; $(MAKE) config.status) + +dependencies: schema_master.cpp *.cpp *.h + $(CXX) $(CXXFLAGS) -M *.cpp > dependencies + + + +include dependencies diff --git a/db/app_config.cpp b/db/app_config.cpp new file mode 100644 index 0000000..0b808ef --- /dev/null +++ b/db/app_config.cpp @@ -0,0 +1,76 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "sah_config.h" +#include +#include +#include + +#ifdef HAVE_IEEEFP_H +#include +#endif + +#include "util.h" +#include "parse.h" +#include "error_numbers.h" + +#include "app_config.h" + +const char* APP_CONFIG_FILE = "sah_config.xml"; +//const char* APP_CONFIG_FILE = "sah_enhanced_config.xml"; + +int APP_CONFIG::parse(char* buf) { + + memset(this, 0, sizeof(APP_CONFIG)); + min_disk_free_pct=10; + parse_str(buf, "", scidb_name, sizeof(scidb_name)); + parse_int(buf, "", max_wus_ondisk); + parse_double(buf, "", min_disk_free_pct); + parse_int(buf, "", min_quorum ); + parse_int(buf, "", target_nresults); + parse_int(buf, "", max_error_results); + parse_int(buf, "", max_success_results); + parse_int(buf, "", max_total_results); + parse_bool(buf, "", assim_check_rfi); + if (match_tag(buf, "")) return 0; + return ERR_XML_PARSE; +} + +int APP_CONFIG::parse_file(char* dir) { + char* p; + char path[256]; + int retval; + + sprintf(path, "%s/%s", dir, APP_CONFIG_FILE); + retval = read_file_malloc(path, p); + if (retval) return retval; + return parse(p); +} + + +// main routine for testing +//int main(int argc, char** argv) { +// +// APP_CONFIG sah_config; +// int retval; +// +// retval = sah_config.parse_file(".."); +// if (retval) { +// fprintf(stderr, "Can't parse config file\n"); +// } else { +// fprintf(stderr, "db name is %s\n", sah_config.scidb_name); +// } +//} diff --git a/db/app_config.h b/db/app_config.h new file mode 100644 index 0000000..5823966 --- /dev/null +++ b/db/app_config.h @@ -0,0 +1,33 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +class APP_CONFIG { +public: + char scidb_name[256]; + int max_wus_ondisk; // actually the number of unsent results + double min_disk_free_pct; // Minimum free disk percent in download dir. + + // fields in the boinc DB workunit record + int min_quorum; // minimum quorum size + int target_nresults; // try to get this many successful results + int max_error_results; // WU error if < #error results + int max_total_results; // WU error if < #total results + int max_success_results; // WU error if < #success results + bool assim_check_rfi; // if true, assimilator will check each signal for rfi + + int parse(char*); + int parse_file(char* dir="."); +}; diff --git a/db/db_table.h b/db/db_table.h new file mode 100644 index 0000000..fd6e6ec --- /dev/null +++ b/db/db_table.h @@ -0,0 +1,619 @@ +// $Id: db_table.h,v 1.45.2.10 2007/05/31 22:03:18 korpela Exp $ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef _DB_TABLE_H_ +#define _DB_TABLE_H_ + +#include "sah_config.h" +#include +#include +#include +#include +#include "track_mem.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlint8.h" +#include "db_util.h" + +#ifndef CLIENT +#include "sqlapi.h" +#endif + +#include "row_cache.h" + +template +class db_type : public track_mem { + private: + static const char * const type_name; + static const char * const column_names[]; + public: + db_type(T &t); + ~db_type(); + db_type &operator =(const T &t); + db_type &operator =(const db_type &t); + void clear() { *me = T(); }; + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=1, + const char *tag=type_name) const; + const char *search_tag(const char *s=0); + operator T(); + static int nfields() { return _nfields; }; + private: + T *me; + static const char * _search_tag; + static const int _nfields; +}; + +template +class db_table; + +template +std::ostream &operator <<(std::ostream &o, const db_type &a) { + o << a.print_xml(); + return o; +} + + +template +std::ostream &operator <<(std::ostream &o, const db_table &a) { + o << a.me->print_xml(); + return o; +} + +template +std::istream &operator >>(std::istream &i, db_table &a) { + std::string s; + static std::string remainder(""); + std::string s_tag("<"); + std::string e_tag("> s; + if (!found && xml_match_tag(s,s_tag.c_str())) { + found=true; + a.clear(); + } + if (found) buffer+=(s+' '); + if (found && xml_match_tag(s,e_tag.c_str())) { + found=false; + done=true; + } + } + a.me->parse_xml(buffer); + std::string::size_type p=buffer.find(e_tag); + if (p != std::string::npos) { + p=buffer.find('>',p+1); + if (p != std::string::npos) { + remainder=buffer.substr(p,buffer.size()-p); + } else { + remainder=std::string(""); + } + } + return i; +} + +#ifdef _WIN32 +#undef DELETE +#endif + +template +class db_table : public track_mem { + public: + db_table(T &t, SQL_CURSOR c); + ~db_table(); +#ifndef CLIENT + sqlint8_t insert(sqlint8_t lid=0); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + bool update(); + bool fetch(sqlint8_t lid=0); + bool cached_fetch(sqlint8_t lid=0); + bool fetch(const std::string &where); + bool authorize_delete(bool auth) {return delete_flag=auth;}; + bool DELETE(sqlint8_t lid=0); + bool DELETE(const std::string &where); + bool open_query(const std::string &where="",const std::string &order="",const std::string &directives=""); + bool get_next(bool cache_result); + bool get_next() { return get_next(false); }; + bool close_query(); + static int nfields() { return _nfields; }; + sqlint8_t count(const std::string &where=""); + SQL_CURSOR get_cursor(); + int set_cache_size(int i) { cache.set_size(i); return(cache.get_size()); }; + time_t set_cache_ttl(time_t i) { cache.set_ttl(i); return(cache.get_ttl()); }; +#endif + const char *search_tag(const char *s=0); + operator T(); + db_table &operator =(const T &t); + db_table &operator =(const db_table &t); + void clear() { *me = T(); }; +#if !defined(_WIN32) || (_MSC_VER > 1300) || defined(__MINGW32__) + friend std::ostream &operator <<(std::ostream &o, const db_table &a); + friend std::istream &operator >>(std::istream &i, db_table &a); +#else + friend std::ostream &operator <<(std::ostream &o, const db_table &a); + friend std::istream &operator >>(std::istream &i, db_table &a); +#endif + static const char * const table_name; + private: + T *me; + static row_cache cache; + static const char *_search_tag; + static const int _nfields; + static const char * const column_names[]; + bool delete_flag; + SQL_CURSOR cursor; +}; + +template +row_cache db_table::cache; + +#ifndef NEBULA +template +class db_reference { + private: + T r; + public: + ID_TYPE &id; + db_reference(ID_TYPE req_id=0); + db_reference(const db_reference &a) : r(a.r), id(*(ID_TYPE *)(&(r.id))) {}; + T &get(); + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=1, + const char *tag=0) const; + void parse_xml(std::string &buf, const char *tag); + void parse(const std::string &buf); + void parse(const SQL_ROW &buf); + operator T() const; + T *operator ->(); + const T *operator ->() const; + db_reference &operator =(const T &t); + db_reference &operator =(const db_reference &t); +}; + +template +db_reference::db_reference(ID_TYPE req_id) : id(*(ID_TYPE *)(&(r.id))) { + id=req_id; +} + +template +db_reference &db_reference::operator =(const T &t) { + if (&id != &(t.id)) { + r=t; + } + return *this; +} + +template +db_reference &db_reference::operator =(const db_reference &t) { + if (&id != &(t.id)) { + r=t.r; + } + return *this; +} + +template +db_reference::operator T() const { + return r; +} + +template +T *db_reference::operator ->() { + return &r; +} + +template +const T *db_reference::operator ->() const { + return &r; +} + +template +std::string db_reference::print(int full_subtables, int show_ids, int no_refs) const { + if (full_subtables) { + return r.print(full_subtables,show_ids,no_refs); + } else { + char buf[256]; + sprintf(buf,"%" INT8_FMT,INT8_PRINT_CAST(sqlint8_t(r.id))); + return std::string(buf); + } +} + +template +std::string db_reference::print_xml(int full_subtables, int show_ids, int no_refs, const char *tag) const { + if (full_subtables) { + return r.print_xml(full_subtables,show_ids,no_refs,tag); + } else { + char buf[256]; + sprintf(buf,"%" INT8_FMT "",INT8_PRINT_CAST(sqlint8_t(r.id))); + return std::string(buf); + } +} + +template +void db_reference::parse(const std::string &buf) { + r.parse(buf); +} + +template +void db_reference::parse(const SQL_ROW &buf) { + r.parse(buf); +} + +template +void db_reference::parse_xml(std::string &buf, const char *tag) { + r.parse_xml(buf,tag); +} + +template +std::ostream &operator <<(std::ostream &o, const db_reference &a) { + o << a.print_xml(); + return o; +} + +#endif // NEBULA + +template +db_type::db_type(T &t) : track_mem(T::type_name), me(&t) {} + +template +db_type::~db_type() {} + +template +db_table::db_table(T &t, SQL_CURSOR c) : track_mem(T::table_name), me(&t), delete_flag(false), cursor(c) {} + +template +db_table::~db_table() {} + +template +db_type::operator T() { + return *me; +} + +template +db_table::operator T() { + return *me; +} + +#ifndef CLIENT +template +sqlint8_t db_table::insert(sqlint8_t lid) { + int rv=0; + std::string query=std::string("insert into ")+table_name+" values ("+me->insert_format()+");"; + // jeffc + me->id=lid; + std::string tmpstr(me->print()); + // old SQL_ROW valarr(tmpstr.c_str(),_nfields); + SQL_ROW valarr(&tmpstr,_nfields); + const char *q=query.c_str(); + while (*q) { + if (*(q++)=='?') rv++; + } + if ((int)valarr.argc() != rv) { + std::cout << "Error " << valarr.argc() << "!=" << rv << std::endl; + std::cout << query << std::endl; + for (int i=0; i<(int)valarr.argc(); i++) { + std::cout << i << " " << valarr[i] << std::endl; + } + } +#ifndef NODB + rv=sql_open(query.c_str(),valarr); + if (rv>=0 && sql_fetch(rv)) { + me->id=sql_insert_id(rv); + sql_close(rv); + return static_cast(me->id); + } +#else + std::cout << query << std::endl; +#endif + return 0; +} + +template +sqlint8_t db_new(T &t) { + return (static_cast *>(&t)->insert()); +} + +template +bool db_table::update() { + char buf[256]; + int rv,i; + sprintf(buf," where id=%"INT8_FMT,INT8_PRINT_CAST(sqlint8_t(me->id))); +#if 0 + std::string query=std::string("update ")+table_name+" set ("; + for (i=1;i<_nfields-1;i++) query+=std::string(column_names[i])+','; + query+=std::string(column_names[i])+")=("+me->update_format()+") "; +#else + std::string query=std::string("update ")+table_name+" set "; + for (i=1;i<_nfields-1;i++) query+=std::string(column_names[i])+"=?,"; + query+=std::string(column_names[i])+"=?"; +#endif + std::string tmpstr(me->print()); + // old SQL_ROW valarr(SQL_ROW(tmpstr.c_str(),_nfields)+1); + SQL_ROW valarr(SQL_ROW(&tmpstr,_nfields)+1); + query+=buf; +#ifndef NODB + rv=sql_run(query.c_str(),valarr); +#else + std::cout << query << std::endl; + rv=true; +#endif + return rv; +} + + +template +bool db_update(T &t) { + return (static_cast *>(&t)->update()); +} + +template +bool db_table::DELETE(sqlint8_t lid) { + bool rv; + char buf[256]; + if (!delete_flag) return false; + if (lid) me->id=lid; + sprintf(buf," where id=%"INT8_FMT,INT8_PRINT_CAST(sqlint8_t(me->id))); + std::string query=std::string("delete from ")+table_name+std::string(buf); + rv=sql_run(query.c_str()); + delete_flag=false; + return rv; +} + +template +bool db_table::DELETE(const std::string &where) { + bool rv; + if (!delete_flag) return false; + if (where.size() = 0) return false; + std::string query=std::string("delete from ")+table_name+std::string(" ")+where; + rv=sql_run(query.c_str()); + delete_flag=false; + return rv; +} + +template +bool db_table::cached_fetch(sqlint8_t lid) { + T *item; + if (!lid) { + lid=me->id; + } + if ((item=cache.find(lid)) != NULL) { + *this=*item; + return true; + } else { + bool rv=fetch(lid); + if (rv) cache.insert(*this); + return rv; + } +} + +template +bool db_table::fetch(sqlint8_t lid) { + char buf[1024]; + int tmp; + SQL_ROW values; + int rv; + bool rv2=false; + if (!lid) { + lid=me->id; + } + sprintf(buf,"select * from %s where id=%"INT8_FMT,table_name,lid); +#ifndef NODB + if (((rv=sql_open(buf))>=0) && + (rv2=sql_fetch(rv))) + { + values=sql_values(rv,&tmp); + me->parse(values); + } + if (rv>=0) sql_close(rv); +#else + std::cout << buf << std::endl; +#endif + return (rv2); +} + +template +bool db_table::fetch(const std::string &where) { + char buf[1024]; + int tmp; + SQL_ROW values; + int rv; + bool rv2=false; + sprintf(buf,"select * from %s %s",table_name,where.c_str()); +#ifndef NODB + if (((rv=sql_open(buf))>=0) && + (rv2=sql_fetch(rv))) + { + values=sql_values(rv,&tmp); + me->parse(values); + } + if (rv>=0) sql_close(rv); +#else + std::cout << buf << std::endl; + rv=0; +#endif + return (rv2); +} + +template +bool db_table::open_query(const std::string &where,const std::string &order,const std::string &directives) { + bool rv; + std::string query=std::string("select ")+directives+" * from "+table_name+" "+where+" "+order; +#ifndef NODB + if (cursor>=0) sql_close(cursor); + rv=(chk_cursor(cursor=sql_open(query.c_str()),"db_table<>::open_query")); + if (!rv) { + sql_close(cursor); + cursor=-1; + } + return (cursor>=0); +#else + std::cout << query << std::endl; + return true; +#endif +} + +template +bool db_table::get_next(bool cache) { + int rv; + static bool is_signal, init; + + if(!init) { + if(strcmp(table_name,"spike") == 0 || + strcmp(table_name,"spike_small") == 0 || + strcmp(table_name,"gaussian") == 0 || + strcmp(table_name,"gaussian_small") == 0 || + strcmp(table_name,"pulse") == 0 || + strcmp(table_name,"pulse_small") == 0 || + strcmp(table_name,"triplet") == 0 || + strcmp(table_name,"triplet_small") == 0 || + strcmp(table_name,"autocorr") == 0 || + strcmp(table_name,"autocorr_small") == 0) { + is_signal = true; + } + init = true; + } + +#ifndef NODB + if ((rv=sql_fetch(cursor))) { + SQL_ROW r(sql_values(cursor,&rv)); + me->parse(r); + if(is_signal) { + signal_preprocess(me); + } + } else { + sql_close(cursor); + } + return (rv); +#else + static int i=30; + me->id=i; + return ((i--)>0); +#endif +} + +template +bool db_table::close_query() { +#ifndef NODB + if (cursor>=0) sql_close(cursor); +#endif + cursor=-1; + return cursor; +} + +template +sqlint8_t db_table::count(const std::string &where) { + std::string query=std::string("select count(*) from ")+table_name+" "+where; + int fd,rv=0; + sqlint8_t lrv=-1; +#ifndef NODB + if ((fd=sql_open(query.c_str()))>=0) { + if (sql_fetch(fd)) { + SQL_ROW r(sql_values(fd,&rv)); + if (rv) { + lrv=atoll(r[0]->c_str()); + } + } + sql_close(fd); + } + return lrv; +#else + return 30; +#endif +} + +#endif + +template +const char *db_type::search_tag(const char *s) { + if (s) { + _search_tag=s; + } else { + _search_tag=type_name; + } + return _search_tag; +} + +template +const char *db_table::search_tag(const char *s) { + if (s) { + _search_tag=s; + } else { + _search_tag=table_name; + } + return _search_tag; +} + +template +std::string db_type::print(int full_subtables, int show_ids, int no_refs) const { + return me->print(full_subtables,show_ids,no_refs); +} + +template +std::string db_type::print_xml(int full_subtables, int show_ids, int no_refs, + const char *tag) const { + return me->print_xml(full_subtables,show_ids,no_refs,tag); +} + +template +db_type &db_type::operator =(const T &t) { + if (me != &t) { + *me=t; + } + return *this; +} + +template +db_type &db_type::operator =(const db_type &t) { + if (this != &t) { + *me=*(t.me); + } + return *this; +} + +template +db_table &db_table::operator =(const T &t) { + if (me != &t) { + *me=t; + cursor=-1; + } + return *this; +} + +template +db_table &db_table::operator =(const db_table &t) { + if (this != &t) { + *me=*(t.me); + cursor=-1; + } + return *this; +} + + +#endif diff --git a/db/db_util.h b/db/db_util.h new file mode 100644 index 0000000..3819542 --- /dev/null +++ b/db/db_util.h @@ -0,0 +1,6 @@ +template +void signal_preprocess(T &signal) { +// this is where just in time iq flipping will occur + //fprintf(stderr, "I am a %s and my ID is %ld\n", signal->table_name, signal->id); + +} diff --git a/db/find_references.awk b/db/find_references.awk new file mode 100644 index 0000000..38458d4 --- /dev/null +++ b/db/find_references.awk @@ -0,0 +1,59 @@ +# Copyright 2003 Regents of the University of California + +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +# SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with SETI_BOINC; see the file COPYING. If not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/create table/ { n=split($3,a,"."); table=a[n]; } +/create table/,/\);/ { + for (i=1;i +#include +#include +#include +#include + +#include "db_table.h" +#include "schema_master.h" +#include "sqlhdr.h" + +const char * from_db = "sah2@sci_master_shm"; +const char * to_db = "t_sah@temp_master_tcp"; + +template +int read_and_compare_dbs (T& table, int modulo, int remainder, int maxnum, int minid, int maxid); + +int main(int argc, char ** argv) { + + receiver_config receiver_cfg; + recorder_config recorder_cfg; + splitter_config splitter_cfg; + analysis_config analysis_cfg; + tape tp; + settings set; + workunit_grp wug; + workunit_header wuh; + result res; + triplet trip; + gaussian gauss; + pulse pul; + spike sp; + + char type[32]; + int modulo, remainder, maxnum, minid, maxid; + + + if (argc != 7) { + fprintf(stderr, "Usage: migrate_test table_name modulo remainder maximum_number_of_elements minimum_id maximum_id\n"); + exit (1); + } else { + strcpy(type, argv[1]); + modulo = atoi(argv[2]); + remainder = atoi(argv[3]); + maxnum = atoi(argv[4]); + minid = atoi(argv[5]); + maxid = atoi(argv[6]); + } + + // how to call read_and_compare_dbs? + + if (strcmp(type,"receiver_config") == 0) { read_and_compare_dbs (receiver_cfg, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"recorder_config") == 0) { read_and_compare_dbs (recorder_cfg, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"splitter_config") == 0) { read_and_compare_dbs (splitter_cfg, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"analysis_config") == 0) { read_and_compare_dbs (analysis_cfg, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"tape") == 0) { read_and_compare_dbs (tp, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"settings") == 0) { read_and_compare_dbs (set, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"workunit_grp") == 0) { read_and_compare_dbs (wug, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"workunit_header") == 0) { read_and_compare_dbs (wuh, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"result") == 0) { read_and_compare_dbs (res, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"triplet") == 0) { read_and_compare_dbs (trip, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"gaussian") == 0) { read_and_compare_dbs (gauss, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"pulse") == 0) { read_and_compare_dbs (pul, modulo, remainder, maxnum, minid, maxid); } + else if (strcmp(type,"spike") == 0) { read_and_compare_dbs (sp, modulo, remainder, maxnum, minid, maxid); } + else { + fprintf(stderr, "Don't recognize table: %s\n", type); + exit(1); + } + exit (0); +} + + +template +int read_and_compare_dbs (T& table, int modulo, int remainder, int maxnum, int minid, int maxid) { + + int retval, get_next_retval; + int i, match, dontmatch; + std::vector id_list; + + char c_string[256]; + std::string where_clause; + + if (remainder != 0) { + sprintf(c_string, "where id >= %d and id <= %d and MOD(id, %d) = %d", minid, maxid, modulo, remainder); + } else { + sprintf(c_string, "where id >= %d and id <= %d", minid, maxid); + } + where_clause = c_string; + std::cerr << "where clause: " << where_clause << "\n"; + + retval = db_change(from_db); + fprintf(stderr, "db_change(%s) returns %d\n", from_db, retval); + retval = table.open_query(where_clause); + fprintf(stderr, "open_query returns %d, %d\n", retval, sql_last_error_code()); + i = 0; + while (get_next_retval = table.get_next() && (i++) < maxnum) id_list.push_back (table.id); + table.close_query(); + + typename std::vector::iterator id_iter = id_list.begin(); + T from_thisrow; + T to_thisrow; + + match = dontmatch = 0; + while (id_iter != id_list.end()) { + sprintf(c_string, "where id = %d", (*id_iter)); + where_clause = c_string; + db_change(from_db); + table.open_query(where_clause); + table.get_next(); + from_thisrow = table; + db_change(to_db); + table.open_query(where_clause); + table.get_next(); + to_thisrow = table; + std::cerr << "FROM DATABASE:\n" << from_thisrow.print(0,1,0) << "\n\nTO DATABASE:\n" << to_thisrow.print(0,1,0) << "\n"; + if (from_thisrow.print(0,1,0) == to_thisrow.print(0,1,0)) { match++; } + else { + dontmatch++; + fprintf(stderr,"DON'T MATCH!!!\n"); + } + fprintf(stderr,"--------------------------\n"); + id_iter++; + } + fprintf(stderr,"num match: %d don't match: %d\n",match,dontmatch); + return 0; +} diff --git a/db/row_cache.h b/db/row_cache.h new file mode 100644 index 0000000..c5a3f75 --- /dev/null +++ b/db/row_cache.h @@ -0,0 +1,122 @@ +// $Id: db_table.h,v 1.45.2.10 2007/05/31 22:03:18 korpela Exp $ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include +#include +#include + + +template +class row_cache { + private: + class cache_element { + public: + T item; + time_t insert_time; + cache_element(const T &val) : item(val), insert_time(time(0)) {}; + cache_element &operator =(const T &val) { + if (&item != &val) { + item=val; + insert_time=time(0); + } + return *this; + }; + }; + int size; + std::vector elements; + typedef typename std::vector::iterator element_iterator; + typedef typename std::map::iterator id_iterator; + typedef typename std::multimap::iterator time_iterator; + std::map id_index; + std::multimap time_index; + time_t ttl; + size_t hits; + size_t misses; + + public: + // constructors + row_cache(int newsize=1024, time_t newttl=3600) : + size(newsize), ttl(newttl), hits(0), misses(0) { invalidate_all(); }; + + ~row_cache() { +#ifndef _NDEBUG + print_stats(); +#endif + }; + + void print_stats() { + printf("Cache statistics on %s\n",T::table_name); + printf("%ld hits %ld misses %f percent hit rate\n", + misses, hits, (double)hits/(hits+misses)); + } + + void invalidate_all() { + elements.clear(); + elements.reserve(size); + time_index.clear(); + id_index.clear(); + }; + + void set_size(int newsize) { + size=newsize; + invalidate_all(); + } + + int get_size() { + return(size); + } + + void set_ttl(time_t newttl) { + ttl=newttl; + } + + time_t get_ttl() { + return(ttl); + } + + void insert(const T &val) { + element_iterator inserted; + if (elements.size() < size) { + // not full yet, just push_back() + elements.push_back(val); + inserted=elements.end()-1; + } else { + // We're full so we'll find the oldest element to overwrite. + time_iterator oldest=time_index.begin(); + inserted=oldest->second; + // remove it from the indexes + id_index.erase(id_index.find(inserted->item.id)); + time_index.erase(oldest); + // overwrite the old cache item with the new one. + *inserted=val; + } + // add the new item to the indexes. + id_index[inserted->item.id]=inserted; + time_index.insert(std::pair(inserted->insert_time,inserted)); + }; + + T *find(sqlint8_t id) { + id_iterator i=id_index.find(id); + if ((i == id_index.end()) || (i->second->insert_time+ttl < time(0))) { + misses++; + return NULL; + } + hits++; + return &(i->second->item); + }; +}; + diff --git a/db/schema_master.cpp b/db/schema_master.cpp new file mode 100644 index 0000000..6a7fffb --- /dev/null +++ b/db/schema_master.cpp @@ -0,0 +1,15303 @@ +// This file is automatically generated. Do not edit +#include "sah_config.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "parse.h" +#include "xml_util.h" +#include "db_table.h" +#include "schema_master.h" + +#ifdef _WIN32 +#pragma warning( disable : 4355 ) +#endif + +#define found(x) ((x != std::string::npos)) + +#ifdef USE_NAMESPACE +using namespace ifx; +#endif + + +const char *db_name="sah2b@sah_master_tcp"; +int db_is_open; + +template <> const char * const db_type::type_name="coordinate_t"; +template <> const char * db_type::_search_tag=type_name; +template <> const int db_type::_nfields=3; +template <> const char * const db_type::column_names[3]={"time","ra","dec"}; + +coordinate_t::coordinate_t() : + db_type(*this), + time(0), + ra(0), + dec(0) +{ + db_open(); +} + + +coordinate_t::coordinate_t(const coordinate_t &a) : + db_type(*this), + time(a.time), + ra(a.ra), + dec(a.dec) +{ + db_open(); +} + + +coordinate_t::coordinate_t(const SQL_ROW &a) : + db_type(*this) +{ + db_open(); + parse(a); +} + + +coordinate_t::coordinate_t(const std::string &s,const char *tag) : + db_type(*this) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +coordinate_t &coordinate_t::operator =(const coordinate_t &a) { + if (&a != this) { + time=a.time; + ra=a.ra; + dec=a.dec; + } + return (*this); +} + + +std::string coordinate_t::update_format() const +{ std::ostringstream rv(""); + + rv << "ROW("; + for (int i=1;i<3;i++) rv << "?,"; + rv << "?"; +rv << ")"; + + return rv.str(); +} + + +std::string coordinate_t::insert_format() const +{ return update_format(); +} + +std::string coordinate_t::select_format() const +{ +std::string rv(""); +for (int i=0; i<2;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string coordinate_t::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + rv << "ROW("; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << dec; + rv << ")"; + return rv.str(); +} + + +std::string coordinate_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << dec << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void coordinate_t::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"dec",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> dec; + } + } + } + + void coordinate_t::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> time; + } + { + std::istringstream row(*(s[1])); + row >> ra; + } + { + std::istringstream row(*(s[2])); + row >> dec; + } + } + + void coordinate_t::parse(const std::string &s) { + SQL_ROW row(&s,3); + parse(row); + } + +template <> const char * const db_type::type_name="chirp_parameter_t"; +template <> const char * db_type::_search_tag=type_name; +template <> const int db_type::_nfields=2; +template <> const char * const db_type::column_names[2]={"chirp_limit","fft_len_flags"}; + +chirp_parameter_t::chirp_parameter_t() : + db_type(*this), + chirp_limit(0), + fft_len_flags(0) +{ + db_open(); +} + + +chirp_parameter_t::chirp_parameter_t(const chirp_parameter_t &a) : + db_type(*this), + chirp_limit(a.chirp_limit), + fft_len_flags(a.fft_len_flags) +{ + db_open(); +} + + +chirp_parameter_t::chirp_parameter_t(const SQL_ROW &a) : + db_type(*this) +{ + db_open(); + parse(a); +} + + +chirp_parameter_t::chirp_parameter_t(const std::string &s,const char *tag) : + db_type(*this) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +chirp_parameter_t &chirp_parameter_t::operator =(const chirp_parameter_t &a) { + if (&a != this) { + chirp_limit=a.chirp_limit; + fft_len_flags=a.fft_len_flags; + } + return (*this); +} + + +std::string chirp_parameter_t::update_format() const +{ std::ostringstream rv(""); + + rv << "ROW("; + for (int i=1;i<2;i++) rv << "?,"; + rv << "?"; +rv << ")"; + + return rv.str(); +} + + +std::string chirp_parameter_t::insert_format() const +{ return update_format(); +} + +std::string chirp_parameter_t::select_format() const +{ +std::string rv(""); +for (int i=0; i<1;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string chirp_parameter_t::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + rv << "ROW("; + rv << chirp_limit; + rv << ','; + rv << fft_len_flags; + rv << ")"; + return rv.str(); +} + + +std::string chirp_parameter_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + rv << xml_indent() << "" << chirp_limit << "\n"; + rv << xml_indent() << "" << fft_len_flags << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void chirp_parameter_t::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"chirp_limit",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_limit; + } + if (extract_xml_record(field,"fft_len_flags",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len_flags; + } + } + } + + void chirp_parameter_t::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> chirp_limit; + } + { + std::istringstream row(*(s[1])); + row >> fft_len_flags; + } + } + + void chirp_parameter_t::parse(const std::string &s) { + SQL_ROW row(&s,2); + parse(row); + } + +template <> const char * const db_type::type_name="subband_description_t"; +template <> const char * db_type::_search_tag=type_name; +template <> const int db_type::_nfields=4; +template <> const char * const db_type::column_names[4]={"number","center","base","sample_rate"}; + +subband_description_t::subband_description_t() : + db_type(*this), + number(0), + center(0), + base(0), + sample_rate(0) +{ + db_open(); +} + + +subband_description_t::subband_description_t(const subband_description_t &a) : + db_type(*this), + number(a.number), + center(a.center), + base(a.base), + sample_rate(a.sample_rate) +{ + db_open(); +} + + +subband_description_t::subband_description_t(const SQL_ROW &a) : + db_type(*this) +{ + db_open(); + parse(a); +} + + +subband_description_t::subband_description_t(const std::string &s,const char *tag) : + db_type(*this) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +subband_description_t &subband_description_t::operator =(const subband_description_t &a) { + if (&a != this) { + number=a.number; + center=a.center; + base=a.base; + sample_rate=a.sample_rate; + } + return (*this); +} + + +std::string subband_description_t::update_format() const +{ std::ostringstream rv(""); + + rv << "ROW("; + for (int i=1;i<4;i++) rv << "?,"; + rv << "?"; +rv << ")"; + + return rv.str(); +} + + +std::string subband_description_t::insert_format() const +{ return update_format(); +} + +std::string subband_description_t::select_format() const +{ +std::string rv(""); +for (int i=0; i<3;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string subband_description_t::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + rv << "ROW("; + rv << number; + rv << ','; + rv << center; + rv << ','; + rv << base; + rv << ','; + rv << sample_rate; + rv << ")"; + return rv.str(); +} + + +std::string subband_description_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + rv << xml_indent() << "" << number << "\n"; + rv << xml_indent() << "

" << center << "
\n"; + rv << xml_indent() << "" << base << "\n"; + rv << xml_indent() << "" << sample_rate << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void subband_description_t::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"number",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> number; + } + if (extract_xml_record(field,"center",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> center; + } + if (extract_xml_record(field,"base",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> base; + } + if (extract_xml_record(field,"sample_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> sample_rate; + } + } + } + + void subband_description_t::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> number; + } + { + std::istringstream row(*(s[1])); + row >> center; + } + { + std::istringstream row(*(s[2])); + row >> base; + } + { + std::istringstream row(*(s[3])); + row >> sample_rate; + } + } + + void subband_description_t::parse(const std::string &s) { + SQL_ROW row(&s,4); + parse(row); + } + +template <> const char * const db_type::type_name="data_description_t"; +template <> const char * db_type::_search_tag=type_name; +template <> const int db_type::_nfields=9; +template <> const char * const db_type::column_names[9]={"start_ra","start_dec","end_ra","end_dec","true_angle_range","time_recorded","time_recorded_jd","nsamples","coords"}; + +data_description_t::data_description_t() : + db_type(*this), + start_ra(0), + start_dec(0), + end_ra(0), + end_dec(0), + true_angle_range(0), + time_recorded_jd(0), + nsamples(0), + coords((coordinate_t *)0,0,_x_xml_values) +{ + db_open(); + time_recorded[0]=0; +} + + +data_description_t::data_description_t(const data_description_t &a) : + db_type(*this), + start_ra(a.start_ra), + start_dec(a.start_dec), + end_ra(a.end_ra), + end_dec(a.end_dec), + true_angle_range(a.true_angle_range), + time_recorded_jd(a.time_recorded_jd), + nsamples(a.nsamples), + coords(a.coords) +{ + db_open(); + strcpy(time_recorded,a.time_recorded); +} + + +data_description_t::data_description_t(const SQL_ROW &a) : + db_type(*this) +{ + db_open(); + parse(a); +} + + +data_description_t::data_description_t(const std::string &s,const char *tag) : + db_type(*this) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +data_description_t &data_description_t::operator =(const data_description_t &a) { + if (&a != this) { + start_ra=a.start_ra; + start_dec=a.start_dec; + end_ra=a.end_ra; + end_dec=a.end_dec; + true_angle_range=a.true_angle_range; + time_recorded_jd=a.time_recorded_jd; + nsamples=a.nsamples; + { + coords.clear(); + std::vector::const_iterator i(a.coords.begin()); + for (;i!=a.coords.end();i++) { + coords.push_back(*i); + } + } + strcpy(time_recorded,a.time_recorded); + } + return (*this); +} + + +std::string data_description_t::update_format() const +{ std::ostringstream rv(""); + + rv << "ROW("; + for (int i=1;i<9;i++) rv << "?,"; + rv << "?"; +rv << ")"; + + return rv.str(); +} + + +std::string data_description_t::insert_format() const +{ return update_format(); +} + +std::string data_description_t::select_format() const +{ +std::string rv(""); +for (int i=0; i<8;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string data_description_t::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + rv << "ROW("; + rv << start_ra; + rv << ','; + rv << start_dec; + rv << ','; + rv << end_ra; + rv << ','; + rv << end_dec; + rv << ','; + rv << true_angle_range; + rv << ','; + rv << "'" << time_recorded << "'"; + rv << ','; + rv << time_recorded_jd; + rv << ','; + rv << nsamples; + rv << ','; + rv << "LIST {"; + { + std::vector::const_iterator p=coords.begin(); + for (;pprint(); + if (p != coords.end()-1) { + rv << ','; + } else { + rv << "}"; + } + } + } + rv << ")"; + return rv.str(); +} + + +std::string data_description_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + rv << xml_indent() << "" << start_ra << "\n"; + rv << xml_indent() << "" << start_dec << "\n"; + rv << xml_indent() << "" << end_ra << "\n"; + rv << xml_indent() << "" << end_dec << "\n"; + rv << xml_indent() << "" << true_angle_range << "\n"; + { + std::string enc_field=xml_encode_string(time_recorded,std::min(strlen(time_recorded),sizeof(time_recorded))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << time_recorded_jd << "\n"; + rv << xml_indent() << "" << nsamples << "\n"; + if (coords.size()) { + rv << xml_indent() << "\n" ; + rv << enc_string; + } +} + rv << xml_indent(-2); + rv << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void data_description_t::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"start_ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> start_ra; + } + if (extract_xml_record(field,"start_dec",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> start_dec; + } + if (extract_xml_record(field,"end_ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> end_ra; + } + if (extract_xml_record(field,"end_dec",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> end_dec; + } + if (extract_xml_record(field,"true_angle_range",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> true_angle_range; + } + if (extract_xml_record(field,"time_recorded",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(time_recorded,(const char *)&(in.front()),std::min(in.size(),(size_t)255)); + time_recorded[std::min(in.size(),(size_t)254)]=0; + } + if (extract_xml_record(field,"time_recorded_jd",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time_recorded_jd; + } + if (extract_xml_record(field,"nsamples",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> nsamples; + } + coords.clear(); + if (extract_xml_record(field,"coords",sub)) { + pos=0; + while ((pos=sub.find("",pos); + } + } + } + } + + void data_description_t::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> start_ra; + } + { + std::istringstream row(*(s[1])); + row >> start_dec; + } + { + std::istringstream row(*(s[2])); + row >> end_ra; + } + { + std::istringstream row(*(s[3])); + row >> end_dec; + } + { + std::istringstream row(*(s[4])); + row >> true_angle_range; + } + { + strncpy(time_recorded,s[5]->c_str(),255); + time_recorded[254]=0; + } + { + std::istringstream row(*(s[6])); + row >> time_recorded_jd; + } + { + std::istringstream row(*(s[7])); + row >> nsamples; + } + { + std::string::size_type p,q; + int i; + coords.clear(); + SQL_ROW tmp(s[8]); + for (i=0;i const char * const db_table::table_name="receiver_config"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=20; +template <> const char * const db_table::column_names[20]={"id","s4_id","name","beam_width","center_freq","latitude","longitude","elevation","glat","glon","galt","diameter","az_orientation","az_corr_coeff","zen_corr_coeff","array_az_ellipse","array_za_ellipse","array_angle","min_vgc""polarization"}; + +receiver_config::receiver_config() : + db_table(*this,-1), + id(0), + s4_id(0), + beam_width(0), + center_freq(0), + latitude(0), + longitude(0), + elevation(0), + glat(0), + glon(0), + galt(0), + diameter(0), + az_orientation(0), + az_corr_coeff((float *)0,0,_x_csv), + zen_corr_coeff((float *)0,0,_x_csv), + array_az_ellipse(0), + array_za_ellipse(0), + array_angle(0), + min_vgc(0) +{ + db_open(); + name[0]=0; + polarization[0]=0; +} + + +receiver_config::receiver_config(const receiver_config &a) : + db_table(*this,-1), + id(a.id), + s4_id(a.s4_id), + beam_width(a.beam_width), + center_freq(a.center_freq), + latitude(a.latitude), + longitude(a.longitude), + elevation(a.elevation), + glat(a.glat), + glon(a.glon), + galt(a.galt), + diameter(a.diameter), + az_orientation(a.az_orientation), + az_corr_coeff(a.az_corr_coeff), + zen_corr_coeff(a.zen_corr_coeff), + array_az_ellipse(a.array_az_ellipse), + array_za_ellipse(a.array_za_ellipse), + array_angle(a.array_angle), + min_vgc(a.min_vgc) +{ + db_open(); + strcpy(name,a.name); + strcpy(polarization,a.polarization); +} + + +receiver_config::receiver_config(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +receiver_config::receiver_config(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +receiver_config &receiver_config::operator =(const receiver_config &a) { + if (&a != this) { + id=a.id; + s4_id=a.s4_id; + beam_width=a.beam_width; + center_freq=a.center_freq; + latitude=a.latitude; + longitude=a.longitude; + elevation=a.elevation; + glat=a.glat; + glon=a.glon; + galt=a.galt; + diameter=a.diameter; + az_orientation=a.az_orientation; + { + az_corr_coeff.clear(); + std::vector::const_iterator i(a.az_corr_coeff.begin()); + for (;i!=a.az_corr_coeff.end();i++) { + az_corr_coeff.push_back(*i); + } + } + { + zen_corr_coeff.clear(); + std::vector::const_iterator i(a.zen_corr_coeff.begin()); + for (;i!=a.zen_corr_coeff.end();i++) { + zen_corr_coeff.push_back(*i); + } + } + array_az_ellipse=a.array_az_ellipse; + array_za_ellipse=a.array_za_ellipse; + array_angle=a.array_angle; + min_vgc=a.min_vgc; + strcpy(name,a.name); + strcpy(polarization,a.polarization); + } + return (*this); +} + + +std::string receiver_config::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<20;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string receiver_config::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string receiver_config::select_format() const +{ +std::string rv(""); +for (int i=0; i<19;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string receiver_config::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << s4_id; + rv << ','; + rv << "'" << name << "'"; + rv << ','; + rv << beam_width; + rv << ','; + rv << center_freq; + rv << ','; + rv << latitude; + rv << ','; + rv << longitude; + rv << ','; + rv << elevation; + rv << ','; + rv << glat; + rv << ','; + rv << glon; + rv << ','; + rv << galt; + rv << ','; + rv << diameter; + rv << ','; + rv << az_orientation; + rv << ','; + rv << "LIST {"; + { + std::vector::const_iterator p=az_corr_coeff.begin(); + for (;p::const_iterator p=zen_corr_coeff.begin(); + for (;p\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << s4_id << "\n"; + { + std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << beam_width << "\n"; + rv << xml_indent() << "" << center_freq << "\n"; + rv << xml_indent() << "" << latitude << "\n"; + rv << xml_indent() << "" << longitude << "\n"; + rv << xml_indent() << "" << elevation << "\n"; + rv << xml_indent() << "" << glat << "\n"; + rv << xml_indent() << "" << glon << "\n"; + rv << xml_indent() << "" << galt << "\n"; + rv << xml_indent() << "" << diameter << "\n"; + rv << xml_indent() << "" << az_orientation << "\n"; + if (az_corr_coeff.size()) { + rv << xml_indent() << "" ; + rv << enc_string; + } +} + rv << "\n"; + if (zen_corr_coeff.size()) { + rv << xml_indent() << "" ; + rv << enc_string; + } +} + rv << "\n"; + rv << xml_indent() << "" << array_az_ellipse << "\n"; + rv << xml_indent() << "" << array_za_ellipse << "\n"; + rv << xml_indent() << "" << array_angle << "\n"; + rv << xml_indent() << "" << min_vgc << "\n"; + { + std::string enc_field=xml_encode_string(polarization,std::min(strlen(polarization),sizeof(polarization))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void receiver_config::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"s4_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> s4_id; + } + if (extract_xml_record(field,"name",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)255)); + name[std::min(in.size(),(size_t)254)]=0; + } + if (extract_xml_record(field,"beam_width",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> beam_width; + } + if (extract_xml_record(field,"center_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> center_freq; + } + if (extract_xml_record(field,"latitude",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> latitude; + } + if (extract_xml_record(field,"longitude",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> longitude; + } + if (extract_xml_record(field,"elevation",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> elevation; + } + if (extract_xml_record(field,"glat",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> glat; + } + if (extract_xml_record(field,"glon",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> glon; + } + if (extract_xml_record(field,"galt",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> galt; + } + if (extract_xml_record(field,"diameter",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> diameter; + } + if (extract_xml_record(field,"az_orientation",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> az_orientation; + } + az_corr_coeff.clear(); + if (extract_xml_record(field,"az_corr_coeff",sub)) { + pos=sub.find(">"); + do { + if (pos!=std::string::npos) { + do { pos++; } while ((sub[pos]=='\n') || (sub[pos]==',')); + std::istringstream in(std::string(sub.c_str()+pos)); + float tmp; + in >> tmp; + az_corr_coeff.push_back(tmp); + } + } while ((pos=sub.find(",",pos)) != std::string::npos); + } + zen_corr_coeff.clear(); + if (extract_xml_record(field,"zen_corr_coeff",sub)) { + pos=sub.find(">"); + do { + if (pos!=std::string::npos) { + do { pos++; } while ((sub[pos]=='\n') || (sub[pos]==',')); + std::istringstream in(std::string(sub.c_str()+pos)); + float tmp; + in >> tmp; + zen_corr_coeff.push_back(tmp); + } + } while ((pos=sub.find(",",pos)) != std::string::npos); + } + if (extract_xml_record(field,"array_az_ellipse",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> array_az_ellipse; + } + if (extract_xml_record(field,"array_za_ellipse",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> array_za_ellipse; + } + if (extract_xml_record(field,"array_angle",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> array_angle; + } + if (extract_xml_record(field,"min_vgc",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_vgc; + } + if (extract_xml_record(field,"polarization",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(polarization,(const char *)&(in.front()),std::min(in.size(),(size_t)32)); + polarization[std::min(in.size(),(size_t)31)]=0; + } + } + } + + void receiver_config::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> s4_id; + } + { + strncpy(name,s[2]->c_str(),255); + name[254]=0; + } + { + std::istringstream row(*(s[3])); + row >> beam_width; + } + { + std::istringstream row(*(s[4])); + row >> center_freq; + } + { + std::istringstream row(*(s[5])); + row >> latitude; + } + { + std::istringstream row(*(s[6])); + row >> longitude; + } + { + std::istringstream row(*(s[7])); + row >> elevation; + } + { + std::istringstream row(*(s[8])); + row >> glat; + } + { + std::istringstream row(*(s[9])); + row >> glon; + } + { + std::istringstream row(*(s[10])); + row >> galt; + } + { + std::istringstream row(*(s[11])); + row >> diameter; + } + { + std::istringstream row(*(s[12])); + row >> az_orientation; + } + { + std::string::size_type p,q; + int i; + az_corr_coeff.clear(); + SQL_ROW tmp(s[13]); + for (i=0;i> tmp0; + az_corr_coeff.push_back(tmp0); + } + } + { + std::string::size_type p,q; + int i; + zen_corr_coeff.clear(); + SQL_ROW tmp(s[14]); + for (i=0;i> tmp0; + zen_corr_coeff.push_back(tmp0); + } + } + { + std::istringstream row(*(s[15])); + row >> array_az_ellipse; + } + { + std::istringstream row(*(s[16])); + row >> array_za_ellipse; + } + { + std::istringstream row(*(s[17])); + row >> array_angle; + } + { + std::istringstream row(*(s[18])); + row >> min_vgc; + } + { + strncpy(polarization,s[19]->c_str(),32); + polarization[31]=0; + } + } + + void receiver_config::parse(const std::string &s) { + SQL_ROW row(&s,20); + parse(row); + } + +template <> const char * const db_table::table_name="recorder_config"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=6; +template <> const char * const db_table::column_names[6]={"id","name","bits_per_sample","sample_rate","beams","version"}; + +recorder_config::recorder_config() : + db_table(*this,-1), + id(0), + bits_per_sample(0), + sample_rate(0), + beams(0), + version(0) +{ + db_open(); + name[0]=0; +} + + +recorder_config::recorder_config(const recorder_config &a) : + db_table(*this,-1), + id(a.id), + bits_per_sample(a.bits_per_sample), + sample_rate(a.sample_rate), + beams(a.beams), + version(a.version) +{ + db_open(); + strcpy(name,a.name); +} + + +recorder_config::recorder_config(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +recorder_config::recorder_config(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +recorder_config &recorder_config::operator =(const recorder_config &a) { + if (&a != this) { + id=a.id; + bits_per_sample=a.bits_per_sample; + sample_rate=a.sample_rate; + beams=a.beams; + version=a.version; + strcpy(name,a.name); + } + return (*this); +} + + +std::string recorder_config::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<6;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string recorder_config::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string recorder_config::select_format() const +{ +std::string rv(""); +for (int i=0; i<5;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string recorder_config::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << "'" << name << "'"; + rv << ','; + rv << bits_per_sample; + rv << ','; + rv << sample_rate; + rv << ','; + rv << beams; + rv << ','; + rv << version; + return rv.str(); +} + + +std::string recorder_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + { + std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << bits_per_sample << "\n"; + rv << xml_indent() << "" << sample_rate << "\n"; + rv << xml_indent() << "" << beams << "\n"; + rv << xml_indent() << "" << version << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void recorder_config::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"name",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)64)); + name[std::min(in.size(),(size_t)63)]=0; + } + if (extract_xml_record(field,"bits_per_sample",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> bits_per_sample; + } + if (extract_xml_record(field,"sample_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> sample_rate; + } + if (extract_xml_record(field,"beams",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> beams; + } + if (extract_xml_record(field,"version",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> version; + } + } + } + + void recorder_config::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + strncpy(name,s[1]->c_str(),64); + name[63]=0; + } + { + std::istringstream row(*(s[2])); + row >> bits_per_sample; + } + { + std::istringstream row(*(s[3])); + row >> sample_rate; + } + { + std::istringstream row(*(s[4])); + row >> beams; + } + { + std::istringstream row(*(s[5])); + row >> version; + } + } + + void recorder_config::parse(const std::string &s) { + SQL_ROW row(&s,6); + parse(row); + } + +template <> const char * const db_table::table_name="splitter_config"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=13; +template <> const char * const db_table::column_names[13]={"id","version","data_type","fft_len","ifft_len","filter","window","samples_per_wu","highpass","blanker_filter","pfb_ntaps","pfb_width_factor","wu_bits_per_sample"}; + +splitter_config::splitter_config() : + db_table(*this,-1), + id(0), + version(0), + fft_len(0), + ifft_len(0), + samples_per_wu(0), + highpass(0), + pfb_ntaps(0), + pfb_width_factor(0), + wu_bits_per_sample(0) +{ + db_open(); + data_type[0]=0; + filter[0]=0; + window[0]=0; + blanker_filter[0]=0; +} + + +splitter_config::splitter_config(const splitter_config &a) : + db_table(*this,-1), + id(a.id), + version(a.version), + fft_len(a.fft_len), + ifft_len(a.ifft_len), + samples_per_wu(a.samples_per_wu), + highpass(a.highpass), + pfb_ntaps(a.pfb_ntaps), + pfb_width_factor(a.pfb_width_factor), + wu_bits_per_sample(a.wu_bits_per_sample) +{ + db_open(); + strcpy(data_type,a.data_type); + strcpy(filter,a.filter); + strcpy(window,a.window); + strcpy(blanker_filter,a.blanker_filter); +} + + +splitter_config::splitter_config(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +splitter_config::splitter_config(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +splitter_config &splitter_config::operator =(const splitter_config &a) { + if (&a != this) { + id=a.id; + version=a.version; + fft_len=a.fft_len; + ifft_len=a.ifft_len; + samples_per_wu=a.samples_per_wu; + highpass=a.highpass; + pfb_ntaps=a.pfb_ntaps; + pfb_width_factor=a.pfb_width_factor; + wu_bits_per_sample=a.wu_bits_per_sample; + strcpy(data_type,a.data_type); + strcpy(filter,a.filter); + strcpy(window,a.window); + strcpy(blanker_filter,a.blanker_filter); + } + return (*this); +} + + +std::string splitter_config::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<13;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string splitter_config::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string splitter_config::select_format() const +{ +std::string rv(""); +for (int i=0; i<12;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string splitter_config::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << version; + rv << ','; + rv << "'" << data_type << "'"; + rv << ','; + rv << fft_len; + rv << ','; + rv << ifft_len; + rv << ','; + rv << "'" << filter << "'"; + rv << ','; + rv << "'" << window << "'"; + rv << ','; + rv << samples_per_wu; + rv << ','; + rv << highpass; + rv << ','; + rv << "'" << blanker_filter << "'"; + rv << ','; + rv << pfb_ntaps; + rv << ','; + rv << pfb_width_factor; + rv << ','; + rv << wu_bits_per_sample; + return rv.str(); +} + + +std::string splitter_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << version << "\n"; + { + std::string enc_field=xml_encode_string(data_type,std::min(strlen(data_type),sizeof(data_type))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << ifft_len << "\n"; + { + std::string enc_field=xml_encode_string(filter,std::min(strlen(filter),sizeof(filter))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + { + std::string enc_field=xml_encode_string(window,std::min(strlen(window),sizeof(window))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << samples_per_wu << "\n"; + rv << xml_indent() << "" << highpass << "\n"; + { + std::string enc_field=xml_encode_string(blanker_filter,std::min(strlen(blanker_filter),sizeof(blanker_filter))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << pfb_ntaps << "\n"; + rv << xml_indent() << "" << pfb_width_factor << "\n"; + rv << xml_indent() << "" << wu_bits_per_sample << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void splitter_config::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"version",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> version; + } + if (extract_xml_record(field,"data_type",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(data_type,(const char *)&(in.front()),std::min(in.size(),(size_t)64)); + data_type[std::min(in.size(),(size_t)63)]=0; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"ifft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ifft_len; + } + if (extract_xml_record(field,"filter",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(filter,(const char *)&(in.front()),std::min(in.size(),(size_t)64)); + filter[std::min(in.size(),(size_t)63)]=0; + } + if (extract_xml_record(field,"window",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(window,(const char *)&(in.front()),std::min(in.size(),(size_t)64)); + window[std::min(in.size(),(size_t)63)]=0; + } + if (extract_xml_record(field,"samples_per_wu",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> samples_per_wu; + } + if (extract_xml_record(field,"highpass",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> highpass; + } + if (extract_xml_record(field,"blanker_filter",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(blanker_filter,(const char *)&(in.front()),std::min(in.size(),(size_t)64)); + blanker_filter[std::min(in.size(),(size_t)63)]=0; + } + if (extract_xml_record(field,"pfb_ntaps",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pfb_ntaps; + } + if (extract_xml_record(field,"pfb_width_factor",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pfb_width_factor; + } + if (extract_xml_record(field,"wu_bits_per_sample",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> wu_bits_per_sample; + } + } + } + + void splitter_config::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> version; + } + { + strncpy(data_type,s[2]->c_str(),64); + data_type[63]=0; + } + { + std::istringstream row(*(s[3])); + row >> fft_len; + } + { + std::istringstream row(*(s[4])); + row >> ifft_len; + } + { + strncpy(filter,s[5]->c_str(),64); + filter[63]=0; + } + { + strncpy(window,s[6]->c_str(),64); + window[63]=0; + } + { + std::istringstream row(*(s[7])); + row >> samples_per_wu; + } + { + std::istringstream row(*(s[8])); + row >> highpass; + } + { + strncpy(blanker_filter,s[9]->c_str(),64); + blanker_filter[63]=0; + } + { + std::istringstream row(*(s[10])); + row >> pfb_ntaps; + } + { + std::istringstream row(*(s[11])); + row >> pfb_width_factor; + } + { + std::istringstream row(*(s[12])); + row >> wu_bits_per_sample; + } + } + + void splitter_config::parse(const std::string &s) { + SQL_ROW row(&s,13); + parse(row); + } + +template <> const char * const db_table::table_name="analysis_config"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=39; +template <> const char * const db_table::column_names[39]={"id","spike_thresh","spikes_per_spectrum","autocorr_thresh","autocorr_per_spectrum","autocorr_fftlen","gauss_null_chi_sq_thresh","gauss_chi_sq_thresh","gauss_power_thresh","gauss_peak_power_thresh","gauss_pot_length","pulse_thresh","pulse_display_thresh","pulse_max","pulse_min","pulse_fft_max","pulse_pot_length","triplet_thresh","triplet_max","triplet_min","triplet_pot_length","pot_overlap_factor","pot_t_offset","pot_min_slew","pot_max_slew","chirp_resolution","analysis_fft_lengths","bsmooth_boxcar_length","bsmooth_chunk_size","chirps","pulse_beams","max_signals","max_spikes","max_autocorr","max_gaussians","max_pulses","max_triplets","keyuniq","credit_rate"}; + +analysis_config::analysis_config() : + db_table(*this,-1), + id(0), + spike_thresh(0), + spikes_per_spectrum(0), + autocorr_thresh(0), + autocorr_per_spectrum(0), + autocorr_fftlen(0), + gauss_null_chi_sq_thresh(0), + gauss_chi_sq_thresh(0), + gauss_power_thresh(0), + gauss_peak_power_thresh(0), + gauss_pot_length(0), + pulse_thresh(0), + pulse_display_thresh(0), + pulse_max(0), + pulse_min(0), + pulse_fft_max(0), + pulse_pot_length(0), + triplet_thresh(0), + triplet_max(0), + triplet_min(0), + triplet_pot_length(0), + pot_overlap_factor(0), + pot_t_offset(0), + pot_min_slew(0), + pot_max_slew(0), + chirp_resolution(0), + analysis_fft_lengths(0), + bsmooth_boxcar_length(0), + bsmooth_chunk_size(0), + chirps((chirp_parameter_t *)0,0,_x_xml_values), + pulse_beams(0), + max_signals(0), + max_spikes(0), + max_autocorr(0), + max_gaussians(0), + max_pulses(0), + max_triplets(0), + keyuniq(0), + credit_rate(0) +{ + db_open(); +} + + +analysis_config::analysis_config(const analysis_config &a) : + db_table(*this,-1), + id(a.id), + spike_thresh(a.spike_thresh), + spikes_per_spectrum(a.spikes_per_spectrum), + autocorr_thresh(a.autocorr_thresh), + autocorr_per_spectrum(a.autocorr_per_spectrum), + autocorr_fftlen(a.autocorr_fftlen), + gauss_null_chi_sq_thresh(a.gauss_null_chi_sq_thresh), + gauss_chi_sq_thresh(a.gauss_chi_sq_thresh), + gauss_power_thresh(a.gauss_power_thresh), + gauss_peak_power_thresh(a.gauss_peak_power_thresh), + gauss_pot_length(a.gauss_pot_length), + pulse_thresh(a.pulse_thresh), + pulse_display_thresh(a.pulse_display_thresh), + pulse_max(a.pulse_max), + pulse_min(a.pulse_min), + pulse_fft_max(a.pulse_fft_max), + pulse_pot_length(a.pulse_pot_length), + triplet_thresh(a.triplet_thresh), + triplet_max(a.triplet_max), + triplet_min(a.triplet_min), + triplet_pot_length(a.triplet_pot_length), + pot_overlap_factor(a.pot_overlap_factor), + pot_t_offset(a.pot_t_offset), + pot_min_slew(a.pot_min_slew), + pot_max_slew(a.pot_max_slew), + chirp_resolution(a.chirp_resolution), + analysis_fft_lengths(a.analysis_fft_lengths), + bsmooth_boxcar_length(a.bsmooth_boxcar_length), + bsmooth_chunk_size(a.bsmooth_chunk_size), + chirps(a.chirps), + pulse_beams(a.pulse_beams), + max_signals(a.max_signals), + max_spikes(a.max_spikes), + max_autocorr(a.max_autocorr), + max_gaussians(a.max_gaussians), + max_pulses(a.max_pulses), + max_triplets(a.max_triplets), + keyuniq(a.keyuniq), + credit_rate(a.credit_rate) +{ + db_open(); +} + + +analysis_config::analysis_config(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +analysis_config::analysis_config(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +analysis_config &analysis_config::operator =(const analysis_config &a) { + if (&a != this) { + id=a.id; + spike_thresh=a.spike_thresh; + spikes_per_spectrum=a.spikes_per_spectrum; + autocorr_thresh=a.autocorr_thresh; + autocorr_per_spectrum=a.autocorr_per_spectrum; + autocorr_fftlen=a.autocorr_fftlen; + gauss_null_chi_sq_thresh=a.gauss_null_chi_sq_thresh; + gauss_chi_sq_thresh=a.gauss_chi_sq_thresh; + gauss_power_thresh=a.gauss_power_thresh; + gauss_peak_power_thresh=a.gauss_peak_power_thresh; + gauss_pot_length=a.gauss_pot_length; + pulse_thresh=a.pulse_thresh; + pulse_display_thresh=a.pulse_display_thresh; + pulse_max=a.pulse_max; + pulse_min=a.pulse_min; + pulse_fft_max=a.pulse_fft_max; + pulse_pot_length=a.pulse_pot_length; + triplet_thresh=a.triplet_thresh; + triplet_max=a.triplet_max; + triplet_min=a.triplet_min; + triplet_pot_length=a.triplet_pot_length; + pot_overlap_factor=a.pot_overlap_factor; + pot_t_offset=a.pot_t_offset; + pot_min_slew=a.pot_min_slew; + pot_max_slew=a.pot_max_slew; + chirp_resolution=a.chirp_resolution; + analysis_fft_lengths=a.analysis_fft_lengths; + bsmooth_boxcar_length=a.bsmooth_boxcar_length; + bsmooth_chunk_size=a.bsmooth_chunk_size; + { + chirps.clear(); + std::vector::const_iterator i(a.chirps.begin()); + for (;i!=a.chirps.end();i++) { + chirps.push_back(*i); + } + } + pulse_beams=a.pulse_beams; + max_signals=a.max_signals; + max_spikes=a.max_spikes; + max_autocorr=a.max_autocorr; + max_gaussians=a.max_gaussians; + max_pulses=a.max_pulses; + max_triplets=a.max_triplets; + keyuniq=a.keyuniq; + credit_rate=a.credit_rate; + } + return (*this); +} + + +std::string analysis_config::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<39;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string analysis_config::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string analysis_config::select_format() const +{ +std::string rv(""); +for (int i=0; i<38;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string analysis_config::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << spike_thresh; + rv << ','; + rv << spikes_per_spectrum; + rv << ','; + rv << autocorr_thresh; + rv << ','; + rv << autocorr_per_spectrum; + rv << ','; + rv << autocorr_fftlen; + rv << ','; + rv << gauss_null_chi_sq_thresh; + rv << ','; + rv << gauss_chi_sq_thresh; + rv << ','; + rv << gauss_power_thresh; + rv << ','; + rv << gauss_peak_power_thresh; + rv << ','; + rv << gauss_pot_length; + rv << ','; + rv << pulse_thresh; + rv << ','; + rv << pulse_display_thresh; + rv << ','; + rv << pulse_max; + rv << ','; + rv << pulse_min; + rv << ','; + rv << pulse_fft_max; + rv << ','; + rv << pulse_pot_length; + rv << ','; + rv << triplet_thresh; + rv << ','; + rv << triplet_max; + rv << ','; + rv << triplet_min; + rv << ','; + rv << triplet_pot_length; + rv << ','; + rv << pot_overlap_factor; + rv << ','; + rv << pot_t_offset; + rv << ','; + rv << pot_min_slew; + rv << ','; + rv << pot_max_slew; + rv << ','; + rv << chirp_resolution; + rv << ','; + rv << analysis_fft_lengths; + rv << ','; + rv << bsmooth_boxcar_length; + rv << ','; + rv << bsmooth_chunk_size; + rv << ','; + rv << "LIST {"; + { + std::vector::const_iterator p=chirps.begin(); + for (;pprint(); + if (p != chirps.end()-1) { + rv << ','; + } else { + rv << "}"; + } + } + } + rv << ','; + rv << pulse_beams; + rv << ','; + rv << max_signals; + rv << ','; + rv << max_spikes; + rv << ','; + rv << max_autocorr; + rv << ','; + rv << max_gaussians; + rv << ','; + rv << max_pulses; + rv << ','; + rv << max_triplets; + rv << ','; + rv << keyuniq; + rv << ','; + rv << credit_rate; + return rv.str(); +} + + +std::string analysis_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << spike_thresh << "\n"; + rv << xml_indent() << "" << spikes_per_spectrum << "\n"; + rv << xml_indent() << "" << autocorr_thresh << "\n"; + rv << xml_indent() << "" << autocorr_per_spectrum << "\n"; + rv << xml_indent() << "" << autocorr_fftlen << "\n"; + rv << xml_indent() << "" << gauss_null_chi_sq_thresh << "\n"; + rv << xml_indent() << "" << gauss_chi_sq_thresh << "\n"; + rv << xml_indent() << "" << gauss_power_thresh << "\n"; + rv << xml_indent() << "" << gauss_peak_power_thresh << "\n"; + rv << xml_indent() << "" << gauss_pot_length << "\n"; + rv << xml_indent() << "" << pulse_thresh << "\n"; + rv << xml_indent() << "" << pulse_display_thresh << "\n"; + rv << xml_indent() << "" << pulse_max << "\n"; + rv << xml_indent() << "" << pulse_min << "\n"; + rv << xml_indent() << "" << pulse_fft_max << "\n"; + rv << xml_indent() << "" << pulse_pot_length << "\n"; + rv << xml_indent() << "" << triplet_thresh << "\n"; + rv << xml_indent() << "" << triplet_max << "\n"; + rv << xml_indent() << "" << triplet_min << "\n"; + rv << xml_indent() << "" << triplet_pot_length << "\n"; + rv << xml_indent() << "" << pot_overlap_factor << "\n"; + rv << xml_indent() << "" << pot_t_offset << "\n"; + rv << xml_indent() << "" << pot_min_slew << "\n"; + rv << xml_indent() << "" << pot_max_slew << "\n"; + rv << xml_indent() << "" << chirp_resolution << "\n"; + rv << xml_indent() << "" << analysis_fft_lengths << "\n"; + rv << xml_indent() << "" << bsmooth_boxcar_length << "\n"; + rv << xml_indent() << "" << bsmooth_chunk_size << "\n"; + if (chirps.size()) { + rv << xml_indent() << "\n" ; + rv << enc_string; + } +} + rv << xml_indent(-2); + rv << "\n"; + rv << xml_indent() << "" << pulse_beams << "\n"; + rv << xml_indent() << "" << max_signals << "\n"; + rv << xml_indent() << "" << max_spikes << "\n"; + rv << xml_indent() << "" << max_autocorr << "\n"; + rv << xml_indent() << "" << max_gaussians << "\n"; + rv << xml_indent() << "" << max_pulses << "\n"; + rv << xml_indent() << "" << max_triplets << "\n"; + rv << xml_indent() << "" << keyuniq << "\n"; + rv << xml_indent() << "" << credit_rate << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void analysis_config::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"spike_thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spike_thresh; + } + if (extract_xml_record(field,"spikes_per_spectrum",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spikes_per_spectrum; + } + if (extract_xml_record(field,"autocorr_thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> autocorr_thresh; + } + if (extract_xml_record(field,"autocorr_per_spectrum",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> autocorr_per_spectrum; + } + if (extract_xml_record(field,"autocorr_fftlen",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> autocorr_fftlen; + } + if (extract_xml_record(field,"gauss_null_chi_sq_thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gauss_null_chi_sq_thresh; + } + if (extract_xml_record(field,"gauss_chi_sq_thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gauss_chi_sq_thresh; + } + if (extract_xml_record(field,"gauss_power_thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gauss_power_thresh; + } + if (extract_xml_record(field,"gauss_peak_power_thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gauss_peak_power_thresh; + } + if (extract_xml_record(field,"gauss_pot_length",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gauss_pot_length; + } + if (extract_xml_record(field,"pulse_thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_thresh; + } + if (extract_xml_record(field,"pulse_display_thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_display_thresh; + } + if (extract_xml_record(field,"pulse_max",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_max; + } + if (extract_xml_record(field,"pulse_min",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_min; + } + if (extract_xml_record(field,"pulse_fft_max",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_fft_max; + } + if (extract_xml_record(field,"pulse_pot_length",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_pot_length; + } + if (extract_xml_record(field,"triplet_thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_thresh; + } + if (extract_xml_record(field,"triplet_max",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_max; + } + if (extract_xml_record(field,"triplet_min",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_min; + } + if (extract_xml_record(field,"triplet_pot_length",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_pot_length; + } + if (extract_xml_record(field,"pot_overlap_factor",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pot_overlap_factor; + } + if (extract_xml_record(field,"pot_t_offset",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pot_t_offset; + } + if (extract_xml_record(field,"pot_min_slew",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pot_min_slew; + } + if (extract_xml_record(field,"pot_max_slew",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pot_max_slew; + } + if (extract_xml_record(field,"chirp_resolution",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_resolution; + } + if (extract_xml_record(field,"analysis_fft_lengths",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> analysis_fft_lengths; + } + if (extract_xml_record(field,"bsmooth_boxcar_length",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> bsmooth_boxcar_length; + } + if (extract_xml_record(field,"bsmooth_chunk_size",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> bsmooth_chunk_size; + } + chirps.clear(); + if (extract_xml_record(field,"chirps",sub)) { + pos=0; + while ((pos=sub.find("",pos); + } + } + if (extract_xml_record(field,"pulse_beams",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_beams; + } + if (extract_xml_record(field,"max_signals",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_signals; + } + if (extract_xml_record(field,"max_spikes",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_spikes; + } + if (extract_xml_record(field,"max_autocorr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_autocorr; + } + if (extract_xml_record(field,"max_gaussians",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_gaussians; + } + if (extract_xml_record(field,"max_pulses",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_pulses; + } + if (extract_xml_record(field,"max_triplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_triplets; + } + if (extract_xml_record(field,"keyuniq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> keyuniq; + } + if (extract_xml_record(field,"credit_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> credit_rate; + } + } + } + + void analysis_config::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> spike_thresh; + } + { + std::istringstream row(*(s[2])); + row >> spikes_per_spectrum; + } + { + std::istringstream row(*(s[3])); + row >> autocorr_thresh; + } + { + std::istringstream row(*(s[4])); + row >> autocorr_per_spectrum; + } + { + std::istringstream row(*(s[5])); + row >> autocorr_fftlen; + } + { + std::istringstream row(*(s[6])); + row >> gauss_null_chi_sq_thresh; + } + { + std::istringstream row(*(s[7])); + row >> gauss_chi_sq_thresh; + } + { + std::istringstream row(*(s[8])); + row >> gauss_power_thresh; + } + { + std::istringstream row(*(s[9])); + row >> gauss_peak_power_thresh; + } + { + std::istringstream row(*(s[10])); + row >> gauss_pot_length; + } + { + std::istringstream row(*(s[11])); + row >> pulse_thresh; + } + { + std::istringstream row(*(s[12])); + row >> pulse_display_thresh; + } + { + std::istringstream row(*(s[13])); + row >> pulse_max; + } + { + std::istringstream row(*(s[14])); + row >> pulse_min; + } + { + std::istringstream row(*(s[15])); + row >> pulse_fft_max; + } + { + std::istringstream row(*(s[16])); + row >> pulse_pot_length; + } + { + std::istringstream row(*(s[17])); + row >> triplet_thresh; + } + { + std::istringstream row(*(s[18])); + row >> triplet_max; + } + { + std::istringstream row(*(s[19])); + row >> triplet_min; + } + { + std::istringstream row(*(s[20])); + row >> triplet_pot_length; + } + { + std::istringstream row(*(s[21])); + row >> pot_overlap_factor; + } + { + std::istringstream row(*(s[22])); + row >> pot_t_offset; + } + { + std::istringstream row(*(s[23])); + row >> pot_min_slew; + } + { + std::istringstream row(*(s[24])); + row >> pot_max_slew; + } + { + std::istringstream row(*(s[25])); + row >> chirp_resolution; + } + { + std::istringstream row(*(s[26])); + row >> analysis_fft_lengths; + } + { + std::istringstream row(*(s[27])); + row >> bsmooth_boxcar_length; + } + { + std::istringstream row(*(s[28])); + row >> bsmooth_chunk_size; + } + { + std::string::size_type p,q; + int i; + chirps.clear(); + SQL_ROW tmp(s[29]); + for (i=0;i> pulse_beams; + } + { + std::istringstream row(*(s[31])); + row >> max_signals; + } + { + std::istringstream row(*(s[32])); + row >> max_spikes; + } + { + std::istringstream row(*(s[33])); + row >> max_autocorr; + } + { + std::istringstream row(*(s[34])); + row >> max_gaussians; + } + { + std::istringstream row(*(s[35])); + row >> max_pulses; + } + { + std::istringstream row(*(s[36])); + row >> max_triplets; + } + { + std::istringstream row(*(s[37])); + row >> keyuniq; + } + { + std::istringstream row(*(s[38])); + row >> credit_rate; + } + } + + void analysis_config::parse(const std::string &s) { + SQL_ROW row(&s,39); + parse(row); + } + +template <> const char * const db_table::table_name="science_config"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=29; +template <> const char * const db_table::column_names[29]={"id","active","qpix_scheme","qpix_nside","fpix_width","total_bandwidth","freq_uncertainty","fwhm_beamwidth","sky_disc_radius","observable_sky","epoch","bary_chirp_window","bary_freq_window","nonbary_freq_window","spike_obs_duration","spike_obs_interval","gauss_obs_duration","gauss_obs_interval","pulse_obs_duration","pulse_obs_interval","triplet_obs_duration","triplet_obs_interval","min_spike_id","min_autocorr_id","min_gaussian_id","min_pulse_id","min_triplet_id","min_app_version""info_xml"}; + +science_config::science_config() : + db_table(*this,-1), + id(0), + active(0), + qpix_nside(0), + fpix_width(0), + total_bandwidth(0), + freq_uncertainty(0), + fwhm_beamwidth(0), + sky_disc_radius(0), + observable_sky(0), + epoch(0), + bary_chirp_window(0), + bary_freq_window(0), + nonbary_freq_window(0), + spike_obs_duration(0), + spike_obs_interval(0), + gauss_obs_duration(0), + gauss_obs_interval(0), + pulse_obs_duration(0), + pulse_obs_interval(0), + triplet_obs_duration(0), + triplet_obs_interval(0), + min_spike_id(0), + min_autocorr_id(0), + min_gaussian_id(0), + min_pulse_id(0), + min_triplet_id(0), + min_app_version(0) +{ + db_open(); + qpix_scheme[0]=0; + info_xml[0]=0; +} + + +science_config::science_config(const science_config &a) : + db_table(*this,-1), + id(a.id), + active(a.active), + qpix_nside(a.qpix_nside), + fpix_width(a.fpix_width), + total_bandwidth(a.total_bandwidth), + freq_uncertainty(a.freq_uncertainty), + fwhm_beamwidth(a.fwhm_beamwidth), + sky_disc_radius(a.sky_disc_radius), + observable_sky(a.observable_sky), + epoch(a.epoch), + bary_chirp_window(a.bary_chirp_window), + bary_freq_window(a.bary_freq_window), + nonbary_freq_window(a.nonbary_freq_window), + spike_obs_duration(a.spike_obs_duration), + spike_obs_interval(a.spike_obs_interval), + gauss_obs_duration(a.gauss_obs_duration), + gauss_obs_interval(a.gauss_obs_interval), + pulse_obs_duration(a.pulse_obs_duration), + pulse_obs_interval(a.pulse_obs_interval), + triplet_obs_duration(a.triplet_obs_duration), + triplet_obs_interval(a.triplet_obs_interval), + min_spike_id(a.min_spike_id), + min_autocorr_id(a.min_autocorr_id), + min_gaussian_id(a.min_gaussian_id), + min_pulse_id(a.min_pulse_id), + min_triplet_id(a.min_triplet_id), + min_app_version(a.min_app_version) +{ + db_open(); + strcpy(qpix_scheme,a.qpix_scheme); + strcpy(info_xml,a.info_xml); +} + + +science_config::science_config(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +science_config::science_config(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +science_config &science_config::operator =(const science_config &a) { + if (&a != this) { + id=a.id; + active=a.active; + qpix_nside=a.qpix_nside; + fpix_width=a.fpix_width; + total_bandwidth=a.total_bandwidth; + freq_uncertainty=a.freq_uncertainty; + fwhm_beamwidth=a.fwhm_beamwidth; + sky_disc_radius=a.sky_disc_radius; + observable_sky=a.observable_sky; + epoch=a.epoch; + bary_chirp_window=a.bary_chirp_window; + bary_freq_window=a.bary_freq_window; + nonbary_freq_window=a.nonbary_freq_window; + spike_obs_duration=a.spike_obs_duration; + spike_obs_interval=a.spike_obs_interval; + gauss_obs_duration=a.gauss_obs_duration; + gauss_obs_interval=a.gauss_obs_interval; + pulse_obs_duration=a.pulse_obs_duration; + pulse_obs_interval=a.pulse_obs_interval; + triplet_obs_duration=a.triplet_obs_duration; + triplet_obs_interval=a.triplet_obs_interval; + min_spike_id=a.min_spike_id; + min_autocorr_id=a.min_autocorr_id; + min_gaussian_id=a.min_gaussian_id; + min_pulse_id=a.min_pulse_id; + min_triplet_id=a.min_triplet_id; + min_app_version=a.min_app_version; + strcpy(qpix_scheme,a.qpix_scheme); + strcpy(info_xml,a.info_xml); + } + return (*this); +} + + +std::string science_config::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<29;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string science_config::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string science_config::select_format() const +{ +std::string rv(""); +for (int i=0; i<28;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string science_config::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << active; + rv << ','; + rv << "'" << qpix_scheme << "'"; + rv << ','; + rv << qpix_nside; + rv << ','; + rv << fpix_width; + rv << ','; + rv << total_bandwidth; + rv << ','; + rv << freq_uncertainty; + rv << ','; + rv << fwhm_beamwidth; + rv << ','; + rv << sky_disc_radius; + rv << ','; + rv << observable_sky; + rv << ','; + rv << epoch; + rv << ','; + rv << bary_chirp_window; + rv << ','; + rv << bary_freq_window; + rv << ','; + rv << nonbary_freq_window; + rv << ','; + rv << spike_obs_duration; + rv << ','; + rv << spike_obs_interval; + rv << ','; + rv << gauss_obs_duration; + rv << ','; + rv << gauss_obs_interval; + rv << ','; + rv << pulse_obs_duration; + rv << ','; + rv << pulse_obs_interval; + rv << ','; + rv << triplet_obs_duration; + rv << ','; + rv << triplet_obs_interval; + rv << ','; + rv << min_spike_id; + rv << ','; + rv << min_autocorr_id; + rv << ','; + rv << min_gaussian_id; + rv << ','; + rv << min_pulse_id; + rv << ','; + rv << min_triplet_id; + rv << ','; + rv << min_app_version; + rv << ','; + rv << "'" << info_xml << "'"; + return rv.str(); +} + + +std::string science_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << active << "\n"; + { + std::string enc_field=xml_encode_string(qpix_scheme,std::min(strlen(qpix_scheme),sizeof(qpix_scheme))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << qpix_nside << "\n"; + rv << xml_indent() << "" << fpix_width << "\n"; + rv << xml_indent() << "" << total_bandwidth << "\n"; + rv << xml_indent() << "" << freq_uncertainty << "\n"; + rv << xml_indent() << "" << fwhm_beamwidth << "\n"; + rv << xml_indent() << "" << sky_disc_radius << "\n"; + rv << xml_indent() << "" << observable_sky << "\n"; + rv << xml_indent() << "" << epoch << "\n"; + rv << xml_indent() << "" << bary_chirp_window << "\n"; + rv << xml_indent() << "" << bary_freq_window << "\n"; + rv << xml_indent() << "" << nonbary_freq_window << "\n"; + rv << xml_indent() << "" << spike_obs_duration << "\n"; + rv << xml_indent() << "" << spike_obs_interval << "\n"; + rv << xml_indent() << "" << gauss_obs_duration << "\n"; + rv << xml_indent() << "" << gauss_obs_interval << "\n"; + rv << xml_indent() << "" << pulse_obs_duration << "\n"; + rv << xml_indent() << "" << pulse_obs_interval << "\n"; + rv << xml_indent() << "" << triplet_obs_duration << "\n"; + rv << xml_indent() << "" << triplet_obs_interval << "\n"; + rv << xml_indent() << "" << min_spike_id << "\n"; + rv << xml_indent() << "" << min_autocorr_id << "\n"; + rv << xml_indent() << "" << min_gaussian_id << "\n"; + rv << xml_indent() << "" << min_pulse_id << "\n"; + rv << xml_indent() << "" << min_triplet_id << "\n"; + rv << xml_indent() << "" << min_app_version << "\n"; + { + std::string enc_field=xml_encode_string(info_xml,std::min(strlen(info_xml),sizeof(info_xml))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void science_config::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"active",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> active; + } + if (extract_xml_record(field,"qpix_scheme",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(qpix_scheme,(const char *)&(in.front()),std::min(in.size(),(size_t)16)); + qpix_scheme[std::min(in.size(),(size_t)15)]=0; + } + if (extract_xml_record(field,"qpix_nside",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> qpix_nside; + } + if (extract_xml_record(field,"fpix_width",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fpix_width; + } + if (extract_xml_record(field,"total_bandwidth",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> total_bandwidth; + } + if (extract_xml_record(field,"freq_uncertainty",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq_uncertainty; + } + if (extract_xml_record(field,"fwhm_beamwidth",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fwhm_beamwidth; + } + if (extract_xml_record(field,"sky_disc_radius",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> sky_disc_radius; + } + if (extract_xml_record(field,"observable_sky",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> observable_sky; + } + if (extract_xml_record(field,"epoch",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> epoch; + } + if (extract_xml_record(field,"bary_chirp_window",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> bary_chirp_window; + } + if (extract_xml_record(field,"bary_freq_window",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> bary_freq_window; + } + if (extract_xml_record(field,"nonbary_freq_window",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> nonbary_freq_window; + } + if (extract_xml_record(field,"spike_obs_duration",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spike_obs_duration; + } + if (extract_xml_record(field,"spike_obs_interval",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spike_obs_interval; + } + if (extract_xml_record(field,"gauss_obs_duration",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gauss_obs_duration; + } + if (extract_xml_record(field,"gauss_obs_interval",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gauss_obs_interval; + } + if (extract_xml_record(field,"pulse_obs_duration",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_obs_duration; + } + if (extract_xml_record(field,"pulse_obs_interval",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_obs_interval; + } + if (extract_xml_record(field,"triplet_obs_duration",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_obs_duration; + } + if (extract_xml_record(field,"triplet_obs_interval",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_obs_interval; + } + if (extract_xml_record(field,"min_spike_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_spike_id; + } + if (extract_xml_record(field,"min_autocorr_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_autocorr_id; + } + if (extract_xml_record(field,"min_gaussian_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_gaussian_id; + } + if (extract_xml_record(field,"min_pulse_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_pulse_id; + } + if (extract_xml_record(field,"min_triplet_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_triplet_id; + } + if (extract_xml_record(field,"min_app_version",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_app_version; + } + if (extract_xml_record(field,"info_xml",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(info_xml,(const char *)&(in.front()),std::min(in.size(),(size_t)255)); + info_xml[std::min(in.size(),(size_t)254)]=0; + } + } + } + + void science_config::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> active; + } + { + strncpy(qpix_scheme,s[2]->c_str(),16); + qpix_scheme[15]=0; + } + { + std::istringstream row(*(s[3])); + row >> qpix_nside; + } + { + std::istringstream row(*(s[4])); + row >> fpix_width; + } + { + std::istringstream row(*(s[5])); + row >> total_bandwidth; + } + { + std::istringstream row(*(s[6])); + row >> freq_uncertainty; + } + { + std::istringstream row(*(s[7])); + row >> fwhm_beamwidth; + } + { + std::istringstream row(*(s[8])); + row >> sky_disc_radius; + } + { + std::istringstream row(*(s[9])); + row >> observable_sky; + } + { + std::istringstream row(*(s[10])); + row >> epoch; + } + { + std::istringstream row(*(s[11])); + row >> bary_chirp_window; + } + { + std::istringstream row(*(s[12])); + row >> bary_freq_window; + } + { + std::istringstream row(*(s[13])); + row >> nonbary_freq_window; + } + { + std::istringstream row(*(s[14])); + row >> spike_obs_duration; + } + { + std::istringstream row(*(s[15])); + row >> spike_obs_interval; + } + { + std::istringstream row(*(s[16])); + row >> gauss_obs_duration; + } + { + std::istringstream row(*(s[17])); + row >> gauss_obs_interval; + } + { + std::istringstream row(*(s[18])); + row >> pulse_obs_duration; + } + { + std::istringstream row(*(s[19])); + row >> pulse_obs_interval; + } + { + std::istringstream row(*(s[20])); + row >> triplet_obs_duration; + } + { + std::istringstream row(*(s[21])); + row >> triplet_obs_interval; + } + { + std::istringstream row(*(s[22])); + row >> min_spike_id; + } + { + std::istringstream row(*(s[23])); + row >> min_autocorr_id; + } + { + std::istringstream row(*(s[24])); + row >> min_gaussian_id; + } + { + std::istringstream row(*(s[25])); + row >> min_pulse_id; + } + { + std::istringstream row(*(s[26])); + row >> min_triplet_id; + } + { + std::istringstream row(*(s[27])); + row >> min_app_version; + } + { + strncpy(info_xml,s[28]->c_str(),255); + info_xml[254]=0; + } + } + + void science_config::parse(const std::string &s) { + SQL_ROW row(&s,29); + parse(row); + } + +template <> const char * const db_type::type_name="candidate_t"; +template <> const char * db_type::_search_tag=type_name; +template <> const int db_type::_nfields=5; +template <> const char * const db_type::column_names[5]={"type","id","num_obs","score","is_rfi"}; + +candidate_t::candidate_t() : + db_type(*this), + type(0), + id(0), + num_obs(0), + score(0), + is_rfi(0) +{ + db_open(); +} + + +candidate_t::candidate_t(const candidate_t &a) : + db_type(*this), + type(a.type), + id(a.id), + num_obs(a.num_obs), + score(a.score), + is_rfi(a.is_rfi) +{ + db_open(); +} + + +candidate_t::candidate_t(const SQL_ROW &a) : + db_type(*this) +{ + db_open(); + parse(a); +} + + +candidate_t::candidate_t(const std::string &s,const char *tag) : + db_type(*this) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +candidate_t &candidate_t::operator =(const candidate_t &a) { + if (&a != this) { + type=a.type; + id=a.id; + num_obs=a.num_obs; + score=a.score; + is_rfi=a.is_rfi; + } + return (*this); +} + + +std::string candidate_t::update_format() const +{ std::ostringstream rv(""); + + rv << "ROW("; + for (int i=1;i<5;i++) rv << "?,"; + rv << "?"; +rv << ")"; + + return rv.str(); +} + + +std::string candidate_t::insert_format() const +{ return update_format(); +} + +std::string candidate_t::select_format() const +{ +std::string rv(""); +for (int i=0; i<4;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string candidate_t::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + rv << "ROW("; + rv << type; + rv << ','; + rv << id; + rv << ','; + rv << num_obs; + rv << ','; + rv << score; + rv << ','; + rv << is_rfi; + rv << ")"; + return rv.str(); +} + + +std::string candidate_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + rv << xml_indent() << "" << type << "\n"; + rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << num_obs << "\n"; + rv << xml_indent() << "" << score << "\n"; + rv << xml_indent() << "" << is_rfi << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void candidate_t::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"type",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> type; + } + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"num_obs",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_obs; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + if (extract_xml_record(field,"is_rfi",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> is_rfi; + } + } + } + + void candidate_t::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> type; + } + { + std::istringstream row(*(s[1])); + row >> id; + } + { + std::istringstream row(*(s[2])); + row >> num_obs; + } + { + std::istringstream row(*(s[3])); + row >> score; + } + { + std::istringstream row(*(s[4])); + row >> is_rfi; + } + } + + void candidate_t::parse(const std::string &s) { + SQL_ROW row(&s,5); + parse(row); + } + +template <> const char * const db_table::table_name="meta_candidate"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=32; +template <> const char * const db_table::column_names[32]={"id","version","time_last_updated","num_spikes","num_spike_b_multiplets","best_spike_b_mp_score","num_spike_nb_multiplets","best_spike_nb_mp_score","spike_high_id","num_gaussians","num_gaussian_b_multiplets","best_gaussian_b_mp_score","num_gaussian_nb_multiplets","best_gaussian_nb_mp_score","gaussian_high_id","num_pulses","num_pulse_b_multiplets","best_pulse_b_mp_score","num_pulse_nb_multiplets","best_pulse_nb_mp_score","pulse_high_id","num_triplets","num_triplet_b_multiplets","best_triplet_b_mp_score","num_triplet_nb_multiplets","best_triplet_nb_mp_score","triplet_high_id","num_stars","best_star_score","meta_score","rfi_clean","state"}; + +meta_candidate::meta_candidate() : + db_table(*this,-1), + id(0), + version(0), + time_last_updated(0), + num_spikes(0), + num_spike_b_multiplets(0), + best_spike_b_mp_score(0), + num_spike_nb_multiplets(0), + best_spike_nb_mp_score(0), + spike_high_id(0), + num_gaussians(0), + num_gaussian_b_multiplets(0), + best_gaussian_b_mp_score(0), + num_gaussian_nb_multiplets(0), + best_gaussian_nb_mp_score(0), + gaussian_high_id(0), + num_pulses(0), + num_pulse_b_multiplets(0), + best_pulse_b_mp_score(0), + num_pulse_nb_multiplets(0), + best_pulse_nb_mp_score(0), + pulse_high_id(0), + num_triplets(0), + num_triplet_b_multiplets(0), + best_triplet_b_mp_score(0), + num_triplet_nb_multiplets(0), + best_triplet_nb_mp_score(0), + triplet_high_id(0), + num_stars(0), + best_star_score(0), + meta_score(0), + rfi_clean(0), + state(0) +{ + db_open(); +} + + +meta_candidate::meta_candidate(const meta_candidate &a) : + db_table(*this,-1), + id(a.id), + version(a.version), + time_last_updated(a.time_last_updated), + num_spikes(a.num_spikes), + num_spike_b_multiplets(a.num_spike_b_multiplets), + best_spike_b_mp_score(a.best_spike_b_mp_score), + num_spike_nb_multiplets(a.num_spike_nb_multiplets), + best_spike_nb_mp_score(a.best_spike_nb_mp_score), + spike_high_id(a.spike_high_id), + num_gaussians(a.num_gaussians), + num_gaussian_b_multiplets(a.num_gaussian_b_multiplets), + best_gaussian_b_mp_score(a.best_gaussian_b_mp_score), + num_gaussian_nb_multiplets(a.num_gaussian_nb_multiplets), + best_gaussian_nb_mp_score(a.best_gaussian_nb_mp_score), + gaussian_high_id(a.gaussian_high_id), + num_pulses(a.num_pulses), + num_pulse_b_multiplets(a.num_pulse_b_multiplets), + best_pulse_b_mp_score(a.best_pulse_b_mp_score), + num_pulse_nb_multiplets(a.num_pulse_nb_multiplets), + best_pulse_nb_mp_score(a.best_pulse_nb_mp_score), + pulse_high_id(a.pulse_high_id), + num_triplets(a.num_triplets), + num_triplet_b_multiplets(a.num_triplet_b_multiplets), + best_triplet_b_mp_score(a.best_triplet_b_mp_score), + num_triplet_nb_multiplets(a.num_triplet_nb_multiplets), + best_triplet_nb_mp_score(a.best_triplet_nb_mp_score), + triplet_high_id(a.triplet_high_id), + num_stars(a.num_stars), + best_star_score(a.best_star_score), + meta_score(a.meta_score), + rfi_clean(a.rfi_clean), + state(a.state) +{ + db_open(); +} + + +meta_candidate::meta_candidate(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +meta_candidate::meta_candidate(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +meta_candidate &meta_candidate::operator =(const meta_candidate &a) { + if (&a != this) { + id=a.id; + version=a.version; + time_last_updated=a.time_last_updated; + num_spikes=a.num_spikes; + num_spike_b_multiplets=a.num_spike_b_multiplets; + best_spike_b_mp_score=a.best_spike_b_mp_score; + num_spike_nb_multiplets=a.num_spike_nb_multiplets; + best_spike_nb_mp_score=a.best_spike_nb_mp_score; + spike_high_id=a.spike_high_id; + num_gaussians=a.num_gaussians; + num_gaussian_b_multiplets=a.num_gaussian_b_multiplets; + best_gaussian_b_mp_score=a.best_gaussian_b_mp_score; + num_gaussian_nb_multiplets=a.num_gaussian_nb_multiplets; + best_gaussian_nb_mp_score=a.best_gaussian_nb_mp_score; + gaussian_high_id=a.gaussian_high_id; + num_pulses=a.num_pulses; + num_pulse_b_multiplets=a.num_pulse_b_multiplets; + best_pulse_b_mp_score=a.best_pulse_b_mp_score; + num_pulse_nb_multiplets=a.num_pulse_nb_multiplets; + best_pulse_nb_mp_score=a.best_pulse_nb_mp_score; + pulse_high_id=a.pulse_high_id; + num_triplets=a.num_triplets; + num_triplet_b_multiplets=a.num_triplet_b_multiplets; + best_triplet_b_mp_score=a.best_triplet_b_mp_score; + num_triplet_nb_multiplets=a.num_triplet_nb_multiplets; + best_triplet_nb_mp_score=a.best_triplet_nb_mp_score; + triplet_high_id=a.triplet_high_id; + num_stars=a.num_stars; + best_star_score=a.best_star_score; + meta_score=a.meta_score; + rfi_clean=a.rfi_clean; + state=a.state; + } + return (*this); +} + + +std::string meta_candidate::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<32;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string meta_candidate::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string meta_candidate::select_format() const +{ +std::string rv(""); +for (int i=0; i<31;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string meta_candidate::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << version; + rv << ','; + rv << time_last_updated; + rv << ','; + rv << num_spikes; + rv << ','; + rv << num_spike_b_multiplets; + rv << ','; + rv << best_spike_b_mp_score; + rv << ','; + rv << num_spike_nb_multiplets; + rv << ','; + rv << best_spike_nb_mp_score; + rv << ','; + rv << spike_high_id; + rv << ','; + rv << num_gaussians; + rv << ','; + rv << num_gaussian_b_multiplets; + rv << ','; + rv << best_gaussian_b_mp_score; + rv << ','; + rv << num_gaussian_nb_multiplets; + rv << ','; + rv << best_gaussian_nb_mp_score; + rv << ','; + rv << gaussian_high_id; + rv << ','; + rv << num_pulses; + rv << ','; + rv << num_pulse_b_multiplets; + rv << ','; + rv << best_pulse_b_mp_score; + rv << ','; + rv << num_pulse_nb_multiplets; + rv << ','; + rv << best_pulse_nb_mp_score; + rv << ','; + rv << pulse_high_id; + rv << ','; + rv << num_triplets; + rv << ','; + rv << num_triplet_b_multiplets; + rv << ','; + rv << best_triplet_b_mp_score; + rv << ','; + rv << num_triplet_nb_multiplets; + rv << ','; + rv << best_triplet_nb_mp_score; + rv << ','; + rv << triplet_high_id; + rv << ','; + rv << num_stars; + rv << ','; + rv << best_star_score; + rv << ','; + rv << meta_score; + rv << ','; + rv << rfi_clean; + rv << ','; + rv << state; + return rv.str(); +} + + +std::string meta_candidate::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << version << "\n"; + rv << xml_indent() << "" << time_last_updated << "\n"; + rv << xml_indent() << "" << num_spikes << "\n"; + rv << xml_indent() << "" << num_spike_b_multiplets << "\n"; + rv << xml_indent() << "" << best_spike_b_mp_score << "\n"; + rv << xml_indent() << "" << num_spike_nb_multiplets << "\n"; + rv << xml_indent() << "" << best_spike_nb_mp_score << "\n"; + rv << xml_indent() << "" << spike_high_id << "\n"; + rv << xml_indent() << "" << num_gaussians << "\n"; + rv << xml_indent() << "" << num_gaussian_b_multiplets << "\n"; + rv << xml_indent() << "" << best_gaussian_b_mp_score << "\n"; + rv << xml_indent() << "" << num_gaussian_nb_multiplets << "\n"; + rv << xml_indent() << "" << best_gaussian_nb_mp_score << "\n"; + rv << xml_indent() << "" << gaussian_high_id << "\n"; + rv << xml_indent() << "" << num_pulses << "\n"; + rv << xml_indent() << "" << num_pulse_b_multiplets << "\n"; + rv << xml_indent() << "" << best_pulse_b_mp_score << "\n"; + rv << xml_indent() << "" << num_pulse_nb_multiplets << "\n"; + rv << xml_indent() << "" << best_pulse_nb_mp_score << "\n"; + rv << xml_indent() << "" << pulse_high_id << "\n"; + rv << xml_indent() << "" << num_triplets << "\n"; + rv << xml_indent() << "" << num_triplet_b_multiplets << "\n"; + rv << xml_indent() << "" << best_triplet_b_mp_score << "\n"; + rv << xml_indent() << "" << num_triplet_nb_multiplets << "\n"; + rv << xml_indent() << "" << best_triplet_nb_mp_score << "\n"; + rv << xml_indent() << "" << triplet_high_id << "\n"; + rv << xml_indent() << "" << num_stars << "\n"; + rv << xml_indent() << "" << best_star_score << "\n"; + rv << xml_indent() << "" << meta_score << "\n"; + rv << xml_indent() << "" << rfi_clean << "\n"; + rv << xml_indent() << "" << state << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void meta_candidate::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"version",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> version; + } + if (extract_xml_record(field,"time_last_updated",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time_last_updated; + } + if (extract_xml_record(field,"num_spikes",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_spikes; + } + if (extract_xml_record(field,"num_spike_b_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_spike_b_multiplets; + } + if (extract_xml_record(field,"best_spike_b_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_spike_b_mp_score; + } + if (extract_xml_record(field,"num_spike_nb_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_spike_nb_multiplets; + } + if (extract_xml_record(field,"best_spike_nb_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_spike_nb_mp_score; + } + if (extract_xml_record(field,"spike_high_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spike_high_id; + } + if (extract_xml_record(field,"num_gaussians",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_gaussians; + } + if (extract_xml_record(field,"num_gaussian_b_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_gaussian_b_multiplets; + } + if (extract_xml_record(field,"best_gaussian_b_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_gaussian_b_mp_score; + } + if (extract_xml_record(field,"num_gaussian_nb_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_gaussian_nb_multiplets; + } + if (extract_xml_record(field,"best_gaussian_nb_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_gaussian_nb_mp_score; + } + if (extract_xml_record(field,"gaussian_high_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gaussian_high_id; + } + if (extract_xml_record(field,"num_pulses",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_pulses; + } + if (extract_xml_record(field,"num_pulse_b_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_pulse_b_multiplets; + } + if (extract_xml_record(field,"best_pulse_b_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_pulse_b_mp_score; + } + if (extract_xml_record(field,"num_pulse_nb_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_pulse_nb_multiplets; + } + if (extract_xml_record(field,"best_pulse_nb_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_pulse_nb_mp_score; + } + if (extract_xml_record(field,"pulse_high_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_high_id; + } + if (extract_xml_record(field,"num_triplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_triplets; + } + if (extract_xml_record(field,"num_triplet_b_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_triplet_b_multiplets; + } + if (extract_xml_record(field,"best_triplet_b_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_triplet_b_mp_score; + } + if (extract_xml_record(field,"num_triplet_nb_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_triplet_nb_multiplets; + } + if (extract_xml_record(field,"best_triplet_nb_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_triplet_nb_mp_score; + } + if (extract_xml_record(field,"triplet_high_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_high_id; + } + if (extract_xml_record(field,"num_stars",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_stars; + } + if (extract_xml_record(field,"best_star_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_star_score; + } + if (extract_xml_record(field,"meta_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> meta_score; + } + if (extract_xml_record(field,"rfi_clean",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_clean; + } + if (extract_xml_record(field,"state",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> state; + } + } + } + + void meta_candidate::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> version; + } + { + std::istringstream row(*(s[2])); + row >> time_last_updated; + } + { + std::istringstream row(*(s[3])); + row >> num_spikes; + } + { + std::istringstream row(*(s[4])); + row >> num_spike_b_multiplets; + } + { + std::istringstream row(*(s[5])); + row >> best_spike_b_mp_score; + } + { + std::istringstream row(*(s[6])); + row >> num_spike_nb_multiplets; + } + { + std::istringstream row(*(s[7])); + row >> best_spike_nb_mp_score; + } + { + std::istringstream row(*(s[8])); + row >> spike_high_id; + } + { + std::istringstream row(*(s[9])); + row >> num_gaussians; + } + { + std::istringstream row(*(s[10])); + row >> num_gaussian_b_multiplets; + } + { + std::istringstream row(*(s[11])); + row >> best_gaussian_b_mp_score; + } + { + std::istringstream row(*(s[12])); + row >> num_gaussian_nb_multiplets; + } + { + std::istringstream row(*(s[13])); + row >> best_gaussian_nb_mp_score; + } + { + std::istringstream row(*(s[14])); + row >> gaussian_high_id; + } + { + std::istringstream row(*(s[15])); + row >> num_pulses; + } + { + std::istringstream row(*(s[16])); + row >> num_pulse_b_multiplets; + } + { + std::istringstream row(*(s[17])); + row >> best_pulse_b_mp_score; + } + { + std::istringstream row(*(s[18])); + row >> num_pulse_nb_multiplets; + } + { + std::istringstream row(*(s[19])); + row >> best_pulse_nb_mp_score; + } + { + std::istringstream row(*(s[20])); + row >> pulse_high_id; + } + { + std::istringstream row(*(s[21])); + row >> num_triplets; + } + { + std::istringstream row(*(s[22])); + row >> num_triplet_b_multiplets; + } + { + std::istringstream row(*(s[23])); + row >> best_triplet_b_mp_score; + } + { + std::istringstream row(*(s[24])); + row >> num_triplet_nb_multiplets; + } + { + std::istringstream row(*(s[25])); + row >> best_triplet_nb_mp_score; + } + { + std::istringstream row(*(s[26])); + row >> triplet_high_id; + } + { + std::istringstream row(*(s[27])); + row >> num_stars; + } + { + std::istringstream row(*(s[28])); + row >> best_star_score; + } + { + std::istringstream row(*(s[29])); + row >> meta_score; + } + { + std::istringstream row(*(s[30])); + row >> rfi_clean; + } + { + std::istringstream row(*(s[31])); + row >> state; + } + } + + void meta_candidate::parse(const std::string &s) { + SQL_ROW row(&s,32); + parse(row); + } + +template <> const char * const db_table::table_name="meta_candidate_tinysky"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=32; +template <> const char * const db_table::column_names[32]={"id","version","time_last_updated","num_spikes","num_spike_b_multiplets","best_spike_b_mp_score","num_spike_nb_multiplets","best_spike_nb_mp_score","spike_high_id","num_gaussians","num_gaussian_b_multiplets","best_gaussian_b_mp_score","num_gaussian_nb_multiplets","best_gaussian_nb_mp_score","gaussian_high_id","num_pulses","num_pulse_b_multiplets","best_pulse_b_mp_score","num_pulse_nb_multiplets","best_pulse_nb_mp_score","pulse_high_id","num_triplets","num_triplet_b_multiplets","best_triplet_b_mp_score","num_triplet_nb_multiplets","best_triplet_nb_mp_score","triplet_high_id","num_stars","best_star_score","meta_score","rfi_clean","state"}; + +meta_candidate_tinysky::meta_candidate_tinysky() : + db_table(*this,-1), + id(0), + version(0), + time_last_updated(0), + num_spikes(0), + num_spike_b_multiplets(0), + best_spike_b_mp_score(0), + num_spike_nb_multiplets(0), + best_spike_nb_mp_score(0), + spike_high_id(0), + num_gaussians(0), + num_gaussian_b_multiplets(0), + best_gaussian_b_mp_score(0), + num_gaussian_nb_multiplets(0), + best_gaussian_nb_mp_score(0), + gaussian_high_id(0), + num_pulses(0), + num_pulse_b_multiplets(0), + best_pulse_b_mp_score(0), + num_pulse_nb_multiplets(0), + best_pulse_nb_mp_score(0), + pulse_high_id(0), + num_triplets(0), + num_triplet_b_multiplets(0), + best_triplet_b_mp_score(0), + num_triplet_nb_multiplets(0), + best_triplet_nb_mp_score(0), + triplet_high_id(0), + num_stars(0), + best_star_score(0), + meta_score(0), + rfi_clean(0), + state(0) +{ + db_open(); +} + + +meta_candidate_tinysky::meta_candidate_tinysky(const meta_candidate_tinysky &a) : + db_table(*this,-1), + id(a.id), + version(a.version), + time_last_updated(a.time_last_updated), + num_spikes(a.num_spikes), + num_spike_b_multiplets(a.num_spike_b_multiplets), + best_spike_b_mp_score(a.best_spike_b_mp_score), + num_spike_nb_multiplets(a.num_spike_nb_multiplets), + best_spike_nb_mp_score(a.best_spike_nb_mp_score), + spike_high_id(a.spike_high_id), + num_gaussians(a.num_gaussians), + num_gaussian_b_multiplets(a.num_gaussian_b_multiplets), + best_gaussian_b_mp_score(a.best_gaussian_b_mp_score), + num_gaussian_nb_multiplets(a.num_gaussian_nb_multiplets), + best_gaussian_nb_mp_score(a.best_gaussian_nb_mp_score), + gaussian_high_id(a.gaussian_high_id), + num_pulses(a.num_pulses), + num_pulse_b_multiplets(a.num_pulse_b_multiplets), + best_pulse_b_mp_score(a.best_pulse_b_mp_score), + num_pulse_nb_multiplets(a.num_pulse_nb_multiplets), + best_pulse_nb_mp_score(a.best_pulse_nb_mp_score), + pulse_high_id(a.pulse_high_id), + num_triplets(a.num_triplets), + num_triplet_b_multiplets(a.num_triplet_b_multiplets), + best_triplet_b_mp_score(a.best_triplet_b_mp_score), + num_triplet_nb_multiplets(a.num_triplet_nb_multiplets), + best_triplet_nb_mp_score(a.best_triplet_nb_mp_score), + triplet_high_id(a.triplet_high_id), + num_stars(a.num_stars), + best_star_score(a.best_star_score), + meta_score(a.meta_score), + rfi_clean(a.rfi_clean), + state(a.state) +{ + db_open(); +} + + +meta_candidate_tinysky::meta_candidate_tinysky(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +meta_candidate_tinysky::meta_candidate_tinysky(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +meta_candidate_tinysky &meta_candidate_tinysky::operator =(const meta_candidate_tinysky &a) { + if (&a != this) { + id=a.id; + version=a.version; + time_last_updated=a.time_last_updated; + num_spikes=a.num_spikes; + num_spike_b_multiplets=a.num_spike_b_multiplets; + best_spike_b_mp_score=a.best_spike_b_mp_score; + num_spike_nb_multiplets=a.num_spike_nb_multiplets; + best_spike_nb_mp_score=a.best_spike_nb_mp_score; + spike_high_id=a.spike_high_id; + num_gaussians=a.num_gaussians; + num_gaussian_b_multiplets=a.num_gaussian_b_multiplets; + best_gaussian_b_mp_score=a.best_gaussian_b_mp_score; + num_gaussian_nb_multiplets=a.num_gaussian_nb_multiplets; + best_gaussian_nb_mp_score=a.best_gaussian_nb_mp_score; + gaussian_high_id=a.gaussian_high_id; + num_pulses=a.num_pulses; + num_pulse_b_multiplets=a.num_pulse_b_multiplets; + best_pulse_b_mp_score=a.best_pulse_b_mp_score; + num_pulse_nb_multiplets=a.num_pulse_nb_multiplets; + best_pulse_nb_mp_score=a.best_pulse_nb_mp_score; + pulse_high_id=a.pulse_high_id; + num_triplets=a.num_triplets; + num_triplet_b_multiplets=a.num_triplet_b_multiplets; + best_triplet_b_mp_score=a.best_triplet_b_mp_score; + num_triplet_nb_multiplets=a.num_triplet_nb_multiplets; + best_triplet_nb_mp_score=a.best_triplet_nb_mp_score; + triplet_high_id=a.triplet_high_id; + num_stars=a.num_stars; + best_star_score=a.best_star_score; + meta_score=a.meta_score; + rfi_clean=a.rfi_clean; + state=a.state; + } + return (*this); +} + + +std::string meta_candidate_tinysky::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<32;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string meta_candidate_tinysky::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string meta_candidate_tinysky::select_format() const +{ +std::string rv(""); +for (int i=0; i<31;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string meta_candidate_tinysky::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << version; + rv << ','; + rv << time_last_updated; + rv << ','; + rv << num_spikes; + rv << ','; + rv << num_spike_b_multiplets; + rv << ','; + rv << best_spike_b_mp_score; + rv << ','; + rv << num_spike_nb_multiplets; + rv << ','; + rv << best_spike_nb_mp_score; + rv << ','; + rv << spike_high_id; + rv << ','; + rv << num_gaussians; + rv << ','; + rv << num_gaussian_b_multiplets; + rv << ','; + rv << best_gaussian_b_mp_score; + rv << ','; + rv << num_gaussian_nb_multiplets; + rv << ','; + rv << best_gaussian_nb_mp_score; + rv << ','; + rv << gaussian_high_id; + rv << ','; + rv << num_pulses; + rv << ','; + rv << num_pulse_b_multiplets; + rv << ','; + rv << best_pulse_b_mp_score; + rv << ','; + rv << num_pulse_nb_multiplets; + rv << ','; + rv << best_pulse_nb_mp_score; + rv << ','; + rv << pulse_high_id; + rv << ','; + rv << num_triplets; + rv << ','; + rv << num_triplet_b_multiplets; + rv << ','; + rv << best_triplet_b_mp_score; + rv << ','; + rv << num_triplet_nb_multiplets; + rv << ','; + rv << best_triplet_nb_mp_score; + rv << ','; + rv << triplet_high_id; + rv << ','; + rv << num_stars; + rv << ','; + rv << best_star_score; + rv << ','; + rv << meta_score; + rv << ','; + rv << rfi_clean; + rv << ','; + rv << state; + return rv.str(); +} + + +std::string meta_candidate_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << version << "\n"; + rv << xml_indent() << "" << time_last_updated << "\n"; + rv << xml_indent() << "" << num_spikes << "\n"; + rv << xml_indent() << "" << num_spike_b_multiplets << "\n"; + rv << xml_indent() << "" << best_spike_b_mp_score << "\n"; + rv << xml_indent() << "" << num_spike_nb_multiplets << "\n"; + rv << xml_indent() << "" << best_spike_nb_mp_score << "\n"; + rv << xml_indent() << "" << spike_high_id << "\n"; + rv << xml_indent() << "" << num_gaussians << "\n"; + rv << xml_indent() << "" << num_gaussian_b_multiplets << "\n"; + rv << xml_indent() << "" << best_gaussian_b_mp_score << "\n"; + rv << xml_indent() << "" << num_gaussian_nb_multiplets << "\n"; + rv << xml_indent() << "" << best_gaussian_nb_mp_score << "\n"; + rv << xml_indent() << "" << gaussian_high_id << "\n"; + rv << xml_indent() << "" << num_pulses << "\n"; + rv << xml_indent() << "" << num_pulse_b_multiplets << "\n"; + rv << xml_indent() << "" << best_pulse_b_mp_score << "\n"; + rv << xml_indent() << "" << num_pulse_nb_multiplets << "\n"; + rv << xml_indent() << "" << best_pulse_nb_mp_score << "\n"; + rv << xml_indent() << "" << pulse_high_id << "\n"; + rv << xml_indent() << "" << num_triplets << "\n"; + rv << xml_indent() << "" << num_triplet_b_multiplets << "\n"; + rv << xml_indent() << "" << best_triplet_b_mp_score << "\n"; + rv << xml_indent() << "" << num_triplet_nb_multiplets << "\n"; + rv << xml_indent() << "" << best_triplet_nb_mp_score << "\n"; + rv << xml_indent() << "" << triplet_high_id << "\n"; + rv << xml_indent() << "" << num_stars << "\n"; + rv << xml_indent() << "" << best_star_score << "\n"; + rv << xml_indent() << "" << meta_score << "\n"; + rv << xml_indent() << "" << rfi_clean << "\n"; + rv << xml_indent() << "" << state << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void meta_candidate_tinysky::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"version",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> version; + } + if (extract_xml_record(field,"time_last_updated",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time_last_updated; + } + if (extract_xml_record(field,"num_spikes",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_spikes; + } + if (extract_xml_record(field,"num_spike_b_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_spike_b_multiplets; + } + if (extract_xml_record(field,"best_spike_b_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_spike_b_mp_score; + } + if (extract_xml_record(field,"num_spike_nb_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_spike_nb_multiplets; + } + if (extract_xml_record(field,"best_spike_nb_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_spike_nb_mp_score; + } + if (extract_xml_record(field,"spike_high_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spike_high_id; + } + if (extract_xml_record(field,"num_gaussians",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_gaussians; + } + if (extract_xml_record(field,"num_gaussian_b_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_gaussian_b_multiplets; + } + if (extract_xml_record(field,"best_gaussian_b_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_gaussian_b_mp_score; + } + if (extract_xml_record(field,"num_gaussian_nb_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_gaussian_nb_multiplets; + } + if (extract_xml_record(field,"best_gaussian_nb_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_gaussian_nb_mp_score; + } + if (extract_xml_record(field,"gaussian_high_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gaussian_high_id; + } + if (extract_xml_record(field,"num_pulses",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_pulses; + } + if (extract_xml_record(field,"num_pulse_b_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_pulse_b_multiplets; + } + if (extract_xml_record(field,"best_pulse_b_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_pulse_b_mp_score; + } + if (extract_xml_record(field,"num_pulse_nb_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_pulse_nb_multiplets; + } + if (extract_xml_record(field,"best_pulse_nb_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_pulse_nb_mp_score; + } + if (extract_xml_record(field,"pulse_high_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_high_id; + } + if (extract_xml_record(field,"num_triplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_triplets; + } + if (extract_xml_record(field,"num_triplet_b_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_triplet_b_multiplets; + } + if (extract_xml_record(field,"best_triplet_b_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_triplet_b_mp_score; + } + if (extract_xml_record(field,"num_triplet_nb_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_triplet_nb_multiplets; + } + if (extract_xml_record(field,"best_triplet_nb_mp_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_triplet_nb_mp_score; + } + if (extract_xml_record(field,"triplet_high_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_high_id; + } + if (extract_xml_record(field,"num_stars",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_stars; + } + if (extract_xml_record(field,"best_star_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> best_star_score; + } + if (extract_xml_record(field,"meta_score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> meta_score; + } + if (extract_xml_record(field,"rfi_clean",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_clean; + } + if (extract_xml_record(field,"state",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> state; + } + } + } + + void meta_candidate_tinysky::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> version; + } + { + std::istringstream row(*(s[2])); + row >> time_last_updated; + } + { + std::istringstream row(*(s[3])); + row >> num_spikes; + } + { + std::istringstream row(*(s[4])); + row >> num_spike_b_multiplets; + } + { + std::istringstream row(*(s[5])); + row >> best_spike_b_mp_score; + } + { + std::istringstream row(*(s[6])); + row >> num_spike_nb_multiplets; + } + { + std::istringstream row(*(s[7])); + row >> best_spike_nb_mp_score; + } + { + std::istringstream row(*(s[8])); + row >> spike_high_id; + } + { + std::istringstream row(*(s[9])); + row >> num_gaussians; + } + { + std::istringstream row(*(s[10])); + row >> num_gaussian_b_multiplets; + } + { + std::istringstream row(*(s[11])); + row >> best_gaussian_b_mp_score; + } + { + std::istringstream row(*(s[12])); + row >> num_gaussian_nb_multiplets; + } + { + std::istringstream row(*(s[13])); + row >> best_gaussian_nb_mp_score; + } + { + std::istringstream row(*(s[14])); + row >> gaussian_high_id; + } + { + std::istringstream row(*(s[15])); + row >> num_pulses; + } + { + std::istringstream row(*(s[16])); + row >> num_pulse_b_multiplets; + } + { + std::istringstream row(*(s[17])); + row >> best_pulse_b_mp_score; + } + { + std::istringstream row(*(s[18])); + row >> num_pulse_nb_multiplets; + } + { + std::istringstream row(*(s[19])); + row >> best_pulse_nb_mp_score; + } + { + std::istringstream row(*(s[20])); + row >> pulse_high_id; + } + { + std::istringstream row(*(s[21])); + row >> num_triplets; + } + { + std::istringstream row(*(s[22])); + row >> num_triplet_b_multiplets; + } + { + std::istringstream row(*(s[23])); + row >> best_triplet_b_mp_score; + } + { + std::istringstream row(*(s[24])); + row >> num_triplet_nb_multiplets; + } + { + std::istringstream row(*(s[25])); + row >> best_triplet_nb_mp_score; + } + { + std::istringstream row(*(s[26])); + row >> triplet_high_id; + } + { + std::istringstream row(*(s[27])); + row >> num_stars; + } + { + std::istringstream row(*(s[28])); + row >> best_star_score; + } + { + std::istringstream row(*(s[29])); + row >> meta_score; + } + { + std::istringstream row(*(s[30])); + row >> rfi_clean; + } + { + std::istringstream row(*(s[31])); + row >> state; + } + } + + void meta_candidate_tinysky::parse(const std::string &s) { + SQL_ROW row(&s,32); + parse(row); + } + +template <> const char * const db_table::table_name="multiplet"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=25; +template <> const char * const db_table::column_names[25]={"id","version","signal_type","mp_type","qpix","freq_win","mean_ra","mean_decl","ra_stddev","decl_stddev","mean_angular_distance","angular_distance_stddev","mean_frequency","frequency_stddev","mean_chirp","chirp_stddev","mean_period","period_stddev","mean_snr","snr_stddev","mean_threshold","threshold_stddev","score","num_detections","signal_ids"}; + +multiplet::multiplet() : + db_table(*this,-1), + id(0), + version(0), + signal_type(0), + mp_type(0), + qpix(0), + freq_win(0), + mean_ra(0), + mean_decl(0), + ra_stddev(0), + decl_stddev(0), + mean_angular_distance(0), + angular_distance_stddev(0), + mean_frequency(0), + frequency_stddev(0), + mean_chirp(0), + chirp_stddev(0), + mean_period(0), + period_stddev(0), + mean_snr(0), + snr_stddev(0), + mean_threshold(0), + threshold_stddev(0), + score(0), + num_detections(0), + signal_ids((sqlint8_t *)0,0,_x_csv) +{ + db_open(); +} + + +multiplet::multiplet(const multiplet &a) : + db_table(*this,-1), + id(a.id), + version(a.version), + signal_type(a.signal_type), + mp_type(a.mp_type), + qpix(a.qpix), + freq_win(a.freq_win), + mean_ra(a.mean_ra), + mean_decl(a.mean_decl), + ra_stddev(a.ra_stddev), + decl_stddev(a.decl_stddev), + mean_angular_distance(a.mean_angular_distance), + angular_distance_stddev(a.angular_distance_stddev), + mean_frequency(a.mean_frequency), + frequency_stddev(a.frequency_stddev), + mean_chirp(a.mean_chirp), + chirp_stddev(a.chirp_stddev), + mean_period(a.mean_period), + period_stddev(a.period_stddev), + mean_snr(a.mean_snr), + snr_stddev(a.snr_stddev), + mean_threshold(a.mean_threshold), + threshold_stddev(a.threshold_stddev), + score(a.score), + num_detections(a.num_detections), + signal_ids(a.signal_ids) +{ + db_open(); +} + + +multiplet::multiplet(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +multiplet::multiplet(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +multiplet &multiplet::operator =(const multiplet &a) { + if (&a != this) { + id=a.id; + version=a.version; + signal_type=a.signal_type; + mp_type=a.mp_type; + qpix=a.qpix; + freq_win=a.freq_win; + mean_ra=a.mean_ra; + mean_decl=a.mean_decl; + ra_stddev=a.ra_stddev; + decl_stddev=a.decl_stddev; + mean_angular_distance=a.mean_angular_distance; + angular_distance_stddev=a.angular_distance_stddev; + mean_frequency=a.mean_frequency; + frequency_stddev=a.frequency_stddev; + mean_chirp=a.mean_chirp; + chirp_stddev=a.chirp_stddev; + mean_period=a.mean_period; + period_stddev=a.period_stddev; + mean_snr=a.mean_snr; + snr_stddev=a.snr_stddev; + mean_threshold=a.mean_threshold; + threshold_stddev=a.threshold_stddev; + score=a.score; + num_detections=a.num_detections; + { + signal_ids.clear(); + std::vector::const_iterator i(a.signal_ids.begin()); + for (;i!=a.signal_ids.end();i++) { + signal_ids.push_back(*i); + } + } + } + return (*this); +} + + +std::string multiplet::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<25;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string multiplet::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string multiplet::select_format() const +{ +std::string rv(""); +for (int i=0; i<24;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string multiplet::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << version; + rv << ','; + rv << signal_type; + rv << ','; + rv << mp_type; + rv << ','; + rv << qpix; + rv << ','; + rv << freq_win; + rv << ','; + rv << mean_ra; + rv << ','; + rv << mean_decl; + rv << ','; + rv << ra_stddev; + rv << ','; + rv << decl_stddev; + rv << ','; + rv << mean_angular_distance; + rv << ','; + rv << angular_distance_stddev; + rv << ','; + rv << mean_frequency; + rv << ','; + rv << frequency_stddev; + rv << ','; + rv << mean_chirp; + rv << ','; + rv << chirp_stddev; + rv << ','; + rv << mean_period; + rv << ','; + rv << period_stddev; + rv << ','; + rv << mean_snr; + rv << ','; + rv << snr_stddev; + rv << ','; + rv << mean_threshold; + rv << ','; + rv << threshold_stddev; + rv << ','; + rv << score; + rv << ','; + rv << num_detections; + rv << ','; + rv << "LIST {"; + { + std::vector::const_iterator p=signal_ids.begin(); + for (;p\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << version << "\n"; + rv << xml_indent() << "" << signal_type << "\n"; + rv << xml_indent() << "" << mp_type << "\n"; + rv << xml_indent() << "" << qpix << "\n"; + rv << xml_indent() << "" << freq_win << "\n"; + rv << xml_indent() << "" << mean_ra << "\n"; + rv << xml_indent() << "" << mean_decl << "\n"; + rv << xml_indent() << "" << ra_stddev << "\n"; + rv << xml_indent() << "" << decl_stddev << "\n"; + rv << xml_indent() << "" << mean_angular_distance << "\n"; + rv << xml_indent() << "" << angular_distance_stddev << "\n"; + rv << xml_indent() << "" << mean_frequency << "\n"; + rv << xml_indent() << "" << frequency_stddev << "\n"; + rv << xml_indent() << "" << mean_chirp << "\n"; + rv << xml_indent() << "" << chirp_stddev << "\n"; + rv << xml_indent() << "" << mean_period << "\n"; + rv << xml_indent() << "" << period_stddev << "\n"; + rv << xml_indent() << "" << mean_snr << "\n"; + rv << xml_indent() << "" << snr_stddev << "\n"; + rv << xml_indent() << "" << mean_threshold << "\n"; + rv << xml_indent() << "" << threshold_stddev << "\n"; + rv << xml_indent() << "" << score << "\n"; + rv << xml_indent() << "" << num_detections << "\n"; + if (signal_ids.size()) { + rv << xml_indent() << "" ; + rv << enc_string; + } +} + rv << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void multiplet::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"version",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> version; + } + if (extract_xml_record(field,"signal_type",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> signal_type; + } + if (extract_xml_record(field,"mp_type",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mp_type; + } + if (extract_xml_record(field,"qpix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> qpix; + } + if (extract_xml_record(field,"freq_win",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq_win; + } + if (extract_xml_record(field,"mean_ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_ra; + } + if (extract_xml_record(field,"mean_decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_decl; + } + if (extract_xml_record(field,"ra_stddev",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra_stddev; + } + if (extract_xml_record(field,"decl_stddev",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl_stddev; + } + if (extract_xml_record(field,"mean_angular_distance",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_angular_distance; + } + if (extract_xml_record(field,"angular_distance_stddev",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> angular_distance_stddev; + } + if (extract_xml_record(field,"mean_frequency",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_frequency; + } + if (extract_xml_record(field,"frequency_stddev",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> frequency_stddev; + } + if (extract_xml_record(field,"mean_chirp",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_chirp; + } + if (extract_xml_record(field,"chirp_stddev",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_stddev; + } + if (extract_xml_record(field,"mean_period",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_period; + } + if (extract_xml_record(field,"period_stddev",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> period_stddev; + } + if (extract_xml_record(field,"mean_snr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_snr; + } + if (extract_xml_record(field,"snr_stddev",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> snr_stddev; + } + if (extract_xml_record(field,"mean_threshold",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_threshold; + } + if (extract_xml_record(field,"threshold_stddev",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> threshold_stddev; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + if (extract_xml_record(field,"num_detections",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> num_detections; + } + signal_ids.clear(); + if (extract_xml_record(field,"signal_ids",sub)) { + pos=sub.find(">"); + do { + if (pos!=std::string::npos) { + do { pos++; } while ((sub[pos]=='\n') || (sub[pos]==',')); + std::istringstream in(std::string(sub.c_str()+pos)); + sqlint8_t tmp; + in >> tmp; + signal_ids.push_back(tmp); + } + } while ((pos=sub.find(",",pos)) != std::string::npos); + } + } + } + + void multiplet::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> version; + } + { + std::istringstream row(*(s[2])); + row >> signal_type; + } + { + std::istringstream row(*(s[3])); + row >> mp_type; + } + { + std::istringstream row(*(s[4])); + row >> qpix; + } + { + std::istringstream row(*(s[5])); + row >> freq_win; + } + { + std::istringstream row(*(s[6])); + row >> mean_ra; + } + { + std::istringstream row(*(s[7])); + row >> mean_decl; + } + { + std::istringstream row(*(s[8])); + row >> ra_stddev; + } + { + std::istringstream row(*(s[9])); + row >> decl_stddev; + } + { + std::istringstream row(*(s[10])); + row >> mean_angular_distance; + } + { + std::istringstream row(*(s[11])); + row >> angular_distance_stddev; + } + { + std::istringstream row(*(s[12])); + row >> mean_frequency; + } + { + std::istringstream row(*(s[13])); + row >> frequency_stddev; + } + { + std::istringstream row(*(s[14])); + row >> mean_chirp; + } + { + std::istringstream row(*(s[15])); + row >> chirp_stddev; + } + { + std::istringstream row(*(s[16])); + row >> mean_period; + } + { + std::istringstream row(*(s[17])); + row >> period_stddev; + } + { + std::istringstream row(*(s[18])); + row >> mean_snr; + } + { + std::istringstream row(*(s[19])); + row >> snr_stddev; + } + { + std::istringstream row(*(s[20])); + row >> mean_threshold; + } + { + std::istringstream row(*(s[21])); + row >> threshold_stddev; + } + { + std::istringstream row(*(s[22])); + row >> score; + } + { + std::istringstream row(*(s[23])); + row >> num_detections; + } + { + std::string::size_type p,q; + int i; + signal_ids.clear(); + SQL_ROW tmp(s[24]); + for (i=0;i> tmp0; + signal_ids.push_back(tmp0); + } + } + } + + void multiplet::parse(const std::string &s) { + SQL_ROW row(&s,25); + parse(row); + } + +template <> const char * const db_table::table_name="star"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=14; +template <> const char * const db_table::column_names[14]={"id","object_type","catalog_name","catalog_number","object_name","ra","decl","qpix","v_mag","b_minus_v","parallax","stellar_type","planets","score"}; + +star::star() : + db_table(*this,-1), + id(0), + catalog_number(0), + ra(0), + decl(0), + qpix(0), + v_mag(0), + b_minus_v(0), + parallax(0), + planets(0), + score(0) +{ + db_open(); + object_type[0]=0; + catalog_name[0]=0; + object_name[0]=0; + stellar_type[0]=0; +} + + +star::star(const star &a) : + db_table(*this,-1), + id(a.id), + catalog_number(a.catalog_number), + ra(a.ra), + decl(a.decl), + qpix(a.qpix), + v_mag(a.v_mag), + b_minus_v(a.b_minus_v), + parallax(a.parallax), + planets(a.planets), + score(a.score) +{ + db_open(); + strcpy(object_type,a.object_type); + strcpy(catalog_name,a.catalog_name); + strcpy(object_name,a.object_name); + strcpy(stellar_type,a.stellar_type); +} + + +star::star(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +star::star(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +star &star::operator =(const star &a) { + if (&a != this) { + id=a.id; + catalog_number=a.catalog_number; + ra=a.ra; + decl=a.decl; + qpix=a.qpix; + v_mag=a.v_mag; + b_minus_v=a.b_minus_v; + parallax=a.parallax; + planets=a.planets; + score=a.score; + strcpy(object_type,a.object_type); + strcpy(catalog_name,a.catalog_name); + strcpy(object_name,a.object_name); + strcpy(stellar_type,a.stellar_type); + } + return (*this); +} + + +std::string star::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<14;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string star::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string star::select_format() const +{ +std::string rv(""); +for (int i=0; i<13;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string star::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << "'" << object_type << "'"; + rv << ','; + rv << "'" << catalog_name << "'"; + rv << ','; + rv << catalog_number; + rv << ','; + rv << "'" << object_name << "'"; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << qpix; + rv << ','; + rv << v_mag; + rv << ','; + rv << b_minus_v; + rv << ','; + rv << parallax; + rv << ','; + rv << "'" << stellar_type << "'"; + rv << ','; + rv << planets; + rv << ','; + rv << score; + return rv.str(); +} + + +std::string star::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + { + std::string enc_field=xml_encode_string(object_type,std::min(strlen(object_type),sizeof(object_type))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + { + std::string enc_field=xml_encode_string(catalog_name,std::min(strlen(catalog_name),sizeof(catalog_name))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << catalog_number << "\n"; + { + std::string enc_field=xml_encode_string(object_name,std::min(strlen(object_name),sizeof(object_name))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << qpix << "\n"; + rv << xml_indent() << "" << v_mag << "\n"; + rv << xml_indent() << "" << b_minus_v << "\n"; + rv << xml_indent() << "" << parallax << "\n"; + { + std::string enc_field=xml_encode_string(stellar_type,std::min(strlen(stellar_type),sizeof(stellar_type))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << planets << "\n"; + rv << xml_indent() << "" << score << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void star::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"object_type",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(object_type,(const char *)&(in.front()),std::min(in.size(),(size_t)16)); + object_type[std::min(in.size(),(size_t)15)]=0; + } + if (extract_xml_record(field,"catalog_name",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(catalog_name,(const char *)&(in.front()),std::min(in.size(),(size_t)64)); + catalog_name[std::min(in.size(),(size_t)63)]=0; + } + if (extract_xml_record(field,"catalog_number",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> catalog_number; + } + if (extract_xml_record(field,"object_name",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(object_name,(const char *)&(in.front()),std::min(in.size(),(size_t)64)); + object_name[std::min(in.size(),(size_t)63)]=0; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"qpix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> qpix; + } + if (extract_xml_record(field,"v_mag",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> v_mag; + } + if (extract_xml_record(field,"b_minus_v",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> b_minus_v; + } + if (extract_xml_record(field,"parallax",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> parallax; + } + if (extract_xml_record(field,"stellar_type",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(stellar_type,(const char *)&(in.front()),std::min(in.size(),(size_t)32)); + stellar_type[std::min(in.size(),(size_t)31)]=0; + } + if (extract_xml_record(field,"planets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> planets; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + } + } + + void star::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + strncpy(object_type,s[1]->c_str(),16); + object_type[15]=0; + } + { + strncpy(catalog_name,s[2]->c_str(),64); + catalog_name[63]=0; + } + { + std::istringstream row(*(s[3])); + row >> catalog_number; + } + { + strncpy(object_name,s[4]->c_str(),64); + object_name[63]=0; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> qpix; + } + { + std::istringstream row(*(s[8])); + row >> v_mag; + } + { + std::istringstream row(*(s[9])); + row >> b_minus_v; + } + { + std::istringstream row(*(s[10])); + row >> parallax; + } + { + strncpy(stellar_type,s[11]->c_str(),32); + stellar_type[31]=0; + } + { + std::istringstream row(*(s[12])); + row >> planets; + } + { + std::istringstream row(*(s[13])); + row >> score; + } + } + + void star::parse(const std::string &s) { + SQL_ROW row(&s,14); + parse(row); + } + +template <> const char * const db_table::table_name="candidate_count"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=15; +template <> const char * const db_table::column_names[15]={"id","spikes","gaussians","pulses","triplets","spike_barycentric_multiplets","gaussian_barycentric_multiplets","pulse_barycentric_multiplets","triplet_barycentric_multiplets","spike_nonbarycentric_multiplets","gaussian_nonbarycentric_multiplets","pulse_nonbarycentric_multiplets","triplet_nonbarycentric_multiplets","stars","time_last_updated"}; + +candidate_count::candidate_count() : + db_table(*this,-1), + id(0), + spikes(0), + gaussians(0), + pulses(0), + triplets(0), + spike_barycentric_multiplets(0), + gaussian_barycentric_multiplets(0), + pulse_barycentric_multiplets(0), + triplet_barycentric_multiplets(0), + spike_nonbarycentric_multiplets(0), + gaussian_nonbarycentric_multiplets(0), + pulse_nonbarycentric_multiplets(0), + triplet_nonbarycentric_multiplets(0), + stars(0), + time_last_updated(0) +{ + db_open(); +} + + +candidate_count::candidate_count(const candidate_count &a) : + db_table(*this,-1), + id(a.id), + spikes(a.spikes), + gaussians(a.gaussians), + pulses(a.pulses), + triplets(a.triplets), + spike_barycentric_multiplets(a.spike_barycentric_multiplets), + gaussian_barycentric_multiplets(a.gaussian_barycentric_multiplets), + pulse_barycentric_multiplets(a.pulse_barycentric_multiplets), + triplet_barycentric_multiplets(a.triplet_barycentric_multiplets), + spike_nonbarycentric_multiplets(a.spike_nonbarycentric_multiplets), + gaussian_nonbarycentric_multiplets(a.gaussian_nonbarycentric_multiplets), + pulse_nonbarycentric_multiplets(a.pulse_nonbarycentric_multiplets), + triplet_nonbarycentric_multiplets(a.triplet_nonbarycentric_multiplets), + stars(a.stars), + time_last_updated(a.time_last_updated) +{ + db_open(); +} + + +candidate_count::candidate_count(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +candidate_count::candidate_count(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +candidate_count &candidate_count::operator =(const candidate_count &a) { + if (&a != this) { + id=a.id; + spikes=a.spikes; + gaussians=a.gaussians; + pulses=a.pulses; + triplets=a.triplets; + spike_barycentric_multiplets=a.spike_barycentric_multiplets; + gaussian_barycentric_multiplets=a.gaussian_barycentric_multiplets; + pulse_barycentric_multiplets=a.pulse_barycentric_multiplets; + triplet_barycentric_multiplets=a.triplet_barycentric_multiplets; + spike_nonbarycentric_multiplets=a.spike_nonbarycentric_multiplets; + gaussian_nonbarycentric_multiplets=a.gaussian_nonbarycentric_multiplets; + pulse_nonbarycentric_multiplets=a.pulse_nonbarycentric_multiplets; + triplet_nonbarycentric_multiplets=a.triplet_nonbarycentric_multiplets; + stars=a.stars; + time_last_updated=a.time_last_updated; + } + return (*this); +} + + +std::string candidate_count::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<15;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string candidate_count::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string candidate_count::select_format() const +{ +std::string rv(""); +for (int i=0; i<14;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string candidate_count::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << spikes; + rv << ','; + rv << gaussians; + rv << ','; + rv << pulses; + rv << ','; + rv << triplets; + rv << ','; + rv << spike_barycentric_multiplets; + rv << ','; + rv << gaussian_barycentric_multiplets; + rv << ','; + rv << pulse_barycentric_multiplets; + rv << ','; + rv << triplet_barycentric_multiplets; + rv << ','; + rv << spike_nonbarycentric_multiplets; + rv << ','; + rv << gaussian_nonbarycentric_multiplets; + rv << ','; + rv << pulse_nonbarycentric_multiplets; + rv << ','; + rv << triplet_nonbarycentric_multiplets; + rv << ','; + rv << stars; + rv << ','; + rv << time_last_updated; + return rv.str(); +} + + +std::string candidate_count::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << spikes << "\n"; + rv << xml_indent() << "" << gaussians << "\n"; + rv << xml_indent() << "" << pulses << "\n"; + rv << xml_indent() << "" << triplets << "\n"; + rv << xml_indent() << "" << spike_barycentric_multiplets << "\n"; + rv << xml_indent() << "" << gaussian_barycentric_multiplets << "\n"; + rv << xml_indent() << "" << pulse_barycentric_multiplets << "\n"; + rv << xml_indent() << "" << triplet_barycentric_multiplets << "\n"; + rv << xml_indent() << "" << spike_nonbarycentric_multiplets << "\n"; + rv << xml_indent() << "" << gaussian_nonbarycentric_multiplets << "\n"; + rv << xml_indent() << "" << pulse_nonbarycentric_multiplets << "\n"; + rv << xml_indent() << "" << triplet_nonbarycentric_multiplets << "\n"; + rv << xml_indent() << "" << stars << "\n"; + rv << xml_indent() << "" << time_last_updated << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void candidate_count::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"spikes",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spikes; + } + if (extract_xml_record(field,"gaussians",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gaussians; + } + if (extract_xml_record(field,"pulses",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulses; + } + if (extract_xml_record(field,"triplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplets; + } + if (extract_xml_record(field,"spike_barycentric_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spike_barycentric_multiplets; + } + if (extract_xml_record(field,"gaussian_barycentric_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gaussian_barycentric_multiplets; + } + if (extract_xml_record(field,"pulse_barycentric_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_barycentric_multiplets; + } + if (extract_xml_record(field,"triplet_barycentric_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_barycentric_multiplets; + } + if (extract_xml_record(field,"spike_nonbarycentric_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spike_nonbarycentric_multiplets; + } + if (extract_xml_record(field,"gaussian_nonbarycentric_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gaussian_nonbarycentric_multiplets; + } + if (extract_xml_record(field,"pulse_nonbarycentric_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_nonbarycentric_multiplets; + } + if (extract_xml_record(field,"triplet_nonbarycentric_multiplets",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_nonbarycentric_multiplets; + } + if (extract_xml_record(field,"stars",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> stars; + } + if (extract_xml_record(field,"time_last_updated",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time_last_updated; + } + } + } + + void candidate_count::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> spikes; + } + { + std::istringstream row(*(s[2])); + row >> gaussians; + } + { + std::istringstream row(*(s[3])); + row >> pulses; + } + { + std::istringstream row(*(s[4])); + row >> triplets; + } + { + std::istringstream row(*(s[5])); + row >> spike_barycentric_multiplets; + } + { + std::istringstream row(*(s[6])); + row >> gaussian_barycentric_multiplets; + } + { + std::istringstream row(*(s[7])); + row >> pulse_barycentric_multiplets; + } + { + std::istringstream row(*(s[8])); + row >> triplet_barycentric_multiplets; + } + { + std::istringstream row(*(s[9])); + row >> spike_nonbarycentric_multiplets; + } + { + std::istringstream row(*(s[10])); + row >> gaussian_nonbarycentric_multiplets; + } + { + std::istringstream row(*(s[11])); + row >> pulse_nonbarycentric_multiplets; + } + { + std::istringstream row(*(s[12])); + row >> triplet_nonbarycentric_multiplets; + } + { + std::istringstream row(*(s[13])); + row >> stars; + } + { + std::istringstream row(*(s[14])); + row >> time_last_updated; + } + } + + void candidate_count::parse(const std::string &s) { + SQL_ROW row(&s,15); + parse(row); + } + +template <> const char * const db_table::table_name="tape"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=8; +template <> const char * const db_table::column_names[8]={"id","name","start_time","last_block_time","last_block_done","missed","tape_quality","beam"}; + +tape::tape() : + db_table(*this,-1), + id(0), + start_time(0), + last_block_time(0), + last_block_done(0), + missed(0), + tape_quality(0), + beam(0) +{ + db_open(); + name[0]=0; +} + + +tape::tape(const tape &a) : + db_table(*this,-1), + id(a.id), + start_time(a.start_time), + last_block_time(a.last_block_time), + last_block_done(a.last_block_done), + missed(a.missed), + tape_quality(a.tape_quality), + beam(a.beam) +{ + db_open(); + strcpy(name,a.name); +} + + +tape::tape(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +tape::tape(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +tape &tape::operator =(const tape &a) { + if (&a != this) { + id=a.id; + start_time=a.start_time; + last_block_time=a.last_block_time; + last_block_done=a.last_block_done; + missed=a.missed; + tape_quality=a.tape_quality; + beam=a.beam; + strcpy(name,a.name); + } + return (*this); +} + + +std::string tape::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<8;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string tape::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string tape::select_format() const +{ +std::string rv(""); +for (int i=0; i<7;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string tape::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << "'" << name << "'"; + rv << ','; + rv << start_time; + rv << ','; + rv << last_block_time; + rv << ','; + rv << last_block_done; + rv << ','; + rv << missed; + rv << ','; + rv << tape_quality; + rv << ','; + rv << beam; + return rv.str(); +} + + +std::string tape::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + { + std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << start_time << "\n"; + rv << xml_indent() << "" << last_block_time << "\n"; + rv << xml_indent() << "" << last_block_done << "\n"; + rv << xml_indent() << "" << missed << "\n"; + rv << xml_indent() << "" << tape_quality << "\n"; + rv << xml_indent() << "" << beam << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void tape::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"name",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)128)); + name[std::min(in.size(),(size_t)127)]=0; + } + if (extract_xml_record(field,"start_time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> start_time; + } + if (extract_xml_record(field,"last_block_time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> last_block_time; + } + if (extract_xml_record(field,"last_block_done",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> last_block_done; + } + if (extract_xml_record(field,"missed",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> missed; + } + if (extract_xml_record(field,"tape_quality",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> tape_quality; + } + if (extract_xml_record(field,"beam",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> beam; + } + } + } + + void tape::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + strncpy(name,s[1]->c_str(),128); + name[127]=0; + } + { + std::istringstream row(*(s[2])); + row >> start_time; + } + { + std::istringstream row(*(s[3])); + row >> last_block_time; + } + { + std::istringstream row(*(s[4])); + row >> last_block_done; + } + { + std::istringstream row(*(s[5])); + row >> missed; + } + { + std::istringstream row(*(s[6])); + row >> tape_quality; + } + { + std::istringstream row(*(s[7])); + row >> beam; + } + } + + void tape::parse(const std::string &s) { + SQL_ROW row(&s,8); + parse(row); + } + +template <> const char * const db_table::table_name="settings"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=6; +template <> const char * const db_table::column_names[6]={"id","active","recorder_cfg","splitter_cfg","analysis_cfg","receiver_cfg"}; + +settings::settings() : + db_table(*this,-1), + id(0), + active(0), + recorder_cfg(), + splitter_cfg(), + analysis_cfg(), + receiver_cfg() +{ + db_open(); +} + + +settings::settings(const settings &a) : + db_table(*this,-1), + id(a.id), + active(a.active), + recorder_cfg(a.recorder_cfg), + splitter_cfg(a.splitter_cfg), + analysis_cfg(a.analysis_cfg), + receiver_cfg(a.receiver_cfg) +{ + db_open(); +} + + +settings::settings(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +settings::settings(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +settings &settings::operator =(const settings &a) { + if (&a != this) { + id=a.id; + active=a.active; + recorder_cfg=a.recorder_cfg; + splitter_cfg=a.splitter_cfg; + analysis_cfg=a.analysis_cfg; + receiver_cfg=a.receiver_cfg; + } + return (*this); +} + + +std::string settings::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<6;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string settings::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string settings::select_format() const +{ +std::string rv(""); +for (int i=0; i<5;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string settings::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << active; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << recorder_cfg.print(full_subtables,show_ids,no_refs); + } else { + rv << recorder_cfg.id; + } + } + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << splitter_cfg.print(full_subtables,show_ids,no_refs); + } else { + rv << splitter_cfg.id; + } + } + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << analysis_cfg.print(full_subtables,show_ids,no_refs); + } else { + rv << analysis_cfg.id; + } + } + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << receiver_cfg.print(full_subtables,show_ids,no_refs); + } else { + rv << receiver_cfg.id; + } + } + return rv.str(); +} + + +std::string settings::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << active << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << recorder_cfg.print_xml(full_subtables,show_ids,no_refs,"recorder_cfg"); + } else { + rv << xml_indent() << "" << recorder_cfg.id << "\n"; + } + } + if (!no_refs) { + if (full_subtables) { + rv << splitter_cfg.print_xml(full_subtables,show_ids,no_refs,"splitter_cfg"); + } else { + rv << xml_indent() << "" << splitter_cfg.id << "\n"; + } + } + if (!no_refs) { + if (full_subtables) { + rv << analysis_cfg.print_xml(full_subtables,show_ids,no_refs,"analysis_cfg"); + } else { + rv << xml_indent() << "" << analysis_cfg.id << "\n"; + } + } + if (!no_refs) { + if (full_subtables) { + rv << receiver_cfg.print_xml(full_subtables,show_ids,no_refs,"receiver_cfg"); + } else { + rv << xml_indent() << "" << receiver_cfg.id << "\n"; + } + } + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void settings::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"active",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> active; + } + if (extract_xml_record(field,"recorder_cfg",sub)) { + recorder_cfg.parse_xml(sub,"recorder_cfg"); + } + if (extract_xml_record(field,"splitter_cfg",sub)) { + splitter_cfg.parse_xml(sub,"splitter_cfg"); + } + if (extract_xml_record(field,"analysis_cfg",sub)) { + analysis_cfg.parse_xml(sub,"analysis_cfg"); + } + if (extract_xml_record(field,"receiver_cfg",sub)) { + receiver_cfg.parse_xml(sub,"receiver_cfg"); + } + } + } + + void settings::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> active; + } + { + recorder_cfg.parse(SQL_ROW(s[2],0)); + } + { + splitter_cfg.parse(SQL_ROW(s[3],0)); + } + { + analysis_cfg.parse(SQL_ROW(s[4],0)); + } + { + receiver_cfg.parse(SQL_ROW(s[5],0)); + } + } + + void settings::parse(const std::string &s) { + SQL_ROW row(&s,6); + parse(row); + } + +template <> const char * const db_table::table_name="workunit_grp"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=11; +template <> const char * const db_table::column_names[11]={"id","tape_info","name","data_desc","receiver_cfg","recorder_cfg","splitter_cfg","analysis_cfg","sb_id","iq_modified","alfa_filter_bank"}; + +workunit_grp::workunit_grp() : + db_table(*this,-1), + id(0), + tape_info(), + data_desc(), + receiver_cfg(), + recorder_cfg(), + splitter_cfg(), + analysis_cfg(), + sb_id(0), + iq_modified(0), + alfa_filter_bank(0) +{ + db_open(); + name[0]=0; +} + + +workunit_grp::workunit_grp(const workunit_grp &a) : + db_table(*this,-1), + id(a.id), + tape_info(a.tape_info), + data_desc(a.data_desc), + receiver_cfg(a.receiver_cfg), + recorder_cfg(a.recorder_cfg), + splitter_cfg(a.splitter_cfg), + analysis_cfg(a.analysis_cfg), + sb_id(a.sb_id), + iq_modified(a.iq_modified), + alfa_filter_bank(a.alfa_filter_bank) +{ + db_open(); + strcpy(name,a.name); +} + + +workunit_grp::workunit_grp(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +workunit_grp::workunit_grp(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +workunit_grp &workunit_grp::operator =(const workunit_grp &a) { + if (&a != this) { + id=a.id; + tape_info=a.tape_info; + data_desc=a.data_desc; + receiver_cfg=a.receiver_cfg; + recorder_cfg=a.recorder_cfg; + splitter_cfg=a.splitter_cfg; + analysis_cfg=a.analysis_cfg; + sb_id=a.sb_id; + iq_modified=a.iq_modified; + alfa_filter_bank=a.alfa_filter_bank; + strcpy(name,a.name); + } + return (*this); +} + + +std::string workunit_grp::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<11;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string workunit_grp::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string workunit_grp::select_format() const +{ +std::string rv(""); +for (int i=0; i<10;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string workunit_grp::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << tape_info.print(full_subtables,show_ids,no_refs); + } else { + rv << tape_info.id; + } + } + rv << ','; + rv << "'" << name << "'"; + rv << ','; + rv << data_desc.print(full_subtables,show_ids,no_refs); + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << receiver_cfg.print(full_subtables,show_ids,no_refs); + } else { + rv << receiver_cfg.id; + } + } + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << recorder_cfg.print(full_subtables,show_ids,no_refs); + } else { + rv << recorder_cfg.id; + } + } + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << splitter_cfg.print(full_subtables,show_ids,no_refs); + } else { + rv << splitter_cfg.id; + } + } + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << analysis_cfg.print(full_subtables,show_ids,no_refs); + } else { + rv << analysis_cfg.id; + } + } + rv << ','; + rv << sb_id; + rv << ','; + rv << iq_modified; + rv << ','; + rv << alfa_filter_bank; + return rv.str(); +} + + +std::string workunit_grp::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << tape_info.print_xml(full_subtables,show_ids,no_refs,"tape_info"); + } else { + rv << xml_indent() << "" << tape_info.id << "\n"; + } + } + { + std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << data_desc.print_xml(full_subtables,show_ids,no_refs,"data_desc"); + if (!no_refs) { + if (full_subtables) { + rv << receiver_cfg.print_xml(full_subtables,show_ids,no_refs,"receiver_cfg"); + } else { + rv << xml_indent() << "" << receiver_cfg.id << "\n"; + } + } + if (!no_refs) { + if (full_subtables) { + rv << recorder_cfg.print_xml(full_subtables,show_ids,no_refs,"recorder_cfg"); + } else { + rv << xml_indent() << "" << recorder_cfg.id << "\n"; + } + } + if (!no_refs) { + if (full_subtables) { + rv << splitter_cfg.print_xml(full_subtables,show_ids,no_refs,"splitter_cfg"); + } else { + rv << xml_indent() << "" << splitter_cfg.id << "\n"; + } + } + if (!no_refs) { + if (full_subtables) { + rv << analysis_cfg.print_xml(full_subtables,show_ids,no_refs,"analysis_cfg"); + } else { + rv << xml_indent() << "" << analysis_cfg.id << "\n"; + } + } + rv << xml_indent() << "" << sb_id << "\n"; + rv << xml_indent() << "" << iq_modified << "\n"; + rv << xml_indent() << "" << alfa_filter_bank << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void workunit_grp::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"tape_info",sub)) { + tape_info.parse_xml(sub,"tape_info"); + } + if (extract_xml_record(field,"name",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)128)); + name[std::min(in.size(),(size_t)127)]=0; + } + if (extract_xml_record(field,"data_desc",sub)) { + data_desc.parse_xml(sub,"data_desc"); + } + if (extract_xml_record(field,"receiver_cfg",sub)) { + receiver_cfg.parse_xml(sub,"receiver_cfg"); + } + if (extract_xml_record(field,"recorder_cfg",sub)) { + recorder_cfg.parse_xml(sub,"recorder_cfg"); + } + if (extract_xml_record(field,"splitter_cfg",sub)) { + splitter_cfg.parse_xml(sub,"splitter_cfg"); + } + if (extract_xml_record(field,"analysis_cfg",sub)) { + analysis_cfg.parse_xml(sub,"analysis_cfg"); + } + if (extract_xml_record(field,"sb_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> sb_id; + } + if (extract_xml_record(field,"iq_modified",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> iq_modified; + } + if (extract_xml_record(field,"alfa_filter_bank",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> alfa_filter_bank; + } + } + } + + void workunit_grp::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + tape_info.parse(SQL_ROW(s[1],0)); + } + { + strncpy(name,s[2]->c_str(),128); + name[127]=0; + } + { + data_desc.parse(SQL_ROW(s[3],0)); + } + { + receiver_cfg.parse(SQL_ROW(s[4],0)); + } + { + recorder_cfg.parse(SQL_ROW(s[5],0)); + } + { + splitter_cfg.parse(SQL_ROW(s[6],0)); + } + { + analysis_cfg.parse(SQL_ROW(s[7],0)); + } + { + std::istringstream row(*(s[8])); + row >> sb_id; + } + { + std::istringstream row(*(s[9])); + row >> iq_modified; + } + { + std::istringstream row(*(s[10])); + row >> alfa_filter_bank; + } + } + + void workunit_grp::parse(const std::string &s) { + SQL_ROW row(&s,11); + parse(row); + } + +template <> const char * const db_table::table_name="workunit_header"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=5; +template <> const char * const db_table::column_names[5]={"id","name","group_info","subband_desc","sb_id"}; + +workunit_header::workunit_header() : + db_table(*this,-1), + id(0), + group_info(), + subband_desc(), + sb_id(0) +{ + db_open(); + name[0]=0; +} + + +workunit_header::workunit_header(const workunit_header &a) : + db_table(*this,-1), + id(a.id), + group_info(a.group_info), + subband_desc(a.subband_desc), + sb_id(a.sb_id) +{ + db_open(); + strcpy(name,a.name); +} + + +workunit_header::workunit_header(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +workunit_header::workunit_header(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +workunit_header &workunit_header::operator =(const workunit_header &a) { + if (&a != this) { + id=a.id; + group_info=a.group_info; + subband_desc=a.subband_desc; + sb_id=a.sb_id; + strcpy(name,a.name); + } + return (*this); +} + + +std::string workunit_header::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<5;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string workunit_header::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string workunit_header::select_format() const +{ +std::string rv(""); +for (int i=0; i<4;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string workunit_header::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << "'" << name << "'"; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << group_info.print(full_subtables,show_ids,no_refs); + } else { + rv << group_info.id; + } + } + rv << ','; + rv << subband_desc.print(full_subtables,show_ids,no_refs); + rv << ','; + rv << sb_id; + return rv.str(); +} + + +std::string workunit_header::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + { + std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + if (!no_refs) { + if (full_subtables) { + rv << group_info.print_xml(full_subtables,show_ids,no_refs,"group_info"); + } else { + rv << xml_indent() << "" << group_info.id << "\n"; + } + } + rv << subband_desc.print_xml(full_subtables,show_ids,no_refs,"subband_desc"); + rv << xml_indent() << "" << sb_id << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void workunit_header::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"name",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)128)); + name[std::min(in.size(),(size_t)127)]=0; + } + if (extract_xml_record(field,"group_info",sub)) { + group_info.parse_xml(sub,"group_info"); + } + if (extract_xml_record(field,"subband_desc",sub)) { + subband_desc.parse_xml(sub,"subband_desc"); + } + if (extract_xml_record(field,"sb_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> sb_id; + } + } + } + + void workunit_header::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + strncpy(name,s[1]->c_str(),128); + name[127]=0; + } + { + group_info.parse(SQL_ROW(s[2],0)); + } + { + subband_desc.parse(SQL_ROW(s[3],0)); + } + { + std::istringstream row(*(s[4])); + row >> sb_id; + } + } + + void workunit_header::parse(const std::string &s) { + SQL_ROW row(&s,5); + parse(row); + } + +template <> const char * const db_table::table_name="result"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=10; +template <> const char * const db_table::column_names[10]={"id","boinc_result","wuid","received","hostid","versionid","return_code","overflow","reserved","sb_id"}; + +result::result() : + db_table(*this,-1), + id(0), + boinc_result(0), + wuid(), + received(0), + hostid(0), + versionid(0), + return_code(0), + overflow(0), + reserved(0), + sb_id(0) +{ + db_open(); +} + + +result::result(const result &a) : + db_table(*this,-1), + id(a.id), + boinc_result(a.boinc_result), + wuid(a.wuid), + received(a.received), + hostid(a.hostid), + versionid(a.versionid), + return_code(a.return_code), + overflow(a.overflow), + reserved(a.reserved), + sb_id(a.sb_id) +{ + db_open(); +} + + +result::result(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +result::result(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +result &result::operator =(const result &a) { + if (&a != this) { + id=a.id; + boinc_result=a.boinc_result; + wuid=a.wuid; + received=a.received; + hostid=a.hostid; + versionid=a.versionid; + return_code=a.return_code; + overflow=a.overflow; + reserved=a.reserved; + sb_id=a.sb_id; + } + return (*this); +} + + +std::string result::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<10;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string result::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string result::select_format() const +{ +std::string rv(""); +for (int i=0; i<9;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string result::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << boinc_result; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << wuid.print(full_subtables,show_ids,no_refs); + } else { + rv << wuid.id; + } + } + rv << ','; + rv << received; + rv << ','; + rv << hostid; + rv << ','; + rv << versionid; + rv << ','; + rv << return_code; + rv << ','; + rv << overflow; + rv << ','; + rv << reserved; + rv << ','; + rv << sb_id; + return rv.str(); +} + + +std::string result::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << boinc_result << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << wuid.print_xml(full_subtables,show_ids,no_refs,"wuid"); + } else { + rv << xml_indent() << "" << wuid.id << "\n"; + } + } + rv << xml_indent() << "" << received << "\n"; + rv << xml_indent() << "" << hostid << "\n"; + rv << xml_indent() << "" << versionid << "\n"; + rv << xml_indent() << "" << return_code << "\n"; + rv << xml_indent() << "" << overflow << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << sb_id << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void result::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"boinc_result",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> boinc_result; + } + if (extract_xml_record(field,"wuid",sub)) { + wuid.parse_xml(sub,"wuid"); + } + if (extract_xml_record(field,"received",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> received; + } + if (extract_xml_record(field,"hostid",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> hostid; + } + if (extract_xml_record(field,"versionid",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> versionid; + } + if (extract_xml_record(field,"return_code",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> return_code; + } + if (extract_xml_record(field,"overflow",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> overflow; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"sb_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> sb_id; + } + } + } + + void result::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> boinc_result; + } + { + wuid.parse(SQL_ROW(s[2],0)); + } + { + std::istringstream row(*(s[3])); + row >> received; + } + { + std::istringstream row(*(s[4])); + row >> hostid; + } + { + std::istringstream row(*(s[5])); + row >> versionid; + } + { + std::istringstream row(*(s[6])); + row >> return_code; + } + { + std::istringstream row(*(s[7])); + row >> overflow; + } + { + std::istringstream row(*(s[8])); + row >> reserved; + } + { + std::istringstream row(*(s[9])); + row >> sb_id; + } + } + + void result::parse(const std::string &s) { + SQL_ROW row(&s,10); + parse(row); + } + +template <> const char * const db_table::table_name="triplet"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=17; +template <> const char * const db_table::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period"}; + +triplet::triplet() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0), + period(0) +{ + db_open(); +} + + +triplet::triplet(const triplet &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved), + period(a.period) +{ + db_open(); +} + + +triplet::triplet(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +triplet::triplet(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +triplet &triplet::operator =(const triplet &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + period=a.period; + } + return (*this); +} + + +std::string triplet::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<17;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string triplet::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string triplet::select_format() const +{ +std::string rv(""); +for (int i=0; i<16;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string triplet::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + rv << ','; + rv << period; + return rv.str(); +} + + +std::string triplet::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << period << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void triplet::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"period",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> period; + } + } + } + + void triplet::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + { + std::istringstream row(*(s[16])); + row >> period; + } + } + + void triplet::parse(const std::string &s) { + SQL_ROW row(&s,17); + parse(row); + } + +template <> const char * const db_table::table_name="triplet_small"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=17; +template <> const char * const db_table::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period"}; + +triplet_small::triplet_small() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0), + period(0) +{ + db_open(); +} + + +triplet_small::triplet_small(const triplet_small &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved), + period(a.period) +{ + db_open(); +} + + +triplet_small::triplet_small(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +triplet_small::triplet_small(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +triplet_small &triplet_small::operator =(const triplet_small &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + period=a.period; + } + return (*this); +} + + +std::string triplet_small::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<17;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string triplet_small::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string triplet_small::select_format() const +{ +std::string rv(""); +for (int i=0; i<16;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string triplet_small::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + rv << ','; + rv << period; + return rv.str(); +} + + +std::string triplet_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << period << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void triplet_small::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"period",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> period; + } + } + } + + void triplet_small::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + { + std::istringstream row(*(s[16])); + row >> period; + } + } + + void triplet_small::parse(const std::string &s) { + SQL_ROW row(&s,17); + parse(row); + } + +template <> const char * const db_table::table_name="gaussian"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=22; +template <> const char * const db_table::column_names[22]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","sigma","chisqr","null_chisqr","score","max_power","pot"}; + +gaussian::gaussian() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0), + sigma(0), + chisqr(0), + null_chisqr(0), + score(0), + max_power(0), + pot((unsigned char *)0,0,_x_csv) +{ + db_open(); +} + + +gaussian::gaussian(const gaussian &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved), + sigma(a.sigma), + chisqr(a.chisqr), + null_chisqr(a.null_chisqr), + score(a.score), + max_power(a.max_power), + pot(a.pot) +{ + db_open(); +} + + +gaussian::gaussian(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +gaussian::gaussian(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +gaussian &gaussian::operator =(const gaussian &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + sigma=a.sigma; + chisqr=a.chisqr; + null_chisqr=a.null_chisqr; + score=a.score; + max_power=a.max_power; + pot=a.pot; + } + return (*this); +} + + +std::string gaussian::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<22;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string gaussian::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string gaussian::select_format() const +{ +std::string rv(""); +for (int i=0; i<21;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string gaussian::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + rv << ','; + rv << sigma; + rv << ','; + rv << chisqr; + rv << ','; + rv << null_chisqr; + rv << ','; + rv << score; + rv << ','; + rv << max_power; + rv << ','; + rv << "" << pot.print_hex() ; + return rv.str(); +} + + +std::string gaussian::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << sigma << "\n"; + rv << xml_indent() << "" << chisqr << "\n"; + rv << xml_indent() << "" << null_chisqr << "\n"; + rv << xml_indent() << "" << score << "\n"; + rv << xml_indent() << "" << max_power << "\n"; + if (pot.size()) { + std::string enc_field=xml_encode_string(pot,pot.encoding); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void gaussian::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"sigma",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> sigma; + } + if (extract_xml_record(field,"chisqr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chisqr; + } + if (extract_xml_record(field,"null_chisqr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> null_chisqr; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + if (extract_xml_record(field,"max_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_power; + } + if (extract_xml_record(field,"pot",sub)) { + std::istringstream in(sub.c_str()); + in >> pot; + } + } + } + + void gaussian::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + { + std::istringstream row(*(s[16])); + row >> sigma; + } + { + std::istringstream row(*(s[17])); + row >> chisqr; + } + { + std::istringstream row(*(s[18])); + row >> null_chisqr; + } + { + std::istringstream row(*(s[19])); + row >> score; + } + { + std::istringstream row(*(s[20])); + row >> max_power; + } + { + pot=sqlblob(*(s[21])); + } + } + + void gaussian::parse(const std::string &s) { + SQL_ROW row(&s,22); + parse(row); + } + +template <> const char * const db_table::table_name="gaussian_small"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=21; +template <> const char * const db_table::column_names[21]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","sigma","chisqr","null_chisqr","score","max_power"}; + +gaussian_small::gaussian_small() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0), + sigma(0), + chisqr(0), + null_chisqr(0), + score(0), + max_power(0) +{ + db_open(); +} + + +gaussian_small::gaussian_small(const gaussian_small &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved), + sigma(a.sigma), + chisqr(a.chisqr), + null_chisqr(a.null_chisqr), + score(a.score), + max_power(a.max_power) +{ + db_open(); +} + + +gaussian_small::gaussian_small(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +gaussian_small::gaussian_small(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +gaussian_small &gaussian_small::operator =(const gaussian_small &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + sigma=a.sigma; + chisqr=a.chisqr; + null_chisqr=a.null_chisqr; + score=a.score; + max_power=a.max_power; + } + return (*this); +} + + +std::string gaussian_small::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<21;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string gaussian_small::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string gaussian_small::select_format() const +{ +std::string rv(""); +for (int i=0; i<20;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string gaussian_small::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + rv << ','; + rv << sigma; + rv << ','; + rv << chisqr; + rv << ','; + rv << null_chisqr; + rv << ','; + rv << score; + rv << ','; + rv << max_power; + return rv.str(); +} + + +std::string gaussian_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << sigma << "\n"; + rv << xml_indent() << "" << chisqr << "\n"; + rv << xml_indent() << "" << null_chisqr << "\n"; + rv << xml_indent() << "" << score << "\n"; + rv << xml_indent() << "" << max_power << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void gaussian_small::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"sigma",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> sigma; + } + if (extract_xml_record(field,"chisqr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chisqr; + } + if (extract_xml_record(field,"null_chisqr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> null_chisqr; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + if (extract_xml_record(field,"max_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_power; + } + } + } + + void gaussian_small::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + { + std::istringstream row(*(s[16])); + row >> sigma; + } + { + std::istringstream row(*(s[17])); + row >> chisqr; + } + { + std::istringstream row(*(s[18])); + row >> null_chisqr; + } + { + std::istringstream row(*(s[19])); + row >> score; + } + { + std::istringstream row(*(s[20])); + row >> max_power; + } + } + + void gaussian_small::parse(const std::string &s) { + SQL_ROW row(&s,21); + parse(row); + } + +template <> const char * const db_table::table_name="pulse"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=22; +template <> const char * const db_table::column_names[22]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period","snr","thresh","score","len_prof","pot"}; + +pulse::pulse() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0), + period(0), + snr(0), + thresh(0), + score(0), + len_prof(0), + pot((unsigned char *)0,0,_x_csv) +{ + db_open(); +} + + +pulse::pulse(const pulse &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved), + period(a.period), + snr(a.snr), + thresh(a.thresh), + score(a.score), + len_prof(a.len_prof), + pot(a.pot) +{ + db_open(); +} + + +pulse::pulse(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +pulse::pulse(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +pulse &pulse::operator =(const pulse &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + period=a.period; + snr=a.snr; + thresh=a.thresh; + score=a.score; + len_prof=a.len_prof; + pot=a.pot; + } + return (*this); +} + + +std::string pulse::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<22;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string pulse::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string pulse::select_format() const +{ +std::string rv(""); +for (int i=0; i<21;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string pulse::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + rv << ','; + rv << period; + rv << ','; + rv << snr; + rv << ','; + rv << thresh; + rv << ','; + rv << score; + rv << ','; + rv << len_prof; + rv << ','; + rv << "" << pot.print_hex() ; + return rv.str(); +} + + +std::string pulse::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << period << "\n"; + rv << xml_indent() << "" << snr << "\n"; + rv << xml_indent() << "" << thresh << "\n"; + rv << xml_indent() << "" << score << "\n"; + rv << xml_indent() << "" << len_prof << "\n"; + if (pot.size()) { + std::string enc_field=xml_encode_string(pot,pot.encoding); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void pulse::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"period",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> period; + } + if (extract_xml_record(field,"snr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> snr; + } + if (extract_xml_record(field,"thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> thresh; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + if (extract_xml_record(field,"len_prof",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> len_prof; + } + if (extract_xml_record(field,"pot",sub)) { + std::istringstream in(sub.c_str()); + in >> pot; + } + } + } + + void pulse::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + { + std::istringstream row(*(s[16])); + row >> period; + } + { + std::istringstream row(*(s[17])); + row >> snr; + } + { + std::istringstream row(*(s[18])); + row >> thresh; + } + { + std::istringstream row(*(s[19])); + row >> score; + } + { + std::istringstream row(*(s[20])); + row >> len_prof; + } + { + pot=sqlblob(*(s[21])); + } + } + + void pulse::parse(const std::string &s) { + SQL_ROW row(&s,22); + parse(row); + } + +template <> const char * const db_table::table_name="pulse_small"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=20; +template <> const char * const db_table::column_names[20]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period","snr","thresh","score"}; + +pulse_small::pulse_small() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0), + period(0), + snr(0), + thresh(0), + score(0) +{ + db_open(); +} + + +pulse_small::pulse_small(const pulse_small &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved), + period(a.period), + snr(a.snr), + thresh(a.thresh), + score(a.score) +{ + db_open(); +} + + +pulse_small::pulse_small(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +pulse_small::pulse_small(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +pulse_small &pulse_small::operator =(const pulse_small &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + period=a.period; + snr=a.snr; + thresh=a.thresh; + score=a.score; + } + return (*this); +} + + +std::string pulse_small::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<20;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string pulse_small::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string pulse_small::select_format() const +{ +std::string rv(""); +for (int i=0; i<19;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string pulse_small::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + rv << ','; + rv << period; + rv << ','; + rv << snr; + rv << ','; + rv << thresh; + rv << ','; + rv << score; + return rv.str(); +} + + +std::string pulse_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << period << "\n"; + rv << xml_indent() << "" << snr << "\n"; + rv << xml_indent() << "" << thresh << "\n"; + rv << xml_indent() << "" << score << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void pulse_small::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"period",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> period; + } + if (extract_xml_record(field,"snr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> snr; + } + if (extract_xml_record(field,"thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> thresh; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + } + } + + void pulse_small::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + { + std::istringstream row(*(s[16])); + row >> period; + } + { + std::istringstream row(*(s[17])); + row >> snr; + } + { + std::istringstream row(*(s[18])); + row >> thresh; + } + { + std::istringstream row(*(s[19])); + row >> score; + } + } + + void pulse_small::parse(const std::string &s) { + SQL_ROW row(&s,20); + parse(row); + } + +template <> const char * const db_table::table_name="sah_pointing"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=7; +template <> const char * const db_table::column_names[7]={"time_id","time","ra","dec","q_pix","angle_range","bad"}; + +sah_pointing::sah_pointing() : + db_table(*this,-1), + time_id(0), + time(0), + ra(0), + dec(0), + q_pix(0), + angle_range(0), + bad(0) +{ + db_open(); +} + + +sah_pointing::sah_pointing(const sah_pointing &a) : + db_table(*this,-1), + time_id(a.time_id), + time(a.time), + ra(a.ra), + dec(a.dec), + q_pix(a.q_pix), + angle_range(a.angle_range), + bad(a.bad) +{ + db_open(); +} + + +sah_pointing::sah_pointing(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +sah_pointing::sah_pointing(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +sah_pointing &sah_pointing::operator =(const sah_pointing &a) { + if (&a != this) { + time_id=a.time_id; + time=a.time; + ra=a.ra; + dec=a.dec; + q_pix=a.q_pix; + angle_range=a.angle_range; + bad=a.bad; + } + return (*this); +} + + +std::string sah_pointing::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<7;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string sah_pointing::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string sah_pointing::select_format() const +{ +std::string rv(""); +for (int i=0; i<6;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string sah_pointing::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << time_id; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << dec; + rv << ','; + rv << q_pix; + rv << ','; + rv << angle_range; + rv << ','; + rv << bad; + return rv.str(); +} + + +std::string sah_pointing::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << time_id << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << dec << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << angle_range << "\n"; + rv << xml_indent() << "" << bad << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void sah_pointing::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"time_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time_id; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"dec",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> dec; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"angle_range",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> angle_range; + } + if (extract_xml_record(field,"bad",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> bad; + } + } + } + + void sah_pointing::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> time_id; + } + { + std::istringstream row(*(s[1])); + row >> time; + } + { + std::istringstream row(*(s[2])); + row >> ra; + } + { + std::istringstream row(*(s[3])); + row >> dec; + } + { + std::istringstream row(*(s[4])); + row >> q_pix; + } + { + std::istringstream row(*(s[5])); + row >> angle_range; + } + { + std::istringstream row(*(s[6])); + row >> bad; + } + } + + void sah_pointing::parse(const std::string &s) { + SQL_ROW row(&s,7); + parse(row); + } + +template <> const char * const db_table::table_name="sky_map"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=13; +template <> const char * const db_table::column_names[13]={"npix","qpix","fpix","spike_max_id","gaussian_max_id","pulse_max_id","triplet_max_id","spike_count","gaussian_count","pulse_count","triplet_count","new_data","score"}; + +sky_map::sky_map() : + db_table(*this,-1), + npix(0), + qpix(0), + fpix(0), + spike_max_id(0), + gaussian_max_id(0), + pulse_max_id(0), + triplet_max_id(0), + spike_count(0), + gaussian_count(0), + pulse_count(0), + triplet_count(0), + new_data(0), + score(0) +{ + db_open(); +} + + +sky_map::sky_map(const sky_map &a) : + db_table(*this,-1), + npix(a.npix), + qpix(a.qpix), + fpix(a.fpix), + spike_max_id(a.spike_max_id), + gaussian_max_id(a.gaussian_max_id), + pulse_max_id(a.pulse_max_id), + triplet_max_id(a.triplet_max_id), + spike_count(a.spike_count), + gaussian_count(a.gaussian_count), + pulse_count(a.pulse_count), + triplet_count(a.triplet_count), + new_data(a.new_data), + score(a.score) +{ + db_open(); +} + + +sky_map::sky_map(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +sky_map::sky_map(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +sky_map &sky_map::operator =(const sky_map &a) { + if (&a != this) { + npix=a.npix; + qpix=a.qpix; + fpix=a.fpix; + spike_max_id=a.spike_max_id; + gaussian_max_id=a.gaussian_max_id; + pulse_max_id=a.pulse_max_id; + triplet_max_id=a.triplet_max_id; + spike_count=a.spike_count; + gaussian_count=a.gaussian_count; + pulse_count=a.pulse_count; + triplet_count=a.triplet_count; + new_data=a.new_data; + score=a.score; + } + return (*this); +} + + +std::string sky_map::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<13;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string sky_map::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string sky_map::select_format() const +{ +std::string rv(""); +for (int i=0; i<12;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string sky_map::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << npix; + rv << ','; + rv << qpix; + rv << ','; + rv << fpix; + rv << ','; + rv << spike_max_id; + rv << ','; + rv << gaussian_max_id; + rv << ','; + rv << pulse_max_id; + rv << ','; + rv << triplet_max_id; + rv << ','; + rv << spike_count; + rv << ','; + rv << gaussian_count; + rv << ','; + rv << pulse_count; + rv << ','; + rv << triplet_count; + rv << ','; + rv << new_data; + rv << ','; + rv << score; + return rv.str(); +} + + +std::string sky_map::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << npix << "\n"; + rv << xml_indent() << "" << qpix << "\n"; + rv << xml_indent() << "" << fpix << "\n"; + rv << xml_indent() << "" << spike_max_id << "\n"; + rv << xml_indent() << "" << gaussian_max_id << "\n"; + rv << xml_indent() << "" << pulse_max_id << "\n"; + rv << xml_indent() << "" << triplet_max_id << "\n"; + rv << xml_indent() << "" << spike_count << "\n"; + rv << xml_indent() << "" << gaussian_count << "\n"; + rv << xml_indent() << "" << pulse_count << "\n"; + rv << xml_indent() << "" << triplet_count << "\n"; + rv << xml_indent() << "" << new_data << "\n"; + rv << xml_indent() << "" << score << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void sky_map::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"npix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> npix; + } + if (extract_xml_record(field,"qpix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> qpix; + } + if (extract_xml_record(field,"fpix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fpix; + } + if (extract_xml_record(field,"spike_max_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spike_max_id; + } + if (extract_xml_record(field,"gaussian_max_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gaussian_max_id; + } + if (extract_xml_record(field,"pulse_max_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_max_id; + } + if (extract_xml_record(field,"triplet_max_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_max_id; + } + if (extract_xml_record(field,"spike_count",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> spike_count; + } + if (extract_xml_record(field,"gaussian_count",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> gaussian_count; + } + if (extract_xml_record(field,"pulse_count",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> pulse_count; + } + if (extract_xml_record(field,"triplet_count",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> triplet_count; + } + if (extract_xml_record(field,"new_data",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> new_data; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + } + } + + void sky_map::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> npix; + } + { + std::istringstream row(*(s[1])); + row >> qpix; + } + { + std::istringstream row(*(s[2])); + row >> fpix; + } + { + std::istringstream row(*(s[3])); + row >> spike_max_id; + } + { + std::istringstream row(*(s[4])); + row >> gaussian_max_id; + } + { + std::istringstream row(*(s[5])); + row >> pulse_max_id; + } + { + std::istringstream row(*(s[6])); + row >> triplet_max_id; + } + { + std::istringstream row(*(s[7])); + row >> spike_count; + } + { + std::istringstream row(*(s[8])); + row >> gaussian_count; + } + { + std::istringstream row(*(s[9])); + row >> pulse_count; + } + { + std::istringstream row(*(s[10])); + row >> triplet_count; + } + { + std::istringstream row(*(s[11])); + row >> new_data; + } + { + std::istringstream row(*(s[12])); + row >> score; + } + } + + void sky_map::parse(const std::string &s) { + SQL_ROW row(&s,13); + parse(row); + } + +template <> const char * const db_table::table_name="hotpix"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=2; +template <> const char * const db_table::column_names[2]={"id","last_hit_time"}; + +hotpix::hotpix() : + db_table(*this,-1), + id(0), + last_hit_time(0) +{ + db_open(); +} + + +hotpix::hotpix(const hotpix &a) : + db_table(*this,-1), + id(a.id), + last_hit_time(a.last_hit_time) +{ + db_open(); +} + + +hotpix::hotpix(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +hotpix::hotpix(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +hotpix &hotpix::operator =(const hotpix &a) { + if (&a != this) { + id=a.id; + last_hit_time=a.last_hit_time; + } + return (*this); +} + + +std::string hotpix::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<2;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string hotpix::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string hotpix::select_format() const +{ +std::string rv(""); +for (int i=0; i<1;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string hotpix::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << last_hit_time; + return rv.str(); +} + + +std::string hotpix::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << last_hit_time << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void hotpix::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"last_hit_time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> last_hit_time; + } + } + } + + void hotpix::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> last_hit_time; + } + } + + void hotpix::parse(const std::string &s) { + SQL_ROW row(&s,2); + parse(row); + } + +template <> const char * const db_table::table_name="hotpix_tinysky"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=2; +template <> const char * const db_table::column_names[2]={"id","last_hit_time"}; + +hotpix_tinysky::hotpix_tinysky() : + db_table(*this,-1), + id(0), + last_hit_time(0) +{ + db_open(); +} + + +hotpix_tinysky::hotpix_tinysky(const hotpix_tinysky &a) : + db_table(*this,-1), + id(a.id), + last_hit_time(a.last_hit_time) +{ + db_open(); +} + + +hotpix_tinysky::hotpix_tinysky(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +hotpix_tinysky::hotpix_tinysky(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +hotpix_tinysky &hotpix_tinysky::operator =(const hotpix_tinysky &a) { + if (&a != this) { + id=a.id; + last_hit_time=a.last_hit_time; + } + return (*this); +} + + +std::string hotpix_tinysky::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<2;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string hotpix_tinysky::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string hotpix_tinysky::select_format() const +{ +std::string rv(""); +for (int i=0; i<1;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string hotpix_tinysky::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << last_hit_time; + return rv.str(); +} + + +std::string hotpix_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << last_hit_time << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void hotpix_tinysky::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"last_hit_time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> last_hit_time; + } + } + } + + void hotpix_tinysky::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> last_hit_time; + } + } + + void hotpix_tinysky::parse(const std::string &s) { + SQL_ROW row(&s,2); + parse(row); + } + +template <> const char * const db_table::table_name="spike"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=16; +template <> const char * const db_table::column_names[16]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"}; + +spike::spike() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0) +{ + db_open(); +} + + +spike::spike(const spike &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved) +{ + db_open(); +} + + +spike::spike(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +spike::spike(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +spike &spike::operator =(const spike &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + } + return (*this); +} + + +std::string spike::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<16;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string spike::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string spike::select_format() const +{ +std::string rv(""); +for (int i=0; i<15;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string spike::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + return rv.str(); +} + + +std::string spike::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void spike::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + } + } + + void spike::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + } + + void spike::parse(const std::string &s) { + SQL_ROW row(&s,16); + parse(row); + } + +template <> const char * const db_table::table_name="spike_small"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=16; +template <> const char * const db_table::column_names[16]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"}; + +spike_small::spike_small() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0) +{ + db_open(); +} + + +spike_small::spike_small(const spike_small &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved) +{ + db_open(); +} + + +spike_small::spike_small(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +spike_small::spike_small(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +spike_small &spike_small::operator =(const spike_small &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + } + return (*this); +} + + +std::string spike_small::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<16;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string spike_small::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string spike_small::select_format() const +{ +std::string rv(""); +for (int i=0; i<15;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string spike_small::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + return rv.str(); +} + + +std::string spike_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void spike_small::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + } + } + + void spike_small::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + } + + void spike_small::parse(const std::string &s) { + SQL_ROW row(&s,16); + parse(row); + } + +template <> const char * const db_table::table_name="autocorr"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=17; +template <> const char * const db_table::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","delay","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"}; + +autocorr::autocorr() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + delay(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0) +{ + db_open(); +} + + +autocorr::autocorr(const autocorr &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + delay(a.delay), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved) +{ + db_open(); +} + + +autocorr::autocorr(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +autocorr::autocorr(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +autocorr &autocorr::operator =(const autocorr &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + delay=a.delay; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + } + return (*this); +} + + +std::string autocorr::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<17;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string autocorr::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string autocorr::select_format() const +{ +std::string rv(""); +for (int i=0; i<16;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string autocorr::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << delay; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + return rv.str(); +} + + +std::string autocorr::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << delay << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void autocorr::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"delay",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> delay; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + } + } + + void autocorr::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> delay; + } + { + std::istringstream row(*(s[9])); + row >> freq; + } + { + std::istringstream row(*(s[10])); + row >> detection_freq; + } + { + std::istringstream row(*(s[11])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[12])); + row >> fft_len; + } + { + std::istringstream row(*(s[13])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[14])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[15])); + row >> rfi_found; + } + { + std::istringstream row(*(s[16])); + row >> reserved; + } + } + + void autocorr::parse(const std::string &s) { + SQL_ROW row(&s,17); + parse(row); + } + +template <> const char * const db_table::table_name="autocorr_small"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=17; +template <> const char * const db_table::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","delay","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"}; + +autocorr_small::autocorr_small() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + delay(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0) +{ + db_open(); +} + + +autocorr_small::autocorr_small(const autocorr_small &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + delay(a.delay), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved) +{ + db_open(); +} + + +autocorr_small::autocorr_small(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +autocorr_small::autocorr_small(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +autocorr_small &autocorr_small::operator =(const autocorr_small &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + delay=a.delay; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + } + return (*this); +} + + +std::string autocorr_small::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<17;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string autocorr_small::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string autocorr_small::select_format() const +{ +std::string rv(""); +for (int i=0; i<16;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string autocorr_small::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << delay; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + return rv.str(); +} + + +std::string autocorr_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << delay << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void autocorr_small::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"delay",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> delay; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + } + } + + void autocorr_small::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> delay; + } + { + std::istringstream row(*(s[9])); + row >> freq; + } + { + std::istringstream row(*(s[10])); + row >> detection_freq; + } + { + std::istringstream row(*(s[11])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[12])); + row >> fft_len; + } + { + std::istringstream row(*(s[13])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[14])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[15])); + row >> rfi_found; + } + { + std::istringstream row(*(s[16])); + row >> reserved; + } + } + + void autocorr_small::parse(const std::string &s) { + SQL_ROW row(&s,17); + parse(row); + } + +template <> const char * const db_table::table_name="classic_versions"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=10; +template <> const char * const db_table::column_names[10]={"id","ver_major","ver_minor","platformid","comment","filename","md5_cksum","sum_cksum","cksum_cksum","file_cksum"}; + +classic_versions::classic_versions() : + db_table(*this,-1), + id(0), + ver_major(0), + ver_minor(0), + platformid(0), + file_cksum(0) +{ + db_open(); + comment[0]=0; + filename[0]=0; + md5_cksum[0]=0; + sum_cksum[0]=0; + cksum_cksum[0]=0; +} + + +classic_versions::classic_versions(const classic_versions &a) : + db_table(*this,-1), + id(a.id), + ver_major(a.ver_major), + ver_minor(a.ver_minor), + platformid(a.platformid), + file_cksum(a.file_cksum) +{ + db_open(); + strcpy(comment,a.comment); + strcpy(filename,a.filename); + strcpy(md5_cksum,a.md5_cksum); + strcpy(sum_cksum,a.sum_cksum); + strcpy(cksum_cksum,a.cksum_cksum); +} + + +classic_versions::classic_versions(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +classic_versions::classic_versions(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +classic_versions &classic_versions::operator =(const classic_versions &a) { + if (&a != this) { + id=a.id; + ver_major=a.ver_major; + ver_minor=a.ver_minor; + platformid=a.platformid; + file_cksum=a.file_cksum; + strcpy(comment,a.comment); + strcpy(filename,a.filename); + strcpy(md5_cksum,a.md5_cksum); + strcpy(sum_cksum,a.sum_cksum); + strcpy(cksum_cksum,a.cksum_cksum); + } + return (*this); +} + + +std::string classic_versions::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<10;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string classic_versions::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string classic_versions::select_format() const +{ +std::string rv(""); +for (int i=0; i<9;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string classic_versions::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << ver_major; + rv << ','; + rv << ver_minor; + rv << ','; + rv << platformid; + rv << ','; + rv << "'" << comment << "'"; + rv << ','; + rv << "'" << filename << "'"; + rv << ','; + rv << "'" << md5_cksum << "'"; + rv << ','; + rv << "'" << sum_cksum << "'"; + rv << ','; + rv << "'" << cksum_cksum << "'"; + rv << ','; + rv << file_cksum; + return rv.str(); +} + + +std::string classic_versions::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << ver_major << "\n"; + rv << xml_indent() << "" << ver_minor << "\n"; + rv << xml_indent() << "" << platformid << "\n"; + { + std::string enc_field=xml_encode_string(comment,std::min(strlen(comment),sizeof(comment))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + { + std::string enc_field=xml_encode_string(filename,std::min(strlen(filename),sizeof(filename))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + { + std::string enc_field=xml_encode_string(md5_cksum,std::min(strlen(md5_cksum),sizeof(md5_cksum))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + { + std::string enc_field=xml_encode_string(sum_cksum,std::min(strlen(sum_cksum),sizeof(sum_cksum))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + { + std::string enc_field=xml_encode_string(cksum_cksum,std::min(strlen(cksum_cksum),sizeof(cksum_cksum))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << file_cksum << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void classic_versions::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"ver_major",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ver_major; + } + if (extract_xml_record(field,"ver_minor",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ver_minor; + } + if (extract_xml_record(field,"platformid",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> platformid; + } + if (extract_xml_record(field,"comment",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(comment,(const char *)&(in.front()),std::min(in.size(),(size_t)254)); + comment[std::min(in.size(),(size_t)253)]=0; + } + if (extract_xml_record(field,"filename",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(filename,(const char *)&(in.front()),std::min(in.size(),(size_t)254)); + filename[std::min(in.size(),(size_t)253)]=0; + } + if (extract_xml_record(field,"md5_cksum",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(md5_cksum,(const char *)&(in.front()),std::min(in.size(),(size_t)254)); + md5_cksum[std::min(in.size(),(size_t)253)]=0; + } + if (extract_xml_record(field,"sum_cksum",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(sum_cksum,(const char *)&(in.front()),std::min(in.size(),(size_t)254)); + sum_cksum[std::min(in.size(),(size_t)253)]=0; + } + if (extract_xml_record(field,"cksum_cksum",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(cksum_cksum,(const char *)&(in.front()),std::min(in.size(),(size_t)254)); + cksum_cksum[std::min(in.size(),(size_t)253)]=0; + } + if (extract_xml_record(field,"file_cksum",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> file_cksum; + } + } + } + + void classic_versions::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> ver_major; + } + { + std::istringstream row(*(s[2])); + row >> ver_minor; + } + { + std::istringstream row(*(s[3])); + row >> platformid; + } + { + strncpy(comment,s[4]->c_str(),254); + comment[253]=0; + } + { + strncpy(filename,s[5]->c_str(),254); + filename[253]=0; + } + { + strncpy(md5_cksum,s[6]->c_str(),254); + md5_cksum[253]=0; + } + { + strncpy(sum_cksum,s[7]->c_str(),254); + sum_cksum[253]=0; + } + { + strncpy(cksum_cksum,s[8]->c_str(),254); + cksum_cksum[253]=0; + } + { + std::istringstream row(*(s[9])); + row >> file_cksum; + } + } + + void classic_versions::parse(const std::string &s) { + SQL_ROW row(&s,10); + parse(row); + } + +template <> const char * const db_table::table_name="classic_active_versions"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=4; +template <> const char * const db_table::column_names[4]={"id","versionid","ver_major","ver_minor"}; + +classic_active_versions::classic_active_versions() : + db_table(*this,-1), + id(0), + versionid(0), + ver_major(0), + ver_minor(0) +{ + db_open(); +} + + +classic_active_versions::classic_active_versions(const classic_active_versions &a) : + db_table(*this,-1), + id(a.id), + versionid(a.versionid), + ver_major(a.ver_major), + ver_minor(a.ver_minor) +{ + db_open(); +} + + +classic_active_versions::classic_active_versions(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +classic_active_versions::classic_active_versions(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +classic_active_versions &classic_active_versions::operator =(const classic_active_versions &a) { + if (&a != this) { + id=a.id; + versionid=a.versionid; + ver_major=a.ver_major; + ver_minor=a.ver_minor; + } + return (*this); +} + + +std::string classic_active_versions::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<4;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string classic_active_versions::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string classic_active_versions::select_format() const +{ +std::string rv(""); +for (int i=0; i<3;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string classic_active_versions::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << versionid; + rv << ','; + rv << ver_major; + rv << ','; + rv << ver_minor; + return rv.str(); +} + + +std::string classic_active_versions::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << versionid << "\n"; + rv << xml_indent() << "" << ver_major << "\n"; + rv << xml_indent() << "" << ver_minor << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void classic_active_versions::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"versionid",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> versionid; + } + if (extract_xml_record(field,"ver_major",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ver_major; + } + if (extract_xml_record(field,"ver_minor",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ver_minor; + } + } + } + + void classic_active_versions::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> versionid; + } + { + std::istringstream row(*(s[2])); + row >> ver_major; + } + { + std::istringstream row(*(s[3])); + row >> ver_minor; + } + } + + void classic_active_versions::parse(const std::string &s) { + SQL_ROW row(&s,4); + parse(row); + } + +template <> const char * const db_table::table_name="classic_active_versionids"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=2; +template <> const char * const db_table::column_names[2]={"id","versionid"}; + +classic_active_versionids::classic_active_versionids() : + db_table(*this,-1), + id(0), + versionid(0) +{ + db_open(); +} + + +classic_active_versionids::classic_active_versionids(const classic_active_versionids &a) : + db_table(*this,-1), + id(a.id), + versionid(a.versionid) +{ + db_open(); +} + + +classic_active_versionids::classic_active_versionids(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +classic_active_versionids::classic_active_versionids(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +classic_active_versionids &classic_active_versionids::operator =(const classic_active_versionids &a) { + if (&a != this) { + id=a.id; + versionid=a.versionid; + } + return (*this); +} + + +std::string classic_active_versionids::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<2;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string classic_active_versionids::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string classic_active_versionids::select_format() const +{ +std::string rv(""); +for (int i=0; i<1;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string classic_active_versionids::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << versionid; + return rv.str(); +} + + +std::string classic_active_versionids::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << versionid << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void classic_active_versionids::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"versionid",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> versionid; + } + } + } + + void classic_active_versionids::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> versionid; + } + } + + void classic_active_versionids::parse(const std::string &s) { + SQL_ROW row(&s,2); + parse(row); + } + +template <> const char * const db_table::table_name="rfi_zone"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=26; +template <> const char * const db_table::column_names[26]={"id","min_receiver_s4id","max_receiver_s4id","min_splitter_config","max_splitter_config","min_analysis_config","max_analysis_config","min_tape_id","max_tape_id","min_workunit_id","max_workunit_id","min_result_id","max_result_id","min_time","max_time","central_baseband_freq","baseband_freq_width","central_detection_freq","detection_freq_width","central_period","period_width","fft_len_flags","signal_type_flags","ra","dec","angular_distance"}; + +rfi_zone::rfi_zone() : + db_table(*this,-1), + id(0), + min_receiver_s4id(0), + max_receiver_s4id(0), + min_splitter_config(0), + max_splitter_config(0), + min_analysis_config(0), + max_analysis_config(0), + min_tape_id(0), + max_tape_id(0), + min_workunit_id(0), + max_workunit_id(0), + min_result_id(0), + max_result_id(0), + min_time(0), + max_time(0), + central_baseband_freq(0), + baseband_freq_width(0), + central_detection_freq(0), + detection_freq_width(0), + central_period(0), + period_width(0), + fft_len_flags(0), + signal_type_flags(0), + ra(0), + dec(0), + angular_distance(0) +{ + db_open(); +} + + +rfi_zone::rfi_zone(const rfi_zone &a) : + db_table(*this,-1), + id(a.id), + min_receiver_s4id(a.min_receiver_s4id), + max_receiver_s4id(a.max_receiver_s4id), + min_splitter_config(a.min_splitter_config), + max_splitter_config(a.max_splitter_config), + min_analysis_config(a.min_analysis_config), + max_analysis_config(a.max_analysis_config), + min_tape_id(a.min_tape_id), + max_tape_id(a.max_tape_id), + min_workunit_id(a.min_workunit_id), + max_workunit_id(a.max_workunit_id), + min_result_id(a.min_result_id), + max_result_id(a.max_result_id), + min_time(a.min_time), + max_time(a.max_time), + central_baseband_freq(a.central_baseband_freq), + baseband_freq_width(a.baseband_freq_width), + central_detection_freq(a.central_detection_freq), + detection_freq_width(a.detection_freq_width), + central_period(a.central_period), + period_width(a.period_width), + fft_len_flags(a.fft_len_flags), + signal_type_flags(a.signal_type_flags), + ra(a.ra), + dec(a.dec), + angular_distance(a.angular_distance) +{ + db_open(); +} + + +rfi_zone::rfi_zone(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +rfi_zone::rfi_zone(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +rfi_zone &rfi_zone::operator =(const rfi_zone &a) { + if (&a != this) { + id=a.id; + min_receiver_s4id=a.min_receiver_s4id; + max_receiver_s4id=a.max_receiver_s4id; + min_splitter_config=a.min_splitter_config; + max_splitter_config=a.max_splitter_config; + min_analysis_config=a.min_analysis_config; + max_analysis_config=a.max_analysis_config; + min_tape_id=a.min_tape_id; + max_tape_id=a.max_tape_id; + min_workunit_id=a.min_workunit_id; + max_workunit_id=a.max_workunit_id; + min_result_id=a.min_result_id; + max_result_id=a.max_result_id; + min_time=a.min_time; + max_time=a.max_time; + central_baseband_freq=a.central_baseband_freq; + baseband_freq_width=a.baseband_freq_width; + central_detection_freq=a.central_detection_freq; + detection_freq_width=a.detection_freq_width; + central_period=a.central_period; + period_width=a.period_width; + fft_len_flags=a.fft_len_flags; + signal_type_flags=a.signal_type_flags; + ra=a.ra; + dec=a.dec; + angular_distance=a.angular_distance; + } + return (*this); +} + + +std::string rfi_zone::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<26;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string rfi_zone::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string rfi_zone::select_format() const +{ +std::string rv(""); +for (int i=0; i<25;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string rfi_zone::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + rv << min_receiver_s4id; + rv << ','; + rv << max_receiver_s4id; + rv << ','; + rv << min_splitter_config; + rv << ','; + rv << max_splitter_config; + rv << ','; + rv << min_analysis_config; + rv << ','; + rv << max_analysis_config; + rv << ','; + rv << min_tape_id; + rv << ','; + rv << max_tape_id; + rv << ','; + rv << min_workunit_id; + rv << ','; + rv << max_workunit_id; + rv << ','; + rv << min_result_id; + rv << ','; + rv << max_result_id; + rv << ','; + rv << min_time; + rv << ','; + rv << max_time; + rv << ','; + rv << central_baseband_freq; + rv << ','; + rv << baseband_freq_width; + rv << ','; + rv << central_detection_freq; + rv << ','; + rv << detection_freq_width; + rv << ','; + rv << central_period; + rv << ','; + rv << period_width; + rv << ','; + rv << fft_len_flags; + rv << ','; + rv << signal_type_flags; + rv << ','; + rv << ra; + rv << ','; + rv << dec; + rv << ','; + rv << angular_distance; + return rv.str(); +} + + +std::string rfi_zone::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + rv << xml_indent() << "" << min_receiver_s4id << "\n"; + rv << xml_indent() << "" << max_receiver_s4id << "\n"; + rv << xml_indent() << "" << min_splitter_config << "\n"; + rv << xml_indent() << "" << max_splitter_config << "\n"; + rv << xml_indent() << "" << min_analysis_config << "\n"; + rv << xml_indent() << "" << max_analysis_config << "\n"; + rv << xml_indent() << "" << min_tape_id << "\n"; + rv << xml_indent() << "" << max_tape_id << "\n"; + rv << xml_indent() << "" << min_workunit_id << "\n"; + rv << xml_indent() << "" << max_workunit_id << "\n"; + rv << xml_indent() << "" << min_result_id << "\n"; + rv << xml_indent() << "" << max_result_id << "\n"; + rv << xml_indent() << "" << min_time << "\n"; + rv << xml_indent() << "" << max_time << "\n"; + rv << xml_indent() << "" << central_baseband_freq << "\n"; + rv << xml_indent() << "" << baseband_freq_width << "\n"; + rv << xml_indent() << "" << central_detection_freq << "\n"; + rv << xml_indent() << "" << detection_freq_width << "\n"; + rv << xml_indent() << "" << central_period << "\n"; + rv << xml_indent() << "" << period_width << "\n"; + rv << xml_indent() << "" << fft_len_flags << "\n"; + rv << xml_indent() << "" << signal_type_flags << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << dec << "\n"; + rv << xml_indent() << "" << angular_distance << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void rfi_zone::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"min_receiver_s4id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_receiver_s4id; + } + if (extract_xml_record(field,"max_receiver_s4id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_receiver_s4id; + } + if (extract_xml_record(field,"min_splitter_config",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_splitter_config; + } + if (extract_xml_record(field,"max_splitter_config",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_splitter_config; + } + if (extract_xml_record(field,"min_analysis_config",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_analysis_config; + } + if (extract_xml_record(field,"max_analysis_config",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_analysis_config; + } + if (extract_xml_record(field,"min_tape_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_tape_id; + } + if (extract_xml_record(field,"max_tape_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_tape_id; + } + if (extract_xml_record(field,"min_workunit_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_workunit_id; + } + if (extract_xml_record(field,"max_workunit_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_workunit_id; + } + if (extract_xml_record(field,"min_result_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_result_id; + } + if (extract_xml_record(field,"max_result_id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_result_id; + } + if (extract_xml_record(field,"min_time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> min_time; + } + if (extract_xml_record(field,"max_time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_time; + } + if (extract_xml_record(field,"central_baseband_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> central_baseband_freq; + } + if (extract_xml_record(field,"baseband_freq_width",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> baseband_freq_width; + } + if (extract_xml_record(field,"central_detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> central_detection_freq; + } + if (extract_xml_record(field,"detection_freq_width",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq_width; + } + if (extract_xml_record(field,"central_period",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> central_period; + } + if (extract_xml_record(field,"period_width",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> period_width; + } + if (extract_xml_record(field,"fft_len_flags",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len_flags; + } + if (extract_xml_record(field,"signal_type_flags",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> signal_type_flags; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"dec",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> dec; + } + if (extract_xml_record(field,"angular_distance",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> angular_distance; + } + } + } + + void rfi_zone::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + std::istringstream row(*(s[1])); + row >> min_receiver_s4id; + } + { + std::istringstream row(*(s[2])); + row >> max_receiver_s4id; + } + { + std::istringstream row(*(s[3])); + row >> min_splitter_config; + } + { + std::istringstream row(*(s[4])); + row >> max_splitter_config; + } + { + std::istringstream row(*(s[5])); + row >> min_analysis_config; + } + { + std::istringstream row(*(s[6])); + row >> max_analysis_config; + } + { + std::istringstream row(*(s[7])); + row >> min_tape_id; + } + { + std::istringstream row(*(s[8])); + row >> max_tape_id; + } + { + std::istringstream row(*(s[9])); + row >> min_workunit_id; + } + { + std::istringstream row(*(s[10])); + row >> max_workunit_id; + } + { + std::istringstream row(*(s[11])); + row >> min_result_id; + } + { + std::istringstream row(*(s[12])); + row >> max_result_id; + } + { + std::istringstream row(*(s[13])); + row >> min_time; + } + { + std::istringstream row(*(s[14])); + row >> max_time; + } + { + std::istringstream row(*(s[15])); + row >> central_baseband_freq; + } + { + std::istringstream row(*(s[16])); + row >> baseband_freq_width; + } + { + std::istringstream row(*(s[17])); + row >> central_detection_freq; + } + { + std::istringstream row(*(s[18])); + row >> detection_freq_width; + } + { + std::istringstream row(*(s[19])); + row >> central_period; + } + { + std::istringstream row(*(s[20])); + row >> period_width; + } + { + std::istringstream row(*(s[21])); + row >> fft_len_flags; + } + { + std::istringstream row(*(s[22])); + row >> signal_type_flags; + } + { + std::istringstream row(*(s[23])); + row >> ra; + } + { + std::istringstream row(*(s[24])); + row >> dec; + } + { + std::istringstream row(*(s[25])); + row >> angular_distance; + } + } + + void rfi_zone::parse(const std::string &s) { + SQL_ROW row(&s,26); + parse(row); + } + +template <> const char * const db_table::table_name="bad_data"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=3; +template <> const char * const db_table::column_names[3]={"name","beam""reason"}; + +bad_data::bad_data() : + db_table(*this,-1), + beam(0) +{ + db_open(); + name[0]=0; + reason[0]=0; +} + + +bad_data::bad_data(const bad_data &a) : + db_table(*this,-1), + beam(a.beam) +{ + db_open(); + strcpy(name,a.name); + strcpy(reason,a.reason); +} + + +bad_data::bad_data(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +bad_data::bad_data(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +bad_data &bad_data::operator =(const bad_data &a) { + if (&a != this) { + beam=a.beam; + strcpy(name,a.name); + strcpy(reason,a.reason); + } + return (*this); +} + + +std::string bad_data::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<3;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string bad_data::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string bad_data::select_format() const +{ +std::string rv(""); +for (int i=0; i<2;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string bad_data::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + rv << "'" << name << "'"; + rv << ','; + rv << beam; + rv << ','; + rv << "'" << reason << "'"; + return rv.str(); +} + + +std::string bad_data::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + { + std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + rv << xml_indent() << "" << beam << "\n"; + { + std::string enc_field=xml_encode_string(reason,std::min(strlen(reason),sizeof(reason))); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void bad_data::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"name",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)128)); + name[std::min(in.size(),(size_t)127)]=0; + } + if (extract_xml_record(field,"beam",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> beam; + } + if (extract_xml_record(field,"reason",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::string::size_type epos=sub.find("<",pos); + if (epos==std::string::npos) epos=sub.find('\n',pos); + if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos); + std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos)); + strncpy(reason,(const char *)&(in.front()),std::min(in.size(),(size_t)255)); + reason[std::min(in.size(),(size_t)254)]=0; + } + } + } + + void bad_data::parse(const SQL_ROW &s) { + { + strncpy(name,s[0]->c_str(),128); + name[127]=0; + } + { + std::istringstream row(*(s[1])); + row >> beam; + } + { + strncpy(reason,s[2]->c_str(),255); + reason[254]=0; + } + } + + void bad_data::parse(const std::string &s) { + SQL_ROW row(&s,3); + parse(row); + } + +template <> const char * const db_table::table_name="spike_tinysky"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=16; +template <> const char * const db_table::column_names[16]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"}; + +spike_tinysky::spike_tinysky() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0) +{ + db_open(); +} + + +spike_tinysky::spike_tinysky(const spike_tinysky &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved) +{ + db_open(); +} + + +spike_tinysky::spike_tinysky(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +spike_tinysky::spike_tinysky(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +spike_tinysky &spike_tinysky::operator =(const spike_tinysky &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + } + return (*this); +} + + +std::string spike_tinysky::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<16;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string spike_tinysky::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string spike_tinysky::select_format() const +{ +std::string rv(""); +for (int i=0; i<15;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string spike_tinysky::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + return rv.str(); +} + + +std::string spike_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void spike_tinysky::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + } + } + + void spike_tinysky::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + } + + void spike_tinysky::parse(const std::string &s) { + SQL_ROW row(&s,16); + parse(row); + } + +template <> const char * const db_table::table_name="gaussian_tinysky"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=22; +template <> const char * const db_table::column_names[22]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","sigma","chisqr","null_chisqr","score","max_power","pot"}; + +gaussian_tinysky::gaussian_tinysky() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0), + sigma(0), + chisqr(0), + null_chisqr(0), + score(0), + max_power(0), + pot((unsigned char *)0,0,_x_csv) +{ + db_open(); +} + + +gaussian_tinysky::gaussian_tinysky(const gaussian_tinysky &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved), + sigma(a.sigma), + chisqr(a.chisqr), + null_chisqr(a.null_chisqr), + score(a.score), + max_power(a.max_power), + pot(a.pot) +{ + db_open(); +} + + +gaussian_tinysky::gaussian_tinysky(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +gaussian_tinysky::gaussian_tinysky(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +gaussian_tinysky &gaussian_tinysky::operator =(const gaussian_tinysky &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + sigma=a.sigma; + chisqr=a.chisqr; + null_chisqr=a.null_chisqr; + score=a.score; + max_power=a.max_power; + pot=a.pot; + } + return (*this); +} + + +std::string gaussian_tinysky::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<22;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string gaussian_tinysky::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string gaussian_tinysky::select_format() const +{ +std::string rv(""); +for (int i=0; i<21;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string gaussian_tinysky::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + rv << ','; + rv << sigma; + rv << ','; + rv << chisqr; + rv << ','; + rv << null_chisqr; + rv << ','; + rv << score; + rv << ','; + rv << max_power; + rv << ','; + rv << "" << pot.print_hex() ; + return rv.str(); +} + + +std::string gaussian_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << sigma << "\n"; + rv << xml_indent() << "" << chisqr << "\n"; + rv << xml_indent() << "" << null_chisqr << "\n"; + rv << xml_indent() << "" << score << "\n"; + rv << xml_indent() << "" << max_power << "\n"; + if (pot.size()) { + std::string enc_field=xml_encode_string(pot,pot.encoding); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void gaussian_tinysky::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"sigma",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> sigma; + } + if (extract_xml_record(field,"chisqr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chisqr; + } + if (extract_xml_record(field,"null_chisqr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> null_chisqr; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + if (extract_xml_record(field,"max_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> max_power; + } + if (extract_xml_record(field,"pot",sub)) { + std::istringstream in(sub.c_str()); + in >> pot; + } + } + } + + void gaussian_tinysky::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + { + std::istringstream row(*(s[16])); + row >> sigma; + } + { + std::istringstream row(*(s[17])); + row >> chisqr; + } + { + std::istringstream row(*(s[18])); + row >> null_chisqr; + } + { + std::istringstream row(*(s[19])); + row >> score; + } + { + std::istringstream row(*(s[20])); + row >> max_power; + } + { + pot=sqlblob(*(s[21])); + } + } + + void gaussian_tinysky::parse(const std::string &s) { + SQL_ROW row(&s,22); + parse(row); + } + +template <> const char * const db_table::table_name="pulse_tinysky"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=22; +template <> const char * const db_table::column_names[22]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period","snr","thresh","score","len_prof","pot"}; + +pulse_tinysky::pulse_tinysky() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0), + period(0), + snr(0), + thresh(0), + score(0), + len_prof(0), + pot((unsigned char *)0,0,_x_csv) +{ + db_open(); +} + + +pulse_tinysky::pulse_tinysky(const pulse_tinysky &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved), + period(a.period), + snr(a.snr), + thresh(a.thresh), + score(a.score), + len_prof(a.len_prof), + pot(a.pot) +{ + db_open(); +} + + +pulse_tinysky::pulse_tinysky(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +pulse_tinysky::pulse_tinysky(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +pulse_tinysky &pulse_tinysky::operator =(const pulse_tinysky &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + period=a.period; + snr=a.snr; + thresh=a.thresh; + score=a.score; + len_prof=a.len_prof; + pot=a.pot; + } + return (*this); +} + + +std::string pulse_tinysky::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<22;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string pulse_tinysky::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string pulse_tinysky::select_format() const +{ +std::string rv(""); +for (int i=0; i<21;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string pulse_tinysky::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + rv << ','; + rv << period; + rv << ','; + rv << snr; + rv << ','; + rv << thresh; + rv << ','; + rv << score; + rv << ','; + rv << len_prof; + rv << ','; + rv << "" << pot.print_hex() ; + return rv.str(); +} + + +std::string pulse_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << period << "\n"; + rv << xml_indent() << "" << snr << "\n"; + rv << xml_indent() << "" << thresh << "\n"; + rv << xml_indent() << "" << score << "\n"; + rv << xml_indent() << "" << len_prof << "\n"; + if (pot.size()) { + std::string enc_field=xml_encode_string(pot,pot.encoding); + rv << xml_indent() << ""; + rv << enc_field << "\n"; + } + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void pulse_tinysky::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"period",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> period; + } + if (extract_xml_record(field,"snr",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> snr; + } + if (extract_xml_record(field,"thresh",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> thresh; + } + if (extract_xml_record(field,"score",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> score; + } + if (extract_xml_record(field,"len_prof",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> len_prof; + } + if (extract_xml_record(field,"pot",sub)) { + std::istringstream in(sub.c_str()); + in >> pot; + } + } + } + + void pulse_tinysky::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + { + std::istringstream row(*(s[16])); + row >> period; + } + { + std::istringstream row(*(s[17])); + row >> snr; + } + { + std::istringstream row(*(s[18])); + row >> thresh; + } + { + std::istringstream row(*(s[19])); + row >> score; + } + { + std::istringstream row(*(s[20])); + row >> len_prof; + } + { + pot=sqlblob(*(s[21])); + } + } + + void pulse_tinysky::parse(const std::string &s) { + SQL_ROW row(&s,22); + parse(row); + } + +template <> const char * const db_table::table_name="triplet_tinysky"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=17; +template <> const char * const db_table::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period"}; + +triplet_tinysky::triplet_tinysky() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0), + period(0) +{ + db_open(); +} + + +triplet_tinysky::triplet_tinysky(const triplet_tinysky &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved), + period(a.period) +{ + db_open(); +} + + +triplet_tinysky::triplet_tinysky(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +triplet_tinysky::triplet_tinysky(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +triplet_tinysky &triplet_tinysky::operator =(const triplet_tinysky &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + period=a.period; + } + return (*this); +} + + +std::string triplet_tinysky::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<17;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string triplet_tinysky::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string triplet_tinysky::select_format() const +{ +std::string rv(""); +for (int i=0; i<16;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string triplet_tinysky::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + rv << ','; + rv << period; + return rv.str(); +} + + +std::string triplet_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + rv << xml_indent() << "" << period << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void triplet_tinysky::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + if (extract_xml_record(field,"period",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> period; + } + } + } + + void triplet_tinysky::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> freq; + } + { + std::istringstream row(*(s[9])); + row >> detection_freq; + } + { + std::istringstream row(*(s[10])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[11])); + row >> fft_len; + } + { + std::istringstream row(*(s[12])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[13])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[14])); + row >> rfi_found; + } + { + std::istringstream row(*(s[15])); + row >> reserved; + } + { + std::istringstream row(*(s[16])); + row >> period; + } + } + + void triplet_tinysky::parse(const std::string &s) { + SQL_ROW row(&s,17); + parse(row); + } + +template <> const char * const db_table::table_name="autocorr_tinysky"; +template <> const char * db_table::_search_tag=table_name; +template <> const int db_table::_nfields=17; +template <> const char * const db_table::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","delay","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"}; + +autocorr_tinysky::autocorr_tinysky() : + db_table(*this,-1), + id(0), + result_id(), + peak_power(0), + mean_power(0), + time(0), + ra(0), + decl(0), + q_pix(0), + delay(0), + freq(0), + detection_freq(0), + barycentric_freq(0), + fft_len(0), + chirp_rate(0), + rfi_checked(0), + rfi_found(0), + reserved(0) +{ + db_open(); +} + + +autocorr_tinysky::autocorr_tinysky(const autocorr_tinysky &a) : + db_table(*this,-1), + id(a.id), + result_id(a.result_id), + peak_power(a.peak_power), + mean_power(a.mean_power), + time(a.time), + ra(a.ra), + decl(a.decl), + q_pix(a.q_pix), + delay(a.delay), + freq(a.freq), + detection_freq(a.detection_freq), + barycentric_freq(a.barycentric_freq), + fft_len(a.fft_len), + chirp_rate(a.chirp_rate), + rfi_checked(a.rfi_checked), + rfi_found(a.rfi_found), + reserved(a.reserved) +{ + db_open(); +} + + +autocorr_tinysky::autocorr_tinysky(const SQL_ROW &a) : + db_table(*this,-1) +{ + db_open(); + parse(a); +} + + +autocorr_tinysky::autocorr_tinysky(const std::string &s,const char *tag) : + db_table(*this,-1) +{ + db_open(); + if (xml_match_tag(s,tag)) { + parse_xml(s,tag); + } else { + parse(s); + } +} + + +autocorr_tinysky &autocorr_tinysky::operator =(const autocorr_tinysky &a) { + if (&a != this) { + id=a.id; + result_id=a.result_id; + peak_power=a.peak_power; + mean_power=a.mean_power; + time=a.time; + ra=a.ra; + decl=a.decl; + q_pix=a.q_pix; + delay=a.delay; + freq=a.freq; + detection_freq=a.detection_freq; + barycentric_freq=a.barycentric_freq; + fft_len=a.fft_len; + chirp_rate=a.chirp_rate; + rfi_checked=a.rfi_checked; + rfi_found=a.rfi_found; + reserved=a.reserved; + } + return (*this); +} + + +std::string autocorr_tinysky::update_format() const +{ std::ostringstream rv(""); + + for (int i=2;i<17;i++) rv << "?,"; + rv << "?"; + return rv.str(); +} + + +std::string autocorr_tinysky::insert_format() const +{ return std::string("?,")+update_format(); +} + +std::string autocorr_tinysky::select_format() const +{ +std::string rv(""); +for (int i=0; i<16;i++) rv+="?,"; +rv+="?"; +return rv; +} + +std::string autocorr_tinysky::print(int full_subtables, int show_ids, int no_refs) const +{ std::ostringstream rv(""); + + rv.precision(14); + if (show_ids) rv << id; + rv << ','; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print(full_subtables,show_ids,no_refs); + } else { + rv << result_id.id; + } + } + rv << ','; + rv << peak_power; + rv << ','; + rv << mean_power; + rv << ','; + rv << time; + rv << ','; + rv << ra; + rv << ','; + rv << decl; + rv << ','; + rv << q_pix; + rv << ','; + rv << delay; + rv << ','; + rv << freq; + rv << ','; + rv << detection_freq; + rv << ','; + rv << barycentric_freq; + rv << ','; + rv << fft_len; + rv << ','; + rv << chirp_rate; + rv << ','; + rv << rfi_checked; + rv << ','; + rv << rfi_found; + rv << ','; + rv << reserved; + return rv.str(); +} + + +std::string autocorr_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const +{ + std::ostringstream rv(""); + + rv.precision(14); + rv << xml_indent() << '<' << tag << ">\n"; + xml_indent(2); + if (show_ids) rv << xml_indent() << "" << id << "\n"; + if (!no_refs) { + if (full_subtables) { + rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id"); + } else { + rv << xml_indent() << "" << result_id.id << "\n"; + } + } + rv << xml_indent() << "" << peak_power << "\n"; + rv << xml_indent() << "" << mean_power << "\n"; + rv << xml_indent() << "\n"; + rv << xml_indent() << "" << ra << "\n"; + rv << xml_indent() << "" << decl << "\n"; + rv << xml_indent() << "" << q_pix << "\n"; + rv << xml_indent() << "" << delay << "\n"; + rv << xml_indent() << "" << freq << "\n"; + rv << xml_indent() << "" << detection_freq << "\n"; + rv << xml_indent() << "" << barycentric_freq << "\n"; + rv << xml_indent() << "" << fft_len << "\n"; + rv << xml_indent() << "" << chirp_rate << "\n"; + rv << xml_indent() << "" << rfi_checked << "\n"; + rv << xml_indent() << "" << rfi_found << "\n"; + rv << xml_indent() << "" << reserved << "\n"; + xml_indent(-2); + rv << xml_indent() << "\n"; + return rv.str(); +} + + + void autocorr_tinysky::parse_xml(const std::string &s,const char *tag) { + std::string field,sub; + if (extract_xml_record(s,tag,field)) { + std::string::size_type pos=0; + if (extract_xml_record(field,"id",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> id; + } + if (extract_xml_record(field,"result_id",sub)) { + result_id.parse_xml(sub,"result_id"); + } + if (extract_xml_record(field,"peak_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> peak_power; + } + if (extract_xml_record(field,"mean_power",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> mean_power; + } + if (extract_xml_record(field,"time",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> time; + } + if (extract_xml_record(field,"ra",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> ra; + } + if (extract_xml_record(field,"decl",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> decl; + } + if (extract_xml_record(field,"q_pix",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> q_pix; + } + if (extract_xml_record(field,"delay",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> delay; + } + if (extract_xml_record(field,"freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> freq; + } + if (extract_xml_record(field,"detection_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> detection_freq; + } + if (extract_xml_record(field,"barycentric_freq",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> barycentric_freq; + } + if (extract_xml_record(field,"fft_len",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> fft_len; + } + if (extract_xml_record(field,"chirp_rate",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> chirp_rate; + } + if (extract_xml_record(field,"rfi_checked",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_checked; + } + if (extract_xml_record(field,"rfi_found",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> rfi_found; + } + if (extract_xml_record(field,"reserved",sub)) { + pos=sub.find(">"); + do { pos++; } while(sub[pos]=='\n'); + std::istringstream in(sub.c_str()+pos); + in >> reserved; + } + } + } + + void autocorr_tinysky::parse(const SQL_ROW &s) { + { + std::istringstream row(*(s[0])); + row >> id; + } + { + result_id.parse(SQL_ROW(s[1],0)); + } + { + std::istringstream row(*(s[2])); + row >> peak_power; + } + { + std::istringstream row(*(s[3])); + row >> mean_power; + } + { + std::istringstream row(*(s[4])); + row >> time; + } + { + std::istringstream row(*(s[5])); + row >> ra; + } + { + std::istringstream row(*(s[6])); + row >> decl; + } + { + std::istringstream row(*(s[7])); + row >> q_pix; + } + { + std::istringstream row(*(s[8])); + row >> delay; + } + { + std::istringstream row(*(s[9])); + row >> freq; + } + { + std::istringstream row(*(s[10])); + row >> detection_freq; + } + { + std::istringstream row(*(s[11])); + row >> barycentric_freq; + } + { + std::istringstream row(*(s[12])); + row >> fft_len; + } + { + std::istringstream row(*(s[13])); + row >> chirp_rate; + } + { + std::istringstream row(*(s[14])); + row >> rfi_checked; + } + { + std::istringstream row(*(s[15])); + row >> rfi_found; + } + { + std::istringstream row(*(s[16])); + row >> reserved; + } + } + + void autocorr_tinysky::parse(const std::string &s) { + SQL_ROW row(&s,17); + parse(row); + } + diff --git a/db/schema_master.h b/db/schema_master.h new file mode 100644 index 0000000..491e38e --- /dev/null +++ b/db/schema_master.h @@ -0,0 +1,1643 @@ +// This file is automatically generated. Do not edit +#ifndef _H_schema_master_H +#define _H_schema_master_H +extern const char *db_name; +extern int db_is_open; + +#if !defined(CLIENT) && !defined(NEBULA) +inline int db_open() { + if (!db_is_open) db_is_open=sql_database(db_name); + return db_is_open; } +inline int db_close() { + if (db_is_open) db_is_open=!sql_finish(); + return !db_is_open; } +inline int db_change(const char *name) { + if(strcmp(db_name, name) || !db_is_open) { + db_close(); + db_name=name; + db_open(); } return(db_is_open); } +#else +inline int db_open() { return (db_is_open=1); } +inline int db_close() { return !(db_is_open=0); } +inline int db_change() { return (db_is_open=1); } +#ifdef NEBULA +typedef long sqlint8_t; +template +struct db_reference { + ID_TYPE id; + void parse_xml(std::string &buf, const char *tag) {}; + void parse(const std::string &buf) {}; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const {}; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=1, const char *tag=0) const {}; + void parse(const SQL_ROW&) {}; +}; +#endif //NEBULA + +#endif //CLIENT || NEBULA + +class coordinate_t : public db_type { + public: + double time; + double ra; + double dec; + coordinate_t(); + coordinate_t(const coordinate_t &a); + coordinate_t(const SQL_ROW &a); + coordinate_t(const std::string &s,const char *tag="coordinate_t"); + coordinate_t &operator =(const coordinate_t &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="coordinate_t") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="coordinate_t"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class chirp_parameter_t : public db_type { + public: + double chirp_limit; + long fft_len_flags; + chirp_parameter_t(); + chirp_parameter_t(const chirp_parameter_t &a); + chirp_parameter_t(const SQL_ROW &a); + chirp_parameter_t(const std::string &s,const char *tag="chirp_parameter_t"); + chirp_parameter_t &operator =(const chirp_parameter_t &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="chirp_parameter_t") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="chirp_parameter_t"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class subband_description_t : public db_type { + public: + long number; + double center; + double base; + double sample_rate; + subband_description_t(); + subband_description_t(const subband_description_t &a); + subband_description_t(const SQL_ROW &a); + subband_description_t(const std::string &s,const char *tag="subband_description_t"); + subband_description_t &operator =(const subband_description_t &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="subband_description_t") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="subband_description_t"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class data_description_t : public db_type { + public: + double start_ra; + double start_dec; + double end_ra; + double end_dec; + double true_angle_range; + char time_recorded[255]; + double time_recorded_jd; + long nsamples; + sqlblob coords ; + data_description_t(); + data_description_t(const data_description_t &a); + data_description_t(const SQL_ROW &a); + data_description_t(const std::string &s,const char *tag="data_description_t"); + data_description_t &operator =(const data_description_t &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="data_description_t") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="data_description_t"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class receiver_config : public db_table { + public: + long id; + long s4_id; + char name[255]; + double beam_width; + double center_freq; + double latitude; + double longitude; + double elevation; + double glat; + double glon; + double galt; + double diameter; + double az_orientation; + sqlblob az_corr_coeff ; + sqlblob zen_corr_coeff ; + double array_az_ellipse; + double array_za_ellipse; + double array_angle; + long min_vgc; + char polarization[32]; + receiver_config(); + receiver_config(const receiver_config &a); + receiver_config(const SQL_ROW &a); + receiver_config(const std::string &s,const char *tag="receiver_config"); + receiver_config &operator =(const receiver_config &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="receiver_config") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="receiver_config"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class recorder_config : public db_table { + public: + long id; + char name[64]; + long bits_per_sample; + double sample_rate; + long beams; + double version; + recorder_config(); + recorder_config(const recorder_config &a); + recorder_config(const SQL_ROW &a); + recorder_config(const std::string &s,const char *tag="recorder_config"); + recorder_config &operator =(const recorder_config &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="recorder_config") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="recorder_config"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class splitter_config : public db_table { + public: + long id; + double version; + char data_type[64]; + long fft_len; + long ifft_len; + char filter[64]; + char window[64]; + long samples_per_wu; + double highpass; + char blanker_filter[64]; + long pfb_ntaps; + double pfb_width_factor; + long wu_bits_per_sample; + splitter_config(); + splitter_config(const splitter_config &a); + splitter_config(const SQL_ROW &a); + splitter_config(const std::string &s,const char *tag="splitter_config"); + splitter_config &operator =(const splitter_config &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="splitter_config") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="splitter_config"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class analysis_config : public db_table { + public: + long id; + double spike_thresh; + long spikes_per_spectrum; + double autocorr_thresh; + long autocorr_per_spectrum; + long autocorr_fftlen; + double gauss_null_chi_sq_thresh; + double gauss_chi_sq_thresh; + double gauss_power_thresh; + double gauss_peak_power_thresh; + long gauss_pot_length; + double pulse_thresh; + double pulse_display_thresh; + long pulse_max; + long pulse_min; + long pulse_fft_max; + long pulse_pot_length; + double triplet_thresh; + long triplet_max; + long triplet_min; + long triplet_pot_length; + double pot_overlap_factor; + double pot_t_offset; + double pot_min_slew; + double pot_max_slew; + double chirp_resolution; + long analysis_fft_lengths; + long bsmooth_boxcar_length; + long bsmooth_chunk_size; + sqlblob chirps ; + double pulse_beams; + long max_signals; + long max_spikes; + long max_autocorr; + long max_gaussians; + long max_pulses; + long max_triplets; + long keyuniq; + double credit_rate; + analysis_config(); + analysis_config(const analysis_config &a); + analysis_config(const SQL_ROW &a); + analysis_config(const std::string &s,const char *tag="analysis_config"); + analysis_config &operator =(const analysis_config &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="analysis_config") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="analysis_config"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class science_config : public db_table { + public: + long id; + long active; + char qpix_scheme[16]; + long qpix_nside; + double fpix_width; + double total_bandwidth; + double freq_uncertainty; + double fwhm_beamwidth; + double sky_disc_radius; + double observable_sky; + long epoch; + double bary_chirp_window; + long bary_freq_window; + long nonbary_freq_window; + double spike_obs_duration; + double spike_obs_interval; + double gauss_obs_duration; + double gauss_obs_interval; + double pulse_obs_duration; + double pulse_obs_interval; + double triplet_obs_duration; + double triplet_obs_interval; + sqlint8_t min_spike_id; + sqlint8_t min_autocorr_id; + sqlint8_t min_gaussian_id; + sqlint8_t min_pulse_id; + sqlint8_t min_triplet_id; + double min_app_version; + char info_xml[255]; + science_config(); + science_config(const science_config &a); + science_config(const SQL_ROW &a); + science_config(const std::string &s,const char *tag="science_config"); + science_config &operator =(const science_config &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="science_config") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="science_config"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class candidate_t : public db_type { + public: + long type; + sqlint8_t id; + long num_obs; + double score; + long is_rfi; + candidate_t(); + candidate_t(const candidate_t &a); + candidate_t(const SQL_ROW &a); + candidate_t(const std::string &s,const char *tag="candidate_t"); + candidate_t &operator =(const candidate_t &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="candidate_t") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="candidate_t"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class meta_candidate : public db_table { + public: + sqlint8_t id; + long version; + double time_last_updated; + long num_spikes; + long num_spike_b_multiplets; + double best_spike_b_mp_score; + long num_spike_nb_multiplets; + double best_spike_nb_mp_score; + sqlint8_t spike_high_id; + long num_gaussians; + long num_gaussian_b_multiplets; + double best_gaussian_b_mp_score; + long num_gaussian_nb_multiplets; + double best_gaussian_nb_mp_score; + sqlint8_t gaussian_high_id; + long num_pulses; + long num_pulse_b_multiplets; + double best_pulse_b_mp_score; + long num_pulse_nb_multiplets; + double best_pulse_nb_mp_score; + sqlint8_t pulse_high_id; + long num_triplets; + long num_triplet_b_multiplets; + double best_triplet_b_mp_score; + long num_triplet_nb_multiplets; + double best_triplet_nb_mp_score; + sqlint8_t triplet_high_id; + long num_stars; + double best_star_score; + double meta_score; + long rfi_clean; + long state; + meta_candidate(); + meta_candidate(const meta_candidate &a); + meta_candidate(const SQL_ROW &a); + meta_candidate(const std::string &s,const char *tag="meta_candidate"); + meta_candidate &operator =(const meta_candidate &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="meta_candidate") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="meta_candidate"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class meta_candidate_tinysky : public db_table { + public: + sqlint8_t id; + long version; + double time_last_updated; + long num_spikes; + long num_spike_b_multiplets; + double best_spike_b_mp_score; + long num_spike_nb_multiplets; + double best_spike_nb_mp_score; + sqlint8_t spike_high_id; + long num_gaussians; + long num_gaussian_b_multiplets; + double best_gaussian_b_mp_score; + long num_gaussian_nb_multiplets; + double best_gaussian_nb_mp_score; + sqlint8_t gaussian_high_id; + long num_pulses; + long num_pulse_b_multiplets; + double best_pulse_b_mp_score; + long num_pulse_nb_multiplets; + double best_pulse_nb_mp_score; + sqlint8_t pulse_high_id; + long num_triplets; + long num_triplet_b_multiplets; + double best_triplet_b_mp_score; + long num_triplet_nb_multiplets; + double best_triplet_nb_mp_score; + sqlint8_t triplet_high_id; + long num_stars; + double best_star_score; + double meta_score; + long rfi_clean; + long state; + meta_candidate_tinysky(); + meta_candidate_tinysky(const meta_candidate_tinysky &a); + meta_candidate_tinysky(const SQL_ROW &a); + meta_candidate_tinysky(const std::string &s,const char *tag="meta_candidate_tinysky"); + meta_candidate_tinysky &operator =(const meta_candidate_tinysky &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="meta_candidate_tinysky") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="meta_candidate_tinysky"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class multiplet : public db_table { + public: + long id; + long version; + long signal_type; + long mp_type; + long qpix; + double freq_win; + double mean_ra; + double mean_decl; + double ra_stddev; + double decl_stddev; + double mean_angular_distance; + double angular_distance_stddev; + double mean_frequency; + double frequency_stddev; + double mean_chirp; + double chirp_stddev; + double mean_period; + double period_stddev; + double mean_snr; + double snr_stddev; + double mean_threshold; + double threshold_stddev; + double score; + long num_detections; + sqlblob signal_ids ; + multiplet(); + multiplet(const multiplet &a); + multiplet(const SQL_ROW &a); + multiplet(const std::string &s,const char *tag="multiplet"); + multiplet &operator =(const multiplet &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="multiplet") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="multiplet"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class star : public db_table { + public: + long id; + char object_type[16]; + char catalog_name[64]; + long catalog_number; + char object_name[64]; + double ra; + double decl; + long qpix; + double v_mag; + double b_minus_v; + double parallax; + char stellar_type[32]; + long planets; + double score; + star(); + star(const star &a); + star(const SQL_ROW &a); + star(const std::string &s,const char *tag="star"); + star &operator =(const star &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="star") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="star"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class candidate_count : public db_table { + public: + long id; + sqlint8_t spikes; + sqlint8_t gaussians; + sqlint8_t pulses; + sqlint8_t triplets; + sqlint8_t spike_barycentric_multiplets; + sqlint8_t gaussian_barycentric_multiplets; + sqlint8_t pulse_barycentric_multiplets; + sqlint8_t triplet_barycentric_multiplets; + sqlint8_t spike_nonbarycentric_multiplets; + sqlint8_t gaussian_nonbarycentric_multiplets; + sqlint8_t pulse_nonbarycentric_multiplets; + sqlint8_t triplet_nonbarycentric_multiplets; + sqlint8_t stars; + long time_last_updated; + candidate_count(); + candidate_count(const candidate_count &a); + candidate_count(const SQL_ROW &a); + candidate_count(const std::string &s,const char *tag="candidate_count"); + candidate_count &operator =(const candidate_count &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="candidate_count") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="candidate_count"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class tape : public db_table { + public: + long id; + char name[128]; + double start_time; + double last_block_time; + long last_block_done; + long missed; + long tape_quality; + long beam; + tape(); + tape(const tape &a); + tape(const SQL_ROW &a); + tape(const std::string &s,const char *tag="tape"); + tape &operator =(const tape &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="tape") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="tape"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class settings : public db_table { + public: + long id; + long active; + db_reference recorder_cfg; + db_reference splitter_cfg; + db_reference analysis_cfg; + db_reference receiver_cfg; + settings(); + settings(const settings &a); + settings(const SQL_ROW &a); + settings(const std::string &s,const char *tag="settings"); + settings &operator =(const settings &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="settings") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="settings"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class workunit_grp : public db_table { + public: + long id; + db_reference tape_info; + char name[128]; + data_description_t data_desc; + db_reference receiver_cfg; + db_reference recorder_cfg; + db_reference splitter_cfg; + db_reference analysis_cfg; + long sb_id; + long iq_modified; + long alfa_filter_bank; + workunit_grp(); + workunit_grp(const workunit_grp &a); + workunit_grp(const SQL_ROW &a); + workunit_grp(const std::string &s,const char *tag="workunit_grp"); + workunit_grp &operator =(const workunit_grp &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="workunit_grp") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="workunit_grp"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class workunit_header : public db_table { + public: + sqlint8_t id; + char name[128]; + db_reference group_info; + subband_description_t subband_desc; + sqlint8_t sb_id; + workunit_header(); + workunit_header(const workunit_header &a); + workunit_header(const SQL_ROW &a); + workunit_header(const std::string &s,const char *tag="workunit_header"); + workunit_header &operator =(const workunit_header &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="workunit_header") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="workunit_header"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +typedef workunit_header workunit; +class result : public db_table { + public: + sqlint8_t id; + sqlint8_t boinc_result; + db_reference wuid; + double received; + long hostid; + long versionid; + long return_code; + long overflow; + long reserved; + sqlint8_t sb_id; + result(); + result(const result &a); + result(const SQL_ROW &a); + result(const std::string &s,const char *tag="result"); + result &operator =(const result &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="result") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="result"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class triplet : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + double period; + triplet(); + triplet(const triplet &a); + triplet(const SQL_ROW &a); + triplet(const std::string &s,const char *tag="triplet"); + triplet &operator =(const triplet &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="triplet") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="triplet"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class triplet_small : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + double period; + triplet_small(); + triplet_small(const triplet_small &a); + triplet_small(const SQL_ROW &a); + triplet_small(const std::string &s,const char *tag="triplet_small"); + triplet_small &operator =(const triplet_small &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="triplet_small") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="triplet_small"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class gaussian : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + double sigma; + double chisqr; + double null_chisqr; + double score; + double max_power; + sqlblob pot; + gaussian(); + gaussian(const gaussian &a); + gaussian(const SQL_ROW &a); + gaussian(const std::string &s,const char *tag="gaussian"); + gaussian &operator =(const gaussian &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="gaussian") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="gaussian"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class gaussian_small : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + double sigma; + double chisqr; + double null_chisqr; + double score; + double max_power; + gaussian_small(); + gaussian_small(const gaussian_small &a); + gaussian_small(const SQL_ROW &a); + gaussian_small(const std::string &s,const char *tag="gaussian_small"); + gaussian_small &operator =(const gaussian_small &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="gaussian_small") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="gaussian_small"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class pulse : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + double period; + double snr; + double thresh; + double score; + long len_prof; + sqlblob pot; + pulse(); + pulse(const pulse &a); + pulse(const SQL_ROW &a); + pulse(const std::string &s,const char *tag="pulse"); + pulse &operator =(const pulse &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="pulse") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="pulse"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class pulse_small : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + double period; + double snr; + double thresh; + double score; + pulse_small(); + pulse_small(const pulse_small &a); + pulse_small(const SQL_ROW &a); + pulse_small(const std::string &s,const char *tag="pulse_small"); + pulse_small &operator =(const pulse_small &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="pulse_small") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="pulse_small"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class sah_pointing : public db_table { + public: + long time_id; + double time; + double ra; + double dec; + long q_pix; + double angle_range; + long bad; + sah_pointing(); + sah_pointing(const sah_pointing &a); + sah_pointing(const SQL_ROW &a); + sah_pointing(const std::string &s,const char *tag="sah_pointing"); + sah_pointing &operator =(const sah_pointing &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="sah_pointing") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="sah_pointing"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class sky_map : public db_table { + public: + sqlint8_t npix; + long qpix; + long fpix; + sqlint8_t spike_max_id; + sqlint8_t gaussian_max_id; + sqlint8_t pulse_max_id; + sqlint8_t triplet_max_id; + long spike_count; + long gaussian_count; + long pulse_count; + long triplet_count; + long new_data; + double score; + sky_map(); + sky_map(const sky_map &a); + sky_map(const SQL_ROW &a); + sky_map(const std::string &s,const char *tag="sky_map"); + sky_map &operator =(const sky_map &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="sky_map") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="sky_map"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class hotpix : public db_table { + public: + long id; + long last_hit_time; + hotpix(); + hotpix(const hotpix &a); + hotpix(const SQL_ROW &a); + hotpix(const std::string &s,const char *tag="hotpix"); + hotpix &operator =(const hotpix &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="hotpix") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="hotpix"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class hotpix_tinysky : public db_table { + public: + long id; + long last_hit_time; + hotpix_tinysky(); + hotpix_tinysky(const hotpix_tinysky &a); + hotpix_tinysky(const SQL_ROW &a); + hotpix_tinysky(const std::string &s,const char *tag="hotpix_tinysky"); + hotpix_tinysky &operator =(const hotpix_tinysky &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="hotpix_tinysky") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="hotpix_tinysky"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class spike : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + spike(); + spike(const spike &a); + spike(const SQL_ROW &a); + spike(const std::string &s,const char *tag="spike"); + spike &operator =(const spike &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="spike") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="spike"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class spike_small : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + spike_small(); + spike_small(const spike_small &a); + spike_small(const SQL_ROW &a); + spike_small(const std::string &s,const char *tag="spike_small"); + spike_small &operator =(const spike_small &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="spike_small") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="spike_small"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class autocorr : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double delay; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + autocorr(); + autocorr(const autocorr &a); + autocorr(const SQL_ROW &a); + autocorr(const std::string &s,const char *tag="autocorr"); + autocorr &operator =(const autocorr &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="autocorr") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="autocorr"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class autocorr_small : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double delay; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + autocorr_small(); + autocorr_small(const autocorr_small &a); + autocorr_small(const SQL_ROW &a); + autocorr_small(const std::string &s,const char *tag="autocorr_small"); + autocorr_small &operator =(const autocorr_small &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="autocorr_small") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="autocorr_small"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class classic_versions : public db_table { + public: + long id; + long ver_major; + long ver_minor; + long platformid; + char comment[254]; + char filename[254]; + char md5_cksum[254]; + char sum_cksum[254]; + char cksum_cksum[254]; + long file_cksum; + classic_versions(); + classic_versions(const classic_versions &a); + classic_versions(const SQL_ROW &a); + classic_versions(const std::string &s,const char *tag="classic_versions"); + classic_versions &operator =(const classic_versions &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="classic_versions") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="classic_versions"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class classic_active_versions : public db_table { + public: + long id; + long versionid; + long ver_major; + long ver_minor; + classic_active_versions(); + classic_active_versions(const classic_active_versions &a); + classic_active_versions(const SQL_ROW &a); + classic_active_versions(const std::string &s,const char *tag="classic_active_versions"); + classic_active_versions &operator =(const classic_active_versions &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="classic_active_versions") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="classic_active_versions"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class classic_active_versionids : public db_table { + public: + long id; + long versionid; + classic_active_versionids(); + classic_active_versionids(const classic_active_versionids &a); + classic_active_versionids(const SQL_ROW &a); + classic_active_versionids(const std::string &s,const char *tag="classic_active_versionids"); + classic_active_versionids &operator =(const classic_active_versionids &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="classic_active_versionids") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="classic_active_versionids"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class rfi_zone : public db_table { + public: + long id; + long min_receiver_s4id; + long max_receiver_s4id; + long min_splitter_config; + long max_splitter_config; + long min_analysis_config; + long max_analysis_config; + long min_tape_id; + long max_tape_id; + sqlint8_t min_workunit_id; + sqlint8_t max_workunit_id; + sqlint8_t min_result_id; + sqlint8_t max_result_id; + double min_time; + double max_time; + double central_baseband_freq; + double baseband_freq_width; + double central_detection_freq; + double detection_freq_width; + double central_period; + double period_width; + long fft_len_flags; + long signal_type_flags; + double ra; + double dec; + double angular_distance; + rfi_zone(); + rfi_zone(const rfi_zone &a); + rfi_zone(const SQL_ROW &a); + rfi_zone(const std::string &s,const char *tag="rfi_zone"); + rfi_zone &operator =(const rfi_zone &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="rfi_zone") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="rfi_zone"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class bad_data : public db_table { + public: + char name[128]; + long beam; + char reason[255]; + bad_data(); + bad_data(const bad_data &a); + bad_data(const SQL_ROW &a); + bad_data(const std::string &s,const char *tag="bad_data"); + bad_data &operator =(const bad_data &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="bad_data") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="bad_data"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class spike_tinysky : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + spike_tinysky(); + spike_tinysky(const spike_tinysky &a); + spike_tinysky(const SQL_ROW &a); + spike_tinysky(const std::string &s,const char *tag="spike_tinysky"); + spike_tinysky &operator =(const spike_tinysky &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="spike_tinysky") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="spike_tinysky"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class gaussian_tinysky : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + double sigma; + double chisqr; + double null_chisqr; + double score; + double max_power; + sqlblob pot; + gaussian_tinysky(); + gaussian_tinysky(const gaussian_tinysky &a); + gaussian_tinysky(const SQL_ROW &a); + gaussian_tinysky(const std::string &s,const char *tag="gaussian_tinysky"); + gaussian_tinysky &operator =(const gaussian_tinysky &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="gaussian_tinysky") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="gaussian_tinysky"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class pulse_tinysky : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + double period; + double snr; + double thresh; + double score; + long len_prof; + sqlblob pot; + pulse_tinysky(); + pulse_tinysky(const pulse_tinysky &a); + pulse_tinysky(const SQL_ROW &a); + pulse_tinysky(const std::string &s,const char *tag="pulse_tinysky"); + pulse_tinysky &operator =(const pulse_tinysky &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="pulse_tinysky") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="pulse_tinysky"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class triplet_tinysky : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + double period; + triplet_tinysky(); + triplet_tinysky(const triplet_tinysky &a); + triplet_tinysky(const SQL_ROW &a); + triplet_tinysky(const std::string &s,const char *tag="triplet_tinysky"); + triplet_tinysky &operator =(const triplet_tinysky &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="triplet_tinysky") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="triplet_tinysky"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +class autocorr_tinysky : public db_table { + public: + sqlint8_t id; + db_reference result_id; + double peak_power; + double mean_power; + double time; + double ra; + double decl; + sqlint8_t q_pix; + double delay; + double freq; + double detection_freq; + double barycentric_freq; + long fft_len; + double chirp_rate; + long rfi_checked; + long rfi_found; + long reserved; + autocorr_tinysky(); + autocorr_tinysky(const autocorr_tinysky &a); + autocorr_tinysky(const SQL_ROW &a); + autocorr_tinysky(const std::string &s,const char *tag="autocorr_tinysky"); + autocorr_tinysky &operator =(const autocorr_tinysky &a); + std::string update_format() const; + std::string insert_format() const; + std::string select_format() const; + std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const; + std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="autocorr_tinysky") const; + void parse(const SQL_ROW &s); + void parse(const std::string &s); + void parse_xml(const std::string &s,const char *tag="autocorr_tinysky"); +#ifdef NEBULA + bool nebula_read(FILE *f); +#endif + private: +}; + + +#endif diff --git a/db/schema_master.sql b/db/schema_master.sql new file mode 100644 index 0000000..d8df6c0 --- /dev/null +++ b/db/schema_master.sql @@ -0,0 +1,1073 @@ +-- Copyright 2003 Regents of the University of California + +-- SETI_BOINC is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. + +-- SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +-- more details. + +-- You should have received a copy of the GNU General Public License along +-- with SETI_BOINC; see the file COPYING. If not, write to the Free Software +-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +-- In addition, as a special exception, the Regents of the University of +-- California give permission to link the code of this program with libraries +-- that provide specific optimized fast Fourier transform (FFT) functions and +-- distribute a linked executable. You must obey the GNU General Public +-- License in all respects for all of the code used other than the FFT library +-- itself. Any modification required to support these libraries must be +-- distributed in source code form. If you modify this file, you may extend +-- this exception to your version of the file, but you are not obligated to +-- do so. If you do not wish to do so, delete this exception statement from +-- your version. + + +create database sah2b@sah_master_tcp in sah2dbs; -- informix + + +create row type coordinate_t +( + time float, + ra float, + dec float +); + + + +create row type chirp_parameter_t + ( + chirp_limit smallfloat, + fft_len_flags integer -- bitfield + ); + + + +create row type subband_description_t + ( + number integer, + center float, + base float, + sample_rate float + ); + + + +create row type data_description_t + ( + start_ra float, + start_dec float, + end_ra float, + end_dec float, + true_angle_range smallfloat, + time_recorded varchar(255), + time_recorded_jd float, + nsamples integer, + coords list(coordinate_t not null) + ); + + +create table receiver_config + ( + id serial primary key, + s4_id integer unique, + name varchar(255) unique, + beam_width smallfloat, -- degrees + center_freq float, -- MHz + latitude float, + longitude float, + elevation float, + glat float, + glon float, + galt float, + diameter smallfloat, + az_orientation float, + az_corr_coeff list(float not null), + zen_corr_coeff list(float not null), + array_az_ellipse float default 0 not null, + array_za_ellipse float default 0 not null, + array_angle float default 0 not null, + min_vgc integer default 0, + polarization char(32) + ); + + + +create table recorder_config + ( + id serial primary key, + name char(64), + bits_per_sample integer, + sample_rate float, + beams integer, + version smallfloat unique + ); + + + +create table splitter_config + ( + id serial primary key, + version smallfloat, + data_type char(64), + fft_len integer, + ifft_len integer, + filter char(64), + window char(64), + samples_per_wu integer default 1048576 not null, + highpass smallfloat default 0 not null, + blanker_filter char(64) default "none" not null, + pfb_ntaps integer not null, + pfb_width_factor smallfloat not null, + wu_bits_per_sample integer default 2 not null + ); + + + + +create table analysis_config + ( + id serial primary key, + spike_thresh smallfloat, + spikes_per_spectrum integer, + autocorr_thresh smallfloat, + autocorr_per_spectrum integer, + autocorr_fftlen integer, + gauss_null_chi_sq_thresh smallfloat, + gauss_chi_sq_thresh smallfloat, + gauss_power_thresh smallfloat, + gauss_peak_power_thresh smallfloat, + gauss_pot_length integer, + pulse_thresh smallfloat, + pulse_display_thresh smallfloat, + pulse_max integer, + pulse_min integer, + pulse_fft_max integer, + pulse_pot_length integer, + triplet_thresh smallfloat, + triplet_max integer, + triplet_min integer, + triplet_pot_length integer, + pot_overlap_factor smallfloat, + pot_t_offset smallfloat, + pot_min_slew smallfloat, + pot_max_slew smallfloat, + chirp_resolution float, + analysis_fft_lengths integer, -- bitfield + bsmooth_boxcar_length integer, + bsmooth_chunk_size integer, + chirps list(chirp_parameter_t not null), + pulse_beams smallfloat, + max_signals integer, + max_spikes integer, + max_autocorr integer, + max_gaussians integer, + max_pulses integer, + max_triplets integer, + keyuniq integer, + credit_rate smallfloat + ); + +create table science_config + ( + id serial primary key, + active integer not null, + qpix_scheme char(16) not null, + qpix_nside integer not null, + fpix_width float not null, + total_bandwidth float not null, + freq_uncertainty float not null, + fwhm_beamwidth float not null, + sky_disc_radius float not null, + observable_sky float not null, + epoch integer not null, + bary_chirp_window float not null, + bary_freq_window integer not null, + nonbary_freq_window integer not null, + spike_obs_duration float not null, + spike_obs_interval float not null, + gauss_obs_duration float not null, + gauss_obs_interval float not null, + pulse_obs_duration float not null, + pulse_obs_interval float not null, + triplet_obs_duration float not null, + triplet_obs_interval float not null, + min_spike_id int8, + min_autocorr_id int8, + min_gaussian_id int8, + min_pulse_id int8, + min_triplet_id int8, + min_app_version float not null, + info_xml varchar(255) + ); + + +create row type candidate_t + ( + type integer not null, + id int8 not null, + num_obs integer not null, + score float not null, + is_rfi integer not null -- bitfield + ); + + +create table meta_candidate + ( + id serial8 not null, + version integer not null, + time_last_updated float not null, + num_spikes integer not null, + num_spike_b_multiplets integer not null, + best_spike_b_mp_score float not null, + num_spike_nb_multiplets integer not null, + best_spike_nb_mp_score float not null, + spike_high_id int8 not null, + num_gaussians integer not null, + num_gaussian_b_multiplets integer not null, + best_gaussian_b_mp_score float not null, + num_gaussian_nb_multiplets integer not null, + best_gaussian_nb_mp_score float not null, + gaussian_high_id int8 not null, + num_pulses integer not null, + num_pulse_b_multiplets integer not null, + best_pulse_b_mp_score float not null, + num_pulse_nb_multiplets integer not null, + best_pulse_nb_mp_score float not null, + pulse_high_id int8 not null, + num_triplets integer not null, + num_triplet_b_multiplets integer not null, + best_triplet_b_mp_score float not null, + num_triplet_nb_multiplets integer not null, + best_triplet_nb_mp_score float not null, + triplet_high_id int8 not null, + num_stars integer not null, + best_star_score float not null, + meta_score float not null, + rfi_clean integer, + state smallint -- 0 : the ntpckr has (re)scored this MC - rfi should look at it + -- 1 : the signal set has changed - ntpckr should look at it + -- 2 : this is a stable and clean candidate + ); + +create table meta_candidate_tinysky + ( + id serial8 not null, + version integer not null, + time_last_updated float not null, + num_spikes integer not null, + num_spike_b_multiplets integer not null, + best_spike_b_mp_score float not null, + num_spike_nb_multiplets integer not null, + best_spike_nb_mp_score float not null, + spike_high_id int8 not null, + num_gaussians integer not null, + num_gaussian_b_multiplets integer not null, + best_gaussian_b_mp_score float not null, + num_gaussian_nb_multiplets integer not null, + best_gaussian_nb_mp_score float not null, + gaussian_high_id int8 not null, + num_pulses integer not null, + num_pulse_b_multiplets integer not null, + best_pulse_b_mp_score float not null, + num_pulse_nb_multiplets integer not null, + best_pulse_nb_mp_score float not null, + pulse_high_id int8 not null, + num_triplets integer not null, + num_triplet_b_multiplets integer not null, + best_triplet_b_mp_score float not null, + num_triplet_nb_multiplets integer not null, + best_triplet_nb_mp_score float not null, + triplet_high_id int8 not null, + num_stars integer not null, + best_star_score float not null, + meta_score float not null, + rfi_clean integer, + state smallint -- 0 : the ntpckr has (re)scored this MC - rfi should look at it + -- 1 : the signal set has changed - ntpckr should look at it + -- 2 : this is a stable and clean candidate + ); + +create table multiplet + ( + id serial primary key, + version integer not null, + signal_type int not null, + mp_type int not null, + qpix integer not null, + freq_win float not null, + mean_ra float not null, + mean_decl float not null, + ra_stddev float not null, + decl_stddev float not null, + mean_angular_distance float not null, + angular_distance_stddev float not null, + mean_frequency float not null, + frequency_stddev float not null, + mean_chirp float not null, + chirp_stddev float not null, + mean_period float not null, + period_stddev float not null, + mean_snr float not null, + snr_stddev float not null, + mean_threshold float not null, + threshold_stddev float not null, + score float not null, + num_detections integer not null, + signal_ids list(int8 not null) + ) + fragment by expression + (mod(id,4)=0) in page_8k_dbs5, + (mod(id,4)=1) in page_8k_dbs6, + (mod(id,4)=2) in page_8k_dbs7, + (mod(id,4)=3) in page_8k_dbs8 + extent size 209714 next size 204714; + +create table star + ( + id integer not null, + object_type varchar(16) not null, + catalog_name varchar(64), + catalog_number integer, + object_name varchar(64), + ra smallfloat not null, + decl smallfloat not null, + qpix integer, + v_mag smallfloat, + b_minus_v smallfloat, + parallax smallfloat, + stellar_type varchar(32), + planets integer, + score smallfloat + ); + +create table candidate_count + ( + id integer not null, + spikes int8 not null, + gaussians int8 not null, + pulses int8 not null, + triplets int8 not null, + spike_barycentric_multiplets int8 not null, + gaussian_barycentric_multiplets int8 not null, + pulse_barycentric_multiplets int8 not null, + triplet_barycentric_multiplets int8 not null, + spike_nonbarycentric_multiplets int8 not null, + gaussian_nonbarycentric_multiplets int8 not null, + pulse_nonbarycentric_multiplets int8 not null, + triplet_nonbarycentric_multiplets int8 not null, + stars int8 not null, + time_last_updated integer not null + ); + +create table tape + ( + id serial primary key, + name char(128) not null , + start_time float not null , + last_block_time float not null , + last_block_done integer not null , + missed integer not null , + tape_quality integer, + beam integer default 0 not null +-- , + -- unique (name,beam) constraint uniq_namebeam + ); + + + +create table settings ( + id serial primary key, + active integer, + recorder_cfg integer references recorder_config, + splitter_cfg integer references splitter_config, + analysis_cfg integer references analysis_config, + receiver_cfg integer references receiver_config +); + + + + +create table workunit_grp + ( + id serial primary key, + tape_info integer not null , --references tape + name char(128) not null , + data_desc data_description_t, + receiver_cfg integer references receiver_config, + recorder_cfg integer references recorder_config, + splitter_cfg integer references splitter_config, + analysis_cfg integer references analysis_config, + sb_id integer, + iq_modified integer, + alfa_filter_bank smallint + ); + + + +create table workunit_header + ( + id serial8 primary key, + name char(128) not null , + group_info integer not null , -- references workunit_grp + subband_desc subband_description_t, + sb_id int8 + ) + fragment by expression + (mod(id,4)=0) in other_dbs001, + (mod(id,4)=1) in other_dbs002, + (mod(id,4)=2) in other_dbs003, + (mod(id,4)=3) in other_dbs004 + extent size 209714 next size 204714; + +create synonym workunit for workunit_header; + + + +create table result + ( + id serial8 primary key, + boinc_result int8 not null, + wuid int8 not null , -- references workunit_header + received float not null, + hostid integer not null, + versionid integer not null, + return_code integer not null, + overflow smallint not null, + reserved integer not null, + sb_id int8 + ) + fragment by expression + (mod(id,4)=0) in other_dbs001, + (mod(id,4)=1) in other_dbs002, + (mod(id,4)=2) in other_dbs003, + (mod(id,4)=3) in other_dbs004 + extent size 209714 next size 204714; + + + +create table triplet + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer, + period smallfloat not null + ) + fragment by expression + (mod(id,4)=0) in page_16k_dbs1, + (mod(id,4)=1) in page_16k_dbs2, + (mod(id,4)=2) in page_16k_dbs3, + (mod(id,4)=3) in page_16k_dbs4 + extent size 1048576 next size 1048576; + +create table triplet_small + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer, + period smallfloat not null + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + + +create table gaussian + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer, + sigma smallfloat not null , + chisqr smallfloat not null , + null_chisqr smallfloat not null , + score smallfloat not null , + max_power smallfloat, + pot byte -- binary + ) + fragment by expression + (mod(id,4)=0) in page_16k_dbs5, + (mod(id,4)=1) in page_16k_dbs6, + (mod(id,4)=2) in page_16k_dbs7, + (mod(id,4)=3) in page_16k_dbs8 + extent size 1048576 next size 1048576; + +create table gaussian_small + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer, + sigma smallfloat not null , + chisqr smallfloat not null , + null_chisqr smallfloat not null , + score smallfloat not null , + max_power smallfloat + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + + +create table pulse + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer, + period smallfloat not null , + snr smallfloat not null , + thresh smallfloat not null , + score smallfloat not null , + len_prof smallint not null , + pot byte -- binary + ) + fragment by expression + (mod(id,4)=0) in other_dbs001, + (mod(id,4)=1) in other_dbs002, + (mod(id,4)=2) in other_dbs003, + (mod(id,4)=3) in other_dbs004 + extent size 209714 next size 204714; + +create table pulse_small + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer, + period smallfloat not null , + snr smallfloat not null , + thresh smallfloat not null , + score smallfloat not null + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + +create table sah_pointing + ( + time_id integer not null , + time float not null , + ra float not null , + dec float not null , + q_pix integer not null, + angle_range float not null , + bad smallint + ); + + +create table sky_map + ( + npix int8, -- the primary search key + qpix int, -- for fast spatial maps + fpix int, -- for fast frequency maps + spike_max_id int8 , + gaussian_max_id int8, + pulse_max_id int8, + triplet_max_id int8, + spike_count int, + gaussian_count int, + pulse_count int, + triplet_count int, + new_data smallint, -- a boolean + score float + ); + +create table hotpix + ( + id int, -- qpix + last_hit_time int + ); + +create table hotpix_tinysky + ( + id int, -- qpix + last_hit_time int + ); + +create table spike + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer + ) + fragment by expression + (mod(id,4)=0) in spike21_dbs, + (mod(id,4)=1) in spike22_dbs, + (mod(id,4)=2) in spike23_dbs, + (mod(id,4)=3) in spike24_dbs + extent size 2047100 next size 2047100; + +create table spike_small + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + + +create table autocorr + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + delay float not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer + ) + fragment by expression + (mod(id,4)=0) in page_16k_dbs9, + (mod(id,4)=1) in page_16k_dbs10, + (mod(id,4)=2) in page_16k_dbs11, + (mod(id,4)=3) in page_16k_dbs12 + extent size 1048576 next size 1048576; + +create table autocorr_small + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + delay float not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + + +create table classic_versions + ( + id serial not null, + ver_major integer not null, + ver_minor integer not null, + platformid integer not null, + comment char(254), + filename char(254), + md5_cksum char(254), + sum_cksum char(254), + cksum_cksum char(254), + file_cksum integer not null + ); + + + +create table classic_active_versions + ( + id integer, + versionid integer, + ver_major integer, + ver_minor integer + ); + + + +create table classic_active_versionids + ( + id integer, + versionid integer + ); + +create table rfi_zone + ( + id serial not null, + min_receiver_s4id integer not null, + max_receiver_s4id integer not null, + min_splitter_config integer not null, + max_splitter_config integer not null, + min_analysis_config integer not null, + max_analysis_config integer not null, + min_tape_id integer not null, + max_tape_id integer not null, + min_workunit_id int8 not null, + max_workunit_id int8 not null, + min_result_id int8 not null, + max_result_id int8 not null, + min_time float not null, + max_time float not null, + central_baseband_freq float not null, + baseband_freq_width float not null, + central_detection_freq float not null, + detection_freq_width float not null, + central_period float not null, + period_width float not null, + fft_len_flags int not null, + signal_type_flags int not null, + ra float not null, + dec float not null, + angular_distance float not null + ); + +create table bad_data + ( + name char(128) not null, + beam integer default 0 not null, + reason varchar(255) + ); + +create table spike_tinysky + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + +create table gaussian_tinysky + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer, + sigma smallfloat not null , + chisqr smallfloat not null , + null_chisqr smallfloat not null , + score smallfloat not null , + max_power smallfloat , + pot byte -- binary + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + +create table pulse_tinysky + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer, + period smallfloat not null , + snr smallfloat not null , + thresh smallfloat not null , + score smallfloat not null , + len_prof smallint not null , + pot byte -- binary + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + +create table triplet_tinysky + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer, + period smallfloat not null + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + +create table autocorr_tinysky + ( + id serial8 not null , + result_id int8, -- references result + peak_power smallfloat not null , + mean_power smallfloat not null , + time float not null , + ra smallfloat not null , + decl smallfloat not null , + q_pix int8 not null , + delay float not null , + freq float not null , + detection_freq float not null, + barycentric_freq float not null, + fft_len integer not null , + chirp_rate smallfloat not null , + rfi_checked int, + rfi_found int, + reserved integer + ) + fragment by expression + (mod(id,4)=0) in small_sig_dbs1, + (mod(id,4)=1) in small_sig_dbs2, + (mod(id,4)=2) in small_sig_dbs3, + (mod(id,4)=3) in small_sig_dbs4 + extent size 209714 next size 204714; + + +create index spike_res on spike(result_id); + + +create index autocorr_res on autocorr(result_id); + + +create index gaussian_res on gaussian(result_id); + + +create index pulse_res on pulse(result_id); + + +create index triplet_res on triplet(result_id); + + +create index result_wu on result(wuid); + + +create index workunit_wu_grp on workunit(group_info); + + + +create index wugrp_tapenum on workunit(tape_info); +alter table workunit_grp add constraint (foreign key + (tape_info) references tape (id)); + + +create index wu_grpnum on workunit(group_info); +alter table workunit add constraint (foreign key (group_info) + references workunit_grp (id)); + + +create index res_wuid on result(wuid); +alter table result add constraint (foreign key (wuid) + references workunit_header (id)), + add constraint unique(boinc_result); + + +create index trip_res on triplet(result_id); +alter table triplet add constraint (foreign key (result_id) + references result (id)); + + +crete index gauss-res on gaussian(result_id); +alter table gaussian add constraint (foreign key (result_id) + references result (id)); + + +create index pulse_res on pulse(result_id); +alter table pulse add constraint (foreign key (result_id) + references result (id)); + + +create index spike_res on spike(result_id); +alter table spike add constraint (foreign key (result_id) + references result (id) constraint result_spike); + +create unique index namebeam on tape (name, beam); + +create index spike_tinysky_res on spike_tinysky(result_id); +create unique index spike_tinysky_id on spike_tinysky(id); +create index spike_tinysky_qpix on spike_tinysky(q_pix); + +create index gaussian_tinysky_res on gaussian_tinysky(result_id); +create unique index gaussian_tinysky_id on gaussian_tinysky(id); +create index gaussian_tinysky_qpix on gaussian_tinysky(q_pix); + +create index pulse_tinysky_res on pulse_tinysky(result_id); +create unique index pulse_tinysky_id on pulse_tinysky(id); +create index pulse_tinysky_qpix on pulse_tinysky(q_pix); + +create index triplet_tinysky_res on triplet_tinysky(result_id); +create unique index triplet_tinysky_id on triplet_tinysky(id); +create index triplet_tinysky_qpix on triplet_tinysky(q_pix); + +create index autocorr_tinysky_res on autocorr_tinysky(result_id); +create unique index autocorr_tinysky_id on autocorr_tinysky(id); +create index autocorr_tinysky_qpix on autocorr_tinysky(q_pix); diff --git a/db/schema_to_class.awk b/db/schema_to_class.awk new file mode 100644 index 0000000..3b50886 --- /dev/null +++ b/db/schema_to_class.awk @@ -0,0 +1,756 @@ +# Copyright 2003-2005 Regents of the University of California + +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +# SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with SETI_BOINC; see the file COPYING. If not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Copyright 2003-2005 Regents, University of California +# All rights reserved +# +# $Id: schema_to_class.awk,v 1.57.2.5 2007/03/29 01:08:22 korpela Exp $ +# +BEGIN { + print "processing BEGIN" + # Work around gawk FILENAME bug. + if ((FILENAME=="") || (FILENAME=="-")) { + tmpfilename=ARGV[ARGC-1] + headerfile=ARGV[ARGC-1]".h" + sourcefile=ARGV[ARGC-1]".cpp" + } else { + tmpfilename=FILENAME + headerfile=FILENAME".h" + sourcefile=FILENAME".cpp" + } + print "// This file is automatically generated. Do not edit" > sourcefile + print "// This file is automatically generated. Do not edit" > headerfile + print "#include \"sah_config.h\"" > sourcefile + print "" > sourcefile + print "#include " > sourcefile + print "#include " >sourcefile + print "#include " >sourcefile + print "#include " >sourcefile + print "#include " >sourcefile + print "#include " >sourcefile + print "#include " > sourcefile + print "" > sourcefile + print "#include \"parse.h\"" > sourcefile + print "#include \"xml_util.h\"" > sourcefile + print "#include \"db_table.h\"" >sourcefile + n=split(tmpfilename,a,"/") + print "#include \""a[n]".h\"" >sourcefile + print "\n#ifdef _WIN32" >sourcefile + print "#pragma warning( disable : 4355 )" >sourcefile + print "#endif\n" >sourcefile + print "#ifndef _H_"a[n]"_H" >headerfile + print "#define _H_"a[n]"_H" >headerfile + print "#define found(x) ((x != std::string::npos))" >sourcefile + print "" > sourcefile + nrefs=1 + nfields=1 + ref_table[1]="" + ref_row[1]="" + ref_rtable[1]="" + def_types[1]="no_types_defined" + ndef_types=1 + } +/^begin_refs/,/^end_refs/ \ + { + print "processing refs" + ref_table[nrefs]=$1 + ref_row[nrefs]=$2 + ref_rtable[nrefs++]=$3 + } + +/synonym/,/;/ \ + { + print "processing synonym" + if (index($5,";")) { + split($5,a,";") + tt=a[1] + } else { + tt=$5 + } + print "typedef "tt" "$3";" >headerfile + next + } +/database/,/;/ \ + { + dbtype="" + print "processing database" + for (i=0;isourcefile + print "using namespace "dbtype";" >sourcefile + print "#endif\n\n" >sourcefile + } + if (index(db_name,";")) { + split(db_name,a,";") + db_name=a[1] + } + print "extern const char *db_name;" >headerfile + print "const char *db_name=\""db_name"\";" >sourcefile + print "extern int db_is_open;\n" >headerfile + print "int db_is_open;\n" >sourcefile + print "#if !defined(CLIENT) && !defined(NEBULA)" >headerfile + print "inline int db_open() { \n\t if (!db_is_open) db_is_open=sql_database(db_name);\n\t return db_is_open; }" >headerfile + print "inline int db_close() { \n\t if (db_is_open) db_is_open=!sql_finish();\n\t return !db_is_open; }" >headerfile + print "inline int db_change(const char *name) { \n\t if(strcmp(db_name, name) || !db_is_open) { \n\t\t db_close();\n\t\t db_name=name;\n\t\t db_open(); } return(db_is_open); }" >headerfile + print "#else" >headerfile + print "inline int db_open() { return (db_is_open=1); }" >headerfile + print "inline int db_close() { return !(db_is_open=0); }" >headerfile + print "inline int db_change() { return (db_is_open=1); }" >headerfile + + print "#ifdef NEBULA" > headerfile + print "typedef sqlint8_t long;" > headerfile + print "template " > headerfile + print "struct db_reference {" > headerfile + print " ID_TYPE id;" > headerfile + print " void parse_xml(std::string &buf, const char *tag) {};" >headerfile + print " void parse(const std::string &buf) {};" >headerfile + print " std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const {};" > headerfile + print " std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=1, const char *tag=0) const {};" > headerfile + print "};" > headerfile + + print "#endif //NEBULA\n" >headerfile + print "#endif //CLIENT || NEBULA\n" >headerfile + next + } + +/{/ { + print "// "$0 > headerfile + print "// "$0 > sourcefile + while (!index($0,"}")) { + getline + print "// "$0 > headerfile + print "// "$0 > sourcefile + } + print "\n" >headerfile + print "\n" >sourcefile + next + } +/deprecated/ { next } +/alter/ { while (!index($0,";")) { getline } next } +/revoke/ { while (!index($0,";")) { getline } next } +/index/ { while (!index($0,";")) { getline } next } +/create[ \t]/ { + print "processing create" + if ($2 == "table") { + if (index($3,"\.")) { + n=split($3,a,"\.") + } else { + n=1 + a[n]=$3 + } + is_typedef=0 + } else { + if (index($4,"\.")) { + n=split($4,a,"\.") + } else { + n=1 + a[n]=$4 + } + is_typedef=1 + } + nfields=1 + fields[1]="" + type[1]="" + nsf=1 + sf[1]="" + sfz[1]=0 + table=a[n] + if (is_typedef) { + def_types[ndef_types++]=a[n] + print "class ",a[n], \ + " : public db_type<"a[n]"> {\n public:" \ + > headerfile + } else { + print "class ",a[n], \ + " : public db_table<"a[n]"> {\n public:" \ + > headerfile + } + } +/list\(/ { + print "processing list" + isref=0 + islist=1 + n=split($2,a,"(") + if (a[n] == "int8" || a[n] == "bigint" || a[n] == "integer8") { + a[n]="sqlint8_t" + } + type[nfields]="v "a[n] + fields[nfields++]=$1 + print "\tsqlblob<"a[n]"> ",$1,";" > headerfile + next + } +/integer8|bigint|int8/ { + print "processing integer8" + isref=0 + type[nfields]="ld" + if (index($NF,"bitfield")) type[nfields]="lb" + fields[nfields++]=$1 + for (i=1;i "ref_row[i]";" >headerfile + type[nfields-1]="r" + } + } + if (!isref) print "\tsqlint8_t ",$1";" > headerfile + if ($1=="id") { + id_type[table]="sqlint8_t " + id_name[table]=$1 + } + next + } +/[ \t]integer|[ \t]int/ { + print "processing integer" + isref=0 + type[nfields]="d" + fields[nfields++]=$1 + for (i=1;i "ref_row[i]";" >headerfile + type[nfields-1]="r" + } + } + if (!isref) print "\tlong ",$1";" > headerfile + if ($1=="id") { + id_type[table]="long" + id_name[table]=$1 + } + next + } +/[ \t]smallint|[ \t]mediumint/ { + print "processing smallint" + isref=0 + type[nfields]="d" + fields[nfields++]=$1 + for (i=1;i "ref_row[i]";" >headerfile + print ref_rtable[i],table"."ref_row[i] + type[nfields-1]="r" + } + } + if (!isref) print "\tlong ",$1";" > headerfile + if ($1=="id") { + id_type[table]="long" + id_name[table]=$1 + } + next + } +/serial8|bigint*auto_increment/ { + print "processing serial8" + key=$1 + type[nfields]="ld" + id_type[table]="sqlint8_t" + id_name[table]=$1 + fields[nfields++]=$1 + print "\tsqlint8_t ",$1";" > headerfile + next + } +/serial|auto_increment/ { + print "processing serial" + key=$1 + type[nfields]="d" + id_type[table]="long" + id_name[table]=$1 + fields[nfields++]=$1 + print "\tlong ",$1";" > headerfile + next + } +/smallfloat/ { + print "processing smallfloat" + type[nfields]="f" + fields[nfields++]=$1 + print "\tdouble ",$1";" > headerfile + next + } +/[ \t]float|[ \t]double/ { + print "processing float" + type[nfields]="f" + fields[nfields++]=$1 + print "\tdouble ",$1";" > headerfile + next + } +/char[ \t\(]|[ \t]byte/ { + print "processing char" + type[nfields]="s" + for (i=0;i headerfile + } else { + print "\tsqlblob ",$1";" >headerfile; + } + next + } +/,/ { + print "processing ," + for (i=1;iheaderfile + next + } + } + } +/./ { + print "processing ." + for (i=1;iheaderfile + next + } + } + } +/;/ { + print "processing ; nfields=",nfields + if (nfields!=1) { + firstcomma=0 + for (i=(nfields-1);i;i--) { + if (firstcomma) { + comma[i]="," + } else { + comma[i]="" + } + if (type[i]!="s") firstcomma=1 + } + print "\t"table"();" >headerfile + print "\t"table"(const "table" &a);" >headerfile + print "\t"table"(const SQL_ROW &a);" >headerfile + print "\t"table"(const std::string &s,const char *tag=\""table"\");" >headerfile + print "\t"table" &operator =(const "table" &a);" >headerfile + print "\tstd::string update_format() const;" >headerfile + print "\tstd::string insert_format() const;" >headerfile + print "\tstd::string select_format() const;" >headerfile + print "\tstd::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;" >headerfile + print "\tstd::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag=\""table"\") const;" >headerfile + print "\tvoid parse(const SQL_ROW &s);" >headerfile + print "\tvoid parse(const std::string &s);" >headerfile + print "\tvoid parse_xml(const std::string &s,const char *tag=\""table"\");" >headerfile + print "#ifdef NEBULA\n\tbool nebula_read(FILE *f);\n#endif" >headerfile + print " private:\n};\n\n" >headerfile + if (is_typedef) { + print "template <> const char * const db_type<"table">::type_name=\""table"\";" >sourcefile + print "template <> const char * db_type<"table">::_search_tag=type_name;" >sourcefile + print "template <> const int db_type<"table">::_nfields="nfields-1";" >sourcefile + printf("template <> const char * const db_type<%s>::column_names[%d]={",table,nfields-1) >sourcefile + } else { + print "template <> const char * const db_table<"table">::table_name=\""table"\";" >sourcefile + print "template <> const char * db_table<"table">::_search_tag=table_name;" >sourcefile + print "template <> const int db_table<"table">::_nfields="nfields-1";" >sourcefile + printf("template <> const char * const db_table<%s>::column_names[%d]={",table,nfields-1) >sourcefile + } + for (i=1;isourcefile + print "};\n" >sourcefile + print table"::"table"() : " >sourcefile + if (is_typedef) { + print "\tdb_type<"table">(*this)," > sourcefile + } else { + print "\tdb_table<"table">(*this,-1)," > sourcefile + } + for (i=1;isourcefile + } else if ((type[i]=="r")||(type[i]=="t")) { + printf("\t%s()%s\n",fields[i],comma[i]) >sourcefile + } else if (type[i]=="b") { + printf("\t%s((unsigned char *)0,%d,_x_csv)%s\n",fields[i],arrlen[i],comma[i]) >sourcefile + } else if (index(type[i],"v")==1) { + n=split(type[i],a," ") + stype=a[n] + n=split(stype,a,"(") + stype=a[n] + sis_deftype=0 + for (n=1;nsourcefile + } else { + printf("\t%s((%s *)0,%d,_x_xml_values)%s\n",fields[i],stype,arrlen[i],comma[i]) >sourcefile + } + } + } + print "{\n\tdb_open();" >sourcefile + for (i=1;isourcefile + } + print "}\n\n" >sourcefile + + print table"::"table"(const "table" &a) : " >sourcefile + if (is_typedef) { + print "\tdb_type<"table">(*this)," > sourcefile + } else { + print "\tdb_table<"table">(*this,-1)," > sourcefile + } + for (i=1;isourcefile + } + print "{\n\tdb_open();" >sourcefile + for (i=1;isourcefile + } + print "}\n\n" >sourcefile + print table"::"table"(const SQL_ROW &a) : " >sourcefile + if (is_typedef) { + print "\tdb_type<"table">(*this)" > sourcefile + } else { + print "\tdb_table<"table">(*this,-1)" > sourcefile + } + print "{\n\tdb_open();" >sourcefile + print "\tparse(a);\n}\n\n" >sourcefile + print table"::"table"(const std::string &s,const char *tag) : " >sourcefile + #for (i=1;isourcefile + # } else if ((type[i]=="r")||(type[i]=="t")) { + # printf("\t%s(),\n",fields[i]) >sourcefile + # } + #} + if (is_typedef) { + print "\tdb_type<"table">(*this)" > sourcefile + } else { + print "\tdb_table<"table">(*this,-1)" > sourcefile + } + print "{\n\tdb_open();" >sourcefile + print "\tif (xml_match_tag(s,tag)) {" >sourcefile + print "\t parse_xml(s,tag);" >sourcefile + print "\t} else {\n\t parse(s);\n\t}\n}\n\n" >sourcefile + + print table" &"table"::operator =(const "table" &a) {" >sourcefile + print "\tif (&a != this) {" >sourcefile + for (i=1;isourcefile + } else { + if (index(type[i],"v") == 1) { + n=split(type[i],a," ") + stype=a[n] + n=split(stype,a,"(") + stype=a[n] + print "\t\t{" >sourcefile + print "\t\t "fields[i]".clear();" > sourcefile + print "\t\t std::vector<"stype">::const_iterator i(a."fields[i]".begin());" > sourcefile + print "\t\t for (;i!=a."fields[i]".end();i++) {" >sourcefile + print "\t\t "fields[i]".push_back(*i); " >sourcefile + print "\t\t }\n\t\t}" >sourcefile + } + } + } + for (i=1;isourcefile + } + print "\t}\n\treturn (*this);\n}\n\n" >sourcefile + + print "std::string "table"::update_format() const" >sourcefile + if (is_typedef) { + print "{\tstd::ostringstream rv(\"\");\n" >sourcefile + print "\trv << \"ROW(\";" >sourcefile + i=1 + } else { + print "{\tstd::ostringstream rv(\"\");\n" >sourcefile + i=2 + } + print "\tfor (int i="i";i<"nfields-1";i++) rv << \"?,\";" >sourcefile + print "\trv << \"?\";" >sourcefile + if (is_typedef) { + print "rv << \")\";\n" >sourcefile + } + print "\treturn rv.str();\n}\n\n" >sourcefile + + print "std::string "table"::insert_format() const" >sourcefile + if (is_typedef) { + print "{\treturn update_format();\n}\n" >sourcefile + } else { + print "{\treturn std::string(\"?,\")+update_format();\n}\n" >sourcefile + } + print "std::string "table"::select_format() const" >sourcefile + print "{\nstd::string rv(\"\");" >sourcefile + print "for (int i=0; i<"nfields-2";i++) rv+=\"?,\";" >sourcefile + print "rv+=\"?\";\nreturn rv;\n}\n" >sourcefile + + + + print "std::string "table"::print(int full_subtables, int show_ids, int no_refs) const" >sourcefile + print "{\tstd::ostringstream rv(\"\");\n" >sourcefile + print "\trv.precision(14);" >sourcefile + if (is_typedef) { + print "\trv << \"ROW(\";" >> sourcefile + } + for (i=1;isourcefile + print "\t if (full_subtables) {" > sourcefile + print "\t rv << "fields[i]".print(full_subtables,show_ids,no_refs);" > sourcefile + print "\t} else {" > sourcefile + print "\t rv << "fields[i]".id;" > sourcefile + + print "\t }\n\t}" > sourcefile + } else if (type[i] == "t") { + print "\trv << "fields[i]".print(full_subtables,show_ids,no_refs);" > sourcefile + } else if (index(type[i],"v")==1) { + n=split(type[i],a," ") + stype=a[n] + n=split(stype,a,"(") + stype=a[n] + print "\trv << \"LIST {\";" > sourcefile + print "\t{\n\tstd::vector<"stype">::const_iterator p="fields[i]".begin();" > sourcefile + print "\tfor (;p<"fields[i]".end();p++) {" > sourcefile + sis_deftype=0 + for (n=1;n sourcefile + } else { + print "\t rv << p->print();" >sourcefile + } + print "\t if (p != "fields[i]".end()-1) {" >sourcefile + print "\t rv << ',';" >sourcefile + print "\t } else {" >sourcefile + print "\t rv << \"}\";" >sourcefile + print "\t }" >sourcefile + print "\t}\n\t}" >sourcefile + } else if ((type[i]=="s")) { + print "\trv << \"'\" << "fields[i]" << \"'\";" >sourcefile + } else if ((type[i]=="b")) { + if (dbtype == "ifx") { + print "\trv << \"\" << "fields[i]".print_hex() ;" >sourcefile + } else { + print "\trv << \"\" << "fields[i]".print_raw() ;" >sourcefile + } + } else { + printf("\t") > sourcefile + if ((i==1) && (!is_typedef)) { + printf("if (show_ids) ") > sourcefile + } + print "rv << "fields[i]";" > sourcefile + } + if (i!=(nfields-1)) print "\trv << ',';" >sourcefile + } + if (is_typedef) { + print "\trv << \")\";" > sourcefile + } + print "\treturn rv.str();\n}\n\n" >sourcefile + + print "std::string "table"::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const " >sourcefile + print "{\n\tstd::ostringstream rv(\"\");\n" >sourcefile + print "\trv.precision(14);" >sourcefile + print "\trv << xml_indent() << '<' << tag << \">\\n\";" >sourcefile + print "\txml_indent(2);" >sourcefile + for (i=1;isourcefile + print "\t if (full_subtables) {" > sourcefile + print "\t rv << "fields[i]".print_xml(full_subtables,show_ids,no_refs,\""fields[i]"\");" > sourcefile + print "\t} else {" > sourcefile + print "\t rv << xml_indent() << \"<"fields[i]">\" << "fields[i]".id << \"\\n\";" > sourcefile + print "\t }\n\t}" > sourcefile + } else if (type[i] == "t") { + print "\trv << "fields[i]".print_xml(full_subtables,show_ids,no_refs,\""fields[i]"\");" > sourcefile + } else if (index(type[i],"v")==1) { + n=split(type[i],a," ") + stype=a[n] + n=split(stype,a,"(") + stype=a[n] + sis_deftype=0 + for (n=1;nsourcefile + print "\t rv << xml_indent() << \"<"fields[i]"\";" >sourcefile + print "\t {\n\t std::string enc_string="fields[i]".print_xml();" >sourcefile + if (!sis_deftype) { + print "\t rv << \" length=\" << enc_string.size() << \" encoding=\\\"\" << xml_encoding_names["fields[i]".encoding] << \"\\\">\" ;" >sourcefile + } else { + print "\t rv << \">\\n\" ;" >sourcefile + } + print "\t rv << enc_string;" >sourcefile + print "\t }\n}" >sourcefile + if (sis_deftype) print "\trv << xml_indent(-2);" > sourcefile + print "\trv << \"\\n\"; " >sourcefile + } else if (type[i]=="s") { + print "\t{\n\t std::string enc_field=xml_encode_string("fields[i]",std::min(strlen("fields[i]"),sizeof("fields[i]")));" > sourcefile + print "\t rv << xml_indent() << \"<"fields[i]">\";" > sourcefile + print "\t rv << enc_field << \"\\n\";" >sourcefile + print "\t}" >> sourcefile + } else if (type[i]=="b") { + print "\tif ("fields[i]".size()) {\n\t std::string enc_field=xml_encode_string("fields[i]","fields[i]".encoding);" > sourcefile + print "\t rv << xml_indent() << \"<"fields[i]" length=\" << enc_field.size() << \" encoding=\\\"\" << xml_encoding_names["fields[i]".encoding] << \"\\\">\"; "> sourcefile + print "\t rv << enc_field << \"\\n\";" >sourcefile + print "\t}" >> sourcefile + } else { + printf("\t") > sourcefile + if ((i==1) && (!is_typedef)) { + printf("if (show_ids) ") > sourcefile + } + print "rv << xml_indent() << \"<"fields[i]">\" << "fields[i]" << \"\\n\";" > sourcefile + } + } + print "\txml_indent(-2);" >sourcefile + print "\trv << xml_indent() << \"\\n\";" >sourcefile + print "\treturn rv.str();\n}\n\n" >sourcefile + print "\tvoid "table"::parse_xml(const std::string &s,const char *tag) {" >sourcefile + print "\t std::string field,sub;" > sourcefile + print "\t if (extract_xml_record(s,tag,field)) {" >sourcefile + print "\t std::string::size_type pos=0;" >sourcefile + for (i=1;i sourcefile + print "\t "fields[i]".parse_xml(sub,\""fields[i]"\");" >sourcefile + print "\t }" > sourcefile + } else if (index(type[i],"v")==1) { + n=split(type[i],a," ") + stype=a[n] + n=split(stype,a,"(") + stype=a[n] + sis_deftype=0 + for (n=1;nsourcefile + print "\t if (extract_xml_record(field,\""fields[i]"\",sub)) {" >sourcefile + if (sis_deftype) { + print "\t pos=0;" >sourcefile + print "\t while ((pos=sub.find(\"<"stype"\",pos)) != std::string::npos) { " >sourcefile + print "\t "fields[i]".push_back("stype"(std::string(sub.c_str()+pos))); " >sourcefile + print "\t pos=sub.find(\"sourcefile + print "\t pos=sub.find(\">\",pos);" >sourcefile + print "\t }" > sourcefile + } else { + print "\t pos=sub.find(\">\");" >sourcefile + print "\t do {" > sourcefile + print "\t if (pos!=std::string::npos) {" >sourcefile + print "\t do { pos++; } while ((sub[pos]=='\\n') || (sub[pos]==','));" >sourcefile + print "\t std::istringstream in(std::string(sub.c_str()+pos)); " >sourcefile + print "\t "stype" tmp;" >sourcefile + print "\t in >> tmp;" >sourcefile + print "\t "fields[i]".push_back(tmp);" >sourcefile + print "\t }" >sourcefile + print "\t } while ((pos=sub.find(\",\",pos)) != std::string::npos); " >sourcefile + } + print "\t }" > sourcefile + } else { + print "\t if (extract_xml_record(field,\""fields[i]"\",sub)) {" > sourcefile + if ((type[i] != "s") && (type[i] != "b")) { + print "\t pos=sub.find(\">\");" >sourcefile + print "\t do { pos++; } while(sub[pos]=='\\n');" >sourcefile + print "\t std::istringstream in(sub.c_str()+pos);" >sourcefile + print "\t in >> "fields[i]";" > sourcefile + } else if (type[i] == "b") { + print "\t std::istringstream in(sub.c_str());" >sourcefile + print "\t in >> "fields[i]";" >sourcefile + } else { + print "\t pos=sub.find(\">\");" >sourcefile + print "\t do { pos++; } while(sub[pos]=='\\n');" >sourcefile + print "\t std::string::size_type epos=sub.find(\"<\",pos);" >sourcefile + print "\t if (epos==std::string::npos) epos=sub.find('\\n',pos);" > sourcefile + print "\t if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);" > sourcefile + print "\t std::vector in(xml_decode_string((const char *)sub.c_str()+pos,epos-pos));" >sourcefile + print "\t strncpy("fields[i]",(const char *)&(in.front()),std::min(in.size(),(size_t)"arrlen[i]"));" >sourcefile + print "\t "fields[i]"[std::min(in.size(),(size_t)"arrlen[i]-1")]=0;" > sourcefile + } + print "\t }" >sourcefile + } + } + print "\t }" >sourcefile + print "\t }\n" >sourcefile + print "\tvoid "table"::parse(const SQL_ROW &s) {" >sourcefile + for (i=1;isourcefile + if (type[i]=="r" || type[i]=="t") { + print "\t "fields[i]".parse(SQL_ROW(s["i-1"],0));" >sourcefile + } else if (index(type[i],"v")==1) { + n=split(type[i],a," ") + stype=a[n] + n=split(stype,a,"(") + stype=a[n] + sis_deftype=0 + for (n=1;nsourcefile + print "\t int i;" >sourcefile + print "\t "fields[i]".clear();" >sourcefile + print "\t SQL_ROW tmp(s["i-1"]); ">sourcefile + if (sis_deftype) { + print "\t for (i=0;isourcefile + print "\t "fields[i]".push_back("stype"(SQL_ROW(tmp[i])));" >sourcefile + } else { + print "\t for (i=0;isourcefile + print "\t std::istringstream in(*(tmp[i]));" >sourcefile + print "\t "stype" tmp0;" >sourcefile + print "\t in >> tmp0;" >sourcefile + print "\t "fields[i]".push_back(tmp0);" >sourcefile + } + print "\t }" >sourcefile + } else { + if ((type[i] != "s") && (type[i] != "b")) { + print "\t std::istringstream row(*(s["i-1"]));" >sourcefile + print "\t row >> "fields[i]";" > sourcefile + } else if (type[i] == "b") { + print "\t "fields[i]"=sqlblob(*(s["i-1"]));" >sourcefile + } else { + print "\t strncpy("fields[i]",s["i-1"]->c_str(),"arrlen[i]");">sourcefile + print "\t "fields[i]"["arrlen[i]-1"]=0;" > sourcefile + } + } + print "\t }" >sourcefile + } + print "\t }\n" >sourcefile + print "\tvoid "table"::parse(const std::string &s) {" >sourcefile + print "\t SQL_ROW row(&s,"nfields-1");" >sourcefile + print "\t parse(row);" >sourcefile + print "\t }\n" >sourcefile + nfields=1 + } + } +END { + print "processing END" + print "#endif"> headerfile + } diff --git a/db/schema_to_class.in b/db/schema_to_class.in new file mode 100755 index 0000000..6edd68a --- /dev/null +++ b/db/schema_to_class.in @@ -0,0 +1,34 @@ +#!/bin/sh +# Copyright 2003 Regents of the University of California + +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +# SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public License along +# with SETI_BOINC; see the file COPYING. If not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +filename=/tmp/`echo $1 | @SED@ 's/\.sql//'` +echo begin_refs > $filename +@AWK@ -f @SAH_TOP_DIR@/db/find_references.awk $1 | @SED@ 's/[(),;]//g' | @SORT@ | @UNIQ@ >> $filename +echo end_refs >> $filename +@CAT@ $1 | @TR@ "[A-Z]" "[a-z]" | @SED@ 's/\`//g' >>$filename + +@AWK@ -f @SAH_TOP_DIR@/db/schema_to_class.awk $filename +INDENT=@INDENT@ +if test -n "$INDENT" +then + @INDENT@ @INDENT_FLAGS@ $filename.h + @INDENT@ @INDENT_FLAGS@ $filename.cpp +fi + +@MV@ $filename.cpp . +@MV@ $filename.h . +@RM@ $filename* diff --git a/db/sqlapi.h b/db/sqlapi.h new file mode 100644 index 0000000..65ed67b --- /dev/null +++ b/db/sqlapi.h @@ -0,0 +1,138 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/* Release 4.0 */ +/* Fri Feb 27 09:06:50 EST 1998 */ + +#ifndef _SQLAPI_H_ +#define _SQLAPI_H_ +#ifdef __cplusplus + +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlint8.h" + +#ifdef USE_NAMESPACE +#if defined(USE_INFORMIX) +namespace ifx { +#elif defined(USE_MYSQL) +namespace mysql { +#endif +#endif + +sqlint8_t sql_insert_id(SQL_CURSOR c); +/* + * Returns the serial value (if any) of the last insert. + */ + +int sql_error_code(); // returns the current error code. +int sql_last_error_code(); // returns the last nonzero error code +void sql_reset_error_code(); // resets the last nonzero error code + +const char *sql_error_message(); +/* + * Return SQL error information + */ + +bool sql_database(const char *dbname, const char *password=0, int exclusive=0); +/* connects to the database specified by dbname + * or if dbname is "" or cannot be opened uses + * the DATABASE environ variable. + * Parses "dbname@host" syntax. + * returns true if sucessful + */ + +bool sql_finish(); +/* closes the database opened earlier + */ + +char *sql_getdatabase(); +/* returns the database name opened by sql_database() + */ + +bool sql_exists(const char *table, const char *field, const char *value, const char *where); +/* check for existence of field in table optionally with value and + * optionally with a where clause where + */ + +SQL_CURSOR sql_open(const char *stmt, SQL_ROW &argv=const_cast(empty_row)); +/* open the query specified by statement and substitute all ? with + * parameters specified + * compiles the query and allocates space for return values + */ + +extern "C" { +#endif +int begin_work(); +/* starts a transaction + */ + +int commit_work(); +/* commits a transaction + */ + +int rollback_work(); +/* rolls backs a transaction + */ +#ifdef __cplusplus +} +bool sql_close(SQL_CURSOR); +/* close the compiled query and release all memory allocated for it + */ + +bool sql_fetch(SQL_CURSOR); +/* fetch a single row into the allocated space + * use sql_values to retrieve it + * (there is no need to free the sql_values return value! + * the program manages this space efficiently by reallocating more + * space if needed and does not do repeated malloc and free.) + */ + +bool sql_run(const char *stmt, SQL_ROW &argv=const_cast(empty_row)); +/* calls sql_open, sql_fetch and then sql_close + */ + +bool sql_explain(int); +/* sets debug on for all queries if int is not 0 else turns off + */ + +bool sql_reopen(SQL_CURSOR fd, SQL_ROW &argv); +/* reopen the cursor so that fetches may be done from the + * start again. uses the old parameters for the open + * if argc is specified bind the variables again + */ + +SQL_ROW sql_values(SQL_CURSOR fd, int *numvalues=0, int dostrip=1); +/* if dostrip is 1, it will strip all trailing blanks + */ + + +bool chk_cursor(SQL_CURSOR fd,const char *s); +/* + * performs an error check on the cursor + * if NDEBUG is not defined then an error message is printed + */ + +bool sql_print(SQL_CURSOR fd); +/* + * prints implementation defined info about the query in process + */ + +#ifdef USE_NAMESPACE +} +#endif +#endif +#endif diff --git a/db/sqlblob.cpp b/db/sqlblob.cpp new file mode 100644 index 0000000..c368ceb --- /dev/null +++ b/db/sqlblob.cpp @@ -0,0 +1,76 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "sah_config.h" + + +#include +#include +#include +#include +#include +#include + +#include "sqldefs.h" +#include "sqlrow.h" +#include "sqlblob.h" + +#ifndef CLIENT +#include "sqlapi.h" +#endif + + + +std::string escape_char(unsigned char c) { + std::string rv(""); + if (isprint(c)) { + switch (c) { + case '\\': rv="\\\\"; + break; + case '\'': rv="\\'"; + break; + case '"': rv="\\\""; + break; + case ',': rv="\\,"; + break; + default: rv+=c; + } + } else { + char buf[8]; + sprintf(buf,"\\%.4o",c); + rv=buf; + } + return rv; +} + +unsigned char unescape_char(const unsigned char *&s) { + unsigned char rv; + int i; + if (*s != '\\') return *s; + switch (*(s+1)) { + case '0': sscanf((const char *)(s+1),"%4o",&i); + rv=i&0xff; + s+=4; + break; + default: rv=*(++s); + } + return rv; +} + + + + + diff --git a/db/sqlblob.h b/db/sqlblob.h new file mode 100644 index 0000000..599e224 --- /dev/null +++ b/db/sqlblob.h @@ -0,0 +1,283 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef _SQLBLOB_H_ +#define _SQLBLOB_H_ + +#ifdef swap +#undef swap +#endif + +#include "sah_config.h" + +#ifndef _WIN32 +#include +#include +#include +#include +#endif + +#include "track_mem.h" +#include "sqldefs.h" +#include "sqlrow.h" +#include "xml_util.h" + +template +class sqlblob; + +template +std::ostream &operator <<(std::ostream &i, const sqlblob &b) { + i << xml_encode_string(*(b.mem),b.encoding); + return i; +} + + +template +std::istream &operator >>(std::istream &i, sqlblob &b) { + std::string buf(""),tmp; + std::string::size_type b_start=0,b_end=0,b_encoding=0; + const char *enc_string; + if (sizeof(T)==1) { + enc_string="x-xml-entity"; + } else { + enc_string="x-xml-values"; + } + while (!i.eof()) { + i >> tmp; + buf+=(tmp+' '); + } + b_start=buf.find('<'); + b_end=std::min(buf.find('>',b_start+1),buf.find(' ',b_start+1)); + std::string tag(std::string("',b_start+1); + b_encoding=buf.find("encoding=",b_start); + if (b_encoding < b_end) + enc_string=buf.c_str()+b_encoding+strlen("encoding="); + b_start=b_end+1; + b_end=buf.find(tag); + if (b.mem) { + delete(b.mem); +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: deleted a vector at 0x%p\n",b.mem); + fflush(stderr); +#endif + } + b.mem=new std::vector(xml_decode_string(buf.c_str()+b_start,b_end-b_start,enc_string)); + b.encoding=(xml_encoding)xml_encoding_from_string(enc_string); +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: allocated a vector at 0x%p\n",b.mem); + fflush(stderr); +#endif + return i; +} + + +template +std::string xml_encode_string(const sqlblob &input, + xml_encoding encoding=_x_xml_entity) { + return xml_encode_string(static_cast(&(*(input.mem))[0]),input.size(),encoding); +} + + +template +class sqlblob : track_mem > { + public: + sqlblob(const sqlblob &b); + explicit sqlblob(const T *p=0, size_t n_elements=0, xml_encoding e=_x_hex); + explicit sqlblob(const std::string &s,xml_encoding e=_x_hex); + explicit sqlblob(const std::vector &v, xml_encoding e=_x_hex); + ~sqlblob(); +// operator T *() { return &((*mem)[0]); }; +// operator const T *() const { return &((*mem)[0]); }; +// operator const char *() const { return (const char *)(&((*mem)[0])); }; + T &at(int i) { return mem->at(i); } + T &operator [](int i) { return (*mem)[i]; }; + const T operator [](int i) const { return (*mem)[i]; } ; + sqlblob &operator =(const sqlblob &b); + sqlblob &operator =(const std::vector &b); + size_t size() const { return mem->size(); }; + size_t set_size(size_t n_elements); + size_t resize(size_t n_elements); + std::string print_xml() const; + std::string print_hex() const; + std::string print_raw() const; + void parse_xml(std::string &field) { std::istringstream s(field); s >> *this; }; + typename std::vector::const_iterator begin() const { return mem->begin(); }; + typename std::vector::iterator begin() { return mem->begin(); }; + typename std::vector::const_iterator end() const { return mem->end(); }; + typename std::vector::iterator end() { return mem->end(); }; + void push_back(const T &t) { mem->push_back(t); } ; + void clear() { mem->clear(); } ; +#if !defined(WIN32) || ( _MSC_VER > 1300 ) || defined(__MINGW32__) // VC 7 or newer + friend std::ostream &operator << (std::ostream &o, const sqlblob &b); + friend std::istream &operator >> (std::istream &o, sqlblob &b); + friend std::string xml_encode_string(const sqlblob &b,xml_encoding encoding); +#else // VC6 or earlier + friend std::ostream &operator <<(std::ostream &o, const sqlblob &b); + friend std::istream &operator >>(std::istream &o, sqlblob &b); + friend std::string xml_encode_string(const sqlblob &b,xml_encoding encoding); +#endif + xml_encoding encoding; + private: + std::vector *mem; +}; + +template +std::string sqlblob::print_xml() const { + return xml_encode_string(*mem,encoding); +} + +template +std::string sqlblob::print_hex() const { + const char *hex="0123456789ABCDEF"; + char *p= new char [size()*sizeof(T)*2+1]; + size_t i,j; + + for (i = j = 0; i < size()*sizeof(T); i++) { + p[j++] = hex[((*mem)[i] & 0xF0) >> 4]; + p[j++] = hex[((*mem)[i] & 0x0F)]; + } + p[j]=0; + std::string rv(p); + delete p; + return rv; +} + +template +std::string sqlblob::print_raw() const { + return std::string(reinterpret_cast(&(*begin())),size()); +} + + +template +sqlblob::sqlblob(const T *p, size_t len, xml_encoding e) : + track_mem >("sqlblob"), encoding(e) { + if (p) { + mem=new std::vector(p,p+len); + } else if (len) { + mem=new std::vector(len); + } else { + mem=new std::vector(); + } +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: allocated a vector at 0x%p\n",mem); + fflush(stderr); +#endif +} + +template +sqlblob::sqlblob(const std::string &s, xml_encoding e) : + encoding(e), mem(new std::vector(s.c_str(),s.c_str()+s.size())) +{ +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: allocated a vector at 0x%p\n",mem); + fflush(stderr); +#endif +} + +template +sqlblob::sqlblob(const std::vector &v, xml_encoding e) : + encoding(e), + mem(new std::vector(v)) { +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: allocated a vector at 0x%p\n",mem); + fflush(stderr); +#endif +} + +template +sqlblob::sqlblob(const sqlblob &b) : + encoding(b.encoding) , + mem(new std::vector(*(b.mem))) { +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: allocated a vector at 0x%p\n",mem); + fflush(stderr); +#endif +} + +template +size_t sqlblob::resize(size_t len) { + mem->resize(len); + return mem->size(); +} + +template +size_t sqlblob::set_size(size_t len) { + mem->resize(len); + if (mem->size() < len) { + while (mem->size() != len) { + mem->push_back(static_cast(0)); + } + } + return mem->size(); +} + +template +sqlblob::~sqlblob() { + if (mem) { + delete mem; +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: deleted a vector at 0x%p\n",mem); + fflush(stderr); +#endif + } +} + +template +sqlblob &sqlblob::operator =(const sqlblob &b) { + if (&b != this) { + if (mem && (mem != b.mem)) { + delete mem; +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: deleted a vector at 0x%p\n",mem); + fflush(stderr); +#endif + } + mem=new std::vector(*(b.mem)); + encoding=b.encoding; +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: allocated a vector at 0x%p\n",mem); + fflush(stderr); +#endif + } + return (*this); +} + +template +sqlblob &sqlblob::operator =(const std::vector &b) { + if (&b != mem) { + if (mem) { + delete mem; +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: deleted a vector at 0x%p\n",mem); + fflush(stderr); +#endif + } + mem=new std::vector(b); +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"sqlblob: allocated a vector at 0x%p\n",mem); + fflush(stderr); +#endif + } + return (*this); +} + + + + + + +#endif diff --git a/db/sqldefs.h b/db/sqldefs.h new file mode 100644 index 0000000..e5106bf --- /dev/null +++ b/db/sqldefs.h @@ -0,0 +1,47 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef _SQLDEFS_H_ +#define _SQLDEFS_H_ + +#ifndef CLIENT +#ifdef USE_INFORMIX +#include "int8.h" +#include "sqlca.h" +#include "sqlda.h" +#include "locator.h" +#include "sqltypes.h" +#include "sqlstype.h" +#ifdef MAX_QUERY_LEN +#undef MAX_QUERY_LEN +#endif +namespace sql { + static const int MAXBLOB=8192; + static const int MAXVARCHAR=255; + static const int MAXCURSORS=20; + static const int MAX_QUERY_LEN=8192; +} +#elif defined(USE_MYSQL) +#include "mysql.h" +namespace sql { + static const int MAXBLOB=4096; + static const int MAXVARCHAR=255; + static const int MAXCURSORS=20; + static const int MAX_QUERY_LEN=8192; +} +#endif +#endif +#endif diff --git a/db/sqlifx.ec b/db/sqlifx.ec new file mode 100644 index 0000000..b4fecad --- /dev/null +++ b/db/sqlifx.ec @@ -0,0 +1,1270 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "sah_config.h" +#undef USE_MYSQL +#define loc_t sys_loc_t +#include +#include +#include +#include +#include +#include +#include +#undef loc_t + +#include "sqlint8.h" +#include "sqlca.h" +#include "sqlda.h" +#include "sqlhdr.h" +#include "locator.h" +#include "sqltypes.h" +#include "sqlstype.h" +#include "sqldefs.h" +#include "sqlint8.h" +#include "sqlblob.h" +#include "sqlrow.h" +#include "sqlapi.h" + + +extern sqlca_s sqlca; + +#ifdef USE_NAMESPACE +namespace ifx { +#endif + +#define found(x) ((x != std::string::npos)) + +struct IFX_LOC_T : private track_mem, public loc_t { + IFX_LOC_T() : track_mem("IFX_LOC_T") { +// fprintf(stderr,"Creating IFX_LOC_T, this=%x\n",this); +// fflush(stderr); + memset(this,0,sizeof(IFX_LOC_T)); + }; + IFX_LOC_T(const IFX_LOC_T &s) : track_mem("IFX_LOC_T") { +// fprintf(stderr,"Creating IFX_LOC_T, this=%x\n",this); +// fflush(stderr); + memcpy(this,&s,sizeof(IFX_LOC_T)); + if (s.loc_buffer) { + if (s.loc_bufsize) { + loc_buffer=new char [s.loc_bufsize]; + } else { + loc_buffer=new char [strlen(s.loc_buffer)]; + loc_bufsize=strlen(s.loc_buffer)+1; + loc_size=loc_bufsize; + } + memcpy(loc_buffer,s.loc_buffer,loc_bufsize); + } + } + IFX_LOC_T(const std::string &s) : track_mem("IFX_LOC_T") { +// fprintf(stderr,"Creating IFX_LOC_T, this=%x\n",this); +// fflush(stderr); + memset(this,0,sizeof(IFX_LOC_T)); + loc_loctype=LOCMEMORY; + loc_buffer=new char [s.size()+1]; + loc_bufsize=s.size(); + loc_size=loc_bufsize; + memcpy(loc_buffer,s.c_str(),s.size()); + loc_buffer[s.size()]=0; + } + + IFX_LOC_T(const char *s, size_t l) : track_mem("IFX_LOC_T") { +// fprintf(stderr,"Creating IFX_LOC_T, this=%x\n",this); +// fflush(stderr); + memset(this,0,sizeof(IFX_LOC_T)); + loc_loctype=LOCMEMORY; + loc_buffer=new char [l+1]; + loc_bufsize=l; + loc_size=loc_bufsize; + memcpy(loc_buffer,s,l); + loc_buffer[l]=0; + } + + ~IFX_LOC_T() { +// fprintf(stderr,"In ~IFX_LOC_T()\n"); +// fflush(stderr); + if (loc_buffer) delete [] loc_buffer; + loc_buffer=NULL; + } +}; + +struct SQLVAR : private track_mem, public ifx_sqlvar_t { + static int ref_cnt; + void clear(); + bool is_blob() { + return ((sqltype == CLOCATORTYPE) || + ((sqltype & SQLTYPE) == SQLTEXT) || + ((sqltype & SQLTYPE) == SQLBYTES)); + } + SQLVAR &operator =(const SQLVAR &s); + SQLVAR(); + SQLVAR(const SQLVAR &s); + SQLVAR(const std::string &s); + SQLVAR(const IFX_LOC_T &s); + ~SQLVAR(); +}; + +int SQLVAR::ref_cnt; +SQLVAR::SQLVAR() { +// fprintf(stderr,"Creating SQLVAR, this=%x\n",this); +// fflush(stderr); + sqldata=0; + sqltype=0; + ref_cnt++; +} + +SQLVAR::SQLVAR(const SQLVAR &s) : track_mem("SQLVAR") { +// fprintf(stderr,"Creating SQLVAR, this=%x\n",this); +// fflush(stderr); + ref_cnt++; + memcpy(this,&s,sizeof(SQLVAR)); + if (sqltype == CLOCATORTYPE) { + IFX_LOC_T *sloc=(IFX_LOC_T *)s.sqldata; + IFX_LOC_T *loc=new IFX_LOC_T(*sloc); + sqldata=(char *)loc; + } else { + sqldata=new char [s.sqllen+1]; + memcpy(sqldata,s.sqldata,s.sqllen); + sqldata[s.sqllen]=0; + } +} + +SQLVAR::SQLVAR(const std::string &s) : track_mem("SQLVAR") { +// fprintf(stderr,"Creating SQLVAR, this=%x\n",this); +// fflush(stderr); + ref_cnt++; + memset(this,0,sizeof(SQLVAR)); + sqltype=CCHARTYPE; + sqllen=s.size(); + sqldata=new char [s.size()+1]; + memcpy(sqldata,s.c_str(),s.size()+1); + sqldata[s.size()]=0; +} + +SQLVAR::SQLVAR(const IFX_LOC_T &s) : track_mem("SQLVAR") { +// fprintf(stderr,"Creating SQLVAR, this=%x\n",this); +// fflush(stderr); + ref_cnt++; + memset(this,0,sizeof(SQLVAR)); + sqltype=CLOCATORTYPE; + IFX_LOC_T *loc=new IFX_LOC_T(s); + sqllen=sizeof(IFX_LOC_T); + sqldata=(char *)loc; +} + +SQLVAR &SQLVAR::operator =(const SQLVAR &s) { + if (this != &s) { + clear(); + memcpy(this,&s,sizeof(SQLVAR)); + if (sqltype == CLOCATORTYPE) { + IFX_LOC_T *sloc=(IFX_LOC_T *)s.sqldata; + IFX_LOC_T *loc=new IFX_LOC_T(*sloc); + sqldata=(char *)loc; + } else { + sqldata=new char [s.sqllen+1]; + memcpy(sqldata,s.sqldata,s.sqllen); + sqldata[s.sqllen]=0; + } + } + return *this; +} + + + +void SQLVAR::clear() { + if (sqldata) { + if (sqltype == CLOCATORTYPE) { + delete (IFX_LOC_T *)sqldata; + } else { + delete [] sqldata; + } + sqldata=NULL; + } +} + +SQLVAR::~SQLVAR() { + ref_cnt--; +// fprintf(stderr,"Destroying SQLVAR() this=%x\n",this); +// fflush(stderr); + clear(); +} + +struct SQLDA : public track_mem, public ifx_sqlda_t { + void resize(int argc) { + int i; + if (argc>sqld) { + SQLVAR *tmp=(SQLVAR *)sqlvar; + sqlvar=new SQLVAR [argc]; + if (tmp) { + for (i=0;i { + char *cmd; + unsigned int opened:1; + unsigned int is_select:1; + SQLDA *in; + SQLDA *out; + SQLDA *exec; + int *arr_sqltype; + int arr_sqltype_len; + int *arr_sqllen; + char p_name[19]; + char c_name[19]; + sqlint8_t insert_id; + SSQL() : cmd(0), opened(0), is_select(0), in(0), out(0), exec(0), + arr_sqltype(0), arr_sqltype_len(0), arr_sqllen(0), insert_id(0) { + p_name[0]=0; + c_name[0]=0; + } +}; + +static char *null_cmd=""; + +#define debug(s) s + +#define errmalloc(pointer, func, len) \ + if (!pointer) {\ + sprintf(errmsg, "Cannot malloc for %uld in %s errno %d",len,func,errno);\ + debug(fprintf(stderr, "%s\n", errmsg));\ + return false;\ + } + +#define is_hex_digit(c) \ + ((((c)>='0') && ((c)<='9')) || (((c)>='a') && ((c)<='f')) || (((c)>='A') && ((c)<='F'))) + + +#define make_into_char(arg) \ + (((arg) >= 'A' && (arg) <= 'F')?((arg) - 'A' + 10):\ + (((arg) >= 'a' && (arg) <= 'f')?((arg) - 'a' + 10):(arg-'0'))) + +bool print_status(const char *p1,const char *p2); + + +int chk_status(int fd, const char *p1, const char *p2) { + int sav=sql_error_code(); + if (sav != 0) { + if (sav < 0) { + sql_close(fd); + print_status(p1, p2); + return (sav); + } + print_status(p1,p2); + } + return 0; +} + + +static SSQL ssql[sql::MAXCURSORS+1]; +static char *database_name; +static char *connection_name; + +static char errmsg[1024+1]; + +#ifndef lint +static char const rcs[] = "@(#)$Id: sqlifx.ec,v 1.22.2.7 2007/04/23 22:04:07 jeffc Exp $"; +#endif + +sqlint8_t sql_insert_id() { + sqlint8_t rv(0); + ifx_int8_t val; + char a[256]; + a[0]=0; + ifx_getserial8(&val); + ifx_int8toasc(&val,&a[0],24); + a[255]=0; + sscanf(a,"%"INT8_FMT,&rv); + if (!rv) { + rv=static_cast(sqlca.sqlerrd[1]); + } + return rv; +} + +#define INSERT_ID sql_insert_id() + +sqlint8_t sql_insert_id(SQL_CURSOR fd) { + return ssql[fd].insert_id; +} + + +bool chk_cursor(SQL_CURSOR fd, const char *function) { + if (fd < 0 || fd >= sql::MAXCURSORS || !ssql[fd].cmd) { + sprintf(errmsg, "Invalid fd %d passed to %s()", fd, function); + debug(fprintf(stderr, "%s\n", errmsg)); + return false; + } + return true; +} + +/* removes trailing white spaces */ +static void strip(std::string &s) { + while (s.size() && isspace(s[s.size()-1])) { + s.erase(s.size()-1,1); + } +} + +static void strip(char *s, int len) { + while (len>=0 && s[len]) s[len--]=0; +} + +static void undelimit(std::string &s,char c_start,char c_end) { + while (s.size() && (isspace(s[0]) || (s[0]==c_start))) s.erase(0,1); + while (s.size() && (isspace(s[s.size()-1]) || (s[s.size()-1]==c_end))) s.erase(s.size()-1,1); +} + +/* Using the previous SQL error code, format the Informix error message */ +bool print_status(const char *p1, const char *p2) { + int retcode = sql_error_code(); + if (retcode < 0) { + int msglen; + errmsg[0] = '\0'; + rgetlmsg(sql_error_code(), errmsg, sizeof(errmsg), &msglen); + if (sqlca.sqlerrd[1]) { + int len = strlen(errmsg); + errmsg[len] = '\0'; + rgetlmsg(sqlca.sqlerrd[1], &errmsg[len], sizeof(errmsg) - len, &msglen); + } + strip(sqlca.sqlerrp,strlen(sqlca.sqlerrp)); + sprintf(&errmsg[strlen(errmsg)], + "%d:%ld:%s %s %s %s\n", + sql_error_code(), sqlca.sqlerrd[1], sqlca.sqlerrp, sqlca.sqlerrm, p1, p2); + debug(fprintf(stderr, "%s\n", errmsg)); + } + return (retcode>=0); +} + +/* Set explain on or off */ +bool sql_explain(int n) { + int fd=0; + if (n) { + $set explain on; + chk_status(fd,"sql_explain","set explain on"); + } else { + $set explain off; + chk_status(fd,"sql_explain","set explain off"); + } + return ((sql_error_code())==0); +} + +/* Return the error message stored in the buffer */ +const char *sql_error_message(void) { + return errmsg; +} + +/* +** Check whether column (field) exists in table with value specified by val +** subject to additional constraints specified in where. +** +** returns +** true if field exists in table, +** false otherwise +*/ +static int alloc_stmt(); + +bool sql_exists(const char *table, const char *field, const char *p_val, const char *where) { + $char *value = const_cast(p_val); + $char stmt[sql::MAXBLOB+1]; + $char result[2]; + int fetch_code = 0; /* NOTUSED */ + int fd=alloc_stmt(); + + if (value && *value != '\0') { + sprintf(stmt, "select '1' from %s where %s = ?", + table, field); + if (where && *where != '\0') + sprintf(&stmt[strlen(stmt)], " and %s", where); + } else { + sprintf(stmt, "select '1' from %s", + table); + if (where && *where != '\0') + sprintf(&stmt[strlen(stmt)], " where %s", where); + } + + $prepare pexist from $stmt; + if (chk_status(fd,"PREPARE(EXISTS)", stmt)) return false; + $declare pexist_cur cursor for pexist; +if (chk_status(fd,"DECLARE(EXISTS)", stmt)) return false; + if (value && *value != '\0') + $open pexist_cur using $value; + else + $open pexist_cur; + if (chk_status(fd,"OPEN(EXISTS)", stmt)) return false; + $fetch pexist_cur into $result; + fetch_code = sql_error_code(); + $close pexist_cur; + sql_close(fd); + return (fetch_code==0); +} + + + +std::string decode_hex(std::string input) { + std::string tgt; + int i,j; + + tgt.resize(input.size()/2); + + for (i = j = 0; i < input.size(); i += 2) { + if (!is_hex_digit(input[i]) || !is_hex_digit(input[i+1])) return input; + tgt[j++] = make_into_char(input[i])*16 + make_into_char(input[i+1]); + } + return tgt; +} + +static bool sql_set_values(SQL_CURSOR fd, SQL_ROW &argv) { + SQLVAR *col; + SQLVAR *ecol; + SQLDA *udesc; + SQLDA *edesc; + int i; + int argc=argv.argc(); + + udesc = ssql[fd].in; + edesc = ssql[fd].exec; + if (argc > 0) { + if (edesc && (argc > edesc->sqld)) { + edesc->resize(argc); + } + if (udesc && argc != udesc->sqld) { + sprintf(errmsg, + "Incorrect number (%d) of bind variables specified - %d required", + argc, udesc->sqld); + debug(fprintf(stderr, "%s\n", errmsg)); + return false; + } + if (udesc) delete (SQLDA *)udesc; + + udesc = ssql[fd].in = new SQLDA(argc); + + if (edesc && edesc->sqld <= 0) edesc = NULL; + if (edesc && edesc->sqlvar) ecol = (SQLVAR *)edesc->sqlvar; + else ecol = NULL; + + for (i = 0, col = (SQLVAR *)udesc->sqlvar; i < argc; i++, col++) { + int blob = 0; + /* Is our column a blob? */ + if (ecol) { + if (ecol->is_blob()) blob = 1; + } + + if (!argv.exists(i)) argv[i]=new std::string(""); + /* remove leading and trailing single quotes */ + undelimit(*(argv[i]),'\'','\''); + + /* Check for blobs */ + if (blob) { + /* Remove tags */ + if ((argv[i]->find("find("find('>'); + if (found(etag)) argv[i]->erase(0,etag+1); + } + std::string tmpstr=decode_hex(*(argv[i])); + IFX_LOC_T tmploc=IFX_LOC_T(tmpstr); + SQLVAR tmpvar=SQLVAR(tmploc); + *col=tmpvar; + } else { + SQLVAR tmpvar=SQLVAR(*(argv[i])); + *col=tmpvar; + } + col->sqlname = 0; + col->sqlind = 0; + if (ecol) ecol++; + } + } + return true; +} + +/* Returns + true on successful execution + sqlca.sqlcode otherwise +*/ +bool sql_run(const char *stmt, SQL_ROW &argv) { + SQL_CURSOR fd; + int ret; + + if (isdigit(stmt[0])) { + fd = atoi(stmt); + if (!chk_cursor(fd, "sql_run")) + sql_close(fd); + return false; + if (!sql_set_values(fd, argv)) + sql_close(fd); + return false; + return sql_fetch(fd); + } + fd = sql_open(stmt, argv); + if (fd < 0) { + sql_close(fd); + return false; + } + ret = sql_fetch(fd); + sql_close(fd); + return ret; +} + +/* +** Allocate a statement number +** Returns: +** -1: no available statements +** 0..sql::MAXCURSORS-1: new statement number +*/ +static int alloc_stmt() { + int i; + + for (i = 0; i < sql::MAXCURSORS; i++) { + if (!ssql[i].cmd) + break; + } + if (i >= sql::MAXCURSORS) { + sprintf(errmsg, + "FATAL ERROR: Too many open SQL statements (> %d) for sql operations\n", sql::MAXCURSORS); + debug(fprintf(stderr, "%s\n", errmsg)); + i = -1; + exit(1); + } else { + ssql[i].cmd=null_cmd; + sprintf(ssql[i].p_name, "p_%d", i); + sprintf(ssql[i].c_name, "c_%d", i); + } + return(i); +} + +SQL_CURSOR sql_open(const char *sql, SQL_ROW &argv) { + SQLVAR *col = 0L; + ifx_sqlda_t *udesc = 0L; + $char *stmt = const_cast(sql); + int i; + int fd; + int len; + char *save; + $char *p_name; + $char *c_name; + int rv; + + if ((fd = alloc_stmt()) < 0) + return(-1); + + len = strlen(stmt); + save = new char [len+1]; + strcpy(save, stmt); + ssql[fd].cmd = save; + + p_name = ssql[fd].p_name; + + $prepare $p_name from $stmt; + + if (rv=chk_status(fd,"PREPARE(OPEN)", stmt)) return rv; + + $describe $p_name into udesc; + + if (rv=chk_status(fd,"DESCRIBE(OPEN)", stmt)) return rv; + + /** + ** The cursory statements are: + ** -- EXECUTE PROCEDURE + ** -- SELECT without INTO TEMP + ** Fortunately, SELECT INTO TEMP is given code SQ_SELINTO + ** Unfortunately, SELECT is not given code SQ_SELECT (2) but 0 + ** Non-cursory statements need minimal extra attention. + */ + if ((sql_error_code()) != 0 && + ((sql_error_code()) != SQ_EXECPROC || udesc->sqld == 0) && + (sql_error_code()) != SQ_SELECT) { + ssql[fd].is_select = 0; + ssql[fd].exec = (SQLDA *)udesc; + if (!sql_set_values(fd, argv)) + return sql_close(fd), -1; + return fd; + } + + ssql[fd].is_select = 1; + ssql[fd].out = (SQLDA *)udesc; + + if (!udesc) { + sprintf(errmsg, "No columns selected !\n"); + fprintf(stderr, "No columns selected !\n"); + return -1; + } + + for (i = 0, col = (SQLVAR *)udesc->sqlvar; i < udesc->sqld; i++, col++) { + int blob = 0; + if ((col->sqltype & SQLTYPE) != SQLCHAR && + (col->sqltype & SQLTYPE) != SQLVCHAR) { + if (col->is_blob()) { + blob = 1; + } else if ((col->sqltype & SQLTYPE) == SQLROW) { + col->sqllen = sql::MAXBLOB; + } else if ((col->sqltype & SQLTYPE) == SQLLIST) { + col->sqllen = sql::MAXBLOB; + } else { + col->sqllen = rtypwidth(col->sqltype, col->sqllen); + } + /* Should allocate at least 12 characters for backward compat. ! */ + if (col->sqllen < 12) col->sqllen = 12; + } + if (blob) { + IFX_LOC_T tmploc; + tmploc.loc_loctype=LOCMEMORY; + tmploc.loc_bufsize=-1; + SQLVAR tmpvar(tmploc); + *col=tmpvar; + } else { + std::string tmpstr(col->sqllen+2,0); + col->sqllen++; + SQLVAR tmpvar(tmpstr); + *col=tmpvar; + } + col->sqlind = new short; + *(col->sqlind) = 0; + } + + c_name = ssql[fd].c_name; + + $declare $c_name cursor for $p_name; + + if (rv=chk_status(fd,"DECLARE(OPEN)", stmt)) return rv; + + if (!sql_reopen(fd,argv)) { + sql_close(fd); + fd=-1; + } + if (rv=chk_status(fd,"OPEN(OPEN)", stmt)) return rv; + + ssql[fd].opened = 1; + ssql[fd].insert_id=INSERT_ID; + return fd; +} + +static int LAST_NON_ZERO_SQLCODE; + +int sql_error_code() { + if (SQLCODE != 0) LAST_NON_ZERO_SQLCODE = SQLCODE; + return SQLCODE; +} + +int sql_last_error_code() { + return LAST_NON_ZERO_SQLCODE; +} + +void sql_reset_error_code() { + LAST_NON_ZERO_SQLCODE=0; +} + + +bool sql_reopen(SQL_CURSOR fd, SQL_ROW &argv) { + struct sqlda *udesc; + $ char *c_name; + + if (!chk_cursor(fd, "sql_reopen")) + return false; + + if (!sql_set_values(fd, argv)) + return false; + + udesc = ssql[fd].in; + c_name = ssql[fd].c_name; + + if (udesc && udesc->sqld) + $open $c_name using descriptor udesc; + else + $open $c_name; + + if (chk_status(fd,"OPEN","sql_reopen()")) return false; + + return (sql_error_code()>=0); +} + +/* +** If this is a non-cursory statement, sql_fetch() executes the statement. +** If this is a cursory statement, then it fetches a row of data. +*/ +bool sql_fetch(SQL_CURSOR fd) { + int ret; + SQLDA *udesc; + + if (!chk_cursor(fd, "sql_fetch")) + return false; + + if (!ssql[fd].is_select) { + $char *p_name = ssql[fd].p_name; + udesc = ssql[fd].in; + if (udesc) + $execute $p_name using descriptor udesc; + else + $execute $p_name; + ret = sql_error_code(); + if (chk_status(fd,"EXECUTE(RUN)", ssql[fd].cmd)) return false; + } else { + $char *c_name = ssql[fd].c_name; + udesc = ssql[fd].out; + if (udesc && udesc->sqld) + $fetch $c_name using descriptor udesc; + else + $fetch $c_name; + ret = sql_error_code(); + if (chk_status(fd,"FETCH(OPEN)", ssql[fd].cmd)) return false; + } + ssql[fd].insert_id=INSERT_ID; + return ((ret>=0) && (ret!=100)); +} + +/* Convert (blob) memory to hex encoding used in UNLOAD */ +static char *convert_ascii(const char *str, int len) { + int i; + int j; + char *hex = "0123456789ABCDEF"; + char *p; + + p = new char [len*2+1]; + if (!p) return p; + + /* BCD to ASCII legible ! */ + for (i = j = 0; i < len; i++) { + p[j++] = hex[((str[i] & 0xF0) >> 4)]; + p[j++] = hex[(str[i] & 0x0F)]; + } + p[j] = '\0'; + return p; +} + +SQL_ROW sql_values(SQL_CURSOR fd, int *num, int dostrip) { + static SQL_ROW argv; + static int maxnum; + SQLDA *udesc; + SQLVAR *col; + int i; + + if (!chk_cursor(fd, "sql_values")) + return SQL_ROW(NULL); + if (!ssql[fd].is_select) { + sprintf(errmsg, + "Cannot get values for a non-select statement " + "(fd %d) passed to sql_values", fd); + debug(fprintf(stderr, "%s\n", errmsg)); + return SQL_ROW(NULL); + } + if (!ssql[fd].opened) { + sprintf(errmsg, + "Cannot get values for unopened statement " + "(fd %d) passed to sql_values", fd); + debug(fprintf(stderr, "%s\n", errmsg)); + return SQL_ROW(NULL); + } + udesc = ssql[fd].out; + if (!udesc) + return SQL_ROW(NULL); + if (udesc->sqld > maxnum) { + argv.argc(udesc->sqld); + maxnum = udesc->sqld; + } + for (i = 0, col = (SQLVAR *)udesc->sqlvar; i < udesc->sqld; i++, col++) { + // if something is already there, free it + argv.clear(i); + // build our SQL_ROW entries from what we have. + if (col->is_blob()) { + IFX_LOC_T *loc = (IFX_LOC_T *)col->sqldata; + if (loc->loc_size >= 0) { + argv[i] = new std::string(loc->loc_buffer,loc->loc_size); + } else { + argv[i] = new std::string(loc->loc_buffer); + } + if (dostrip == 1) strip(*(argv[i])); + } else { + argv[i] = new std::string((col->sqldata)?col->sqldata:""); + if (dostrip == 1) strip(*(argv[i])); + } + } + if (num) *num = udesc->sqld; + return argv; +} + +char *sql_command(SQL_CURSOR fd) { + if (!chk_cursor(fd, "sql_command")) + return NULL; + return ssql[fd].cmd; +} + +bool sql_close(SQL_CURSOR fd) { + struct sqlda *udesc; + struct sqlvar_struct *col; + + if (!ssql[fd].cmd) return true; + + if (ssql[fd].is_select) { + /* XXX - Error handling? */ + $char *c_name = ssql[fd].c_name; + if (ssql[fd].opened) + $close $c_name; + $free $c_name; + } + + { + /* XXX - Error handling? */ + $char *p_name = ssql[fd].p_name; + $free $p_name; + } + + /* XXX - Valid to assert ssql[fd].cmd != 0 ? */ + if (ssql[fd].cmd && (ssql[fd].cmd != null_cmd)) + delete [] ssql[fd].cmd; + + ssql[fd].cmd = NULL; + + udesc = ssql[fd].in; + if (udesc) { + delete (SQLDA *)udesc; + udesc = NULL; + } + ssql[fd].in = NULL; + + udesc = ssql[fd].out; + if (udesc) { +#ifndef FIXBUG + // since the sqlvars for out and exec are allocated by describe + // we need to make sure they don't get freed by us. Lets hope informix + // is doing some garbage collecting. + udesc->sqlvar=NULL; +#endif + delete (SQLDA *)udesc; + udesc = NULL; + } + + udesc = ssql[fd].out; + ssql[fd].out = NULL; + /* If out and exec are the same then no need to the following */ + if (udesc != ssql[fd].exec && ssql[fd].exec) { + udesc = ssql[fd].exec; +#ifndef FIXBUG + // since the sqlvars for out and exec are allocated by describe + // we need to make sure they don't get freed by us. Lets hope informix + // is doing some garbage collecting. + udesc->sqlvar=NULL; +#endif + delete (SQLDA *)udesc; + udesc = NULL; + } + ssql[fd].exec = NULL; + + memset(&ssql[fd], 0, sizeof(SSQL)); + return (sql_error_code()>=0); +} + +bool sql_print(SQL_CURSOR fd) { + struct sqlda *udesc; + struct sqlvar_struct *col; + + if (fd < 0 || fd >= sql::MAXCURSORS) { + sprintf(errmsg, "Invalid fd %d passed to sql_print", fd); + debug(fprintf(stderr, "%s\n", errmsg)); + return false; + } + printf("Command string for fd %d: %s", fd, + (ssql[fd].cmd?ssql[fd].cmd:"null")); + if (!ssql[fd].opened) printf(" not "); + printf(" opened, "); + if (!ssql[fd].opened) printf(" not "); + printf(" selected\n"); + if (ssql[fd].in) { + int i; + udesc = ssql[fd].in; + printf("Input:"); + for (i = 0, col = udesc->sqlvar; i < udesc->sqld; i++, col++) { + if (!(col->sqlname)) col->sqlname="null"; + printf("(%s,%ld,%s)\n",col->sqlname, col->sqllen, col->sqldata); + } + } + if (ssql[fd].out) { + int i; + udesc = ssql[fd].out; + printf("Output:\n"); + for (i = 0, col = udesc->sqlvar; i < udesc->sqld; i++, col++) { + if (!(col->sqlname)) col->sqlname="null"; + printf("(%s,%ld,%s)\n",col->sqlname, col->sqllen, col->sqldata); + } + } + return true; +} + +bool sql_database(const char *dbname, const char *password, int exclusive) { + $char *p; + int len; + int fd=alloc_stmt(); + + if (!dbname || *dbname == '\0') { + p = getenv("DATABASE"); + if (!p) p = "NODATABASE"; + } else + p = const_cast(dbname); + if (exclusive) { + $database $p exclusive; + if (chk_status(fd,"DATABASE EXCLUSIVE", p)) return false; + $set lock mode to wait; + } else { + $database $p; + if (chk_status(fd,"DATABASE", p)) return false; + $set lock mode to wait; + } + if (database_name) { + delete database_name; + database_name = NULL; + } + len = strlen(p) + 1; + database_name = new char [len]; + errmalloc(database_name, "DATABASE", len); + strcpy(database_name, p); + sql_close(fd); + if (SQLCODE<0) { + return false; + } + return true; +} + +bool sql_connect(const char *dbname, const char *uid, const char *pw, const char *cname, int with_contrans) { + $char *p; + $char *username; + $char *password; + $char *conn_name; + int fd=alloc_stmt(); + + int len; + if (!dbname || *dbname == '\0') { + p = getenv("DATABASE"); + if (!p) p = "NODATABASE"; + } else p = const_cast(dbname); + conn_name = const_cast(cname); + username = const_cast(uid); + password = const_cast(pw); + if (cname && *cname != '\0') { + if (with_contrans) { + $connect to $p as $conn_name user $username using $password + with concurrent transaction; + } else { + $connect to $p as $conn_name user $username using $password; + } + } else { + if (with_contrans) { + $connect to $p user $username using $password + with concurrent transaction; + } else { + $connect to $p user $username using $password; + } + } + if (chk_status(fd,"CONNECT", p)) return false; + len = strlen(p) + 1; + if (connection_name) { + delete connection_name; + connection_name = NULL; + } + connection_name = new char [len]; + errmalloc(connection_name, "CONNECT", len); + strcpy(connection_name, p); + sql_close(fd); + return (SQLCODE>=0); +} + +bool sql_disconnect(const char *arg) { + $char *cname; + + cname = const_cast(arg); + if (!arg) { + sprintf(errmsg, "No argument passed to sql_disconnect"); + debug(fprintf(stderr, "%s\n", errmsg)); + return false; + } + if (strcmp(arg, "current") == 0) { + $disconnect current; + } else if (strcmp(arg, "default") == 0) { + $disconnect default; + } else if (strcmp(arg, "all") == 0) { + $disconnect all; + } else { + $disconnect $cname; + } + int fd=alloc_stmt(); + if (chk_status(fd,"DISCONNECT", arg)) return false; + sql_close(fd); + return true; +} + +bool sql_sigcmd(const char *arg) { + $char *cname; + + cname = const_cast(arg); + if (!arg) { + sprintf(errmsg, + "Argument must be one of sqlbreak, sqldetach, sqlexit, sqldone"); + debug(fprintf(stderr, "%s\n", errmsg)); + return false; + } + if (strcmp(arg, "sqlbreak") == 0) { + return (!sqlbreak()); + } else if (strcmp(arg, "sqldetach") == 0) { + return !sqldetach(); + } else if (strcmp(arg, "sqlexit") == 0) { + return !sqlexit(); + } else if (strcmp(arg, "sqldone") == 0) { + return !sqlexit(); + } else { + sprintf(errmsg, + "Argument must be one of sqlbreak, sqldetach, sqlexit, sqldone"); + debug(fprintf(stderr, "%s\n", errmsg)); + return false; + } +} + +bool sql_setconnection(const char *arg, int dormant) { + $char *cname; + + cname = const_cast(arg); + if (!arg) { + sprintf(errmsg, "No argument passed to sql_setconnection"); + debug(fprintf(stderr, "%s\n", errmsg)); + return false; + } + if (strcmp(arg, "current") == 0) { + if (dormant) + $set connection current dormant; + else + /* NOTE: COREDUMPs occur if dormant is removed and no connection is open !!!!*/ + /* HENCE DORMANT IS ALWAYS USED */ + $set connection current dormant; + } else if (strcmp(arg, "default") == 0) { + if (dormant) + $set connection default dormant; + else + $set connection default; + } else { + if (dormant) + $set connection $cname dormant; + else + $set connection $cname; + } + int fd=alloc_stmt(); + if (dormant) { + if (chk_status(fd,"SET CONNECTION DORMANT", arg)) return false; + } else { + if (chk_status(fd,"SET CONNECTION", arg)) return false; + } + sql_close(fd); + return true; +} + +bool sql_finish(void) { + if (database_name) { + delete [] database_name; + database_name = NULL; + } + $close database; + int fd=0; + if (chk_status(fd,"CLOSE", "DATABASE")) return false; + return true; +} + +bool sql_begin(void) { + $begin work; + int fd=alloc_stmt(); + if (chk_status(fd,"BEGIN", "WORK")) return false; + sql_close(fd); + return true; +} + +int sql_commit(void) { + $commit work; + int fd=alloc_stmt(); + if (chk_status(fd,"COMMIT", "WORK")) return false; + sql_close(fd); + return true; +} + +int sql_rollback(void) { + $rollback work; + int fd=alloc_stmt(); + if (chk_status(fd,"ROLLBACK", "WORK")) return false; + sql_close(fd); + return true; +} + +char *sql_getdatabase(void) { + return database_name; +} + +/* +sql readblob table column "rowid = NUM" intofilename [append] + if success (0) returns NULL or SIZE of blob written + else returns ERROR (-1) +sql writeblob table column "rowid = NUM" [fromfilename | null] [size|-1] + if success (0) returns SIZE of blob written + else returns ERROR (-1) +*/ +int sql_readblob(const char *table, const char *column, const char *rowidclause, const char *intofile, + int appendmode) { + $loc_t sloc; + $char stmt[sql::MAXBLOB+1]; + int fd=alloc_stmt(); + + if (atoi(rowidclause) > 0) + sprintf(stmt, "select %s from %s where rowid = %s", + column, table, rowidclause); + else + sprintf(stmt, "select %s from %s where %s", column, table, rowidclause); + + sloc.loc_loctype = LOCFNAME; + sloc.loc_fname = const_cast(intofile); + + if (appendmode) + sloc.loc_oflags = LOC_APPEND; + else + sloc.loc_oflags = LOC_WONLY; + + $prepare tcl_readblob from $stmt; + if (chk_status(fd,"PREPARE(READBLOB)", stmt)) return false; + + $declare tcl_readblob_cur cursor for tcl_readblob; +if (chk_status(fd,"DECLARE(READBLOB)", stmt)) return false; + + $open tcl_readblob_cur; + if (chk_status(fd,"OPEN(READBLOB)", stmt)) return false; + + $fetch tcl_readblob_cur into $sloc; + if (chk_status(fd,"FETCH(READBLOB)", stmt)) return false; + + if (sql_error_code() != 0) { + sprintf(errmsg, "No record found.\n"); + debug(fprintf(stderr, "%s\n", errmsg)); + sql_close(fd); + return -1; + } + + /* + After getting it + sloc.loc_size # of bytes, sloc.loc_indicator = -1 for null, + sloc.loc_status = 0 for success, -ve for error + */ + if (sql_error_code() == 0 && sloc.loc_status == 0) { + if (sloc.loc_indicator == -1) { + $close tcl_readblob_cur; + sql_close(fd); + return -2; + } + $close tcl_readblob_cur; + sql_close(fd); + return sloc.loc_size; + } + $close tcl_readblob_cur; + sql_close(fd); + + return -1; +} + +int sql_writeblob(const char *table, const char *column, const char *rowidclause, const char *fromfile, + int fromsize) { + $loc_t uloc; + $char stmt[sql::MAXBLOB+1]; + $char *colname; + int fd=alloc_stmt(); + + colname = const_cast(column); + + if (atoi(rowidclause) > 0) + sprintf(stmt, "update %s set %s = ? where rowid = %s", + table, column, rowidclause); + else + sprintf(stmt, "update %s set %s = ? where %s", + table, column, rowidclause); + + /* + sprintf(stmt, "select 1 from %s where %s FOR UPDATE OF %s", + table, rowidclause, column); + */ + + uloc.loc_loctype = LOCFNAME; + uloc.loc_fname = const_cast(fromfile); + uloc.loc_oflags = LOC_RONLY; + uloc.loc_size = fromsize; + uloc.loc_indicator = 0; + + if (fromfile) + if (strcmp(fromfile,"null") == 0 || strcmp(fromfile, "NULL") == 0) + uloc.loc_indicator = -1; + + $prepare tcl_writeblob from $stmt; + if (chk_status(fd,"PREPARE(WRITEBLOB)", stmt)) return false; + + $execute tcl_writeblob using $uloc; + if (chk_status(fd,"EXECUTE(WRITEBLOB)", stmt)) return false; + + /* + $declare tcl_writeblob_cur cursor for tcl_writeblob; + chk_status(fd,"DECLARE(WRITEBLOB)", stmt); + + $open tcl_writeblob_cur; + chk_status(fd,"OPEN(WRITEBLOB)", stmt); + + $fetch tcl_writeblob_cur into :found; + chk_status(fd,"FETCH(WRITEBLOB)", stmt); + + sprintf(stmt, "update %s set %s = ? where current of tcl_writeblob_cur", + table, column); + + $prepare tcl_writeblob_new from $stmt; + chk_status(fd,"PREPARE UPDATE(WRITEBLOB)", stmt); + + $execute tcl_writeblob_new using $uloc; + chk_status(fd,"EXECUTE UPDATE(WRITEBLOB)", stmt); + + */ + + /* + After updating it + uloc.loc_size # of bytes transferred + uloc.loc_status = 0 for success, -ve for error + */ + sql_close(fd); + if (sql_error_code() == 0 && uloc.loc_status == 0) + return uloc.loc_size; + + return -1; +} + +#ifdef USE_NAMESPACE +} +#endif + diff --git a/db/sqlint8.cpp b/db/sqlint8.cpp new file mode 100644 index 0000000..bf73081 --- /dev/null +++ b/db/sqlint8.cpp @@ -0,0 +1,39 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "sah_config.h" +#include +#include +#include +#include "sqlint8.h" + +#ifdef HAVE_INTTYPES_H + +#elif defined(LLONG_MAX) || defined(HAVE_LONG_LONG) + +#elif defined(USE_MYSQL) && defined(longlong_defined) + +#elif defined(USE_INFORMIX) + +char _ifx_int8::pval[20]; + +#elif defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS >= 64) + +#elif defined(HAVE_LONG_DOUBLE) + +#else + +#endif diff --git a/db/sqlint8.h b/db/sqlint8.h new file mode 100644 index 0000000..3d7ab37 --- /dev/null +++ b/db/sqlint8.h @@ -0,0 +1,161 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef _SQLINT8_H_ +#define _SQLINT8_H_ + +#include "sah_config.h" +#include + +#ifdef HAVE_INTTYPES_H +#include +typedef int64_t sqlint8_t; +#ifdef PRIdLEAST64 + #define INT8_FMT PRIdLEAST64 +#else + #if SIZEOF_LONG_INT >=8 + #define INT8_FMT "ld" + #else + #define INT8_FMT "lld" + #endif +#endif +#define INT8_PRINT_CAST(x) x +#define INT8_USING_INT64_T + + +#elif SIZEOF_LONG_INT >= 8 +typedef long sqlint8_t; +#define INT8_FMT "ld" +#define INT8_PRINT_CAST(x) x +#define INT8_USING_LONG + +#elif defined(LLONG_MAX) || defined(HAVE_LONG_LONG) +typedef long long sqlint8_t; +#define INT8_FMT "lld" +#define INT8_PRINT_CAST(x) x +#define INT8_USING_LONG_LONG + +#elif defined(USE_MYSQL) && !defined(CLIENT) +#include "my_config.h" +#include "global.h" +typedef longlong sqlint8_t; +#define INT8_FMT "lld" +#define INT8_PRINT_CAST(x) x +#define INT8_USING_LONGLONG + +#elif defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS >= 64) +typedef _int64 sqlint8_t; +#define INT8_FMT "lld" +#define INT8_PRINT_CAST(x) x +#define INT8_USING_INT64 + +#elif defined(USE_INFORMIX) +#include "int8.h" +#include "sqlhdr.h" +#include +#include + +class _ifx_int8 { + public: + _ifx_int8(ifx_int8 a) : val(a) {}; + _ifx_int8(const char *s) {ifx_int8cvasc(const_cast(s),strlen(s),&val);}; + _ifx_int8(double d) {ifx_int8cvdbl(d,&val);}; + _ifx_int8(long l) {ifx_int8cvlong(l,&val);}; + _ifx_int8(int l=0) {ifx_int8cvlong(static_cast(l),&val);}; + operator const char *() const ; + operator long() const ; + private: + ifx_int8 val; + static char pval[20]; +}; + + +inline _ifx_int8::operator const char *() const { + ifx_int8toasc(const_cast(&val),pval,20); + pval[19]=0; + return pval; +} + +inline _ifx_int8::operator long() const { + long l; + ifx_int8tolong(const_cast(&val),&l); + return l; +} + +typedef _ifx_int8 sqlint8_t; +#define INT8_FMT "s" +#define INT8_PRINT_CAST(x) static_cast(x) +#define INT8_USING_IFX + +#elif defined(HAVE_LONG_DOUBLE) +typedef long double sqlint8_t; +#define INT8_FMT "lf21.0" +#define INT8_PRINT_CAST(x) x +#define INT8_USING_LONG_DOUBLE + +#else +typedef double sqlint8_t; +#define INT8_FMT "f16.0" +#define INT8_PRINT_CAST(x) x +#define INT8_USING_DOUBLE +#endif + +#ifndef HAVE_ATOLL +inline sqlint8_t atoll(const char *p) { + sqlint8_t rv=0; + sqlint8_t sign=1; + while (isspace(*(p++))) /* do nothing */ ; + if (*p=='-') { + sign=-1; + p++; + } + while (isdigit(*(p++))) { + rv*=10; + rv+=(*(p-1)-'0'); + } + rv*=sign; + return rv; +} +#endif + +#if defined(INT8_USING_INT64) || defined(INT8_USING_IFX) +inline std::ostream &operator <<(std::ostream &o, const sqlint8_t &p) { + char buf[32]; + sprintf(buf,"%"INT8_FMT,INT8_PRINT_CAST(p)); + o << buf ; + return o; +} + +inline std::istream &operator >>(std::istream &i, sqlint8_t &p) { + char c=' '; + sqlint8_t sign=1; + p=0; + while (isspace(c) && !i.eof()) i.get(c); + if (c=='-') { + sign=-1; + if (!i.eof()) i.get(c); + } + while (isdigit(c) && !i.eof()) { + p*=10; + p+=(c-'0'); + i.get(c); + } + if (!i.eof()) i.putback(c); + p*=sign; + return i; +} +#endif +#endif diff --git a/db/sqlmysql.cpp b/db/sqlmysql.cpp new file mode 100644 index 0000000..15a632f --- /dev/null +++ b/db/sqlmysql.cpp @@ -0,0 +1,313 @@ +// Copyright (c) 1999-2013 Regents of the University of California +// +// FFTW: Copyright (c) 2003,2006-2011 Matteo Frigo +// Copyright (c) 2003,2006-2011 Massachusets Institute of Technology +// +// fft8g.[cpp,h]: Copyright (c) 1995-2001 Takya Ooura +// +// ASMLIB: Copyright (c) 2004 Agner Fog + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) any later +// version. + +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with this program; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions +// as an alternative to FFTW and distribute a linked executable and +// source code. You must obey the GNU General Public License in all +// respects for all of the code used other than the FFT library itself. +// Any modification required to support these libraries must be distributed +// under the terms of this license. If you modify this program, you may extend +// this exception to your version of the program, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. Please be aware that FFTW and ASMLIB are not covered by +// this exception, therefore you may not use FFTW and ASMLIB in any derivative +// work so modified without permission of the authors of those packages. + +#include "sah_config.h" + +#include +#include +#include +#include +#include + +#include "sqlapi.h" + +struct CURSOR { + CURSOR() : active(0), is_select(1), rp(0), current_row(0) {}; + int active; + int is_select; + MYSQL_RES *rp; + MYSQL_ROW current_row; +}; + +MYSQL* mysql; +char sql_dbname[256]; + +const char *myerrormsg; + +CURSOR cursor_arr[sql::MAXCURSORS]; + +bool chk_cursor(SQL_CURSOR fd, const char *s) { + bool rv=true; + if (fd<0) rv=false; + if (fd>(sql::MAXCURSORS-1)) rv=false; + if (rv) rv=(cursor_arr[fd].active); + if (!rv) { + myerrormsg=s; + fprintf(stderr,"%s: %s\r\n",s,sql_error_message()); + } else { + myerrormsg=0; + } + return (rv); +} + + + + + +// convert ' to \' in place +static void escape_single_quotes(char* field) { + char buf[sql::MAX_QUERY_LEN]; + char* q = buf, *p = field; + while (*p) { + if (*p == '\'') { + *q++ = '\\'; + *q++ = '\''; + } else { + *q++ = *p; + } + p++; + } + *q = 0; + strcpy(field, buf); +} + +static void unescape_single_quotes(char* p) { + char* q; + while (1) { + q = strstr(p, "\\'"); + if (!q) break; + strcpy(q, q+1); + } +} + +bool sql_database(const char* dbname, const char* password, int exclusive) { + char buf[256], *p, *host; + if ((!dbname) || (strlen(dbname)==0)) { + dbname=getenv("DATABASE"); + } + buf[0]=0; + if (dbname) { + strncpy(buf,dbname,254); + strncpy(sql_dbname,dbname,254); + buf[255]=0; + } + if ((p=strchr(buf,'@'))) { + host=p+1; + *p=0; + } else { + host=0; + } + mysql = mysql_init(0); + if (!mysql) { + fprintf(stderr,"mysql_init() failed:"); + fprintf(stderr,"%s\r\n",sql_error_message()); + return false; + } + + if (buf[0]) { + mysql = mysql_real_connect(mysql, host, 0, password, buf, 0, 0, 0); + } else { + mysql = mysql_real_connect(mysql, host, 0, password, 0, 0, 0, 0); + } + + if (!mysql) { + fprintf(stderr,"mysql_real_connect(%p,%s,0,%s,%s,0,0,0) failed:",mysql,host,password,buf); + fprintf(stderr,"%s\r\n",sql_error_message()); + return false; + } + return true; +} + +bool sql_run(const char *stmt, SQL_ROW &argv) { + SQL_CURSOR fd; + bool ret=true; + + fd = sql_open(stmt, argv); + if (ret=chk_cursor(fd, stmt)) { + if (cursor_arr[fd].is_select) { + ret=sql_fetch(fd); + if (ret) { + argv=sql_values(fd); + } else { + ret=chk_cursor(fd, stmt); + } + } + } + if (fd>=0) sql_close(fd); + return ret; +} + +int begin_work() { + return mysql_query(mysql,"begin"); +} + +int commit_work() { + return mysql_query(mysql,"commit"); +} + +int rollback_work() { + return mysql_query(mysql,"rollback"); +} + +bool sql_finish() { + mysql_close(mysql); + return 1; +} + +sqlint8_t sql_insert_id(SQL_CURSOR fd) { + return mysql_insert_id(mysql); +} + +int sql_error_code() { + return mysql_errno(mysql); +} + +const char *sql_error_message() { + return mysql?mysql_error(mysql):"Not connected"; +} + +bool sql_exists(const char *table, const char *field, const char *value, + const char *where) { + char stmt[sql::MAX_QUERY_LEN]; + SQL_CURSOR c; + int rv=false; + if (value && *value) { + sprintf(stmt,"select '1' from %s where %s = %s", table, field, value); + } else { + sprintf(stmt,"select '1' from %s",table); + if (where && *where) { + sprintf(stmt+strlen(stmt),"where %s",where); + } + } + if (((c=sql_open(stmt))>=0) && sql_fetch(c)) { + rv=true; + } + sql_close(c); + return rv; +} + +bool sql_fetch(SQL_CURSOR c) { + return ((!(cursor_arr[c].is_select)) + || (cursor_arr[c].active && cursor_arr[c].rp + && (cursor_arr[c].current_row=mysql_fetch_row(cursor_arr[c].rp)))) ; +} + +SQL_ROW sql_values(SQL_CURSOR c, int *num, int dostrip) { + SQL_ROW rv; + if (cursor_arr[c].active && cursor_arr[c].rp) { + MYSQL_RES *rp=cursor_arr[c].rp; + const char **row=const_cast(cursor_arr[c].current_row); + if (row) { + if (num) { + *num=mysql_num_fields(rp); + } + rv=SQL_ROW(row,mysql_num_fields(rp)); + } + } + return rv; +} + +SQL_CURSOR allocate_cursor() { + int i=0; + while (cursor_arr[i].active && (i=0)) { + //printf("mysql= %p",mysql); fflush(stdout); + rv=mysql_real_query(mysql,query.c_str(),query.size()); + //printf("rv= %d",rv); fflush(stdout); + } else { + //fprintf(stderr,"field mismatch: %d != %d in %s\r\n",argv.argc(),n_sub,query.c_str()); + } + if (rv) { + chk_cursor(c,"mysql_real_query"); + free_cursor(c); + return -1; + } + if (store_result(c)) { + cursor_arr[c].is_select=1; + } else { + if (mysql_field_count(mysql)!=0) { + fprintf(stderr,"mysql_field_count()!=0 : %s\r\n",query.c_str()); + free_cursor(c); + return -1; + } + cursor_arr[c].is_select=0; + } + return c; +} + diff --git a/db/sqlrow.cpp b/db/sqlrow.cpp new file mode 100644 index 0000000..d6ba198 --- /dev/null +++ b/db/sqlrow.cpp @@ -0,0 +1,383 @@ +// Copyright 2003 Regents of the University of California + +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include "sah_config.h" + +#include +#include +#include +#include +#include + +#include "sqlrow.h" + +const SQL_ROW empty_row; +const std::string empty_string(""); + +#define found(x) ((x != std::string::npos)) + +std::string *SQL_ROW::string_delimited(std::string &s, char c_start, char c_end) +{ + // return the substring of a string delimited by c_start and c_end. + // c_start and c_end. The substring returned will include everything from + // c_start and before the comma or end or string following c_end. + std::string::size_type open,cls,strt,comma; + std::string::size_type q(s.find(c_start)); // find the opening delimiter. + + if (found(q)) { + strt=q; + int nopen=1; + // since any of the items inside this type could be sql defined + // types themselves, we need to find the matching close delimiter + do { + open=s.find(c_start,q+1); + cls=s.find(c_end,q+1); + if (found(cls) && (cls SQL_ROW::parse_delimited(std::string &s,char c_start,char c_end) { + // parse a section of a comma separated string delimited by the characters + // c_start and c_end. The substring parsed will include everything after + // c_start and before the comma or end of string following c_end. This allows + // sql types of the format "ROW(a,b,c)::type_name" to be properly parsed + // to return a,b and c. + std::string *sub(string_delimited(s,c_start,c_end)); // Get delimited string + std::string tmp(*sub,1,sub->size()-1); // Remove opening delimiter + std::vector rv(parse_row(tmp)); + delete sub; +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"std::string deleted at 0x%p\n",sub); + fflush(stderr); +#endif + return rv; +} + +std::vector SQL_ROW::parse_type(std::string &s) { + // Parses informix defined types of the format "ROW(a,b,c)::typename" + return parse_delimited(s,'(',')'); +} + +std::vector SQL_ROW::parse_list(std::string &s) { + // Parses informix lists of the format "LIST{a,b,c}" + return parse_delimited(s,'{','}'); +} + +std::string *SQL_ROW::parse_blob(std::string &s) { + // Parsed binary objects of the format "fasd874235vxzfdgas" + // or binary objects consisting of the entire string. + std::string *rv; + std::string::size_type etag=s.find('>'); + ssize_t length; + + if (found(etag)) { + std::string::size_type p(s.find('=')); + if (p SQL_ROW::parse_row(std::string &s) { + // parses a SQL row of the format "value,value,value,value", + // where value can be of the form: + // number (i.e. 10) + // "string" + // 'string' + // LIST{value,value,value} + // ROW(value,value,value)::typename + // the passed string is consumed by this routine. + // WARNING: NOT THREAD SAFE + std::string::size_type comma,dquote,quote,p; + std::vector::iterator i; + std::vector rv; + static bool outer=true; + + while (s.size()) { // While there's still bits of string left to process + // get rid of leading spaces and commas + while (isspace(s[0]) && s.size()) s.erase(0,1); + while (s[0]==',') s.erase(0,1); + + // Handle the special cases first... + if (s.find("LIST")==0) { + // only parse a LIST if the entire string passed to parse_row was a list + if (outer) { + outer=false; + std::vector tmprow(parse_list(s)); + for (i=tmprow.begin();i tmprow(parse_type(s)); + for (i=tmprow.begin();i("SQL_ROW") { + if (s) { + std::string tmp(*s); + pval=parse_row(tmp); + } else { + pval.clear(); + for (size_t i=0;i &t) : track_mem("SQL_ROW") { + std::string s(""); + size_t i,tot_size=0; + for (i=0;i("SQL_ROW") { + ssize_t i; + std::string *p; + if (end_col<(ssize_t)start_col) end_col=(ssize_t)s.argc()-1; + for (i=start_col;i<(end_col+1);i++) { + if (s.exists(i)) { + p=new std::string(*(s[i])); +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"std::string allocated at 0x%p\n",p); + fflush(stderr); +#endif + } else { + p=0; + } + pval.push_back(p); + } +} + +SQL_ROW &SQL_ROW::operator =(const SQL_ROW &s) { + if (this != &s) { + size_t i; + std::string *p; + for (i=0;i +#include +#include +#include +#include +#include +#include "track_mem.h" +#include "xml_util.h" + +typedef int SQL_CURSOR; + +class SQL_ROW; +extern const SQL_ROW empty_row; +extern const std::string empty_string; + +class SQL_ROW : track_mem { + public: + explicit SQL_ROW(const std::string *s=NULL,size_t i=0); + explicit SQL_ROW(const std::vector &s); + explicit SQL_ROW(const char **arr, int nfields); + SQL_ROW(const SQL_ROW &r, size_t start_col=0, ssize_t end_col=-1); + ~SQL_ROW(); + SQL_ROW &operator=(const SQL_ROW &r); + std::vector pval; + size_t argc(size_t i); + size_t argc() const; + void clear(size_t i) { + if ((pval.size()>i) && pval[i]) { + delete pval[i]; +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"std::string deleted at 0x%p\n",pval[i]); + fflush(stderr); +#endif + } + pval[i]=NULL; + }; + bool exists(size_t i) const { return ((pval.size()>i) && (pval[i])); } + void clear() { pval.resize(0); } + + // operator char **(); + SQL_ROW operator +(size_t i) const; + std::string *&operator [](size_t i); + const std::string *operator [](size_t i) const; + // const char *operator [](int i) const; + // char *operator *() const; + private: + std::string *string_delimited(std::string &s,char c_open,char c_close); + std::vector parse_delimited(std::string &s,char c_open,char c_close); + std::vector parse_type(std::string &s); + std::vector parse_list(std::string &s); + std::vector parse_row(std::string &s); + std::string *parse_blob(std::string &s); +}; + +//inline SQL_ROW::operator char **() {return static_cast(&(pval[0]));} + +inline std::string *&SQL_ROW::operator [](size_t i) {return pval[i];} +inline const std::string *SQL_ROW::operator [] (size_t i) const { + return (argc()>i)?pval[i]:&empty_string; +} + +/* +inline const char *SQL_ROW::operator [](int i) const { + if (((unsigned)i)c_str()); + } else { + return ""; + } +} +*/ + + +//inline char *SQL_ROW::operator *() const {return (pval[0]);} + +inline size_t SQL_ROW::argc(size_t i) { + if (i > pval.size()) { + while (pval.size() != i) { + pval.push_back(new std::string(empty_string)); +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"std::string allocated at 0x%p\n",pval[pval.size()-1]); + fflush(stderr); +#endif + + } + } else { + while (pval.size() != i) { + if (pval[pval.size()-1]) { +#ifdef DEBUG_ALLOCATIONS + fprintf(stderr,"std::string deleted at 0x%p\n",pval[pval.size()-1]); + fflush(stderr); +#endif + delete pval[pval.size()-1]; + } + pval.pop_back(); + } + } + return pval.size(); +} + +inline size_t SQL_ROW::argc() const {return pval.size();} + +inline SQL_ROW SQL_ROW::operator +(size_t i) const { return SQL_ROW(*this,i); } + +#endif diff --git a/db/tools/Makefile.in b/db/tools/Makefile.in new file mode 100644 index 0000000..519acdc --- /dev/null +++ b/db/tools/Makefile.in @@ -0,0 +1,54 @@ +BOINCDIR = @BOINCDIR@ +INFORMIXDIR= @INFORMIXDIR@ +BOINCLIBS=-L$(BOINCDIR)/lib -lboinc +SETIHOME=../.. +DBLIBS=../xml_util.o ../sqlblob.o ../sqlrow.o ../sqlifx.o @INFORMIX_LIBS@ -ldl -lm -lstdc++ @PTHREAD_LIBS@ + +INCLUDE_DIRS= -I$(SETIHOME) -I$(SETIHOME)/client -I$(SETIHOME)/db \ + @MYSQL_CFLAGS@ \ + @INFORMIX_CFLAGS@ \ + @PTHREAD_CFLAGS@ \ + -I$(BOINCDIR) -I$(BOINCDIR)/lib -I$(BOINCDIR)/sched -I$(BOINCDIR)/db -I$(BOINCDIR)/tools + +LINKOPTIONS=-Xlinker -R -Xlinker $(LD_LIBRARY_PATH):$(INFORMIXDIR)/lib:$(INFORMIXDIR)/lib/esql + +SUFFIXES = .cpp .o + +.cpp.o: + $(CXX) $(CXXFLAGS) -c $< + +CC = @CC@ + +CFLAGS = @CFLAGS@ @DEFS@ $(INCLUDE_DIRS) -DUSE_INFORMIX + +CXX = @CXX@ + +CXXFLAGS = $(CFLAGS) + +dependencies: *.cpp + $(CC) $(CFLAGS) -M *.cpp > dependencies + +all: dependencies print_s4_receivers insert_analysis_config insert_splitter_config insert_receiver_config insert_rfi_zones + +insert_s4_receivers: insert_s4_receivers.o ../schema_master.o ../sqlifx.o ../sqlrow.o + $(CC) $(LINKOPTIONS) -o insert_s4_receivers insert_s4_receivers.o ../schema_master.o $(S4LIBS) $(DBLIBS) $(BOINCLIBS) + +insert_receiver_config: insert_receiver_config.o ../schema_master.o ../sqlifx.o ../sqlrow.o + $(CC) $(LINKOPTIONS) -o insert_receiver_config insert_receiver_config.o ../schema_master.o $(S4LIBS) $(DBLIBS) $(BOINCLIBS) + +insert_analysis_config: insert_analysis_config.o ../schema_master.o ../sqlifx.o ../sqlrow.o + $(CC) $(LINKOPTIONS) -o insert_analysis_config insert_analysis_config.o ../schema_master.o $(S4LIBS) $(DBLIBS) $(BOINCLIBS) + +insert_rfi_zones: insert_rfi_zones.o ../schema_master.o ../sqlifx.o ../sqlrow.o + $(CC) $(LINKOPTIONS) -o insert_rfi_zones insert_rfi_zones.o ../schema_master.o $(S4LIBS) $(DBLIBS) $(BOINCLIBS) + +insert_science_config: insert_science_config.o ../schema_master.o ../sqlifx.o ../sqlrow.o + $(CC) $(LINKOPTIONS) -o insert_science_config insert_science_config.o ../schema_master.o $(S4LIBS) $(DBLIBS) $(BOINCLIBS) + +insert_splitter_config: insert_splitter_config.o ../schema_master.o ../sqlifx.o ../sqlrow.o + $(CC) $(LINKOPTIONS) -o insert_splitter_config insert_splitter_config.o ../schema_master.o $(S4LIBS) $(DBLIBS) $(BOINCLIBS) + +print_s4_receivers: print_s4_receivers.o ../schema_master.o ../sqlifx.o ../sqlrow.o + $(CC) $(LINKOPTIONS) -o print_s4_receivers print_s4_receivers.o ../schema_master.o $(S4LIBS) $(DBLIBS) $(BOINCLIBS) + +include dependencies diff --git a/db/tools/analysis_configs.xml b/db/tools/analysis_configs.xml new file mode 100644 index 0000000..f87e95b --- /dev/null +++ b/db/tools/analysis_configs.xml @@ -0,0 +1,98 @@ + + 24.0 + 1 + 17.8 + 1 + 131072 + 2.225 + 1.42 + 3.0 + 3.2 + 64 + 19.5 + 0.5 + 40960 + 16 + 8192 + 256 + 8.50 + 131072 + 16 + 256 + 0.5 + 1 + 0.0064 # should be beams/s rather and degrees + 0.0320 # should be beams/s rather and degrees + 0.1665 + 262136 + 8192 # should be seconds + 32768 # should be seconds + + + 30.0 + 262136 + + + 100.0 + 65528 + + + 1.0 + 30 + 8 + 8 + 0 + 0 + 0 + 35 + 2.85 + + + 24.0 + 1 + 17.8 + 1 + 131072 + 2.225 + 1.42 + 3.0 + 3.2 + 64 + 19.5 + 0.5 + 40960 + 16 + 8192 + 256 + 8.50 + 131072 + 16 + 256 + 0.5 + 1 + 0.0010 # should be beams/s rather and degrees + 0.0053 # should be beams/s rather and degrees + 0.1665 + 262136 + 8192 # should be seconds + 32768 # should be seconds + + + 30.0 + 262136 + + + 100.0 + 65528 + + + 1.0 + 30 + 8 + 8 + 0 + 0 + 0 + 36 + 2.85 + diff --git a/db/tools/insert_analysis_config.cpp b/db/tools/insert_analysis_config.cpp new file mode 100644 index 0000000..96f3d20 --- /dev/null +++ b/db/tools/insert_analysis_config.cpp @@ -0,0 +1,61 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include "parse.h" +#include "s_util.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +analysis_config cfg; + +int main(int argc, char **argv) { + int i=0; + bool beta=false, sah=false; + + if (argc != 3) { + fprintf(stderr,"Usage:\n insert_analysis_config beta|sah filename\n"); + exit(1); + } + if (strcmp(argv[1], "beta") == 0) { + beta = true; + fprintf(stderr, "Inserting into the beta DB\n"); + } else if (strcmp(argv[1], "sah") == 0) { + sah = true; + fprintf(stderr, "Inserting into the sah DB\n"); + } else { + fprintf(stderr,"Usage:\n insert_analysis_config beta|sah filename\n"); + exit(1); + } + + std::ifstream f(argv[2]); + + if (!f.is_open()) { + fprintf(stderr,"File not found!\n"); + exit(1); + } + + if(beta) { + db_change("sah2b@sah_master_tcp"); + } else if(sah) { + db_change("sah2@sah_master_tcp"); + } else { + fprintf(stderr,"bad DB specification\n"); + } + + while (!f.eof()) { + f >> cfg; + if (!f.eof()) { + i++; + cfg.insert(); + fprintf(stderr, "SQLCODE is %d last SQLCODE is %d\n", sql_error_code(), sql_last_error_code()); + } + } + + std::cout << "Found " << i << " analysis configs." << std::endl; +} + diff --git a/db/tools/insert_receiver_config.cpp b/db/tools/insert_receiver_config.cpp new file mode 100644 index 0000000..1f52441 --- /dev/null +++ b/db/tools/insert_receiver_config.cpp @@ -0,0 +1,43 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include "parse.h" +#include "s_util.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +receiver_config cfg; + +int main(int argc, char **argv) { + int i=0; + + if (argc != 2) { + fprintf(stderr,"Usage:\n insert_receiver_config filename\n"); + exit(1); + } + + std::ifstream f(argv[1]); + + if (!f.is_open()) { + fprintf(stderr,"File not found!\n"); + exit(1); + } + + db_change("sah2@sci_master_tcp"); + + while (!f.eof()) { + f >> cfg; + if (!f.eof()) { + i++; + cfg.insert(); + } + } + + std::cout << "Found " << i << " receiver configs." << std::endl; +} + diff --git a/db/tools/insert_rfi_zones.cpp b/db/tools/insert_rfi_zones.cpp new file mode 100644 index 0000000..33f2685 --- /dev/null +++ b/db/tools/insert_rfi_zones.cpp @@ -0,0 +1,61 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include "parse.h" +#include "s_util.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +rfi_zone zone; + +int main(int argc, char **argv) { + int i=0; + bool beta=false, sah=false; + + if (argc != 3) { + fprintf(stderr,"Usage:\n insert_rfi_zones beta|sah filename\n"); + exit(1); + } + if (strcmp(argv[1], "beta") == 0) { + beta = true; + fprintf(stderr, "Inserting into the beta DB\n"); + } else if (strcmp(argv[1], "sah") == 0) { + sah = true; + fprintf(stderr, "Inserting into the sah DB\n"); + } else { + fprintf(stderr,"Usage:\n insert_rfi_zones beta|sah filename\n"); + exit(1); + } + + std::ifstream f(argv[2]); + + if (!f.is_open()) { + fprintf(stderr,"File not found!\n"); + exit(1); + } + + if(beta) { + db_change("sah2b@sci_master_tcp"); + } else if(sah) { + db_change("sah2@sci_master_tcp"); + } else { + fprintf(stderr,"bad DB specification\n"); + } + + while (!f.eof()) { + f >> zone; + if (!f.eof()) { + i++; + zone.insert(); + fprintf(stderr, "SQLCODE is %d last SQLCODE is %d\n", sql_error_code(), sql_last_error_code()); + } + } + + std::cout << "Found " << i << " rfi zones." << std::endl; +} + diff --git a/db/tools/insert_s4_receivers.cpp b/db/tools/insert_s4_receivers.cpp new file mode 100644 index 0000000..e850833 --- /dev/null +++ b/db/tools/insert_s4_receivers.cpp @@ -0,0 +1,54 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include "s_util.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +#include +#include + +#define S4_RECEIVER_CONFIG_FILE "/usr/local/warez/projects/s4/siren/db/ReceiverConfig.tab" + +ReceiverConfig_t input; +receiver_config output; + +int main() { + int i,j; + if (!sql_database("sah2b@sci_master_tcp")) exit(1); + if (!getenv("S4_RECEIVER_CONFIG")) + putenv("S4_RECEIVER_CONFIG="S4_RECEIVER_CONFIG_FILE); + + for (i=0;i<3;i++) { + memset(&input,0,sizeof(input)); + s4cfg_GetReceiverConfig(i, &input); + output.s4_id=input.ReceiverID; + strncpy(output.name,input.ReceiverName,255); + output.name[254]=0; + output.beam_width=input.BeamWidth; + output.center_freq=input.CenterFreq; + output.latitude=input.Latitude; + output.longitude=input.Longitude; + output.elevation=input.Elevation; + output.diameter=input.Diameter; + output.az_orientation=input.AzOrientation; + output.zen_corr_coeff.clear(); + output.az_corr_coeff.clear(); + for (j=0;j<13;j++) { + output.zen_corr_coeff.push_back(input.ZenCorrCoeff[j]); + output.az_corr_coeff.push_back(input.AzCorrCoeff[j]); + } + db_change("sah2b@sci_master_tcp"); + output.id=0; + if (output.insert()) { + std::cout << "inserted row (id=" << output.id << ")" << std::endl; + } else { + std::cout << "insert failed, sql_error_code =" << sql_error_code() << " sql_last_error_code =" << sql_last_error_code() << std::endl; + } + } +} + diff --git a/db/tools/insert_science_config.cpp b/db/tools/insert_science_config.cpp new file mode 100644 index 0000000..e1e6e6a --- /dev/null +++ b/db/tools/insert_science_config.cpp @@ -0,0 +1,62 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include "parse.h" +#include "s_util.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +science_config cfg; + +int main(int argc, char **argv) { + int i=0; + bool beta=false, sah=false; + + if (argc != 3) { + fprintf(stderr,"Usage:\n insert_science_config beta|sah filename\n"); + exit(1); + } + if (strcmp(argv[1], "beta") == 0) { + beta = true; + fprintf(stderr, "Inserting into the beta DB\n"); + } else if (strcmp(argv[1], "sah") == 0) { + sah = true; + fprintf(stderr, "Inserting into the sah DB\n"); + } else { + fprintf(stderr,"Usage:\n insert_science_config beta|sah filename\n"); + exit(1); + } + + std::ifstream f(argv[2]); + + if (!f.is_open()) { + fprintf(stderr,"File not found!\n"); + exit(1); + } + + if(beta) { + db_change("sah2b@sci_master_tcp"); + } else if(sah) { + db_change("sah2@sci_master_tcp"); + } else { + fprintf(stderr,"bad DB specification\n"); + } + + while (!f.eof()) { + f >> cfg; + if (!f.eof()) { + i++; + fprintf(stderr, "%s\n", cfg.print_xml().c_str()); + cfg.insert(); + fprintf(stderr, "SQLCODE is %d last SQLCODE is %d\n", sql_error_code(), sql_last_error_code()); + } + } + + std::cout << "Found " << i << " science configs." << std::endl; +} + diff --git a/db/tools/insert_splitter_config.cpp b/db/tools/insert_splitter_config.cpp new file mode 100644 index 0000000..efd8c15 --- /dev/null +++ b/db/tools/insert_splitter_config.cpp @@ -0,0 +1,44 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include "parse.h" +#include "s_util.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +splitter_config cfg; + +int main(int argc, char **argv) { + int i=0; + + if (argc != 2) { + fprintf(stderr,"Usage:\n insert_splitter_config filename\n"); + exit(1); + } + + std::ifstream f(argv[1]); + + if (!f.is_open()) { + fprintf(stderr,"File not found!\n"); + exit(1); + } + + db_change("sah2b@sah_master_tcp"); + + while (!f.eof()) { + f >> cfg; + if (!f.eof()) { + i++; + cfg.insert(); + if (!cfg.id) std::cout << sql_error_message() << " " << sql_error_code(); + } + } + + std::cout << "Found " << i << " splitter configs." << std::endl; +} + diff --git a/db/tools/print_s4_receivers.cpp b/db/tools/print_s4_receivers.cpp new file mode 100644 index 0000000..8c027d4 --- /dev/null +++ b/db/tools/print_s4_receivers.cpp @@ -0,0 +1,26 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include "s_util.h" +#include "sqlapi.h" +#include "xml_util.h" +#include "db_table.h" +#include "schema_master.h" + +receiver_config input; + +int main() { + if (!sql_database("sah2b@sci_master_tcp")) exit(1); + std::cout << "\n"; + std::cout << xml_indent() << "" << input.count() << "\n" ; + if (input.open_query()) { + while (input.get_next()) { + std::cout << input.print_xml(); + } + } + std::cout << "\n"; +} diff --git a/db/tools/recorder_configs.sql b/db/tools/recorder_configs.sql new file mode 100644 index 0000000..a981c2f --- /dev/null +++ b/db/tools/recorder_configs.sql @@ -0,0 +1,3 @@ +database sah2@sci_master_tcp; + +insert into recorder_config values(0,"seti_dr2_ALFA",2,2500000,14,1.99); diff --git a/db/tools/rfi_zones_to_xml.pro b/db/tools/rfi_zones_to_xml.pro new file mode 100644 index 0000000..68460f5 --- /dev/null +++ b/db/tools/rfi_zones_to_xml.pro @@ -0,0 +1,23 @@ +pro zones_to_xml, zones, file + + unit = 1 + openw, unit, file + + n = n_elements(zones) + + for i=0,n-1 do begin + printf, unit, "" + printf, unit, " ", zones[i].min_time, "" + printf, unit, " ", zones[i].max_time, "" + printf, unit, " ", zones[i].CENTRAL_DETECTION_FREQ, "" + printf, unit, " ", zones[i].detection_freq_width, "" + printf, unit, " ", zones[i].central_period, "" + printf, unit, " ", zones[i].period_width, "" + printf, unit, " ", zones[i].fft_len_flags, "" + printf, unit, " ", zones[i].signal_type_flags, "" + printf, unit, "" + endfor + + close, unit + +end diff --git a/db/tools/s4_receivers.xml b/db/tools/s4_receivers.xml new file mode 100644 index 0000000..9b3e91c --- /dev/null +++ b/db/tools/s4_receivers.xml @@ -0,0 +1,357 @@ + + 0 + ao430 + 0.166999996 + 430 + 18.3538056 + -66.7552222 + 497 + 168 + 0 + + 7.4,5.4,-49.1,355,0,0,0,0,0,0,0,0,0 + + + -97.1,66.1,14.3,321.7,0,0,0,0,0,0,0,0,0 + + + + 1 + ao1420 + 0.0829999968 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 0 + + 7.4,5.4,-49.1,-1091,0,0,0,0,0,0,0,0,0 + + + -5146.7,66.1,14.3,321.7,0,0,0,0,0,0,0,0,0 + + + + 2 + aogreg1420 + 0.0500000007 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -16.41,-6.41,99.16,-713.84,-1028.24,-22.2,-12.08,7.31,111.56,2.49,-0.69, + -1.93,0.91 + + + -90.48,-100.92,-5.74,175.81,489.81,-11.42,-7.8,4,1.25,0.43,-0.42,-0.3, + -0.19 + + + + 3 + Arecibo 1.4GHz Array, Beam 0, Pol 0 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + + + 4 + Arecibo 1.4GHz Array, Beam 0, Pol 1 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + + + 5 + Arecibo 1.4GHz Array, Beam 1, Pol 0 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + 120.0 + + + 6 + Arecibo 1.4GHz Array, Beam 1, Pol 1 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + 120.0 + + + 7 + Arecibo 1.4GHz Array, Beam 2, Pol 0 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + 180.0 + + + 8 + Arecibo 1.4GHz Array, Beam 2, Pol 1 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + 180.0 + + + 9 + Arecibo 1.4GHz Array, Beam 3, Pol 0 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + -120.0 + + + 10 + Arecibo 1.4GHz Array, Beam 3, Pol 1 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + -120.0 + + + 11 + Arecibo 1.4GHz Array, Beam 4, Pol 0 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + -60.0 + + + 12 + Arecibo 1.4GHz Array, Beam 4, Pol 1 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + -60.0 + + + 13 + Arecibo 1.4GHz Array, Beam 5, Pol 0 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + 0.0 + + + 14 + Arecibo 1.4GHz Array, Beam 5, Pol 1 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + 0.0 + + + 15 + Arecibo 1.4GHz Array, Beam 6, Pol 0 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + 60.0 + + + 16 + Arecibo 1.4GHz Array, Beam 6, Pol 1 + 0.05 + 1420 + 18.3538056 + -66.7552222 + 497 + 168 + 180 + + -37,-6.05,92.35,-731.21,-1013.97,-24.53,-11.19,9.18,106.04,3.02,-1.74, + -3.46,1.29 + + + -57.55,-95.56,-4.13,141.69,677.51,-10.41,-7.71,-10.39,0.08,0.43,-0.62, + 0.03,-0.36 + + 329.06 + 384.005 + 60.0 + + + diff --git a/db/tools/science_configs.xml b/db/tools/science_configs.xml new file mode 100644 index 0000000..d299d8d --- /dev/null +++ b/db/tools/science_configs.xml @@ -0,0 +1,48 @@ + + 0 + NEST + 2048 + 10.0 + 2500000.0 + 50.0 + 0.05 + 0.05 + 14400.0 + 2000 + 10.0 + 50000.0 + 0.0 + 0.0 + 107.0 + 0.010417 + 12.5 + 0.0 + 0.0 + 0.0 + 0.0 + place_holder + + + 1 + NEST + 2048 + 10.0 + 2500000.0 + 50.0 + 0.05 + 0.05 + 14400.0 + 2000 + 10. + 50000. + 0.0 + 0.000694 + 107.0 + 0.000694 + 12.5 + 0.000694 + 12.5 + 0.000694 + 0.0 + place_holder + diff --git a/db/tools/settings.sql b/db/tools/settings.sql new file mode 100644 index 0000000..58ebc20 --- /dev/null +++ b/db/tools/settings.sql @@ -0,0 +1,6 @@ +database sah2@sah_master_tcp; + +-- update settings set active=0 where 1 = 1 ; + +insert into settings values(0,11,2,6,9197,7); + diff --git a/db/tools/splitter_configs.xml b/db/tools/splitter_configs.xml new file mode 100644 index 0000000..c592fdd --- /dev/null +++ b/db/tools/splitter_configs.xml @@ -0,0 +1,11 @@ + + 0.30 + encoded + 2048 + 16 + fft + welsh + 4194304 + 0.0 + randomize + diff --git a/db/track_mem.h b/db/track_mem.h new file mode 100644 index 0000000..f629d9d --- /dev/null +++ b/db/track_mem.h @@ -0,0 +1,39 @@ + +#ifndef _TRACK_MEM_H_ +#define _TRACK_MEM_H_ + +#include +#include + +template +class track_mem { +#ifdef DEBUG_ALLOCATIONS + private: + static const char *name; + static int ref_count; + public: + track_mem(const char *n="unknown") { + name=n; + fprintf(stderr,"%s #%d: allocated 0x%lx bytes at 0x%p\n",name,++ref_count,sizeof(T),this); + fflush(stderr); + }; + ~track_mem() { + fprintf(stderr,"%s #%d: freed 0x%lx bytes at 0x%p\n",name,this->ref_count--,sizeof(T),this); + fflush(stderr); + }; +#else + public: + track_mem(const char *n=0) {}; + ~track_mem() {}; +#endif +}; + +#ifdef DEBUG_ALLOCATIONS +template +const char *track_mem::name; + +template +int track_mem::ref_count; +#endif + +#endif diff --git a/db/xml_util.cpp b/db/xml_util.cpp new file mode 100644 index 0000000..6b94de0 --- /dev/null +++ b/db/xml_util.cpp @@ -0,0 +1,838 @@ +// $Id: xml_util.cpp,v 1.3.2.8 2007/02/28 01:45:17 vonkorff Exp $ +// The contents of this file are subject to the BOINC Public License +// Version 1.0 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://boinc.berkeley.edu/license_1.0.txt +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is the Berkeley Open Infrastructure for Network Computing. +// +// The Initial Developer of the Original Code is the SETI@home project. +// Portions created by the SETI@home project are Copyright (C) 2002 +// University of California at Berkeley. All Rights Reserved. +// +// Contributor(s): +// +// Revision History +// $Log: xml_util.cpp,v $ +// Revision 1.3.2.8 2007/02/28 01:45:17 vonkorff +// +// stopped using BUFSIZ to size temporary buffers +// +// Revision 1.3.2.7 2007/02/22 02:27:23 vonkorff +// +// Added #include "str_util.h" +// +// Revision 1.3.2.6 2006/12/14 22:26:30 korpela +// *** empty log message *** +// +// Revision 1.3.2.5 2006/05/04 21:45:46 charlief +// *** empty log message *** +// +// Revision 1.3.2.4 2006/05/04 12:36:10 charlief +// *** empty log message *** +// +// Revision 1.3.2.3 2006/01/04 00:47:30 korpela +// Upped version to 5.0 +// Made it clear in graphics that this is SETI@home Enhanced +// +// Revision 1.3.2.2 2005/11/17 18:44:39 jeffc +// Fixed a problem with the << operator for db_table.h. +// Also altered << operator to stop looking for the start tag after it is found +// and to not look for the stop tag until after the start is found. +// Modified xml_match_tag() to not search zero length strings. +// +// Revision 1.3.2.1 2005/10/17 22:14:48 korpela +// Fixed bugs with XML formatting and CSV vector input. The XML formatting bug +// fixes were submitted by Tetsuji "Maverick" Rai. The CSV input problem was due +// to my misunderstanding of the istream::operator void *(). I had thought the +// operator returned NULL if the past operation had failed. Instead it returns +// NULL if the NEXT operation will fail. +// +// Revision 1.3 2004/07/02 21:21:16 korpela +// Removed include of stdafx.h where it was not necessary. +// +// Revision 1.2 2004/06/30 20:52:28 korpela +// *** empty log message *** +// +// Revision 1.1 2004/06/17 22:41:28 jeffc +// *** empty log message *** +// +// Revision 1.3 2004/06/12 18:38:30 rwalton +// *** empty log message *** +// +// Revision 1.2 2004/06/12 05:56:14 davea +// *** empty log message *** +// +// Revision 1.1 2004/06/11 17:43:22 davea +// *** empty log message *** +// +// Revision 1.29 2004/04/05 20:09:41 korpela +// Rewrote extract_xml_record() to solve some problems... +// +// Revision 1.28 2004/03/06 09:45:25 rwalton +// *** empty log message *** +// +// Revision 1.27 2004/01/22 17:57:41 davea +// *** empty log message *** +// +// Revision 1.26 2004/01/20 02:51:50 korpela +// VC 7 mods +// +// Revision 1.25 2003/12/01 23:42:05 korpela +// Under some compilers template parameters of type char [] weren't getting +// cast to char *. Template functions now use &(array[0]) to ensure correct +// type is used. +// +// +#include "sah_config.h" + +#include +#include +#include +#include +#include +#include + +#include "std_fixes.h" +#include "util.h" +#include "str_util.h" +#include "str_replace.h" +#include "xml_util.h" + +using std::string; +using std::min; + +int xml_indent_level=0; + +std::string xml_indent(int i) { + if (i) xml_indent_level+=i; + xml_indent_level = (xml_indent_level>0) ? xml_indent_level : 0; + return string(min(xml_indent_level,XML_MAX_INDENT),' '); +} +// Most of these entries are for reverse translation of poorly written HTML. +// Forward translation doesn't translate most printable characters. + +const xml_entity xml_trans[]= { + { 0x07, "&bel;" }, + { 0x0a, "&lf;" }, + { 0x0d, "&cr;" }, + { ' ', "&sp;" }, + { '!', "!" }, + { '\"', """ }, + { '\"', "&dquot;" }, + { '#', "#" }, + { '$', "$" }, + { '%', "%" }, + { '&', "&" }, + { '\'', "'" }, + { '(', "(" }, + { ')', ")" }, + { '*', "*" }, + { '+', "+" }, + { ',', "," }, + { '-', "‐" }, + { '-', "−" }, + { '.', "." }, + { '/', "/" }, + { ':', ":" }, + { ';', ";" }, + { '<', "<" }, + { '=', "=" }, + { '>', ">" }, + { '?', "?" }, + { '@', "@" }, + { '[', "[" }, + { '\\', "\" }, + { ']', "]" }, + { '^', "ˆ" }, + { '_', "_" }, + { '_', "―" }, + { '`', "`" }, + { '{', "{" }, + { '|', "|" }, + { '}', "}" }, + { '~', "˜" }, + { 0x82, "‚" }, + { 0x84, "„" }, + { 0x85, "&ldots;" }, + { 0x8a, "Š" }, + { 0x8b, "‹" }, + { 0x8c, "Œ" }, + { 0x91, "‘" }, + { 0x91, "’" }, + { 0x92, "’" }, + { 0x93, "“" }, + { 0x93, "”" }, + { 0x94, "”" }, + { 0x95, "•" }, + { 0x96, "–" }, + { 0x96, "&endash;" }, + { 0x97, "—" }, + { 0x97, "&emdash;" }, + { 0xa0, " " }, + { 0xa1, "¡" }, + { 0xa2, "¢" }, + { 0xa3, "£" }, + { 0xa4, "¤" }, + { 0xa5, "¥" }, + { 0xa6, "¦" }, + { 0xa7, "§" }, + { 0xa8, "¨" }, + { 0xa9, "©" }, + { 0xaa, "ª" }, + { 0xab, "«" }, + { 0xac, "¬" }, + { 0xad, "­" }, + { 0xae, "®" }, + { 0xaf, "¯" }, + { 0xb0, "°" }, + { 0xb1, "±" }, + { 0xb2, "²" }, + { 0xb3, "³" }, + { 0xb4, "´" }, + { 0xb5, "µ" }, + { 0xb6, "¶" }, + { 0xb7, "·" }, + { 0xb8, "¸" }, + { 0xb9, "¹" }, + { 0xba, "º" }, + { 0xbb, "»" }, + { 0xbc, "¼" }, + { 0xbd, "½" }, + { 0xbe, "¾" }, + { 0xbf, "¿" }, + { 0xc0, "À" }, + { 0xc1, "Á" }, + { 0xc2, "Â" }, + { 0xc3, "Ã" }, + { 0xc4, "Ä" }, + { 0xc5, "Å" }, + { 0xc6, "Æ" }, + { 0xc7, "Ç" }, + { 0xc8, "È" }, + { 0xc9, "É" }, + { 0xca, "Ê" }, + { 0xcb, "Ë" }, + { 0xcc, "Ì" }, + { 0xcd, "Í" }, + { 0xce, "Î" }, + { 0xcf, "Ï" }, + { 0xd0, "Ð" }, + { 0xd1, "Ñ" }, + { 0xd2, "Ò" }, + { 0xd3, "Ó" }, + { 0xd4, "Ô" }, + { 0xd5, "Õ" }, + { 0xd6, "Ö" }, + { 0xd7, "×" }, + { 0xd8, "Ø" }, + { 0xd9, "Ù" }, + { 0xda, "Ú" }, + { 0xdb, "Û" }, + { 0xdc, "Ü" }, + { 0xdd, "Ý" }, + { 0xde, "Þ" }, + { 0xdf, "ß" }, + { 0xe0, "à" }, + { 0xe1, "á" }, + { 0xe2, "â" }, + { 0xe3, "ã" }, + { 0xe4, "ä" }, + { 0xe5, "å" }, + { 0xe6, "æ" }, + { 0xe7, "ç" }, + { 0xe8, "è" }, + { 0xe9, "é" }, + { 0xea, "ê" }, + { 0xeb, "ë" }, + { 0xec, "ì" }, + { 0xed, "í" }, + { 0xee, "î" }, + { 0xef, "ï" }, + { 0xf0, "ð" }, + { 0xf1, "ñ" }, + { 0xf2, "ò" }, + { 0xf3, "ó" }, + { 0xf4, "ô" }, + { 0xf5, "õ" }, + { 0xf6, "ö" }, + { 0xf7, "÷" }, + { 0xf8, "ø" }, + { 0xf9, "ù" }, + { 0xfa, "ú" }, + { 0xfb, "û" }, + { 0xfc, "ü" }, + { 0xfd, "ý" }, + { 0xfe, "þ" }, + { 0xff, "ÿ" }, + { 0x00, 0 } +}; + +#if 0 +xml_ofstream::xml_ofstream() : my_tag(), os() {} + +xml_ofstream::xml_ofstream(const char *filename, const char *tag, + std::ios_base::openmode m) : , my_tag(tag), os(filename,m) +{ + if (is_open()) { + write_head(); + } +} + +xml_ostream::xml_ostream(std::ostream &o, const char *tag) + : my_tag(tag), os(o) +{ + write_head(); +} + +xml_ostream::~xml_ostream() { + write_foot(); +} + +xml_ofstream::~xml_ofstream() { + close(); +} + +void xml_ofstream::open(const char *filename, const char *tag, + std::ios_base::openmode m) { + my_tag=std::string(tag); + os.open(filename,m); + if (is_open()) { + write_head(); + } +} + +void xml_ofstream::close() { + write_foot(); + os.close(); +} + +void xml_ostream::write_head() { + xml_indent_level=0; + os << xml_header << std::endl; + os << '<' << my_tag << '>' << std::endl; + xml_indent(2); +} + +void xml_ofstream::write_head() { + xml_indent_level=0; + os << xml_header << std::endl; + os << '<' << my_tag << '>' << std::endl; + xml_indent(2); +} + +void xml_ostream::write_foot() { + xml_indent(-2); + os << "' << std::endl; +} + +void xml_ofstream::write_foot() { + xml_indent(-2); + os << "' << std::endl; +} + +xml_ifstream::xml_ifstream() : , my_tag(""), xml_start(0), ifs() + xml_end(0) {} + +xml_ifstream::xml_ifstream(const char *filename, const char *tag, + std::ios_base::openmode m) : std::ifstream(filename,m), my_tag(tag), + xml_start(0), xml_end(0) { + if (is_open()) { + seek_head(); + } +} + +xml_istream::xml_istream(std::istream &i, const char *tag) + : my_tag(tag), is(i) { +} + +xml_ifstream::~xml_ifstream() { + close(); +} + +void xml_ifstream::open(const char *filename, const char *tag, + std::ios_base::openmode m) { + my_tag=std::string(tag); + std::ifstream::open(filename,m); + if (is_open()) { + seek_head(); + } +} + +void xml_istream::seek_head() { + std::string tmp; + char c; + unsigned int i=0; + bool start_found=false; + if (my_tag.size()) { + while (is) { + is.get(c); + if (c=='<') { + do { + is.get(c); + i++; + } while (c == my_tag[i-1]); + if ((i==my_tag.size()) && !isalnum(c)) { + start_found=true; + break; + } + } + } + } else { + while (is) { + is.get(c); + if (c=='<') { + do { + is.get(c); + if (isalnum(c)) my_tag+=c; + } while (isalnum(c)); + } + if (my_tag.size()) { + start_found=true; + break; + } + } + } + if (start_found) { + while ((c != '>') && is) is.get(c); + } +} + + +void xml_ifstream::seek_head() { + if (!xml_start) { + std::string tmp; + std::string::size_type tag_start, tag_end; + bool start_found=false; + std::ifstream::seekg(0,std::ios::beg); + if (my_tag.size()) { + do { + *this >> tmp; + if ((tag_start=tmp.find(std::string("<")+my_tag)) != std::string::npos) { + tag_start=tmp.find('>'); + std::ifstream::seekg(tag_start-tmp.size()+my_tag.size()+2,std::ios::cur); + start_found=true; + } else { + if ((tag_start=tmp.find("<")) != std::string::npos) { + if (isalpha(tmp[tag_start+1])) { + while (isalnum(tmp[++tag_start])) my_tag+=tmp[tag_start]; + start_found=true; + tag_start=tmp.find(">",tag_start-1); + std::ifstream::seekg(tag_start-tmp.size(),std::ios::cur); + } + } + } + } while (!start_found && !std::ifstream::eof()); + xml_start=std::ifstream::tellg(); + } + if (my_tag.size()) { + int nstarts=1; + std::string start_tag(std::string("<")+my_tag); + std::string end_tag(std::string("> tmp; + if (tmp.find(start_tag)!=std::string::npos) { + nstarts++; + } + if ((tag_end=tmp.find(end_tag))!=std::string::npos) { + nstarts--; + } + } while (nstarts && !std::ifstream::eof()); + std::ifstream::seekg(tag_end-tmp.size(),std::ios::cur); + xml_end=std::ifstream::tellg(); + } + } + if (xml_start) std::ifstream::seekg(xml_start,std::ios::beg); +} + +xml_ifstream &xml_ifstream::seekg(pos_type p) { + if (xml_start) std::ifstream::seekg(xml_start+p); + return *this; +} + +xml_ifstream &xml_ifstream::seekg(off_type o, std::ios::seekdir d) { + switch (d) { + case std::ios::beg: + seekg(o); + break; + case std::ios::end: + std::ifstream::seekg(xml_end+o); + break; + default: + std::ifstream::seekg(o,d); + break; + } + return *this; +} + +std::ios::pos_type xml_ifstream::tellg() { + return std::ifstream::tellg()-xml_start; +} + +bool xml_ifstream::eof() { + if (std::ifstream::tellg() >= xml_end) { + return true; + } else { + return std::ifstream::tellg(); + } +} +#endif // 0 + +#ifdef HAVE_MAP +#include + +std::multimap encode_map; +std::map decode_map; + +void populate_encode_map() { + int i=0; + do { + encode_map.insert(std::make_pair(xml_trans[i].c,xml_trans[i].s)); + } while (xml_trans[++i].s); +} + +void populate_decode_map() { + int i=0; + do { + decode_map[xml_trans[i].s]=xml_trans[i].c; + } while (xml_trans[++i].s); +} +#endif + +const char * encode_arr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +const char * encode_arr85= +"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxy!#$()*+,-./:;=?@^`{|}~z_"; + + +bool isencchar(char c) { + bool rv=((c>='A') && (c<='Z')); + rv|=((c>='a') && (c<='z')); + rv|=((c>='0') && (c<='9')); + rv|=((c=='+') || (c=='/') || (c=='=')); + return rv; +} + +bool isencchar85(char c) { + bool rv=((c>='A') && (c<='Z')); + rv|=((c>='a') && (c<='z')); + rv|=((c>='0') && (c<='9')); + switch (c) { + case '!': + case '#': + case '$': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '=': + case '?': + case '@': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + case '_': + rv=true; + break; + default: + break; + } + return rv; +} + + + + +std::string encode_char(unsigned char c) { +#ifdef HAVE_MAP + if (!(encode_map.size())) populate_encode_map(); + std::multimap::iterator p=encode_map.find(c); + if (p!=encode_map.end()) { + return (p->second); + } else { +#else + int i=0; + while (xml_trans[i].s) { + if (xml_trans[i].c == c) return std::string(xml_trans[i].s); + i++; + } + { +#endif + char buf[16]; + sprintf(buf,"&#%.3d;",static_cast(c)); +#ifdef HAVE_MAP + encode_map.insert(std::make_pair(c,&(buf[0]))); +#endif + return std::string(buf); + } +} + +unsigned char decode_char(const char *s) { + char code[32]; + int i=0; + code[31]=0; + while (*s && (*s != ';') && i<31) { + code[i]=*s; + s++; + i++; + } + code[i]=';'; + code[i+1]=0; +#ifdef HAVE_MAP + if (!(decode_map.size())) populate_decode_map(); + std::map::iterator p=decode_map.find(code); + if (p!=decode_map.end()) { + return (p->second); + } else { +#else + while (xml_trans[i].s) { + if (!strcmp(xml_trans[i].s,(const char *)(&code[0]))) return xml_trans[i].c; + i++; + } + { +#endif + if (code[1]=='#') { + sscanf((const char *)(code+2),"%d",&i); +#ifdef HAVE_MAP + decode_map.insert(std::make_pair(std::string(code),static_cast(i&0xff))); +#endif + } else { + fprintf(stderr,"Unknown XML entity \"%s\"\n",code); + i='&'; + } + return static_cast(i&0xff); + } +} + +std::string x_csv_encode_char(const unsigned char *bin, size_t nelements) { + std::ostringstream rv(""); + long lastlen,i,ival; + + rv << std::endl << xml_indent(2); + lastlen=(long)rv.str().size(); + for (i=0;i<(long)(nelements-1);i++) { + ival=bin[i]; + rv << ival << ','; + if ((static_cast(rv.str().size()) + -(lastlen-min(xml_indent_level,XML_MAX_INDENT)))>73) { // TMR + rv << std::endl << xml_indent(); + lastlen=(long)rv.str().size(); + } + } + ival=bin[i]; + rv << ival << std::endl << xml_indent(-2); + return rv.str(); +} + +// test if a character is an xml tag delimiter +bool isxmldelim(char c) { + return ((c==' ') || (c=='\n') || (c=='\r') || + (c==',') || (c=='<') || (c=='>') || + (c==0)); +} + +// return true if the tag appears in the line +// +bool xml_match_tag(const char* buf, const char* tag) { + char tmp_tag[8192]={'<',0}; + if (strlen(buf)==0) return false; + if (tag[0] == '<') { + strlcpy(tmp_tag,tag,8192); + } else { + strlcat(tmp_tag,tag,8192); + } + char *p=tmp_tag+strlen(tmp_tag); + do { + *(p--)=0; + } while (isxmldelim(*p)); + while ((buf=strstr(buf,tmp_tag))) { + if (isxmldelim(buf[strlen(tmp_tag)])) return true; + buf++; + } + return false; +} + +bool xml_match_tag(const std::string &s, const char* tag) { + return xml_match_tag(s.c_str(),tag); +} + +size_t xml_find_tag(const char* buf, const char* tag) { + const char *buf0=buf; + char tmp_tag[8192]={'<',0}; + if (tag[0] == '<') { + strlcpy(tmp_tag,tag,8192); + } else { + strlcat(tmp_tag,tag,8192); + } + char *p=tmp_tag+strlen(tmp_tag); + do { + *(p--)=0; + } while (isxmldelim(*p)); + while ((buf=strstr(buf,tmp_tag))) { + if (isxmldelim(buf[strlen(tmp_tag)])) return buf-buf0; + buf++; + } + return strlen(buf0); +} + +std::string::size_type xml_find_tag(const std::string &s, const char* tag) { + std::string::size_type p=xml_find_tag(s.c_str(),tag); + return (p!=strlen(s.c_str()))?p:(std::string::npos); +} + +bool extract_xml_record(const std::string &field, const char *tag, std::string &record) { + char end_tag[256]; + sprintf(end_tag,"/%s",tag); + std::string::size_type j,k; + + // find the start_tag + j=xml_find_tag(field,tag); + if (j==std::string::npos) return false; + // find the end tag + k=xml_find_tag(std::string(field,j,field.length()-j),end_tag); + if (k==std::string::npos) return false; + + record=std::string(field,j,k+strlen(end_tag)+1); + return true; +} + +// +// $Log: xml_util.cpp,v $ +// Revision 1.3.2.8 2007/02/28 01:45:17 vonkorff +// +// stopped using BUFSIZ to size temporary buffers +// +// Revision 1.3.2.7 2007/02/22 02:27:23 vonkorff +// +// Added #include "str_util.h" +// +// Revision 1.3.2.6 2006/12/14 22:26:30 korpela +// *** empty log message *** +// +// Revision 1.3.2.5 2006/05/04 21:45:46 charlief +// *** empty log message *** +// +// Revision 1.3.2.4 2006/05/04 12:36:10 charlief +// *** empty log message *** +// +// Revision 1.3.2.3 2006/01/04 00:47:30 korpela +// Upped version to 5.0 +// Made it clear in graphics that this is SETI@home Enhanced +// +// Revision 1.3.2.2 2005/11/17 18:44:39 jeffc +// Fixed a problem with the << operator for db_table.h. +// Also altered << operator to stop looking for the start tag after it is found +// and to not look for the stop tag until after the start is found. +// Modified xml_match_tag() to not search zero length strings. +// +// Revision 1.3.2.1 2005/10/17 22:14:48 korpela +// Fixed bugs with XML formatting and CSV vector input. The XML formatting bug +// fixes were submitted by Tetsuji "Maverick" Rai. The CSV input problem was due +// to my misunderstanding of the istream::operator void *(). I had thought the +// operator returned NULL if the past operation had failed. Instead it returns +// NULL if the NEXT operation will fail. +// +// Revision 1.3 2004/07/02 21:21:16 korpela +// Removed include of stdafx.h where it was not necessary. +// +// Revision 1.2 2004/06/30 20:52:28 korpela +// *** empty log message *** +// +// Revision 1.1 2004/06/17 22:41:28 jeffc +// *** empty log message *** +// +// Revision 1.3 2004/06/12 18:38:30 rwalton +// *** empty log message *** +// +// Revision 1.2 2004/06/12 05:56:14 davea +// *** empty log message *** +// +// Revision 1.1 2004/06/11 17:43:22 davea +// *** empty log message *** +// +// Revision 1.29 2004/04/05 20:09:41 korpela +// Rewrote extract_xml_record() to solve some problems... +// +// Revision 1.28 2004/03/06 09:45:25 rwalton +// *** empty log message *** +// +// Revision 1.27 2004/01/22 17:57:41 davea +// *** empty log message *** +// +// Revision 1.26 2004/01/20 02:51:50 korpela +// VC 7 mods +// +// Revision 1.25 2003/12/01 23:42:05 korpela +// Under some compilers template parameters of type char [] weren't getting +// cast to char *. Template functions now use &(array[0]) to ensure correct +// type is used. +// +// Revision 1.24 2003/11/11 17:29:01 quarl +// *** empty log message *** +// +// Revision 1.23 2003/10/29 20:08:49 korpela +// *** empty log message *** +// +// Revision 1.22 2003/10/27 23:07:34 korpela +// *** empty log message *** +// +// Revision 1.21 2003/10/27 20:07:11 korpela +// *** empty log message *** +// +// Revision 1.20 2003/10/27 19:41:23 korpela +// +// Fixed potential buffer overrun in decode_char() +// +// Revision 1.19 2003/10/27 17:52:49 korpela +// *** empty log message *** +// +// Revision 1.18 2003/10/24 16:58:10 korpela +// *** empty log message *** +// +// Revision 1.17 2003/10/24 00:05:02 davea +// *** empty log message *** +// +// Revision 1.16 2003/10/23 19:58:20 jeffc +// jeffc - bug fix in csv encode routine +// +// Revision 1.15 2003/10/23 19:18:38 jeffc +// jeffc - put back in line feeds - no longer using parese_str(). +// +// Revision 1.14 2003/10/23 15:39:54 korpela +// no message +// +// Revision 1.13 2003/10/23 00:25:15 jeffc +// jeffc - no line feeds in CSV encoding +// +// Revision 1.12 2003/10/22 18:23:23 korpela +// *** empty log message *** +// +// Revision 1.11 2003/10/22 18:01:41 korpela +// *** empty log message *** +// +// Revision 1.10 2003/10/22 15:24:10 korpela +// *** empty log message *** +// +// Revision 1.9 2003/10/21 18:14:36 korpela +// *** empty log message *** +// +// + + + + + diff --git a/db/xml_util.h b/db/xml_util.h new file mode 100644 index 0000000..c4d16de --- /dev/null +++ b/db/xml_util.h @@ -0,0 +1,1051 @@ +// $Id: xml_util.h,v 1.8.2.6 2007/05/31 22:03:31 korpela Exp $ +// The contents of this file are subject to the BOINC Public License +// Version 1.0 (the "License"); you may not use this file except in +// compliance with the License. You may obtain a copy of the License at +// http://boinc.berkeley.edu/license_1.0.txt +// +// Software distributed under the License is distributed on an "AS IS" +// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +// License for the specific language governing rights and limitations +// under the License. +// +// The Original Code is the Berkeley Open Infrastructure for Network Computing. +// +// The Initial Developer of the Original Code is the SETI@home project. +// Portions created by the SETI@home project are Copyright (C) 2002 +// University of California at Berkeley. All Rights Reserved. +// +// Contributor(s): +// +// Additional routines to help maintain XML compliance. +// +// Revision History: +// $Log: xml_util.h,v $ +// Revision 1.8.2.6 2007/05/31 22:03:31 korpela +// *** empty log message *** +// +// Revision 1.8.2.5 2007/03/09 00:21:15 vonkorff +// Fixed missing trailing null in base64 encoding. +// +// Revision 1.8.2.4 2006/12/14 22:26:30 korpela +// *** empty log message *** +// +// Revision 1.8.2.3 2005/12/01 00:01:01 korpela +// Changed to an Intel compile of fftw3.dll. Hopefully this will fix the problem +// with crashes on Pentium-MMX and earlier. +// +// Added a Dev-C++ project and modified source files to allow seti_boinc to compile +// under MinGW. +// +// Revision 1.8.2.2 2005/10/17 22:33:33 korpela +// Continuing previous fix +// +// Revision 1.8.2.1 2005/10/17 22:14:49 korpela +// Fixed bugs with XML formatting and CSV vector input. The XML formatting bug +// fixes were submitted by Tetsuji "Maverick" Rai. The CSV input problem was due +// to my misunderstanding of the istream::operator void *(). I had thought the +// operator returned NULL if the past operation had failed. Instead it returns +// NULL if the NEXT operation will fail. +// +// Revision 1.8 2004/12/07 23:42:23 korpela +// Added undef of min and max in case they are defined in a previously included +// header file. +// +// Revision 1.7 2004/11/18 19:17:04 korpela +// Fixed base64 and base85 decoding. +// +// +// Revision 1.21 2004/04/05 22:07:08 korpela +// +// Segfault problem fixed? +// +// Revision 1.17 2003/12/01 23:42:05 korpela +// Under some compilers template parameters of type char [] weren't getting +// cast to char *. Template functions now use &(array[0]) to ensure correct +// type is used. +// +// + +#ifndef _XML_UTIL_H_ +#define _XML_UTIL_H_ + +#include "sah_config.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "error_numbers.h" + +// Just in case, undef min and max +#ifdef min +#undef min +#endif +#ifdef max +#undef max +#endif + + + +typedef enum tag_xml_encoding { + _x_xml_entity=0, + _x_xml_cdata, + _x_xml_values, + _quoted_printable, + _base64, + _x_base85, + _x_setiathome, + _x_hex, + _x_csv, + _x_uuencode, + _8bit, + _binary +} xml_encoding; + +const char * const xml_encoding_names[]= { + "x-xml-entity", + "x-xml-cdata", + "x-xml-values", + "quoted-printable", + "base64", + "x-base85", + "x-setiathome", + "x-hex", + "x-csv", + "x-uuencode", + "8bit", + "binary" + }; + +#if 0 + +// the xml_ostream class is an ostream, which can be constructed +// from an existing ostream (i.e. cout). When constructed, +// an xml header and the opening tag are written. When destructed, +// the closing tag is written. +class xml_ostream { + public: + xml_ostream(ostream &o, const char *tag); + ~xml_ostream(); + template + xml_ostream &operator <<(const T &t) { os << t; return *this; }; + private: + void write_head(); + void write_foot(); + std::string my_tag; + std::ostream &os; +}; + +// the xml_ofstream class is an ofstream. When the file is opened, +// an xml header and the opening tag are written. Upon close, +// the closing tag is written. +class xml_ofstream { + public: + xml_ofstream(); + explicit xml_ofstream(const char *filename, const char *tag, + ios_base::openmode m=ios_base::out|ios_base::binary); + ~xml_ofstream(); + void open(const char *p, const char *tag, + ios_base::openmode m=ios_base::out|ios_base::binary); + void close(); + private: + void write_head(); + void write_foot(); + std::string my_tag; + std::ofstream &os; +}; + +// the xml_istream class is an istream that can be constructed from +// an existing istream. When constructed, the stream is read until +// the opening tag or end of file is found. This is really only useful +// for reading XML from stdin. +class xml_istream { + public: + explicit xml_istream(istream &i, const char *tag=0); + ~xml_istream(); + operator istream &() {return is;}; + private: + void seek_head(); + std::string my_tag; + std::istream &is; +}; +// the xml_ifstream class is an ifstream. When the file is opened, +// the file pointer is set after the opening tag. An attempt to +// read past the closing tag will fail as if the end of the file has +// been reached. If no tag is given, it will assume the first tag +// found is the main tag. + +#ifndef HAVE_STD_POS_TYPE +typedef off_t pos_type; +#endif + +#ifndef HAVE_STD_OFF_TYPE +typedef off_t off_type; +#endif + +class xml_ifstream { + public: + xml_ifstream(); + explicit xml_ifstream(const char *filename, const char *tag=0, + ios_base::openmode m=ios_base::in|ios_base::binary); + ~xml_ifstream(); + void open(const char *filename, const char *tag=0, + ios_base::openmode m=ios_base::in|ios_base::binary); + xml_ifstream &seekg(pos_type p); + xml_ifstream &seekg(off_type o, ios_base::seekdir d); + pos_type tellg(); + bool eof(); + private: + void seek_head(); + std::string my_tag; + std::pos_type xml_start; + std::pos_type xml_end; + std::ifstream &ifs; +}; + +#endif // 0 + +#define XML_ENCODING "iso-8859-1" +static const char * const xml_header="\n"; + +// XML entity for tranlation table (not wchar_t compatible) +struct xml_entity { + unsigned char c; + const char *s; +}; + +// change the xml indent level (number of spaces) by adding or subtracting +// "i" spaces. return a string of spaces corresponding to the current xml +// indent level. +std::string xml_indent(int i=0); +static const int XML_MAX_INDENT=40; +extern int xml_indent_level; + + +// decode an XML character string. Return a the decoded string in a vector +// (null not necessarily a terminator). +//template +//vector xml_decode_string(const char *input, size_t length=0, +// const char *encoding="x_xml_entity"); + +// do the same thing, but get the length and encoding type from the +// xml tag properties. +template +std::vector xml_decode_field(const std::string &input, const char *tag); + +// encode an XML character string. Return the encoded string. +//template +//string xml_encode_string(const T *input, size_t n_elements=0, +// xml_encoding encoding=_x_xml_entity); + +template +std::string xml_encode_string(const std::vector &input, + xml_encoding encoding=_x_xml_entity) { + return xml_encode_string(&(*(input.begin())),input.size(),encoding); +} + +#include +#include +#include +#include + +extern const char *encode_arr; +extern const char *encode_arr85; +bool isencchar(char c); +bool isencchar85(char c); + +template +std::string base64_encode(const T *tbin, size_t n_elements) { + size_t nbytes=n_elements*sizeof(T); + const unsigned char *bin=(const unsigned char *)(tbin); + int count=0, offset=0, nleft; + const char crlf[]= {0xa,0xd,0x0}; + std::string rv(""); + rv.reserve(nbytes*4/3+nbytes*2/57); + char c[5]; + for (nleft = (int)nbytes; nleft > 0; nleft -= 3) { + int i; + c[0] = (bin[offset]>>2) & 0x3f ; // 6 + c[1] = (bin[offset]<<4) & 0x3f | ((bin[offset+1]>>4)&0xf); // 2+4 + c[2] = ((bin[offset+1]<<2)&0x3f) | ((bin[offset+2]>>6)&0x3);// 4+2 + c[3] = bin[offset+2]&0x3f; // 6 + for (i=0;i<((nleft>3)?4:(nleft+1));i++) c[i]=encode_arr[(int)c[i]]; + for (;i<4;i++) c[i]='='; + c[4]=0; + rv+=c; + offset += 3; + count += 4; + if (count == 76 ) { + count = 0; + rv+=crlf; + } + } + rv+=crlf; + return rv; +} + +template +std::vector base64_decode(const char *data, size_t nbytes) { + const char *p=data,*eol,*eol2,*eos; + const char cr=0xa,lf=0xd; + char in[4],c[3]; + int i; + std::vector rv; + rv.reserve(nbytes*3/4); + while (p<(data+nbytes)) { + while (*p && (p<(data+nbytes)) && !isencchar(*p)) { + p++; + } + if (!(*p) || (p>=(data+nbytes))) break; + eol=strchr(p,cr); + eol2=strchr(p,lf); + eos=p+strlen(p); + if (eol) { + eol=std::min(eol,eos); + } else { + eol=eos; + } + if (eol && eol2) { + eol=std::min(eol,eol2); + } + for (;p<(eol-1);p+=4) { + for ( i=0;i<4;i++) { + if ((p[i]>='A') && (p[i]<='Z')) { + in[i]=p[i]-'A'; + } else if ((p[i]>='a') && (p[i]<='z')) { + in[i]=p[i]-'a'+26; + } else if ((p[i]>='0') && (p[i]<='9')) { + in[i]=p[i]-'0'+52; + } else { + switch (p[i]) { + case '+': in[i]=62; + break; + case '/': in[i]=63; + break; + default : in[i]=0; + } + } + } + c[0]=(in[0]<<2) | ((in[1] >> 4) & 0x3); + c[1]=(in[1]<<4) | ((in[2] >> 2) & 0xf); + c[2]=(in[2]<<6) | in[3]; + for ( i=0;i<3;i++) rv.push_back(c[i]); + } + } + return std::vector((T *)(&(rv[0])),(T *)(&(rv[0]))+rv.size()/sizeof(T)); +} + +template +std::string base85_encode(const T *tbin, size_t n_elements) { + size_t nbytes=n_elements*sizeof(T); + const unsigned char *bin=(const unsigned char *)(tbin); + int count=0; + const char crlf[]= {0xa,0xd,0x0}; + std::string rv(""); + rv.reserve(nbytes*4/3+nbytes*2/57); + char c[6]; + int n_pads; + unsigned int j=0; + while (j3)?4:(nbytes-j));i++) val=(val<<8)+bin[j+i]; + if (val) { + for (n_pads=4-i;i<4;i++) val*=((i==3)?84:85); + } + if (val == 0) { + c[0]='z'; // If the word is entirely zero use a single digit + c[1]=0; // zero pad of 'z' + } else { + for (i=4;i<5;i--) { + c[i]=(char)(val % ((i==4)?84:85)); // First division is by 84 to prevent + val/= ((i==4)?84:85); // having a pad in the final digit. + } + if (c[0]==83) { // need to change a high order 'z' into + c[0]=84; // an "_" so it won't look like a zero word. + } + for (i=0;i<5;i++) c[i]=encode_arr85[(int)c[i]]; + for (i=5-n_pads;i<5;i++) c[i]='_'; // add pad characters + c[5]=0; + } + j+=4; + if (count>74) { + rv+=crlf; + count=0; + } + count+=(int)strlen(c); + rv+=c; + } + return rv; +} + +template +std::vector base85_decode(const char *data, size_t nbytes) { + const char *p=data,*eol,*eol2,*eos; + const char cr=0xa,lf=0xd; + unsigned long val; + int npads,i; + std::vector rv; + rv.reserve(nbytes*4/5); + while (p<(data+nbytes)) { + while (*p && (p<(data+nbytes)) && !isencchar85(*p)) { + p++; + } + if (!(*p) || (p>=(data+nbytes))) break; + eol=strchr(p,cr); + eol2=strchr(p,lf); + eos=p+strlen(p); + + if (eol) { + eol=std::min(eol,eos); + } else { + eol=eos; + } + if (eol && eol2) { + eol=std::min(eol,eol2); + } + + while (p0) { + if (p[i]!='_') break; + npads++; + } + for (i=0;i='0') && (p[i]<='9')) { + val+=p[i]-'0'; + } else if ((p[i]>='A') && (p[i]<='Z')) { + val+=p[i]-'A'+10; + } else if ((p[i]>='a') && (p[i]<='y')) { + val+=p[i]-'a'+36; + } else { + for (int j=61; j<85; j++) { + if (p[i]==encode_arr85[j]) { + val+=j; + j=85; + } + } + if ((i==0) && (p[i]=='_')) val--; + } + } + } + val<<=(npads*8); + char c[5]; + c[4]=0; + for (int i=3;i>=0;i--) { + c[i]=(char)(val & 0xff); + val>>=8; + } + for (int i=0;i<4;i++) { + rv.push_back(c[i]); + } + p+=5; + } + } + return std::vector((T *)(&(rv[0])),(T *)(&(rv[0]))+rv.size()/sizeof(T)); +} + + +template +std::string x_setiathome_encode(const T *tbin, size_t n_elements) { + size_t nbytes=n_elements*sizeof(T); + const unsigned char *bin=(const unsigned char *)(tbin); + int count=0, offset=0, nleft; + const char cr=0xa; + std::string rv(""); + rv.reserve(nbytes*4/3+nbytes*2/48); + rv+="\n"; + char c[5]; + for (nleft = (int)nbytes; nleft > 0; nleft -= 3) { + c[0] = bin[offset]&0x3f; // 6 + c[1] = (bin[offset]>>6) | (bin[offset+1]<<2)&0x3f; // 2+4 + c[2] = ((bin[offset+1]>>4)&0xf) | (bin[offset+2]<<4)&0x3f;// 4+2 + c[3] = bin[offset+2]>>2; // 6 + for (int i=0;i<4;i++) c[i]+=0x20; + c[4]=0; + rv+=c; + offset += 3; + count += 4; + if (count == 64) { + count = 0; + rv+=cr; + } + } + rv+=cr; + return rv; +} + + +template +std::vector x_setiathome_decode(const char *data, size_t nbytes) { + const char *p=data,*eol,*eol2,*eos; + char in[4],c[3]; + int i; + std::vector rv; + rv.reserve(nbytes*3/4); + while (p<(data+nbytes)) { + while ((*p<0x20) || (*p>0x60)) { + p++; + } + eol=strchr(p,'\n'); + eol2=strchr(p,'\r'); + eos=p+strlen(p); + if (eol) { + eol=std::min(eol,eos); + } else { + eol=eos; + } + if (eol && eol2) { + eol=std::min(eol,eol2); + } + for (;p<(eol-1);p+=4) { + memcpy(in,p,4); + for ( i=0;i<4;i++) in[i]-=0x20; + c[0]=in[0]&0x3f | in[1]<<6; + c[1]=in[1]>>2 | in[2]<<4; + c[2]=in[2]>>4 | in[3]<<2; + for ( i=0;i<3;i++) rv.push_back(c[i]); + } + } + return std::vector((T *)(&(rv[0])),(T *)(&(rv[0]))+rv.size()/sizeof(T)); +} + +template +std::string quoted_printable_encode(const T *tbin, size_t n_elements) { + size_t nbytes=n_elements*sizeof(T); + const unsigned char *bin=(const unsigned char *)(tbin); + int line_len=0; + const char crlf[]= {'=',0xa,0xd,0x0}; + std::string rv(""); + rv.reserve(nbytes*4/3+nbytes*2/48); + for (size_t i=0;i 74) { + rv+=crlf; + line_len=1; + } + rv+=bin[i]; + } else { + line_len+=3; + if (line_len>72) { + rv+=crlf; + line_len=3; + } + char buf[4]; + sprintf(buf,"=%.2X",bin[i]); + rv+=buf; + } + } + return rv; +} + +template +std::vector quoted_printable_decode(const char* data, size_t nbytes) { + std::vector rv; + rv.reserve(strlen(data)); + size_t i=0; + while (i((T *)(&(rv[0])),(T *)(&(rv[0]))+rv.size()/sizeof(T)); +} + +template +std::string x_hex_encode(const T *tbin, size_t n_elements) { + size_t nbytes=n_elements*sizeof(T); + const unsigned char *bin=(const unsigned char *)(tbin); + std::string rv; + int count=0; + rv.reserve(nbytes*2+nbytes*2/76); + for (unsigned int i=0; i +std::vector x_hex_decode(const char *data, size_t nbytes) { + std::vector rv; + rv.reserve(nbytes/2); + unsigned int i=0; + while (i(c)); + } + return std::vector((T *)(&(rv[0])),(T *)(&(rv[0]))+rv.size()/sizeof(T)); +} + + +std::string x_csv_encode_char(const unsigned char *bin, size_t nelements); + +template +std::string x_csv_encode(const T *bin, size_t nelements) { + std::ostringstream rv(""); + long lastlen,i; + + if (sizeof(T)==1) // if T is a char, print in another way + return x_csv_encode_char((const unsigned char *)bin,nelements); + + rv << std::endl << xml_indent(2); // TMR moved here to fix PoT format + lastlen=(long)rv.str().size(); // TMR + for (i=0;i<(static_cast(nelements)-1);i++) { + rv << bin[i] << ','; + if ((static_cast(rv.str().size()) + -(lastlen-std::min(xml_indent_level,XML_MAX_INDENT)))>73) { // TMR + rv << std::endl << xml_indent(); + lastlen=(long)rv.str().size(); + } + } + rv << bin[i] << "\n" << xml_indent(-2); + + return rv.str(); +} + + +template +std::vector x_csv_decode(const char *data, size_t nbytes) { + std::vector rv; + while (!isdigit(*data)) { + data++; + nbytes--; + } + std::istringstream in(std::string(data,nbytes)); + bool ischar=(sizeof(T)==1); + + while (in) { + T t; + if (!ischar) { + in >> t; + } else { + int i; + in >> i; + t=i & 0xff; + } + rv.push_back(t); + char c=' '; + while (in && !isdigit(c)) { + in.get(c); + } + if (isdigit(c)) in.putback(c); + } + return rv; +} + + +std::string encode_char(unsigned char c); +unsigned char decode_char(const char *s); + +template +std::vector x_xml_entity_decode(const char *input, size_t length) { + size_t i; + char c; + if (!length) { + // We're going to decode until we see a null. Including the null. + length=strlen((const char *)input); + } + std::vector rv; + char *p; + rv.reserve(length); + for (i=0; i((T *)(&(rv[0])),(T *)(&(rv[0]))+rv.size()/sizeof(T)); +} + +template +std::string x_xml_entity_encode(const T *tbin, size_t n_elements) { + size_t length=n_elements*sizeof(T); + const unsigned char *input=(const unsigned char *)(tbin); + unsigned int i; + std::string rv; + rv.reserve(length); + for (i=0; i': + case '<': + case '&': + case '\'': + case '"': + rv+=encode_char(input[i]); + break; + default: + rv+=input[i]; + } + } else { + char buf[16]; + sprintf(buf,"&#%.3d;",input[i]); + rv+=buf; + } + } + return rv; +} + +template +std::string x_xml_values_encode(const T *bin, size_t n_elements) { + std::ostringstream rv(""); + unsigned int i; + for (i=0;i +std::vector x_xml_values_decode(const char *data, size_t length) { + std::istringstream r(std::string(data,length)); + std::vector rv; + T t; + while (!r.eof()) { + r >> t ; + rv.push_back(t); + while ((isspace(r.peek()) || (r.peek() == ',')) && !r.eof()) { + char c; + r.get(c); + } + } + return rv; +} + +template +std::string x_xml_cdata_encode(const T *tbin, size_t n_elements) { + size_t length=n_elements*sizeof(T); + const unsigned char *input=(const unsigned char *)(tbin); + unsigned int i; + std::string rv("0x1f) { + switch (input[i]) { + case ']': + if (((length-i)>1) && (input[i+1]==']') && (input[i+2]=='>')) { + rv+="&&endcdt;"; + } else { + rv+=']'; + } + break; + default: + rv+=input[i]; + } + } else { + char buf[16]; + sprintf(buf,"&&#%.2d;",input[i]); + rv+=buf; + } + } + rv+="]]>"; + return rv; +} + +template +std::vector x_xml_cdata_decode(const char *input, size_t length) { + size_t i; + char c; + if (!length) { + // We're going to decode until we see a null. Including the null. + length=strlen(input); + } + std::vector rv; + char *p; + rv.reserve(length); + for (i=0; i8) && !strncmp((const char *)(input+i),"&&endcdt;",9)) { + rv.push_back(']'); + rv.push_back(']'); + rv.push_back('>'); + i+=8; + } else { + if (input[i+1]=='&') { + rv.push_back(c=decode_char(input+i+1)); + if ((c!='&') || !strncmp((const char *)(input+i+1),"&",5)) { + p=strchr((char *)(input+i+1),';'); + i=(p-input); + } + } else { + rv.push_back(input[i]); + } + } + } else { + rv.push_back(input[i]); + } + } + return std::vector((T *)(&(rv[0])),(T *)(&(rv[0]))+rv.size()/sizeof(T)); +} + +template +std::vector x_uudecode(const char *data, size_t nbytes) { + std::vector rv; + return rv; +} + +template +std::string x_uuencode(const T *data, size_t nbytes) { + std::string rv; + return rv; +} + +inline int xml_encoding_from_string(const char *enc_string) { + int i=_x_xml_entity; + const char *p="xqb8"; + // find the start to the encoding string (maybe prepended by + // quote or whitespace. + while (*enc_string && (strchr(p,*enc_string) == NULL)) enc_string++; + do { + if (!strncmp(enc_string,xml_encoding_names[i],strlen(xml_encoding_names[i]))) + break; + } while (i++ != _binary); + return i; +} + +template +std::vector xml_decode_string(const char *input, + size_t length=0, const char *encoding="x_xml_entity") { + int i=xml_encoding_from_string(encoding); + switch (i) { + case _x_xml_entity: + return x_xml_entity_decode(input,length); + case _x_xml_cdata: + return x_xml_cdata_decode(input,length); + case _x_xml_values: + return x_xml_values_decode(input,length); + case _quoted_printable: + return quoted_printable_decode(input,length); + case _base64: + return base64_decode(input,length); + case _x_base85: + return base85_decode(input,length); + case _x_setiathome: + return x_setiathome_decode(input,length); + case _x_hex: + return x_hex_decode(input,length); + case _x_csv: + return x_csv_decode(input,length); + case _x_uuencode: + return x_uudecode(input,length); + case _8bit: + case _binary: + return std::vector((const T *)input,(const T *)input+length/sizeof(T)); + default: + return x_xml_entity_decode(input,length); + } +} + +template +std::vector xml_decode_field(const std::string &input, const char *tag) { + std::string start_tag("<"),end_tag("',start)+1; + if (!length) { + length=(unsigned int)endt - (unsigned int)start; + } + return (xml_decode_string(&(input.c_str()[start]),length,encoding)); +} + + +template +std::string xml_encode_string(const T *input, + size_t length=0, xml_encoding encoding=_x_xml_entity) { + switch (encoding) { + case _x_xml_entity: + return x_xml_entity_encode(input,length); + case _x_xml_cdata: + return x_xml_cdata_encode(input,length); + case _x_xml_values: + return x_xml_values_encode(input,length); + case _quoted_printable: + return quoted_printable_encode(input,length); + case _base64: + return base64_encode(input,length); + case _x_base85: + return base85_encode(input,length); + case _x_setiathome: + return x_setiathome_encode(input,length); + case _x_hex: + return x_hex_encode(input,length); + case _x_csv: + return x_csv_encode(input,length); + case _x_uuencode: + return x_uuencode(input,length); + case _8bit: + case _binary: + return std::string((const char *)(input),length*sizeof(T)); + default: + return x_xml_entity_encode(input,length); + } +} + +extern bool xml_match_tag(const char*, const char*); +extern bool xml_match_tag(const std::string &, const char*); +extern bool extract_xml_record(const std::string &field, const char *tag, std::string &record); + +#endif +// +// $Log: xml_util.h,v $ +// Revision 1.8.2.6 2007/05/31 22:03:31 korpela +// *** empty log message *** +// +// Revision 1.8.2.5 2007/03/09 00:21:15 vonkorff +// Fixed missing trailing null in base64 encoding. +// +// Revision 1.8.2.4 2006/12/14 22:26:30 korpela +// *** empty log message *** +// +// Revision 1.8.2.3 2005/12/01 00:01:01 korpela +// Changed to an Intel compile of fftw3.dll. Hopefully this will fix the problem +// with crashes on Pentium-MMX and earlier. +// +// Added a Dev-C++ project and modified source files to allow seti_boinc to compile +// under MinGW. +// +// Revision 1.8.2.2 2005/10/17 22:33:33 korpela +// Continuing previous fix +// +// Revision 1.8.2.1 2005/10/17 22:14:49 korpela +// Fixed bugs with XML formatting and CSV vector input. The XML formatting bug +// fixes were submitted by Tetsuji "Maverick" Rai. The CSV input problem was due +// to my misunderstanding of the istream::operator void *(). I had thought the +// operator returned NULL if the past operation had failed. Instead it returns +// NULL if the NEXT operation will fail. +// +// Revision 1.8 2004/12/07 23:42:23 korpela +// Added undef of min and max in case they are defined in a previously included +// header file. +// +// Revision 1.7 2004/11/18 19:17:04 korpela +// Fixed base64 and base85 decoding. +// +// Revision 1.6 2004/10/29 04:35:21 korpela +// *** empty log message *** +// +// Revision 1.5 2004/10/21 22:02:48 korpela +// *** empty log message *** +// +// Revision 1.4 2004/06/30 20:52:29 korpela +// *** empty log message *** +// +// Revision 1.3 2004/06/24 08:55:29 quarl +// *** empty log message *** +// +// Revision 1.2 2004/06/12 18:38:30 rwalton +// *** empty log message *** +// +// Revision 1.1 2004/06/11 17:43:22 davea +// *** empty log message *** +// +// Revision 1.21 2004/04/05 22:07:08 korpela +// +// Segfault problem fixed? +// +// Revision 1.20 2004/03/06 09:45:25 rwalton +// *** empty log message *** +// +// Revision 1.19 2004/02/05 05:32:22 quarl +// *** empty log message *** +// +// Revision 1.18 2004/01/22 17:57:41 davea +// *** empty log message *** +// +// Revision 1.17 2003/12/01 23:42:05 korpela +// Under some compilers template parameters of type char [] weren't getting +// cast to char *. Template functions now use &(array[0]) to ensure correct +// type is used. +// +// Revision 1.16 2003/10/29 20:08:50 korpela +// *** empty log message *** +// +// Revision 1.15 2003/10/27 23:07:34 korpela +// *** empty log message *** +// +// Revision 1.14 2003/10/27 20:07:12 korpela +// *** empty log message *** +// +// Revision 1.13 2003/10/25 18:20:03 korpela +// *** empty log message *** +// +// Revision 1.12 2003/10/24 16:58:11 korpela +// *** empty log message *** +// +// Revision 1.11 2003/10/23 15:39:54 korpela +// no message +// +// Revision 1.10 2003/10/22 23:11:49 davea +// *** empty log message *** +// +// Revision 1.9 2003/10/22 22:36:52 jeffc +// jeffc - init xml_encode/decode_string in the definition, not the prototype +// +// Revision 1.8 2003/10/22 18:13:39 korpela +// *** empty log message *** +// +// Revision 1.7 2003/10/22 17:43:10 korpela +// *** empty log message *** +// +// Revision 1.6 2003/10/22 15:24:10 korpela +// *** empty log message *** +// +// Revision 1.5 2003/10/22 03:09:55 korpela +// *** empty log message *** +// +// Revision 1.4 2003/10/21 18:14:36 korpela +// *** empty log message *** +// +// diff --git a/export-tarball b/export-tarball new file mode 100755 index 0000000..203c6f7 --- /dev/null +++ b/export-tarball @@ -0,0 +1,107 @@ +#!/bin/sh + +## $Id: export-tarball,v 1.1.2.1 2005/11/23 17:28:31 korpela Exp $ + +# Create a tarball from CVS or SVN export. + +# example usage: + +# CVSROOT=/usr/local/warez/cvsroot \ +# CHECKOUT='cvs export -r HEAD boinc' \ +# DIR='boinc' \ +# FILENAME_TGZ="boinc-cvs-TODAY.tar.gz" \ +# FILENAME_ZIP="boinc-cvs-TODAY.zip" \ +# DESTINATION="/disks/milkyway/a/users/anderson/boinc/doc/source/nightly/" \ +# /disks/philmor/a/users/quarl/bin/export-tarball + +# CHECKOUT='svn export http://svn.quarl.org/repos/coursesurvey/trunk/coursesurvey' \ +# DIR=coursesurvey \ +# FILENAME_TGZ="coursesurvey-rSVNREVISION.tar.gz" \ +# FILENAME_ZIP="coursesurvey-rSVNREVISION.zip" \ +# DESTINATION="ftp://upload.sourceforge.net/incoming" \ +# /home/quarl/bin/export-tarball + +# Note: requires GNU tar (if you want to use other tar need to separate gzip +# step) + +die() +{ + echo "ERROR in $0 on `hostname`:" + echo "$1" + [ "$2" ] && cat "$2" + exit 1 +} + +reqeval() +{ + test -n "$VERBOSE" && echo "Executing: $1" + eval "$1" || die "error executing: $1" +} + +reqeval_log() +{ + test -n "$VERBOSE" && echo "Executing: $1" + eval "$1" > $2 2>&1 || die "error executing: $1" $2 +} + +upload() +{ + if echo "$DESTINATION" | grep '^ftp://' >/dev/null ; then + ftp_upload "$1" + else + file_upload "$1" + fi +} + +file_upload() +{ + test -n "$VERBOSE" && echo "Putting $1 in $DESTINATION" + reqeval "mv $1 $DESTINATION" +} + +ftp_upload() +{ + SERVER=`echo "$DESTINATION" | sed 's,^ftp://,,' | sed 's,/.*,,'` + DIRECTORY=`echo "$DESTINATION" | sed 's,^ftp://[^/]*',,` + + test -n "$VERBOSE" && echo "Uploading $1 to ftp site $SERVER $DIRECTORY" + reqeval "ncftpput $SERVER $DIRECTORY $1" +} + +if [ -z "$USER" ]; then + USER=$LOGNAME +fi + +if ttyo 2>/dev/null ; then + VERBOSE=1 +fi + +test -n "$CHECKOUT" || die "No CHECKOUT specified" +test -n "$DIR" || die "No DIR specified" +test -n "$FILENAME_TGZ" -o -n "$FILENAME_ZIP" || die "No FILENAME_TGZ nor FILENAME_ZIP specified" +test -n "$DESTINATION" || die "No DESTINATION specified" + +TMPDIR=/tmp/export-tarball-$$ + +reqeval "rm -rf $TMPDIR" +reqeval "mkdir -p $TMPDIR" +reqeval "cd $TMPDIR" +reqeval_log "$CHECKOUT" checkout.log + +test -d "$DIR" || die "No DIR $DIR after CHECKOUT" + +TODAY=`date +%Y-%m-%d` +# SVNREVISION=`svnlastchangedversion "$DIR" 2>/dev/null` + +FILENAME_TGZ=`echo "$FILENAME_TGZ" | sed "s/TODAY/$TODAY/"` +FILENAME_ZIP=`echo "$FILENAME_ZIP" | sed "s/TODAY/$TODAY/"` + +# FILENAME_TGZ=`echo "$FILENAME_TGZ" | sed "s/SVNREVISION/$SVNREVISION/"` +# FILENAME_ZIP=`echo "$FILENAME_ZIP" | sed "s/SVNREVISION/$SVNREVISION/"` + +test -n "$FILENAME_TGZ" && reqeval_log "tar czvf $FILENAME_TGZ $DIR" tar.log +test -n "$FILENAME_ZIP" && reqeval_log "zip -r9 $FILENAME_ZIP $DIR" zip.log +upload $FILENAME_TGZ +upload $FILENAME_ZIP + +reqeval "rm -rf $TMPDIR" diff --git a/gbt_splitter/Makefile.am b/gbt_splitter/Makefile.am new file mode 100644 index 0000000..990f9ef --- /dev/null +++ b/gbt_splitter/Makefile.am @@ -0,0 +1,66 @@ +CC=gcc +BOINCDIR=@BOINCDIR@ +INFORMIXDIR=@INFORMIXDIR@ +SETILIB_PATH=@SETILIB_PATH@ +SETILIB_LIBS=@SETILIB_LIBS@ +SETIHOME=.. + +LINKOPTIONS= + +GSL_LIBS = -lgsl -lgslcblas -lgsl + +DBLIBS=@INFORMIX_LIBS@ -lm -lstdc++ + + +LINKOPTIONS=-Xlinker -R -Xlinker $(INFORMIXDIR)/lib:$(INFORMIXDIR)/lib/esql:$(LD_LIBRARY_PATH) + + +AM_CFLAGS= -g -O3 -Wall $(INCLUDE_DIRS) -DUSE_INFORMIX @PTHREAD_CFLAGS@ -ISETILIB_PATH/include + + +SYSLIBS = -lcrypto -ldl + +BOINCLIBS= -L$(BOINCDIR)/sched -lsched @MYSQL_LIBS@ @PTHREAD_LIBS@ -L$(BOINCDIR)/lib -lboinc_crypt -lboinc -L$(SSLDIR) -lcrypto -lssl + +SPLITLIBS= $(SETILIB_LIBS) \ + $(DBLIBS) \ + $(BOINCLIBS) \ + $(SYSLIBS) \ + -lchealpix \ + -lfftw3f + +noinst_PROGRAMS = mb_splitter + + +mb_splitter_SOURCES=mb_angdist.cpp \ + mb_message.cpp \ + mb_splitter.cpp \ + mb_wufiles.cpp \ + mb_dotransform.cpp \ + mb_validrun.cpp \ + cmap_interp.cpp \ + ../db/schema_master.cpp \ + ../db/sqlifx.cpp \ + ../db/sqlrow.cpp \ + ../db/sqlblob.cpp ../db/sqlint8.cpp \ + ../db/xml_util.cpp \ + ../db/app_config.cpp \ + ../client/seti_header.cpp \ + ../client/timecvt.cpp \ + ../client/lcgamm.cpp \ + ../client/hr_min_sec.o + +mb_splitter_CXXFLAGS= \ + -O3 \ + -I$(SETIHOME) -I$(SETIHOME)/client -I$(SETIHOME)/db \ + @MYSQL_CFLAGS@ -I$(HEALPIX)/include \ + @INFORMIX_CFLAGS@ @SETILIB_CFLAGS@ \ + @BOINC_CFLAGS@ -I$(BOINCDIR)/tools -I$(BOINCDIR)/sched -I$(BOINCDIR)/db +mb_splitter_CFLAGS=$(mb_splitter_CXXFLAGS) +mb_splitter_LDFLAGS=-static $(AM_LDFLAGS) -L$(HEALPIX)/lib $(LINKOPTIONS) +mb_splitter_LDADD=$(SPLITLIBS) $(GSL_LIBS) + +../db/sqlifx.cpp: ../db/sqlifx.ec + $(INFORMIXDIR)/bin/esql -e $< + mv sqlifx.c $*.cpp + diff --git a/gbt_splitter/angdist.cpp b/gbt_splitter/angdist.cpp new file mode 100644 index 0000000..a4d9cf2 --- /dev/null +++ b/gbt_splitter/angdist.cpp @@ -0,0 +1,79 @@ +/* + * angdist.c + * + * Computes angular distance between two lat/lon points + * + * $Id: angdist.cpp,v 1.3.4.1 2006/12/14 22:24:37 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include "seti_header.h" + +#define DTOR (M_PI/180) + +double angdist(double r1, double d1, double r2, double d2) { + double alpha,dist,d; + + r1*=DTOR; + r2*=DTOR; + d1*=DTOR; + d2*=DTOR; + alpha=r1-r2; + dist=sin(d2)*sin(d1)+cos(d1)*cos(d2)*cos(alpha); + if ((dist*dist)<1) { + d=sqrt(1.0-dist*dist); + } else { + dist=1.0; + d=0.0; + } + dist=atan2(d,dist); + dist=dist/DTOR; + return (dist); +} + +double angdist(const SCOPE_STRING &a, const SCOPE_STRING &b) { + return angdist(a.ra*15,a.dec,b.ra*15,b.dec); +} + +/* + * $Log: angdist.cpp,v $ + * Revision 1.3.4.1 2006/12/14 22:24:37 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:39 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:31 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:15 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:16:08 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:47:33 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/angdist.h b/gbt_splitter/angdist.h new file mode 100644 index 0000000..c3fc069 --- /dev/null +++ b/gbt_splitter/angdist.h @@ -0,0 +1,33 @@ +/* + * angdist.h + * + * Computes angular distance between two lat/lon points + * + * $Id: angdist.h,v 1.1 2003/06/03 00:16:09 korpela Exp $ + * + */ + +double angdist(double r1, double d1, double r2, double d2) ; +double angdist(const SCOPE_STRING &a,const SCOPE_STRING &b); + +/* + * $Log: angdist.h,v $ + * Revision 1.1 2003/06/03 00:16:09 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:03:21 korpela + * Initial revision + * + * + */ + diff --git a/gbt_splitter/cmap_interp.cpp b/gbt_splitter/cmap_interp.cpp new file mode 100644 index 0000000..d431f92 --- /dev/null +++ b/gbt_splitter/cmap_interp.cpp @@ -0,0 +1,40 @@ +#include +#include +#include "setilib.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +coordinate_t cmap_interp(std::map &map, seti_time &t) { + std::map::iterator above(map.upper_bound(t)); + std::map::iterator below; + below=above; + if (above==map.begin()) { + above++; + } else { + below--; + } + if (above==map.end()) { + above--; + below--; + } + coordinate_t upper(above->second); + coordinate_t lower(below->second); + coordinate_t rv; + + if ((upper.ra-lower.ra)>23) lower.ra+=24; + if ((lower.ra-upper.ra)>23) upper.ra+=24; + rv.time=t.jd().uval(); + double f=(seti_time(t.jd()-JD1970,JD1970)-seti_time(days(lower.time)))/ + days(upper.time-lower.time); + rv.ra=(upper.ra-lower.ra)*f+lower.ra; + rv.ra=fmod(rv.ra,24.0); + rv.dec=(upper.dec-lower.dec)*f+lower.dec; + return rv; +} + + + + diff --git a/gbt_splitter/cmap_interp.h b/gbt_splitter/cmap_interp.h new file mode 100644 index 0000000..37ee520 --- /dev/null +++ b/gbt_splitter/cmap_interp.h @@ -0,0 +1,6 @@ + +extern coordinate_t cmap_interp(std::map &map, seti_time &t); + + + + diff --git a/gbt_splitter/coordcvt.cpp b/gbt_splitter/coordcvt.cpp new file mode 100644 index 0000000..959f231 --- /dev/null +++ b/gbt_splitter/coordcvt.cpp @@ -0,0 +1,179 @@ +/* + * coordcvt.c + * + * Celestial coordinate conversion routines. + * + * $Id: coordcvt.cpp,v 1.2.4.1 2006/12/14 22:24:37 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include + +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "coordcvt.h" + +extern int gregorian; + +namespace SPLITTER { + +double jd_to_lmst(double jd, double longitude) { +/* + * converts from julian date/time to local mean siderial time + * + */ + + double tu; /* time, in centuries from Jan 0, 2000 */ + double tusqr; + double tucb; + double g; /* derrived from tu, used to calculate gmst */ + double gmst; /* Greenwich Mean Sidereal Time */ + double lmst; /* Local Mean Sidereal Time */ + double jd0=floor(jd+0.5)-0.5; /* jd at noon GMT */ + double ddtime=fmod((jd-jd0)*24,24); /* GMT hours */ + + tu = (jd0 - 2451545.0)/36525; + tusqr = tu * tu; + tucb = tusqr * tu; + +/* computation of the gmst at ddtime UT */ + + g = 24110.54841 + 8640184.812866 * tu + 0.093104 * tusqr - 6.62E-6 * tucb; + + for (gmst = g; gmst < 0; gmst += 86400) ; + + gmst /= 3600; /* GMST at 0h UT */ + gmst += (1.0027379093 * ddtime); /* GMST at utime UT */ + + gmst=fmod(gmst,24); + +/* computation of lmst given gmst and longitude */ + + lmst = gmst + ((longitude/360) * 24); + + if (lmst < 0) + lmst += 24; + lmst = fmod(lmst,24); + return(lmst); +} + + +void horz_to_equatorial(double alt, double azimuth, double lsthour, + double lat, double *ra, double *dec) { + double dec_rad, hour_ang_rad, zenith_ang=90.0-alt; + double temp; + + zenith_ang*=(M_PI/180.0); + azimuth*=(M_PI/180.0); + + dec_rad = asin ((cos(zenith_ang) * sin(lat*M_PI/180)) + + (sin(zenith_ang) * cos(lat*M_PI/180) * cos(azimuth))); + + *dec = dec_rad * 180.0/M_PI; /* radians to decimal degrees */ + + temp = (cos(zenith_ang) - sin(lat*M_PI/180) * sin(dec_rad)) / + (cos(lat*M_PI/180) * cos(dec_rad)); + if (temp > 1) + temp = 1; + else if (temp < -1) + temp = -1; + hour_ang_rad = acos (temp); + + if (sin(azimuth) > 0.0) /* insure correct quadrant */ + hour_ang_rad = (2 * M_PI) - hour_ang_rad; + + + /* to get ra, we convert hour angle to decimal degrees, */ + /* convert degrees to decimal hours, and subtract the */ + /* result from local sidereal decimal hours. */ + *ra = lsthour - ((hour_ang_rad * 180.0/M_PI) / 15.0); + + // Take care of wrap situations in RA + if (*ra < 0.0) + *ra += 24.0; + *ra=fmod(*ra,24); +} +#define D2R 0.017453292 + +void AltAzCorrection(double *alt, double *az) { + double zen=90-*alt; + co_ZenAzCorrection((telescope_id)(gregorian?AOGREG_1420:AO_1420),&zen,az); + *alt=90-zen; +} + +} + +void telstr_coord_convert(SCOPE_STRING *telstr, double lat, double lon) { + + double lmst=SPLITTER::jd_to_lmst(telstr->st.jd,lon); + + SPLITTER::AltAzCorrection(&(telstr->alt),&(telstr->az)); + SPLITTER::horz_to_equatorial(telstr->alt, telstr->az, lmst, lat, &(telstr->ra), + &(telstr->dec)); +} + +/* + * $Log: coordcvt.cpp,v $ + * Revision 1.2.4.1 2006/12/14 22:24:37 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:33 korpela + * + * renames .C files to .cpp + * + * Revision 1.3 2003/06/05 19:01:45 korpela + * + * Fixed coordiate bug that allowed RA>24 hours. + * + * Revision 1.2 2003/06/05 15:52:46 korpela + * + * Fixed coordinate bug that was using the wrong zenith angle from the telescope + * strings when handling units from the gregorian. + * + * Revision 1.1 2003/06/03 00:16:09 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.1 2003/05/20 16:01:54 eheien + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1999/03/05 01:47:18 korpela + * New zenith angle correction. + * + * Revision 2.2 1999/02/22 22:21:09 korpela + * Fixed half-day error. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/27 00:48:48 korpela + * Bug fixes. + * + * Revision 1.1 1998/10/19 23:02:43 korpela + * Initial revision + * + * + */ + diff --git a/gbt_splitter/coordcvt.h b/gbt_splitter/coordcvt.h new file mode 100644 index 0000000..5595f06 --- /dev/null +++ b/gbt_splitter/coordcvt.h @@ -0,0 +1,40 @@ +/* + * coordcvt.h + * + * Celestial coordinate conversion routines. + * + * $Id: coordcvt.h,v 1.1 2003/06/03 00:16:09 korpela Exp $ + * + */ + +#ifndef COORDCVT_H +#define COORDCVT_H + +double jd_to_lmst(double jd, double longitude); + +void horz_to_equatorial(double alt, double azimuth, double lsthour, + double lat, double *ra, double *dec); + +void telstr_coord_convert(SCOPE_STRING *telstr, double lat, double lon); + +#endif + +/* + * $Log: coordcvt.h,v $ + * Revision 1.1 2003/06/03 00:16:09 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/19 23:03:18 korpela + * Initial revision + * + */ diff --git a/gbt_splitter/db_fns.cpp b/gbt_splitter/db_fns.cpp new file mode 100644 index 0000000..9234ed3 --- /dev/null +++ b/gbt_splitter/db_fns.cpp @@ -0,0 +1,199 @@ +/* + * $Id: db_fns.cpp,v 1.3.4.2 2006/12/14 22:24:37 korpela Exp $ + * + */ + + +#include "sah_config.h" +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "message.h" +#include "readtape.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "db_table.h" +#include "schema_master.h" + + +static tape tape_struct; + +int update_tape_entry( tapeheader_t *tapeheader) ; + +int get_last_block(tapeheader_t *tapeheader) { + int err; + strncat(tape_struct.tapename,tapeheader->name,20); + if (!db_tape_lookup_name(&tape_struct)) { + return(tape_struct.last_block_done/TAPE_FRAMES_PER_RECORD); + } else { + if ((err=db_tape_new(&tape_struct))) { + log_messages.printf( SCHED_MSG_LOG::MSG_CRITICAL,"Unable to create db entry for tape %s error %d.\n",tapeheader->name,err); + exit(1); + } + return 0; + } +} + + +/* returns id number of tape db entry or zero if failure */ +/*int update_tape_entry( tapeheader_t *tapeheader) { + if (strncmp(tapeheader->name,tape_struct.tapename,20)) { + strncat(tape_struct.tapename,tapeheader->name,20); + if (db_tape_lookup_name(&tape_struct)) { + tape_struct.id=0; + strncpy(tape_struct.tapename,tapeheader->name,20); + tape_struct.start_time=tapeheader->st.jd; + tape_struct.last_block_time=tapeheader->st.jd; + tape_struct.last_block_done=tapeheader->frameseq; + if (db_tape_new(&tape_struct)) { + char tmpstr[256]; + fprintf( stderr, "Point 2\n" ); + sprintf(tmpstr,"Unable to create db entry for tape %s.",tapeheader->name); + message(tmpstr); + return(0); + } + } + } + tape_struct.last_block_time=tapeheader->st.jd; + tape_struct.last_block_done=tapeheader->frameseq; + if (db_tape_update(&tape_struct)) { + char tmpstr[256]; + sprintf(tmpstr,"Unable to update db entry for tape %s.",tapeheader->name); + message(tmpstr); + return(0); + } + return(tape_struct.id); +} +*/ + +/* returns workunit group id number on success, 0 on failure */ +/* +int create_wugrp_entry(workunit_grp &wugrp, int tapenum, tapeheader_t *tapeheader) { + int i,n; + + wugrp.tapenum=tapenum; + strncpy(wugrp.wugrpname,wugrpname,64); + wugrp.splitter_version=wuheader->wuinfo.splitter_version; + wugrp.start_ra=wuheader->wuinfo.start_ra; + wugrp.start_dec=wuheader->wuinfo.start_dec; + wugrp.end_ra=wuheader->wuinfo.end_ra; + wugrp.end_dec=wuheader->wuinfo.end_dec; + wugrp.angle_range=wuheader->wuinfo.angle_range; + wugrp.true_angle_range=wuheader->wuinfo.true_angle_range; + wugrp.beam_width=wuheader->wuinfo.beam_width; + wugrp.time_recorded=wuheader->wuinfo.time_recorded; + wugrp.fft_len=wuheader->wuinfo.fft_len; + wugrp.ifft_len=wuheader->wuinfo.ifft_len; + wugrp.receiver=wuheader->wuinfo.source; + wugrp.nsamples=wuheader->wuinfo.nsamples; + wugrp.sample_rate=tapeheader->samplerate; + wugrp.data_class=wuheader->wuinfo.data_class; + strncpy(wugrp.tape_version,wuheader->wuinfo.tape_version,13); + wugrp.num_positions=wuheader->wuinfo.num_positions; + if (db_workunit_grp_new(&wugrp)) { + char tmpstr[256]; + sprintf(tmpstr,"Unable to create db entry for workunit_grp %s\n",wugrpname); + message(tmpstr); + return(0); + } + for (i=0;iwuinfo.position_history[i].st.jd, + wuheader->wuinfo.position_history[i].ra, + wuheader->wuinfo.position_history[i].dec + ); + if (n=db_workunit_grp_update_position(wugrp.id,i,tmpstr)) { + fprintf( stderr, "%d\n", n ); + sprintf(tmpstr,"Unable to add position %d to workunit_grp %s\n",i,wugrpname); + message(tmpstr); + } + } + return (wugrp.id); +} + +int create_workunit_entry(wuheader_t *wuheader, int wugrpid, int subband_number) { + WORKUNIT wu; + + memset(&wu,0,sizeof(wu)); + strncpy(wu.name,wuheader->wuhead.name,63); + wu.grpnum=wugrpid; + wu.subb_center=wuheader->wuinfo.subband_center; + wu.subb_base=wuheader->wuinfo.subband_base; + wu.subb_sample_rate=wuheader->wuinfo.subband_sample_rate; + wu.subband_number=subband_number; + wu.data_class=wuheader->wuinfo.data_class; + if (db_workunit_new(&wu)) { + char tmpstr[256]; + sprintf(tmpstr,"Unable to create workunit entry %s\n",wu.name); + message(tmpstr); + return(0); + } + return(wu.id); +} +*/ + +/* + * $Log: db_fns.cpp,v $ + * Revision 1.3.4.2 2006/12/14 22:24:37 korpela + * *** empty log message *** + * + * Revision 1.3.4.1 2006/01/13 00:37:56 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.3 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:40 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:35 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:16 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:16:10 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 1.4 2000/12/01 01:13:29 korpela + * *** empty log message *** + * +// Revision 1.3 1999/03/05 01:47:18 korpela +// Added data_class field. +// +// Revision 1.2 1999/02/22 22:21:09 korpela +// Fixed half-day error. +// +// Revision 1.1 1999/02/11 16:46:28 korpela +// Initial revision +// + * + */ diff --git a/gbt_splitter/db_fns.h b/gbt_splitter/db_fns.h new file mode 100644 index 0000000..3ccf871 --- /dev/null +++ b/gbt_splitter/db_fns.h @@ -0,0 +1,48 @@ +/* + * $Id: db_fns.h,v 1.3 2003/08/05 17:23:40 korpela Exp $ + * + */ + + +#ifndef DB_FNS_H +#define DB_FNS_H + +#include "schema_master.h" + +int get_last_block(tapeheader_t *tapeheader) ; + +//int update_tape_entry( tapeheader_t *tapeheader) ; + +/* returns workunit group id number on success, 0 on failure */ +//int create_wugrp_entry(char *wugrpname,wuheader_t *wuheader, int tapenum, tapeheader_t *tapeheader) ; + +//int create_workunit_entry(wuheader_t *wuheader, int wugrpid, int subband_number) ; + +#endif + +/* + * + * $Log: db_fns.h,v $ + * Revision 1.3 2003/08/05 17:23:40 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.2 2003/06/03 01:01:16 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:16:10 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 1.2 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 1.1 1999/02/11 16:46:28 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/dotransform.cpp b/gbt_splitter/dotransform.cpp new file mode 100644 index 0000000..1663a50 --- /dev/null +++ b/gbt_splitter/dotransform.cpp @@ -0,0 +1,218 @@ +/* + * + * dotransform.c + * + * Functions for division by frequency into work units. + * + * $Id: dotransform.cpp,v 1.2.4.1 2006/12/14 22:24:38 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "fftw.h" +#include "wufiles.h" + +/* buffer for fft input/output */ +float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) +unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + + +int obuf_pos; /* Tracks current postition in the output buffers */ + + +void output_samples(float *data, int i, int buf_pos) { + int j,k; + unsigned short s; + float *p=data; + + for (j=0;j<2;j++) { + s=0; + for (k=0; k<8; k++) { + s >>= 2; + if (*p>0) s |= 0x8000; + if (*(p+1)>0) s |= 0x4000; + p+=2; + } + output_buf[i][buf_pos++]=*(char *)(&s); + output_buf[i][buf_pos++]=*(((char *)(&s))+1); + } +} + +void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) { + unsigned int i, j; + unsigned short s; + static int first_time=1; + static float lut[65536][16]; + + assert(!(nsamples % 8)); + + if (first_time) { + for (i=0;i<65536;i++) { + s=(unsigned short)i; + for (j=0;j<8;j++) { + lut[i][j*2]=(float)2*(s & 1)-1; + s >>= 1; + lut[i][j*2+1]=(float)2*(s & 1)-1; + s >>= 1; + } + } + first_time--; + } + + for (i=0;i<(nsamples/8);i++) { + memcpy(data+16*i,lut[raw[i]],16*sizeof(float)); + } +} + +void process_seg(float* data) { + int i; + float* p = data; + static float dbuff[FFT_LEN*2]; + static fftw_plan planfwd,planinverse; + + if (!planfwd) { + planfwd=fftw_create_plan(FFT_LEN, FFTW_BACKWARD, + FFTW_MEASURE | FFTW_IN_PLACE | FFTW_USE_WISDOM ); + planinverse=fftw_create_plan(IFFT_LEN, FFTW_FORWARD, + FFTW_MEASURE | FFTW_IN_PLACE | FFTW_USE_WISDOM ); + } + + fftw_one(planfwd, (fftw_complex *)data, (fftw_complex *)NULL); + data[0]=0; + data[1]=0; + fftw(planinverse, NSTRIPS, (fftw_complex *)data, 1, IFFT_LEN, + (fftw_complex *)NULL, 1, IFFT_LEN); + for (i=0; i TAPE_DATA_SIZE) { + /* End of frame crossed need to trasfer correctly */ + end_trans.frame++; + end_trans.byte-=TAPE_DATA_SIZE; + nsamp=(TAPE_DATA_SIZE-start_trans.byte)*(CHAR_BIT/2); + assert((nsamp+end_trans.byte*(CHAR_BIT/2)) == FFT_LEN); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf, nsamp); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(end_trans.frame,0),databuf+nsamp*2, + end_trans.byte*(CHAR_BIT/2)); + } else { + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf,FFT_LEN); + } + process_seg(databuf); + /* Go on to next transform */ + start_trans=end_trans; + } + /* Check if we're at the end of the wu file. If so we print less bytes */ + if ((end_trans.frame>=end_of_wu->frame) && + (end_trans.byte>=end_of_wu->byte)) { + write_wufile_blocks(NBYTES % SAMPLES_PER_OBUF); + } else { + write_wufile_blocks(SAMPLES_PER_OBUF); + } + } while (!((end_trans.frame>=end_of_wu->frame) && (end_trans.byte>=end_of_wu->byte))); + + /* Move the data in the buffer so we don't have to reread portions of the + * tape. + */ + { + unsigned char *record_offset; + int copysize; + end_of_wu->frame-=WU_OVERLAP_FRAMES; + records_in_buffer=TAPE_RECORDS_IN_BUFFER- + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD); + record_offset=tapebuffer+ + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD)*TAPE_RECORD_SIZE; + copysize=records_in_buffer*TAPE_RECORD_SIZE; + bcopy(record_offset,tapebuffer,copysize); + } +} + +/* + * + * $Log: dotransform.cpp,v $ + * Revision 1.2.4.1 2006/12/14 22:24:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:36 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:10 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2003/04/10 22:09:00 korpela + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.6 1999/02/22 19:02:50 korpela + * Revered input real & imaginary. + * + * Revision 2.5 1999/02/10 21:49:44 korpela + * Zeroed DC component of forward transform. + * + * Revision 2.4 1999/02/01 22:28:52 korpela + * FFTW version. + * + * Revision 2.3 1998/12/14 23:41:44 korpela + * *** empty log message *** + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:51:08 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/dotransform.h b/gbt_splitter/dotransform.h new file mode 100644 index 0000000..5b3136d --- /dev/null +++ b/gbt_splitter/dotransform.h @@ -0,0 +1,56 @@ +/* + * + * dotransform.h + * + * Functions for division by frequency into work units. + * + * $Id: dotransform.h,v 1.1 2003/06/03 00:16:11 korpela Exp $ + * + */ + +/* buffer for fft input/output */ +extern float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) +#define TBUF_OFFSET(frame,byte) (tapebuffer+(frame)*TAPE_FRAME_SIZE+(byte)) +extern unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + + +extern int obuf_pos; /* Tracks current postition in the output buffers */ + + +void output_samples(float *data, int i, int buf_pos); +void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) ; +void process_seg(float* data) ; +void do_transform(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu) ; + +/* + * + * $Log: dotransform.h,v $ + * Revision 1.1 2003/06/03 00:16:11 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1999/02/01 22:28:52 korpela + * FFTW version. + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:05:22 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/encode.cpp b/gbt_splitter/encode.cpp new file mode 100644 index 0000000..579697b --- /dev/null +++ b/gbt_splitter/encode.cpp @@ -0,0 +1,93 @@ +/* + * + * binary to ascii encoding for work unit files + * + * $Id: encode.cpp,v 1.2.4.2 2007/06/01 03:29:25 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include + +/* Write a range of bytes encoded into printable chars. + * Encodes 3 bytes into 4 chars. + * May read up to two bytes past end + */ + +void splitter_encode(unsigned char *bin, int nbytes, FILE *f) { + int count=0, offset=0, nleft, count1=0; + unsigned char c[4*1024+64]; + unsigned char nl=10; + assert(nbytes<=(3*1024)); + for (nleft = nbytes; nleft > 0; nleft -= 3) { + c[0+count1] = bin[offset]&0x3f; // 6 + c[1+count1] = (bin[offset]>>6) | (bin[offset+1]<<2)&0x3f; // 2+4 + c[2+count1] = ((bin[offset+1]>>4)&0xf) | (bin[offset+2]<<4)&0x3f;// 4+2 + c[3+count1] = bin[offset+2]>>2; // 6 + c[0+count1] += 0x20; + c[1+count1] += 0x20; + c[2+count1] += 0x20; + c[3+count1] += 0x20; + offset += 3; + count += 4; + count1 +=4; + if (count == 64) { + count = 0; + c[count1++]=nl; + } + } + write(fileno(f),c,count1); +} + +/* + * + * $Log: encode.cpp,v $ + * Revision 1.2.4.2 2007/06/01 03:29:25 korpela + * Fixes for linux build of Joe's updated code. + * + * Probably not working yet. + * + * Revision 1.2.4.1 2006/12/14 22:24:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:37 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:11 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * changed function name from encode() to splitter_encode() to avoid + * conflict with encode routine in ../client/util.C. Will investigate + * if merging of two functions is possible. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:52:56 korpela + * Initial revision + * + * + */ + + diff --git a/gbt_splitter/encode.h b/gbt_splitter/encode.h new file mode 100644 index 0000000..d17775f --- /dev/null +++ b/gbt_splitter/encode.h @@ -0,0 +1,39 @@ +/* + * + * binary to ascii encoding for work unit files + * + * $Id: encode.h,v 1.1 2003/06/03 00:16:11 korpela Exp $ + * + */ + +/* Write a range of bytes encoded into printable chars. + * Encodes 3 bytes into 4 chars. + * May read up to two bytes past end + */ + +void splitter_encode(unsigned char *bin, int nbytes, FILE *f); + +/* + * $Log: encode.h,v $ + * Revision 1.1 2003/06/03 00:16:11 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * Changed routine name from encode() to splitter_encode(). See encode.C + * for details. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:06:46 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/fftw.h b/gbt_splitter/fftw.h new file mode 100644 index 0000000..41698f7 --- /dev/null +++ b/gbt_splitter/fftw.h @@ -0,0 +1,413 @@ +/* fftw/fftw.h. Generated automatically by configure. */ +/* -*- C -*- */ +/* + * Copyright (c) 1997,1998 Massachusetts Institute of Technology + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* fftw.h -- system-wide definitions */ +/* $Id: fftw.h,v 1.1 2003/06/03 00:16:12 korpela Exp $ */ + +#ifndef FFTW_H +#define FFTW_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Define for using single precision */ +/* + * If you can, use configure --enable-float instead of changing this + * flag directly + */ +#define FFTW_ENABLE_FLOAT 1 + +/* our real numbers */ +#ifdef FFTW_ENABLE_FLOAT +typedef float fftw_real; +#else +typedef double fftw_real; +#endif + +/********************************************* + * Complex numbers and operations + *********************************************/ +typedef struct { + fftw_real re, im; +} fftw_complex; + +#define c_re(c) ((c).re) +#define c_im(c) ((c).im) + +typedef enum { + FFTW_FORWARD = -1, FFTW_BACKWARD = 1 +} fftw_direction; + +/* backward compatibility with FFTW-1.3 */ +typedef fftw_complex FFTW_COMPLEX; +typedef fftw_real FFTW_REAL; + +#ifndef FFTW_1_0_COMPATIBILITY +#define FFTW_1_0_COMPATIBILITY 0 +#endif + +#if FFTW_1_0_COMPATIBILITY +/* backward compatibility with FFTW-1.0 */ +#define REAL fftw_real +#define COMPLEX fftw_complex +#endif + +/********************************************* + * Success or failure status + *********************************************/ + +typedef enum { + FFTW_SUCCESS = 0, FFTW_FAILURE = -1 +} fftw_status; + +/********************************************* + * Codelets + *********************************************/ +typedef void (fftw_notw_codelet) + (const fftw_complex *, fftw_complex *, int, int); +typedef void (fftw_twiddle_codelet) + (fftw_complex *, const fftw_complex *, int, + int, int); +typedef void (fftw_generic_codelet) + (fftw_complex *, const fftw_complex *, int, + int, int, int); +typedef void (fftw_real2hc_codelet) + (const fftw_real *, fftw_real *, fftw_real *, + int, int, int); +typedef void (fftw_hc2real_codelet) + (const fftw_real *, const fftw_real *, + fftw_real *, int, int, int); +typedef void (fftw_hc2hc_codelet) + (fftw_real *, const fftw_complex *, + int, int, int); +typedef void (fftw_rgeneric_codelet) + (fftw_real *, const fftw_complex *, int, + int, int, int); + +/********************************************* + * Configurations + *********************************************/ +/* + * A configuration is a database of all known codelets + */ + +enum fftw_node_type { + FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER, + FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC +}; + +/* description of a codelet */ +typedef struct { + const char *name; /* name of the codelet */ + void (*codelet) (); /* pointer to the codelet itself */ + int size; /* size of the codelet */ + fftw_direction dir; /* direction */ + enum fftw_node_type type; /* TWIDDLE or NO_TWIDDLE */ + int signature; /* unique id */ + int ntwiddle; /* number of twiddle factors */ + const int *twiddle_order; /* + * array that determines the order + * in which the codelet expects + * the twiddle factors + */ +} fftw_codelet_desc; + +/* On Win32, you need to do funny things to access global variables + in shared libraries. Thanks to Andrew Sterian for this hack. */ +#if defined(__WIN32__) || defined(WIN32) || defined(_WINDOWS) +# if defined(BUILD_FFTW_DLL) +# define DL_IMPORT(type) __declspec(dllexport) type +# elif defined(USE_FFTW_DLL) +# define DL_IMPORT(type) __declspec(dllimport) type +# else +# define DL_IMPORT(type) type +# endif +#else +# define DL_IMPORT(type) type +#endif + +extern DL_IMPORT(const char *) fftw_version; + +/***************************** + * Plans + *****************************/ +/* + * A plan is a sequence of reductions to compute a FFT of + * a given size. At each step, the FFT algorithm can: + * + * 1) apply a notw codelet, or + * 2) recurse and apply a twiddle codelet, or + * 3) apply the generic codelet. + */ + +/* structure that contains twiddle factors */ +typedef struct fftw_twiddle_struct { + int n; + const fftw_codelet_desc *cdesc; + fftw_complex *twarray; + struct fftw_twiddle_struct *next; + int refcnt; +} fftw_twiddle; + +typedef struct fftw_rader_data_struct { + struct fftw_plan_struct *plan; + fftw_complex *omega; + int g, ginv; + int p, flags, refcount; + struct fftw_rader_data_struct *next; + fftw_codelet_desc *cdesc; +} fftw_rader_data; + +typedef void (fftw_rader_codelet) + (fftw_complex *, const fftw_complex *, int, + int, int, fftw_rader_data *); + +/* structure that holds all the data needed for a given step */ +typedef struct fftw_plan_node_struct { + enum fftw_node_type type; + + union { + /* nodes of type FFTW_NOTW */ + struct { + int size; + fftw_notw_codelet *codelet; + const fftw_codelet_desc *codelet_desc; + } notw; + + /* nodes of type FFTW_TWIDDLE */ + struct { + int size; + fftw_twiddle_codelet *codelet; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + const fftw_codelet_desc *codelet_desc; + } twiddle; + + /* nodes of type FFTW_GENERIC */ + struct { + int size; + fftw_generic_codelet *codelet; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + } generic; + + /* nodes of type FFTW_RADER */ + struct { + int size; + fftw_rader_codelet *codelet; + fftw_rader_data *rader_data; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + } rader; + + /* nodes of type FFTW_REAL2HC */ + struct { + int size; + fftw_real2hc_codelet *codelet; + const fftw_codelet_desc *codelet_desc; + } real2hc; + + /* nodes of type FFTW_HC2REAL */ + struct { + int size; + fftw_hc2real_codelet *codelet; + const fftw_codelet_desc *codelet_desc; + } hc2real; + + /* nodes of type FFTW_HC2HC */ + struct { + int size; + fftw_direction dir; + fftw_hc2hc_codelet *codelet; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + const fftw_codelet_desc *codelet_desc; + } hc2hc; + + /* nodes of type FFTW_RGENERIC */ + struct { + int size; + fftw_direction dir; + fftw_rgeneric_codelet *codelet; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + } rgeneric; + } nodeu; + + int refcnt; +} fftw_plan_node; + +struct fftw_plan_struct { + int n; + int refcnt; + fftw_direction dir; + int flags; + int wisdom_signature; + enum fftw_node_type wisdom_type; + struct fftw_plan_struct *next; + fftw_plan_node *root; + double cost; +}; + +/* a plan is just an array of instructions */ +typedef struct fftw_plan_struct *fftw_plan; + +/* flags for the planner */ +#define FFTW_ESTIMATE (0) +#define FFTW_MEASURE (1) + +#define FFTW_OUT_OF_PLACE (0) +#define FFTW_IN_PLACE (8) +#define FFTW_USE_WISDOM (16) + +#define FFTW_THREADSAFE (128) /* guarantee plan is read-only so that the + same plan can be used in parallel by + multiple threads */ + +#define FFTWND_FORCE_BUFFERED (256) /* internal, undocumented flag */ + +extern fftw_plan fftw_create_plan_specific(int n, fftw_direction dir, + int flags, + fftw_complex *in, int istride, + fftw_complex *out, int ostride); +#define FFTW_HAS_PLAN_SPECIFIC +extern fftw_plan fftw_create_plan(int n, fftw_direction dir, int flags); +extern void fftw_print_plan(fftw_plan plan); +extern void fftw_destroy_plan(fftw_plan plan); +extern void fftw(fftw_plan plan, int howmany, fftw_complex *in, int istride, + int idist, fftw_complex *out, int ostride, int odist); +extern void fftw_one(fftw_plan plan, fftw_complex *in, fftw_complex *out); +extern void fftw_die(const char *s); +extern void *fftw_malloc(size_t n); +extern void fftw_free(void *p); +extern void fftw_check_memory_leaks(void); +extern void fftw_print_max_memory_usage(void); + +typedef void *(*fftw_malloc_type_function) (size_t n); +typedef void (*fftw_free_type_function) (void *p); +typedef void (*fftw_die_type_function) (const char *errString); +extern DL_IMPORT(fftw_malloc_type_function) fftw_malloc_hook; +extern DL_IMPORT(fftw_free_type_function) fftw_free_hook; +extern DL_IMPORT(fftw_die_type_function) fftw_die_hook; + +extern size_t fftw_sizeof_fftw_real(void); + +/* Wisdom: */ +/* + * define this symbol so that users know we are using a version of FFTW + * with wisdom + */ +#define FFTW_HAS_WISDOM +extern void fftw_forget_wisdom(void); +extern void fftw_export_wisdom(void (*emitter) (char c, void *), void *data); +extern fftw_status fftw_import_wisdom(int (*g) (void *), void *data); +extern void fftw_export_wisdom_to_file(FILE *output_file); +extern fftw_status fftw_import_wisdom_from_file(FILE *input_file); +extern char *fftw_export_wisdom_to_string(void); +extern fftw_status fftw_import_wisdom_from_string(const char *input_string); + +/* + * define symbol so we know this function is available (it is not in + * older FFTWs) + */ +#define FFTW_HAS_FPRINT_PLAN +extern void fftw_fprint_plan(FILE *f, fftw_plan plan); + +/***************************** + * N-dimensional code + *****************************/ +typedef struct { + int is_in_place; /* 1 if for in-place FFTs, 0 otherwise */ + + int rank; /* + * the rank (number of dimensions) of the + * array to be FFTed + */ + int *n; /* + * the dimensions of the array to the + * FFTed + */ + fftw_direction dir; + + int *n_before; /* + * n_before[i] = product of n[j] for j < i + */ + int *n_after; /* n_after[i] = product of n[j] for j > i */ + + fftw_plan *plans; /* 1d fftw plans for each dimension */ + + int nbuffers, nwork; + fftw_complex *work; /* + * work array big enough to hold + * nbuffers+1 of the largest dimension + * (has nwork elements) + */ +} fftwnd_data; + +typedef fftwnd_data *fftwnd_plan; + +/* Initializing the FFTWND plan: */ +extern fftwnd_plan fftw2d_create_plan(int nx, int ny, fftw_direction dir, + int flags); +extern fftwnd_plan fftw3d_create_plan(int nx, int ny, int nz, + fftw_direction dir, int flags); +extern fftwnd_plan fftwnd_create_plan(int rank, const int *n, + fftw_direction dir, + int flags); + +extern fftwnd_plan fftw2d_create_plan_specific(int nx, int ny, + fftw_direction dir, + int flags, + fftw_complex *in, int istride, + fftw_complex *out, int ostride); +extern fftwnd_plan fftw3d_create_plan_specific(int nx, int ny, int nz, + fftw_direction dir, int flags, + fftw_complex *in, int istride, + fftw_complex *out, int ostride); +extern fftwnd_plan fftwnd_create_plan_specific(int rank, const int *n, + fftw_direction dir, + int flags, + fftw_complex *in, int istride, + fftw_complex *out, int ostride); + +/* Freeing the FFTWND plan: */ +extern void fftwnd_destroy_plan(fftwnd_plan plan); + +/* Printing the plan: */ +extern void fftwnd_fprint_plan(FILE *f, fftwnd_plan p); +extern void fftwnd_print_plan(fftwnd_plan p); +#define FFTWND_HAS_PRINT_PLAN + +/* Computing the N-Dimensional FFT */ +extern void fftwnd(fftwnd_plan plan, int howmany, + fftw_complex *in, int istride, int idist, + fftw_complex *out, int ostride, int odist); +extern void fftwnd_one(fftwnd_plan p, fftw_complex *in, fftw_complex *out); + +#ifdef __cplusplus +} /* extern "C" */ + +#endif /* __cplusplus */ +#endif /* FFTW_H */ diff --git a/gbt_splitter/four1.cpp b/gbt_splitter/four1.cpp new file mode 100644 index 0000000..f775a98 --- /dev/null +++ b/gbt_splitter/four1.cpp @@ -0,0 +1,88 @@ +/* + * + * Fourier transform routine from numerical recipes. + * + * $Id: four1.cpp,v 1.2.4.1 2006/12/14 22:24:38 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr + +void four1(float data[], unsigned long nn, int isign) { + unsigned long n,mmax,m,j,istep,i; + double wtemp,wr,wpr,wpi,wi,theta; + float tempr,tempi; + + n=nn << 1; + j=1; + for (i=1;i i) { + SWAP(data[j],data[i]); + SWAP(data[j+1],data[i+1]); + } + m=n >> 1; + while (m >= 2 && j > m) { + j -= m; + m >>= 1; + } + j += m; + } + mmax=2; + while (n > mmax) { + istep=mmax << 1; + theta=isign*(6.28318530717959/mmax); + wtemp=sin(0.5*theta); + wpr = -2.0*wtemp*wtemp; + wpi=sin(theta); + wr=1.0; + wi=0.0; + for (m=1;m Number of points in FFT" + print " -t --taps Number of taps in PFB" + print " -b --sub-bands Number of sub-bands in data" + print " -w --width-factor width factor for sinc(x) call" + print " -d --data-type Data type - \"float\" or " \ + + "\"signedchar\"" + print " -p --no-plot Do not plot coefficients" + return + +# default values +NFFT = 32768 # number of points in FFT +NTaps = 8 # number of taps in PFB +NSubBands = 1 # number of sub-bands in data +WidthFactor = 1.05 # width factor for sinc(x) call +DataType = "signedchar" # data type - "float" or "signedchar" +Plot = True # plot flag + +# get the command line arguments +ProgName = sys.argv[0] +OptsShort = "hn:t:b:w:d:p" +OptsLong = ["help", "nfft=", "taps=", "sub-bands=", "width-factor=", "data-type=", "no-plot"] + +# check if the minimum expected number of arguments has been passed +# to the program +if (1 == len(sys.argv)): + sys.stderr.write("ERROR: No arguments passed to the program!\n") + PrintUsage(ProgName) + sys.exit(1) + +# get the arguments using the getopt module +try: + (Opts, Args) = getopt.getopt(sys.argv[1:], OptsShort, OptsLong) +except getopt.GetoptError, ErrMsg: + # print usage information and exit + sys.stderr.write("ERROR: " + str(ErrMsg) + "!\n") + PrintUsage(ProgName) + sys.exit(1) + +# parse the arguments +for o, a in Opts: + if o in ("-h", "--help"): + PrintUsage(ProgName) + sys.exit() + elif o in ("-n", "--nfft"): + NFFT = int(a) + elif o in ("-t", "--taps"): + NTaps = int(a) + elif o in ("-b", "--sub-bands"): + NSubBands = int(a) + elif o in ("-w", "--width-factor"): + WidthFactor = float(a) + elif o in ("-d", "--data-type"): + DataType = a + elif o in ("-p", "--no-plot"): + Plot = False + else: + PrintUsage(ProgName) + sys.exit(1) + +M = NTaps * NFFT + +# the filter-coefficient-generation section --> +X = numpy.array([(float(i) / NFFT) - (float(NTaps) / 2) for i in range(M)]) +PFBCoeff = numpy.sinc(X * WidthFactor) * numpy.hanning(M) +# <-- the filter-coefficient-generation section + +# create conversion map +if ("signedchar" == DataType): + Map = numpy.zeros(256, numpy.float32) + for i in range(0, 128): + Map[i] = float(i) / 128 + for i in range(128, 256): + Map[i] = - (float(256 -i) / 128) + +# 32-bit (float) coefficients +PFBCoeffFloat32 = numpy.zeros(M * NSubBands, numpy.float32) +# 8-bit (signedchar) coefficients +if ("signedchar" == DataType): + PFBCoeffInt8 = numpy.zeros(M * NSubBands, numpy.int8) +k = 0 +for i in range(len(PFBCoeff)): + Coeff = float(PFBCoeff[i]) + if ("signedchar" == DataType): + for j in range(256): + #if (math.fabs(Coeff - Map[j]) <= (0.0078125 / 2)): + if (math.fabs(Coeff - Map[j]) <= 0.0078125): + for m in range(NSubBands): + PFBCoeffInt8[k+m] = j + break + elif ("float" == DataType): + for m in range(NSubBands): + PFBCoeffFloat32[k+m] = Coeff + else: + # print usage information and exit + sys.stderr.write("ERROR: Invalid data type!\n") + PrintUsage(ProgName) + sys.exit(1) + k = k + NSubBands + +# write the coefficients to disk and also plot it +FileCoeff = open("coeff_" \ + + DataType + "_" \ + + str(NTaps) + "_" \ + + str(NFFT) + "_" \ + + str(NSubBands) + "_" \ + + str(WidthFactor) + ".dat", \ + "wb") +if ("signedchar" == DataType): + FileCoeff.write(PFBCoeffInt8) + # plot the coefficients + if (Plot): + plotter.plot(PFBCoeffInt8) +else: + FileCoeff.write(PFBCoeffFloat32) + # plot the coefficients + if (Plot): + plotter.plot(PFBCoeffFloat32) + +FileCoeff.close() + +if (Plot): + plotter.show() + diff --git a/gbt_splitter/hr_min_sec.cpp b/gbt_splitter/hr_min_sec.cpp new file mode 100644 index 0000000..63a7eea --- /dev/null +++ b/gbt_splitter/hr_min_sec.cpp @@ -0,0 +1,131 @@ +/* + * + * timecvt.c + * + * Time conversion routines. + * + * $Id: hr_min_sec.cpp,v 1.2.4.1 2006/12/14 22:24:39 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include + +char* hr_min_sec (double x) { + static char buf[256]; + int hr = (int)(x / 3600); + int min = (int)((x/3600-(double)hr)*60); + float s = (float)(x - ((double)hr)*3600 - ((double)min)*60); + + // the "-.05" below is to prevent it from printing 60.0 sec + // when the real value is e.g. 59.91 + // + sprintf(buf, "%d hr %02d min %04.1f sec", hr, min, s-.05); + return buf; +} + + +/* + * $Log: hr_min_sec.cpp,v $ + * Revision 1.2.4.1 2006/12/14 22:24:39 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:40 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 01:01:16 korpela + * + * First working splitter under CVS. + * + * Revision 4.4 2003/03/10 02:50:03 jeffc + * jeffc - t_strncpy() + * + * Revision 4.3 2003/01/22 20:51:58 korpela + * Changed all strcpy to strncpy. + * Changed all gets to fgets. + * + * Revision 4.2 2001/12/27 21:35:57 davea + * *** empty log message *** + * + * Revision 4.1 2001/09/10 00:25:17 davea + * *** empty log message *** + * + * Revision 4.0 2000/10/05 18:12:12 korpela + * Synchronized versions to 4.0 following release of 3.0 client + * + * Revision 3.8 2000/09/14 01:01:31 korpela + * *** empty log message *** + * + * Revision 3.7 2000/04/24 08:39:06 charlief + * eliminate compiler warning in hr_min_sec() function. + * + * Revision 3.6 2000/01/19 08:32:32 davea + * *** empty log message *** + * + * Revision 3.5 1999/10/19 08:07:24 davea + * *** empty log message *** + * + * Revision 3.4 1999/06/26 06:56:44 hiramc + * Hiram 99/06/25 23:59 moved the include out of the + * ifdef _WIN32 to define strcpy() for all compiles + * + * Revision 3.3 1999/06/22 09:40:36 charlief + * Reverse last change:restore jd_string() as it was before. + * Add new function short_jd_string(), which does not print + * Julian Date as a floating point value. + * + * Revision 3.1 1999/06/10 00:44:11 korpela + * *** empty log message *** + * + * Revision 3.0 1999/05/14 19:17:35 korpela + * 1.0(Win/Mac) 1.1(Unix) Release Version + * + * Revision 2.11 1999/03/14 00:23:02 davea + * *** empty log message *** + * + * Revision 2.10 1999/03/11 21:46:58 korpela + * Fixed rounding error in st_to_ut(). + * + * Revision 2.9 1999/03/05 09:15:07 kyleg + * *** empty log message *** + * + * Revision 2.8 1999/02/18 19:36:49 korpela + * *** empty log message *** + * + * Revision 2.7 1999/02/13 23:54:44 kyleg + * *** empty log message *** + * + * Revision 2.6 1999/02/11 08:36:54 davea + * *** empty log message *** + * + * Revision 2.5 1998/11/17 21:47:02 korpela + * *** empty log message *** + * + * Revision 2.4 1998/11/05 21:25:21 davea + * replace floor() with (int) + * + * Revision 2.3 1998/11/05 02:00:06 kyleg + * *** empty log message *** + * + * Revision 2.2 1998/11/02 17:59:06 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 17:23:29 korpela + * .` + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/27 00:58:56 korpela + * Bug fixes. + * + * Revision 1.1 1998/10/19 18:57:56 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/hr_min_sec.h b/gbt_splitter/hr_min_sec.h new file mode 100644 index 0000000..062a2c3 --- /dev/null +++ b/gbt_splitter/hr_min_sec.h @@ -0,0 +1,106 @@ +/* + * + * timecvt.c + * + * Time conversion routines. + * + * $Id: hr_min_sec.h,v 1.1 2003/06/03 01:01:16 korpela Exp $ + * + */ + +char* hr_min_sec (double x) ; + + +/* + * $Log: hr_min_sec.h,v $ + * Revision 1.1 2003/06/03 01:01:16 korpela + * + * First working splitter under CVS. + * + * Revision 4.4 2003/03/10 02:50:03 jeffc + * jeffc - t_strncpy() + * + * Revision 4.3 2003/01/22 20:51:58 korpela + * Changed all strcpy to strncpy. + * Changed all gets to fgets. + * + * Revision 4.2 2001/12/27 21:35:57 davea + * *** empty log message *** + * + * Revision 4.1 2001/09/10 00:25:17 davea + * *** empty log message *** + * + * Revision 4.0 2000/10/05 18:12:12 korpela + * Synchronized versions to 4.0 following release of 3.0 client + * + * Revision 3.8 2000/09/14 01:01:31 korpela + * *** empty log message *** + * + * Revision 3.7 2000/04/24 08:39:06 charlief + * eliminate compiler warning in hr_min_sec() function. + * + * Revision 3.6 2000/01/19 08:32:32 davea + * *** empty log message *** + * + * Revision 3.5 1999/10/19 08:07:24 davea + * *** empty log message *** + * + * Revision 3.4 1999/06/26 06:56:44 hiramc + * Hiram 99/06/25 23:59 moved the include out of the + * ifdef _WIN32 to define strcpy() for all compiles + * + * Revision 3.3 1999/06/22 09:40:36 charlief + * Reverse last change:restore jd_string() as it was before. + * Add new function short_jd_string(), which does not print + * Julian Date as a floating point value. + * + * Revision 3.1 1999/06/10 00:44:11 korpela + * *** empty log message *** + * + * Revision 3.0 1999/05/14 19:17:35 korpela + * 1.0(Win/Mac) 1.1(Unix) Release Version + * + * Revision 2.11 1999/03/14 00:23:02 davea + * *** empty log message *** + * + * Revision 2.10 1999/03/11 21:46:58 korpela + * Fixed rounding error in st_to_ut(). + * + * Revision 2.9 1999/03/05 09:15:07 kyleg + * *** empty log message *** + * + * Revision 2.8 1999/02/18 19:36:49 korpela + * *** empty log message *** + * + * Revision 2.7 1999/02/13 23:54:44 kyleg + * *** empty log message *** + * + * Revision 2.6 1999/02/11 08:36:54 davea + * *** empty log message *** + * + * Revision 2.5 1998/11/17 21:47:02 korpela + * *** empty log message *** + * + * Revision 2.4 1998/11/05 21:25:21 davea + * replace floor() with (int) + * + * Revision 2.3 1998/11/05 02:00:06 kyleg + * *** empty log message *** + * + * Revision 2.2 1998/11/02 17:59:06 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 17:23:29 korpela + * .` + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/27 00:58:56 korpela + * Bug fixes. + * + * Revision 1.1 1998/10/19 18:57:56 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/makebufs.cpp b/gbt_splitter/makebufs.cpp new file mode 100644 index 0000000..c7b5140 --- /dev/null +++ b/gbt_splitter/makebufs.cpp @@ -0,0 +1,139 @@ +/* + * makebuf.c + * + * Creates temporary files and buffers for use in processing.... + * + * $Id: makebufs.cpp,v 1.3.2.2 2006/12/14 22:24:39 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "message.h" + +int tapebuffd; +char tapebufname[30]; + +void delbuffer(void) { + munmap((char *)tapebuffer,TAPE_BUFFER_SIZE); + close(tapebuffd); + unlink(tapebufname); +} + +void delbuffer_sig(int i) { + munmap((char *)tapebuffer,TAPE_BUFFER_SIZE); + close(tapebuffd); + unlink(tapebufname); + exit(1); +} + + + +void makebuffers(unsigned char **tapebuffer) { + char buf[1024]; +/* + * Allocate temp files for tape and wu buffers. Memory mapping these + * files will prevent us from running out of virtual memory + */ +/* sprintf(tapebufname,"tape%d",getpid()); + + if ((tapebuffd=open(tapebufname,O_RDWR|O_CREAT,0777))==-1) { + fprintf(stderr,"Unable to open temp file!\n"); + fprintf(errorlog,"Unable to open temp file!\n"); + exit(EXIT_FAILURE); + } + + if (ftruncate(tapebuffd,TAPE_BUFFER_SIZE) == -1) { + fprintf(stderr,"ftruncate failure\n"); + fprintf(stderr," errno=%d\n",errno); + fprintf(errorlog,"ftruncate failure\n"); + fprintf(errorlog," errno=%d\n",errno); + exit(EXIT_FAILURE); + } + + if (((*tapebuffer= + mmap(0,TAPE_BUFFER_SIZE,PROT_READ|PROT_WRITE,MAP_SHARED,tapebuffd,0))==(char *)-1)) + { + fprintf(stderr,"mmap failure\n"); + fprintf(errorlog,"mmap failure\n"); + exit(EXIT_FAILURE); + } + + atexit(delbuffer); + signal(SIGINT,delbuffer_sig); +*/ + if (!(*tapebuffer=(unsigned char *)malloc(TAPE_BUFFER_SIZE))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"unable to allocate memory for tape buffer\n"); + exit(0); + } +} + +/* + * $Log: makebufs.cpp,v $ + * Revision 1.3.2.2 2006/12/14 22:24:39 korpela + * *** empty log message *** + * + * Revision 1.3.2.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.3 2004/06/16 20:57:18 jeffc + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:42 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:13 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1998/12/14 23:41:44 korpela + * *** empty log message *** + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * Added signal handler for removal of temporary files on SIGINT. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.4 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.3 1998/10/27 00:55:43 korpela + * Bug Fixes + * + * Revision 1.2 1998/10/20 20:40:54 korpela + * Removed wu buffer. + * + * Revision 1.1 1998/10/19 19:01:56 korpela + * Initial revision + * + */ diff --git a/gbt_splitter/makebufs.h b/gbt_splitter/makebufs.h new file mode 100644 index 0000000..3e1aa59 --- /dev/null +++ b/gbt_splitter/makebufs.h @@ -0,0 +1,38 @@ +/* + * makebufs.h + * + * Creates temporary files and buffers for use in processing.... + * + * $Id: makebufs.h,v 1.1 2003/06/03 00:16:14 korpela Exp $ + * + */ + +#ifndef MAKEBUFS_H +#define MAKEBUFS_H + +void makebuffers(unsigned char **tapebuffer); + +#endif + +/* + * $Log: makebufs.h,v $ + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/20 20:41:45 korpela + * Remove wu buffer. + * + * Revision 1.1 1998/10/19 19:02:36 korpela + * Initial revision + * + */ diff --git a/gbt_splitter/mb_angdist.cpp b/gbt_splitter/mb_angdist.cpp new file mode 100644 index 0000000..02f5bd9 --- /dev/null +++ b/gbt_splitter/mb_angdist.cpp @@ -0,0 +1,88 @@ +/* + * angdist.c + * + * Computes angular distance between two lat/lon points + * + * $Id: mb_angdist.cpp,v 1.1.2.1 2006/12/14 22:24:39 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include "seti_header.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "xml_util.h" +#include "db/app_config.h" + + +#define DTOR (M_PI/180) + +double angdist(double r1, double d1, double r2, double d2) { + double alpha,dist,d; + + r1*=DTOR; + r2*=DTOR; + d1*=DTOR; + d2*=DTOR; + alpha=r1-r2; + dist=sin(d2)*sin(d1)+cos(d1)*cos(d2)*cos(alpha); + if ((dist*dist)<1) { + d=sqrt(1.0-dist*dist); + } else { + dist=1.0; + d=0.0; + } + dist=atan2(d,dist); + dist=dist/DTOR; + return (dist); +} + +double angdist(const coordinate_t &a, const coordinate_t &b) { + return angdist(a.ra*15,a.dec,b.ra*15,b.dec); +} + + +/* + * $Log: mb_angdist.cpp,v $ + * Revision 1.1.2.1 2006/12/14 22:24:39 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:39 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:31 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:15 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:16:08 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:47:33 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/mb_angdist.h b/gbt_splitter/mb_angdist.h new file mode 100644 index 0000000..c96b664 --- /dev/null +++ b/gbt_splitter/mb_angdist.h @@ -0,0 +1,36 @@ +/* + * angdist.h + * + * Computes angular distance between two lat/lon points + * + * $Id: mb_angdist.h,v 1.1.2.1 2006/12/14 22:24:40 korpela Exp $ + * + */ + +double angdist(double r1, double d1, double r2, double d2) ; +double angdist(const coordinate_t &a,const coordinate_t &b); + +/* + * $Log: mb_angdist.h,v $ + * Revision 1.1.2.1 2006/12/14 22:24:40 korpela + * *** empty log message *** + * + * Revision 1.1 2003/06/03 00:16:09 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:03:21 korpela + * Initial revision + * + * + */ + diff --git a/gbt_splitter/mb_dotransform.cpp b/gbt_splitter/mb_dotransform.cpp new file mode 100644 index 0000000..753f7dc --- /dev/null +++ b/gbt_splitter/mb_dotransform.cpp @@ -0,0 +1,511 @@ +/* + * + * dotransform.c + * + * Functions for division by frequency into work units. + * + * $Id: mb_dotransform.cpp,v 1.1.2.3 2007/06/06 15:58:29 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "setilib.h" +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "fftw3.h" +#include "mb_wufiles.h" + +#include /* for open() */ +#include /* for open() */ +#include /* for open() */ +#include "mb_dotransform.h" /* for new function declarations and macro + definitions */ + +// PFB parameters +int g_iNTaps; +float g_fWidthFactor; + +/* the PFB data structure */ +typedef struct +{ + complex* pcfData; // stores the data for one polyphase filtering; PFB_FFT_LEN complex floats + fftwf_complex* pfcData; // points to the above data +} PFB_DATA; +PFB_DATA* g_astPFBData; // points to g_iNTaps PFB_DATA's + + +fftwf_plan g_stPlan = {0}; // FFT plan +fftwf_complex* g_pfcFFTArray = NULL; // FFT input/output; PFB_FFT_LEN complex floats + +static complex* g_pcfPackedDataOut = NULL; // packed FFT output, for the benefit of output_samples(); + // PFB_OUTPUT_STACK_SIZE * PFB_FFT_LEN * 2 floats + +float* g_pfPFBCoeff = NULL; // filter coefficients; g_iNTaps * PFB_FFT_LEN floats +int g_iIsFirstRun = TRUE; + +void gen_coeff(float * coeff, int num_coeff) { + + int i; + float hanning_window[num_coeff]; + float work_array[num_coeff]; + + seti_hanning_window(hanning_window, num_coeff); + + for(i=0; i 8 cplx chars, or 16 floats -> 16 chars) + int j,k; + unsigned short s=0; + float *p=data; + + for (k=0; k<8; k++) { + s >>= 2; + if (*p>0) s |= 0x8000; + if (*(p+1)>0) s |= 0x4000; + p+=2; + } + // bin_data is defined in mb_wufiles.cpp as a vector + bin_data[i].push_back((s>>8) & 0xff); + bin_data[i].push_back(s & 0xff); +} + +void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) { + unsigned int i, j; + unsigned short s; + static int first_time=1; + static float lut[65536][16]; + + assert(!(nsamples % 8)); + + if (first_time) { + for (i=0;i<65536;i++) { + s=(unsigned short)i; + for (j=0;j<8;j++) { + lut[i][j*2]=(float)2*(s & 1)-1; + s >>= 1; + lut[i][j*2+1]=(float)2*(s & 1)-1; + s >>= 1; + } + } + first_time--; + } + + for (i=0;i<(nsamples/8);i++) { + memcpy(data+16*i,lut[raw[i]],16*sizeof(float)); + } +} + + +float randu() { +// Uniform random numbers between 0 and 1 + static bool first=true; + if (first) { + srand(time(0)); + first=false; + } + return static_cast(rand())/RAND_MAX; +} + +float randn() { +// normally distributed random numbers + static float last=0; + float a,b,h=0; + if (last==0) { + while (h==0 || h>=1) { + a=2*randu()-1; + b=2*randu()-1; + h=a*a+b*b; + } + h=sqrt(-2*log(h)/h); + last=a*h; + return b*h; + } else { + a=last; + last=0; + return a; + } +} + +int set_iDataIdx(int iDataIdx, int &iTapeBufferIdx, int iPrevTapeBufferIdx) { + /* NOTE: for the last tape buffer, the last polyphase filtering we perform is for the + last consecutive g_iNTaps blocks */ + /* rewind the data index by (g_iNTaps - 1) blocks */ + iDataIdx -= ((g_iNTaps - 1) * PFB_FFT_LEN); + if (iTapeBufferIdx != iPrevTapeBufferIdx) { + if (iDataIdx != 0) { /* data index can only be negative or zero at this point */ + /* if rewinding takes us back to the previous tapebuffer, + change the tapebuffer index and data index accordingly */ + iTapeBufferIdx = iPrevTapeBufferIdx; + /* NOTE: data index is negative, hence the addition */ + iDataIdx = tapebuffer[iTapeBufferIdx].data.size() + iDataIdx; + } + } + + return(iDataIdx); +} + +inline int inc_iDataIdx(int &iTapeBufferIdx, int &iDataIdx) { + + int iFlagBreak = FALSE; + + iDataIdx = (iDataIdx + 1) % tapebuffer[iTapeBufferIdx].data.size(); + if (0 == iDataIdx) { + /* move to the next tapebuffer */ + ++iTapeBufferIdx; + if (tapebuffer.size() == iTapeBufferIdx) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, "End of tape buffer.\n"); + iFlagBreak = TRUE; + /* NOTE: do not return here, as we still need to process the current block */ + } + } + + return(iFlagBreak); +} + +inline int load_pfb_data(int &iTapeBufferIdx, int &iDataIdx, int &i, int &k) { + + g_astPFBData[i].pcfData[k] = complex( + // The PFB has the opposite notion of i and q than that of the data recorder. + // To account for this, we flip real and imag here. + static_cast(tapebuffer[iTapeBufferIdx].data[iDataIdx].imag()), + static_cast(tapebuffer[iTapeBufferIdx].data[iDataIdx].real()) + ); + + return(inc_iDataIdx(iTapeBufferIdx, iDataIdx)); +} + +void reorder_data(fftwf_complex *pfcPackedDataOut, int iPFBTapIdx) { + + int i; + + /* re-order the output data in such a way that at the end of this loop, + output is in the same form as before the PFB implementation, + so output_samples() can be used the same way as before. + (in the above output, frequency is the fastest-changing index, + but output_samples() requires data with time as the fastest-changing + index.) */ + for (i = 0; i < PFB_FFT_LEN; ++i) { + // The PFB has the opposite notion of i and q than that of the workunit. + // To account for this, we flip real and imag here. + /* imaginary part of g_pfcFFTArray[][] */ + pfcPackedDataOut[(i*PFB_OUTPUT_STACK_SIZE)+iPFBTapIdx][0] = g_pfcFFTArray[i][1]; + /* real part of g_pfcFFTArray[][] */ + pfcPackedDataOut[(i*PFB_OUTPUT_STACK_SIZE)+iPFBTapIdx][1] = g_pfcFFTArray[i][0]; + + } +} + + +void process_seg() { + int iTapeBufferIdx = 0; + signed int iDataIdx = 0; + int iFlagBreak = FALSE; + + while (iTapeBufferIdx < tapebuffer.size()) { // walk tape blocks + while (iDataIdx < tapebuffer[iTapeBufferIdx].data.size()) { // walk data within a tape block + int i; + float* fbuff = (float*) g_pcfPackedDataOut; + fftwf_complex *pfcPackedDataOut = (fftwf_complex*) g_pcfPackedDataOut; + float r_total=0, r_mean=0, i_total=0, i_mean=0; // used for nulling the DC bin + int iPrevTapeBufferIdx = 0; /* to keep track of tapebuffer-index-change */ + int iPFBOutputStackIdx; + int iPFBTapIdx; + int iPFBFftIdx; + + // this outer loop just stacks up the amout of data required by output_samples() + for(iPFBOutputStackIdx=0; iPFBOutputStackIdx &tapebuffer) { + int iRet = EXIT_SUCCESS; + + /* initialise PFB-related stuff */ + if (g_iIsFirstRun) + { + iRet = InitPFB(); + if (iRet != EXIT_SUCCESS) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB() failed\n"); + PFBCleanUp(); + return; + } + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, "PFB initialised.\n"); + g_iIsFirstRun = FALSE; + } + + process_seg(); + + /* Move the data in the buffer so we don't have to reread portions of the + * tape. Leave a 20% overlap. + */ + tapebuffer.erase(tapebuffer.begin(),tapebuffer.begin()+tapebuffer.size()*8/10); + +} + +/* function that allocates memory, reads filter coefficients, creates FFT plan, + etc. */ +int InitPFB() +{ + int iRet = EXIT_SUCCESS; + int iFileCoeff = 0; + int i = 0; + + g_iNTaps = splitter_settings.splitter_cfg->pfb_ntaps; + g_fWidthFactor = splitter_settings.splitter_cfg->pfb_width_factor; + + + /* allocate memory for the filter coefficients */ + g_pfPFBCoeff = (float *) malloc(g_iNTaps + * PFB_FFT_LEN + * sizeof(float)); + if (NULL == g_pfPFBCoeff) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + + gen_coeff(g_pfPFBCoeff, g_iNTaps * PFB_FFT_LEN); // generate the coefficients + + /* allocate memory for the PFB data arrays */ + g_astPFBData = (PFB_DATA *) malloc(g_iNTaps * sizeof(PFB_DATA)); + if (NULL == g_astPFBData) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + for (i = 0; i < g_iNTaps; ++i) + { + g_astPFBData[i].pcfData + = (complex*) fftwf_malloc(PFB_FFT_LEN * sizeof(complex)); + if (NULL == g_astPFBData[i].pcfData) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + /* pointer of type fftwf_complex */ + g_astPFBData[i].pfcData = (fftwf_complex*) g_astPFBData[i].pcfData; + } + + /* allocate memory for FFT input/output array */ + g_pfcFFTArray = (fftwf_complex *) fftwf_malloc(PFB_FFT_LEN + * sizeof(fftwf_complex)); + if (NULL == g_pfcFFTArray) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + + /* create FFT plan */ + g_stPlan = fftwf_plan_dft_1d(PFB_FFT_LEN, + g_pfcFFTArray, + g_pfcFFTArray, + FFTW_FORWARD, + FFTW_MEASURE); + + /* allocate memory to pack the output of g_iNTaps FFTs in the PFB + loop in the process_seg() function, so that the output data structure + remains same as before PFB implementation */ + g_pcfPackedDataOut = (complex *) fftwf_malloc(PFB_OUTPUT_STACK_SIZE + * PFB_FFT_LEN + * sizeof(complex)); + if (NULL == g_pcfPackedDataOut) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, "InitPFB(): Configured with NTaps %d WidthFactor %f\n", + g_iNTaps, g_fWidthFactor); + return EXIT_SUCCESS; +} + +/* function that performs the PFB */ +void DoPFB(int iPFBReadIdx) +{ + int i = 0; + int j = 0; + int k = 0; + int iCoeffStartIdx = 0; + + /* reset memory */ + (void) memset(g_pfcFFTArray, '\0', PFB_FFT_LEN * sizeof(fftw_complex)); + + /* perform polyphase filtering, starting from the read index */ + i = iPFBReadIdx; + for (j = 0; j < g_iNTaps; ++j) + { + iCoeffStartIdx = j * PFB_FFT_LEN; + for (k = 0; k < PFB_FFT_LEN; ++k) + { + /* real part */ + g_pfcFFTArray[k][0] += g_astPFBData[i].pfcData[k][0] + * g_pfPFBCoeff[iCoeffStartIdx+k]; + /* imaginary part */ + g_pfcFFTArray[k][1] += g_astPFBData[i].pfcData[k][1] + * g_pfPFBCoeff[iCoeffStartIdx+k]; + } + i = (i + 1) % g_iNTaps; + } + + return; +} + +/* function that frees resources */ +void PFBCleanUp() +{ + int i = 0; + + /* free resources */ + for (i = 0; i < g_iNTaps; ++i) + { + free(g_astPFBData[i].pcfData); + } + + fftwf_free(g_pfcFFTArray); + free(g_pfPFBCoeff); + + /* destroy plans */ + fftwf_destroy_plan(g_stPlan); + + fftwf_cleanup(); + + return; +} + +/* + * + * $Log: mb_dotransform.cpp,v $ + * Revision 1.1.2.3 2007/06/06 15:58:29 korpela + * *** empty log message *** + * + * Revision 1.1.2.2 2007/04/25 17:27:30 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:40 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:36 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:10 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2003/04/10 22:09:00 korpela + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.6 1999/02/22 19:02:50 korpela + * Revered input real & imaginary. + * + * Revision 2.5 1999/02/10 21:49:44 korpela + * Zeroed DC component of forward transform. + * + * Revision 2.4 1999/02/01 22:28:52 korpela + * FFTW version. + * + * Revision 2.3 1998/12/14 23:41:44 korpela + * *** empty log message *** + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:51:08 korpela + * Initial revision + * + * + */ + diff --git a/gbt_splitter/mb_dotransform.h b/gbt_splitter/mb_dotransform.h new file mode 100644 index 0000000..a531c89 --- /dev/null +++ b/gbt_splitter/mb_dotransform.h @@ -0,0 +1,73 @@ +/* + * + * dotransform.h + * + * Functions for division by frequency into work units. + * + * $Id: mb_dotransform.h,v 1.1.2.2 2007/04/25 17:20:28 korpela Exp $ + * + */ + + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) +#define TBUF_OFFSET(frame,byte) (tapebuffer+(frame)*TAPE_FRAME_SIZE+(byte)) + +#define FALSE 0 +#define TRUE 1 + +#define FILE_COEFF_PREFIX "coeff" +#define FILE_COEFF_DATATYPE "float" +#define FILE_COEFF_SUFFIX ".dat" + +#define PFB_OUTPUT_STACK_SIZE 8 // this has to be 8 for the benefit of output_samples() +#define PFB_FFT_LEN 256 + +//extern int obuf_pos; /* Tracks current postition in the output buffers */ + + +void output_samples(float *data, int i, int buf_pos); +void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) ; +void process_seg(void); +void do_transform(std::vector &tapebuffer) ; + +int InitPFB(void); +void DoPFB(int iReadIdx); +void PFBCleanUp(void); + +/* + * + * $Log: mb_dotransform.h,v $ + * Revision 1.1.2.2 2007/04/25 17:20:28 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:41 korpela + * *** empty log message *** + * + * Revision 1.1 2003/06/03 00:16:11 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1999/02/01 22:28:52 korpela + * FFTW version. + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:05:22 korpela + * Initial revision + * + * + */ + diff --git a/gbt_splitter/mb_message.cpp b/gbt_splitter/mb_message.cpp new file mode 100644 index 0000000..022fbf7 --- /dev/null +++ b/gbt_splitter/mb_message.cpp @@ -0,0 +1,73 @@ +/* + * Functions for sending messages to stderr and log files. + * + * $Id: mb_message.cpp,v 1.1.2.1 2006/12/14 22:24:42 korpela Exp $ + */ + +#include "sah_config.h" +#include +#include +#include +#include "setilib.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "xml_util.h" + + +#include "boinc_db.h" +#include "sched_config.h" +#include "sched_msgs.h" +#include "mb_splitter.h" + +void message(char *msg) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s %s",tapebuffer[0].header.name,msg); +} + + + +/* + * $Log: mb_message.cpp,v $ + * Revision 1.1.2.1 2006/12/14 22:24:42 korpela + * *** empty log message *** + * + * Revision 1.2.4.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:43 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:56:16 korpela + * Initial revision + * + */ diff --git a/gbt_splitter/mb_polyphase.cpp b/gbt_splitter/mb_polyphase.cpp new file mode 100644 index 0000000..6df3548 --- /dev/null +++ b/gbt_splitter/mb_polyphase.cpp @@ -0,0 +1,150 @@ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include +#include "setilib.h" + +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "mb_fftw.h" +#include "mb_wufiles.h" +#include "mb_polyphase.h" +#include "mb_dotransform.h" + +/* buffer for fft input/output */ +//float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) + +extern unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + +double *filter_r, *filter_i; +float *f_data; + +extern int obuf_pos; /* Tracks current postition in the output buffers */ + +void make_FIR (int n_points, int M, int window, double *output) { + /* Create Mth band lowpass FIR filter, n_points long. */ + + /* Modify this to give 8-bit quantized filter. */ + /* Also generate Hilbert transformed filter */ + + int n; + double q, p; + + for (n=0; n TAPE_DATA_SIZE) { + // End of frame crossed need to trasfer correctly + end_trans.frame++; + end_trans.byte-=TAPE_DATA_SIZE; + nsamp=(TAPE_DATA_SIZE-start_trans.byte)*(CHAR_BIT/2); + assert((nsamp+end_trans.byte*(CHAR_BIT/2)) == FFT_LEN); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf, nsamp); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(end_trans.frame,0),databuf+nsamp*2, + end_trans.byte*(CHAR_BIT/2)); + } else { + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf,FFT_LEN); + } + polyphase_seg(databuf); + // Go on to next transform + start_trans=end_trans; + } + // Check if we're at the end of the wu file. If so we print less bytes + if ((end_trans.frame>=end_of_wu->frame) && + (end_trans.byte>=end_of_wu->byte)) { + write_wufile_blocks(NBYTES % SAMPLES_PER_OBUF); + } else { + write_wufile_blocks(SAMPLES_PER_OBUF); + } + } while (!((end_trans.frame>=end_of_wu->frame) && (end_trans.byte>=end_of_wu->byte))); + + // Move the data in the buffer so we don't have to reread portions of the + // tape. + // + { + unsigned char *record_offset; + int copysize; + end_of_wu->frame-=WU_OVERLAP_FRAMES; + records_in_buffer=TAPE_RECORDS_IN_BUFFER- + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD); + record_offset=tapebuffer+ + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD)*TAPE_RECORD_SIZE; + copysize=records_in_buffer*TAPE_RECORD_SIZE; + bcopy(record_offset,tapebuffer,copysize); + } +} + + diff --git a/gbt_splitter/mb_splitter.cpp b/gbt_splitter/mb_splitter.cpp new file mode 100644 index 0000000..6479b5c --- /dev/null +++ b/gbt_splitter/mb_splitter.cpp @@ -0,0 +1,966 @@ +/* + * + * The splitter main program. + * + * $Id: mb_splitter.cpp,v 1.1.2.6 2007/08/16 23:03:19 jeffc Exp $ + * + */ + +#include "sah_config.h" +#undef USE_MYSQL +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "boinc_db.h" +#include "backend_lib.h" +#include "sched_config.h" +#include "setilib.h" +#include "str_util.h" +#include "str_replace.h" +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "mb_validrun.h" +#include "mb_wufiles.h" +#include "mb_dotransform.h" +#include "message.h" +#include "sqlrow.h" +#include "sqlapi.h" +#include "db/db_table.h" +#include "db/schema_master.h" +#include "db/app_config.h" + +extern "C" { + int sqldetach(); +} + +char trigger_file_path[1024]="/disks/setifiler1/wutape/tapedir/splitter_stop"; + +SCHED_CONFIG boinc_config; +DB_APP app; +R_RSA_PRIVATE_KEY key; + +// configuration tables +receiver_config rcvr; +settings splitter_settings; + +// TEMPLATE DEFS ------------------------------------------------------ +// IMPORTANT: a change to a template should *always* include a change +// to the template filename. Only the result template is used now. +const char *wu_template_filename_id = "wu_0.xml"; +const char *wu_template= + "\n" + " 0\n" + "\n" + "\n" + " \n" + " 0\n" + " work_unit.sah\n" + " \n" + "\n"; + +const char *result_template_filename_id = "result_0.xml"; +const char *result_template= + "\n" + " \n" + " \n" + " \n" + " 65536\n" + " http://setiboincdata.ssl.berkeley.edu/sah_cgi/file_upload_handler\n" + "\n" + "\n" + " \n" + " \n" + " result.sah\n" + " \n" + "\n"; +// END TEMPLATE DEFS -------------------------------------------------- + +std::vector tapebuffer; +std::map coord_history; +std::vector wuheaders; +char appname[256]; +int max_wus_ondisk=MAX_WUS_ONDISK; +int nodb; +int noencode; +int resumetape; +int norewind; +int startblock; +int dataclass; +int atnight; +int gregorian; +int output_xml; +int polyphase; +int iters=-1; +int beam; +int pol; +int alfa; +int useanalysiscfgid = 0; +int usereceivercfgid = 0; +int userecordercfgid = 0; +int usesplittercfgid = 0; +int filter_window = 0; +double start_time; +double stop_time; +unsigned long minvfsbuf=-1; +char wd[1024]; +//char * scidb = NULL; +char * projectdir = NULL; + +APP_CONFIG sah_config; + +//const char *result_template_filename="projectdir"/"SAH_APP_NAME"_result.tpl"; +char result_template_filename[1024]; +char result_template_filepath[1024]; +char wu_template_filename[1024]; + +int check_for_halt(); +int wait_until_night(); +int check_free_disk_space(); +int wait_for_db_wus_ondisk(); + +void cprint(char *p) { + printf("%s\n",p); +} + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ + +FILE *wulog,*errorlog; +buffer_pos_t start_of_wu,end_of_wu; /* position of start and end of wu in + tape buffer */ +int seqno; + +void cleanup(void) { + FILE *tmpfile; + if ((tmpfile=fopen("seqno.dat","w"))) { + fprintf(tmpfile,"%d\n",seqno); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Unable to open seqno.dat for write\n"); + } +} + + +int process_command_line(int argc, char *argv[],char **tape_device, + int *norewind, int *startblock, int *resumetape, + int *nodb, int *dataclass, int *atnight, + int *max_wus_ondisk, char **projectdir, + int *iters, int *beam, int *pol, int *alfa, + int *useanalysiscfgid, int *usereceivercfgid, + int *userecordercfgid, int *usesplittercfgid) { + int nargs=0,i; + char *ep; + strcpy(appname,SAH_APP_NAME); + for (i=1;i6)) || + ((*pol<0) || (*pol>1))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"ALFA receivers must be specified with beam (0-6) and polarization (0-1), i.e. -alfa=4,0\n"); + exit(EXIT_FAILURE); + } + + *alfa=1; + } else if (!strncmp(argv[i],"-iterations",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",iters); + } else if (!strncmp(argv[i],"-startblock",MAX(ep-argv[i],2))) { + if (*norewind || *resumetape) { + return(1); + } + sscanf(ep+1,"%d",startblock); + } else if (!strncmp(argv[i],"-max_wus_ondisk",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",max_wus_ondisk); + } else if (!strncmp(argv[i],"-dataclass",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",dataclass); + } else if (!strncmp(argv[i],"-projectdir",MAX(ep-argv[i],2))) { + *projectdir=(char *)calloc(strlen(ep+1)+5,1); + strlcpy(*projectdir,ep+1,strlen(ep+1)+5); + strlcat(*projectdir,"/",strlen(ep+1)+5); + } else if (!strncmp(argv[i],"-analysis_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",useanalysiscfgid); + } else if (!strncmp(argv[i],"-recorder_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",userecordercfgid); + } else if (!strncmp(argv[i],"-receiver_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",usereceivercfgid); + } else if (!strncmp(argv[i],"-splitter_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",usesplittercfgid); + } else { + return(1); + } + } else { + return(1); + } + } else { + *tape_device=argv[i]; + nargs++; + } + } + //return(nargs!=1); + + // check for required cmd line + //if (! *scidb) return (1); + if (! *projectdir) return (1); + if (! *tape_device) return (1); + + return 0; +} + +int main(int argc, char *argv[]) { + int tape_fd; + char *tape_device; + FILE *tmpfile; + int retval; + char keyfile[1024]; + char tmpstr[1024]; + char buf[1024]; + + + /* Process command line arguments */ + if (process_command_line(argc,argv,&tape_device,&norewind,&startblock,&resumetape, + &nodb,&dataclass,&atnight,&max_wus_ondisk,&projectdir,&iters, + &beam,&pol,&alfa,&useanalysiscfgid,&usereceivercfgid, + &userecordercfgid,&usesplittercfgid)) { + fprintf(stderr,"Usage: splitter tape_device -projectdir=s [-atnight] [-nodb]\n" + "[-xml] [-gregorian] [-resumetape | -norewind | -startblock=n] [-dataclass=n]\n" + "[-max_wus_on_disk=n] [-iterations=n] [-trigger_file_path=filename]\n" + "[-alfa=beam,pol] [-analysis_config=id] [-receiver_config=id]\n" + "[-recorder_config=id] [-splitter_config=id]\n"); + exit(EXIT_FAILURE); + } + + // MATTL + if (blanking_bit == SOFTWARE_BLANKING_BIT) log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"blanking bit: %d (SOFTWARE)\n",blanking_bit); + else log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"blanking bit: %d (HARDWARE)\n",blanking_bit); + + /* Open log files */ + log_messages.set_debug_level(3); + + retval = sah_config.parse_file(projectdir); + if (retval) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Can't parse config file\n"); + exit(EXIT_FAILURE); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using configuration:\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"scidb_name = %s\n", sah_config.scidb_name); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_wus_ondisk = %d\n", sah_config.max_wus_ondisk); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"min_quorum = %d\n", sah_config.min_quorum); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"target_nresults = %d\n", sah_config.target_nresults); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_error_results = %d\n", sah_config.max_error_results); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_success_results = %d\n", sah_config.max_success_results); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_total_results = %d\n", sah_config.max_total_results); + } + + // Will initially open + if (!db_change(sah_config.scidb_name)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Could not open science database %s\n", sah_config.scidb_name); + if (!nodb) exit(EXIT_FAILURE); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using science database %s\n", sah_config.scidb_name); + } + + + boinc_config.parse_file(projectdir); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using boinc config dir %s\n", projectdir); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using boinc database %s\n", boinc_config.db_name); + + // check / commit result template + strcpy(result_template_filename, "templates/"); + strcat(result_template_filename, appname); + strcat(result_template_filename, "_"); + strcat(result_template_filename, result_template_filename_id); + strcpy(result_template_filepath, projectdir); + strcat(result_template_filepath, result_template_filename); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%s %s\n", result_template_filename, result_template_filepath); + if (!(tmpfile=fopen(result_template_filepath,"r"))) { + if (!(tmpfile=fopen(result_template_filepath,"w"))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Cannot open result file template : %s\n", result_template_filepath); + exit(1); + } + fprintf(tmpfile,result_template); + } + fclose(tmpfile); + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"boinc_db.open\n"); + exit(1); + } + + char tmpquery[128]; + sprintf(tmpquery,"where name ='%s'",appname); + if (app.lookup(tmpquery)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Error looking up appname\n"); + boinc_db.print_error("boinc_app lookup"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"boinc_app lookup\n"); + exit(1); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Splitting for application %s (ID = %d)\n", appname, app.id); + } + + boinc_db.close(); + + telescope_id tel= + channel_to_receiverid[beam_pol_to_channel[bmpol_t(beam,pol)]]; + + sprintf(buf,"where active=%d and receiver_cfg=(select id from receiver_config where s4_id=%d)",app.id,AO_ALFA_0_0); + if (usereceivercfgid > 0) { + sprintf(buf,"where active=%d and receiver_cfg=%d",app.id,usereceivercfgid); + } + if (!splitter_settings.fetch(std::string(buf))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to find active settings for app.id=%d\n",app.id); + exit(1); + } + + sprintf(buf,"where s4_id=%d and id>=%d",tel,splitter_settings.receiver_cfg.id); + if (usereceivercfgid > 0) { sprintf(buf,"where id=%d",usereceivercfgid); } + rcvr.fetch(buf); + if (usereceivercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using receiver cfg id: %d (set by user)\n",usereceivercfgid); + splitter_settings.receiver_cfg = usereceivercfgid; + splitter_settings.receiver_cfg->fetch(); + } else { + splitter_settings.receiver_cfg->fetch(buf); + } + if (userecordercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using recorder cfg id: %d (set by user)\n",userecordercfgid); + splitter_settings.recorder_cfg = userecordercfgid; + } + splitter_settings.recorder_cfg->fetch(); + if (usesplittercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using splitter cfg id: %d (set by user)\n",usesplittercfgid); + splitter_settings.splitter_cfg = usesplittercfgid; + } + splitter_settings.splitter_cfg->fetch(); + if (useanalysiscfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using analysis cfg id: %d (set by user)\n",useanalysiscfgid); + splitter_settings.analysis_cfg = useanalysiscfgid; + } + splitter_settings.analysis_cfg->fetch(); + + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, "settings: \n\n%s\n", splitter_settings.print_xml(1,1,0).c_str()); + + strcpy(keyfile, projectdir); + strcat(keyfile, "/keys/upload_private"); + if (read_key_file(keyfile,key)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Error reading keyfile.\n"); + exit(1); + } + + check_for_halt(); + + if ((tape_fd=open(tape_device,O_RDONLY|0x2000, 0777))<0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to open tape device\n"); + exit(EXIT_FAILURE); + } + + // In early tapes there was a bug where the first N blocks would be duplicates + // of data from previous files. So we need to fast forward until we see a + // frame sequence number of 1. + int i,readbytes=HeaderSize; + dataheader_t header; + header.frameseq=100000; + + while ((readbytes==HeaderSize) && (header.frameseq>10)) { + char buffer[HeaderSize]; + int nread; + readbytes=0; + while ((readbytes!=HeaderSize) && (nread = read(tape_fd,buffer,HeaderSize-readbytes))) { + readbytes+=nread; + } + if (nread < 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"File error %d.\n", errno); + exit(1); + } + if (readbytes == HeaderSize) { + header.populate_from_data(buffer); + if (header.frameseq>10) { + lseek64(tape_fd,DataSize,SEEK_CUR); + } else { + lseek64(tape_fd,-1*(off64_t)HeaderSize,SEEK_CUR); + } + } + } + + if (readbytes != HeaderSize) { + // we fast forwarded through the entire tape without finding the first frame + // maybe this is one of the really early tapes that was split into chunks. + lseek64(tape_fd,0,SEEK_SET); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Warning: First block not found\n"); + } + + if (resumetape) { + tape thistape; + thistape.id=0; + readbytes=HeaderSize; + sprintf(buf,"%d",rcvr.s4_id-AO_ALFA_0_0); + if (thistape.fetch(std::string("where name=\'")+header.name+"\' and beam="+buf)) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Resuming tape %s beam %d pol %d\n",thistape.name,beam,pol ); + while ((readbytes==HeaderSize) && (header.dataseq!=thistape.last_block_done)) { + int nread=0; + char buffer[HeaderSize]; + readbytes=0; + while ((readbytes!=HeaderSize) && + ((nread = read(tape_fd,buffer,HeaderSize-readbytes)) > 0 )) { + readbytes+=nread; + } + if (readbytes == HeaderSize) { + header.populate_from_data(buffer); + if (header.dataseq!=thistape.last_block_done) { + lseek64(tape_fd,(off64_t)(DataSize+HeaderSize)*(thistape.last_block_done-header.dataseq)-HeaderSize,SEEK_CUR); + } else { + lseek64(tape_fd,-1*(off_t)HeaderSize,SEEK_CUR); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Found starting point"); + } + } + if (nread == 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"End of file.\n"); + exit(0); + } + if (nread < 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"File error %d.\n",errno); + exit(1); + } + } + } + } + + /* Start of main loop */ + + + atexit(cleanup); + + getcwd(wd,1024); + + if (polyphase) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Polyphase not implemented\n" ); + exit(1); +#if 0 + int filter_len; + + filter_len = P_FFT_LEN*N_WINDOWS; + + filter_r = (double *)malloc(sizeof(double)*filter_len); + filter_i = (double *)malloc(sizeof(double)*filter_len); + + f_data = (float *)malloc(sizeof(float)*P_FFT_LEN*2); + + make_FIR(filter_len, N_WINDOWS, filter_window, filter_r); + make_FIR(filter_len, N_WINDOWS, filter_window, filter_i); + + /* + int i; + float *data; + data = (float*)malloc(sizeof(float)*2*2048); + for (double n=-20;n<20;n+=.05) { + for (i=0;i<2*2048;i+=2) { + data[i] = cos(2*(24+n)*3.1415926535*i/(2*2048)); + data[i+1] = sin(2*(24+n)*3.1415926535*i/(2*2048)); + } + polyphase_seg(data); + //fprintf( stderr, "%f\n", 3+n/8); + } + exit(0); + for(i=0;i > blanker_filter; + if (strcmp(splitter_settings.splitter_cfg->blanker_filter, "randomize") == 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Setting blanker filter to randomize\n" ); + blanker_filter = randomize; + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Setting blanker filter to null\n" ); + blanker_filter = NULLC; // no blanking + } + while (iters-- && + ((512-tapebuffer.size())==seti_StructureDr2Data(tape_fd, beam, pol, + 512-tapebuffer.size(), tapebuffer, blanker_filter))) { + /* check if we should be running now */ + fflush(stderr); + if (atnight) wait_until_night(); + + sprintf(buf,"where active=%d and receiver_cfg=(select id from receiver_config where s4_id=%d)",app.id,AO_ALFA_0_0); + if (usereceivercfgid > 0) { + sprintf(buf,"where active=%d and receiver_cfg=%d",app.id,usereceivercfgid); + } + if (!splitter_settings.fetch(std::string(buf))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to find active settings for app.id=%d\n",app.id); + exit(1); + } + + sprintf(buf,"where s4_id=%d and id>=%d",tel,splitter_settings.receiver_cfg.id); + if (usereceivercfgid > 0) { sprintf(buf,"where id=%d",usereceivercfgid); } + rcvr.fetch(buf); + if (usereceivercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using receiver cfg id: %d (set by user)\n",usereceivercfgid); + splitter_settings.receiver_cfg = usereceivercfgid; + splitter_settings.receiver_cfg->fetch(); + } else { + splitter_settings.receiver_cfg->fetch(buf); + } + if (userecordercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using recorder cfg id: %d (set by user)\n",userecordercfgid); + splitter_settings.recorder_cfg = userecordercfgid; + } + splitter_settings.recorder_cfg->fetch(); + if (usesplittercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using splitter cfg id: %d (set by user)\n",usesplittercfgid); + splitter_settings.splitter_cfg = usesplittercfgid; + } + splitter_settings.splitter_cfg->fetch(); + if (useanalysiscfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using analysis cfg id: %d (set by user)\n",useanalysiscfgid); + splitter_settings.analysis_cfg = useanalysiscfgid; + } + splitter_settings.analysis_cfg->fetch(); + + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, "settings: \n\n%s\n", splitter_settings.print_xml(1,1,0).c_str()); + + check_for_halt(); + + // Make sure we have enough free disk space + check_free_disk_space(); + + // Wait for ondisk wus in the database to drop below the threshold + if (!nodb) wait_for_db_wus_ondisk(); + //fprintf( stderr, "Read data\n" ); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"less than max wus on disk, continuing\n" ); + fflush(stderr); + + //printf( "Read tape data, analyzing\n" ); + check_for_halt(); + + //check for an uninterrupted run + if (valid_run(tapebuffer,splitter_settings.receiver_cfg->min_vgc)) { + std::vector::iterator i=tapebuffer.begin(); + // insert telescope coordinates into the coordinate history. + // this should be converted to a more accurate routine. + for (;i!=tapebuffer.end();i++) { + coord_history[i->header.coord_time].ra = i->header.ra; + coord_history[i->header.coord_time].dec = i->header.dec; + coord_history[i->header.coord_time].time = i->header.coord_time.jd().uval(); + } + if (make_wu_headers(tapebuffer,tel,wuheaders)) { + int child_pid=-1; + switch (polyphase) { + case 1: + #if 0 + do_polyphase(&start_of_wu,&end_of_wu); + #endif + break; + default: + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"doing transform..." ); + do_transform(tapebuffer); + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG," done\n" ); + } + wait(0); + if (!nodb) sql_finish(); + + do { + sleep(1); + child_pid=fork(); + if (child_pid<0) log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"splitter cannot fork"); + //fprintf( stderr, "child pid: %d\n", child_pid); + } while (child_pid<0); + + if (!child_pid) { + if (!nodb) { + sqldetach(); + while (!sql_database(sah_config.scidb_name)) { + //fprintf(stderr,"child sleeping\n"); + sleep(10); + } + } + rename_wu_files(); + if (!nodb) sql_finish(); + _exit(0); + } + + if (!nodb) { + while (!sql_database(sah_config.scidb_name)) { + //fprintf(stderr,"parent sleeping\n"); + sleep(10); + } + } + } + } + } + + // iters is initalized to -1. If the -iters flag is specified on the command + // line, iters is re-initialized to the user desired number of interations. + // Each time a WUG is proccessed iters is decremineted. If the user specifies + // iters and we do that number of iterations without reaching EOF then iters + // here will be zero. !Zero means we have reached EOF prior to performing the user + // desired number of iterations. + // + // On the other hand, if iters is not specified by the user, iters is decrmented + // downward from -1. It will never be zero in this case. But since we are not + // limiting the number of iterations, the only way will get here is if we reach EOF. + // + // Thus in both cases, a non-zero iters means we have reached EOF. + if (iters != 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"End of file.\n"); + // clean stop at EOF + return (EXIT_NORMAL_EOF); + } else { + // clean stop, but not EOF (iters satisfied or triggered stop) + // (A return of 1 is an error exit somewhere else in the code.) + return(EXIT_NORMAL_NOT_EOF); + } +} + +int check_for_halt() { + FILE *tf; + + tf = fopen(trigger_file_path, "r"); + // tf=0; + if (tf != NULL) { // Stop program + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Found splitter_stop, exiting.\n" ); + exit(EXIT_NORMAL_NOT_EOF); + } + return(0); // Keep going +} + +int wait_until_night() { + time_t t; + struct tm *lt; + do { + t=time(0); + lt=localtime(&t); + // Don't run M-F 8AM-6PM + if ((lt->tm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)) { + sleep(100); + } + } while ((lt->tm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)); + return 0; +} + +int check_free_disk_space() { + struct statvfs vfsbuf; + + /* check disk free space in working directory */ + statvfs("wu_inbox/.",&vfsbuf); + if (vfsbuf.f_frsize==0) vfsbuf.f_frsize=512; + if (vfsbuf.f_bavail < (100000*1024/vfsbuf.f_frsize)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Not enough free disk space in working directory to continue\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Not enough free disk space in working directory to continue\n"); + exit(EXIT_FAILURE); + } + + /* check free disk space in download directory tree */ + std::string download_dir(boinc_config.download_dir); + int waited=0; + download_dir+="/."; + /* wait here if the disk is more than N% full */ + statvfs(download_dir.c_str(),&vfsbuf); + if (vfsbuf.f_blocks > vfsbuf.f_bfree*100/sah_config.min_disk_free_pct) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Waiting for free space in download directory\n"); + while (vfsbuf.f_blocks > vfsbuf.f_bfree*100/sah_config.min_disk_free_pct) { + waited+=10; + sleep(10); + statvfs(download_dir.c_str(),&vfsbuf); + } + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Waited %d seconds\n", waited); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Continuing...\n"); + } + return 0; +} + +int wait_for_db_wus_ondisk() { + //int wus_ondisk,rv; + DB_STATE_COUNTS state_counts; + int retval; + + // No need to check the DB for every single WUG iteration. + static int check_count = 100; + if (check_count < 100) { + check_count++; + return 0; + } else { + check_count = 0; + } + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"boinc_db.open\n"); + exit(1); + } +#if 0 + retval = boinc_db.set_isolation_level(READ_UNCOMMITTED); + if (retval) { + log_messages.printf(MSG_CRITICAL, "boinc_db.set_isolation_level: %d; %s\n", rv, boinc_db.error_string()); + exit(EXIT_FAILURE); + } + else { + log_messages.printf(MSG_NORMAL, "setting read uncommitted isolation level\n"); + } +#endif + do { + char query[1024]; + sprintf(query,"where appid=%d",app.id); + retval=state_counts.lookup(query); + if (retval) { + boinc_db.print_error("state_counts.lookup"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"DB Error, unable to count workunits on disk\n"); + exit(EXIT_FAILURE); + } + check_for_halt(); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%d WUs ondisk which is greater than the max of %d\n", + state_counts.result_server_state_2, sah_config.max_wus_ondisk); + if (state_counts.result_server_state_2>sah_config.max_wus_ondisk) sleep(600); + +#if 0 + sprintf(query,"where appid=%d and server_state=2",app.id); + rv=boinc_result.count(wus_ondisk,query); + if (rv) { + boinc_db.print_error("boinc_result.count"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"DB Error, unable to count workunits on disk\n"); + exit(EXIT_FAILURE); + } + check_for_halt(); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%d WUs ondisk\n", wus_ondisk); + if (wus_ondisk>sah_config.max_wus_ondisk) sleep(600); + } while (wus_ondisk>sah_config.max_wus_ondisk); +#endif + + } while (state_counts.result_server_state_2>sah_config.max_wus_ondisk); + + boinc_db.close(); + return 0; +} + +/* + * $Log: mb_splitter.cpp,v $ + * Revision 1.1.2.6 2007/08/16 23:03:19 jeffc + * *** empty log message *** + * + * Revision 1.1.2.5 2007/08/10 19:29:40 jeffc + * *** empty log message *** + * + * Revision 1.1.2.4 2007/06/07 20:01:52 mattl + * *** empty log message *** + * + * Revision 1.1.2.3 2007/06/06 15:58:29 korpela + * *** empty log message *** + * + * Revision 1.1.2.2 2007/04/25 17:27:30 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:43 korpela + * *** empty log message *** + * + * Revision 1.22.2.4 2006/11/08 20:16:26 vonkorff + * Fixes an error message. + * + * Revision 1.22.2.3 2006/11/07 19:26:37 vonkorff + * Fixed lcgf + * + * Revision 1.22.2.2 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.22.2.1 2005/08/01 21:16:25 jeffc + * *** empty log message *** + * + * Revision 1.22 2005/01/27 23:03:27 mattl + * + * commented out tf=0 in check_for_halt + * + * Revision 1.21 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.19 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/27 21:07:04 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/20 18:56:48 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.14 2004/04/08 22:25:47 jeffc + * *** empty log message *** + * + * Revision 1.13 2004/01/22 00:57:53 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.10 2003/11/25 21:59:52 korpela + * *** empty log message *** + * + * Revision 1.9 2003/11/01 20:54:02 korpela + * *** empty log message *** + * + * Revision 1.8 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.7 2003/09/26 20:48:51 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.5.2.2 2003/09/23 00:49:12 korpela + * *** empty log message *** + * + * Revision 1.5.2.1 2003/09/22 17:39:34 korpela + * *** empty log message *** + * + * Revision 1.6 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/13 20:48:38 korpela + * directory reorg. Moved client files to ./client + * + * Revision 1.4 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/08/13 23:18:47 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:50 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.6 2003/05/21 00:41:42 korpela + * *** empty log message *** + * + * Revision 3.5 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.4 2003/04/09 17:46:54 korpela + * *** empty log message *** + * + * Revision 3.3 2002/06/20 22:09:17 eheien + * *** empty log message *** + * + * Revision 3.2 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.6 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added dataclass paramter. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added some db access functions. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:58:16 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/mb_splitter.h b/gbt_splitter/mb_splitter.h new file mode 100644 index 0000000..6b52bc3 --- /dev/null +++ b/gbt_splitter/mb_splitter.h @@ -0,0 +1,145 @@ +/* + * splitter.h + * + * Global definitions from the splitter main program. + * + * $Id: mb_splitter.h,v 1.1.2.2 2007/04/25 17:20:28 korpela Exp $ + * + */ + +#ifndef SPLITTER_H +#define SPLITTER_H + +#include "splitparms.h" +#include "splittypes.h" + +#define MAX(x,y) ( ((x)<(y)) ? (y) : (x) ) +#define MIN(x,y) ( ((y)<(x)) ? (y) : (x) ) + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ +#include "boinc_db.h" +#include "crypt.h" +#include "backend_lib.h" +#include "sched_config.h" + +extern SCHED_CONFIG boinc_config; +extern DB_APP app; +extern R_RSA_PRIVATE_KEY key; +extern FILE *wulog,*errorlog; +extern std::vector wuheaders; +extern int noencode; +extern int dataclass; +extern char appname[256]; +extern int nodb; +extern int resumetape; +extern int startblock; +extern int norewind; +extern int output_xml; +extern int polyphase; +extern std::vector wu_database_id; +extern int gregorian; +extern char * projectdir; +extern char trigger_file_name[1024]; +extern receiver_config rcvr; +extern settings splitter_settings; + + +/* Buffer that holds tape data */ +extern std::vector tapebuffer; +extern std::map coord_history; + +/* Number of records remaining in the buffer after WU creations is complete */ +extern int records_in_buffer; + +extern const char *wu_template; +extern const char *result_template; +// jeffc +//extern const char *result_template_filename; +extern char result_template_filename[]; +extern char result_template_filepath[]; +extern char wu_template_filename[]; + +// exit values not defined elsewhere +const int EXIT_NORMAL_EOF = 0; +const int EXIT_NORMAL_NOT_EOF = 2; + +/* Persistant sequence number of wu file */ +extern int seqno; + +#endif + +/* + * $Log: mb_splitter.h,v $ + * Revision 1.1.2.2 2007/04/25 17:20:28 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:43 korpela + * *** empty log message *** + * + * Revision 1.6.2.1 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.6 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.5 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.4 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.2.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/10/20 19:20:26 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * Added nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:10:32 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/mb_splittypes.h b/gbt_splitter/mb_splittypes.h new file mode 100644 index 0000000..540fd74 --- /dev/null +++ b/gbt_splitter/mb_splittypes.h @@ -0,0 +1,114 @@ +/* splittypes.h + * + * Type definitions specific to the splitter. + * + * + * $Id: mb_splittypes.h,v 1.1.2.1 2006/12/14 22:24:44 korpela Exp $ + * + */ +#ifndef SPLITTYPES_H +#define SPLITTYPES_H + +#include + +#include "splitparms.h" +#include "s_util.h" +#include "seti_header.h" + +//typedef struct wuheader { + //WU_INFO wuhead; + //SETI_WU_INFO wuinfo; +//} wuheader_t; + +typedef struct tapeheader { + char name[36]; + int rcdtype; + int numringbufs; + int numdiskbufs; + unsigned long frameseq; + unsigned long dataseq; + int missed; + TIME st; + SCOPE_STRING telstr; + int source; + double centerfreq,samplerate; + char version[16]; +} tapeheader_t; + +typedef struct buffer_pos { + int frame; + long offset; +} buffer_pos_t; + +#endif +/* + * $Log: mb_splittypes.h,v $ + * Revision 1.1.2.1 2006/12/14 22:24:44 korpela + * *** empty log message *** + * + * Revision 1.4 2003/08/05 17:23:43 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.3 2003/07/29 20:35:51 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:41 korpela + * + * Again + * + * Revision 3.1 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.4 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.3 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * Moved tape_version and encoding_type into SETI_WU_INFO. + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.7 1998/10/30 21:01:13 davea + * *** empty log message *** + * + * Revision 1.6 1998/10/27 01:10:58 korpela + * Modified tapeheader_t to match new tape header fields. + * + * Revision 1.5 1998/10/19 23:04:32 korpela + * Moved times in telstr_t into an st_t. + * Changed name of ast_t to st_t. + * Added time zone (tz) field to ast_t. + * + * Revision 1.4 1998/10/15 19:13:30 korpela + * Renamed "unix" fields to "unix_time" because of GCC #define. + * Added position_history field to wuheader_t. + * + * Revision 1.3 1998/10/15 18:58:50 korpela + * Added time_t unix to ast_t and telstr_t types. + * Changed times in wuheader_t to time_t types. + * + * Revision 1.2 1998/10/15 18:01:19 korpela + * Removed month field from ast_t and telstr_t. + * + * Revision 1.1 1998/10/15 16:20:24 korpela + * Initial revision + * + */ diff --git a/gbt_splitter/mb_validrun.cpp b/gbt_splitter/mb_validrun.cpp new file mode 100644 index 0000000..9bf7230 --- /dev/null +++ b/gbt_splitter/mb_validrun.cpp @@ -0,0 +1,147 @@ +/* + * validrun.c + * + * Functions for determining if a section of the tape buffer can be + * turned into a valid work unit + * + * $Id: mb_validrun.cpp,v 1.1.2.1 2006/12/14 22:24:45 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include "setilib.h" +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "message.h" + + +bool valid_run(std::vector &tapebuffer, int min_vgc) { + unsigned long start_dataseq=tapebuffer[0].header.dataseq; + unsigned long end_dataseq=tapebuffer[tapebuffer.size()-1].header.dataseq; + bool valid=true; + int i; + + // check for missing frames + if(!(end_dataseq-start_dataseq)==(tapebuffer.size()-1)) { + valid = false; + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Missing frames between %lu and %lu\n", + tapebuffer[0].header.dataseq,tapebuffer[tapebuffer.size()-1].header.dataseq); + for (i=tapebuffer.size()-1;i>0;i--) { // find the last "in sequence" frame + if (tapebuffer[i-1].header.dataseq != (tapebuffer[i].header.dataseq-1)) { + tapebuffer.erase(tapebuffer.begin(),tapebuffer.begin()+i); // delete all frames prior to the miss + } + } + } + + // if still valid, check for failed blanking signal acquisition + if (valid) { + for (i=0;valid && (i 0) { + for (i=0;valid && (i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_ERRNO_H +#include +#endif + +#include "boinc_db.h" +#include "sched_util.h" +#include "setilib.h" +#include "splitparms.h" +#include "splittypes.h" +#include "s_util.h" +#include "util.h" +#include "str_util.h" +#include "str_replace.h" +#include "mb_splitter.h" +#include "message.h" +#include "mb_angdist.h" +#include "cmap_interp.h" +#include "lcgamm.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "xml_util.h" +#include "db/app_config.h" +#include "str_util.h" + +std::vector wu_database_id; +std::vector > bin_data; + +extern APP_CONFIG sah_config; + +int make_wu_headers(std::vector &tapebuffer, telescope_id +tel, std::vector &wuheader) { + int procid=getpid(); + double receiver_freq; + int bandno; + FILE *tmpfile; + char tmpstr[256]; + char buf[64]; + static const receiver_config &r(rcvr); + static const settings &s(splitter_settings); + bool group_is_vlar; + + if (!strncmp(s.splitter_cfg->data_type,"encoded", + std::min(static_cast(7),sizeof(s.splitter_cfg->data_type)))) { + noencode=0; + } else { + noencode=1; + } + + tapebuffer[0].header.samplerate*=1e+6; + seconds sample_time(1.0/tapebuffer[0].header.samplerate); + seti_time start_time(tapebuffer[0].header.data_time + -tapebuffer[0].data.size()*0.5*sample_time); + seti_time end_time(tapebuffer[tapebuffer.size()-1].header.data_time); + + + workunit_grp wugrp; + sprintf(wugrp.name,"%s.%ld.%d.%d.%d", + tapebuffer[0].header.name, + procid, + tapebuffer[0].header.dataseq, + tel-AO_430, + s.id); + wugrp.receiver_cfg=r; + wugrp.recorder_cfg=s.recorder_cfg; + wugrp.splitter_cfg=s.splitter_cfg; + wugrp.analysis_cfg=s.analysis_cfg; + + wugrp.data_desc.nsamples=NSAMPLES; + wugrp.data_desc.true_angle_range=0; + coordinate_t start_coord(cmap_interp(coord_history,start_time)); + coordinate_t end_coord(cmap_interp(coord_history,end_time)); + wugrp.data_desc.start_ra=start_coord.ra; + wugrp.data_desc.end_ra=end_coord.ra; + wugrp.data_desc.start_dec=start_coord.dec; + wugrp.data_desc.end_dec=end_coord.dec; + coordinate_t last_coord=start_coord; + double sample_rate=tapebuffer[0].header.samplerate/NSTRIPS; + + // find the bracketing entries in the coordinate history + std::map::iterator above(coord_history.upper_bound(end_time)); + std::map::iterator below(coord_history.lower_bound(start_time)); + std::map::iterator p; + if (above==coord_history.begin()) { + above++; + } + if (below==coord_history.end()) { + below=above; + below--; + } + if (above==below) { + below--; + } + // Calculate the angular distance the beam has traveled + for (p=below;p!=above;p++) + { + wugrp.data_desc.true_angle_range+=angdist(last_coord,p->second); + last_coord=p->second; + } + wugrp.data_desc.true_angle_range+=angdist(last_coord,end_coord); + if (wugrp.data_desc.true_angle_range==0) wugrp.data_desc.true_angle_range=1e-10; + // Calculate the number of unique signals that could be found in a workunit. + // We will use these numbers to calculate thresholds. + double numgauss=2.36368e+08/std::min(wugrp.data_desc.true_angle_range,10.0); + double numpulse=std::min(4.52067e+10/std::min(wugrp.data_desc.true_angle_range,10.0),2.00382e+11); + double numtrip=std::min(3.25215e+12/std::min(wugrp.data_desc.true_angle_range,10.0),1.44774e+13); + + // check for VLAR workunits + if (wugrp.data_desc.true_angle_range < 0.12) { + group_is_vlar=true; + } else { + group_is_vlar=false; + } + + + // if (useanalysiscfgid > 0) { + // log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Re-reading analysis cfg id: %d (set by user):\n",useanalysiscfgid); + // s.analysis_cfg = useanalysiscfgid; + // } + + // Calculate a unique key to describe this analysis config. + long keyuniq=floor(std::min(wugrp.data_desc.true_angle_range*100,1000.0)+0.5)+ + s.analysis_cfg.id*1024; + if ((keyuniq>((s.analysis_cfg.id+1)*1024)) ||(keyuniq<(s.analysis_cfg.id)*1024)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Invalid keyuniq value!\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%d %d %f\n",keyuniq,s.analysis_cfg.id,wugrp.data_desc.true_angle_range); + exit(1); + } + + keyuniq*=-1; + long save_keyuniq=keyuniq; + splitter_settings.analysis_cfg=wugrp.analysis_cfg; + sprintf(tmpstr,"where keyuniq=%d",keyuniq); + // Check if we've already done this analysis_config... + // Fetch through splitter_settings, since it's alias (s) is const. + splitter_settings.analysis_cfg.id=0; + splitter_settings.analysis_cfg->fetch(tmpstr); + + if (s.analysis_cfg->id==0) { + if (keyuniq != save_keyuniq) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"keyuniq value changed!\n"); + exit(1); + } + + // If not calculate the thresholds based upon the input analysis_config + // Triplets are distributed exponentially... + wugrp.analysis_cfg->triplet_thresh+=(log(numtrip)-29.0652); + + // Gaussians are based upon chisqr... + double p_gauss=lcgf(32.0,wugrp.analysis_cfg->gauss_null_chi_sq_thresh*32.0); + p_gauss-=(log(numgauss)-19.5358); + wugrp.analysis_cfg->gauss_null_chi_sq_thresh=invert_lcgf(p_gauss,32,1e-4)*0.03125; + + // Pulses thresholds are log of the probability + wugrp.analysis_cfg->pulse_thresh+=(log(numpulse)-24.7894); + + wugrp.analysis_cfg->keyuniq=keyuniq; + wugrp.analysis_cfg->insert(); + } else { + wugrp.analysis_cfg=s.analysis_cfg; + } + + strlcpy(wugrp.data_desc.time_recorded, + short_jd_string(start_time.jd().uval()), + sizeof(wugrp.data_desc.time_recorded)); + wugrp.data_desc.time_recorded_jd=start_time.jd().uval(); + wugrp.data_desc.coords.clear(); + + wugrp.data_desc.coords.push_back(start_coord); + for (p=below;p!=above;p++) + { + wugrp.data_desc.coords.push_back(p->second); + } + wugrp.data_desc.coords.push_back(end_coord); + + // indicate the state of the alfa filter bank + wugrp.alfa_filter_bank = tapebuffer[0].header.scram_if1.alfaFb ? 1 : 0; + + wugrp.tape_info->id=0; + sprintf(buf,"%d",tel-AO_ALFA_0_0); + wugrp.tape_info->fetch(std::string("where name=\'")+tapebuffer[0].header.name+"\' and beam="+buf); + wugrp.tape_info->start_time=tapebuffer[0].header.data_time.jd().uval(); + wugrp.tape_info->last_block_time=wugrp.tape_info->start_time; + wugrp.tape_info->last_block_done=tapebuffer[0].header.dataseq; + wugrp.tape_info->beam=tel-AO_ALFA_0_0; + + if (!nodb) { + if (wugrp.tape_info.id) { + if (!(wugrp.tape_info->update())) { + char buf[1024]; + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s",sql_error_message()); + exit(1); + } + } else { + strlcpy(wugrp.tape_info->name,tapebuffer[0].header.name,sizeof(wugrp.tape_info->name)); + wugrp.tape_info->insert(); + } + } + + if (!nodb) { + sqlint8_t wgid; + if ((wgid=wugrp.insert())<=0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Workunit_grp insert failed\nwgid=%d\nSQLCODE=%d\nLAST_NON_ZERO_SQLCODE=%d\n",wgid,sql_error_code(),sql_last_error_code()); + exit( 1 ); + } + wugrp.id=wgid; + } + int i; + wu_database_id.resize(NSTRIPS); + bin_data.resize(NSTRIPS); + wuheader.resize(NSTRIPS); + for (i=0;i\n"); + fprintf(tmpfile,wuheader[i].print_xml().c_str()); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to open file ./wu_inbox/%s, errno=%d\n",wuheader[i].name,errno); + exit(1); + } + bin_data[i].reserve(wuheaders[i].group_info->recorder_cfg->bits_per_sample* + wuheaders[i].group_info->data_desc.nsamples/8); + } + return(1); +} + + +void write_wufile_blocks(int nbytes) { + // doesn't do anything anymore. What was done here is done in output_samples. +} + +int filecopy(char *oldname,char *newname) { + FILE *oldfile,*newfile; + char buffer[16384]; + int nread; + if ((oldfile=fopen(oldname,"rb")) && (newfile=fopen(newname,"wb"))) { + do { + nread=fread(buffer,1,16384,oldfile); + fwrite(buffer,1,nread,newfile); + } while (nread>0); + fclose(oldfile); + fclose(newfile); + return 0; + } else { + return 1; + } +} + + + +void rename_wu_files() { + int i, retval; + char oldname[256],newname[1024]; + unsigned long sz; + DB_WORKUNIT db_wu; + const char *name[1]; + char *wudir="./wu_inbox"; + xml_encoding encoding=(noencode?_binary:_x_setiathome); + FILE *tmpfile; + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Fatal error in boinc_db.open\n"); + exit(1); + } + + for (i=0;i",tmpstr.size(), + xml_encoding_names[encoding]); + fwrite(tmpstr.c_str(),tmpstr.size(),1,tmpfile); + fprintf(tmpfile,"
\n"); + fprintf(tmpfile,"
\n"); + sz=bin_data[i].size(); + + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Header file no longer exists! splitter start script may be failing\n "); + exit(1); + } + if (!nodb) { + if (!filecopy(oldname,newname)) { + db_wu.clear(); + db_wu.opaque=wuheaders[i].id; + strncpy(db_wu.name,name[0],sizeof(db_wu.name)-2); + db_wu.appid=app.id; + //db_wu.rsc_fpops_est=2.79248e+13*6; + //db_wu.rsc_fpops_bound=4.46797e+14*6; + double beam=wuheaders[i].group_info->receiver_cfg->beam_width; + double ar=wuheaders[i].group_info->data_desc.true_angle_range; + double dur=(double)(wuheaders[i].group_info->data_desc.nsamples)/wuheaders[i].subband_desc.sample_rate; + double min_slew=wuheaders[i].group_info->analysis_cfg->pot_min_slew; + double max_slew=wuheaders[i].group_info->analysis_cfg->pot_max_slew; + double autocorr_len=wuheaders[i].group_info->analysis_cfg->autocorr_fftlen; + double autocorr_flops=0; + if (autocorr_len) autocorr_flops=7.5e+06*autocorr_len*log(autocorr_len); + if ( ar <= beam ) { + db_wu.rsc_fpops_est=8.036e+13+autocorr_flops; + } else if ( ar <= ( dur*min_slew ) ) { + db_wu.rsc_fpops_est=4.805e+13+autocorr_flops+2.296e+12/ar; + } else if ( ar <= ( dur*max_slew ) ) { + db_wu.rsc_fpops_est=4.592e+13+autocorr_flops+1.476e+13/ar; + } else { + db_wu.rsc_fpops_est=2.378e+13+autocorr_flops; + } + db_wu.rsc_fpops_est*=(0.333/wuheaders[i].group_info->analysis_cfg->chirp_resolution); + db_wu.rsc_fpops_bound=db_wu.rsc_fpops_est*20; + db_wu.rsc_memory_bound=33554432; + db_wu.rsc_disk_bound=33554432; + // Our minimum is a 40 MFLOP machine + db_wu.delay_bound=std::max(86400.0*7,db_wu.rsc_fpops_est/4e+7); + db_wu.min_quorum=sah_config.min_quorum; + db_wu.target_nresults=sah_config.target_nresults; + db_wu.max_error_results=sah_config.max_error_results; + db_wu.max_total_results=sah_config.max_total_results; + db_wu.max_success_results=sah_config.max_success_results; + strncpy(db_wu.app_name,appname,sizeof(db_wu.app_name)-2); + if (create_work(db_wu, + wu_template, + result_template_filename, + result_template_filepath, + name, + 1, + boinc_config, + NULL + ) + ) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"create work failed\n"); + exit(1); + } + //unlink(oldname); // we now *always* unlink + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"file copy failed\n"); + exit(1); + } + unlink(oldname); + } + } + boinc_db.close(); +} + +/* + * $Log: mb_wufiles.cpp,v $ + * Revision 1.1.2.6 2007/08/10 18:21:13 korpela + * *** empty log message *** + * + * Revision 1.1.2.5 2007/08/09 21:31:08 korpela + * *** empty log message *** + * + * Revision 1.1.2.4 2007/06/07 20:01:52 mattl + * *** empty log message *** + * + * Revision 1.1.2.3 2007/06/06 15:58:30 korpela + * *** empty log message *** + * + * Revision 1.1.2.2 2007/04/25 17:27:31 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:45 korpela + * *** empty log message *** + * + * Revision 1.29.2.14 2006/05/03 19:14:31 korpela + * Updated work estimates. + * + * Revision 1.29.2.13 2006/04/24 18:41:02 korpela + * *** empty log message *** + * + * Revision 1.29.2.12 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.29.2.11 2006/01/10 00:39:04 jeffc + * *** empty log message *** + * + * Revision 1.29.2.10 2006/01/05 23:55:22 korpela + * *** empty log message *** + * + * Revision 1.29.2.9 2005/12/05 22:11:40 korpela + * Fixed bug in flops estimate. + * + * Revision 1.29.2.8 2005/10/05 16:22:17 jeffc + * removed reference to old/new boolean for directory hash. + * + * Revision 1.29.2.7 2005/09/22 23:05:22 korpela + * Fixed threshold calculation. Was using chisqr rather than reduced chisqr. + * + * Revision 1.29.2.6 2005/09/21 22:11:23 korpela + * Updated Makefile.in for OpenSSL. + * Added dynamic threshold generation to wufiles.cpp. + * + * Revision 1.29.2.5 2005/08/01 17:47:38 korpela + * Type fixed. + * + * Revision 1.29.2.4 2005/08/01 17:43:20 korpela + * Refinement of FLOPS estimate for workunits. + * + * Revision 1.29.2.3 2005/07/26 17:17:01 korpela + * Typo fix + * + * Revision 1.29.2.2 2005/07/19 00:15:19 korpela + * Revised delay bound and FLOP estimate for setiathome_enhanced. + * + * Revision 1.29.2.1 2005/07/06 01:30:17 korpela + * Updated estimates of FPOPS per workunit for setiathome enhanced. + * + * Revision 1.29 2005/03/08 22:36:15 jeffc + * jeffc - fixed call to create_work() + * + * Revision 1.28 2005/02/15 23:06:47 korpela + * Fixed missing dir_hier symbol. + * + * Revision 1.27 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.26 2004/11/18 22:24:48 korpela + * *** empty log message *** + * + * Revision 1.25 2004/08/25 22:42:11 jeffc + * *** empty log message *** + * + * Revision 1.24 2004/08/14 04:44:26 jeffc + * *** empty log message *** + * + * Revision 1.23 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.22 2004/07/15 17:54:20 jeffc + * *** empty log message *** + * + * Revision 1.21 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/07/01 17:56:51 korpela + * *** empty log message *** + * + * Revision 1.19 2004/06/25 13:49:33 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/02 20:51:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/01/22 00:57:54 korpela + * *** empty log message *** + * + * Revision 1.14 2004/01/20 22:33:44 korpela + * *** empty log message *** + * + * Revision 1.13 2004/01/06 22:44:05 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/12 01:51:39 korpela + * Now using the opaque field in workunit to store SAH wuid. + * + * Revision 1.10 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.9 2003/11/25 21:59:53 korpela + * *** empty log message *** + * + * Revision 1.8 2003/11/11 06:20:30 korpela + * Increased max fpops_max to prevent timeout on windows clients + * + * Revision 1.7 2003/10/25 18:19:44 korpela + * *** empty log message *** + * + * Revision 1.6 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.3.2.2 2003/09/22 19:00:31 korpela + * *** empty log message *** + * + * Revision 1.3.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.4 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:44 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:36:00 korpela + * + * renames .C files to .cpp + * + * Revision 1.3 2003/06/05 15:52:47 korpela + * + * Fixed coordinate bug that was using the wrong zenith angle from the telescope + * strings when handling units from the gregorian. + * + * Revision 1.2 2003/06/03 01:01:18 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.8 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.7 2003/04/10 17:32:25 korpela + * *** empty log message *** + * + * Revision 3.6 2002/06/21 01:42:15 eheien + * *** empty log message *** + * + * Revision 3.5 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.4 2001/08/17 22:20:54 korpela + * *** empty log message *** + * + * Revision 3.3 2001/08/17 01:22:31 korpela + * *** empty log message *** + * + * Revision 3.2 2001/08/17 01:16:53 korpela + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.18 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.17 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.16 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.15 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.14 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.13 1999/02/11 16:46:28 korpela + * Added db access functions. + * + * Revision 2.12 1999/01/04 22:27:55 korpela + * Updated return codes. + * + * Revision 2.11 1998/12/14 23:41:44 korpela + * Added subband_base to work unit header. + * Changed frequency calculation. + * + * Revision 2.10 1998/12/14 21:55:07 korpela + * Added fft_len and ifft_len to work unit header. + * + * Revision 2.9 1998/11/13 23:58:52 korpela + * Modified for move of name field between structures. + * + * Revision 2.8 1998/11/13 22:18:12 davea + * *** empty log message *** + * + * Revision 2.7 1998/11/10 01:55:26 korpela + * Server requires a CR at the end of a WU file + * ??? + * + * Revision 2.6 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.5 1998/11/05 21:33:02 korpela + * Fixed angle_range bug. + * + * Revision 2.4 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.3 1998/11/02 21:20:58 korpela + * Modified for (internal) integer receiver ID. + * + * Revision 2.2 1998/11/02 18:45:39 korpela + * Changed location of timecvt.h + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 01:01:16 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/mb_wufiles.h b/gbt_splitter/mb_wufiles.h new file mode 100644 index 0000000..5fb95e2 --- /dev/null +++ b/gbt_splitter/mb_wufiles.h @@ -0,0 +1,46 @@ +/* + * + * Functions for managing wufiles and their data + * + * $Id: mb_wufiles.h,v 1.1.2.2 2007/04/25 17:20:28 korpela Exp $ + * + */ + + +extern std::vector > bin_data; + +int make_wu_headers(std::vector &tapebuffer, telescope_id tel, + std::vector &wuheader) ; +void write_wufile_blocks(int nbytes) ; +void rename_wu_files(); + +/* + * $Log: mb_wufiles.h,v $ + * Revision 1.1.2.2 2007/04/25 17:20:28 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:46 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:45 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:13:16 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/message.cpp b/gbt_splitter/message.cpp new file mode 100644 index 0000000..d15181e --- /dev/null +++ b/gbt_splitter/message.cpp @@ -0,0 +1,65 @@ +/* + * Functions for sending messages to stderr and log files. + * + * $Id: message.cpp,v 1.2.4.2 2006/12/14 22:24:46 korpela Exp $ + */ + +#include "sah_config.h" +#include +#include +#include + +#include "boinc_db.h" +#include "sched_config.h" +#include "sched_msgs.h" +#include "splitter.h" + +void message(char *msg) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s %s",tapeheaders[0].name,msg); +} + + + +/* + * $Log: message.cpp,v $ + * Revision 1.2.4.2 2006/12/14 22:24:46 korpela + * *** empty log message *** + * + * Revision 1.2.4.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:43 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:56:16 korpela + * Initial revision + * + */ diff --git a/gbt_splitter/message.h b/gbt_splitter/message.h new file mode 100644 index 0000000..6c51713 --- /dev/null +++ b/gbt_splitter/message.h @@ -0,0 +1,40 @@ +/* + * Functions for sending messages to stderr and log files. + * + * $Id: message.h,v 1.1.4.1 2006/01/13 00:37:57 korpela Exp $ + */ + +#include "sched_msgs.h" + +void message(char *msg); + +/* + * $Log: message.h,v $ + * Revision 1.1.4.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:09:00 korpela + * Initial revision + * + */ diff --git a/gbt_splitter/polyphase.cpp b/gbt_splitter/polyphase.cpp new file mode 100644 index 0000000..57cbdd8 --- /dev/null +++ b/gbt_splitter/polyphase.cpp @@ -0,0 +1,149 @@ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "fftw.h" +#include "wufiles.h" +#include "polyphase.h" +#include "dotransform.h" + +/* buffer for fft input/output */ +//float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) + +extern unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + +double *filter_r, *filter_i; +float *f_data; + +extern int obuf_pos; /* Tracks current postition in the output buffers */ + +void make_FIR (int n_points, int M, int window, double *output) { + /* Create Mth band lowpass FIR filter, n_points long. */ + + /* Modify this to give 8-bit quantized filter. */ + /* Also generate Hilbert transformed filter */ + + int n; + double q, p; + + for (n=0; n TAPE_DATA_SIZE) { + // End of frame crossed need to trasfer correctly + end_trans.frame++; + end_trans.byte-=TAPE_DATA_SIZE; + nsamp=(TAPE_DATA_SIZE-start_trans.byte)*(CHAR_BIT/2); + assert((nsamp+end_trans.byte*(CHAR_BIT/2)) == FFT_LEN); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf, nsamp); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(end_trans.frame,0),databuf+nsamp*2, + end_trans.byte*(CHAR_BIT/2)); + } else { + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf,FFT_LEN); + } + polyphase_seg(databuf); + // Go on to next transform + start_trans=end_trans; + } + // Check if we're at the end of the wu file. If so we print less bytes + if ((end_trans.frame>=end_of_wu->frame) && + (end_trans.byte>=end_of_wu->byte)) { + write_wufile_blocks(NBYTES % SAMPLES_PER_OBUF); + } else { + write_wufile_blocks(SAMPLES_PER_OBUF); + } + } while (!((end_trans.frame>=end_of_wu->frame) && (end_trans.byte>=end_of_wu->byte))); + + // Move the data in the buffer so we don't have to reread portions of the + // tape. + // + { + unsigned char *record_offset; + int copysize; + end_of_wu->frame-=WU_OVERLAP_FRAMES; + records_in_buffer=TAPE_RECORDS_IN_BUFFER- + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD); + record_offset=tapebuffer+ + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD)*TAPE_RECORD_SIZE; + copysize=records_in_buffer*TAPE_RECORD_SIZE; + bcopy(record_offset,tapebuffer,copysize); + } +} + + diff --git a/gbt_splitter/polyphase.h b/gbt_splitter/polyphase.h new file mode 100644 index 0000000..0393c38 --- /dev/null +++ b/gbt_splitter/polyphase.h @@ -0,0 +1,26 @@ +#define NONE 0 +#define WELCH 1 +#define HANNING 2 + +#define N_WINDOWS 8 +#define P_FFT_LEN 256 + +/* buffer for fft input/output */ +extern float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) +#define TBUF_OFFSET(frame,byte) (tapebuffer+(frame)*TAPE_FRAME_SIZE+(byte)) +extern unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + +extern double *filter_r, *filter_i; +extern float *f_data; + +extern int obuf_pos; /* Tracks current postition in the output buffers */ + +void make_FIR (int n_points, int M, int window, double *output); +void polyphase_seg(float *data); +void do_polyphase(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu); + diff --git a/gbt_splitter/randomdata.cpp b/gbt_splitter/randomdata.cpp new file mode 100644 index 0000000..094315d --- /dev/null +++ b/gbt_splitter/randomdata.cpp @@ -0,0 +1,77 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include + +#define NUM_FRAMES 200L +#define FRAME_DATA_SIZE (1024L*1024) +#define HEADER_SIZE 1024 +#define FILESIZE (NUM_FRAMES*(FRAME_DATA_SIZE+HEADER_SIZE)) + +char header[HEADER_SIZE]; + +int main(void) { + int i; + int datapos=0; + int frameseq=0; + long written=0; + int on=0; + struct tm *tm; + unsigned char data; + + char tmpstr[256]; + char telstr[256]; + double time0=(double)time(0); + time_t clock; + + srandom(time(0)); + + for (written=0;writtentm_year,tm->tm_yday,tm->tm_hour,tm->tm_min,tm->tm_sec,(int)((time0-floor(time0))*100)); + strcpy(header+headerpos,tmpstr); + headerpos+=strlen(tmpstr)+1; + if (!((frameseq-1)%5)) { + sprintf(telstr,"TELSTR=%.2d%.3d%.2d%.2d%.2d 0.0 0.0 15.0",tm->tm_year,tm->tm_yday,tm->tm_hour,tm->tm_min,tm->tm_sec); + } + strcpy(header+headerpos,telstr); + headerpos+=strlen(telstr)+1; + strcpy(header+headerpos,"RECEIVER=ao1420"); + headerpos+=strlen("RECEIVER=ao1420")+1; + strcpy(header+headerpos,"SAMPLERATE=2.5000"); + headerpos+=strlen("SAMPLERATE=2.5000")+1; + strcpy(header+headerpos,"CENTERFREQ=1420.0"); + headerpos+=strlen("CENTERFREQ=1420.0")+1; + strcpy(header+headerpos,"VER=1.00"); + headerpos+=strlen("VER=1.00")+1; + strcpy(header+headerpos,"NUMRINGBUFS=4"); + headerpos+=strlen("NUMRINGBUFS=4")+1; + strcpy(header+headerpos,"NUMDISKBUFS=2"); + headerpos+=strlen("NUMDISKBUFS=2")+1; + strcpy(header+headerpos,"EOH="); + write(stdout->_file, header, HEADER_SIZE); + for(i=0;i_file, &data, 1); + } + time0+=(1024.0*1024.0*4.0/2.5e6); + } +} + diff --git a/gbt_splitter/readheader.cpp b/gbt_splitter/readheader.cpp new file mode 100644 index 0000000..6a82fc2 --- /dev/null +++ b/gbt_splitter/readheader.cpp @@ -0,0 +1,225 @@ +/* + * Functions for reading tape and work unit headers + * + * This file currently assumes that the reciever is at Arecibo. + * + * $Id: readheader.cpp,v 1.3.4.2 2006/12/14 22:24:47 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include + +#include "splitter.h" +#include "splitparms.h" +#include "splittypes.h" +#include "message.h" +#include "timecvt.h" +#include "coordcvt.h" + +/* Read a tape header at buffer into a tapeheader_t */ +int read_tape_header(char *buffer, tapeheader_t *header) +{ + static char *receivers[]={"","synthetic","ao1420"}; + int done=0,len; + int pos=0,i; + char tmpstr[256]; + double dummy; + unsigned int firstdata; + + do { + len=strlen(buffer+pos)+1; + if (!strncmp(buffer+pos,"EOH=",4)) { + done=1; + } else if (!strncmp(buffer+pos,"NAME=",5)) { + strncpy(tmpstr,buffer+pos+5,36); + i=0; + while(!isalnum(tmpstr[i])) i++; + strncpy(header->name,tmpstr+i,36); + } else if (!strncmp(buffer+pos,"RCDTYPE=",8)) { + sscanf(buffer+pos+8,"%d",&(header->rcdtype)); + } else if (!strncmp(buffer+pos,"FRAMESEQ=",9)) { + sscanf(buffer+pos+9,"%lu",&(header->frameseq)); + } else if (!strncmp(buffer+pos,"DATASEQ=",8)) { + sscanf(buffer+pos+8,"%lu",&(header->dataseq)); + } else if (!strncmp(buffer+pos,"NUMRINGBUFS=",12)) { + sscanf(buffer+pos+12,"%d",&(header->numringbufs)); + } else if (!strncmp(buffer+pos,"NUMDISKBUFS=",12)) { + sscanf(buffer+pos+12,"%d",&(header->numdiskbufs)); + } else if (!strncmp(buffer+pos,"MISSED=",7)) { + sscanf(buffer+pos+7,"%d",&(header->missed)); + } else if (!strncmp(buffer+pos,"AST=",4)) { + sscanf(buffer+pos+4,"%2d%3d%2d%2d%2d%2d", + &(header->st.y), &(header->st.d), &(header->st.h), + &(header->st.m), &(header->st.s), &(header->st.c)); + header->st.tz=AST; + } else if (!strncmp(buffer+pos,"TELSTR=",7)) { + sscanf(buffer+pos+7,"%2d%3d%2d%2d%2d %lf %lf %lf", + &(header->telstr.st.y), &(header->telstr.st.d), + &(header->telstr.st.h), &(header->telstr.st.m), + &(header->telstr.st.s), &(header->telstr.az), + gregorian?&(header->telstr.alt):&dummy, + gregorian?&dummy:&(header->telstr.alt)); + header->telstr.alt=90.0-header->telstr.alt; + header->telstr.st.tz=AST; + header->telstr.st.c=0; + } else if (!strncmp(buffer+pos,"RECEIVER=",9)) { + i=1; + while ((!strstr(buffer+pos+9,receivers[i])) && (++isource=0; + } else { + header->source=i; + } + } else if (!strncmp(buffer+pos,"CENTERFREQ=",11)) { + sscanf(buffer+pos+11,"%lf",&(header->centerfreq)); + header->centerfreq*=1e6; + } else if (!strncmp(buffer+pos,"SAMPLERATE=",11)) { + sscanf(buffer+pos+11,"%lf",&(header->samplerate)); + header->samplerate*=1e6; + } else if (!strncmp(buffer+pos,"VER=",4)) { + strncpy(&(header->version[0]),&(buffer[pos+4]),16); + } else if (len>1) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Unknown header field: %40s\n",buffer+pos); + } + pos+=len; + } while (!done && (posst)); + header->st.jd-=(float)RECORDER_BUFFER_SAMPLES/header->samplerate/86400; + st_time_convert(&(header->telstr.st)); + telstr_coord_convert(&(header->telstr),ARECIBO_LAT,ARECIBO_LON); + +/* + * Fix a bug in recorder versions prior to 1.30 + */ + + if (atof(&(header->version[0]))<1.299) { + header->centerfreq-=2.0; + } + +/* + * Check for blank tape + */ + firstdata=*(unsigned int *)(buffer+TAPE_HEADER_SIZE); + if (!(firstdata & 0x55555555) || !(firstdata & 0xaaaaaaaa) || + ((firstdata & 0x55555555) == 0x55555555) || + ((firstdata & 0xaaaaaaaa) == 0xaaaaaaaa)) { + header->missed++; + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Possible data problem...data[0] = 0x%x\n",firstdata); + } + + return(1); +} + +/* Read a work unit header from a FILE into a wuheader_t */ +//int read_wu_header(FILE *file, wuheader_t *header) { +/* to be implemented. Don't need it yet. */ +// return(0); +//} + +int parse_tape_headers(unsigned char *tapebuffer, tapeheader_t *tapeheaders) { + int i; + + for (i=0;i +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "util.h" +#include "splitparms.h" +#include "splitter.h" +#include "message.h" +#include "readheader.h" +#include "readtape.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "str_util.h" +#include "str_replace.h" + +int is_tape; + +static tape tape_info; + +int current_record; +static int tape_fd; +struct mtget tape_status; + +static void update_checkpoint() { + FILE *file=fopen("rcd.chk","w"); + if (file) { + fprintf(file,"%d\n",current_record); + fclose(file); + } +} + +int read_checkpoint() { + FILE *file=fopen("rcd.chk","r"); + int retval=0; + if (file) { + fscanf(file,"%d",&retval); + fclose(file); + } + return(retval); +} + +int tape_busy() { +/* Check if tape is busy. If so return 1 else return 0 + */ + if (is_tape) { + if (ioctl(tape_fd,MTIOCGET,&tape_status) != -1) { + return (tape_status.mt_dsreg); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to get tape status\n"); + return (1); + } + } else { + return (0); + } +} + +int tape_eject() { +/* Rewind and eject the tape. Return 1 if sucessful else return 0 + */ + struct mtop op={MTOFFL,1}; + + close(tape_fd); + if (is_tape) { + while (tape_busy()) sleep(1); + if (ioctl(tape_fd,MTIOCTOP,&op)==-1) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to eject tape\n"); + return(0); + } else { + return(1); + } + } else { + return(1); + } +} + + +int tape_rewind() { +/* Rewind to beginning of tape. Return 1 if sucessful, 0 if failure + */ + struct mtop op={MTREW, 1}; + if (is_tape) { + while (tape_busy()) sleep(1); + if (ioctl(tape_fd,MTIOCTOP,&op)!=-1) { + current_record=0; + update_checkpoint(); + } else { + current_record=-1; + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Tape rewind failed\n"); + } + } else { + if (lseek(tape_fd, 0, SEEK_SET)!=-1) { + current_record=0; + update_checkpoint(); + } else { + current_record=-1; + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"File rewind failed\n"); + } + } + return (!current_record); +} + + + +int open_tape_device(char *device) { +/* opens a device, checks if it is a tape device. If so, sets is_tape + * flag. If not, it resets the flag. All tape routines check this flag + * so routines will work for both tapes and files + */ + + + int fd, errcnt=0; + struct mtop op={MTNOP,1}; + + if ((fd=open(device, O_RDONLY|0x2000, 0777))!=-1) { + tape_fd=fd; + if (ioctl(tape_fd,MTIOCGET,&tape_status) != -1) { + is_tape = 1; + } else { + is_tape = 0; + } + while (!norewind && !tape_rewind() && errcnt<10 ) errcnt++; + if (!nodb && resumetape) { + tape_rewind(); + fill_tape_buffer(tapebuffer,TAPE_RECORDS_IN_BUFFER); + parse_tape_headers(tapebuffer, &(tapeheaders[0])); + if (!tape_info.id) { + if (!tape_info.fetch(std::string("where name=\'")+tapeheaders->name+"\'")) { + tape_info.start_time=tapeheaders->st.jd; + tape_info.last_block_time=tapeheaders->st.jd; + tape_info.last_block_done=tapeheaders->frameseq; + strlcpy(tape_info.name,tapeheaders->name,sizeof(tape_info.name)); + tape_info.insert(); + } + } + startblock=tape_info.last_block_done/TAPE_FRAMES_PER_RECORD; + } + if (norewind) { + startblock=MAX(read_checkpoint()-TAPE_RECORDS_IN_BUFFER,0); + tape_rewind(); + } + if (startblock) { + return select_record(startblock); + } + return (1); + } else { + perror( NULL ); + return (0); + } +} + +int select_record(int record_number) { +/* seeks to a specific record number returns 1 if successful */ + int diff; + struct mtop op; + char tmpstr[100]; + off64_t off,offset; + + if ((current_record<0) && !tape_rewind()) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Tape error: position lost and unable to rewind!\n"); + return(0); + } + + diff=record_number-current_record; + + if (is_tape) { + if (diff==0) return (1); + if (diff>0) { + op.mt_op=MTFSR; + op.mt_count=diff; + } else { + op.mt_op=MTBSR; + op.mt_count=diff; + } + if (ioctl(tape_fd,MTIOCTOP,&op)==-1) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Tape error: unable to position to record %d errno=%d\n", + record_number,errno); + current_record=-1; + return(0); + } else { + current_record+=diff; + update_checkpoint(); + return(1); + } + } else { + current_record=record_number; + update_checkpoint(); + offset = record_number; + offset *= TAPE_RECORD_SIZE; + //fprintf( stderr, "offset: %lld", offset ); + off=lseek64(tape_fd,offset,SEEK_SET) ; + //fprintf( stderr, "off: %lld", offset ); + return (off != -1); + } +} + +int tape_read_record(char *buffer) { + int bytesread=0; + int i; + + while (tape_busy()) sleep(1); + + do { + i=read(tape_fd,buffer+bytesread,TAPE_RECORD_SIZE); + if (i>0) bytesread+=i; + } while ((bytesread0)); + + if (i==0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"End of tape. Please insert new tape\n"); + current_record=-1; + return(0); + } + + if (i<0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Tape error.\n"); + current_record=-1; + return(0); + } + + current_record++; + update_checkpoint(); + return(1); +} + +int fill_tape_buffer(unsigned char *buffer, int n_records) { + int i; + long record; + char tmpstr[100]; + + for (i=0;i + +#define WU_SUBDIR "/download" + +#define SPLITTER_VERSION 0x0012 +#define MAX_WUS_ONDISK 500000 +#define N_SIMULT_SPLITTERS 6 + +/* Work Unit Parameters */ +#define NBYTES 262144L +#define NSAMPLES (NBYTES*CHAR_BIT/2) +#define MAX_POSITION_HISTORY 40 +#define WU_FILESIZE (360L*1024) + +/* FFT Parameters */ +#define FFT_LEN 256 +#define IFFT_LEN 1 +#define NSTRIPS (FFT_LEN/IFFT_LEN) + +/* Tape format parameters */ +#define TAPE_HEADER_SIZE 1024L +#define TAPE_DATA_SIZE 1048576L +#define TAPE_FRAMES_PER_RECORD 8L +#define TAPE_FRAME_SIZE (TAPE_HEADER_SIZE+TAPE_DATA_SIZE) +#define TAPE_RECORD_SIZE (TAPE_FRAMES_PER_RECORD*TAPE_FRAME_SIZE) +#define TAPE_BUFFER_SIZE (((NSTRIPS*NBYTES*7/4)/TAPE_RECORD_SIZE+1)*TAPE_RECORD_SIZE) +#define TAPE_RECORDS_IN_BUFFER (TAPE_BUFFER_SIZE/TAPE_RECORD_SIZE) +#define TAPE_FRAMES_IN_BUFFER (TAPE_RECORDS_IN_BUFFER*8) +#define TAPE_FRAMES_PER_WU (NBYTES*NSTRIPS/TAPE_DATA_SIZE) +#define WU_OVERLAP_RECORDS 2 +#define WU_OVERLAP_FRAMES (TAPE_FRAMES_PER_RECORD*WU_OVERLAP_RECORDS) +#define WU_OVERLAP_BYTES (WU_OVERLAP_FRAMES*TAPE_DATA_SIZE) +#define RECORDER_BUFFER_BYTES (1024L*1024L) +#define RECORDER_BUFFER_SAMPLES (RECORDER_BUFFER_BYTES*4) + + +/* Time Zone Parameters */ +#define UTC 0.0 +#define AST (UTC-4.0) + +/* Arecibo Observatory Parameters */ +#define ARECIBO_LAT 18.3538056 +#define ARECIBO_LON (-66.7552222) + +#endif +/* + * $Log: splitparms.h,v $ + * Revision 1.10 2004/11/23 21:26:29 jeffc + * *** empty log message *** + * + * Revision 1.9 2004/08/14 04:44:26 jeffc + * *** empty log message *** + * + * Revision 1.8 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.7 2004/05/22 18:12:18 korpela + * *** empty log message *** + * + * Revision 1.6 2003/10/27 17:53:21 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/26 20:48:51 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.3.2.1 2003/09/22 17:39:34 korpela + * *** empty log message *** + * + * Revision 1.4 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.1 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.9 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.8 1999/10/20 19:20:26 korpela + * *** empty log message *** + * + * Revision 2.7 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.6 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.4 1999/02/23 18:57:09 korpela + * *** empty log message *** + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * Changed version number. + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added WU_FILESIZE, RECORDER_BUFFER_BYTES, RECORDER_BUFFER_SAMPLES.` + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.4 1998/10/27 01:10:04 korpela + * Bug fixes. + * + * Revision 1.3 1998/10/19 23:06:40 korpela + * Added UTC and AST definition. + * Added ARECIBO_LAT and ARECIBO_LON definitions. + * + * Revision 1.2 1998/10/16 19:22:14 korpela + * Reduced WU file size from 512K to 256K. + * + * Revision 1.1 1998/10/15 16:39:51 korpela + * Initial revision + * + */ + diff --git a/gbt_splitter/splitter.cpp b/gbt_splitter/splitter.cpp new file mode 100644 index 0000000..c4cea44 --- /dev/null +++ b/gbt_splitter/splitter.cpp @@ -0,0 +1,717 @@ +/* + * + * The splitter main program. + * + * $Id: splitter.cpp,v 1.22.2.6 2007/06/06 15:58:30 korpela Exp $ + * + */ + +#include "sah_config.h" +#undef USE_MYSQL +#include +#include +#include +#include +#include +#include +#include + +#include "boinc_db.h" +#include "crypt.h" +#include "backend_lib.h" +#include "sched_config.h" +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "validrun.h" +#include "makebufs.h" +#include "readtape.h" +#include "readheader.h" +#include "wufiles.h" +#include "dotransform.h" +#include "polyphase.h" +#include "message.h" +#include "sqlrow.h" +#include "sqlapi.h" +#include "db/db_table.h" +#include "db/schema_master.h" +#include "db/app_config.h" + +extern "C" { + int sqldetach(); +} + +char trigger_file_path[1024]="/disks/setifiler1/wutape/tapedir/splitter_stop"; + +SCHED_CONFIG boinc_config; +DB_APP app; +R_RSA_PRIVATE_KEY key; + + +// TEMPLATE DEFS ------------------------------------------------------ +// IMPORTANT: a change to a template should *always* include a change +// to the template filename. Only the result template is used now. +const char *wu_template_filename_id = "wu_0.xml"; +const char *wu_template= + "\n" + " 0\n" + "\n" + "\n" + " \n" + " 0\n" + " work_unit.sah\n" + " \n" + "\n"; + +const char *result_template_filename_id = "result_0.xml"; +const char *result_template= + "\n" + " \n" + " \n" + " \n" + " 65536\n" + " http://setiboincdata.ssl.berkeley.edu/sah_cgi/file_upload_handler\n" + "\n" + "\n" + " \n" + " \n" + " result.sah\n" + " \n" + "\n"; +// END TEMPLATE DEFS -------------------------------------------------- + +unsigned char *tapebuffer; /* A buffer for a tape section */ +workunit wuheaders[NSTRIPS]; +tapeheader_t tapeheaders[TAPE_FRAMES_IN_BUFFER]; +int max_wus_ondisk=MAX_WUS_ONDISK; +int nodb; +int noencode; +int resumetape; +int norewind; +int startblock; +int dataclass; +int atnight; +int gregorian; +int output_xml; +int polyphase; +int iters=-1; +int filter_window = 0; +double start_time; +double stop_time; +unsigned long minvfsbuf=-1; +char wd[1024]; +//char * scidb = NULL; +char * projectdir = NULL; + +APP_CONFIG sah_config; + +//const char *result_template_filename="projectdir"/"SAH_APP_NAME"_result.tpl"; +char result_template_filename[1024]; +char result_template_filepath[1024]; +char wu_template_filename[1024]; + +int check_for_halt(); +int wait_until_night(); +int check_free_disk_space(); +int wait_for_db_wus_ondisk(); + +void cprint(char *p) { + printf("%s\n",p); +} + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ + +FILE *wulog,*errorlog; +buffer_pos_t start_of_wu,end_of_wu; /* position of start and end of wu in + tape buffer */ +int seqno; +int records_in_buffer; + +void cleanup(void) { + FILE *tmpfile; + if ((tmpfile=fopen("seqno.dat","w"))) { + fprintf(tmpfile,"%d\n",seqno); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Unable to open seqno.dat for write\n"); + } +} + + +int process_command_line(int argc, char *argv[],char **tape_device, + int *norewind, int *startblock, int *resumetape, + int *nodb, int *dataclass, int *atnight, + int *max_wus_ondisk, char **projectdir, + int *iters) { + int nargs=0,i; + char *ep; + for (i=1;itm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)) { + sleep(100); + } + } while ((lt->tm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)); + return 0; +} + +int check_free_disk_space() { + struct statvfs vfsbuf; + + /* check disk free space */ + statvfs("wu_inbox/.",&vfsbuf); + if (vfsbuf.f_bavail < (100000*1024/vfsbuf.f_frsize)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Not enough free disk space in working directory to continue\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Not enough free disk space in working directory to continue\n"); + exit(EXIT_FAILURE); + } + return 0; +} + +int wait_for_db_wus_ondisk() { + int wus_ondisk,rv; + + // The boinc db query below takes a long time. Until we fix this, + // we will do it only every 100 times into this routine. All other + // calls here will assume that we need to add WUs. -- jeffc + static int check_count = 100; + if (check_count < 100) { + check_count++; + return 0; + } else { + check_count = 0; + } + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"boinc_db.open\n"); + exit(1); + } + do { + DB_RESULT boinc_result; + char query[1024]; + sprintf(query,"where appid=%d and server_state=2",app.id); + rv=boinc_result.count(wus_ondisk,query); + if (rv) { + boinc_db.print_error("boinc_result.count"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"DB Error, unable to count workunits on disk\n"); + exit(EXIT_FAILURE); + } + check_for_halt(); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%d WUs ondisk\n", wus_ondisk); + if (wus_ondisk>sah_config.max_wus_ondisk) sleep(600); + } while (wus_ondisk>sah_config.max_wus_ondisk); + + return 0; +} + +/* + * $Log: splitter.cpp,v $ + * Revision 1.22.2.6 2007/06/06 15:58:30 korpela + * *** empty log message *** + * + * Revision 1.22.2.5 2006/12/14 22:24:48 korpela + * *** empty log message *** + * + * Revision 1.22.2.4 2006/11/08 20:16:26 vonkorff + * Fixes an error message. + * + * Revision 1.22.2.3 2006/11/07 19:26:37 vonkorff + * Fixed lcgf + * + * Revision 1.22.2.2 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.22.2.1 2005/08/01 21:16:25 jeffc + * *** empty log message *** + * + * Revision 1.22 2005/01/27 23:03:27 mattl + * + * commented out tf=0 in check_for_halt + * + * Revision 1.21 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.19 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/27 21:07:04 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/20 18:56:48 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.14 2004/04/08 22:25:47 jeffc + * *** empty log message *** + * + * Revision 1.13 2004/01/22 00:57:53 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.10 2003/11/25 21:59:52 korpela + * *** empty log message *** + * + * Revision 1.9 2003/11/01 20:54:02 korpela + * *** empty log message *** + * + * Revision 1.8 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.7 2003/09/26 20:48:51 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.5.2.2 2003/09/23 00:49:12 korpela + * *** empty log message *** + * + * Revision 1.5.2.1 2003/09/22 17:39:34 korpela + * *** empty log message *** + * + * Revision 1.6 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/13 20:48:38 korpela + * directory reorg. Moved client files to ./client + * + * Revision 1.4 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/08/13 23:18:47 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:50 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.6 2003/05/21 00:41:42 korpela + * *** empty log message *** + * + * Revision 3.5 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.4 2003/04/09 17:46:54 korpela + * *** empty log message *** + * + * Revision 3.3 2002/06/20 22:09:17 eheien + * *** empty log message *** + * + * Revision 3.2 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.6 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added dataclass paramter. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added some db access functions. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:58:16 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/splitter.h b/gbt_splitter/splitter.h new file mode 100644 index 0000000..46b73b3 --- /dev/null +++ b/gbt_splitter/splitter.h @@ -0,0 +1,132 @@ +/* + * splitter.h + * + * Global definitions from the splitter main program. + * + * $Id: splitter.h,v 1.6.2.1 2006/01/13 00:37:58 korpela Exp $ + * + */ + +#ifndef SPLITTER_H +#define SPLITTER_H + +#include "splitparms.h" +#include "splittypes.h" + +#define MAX(x,y) ( ((x)<(y)) ? (y) : (x) ) +#define MIN(x,y) ( ((y)<(x)) ? (y) : (x) ) + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ +#include "boinc_db.h" +#include "crypt.h" +#include "backend_lib.h" +#include "sched_config.h" + +extern SCHED_CONFIG boinc_config; +extern DB_APP app; +extern R_RSA_PRIVATE_KEY key; +extern FILE *wulog,*errorlog; +extern workunit wuheaders[NSTRIPS]; +extern tapeheader_t tapeheaders[TAPE_FRAMES_IN_BUFFER]; +extern int noencode; +extern int dataclass; +extern int nodb; +extern int resumetape; +extern int startblock; +extern int norewind; +extern int output_xml; +extern int polyphase; +extern int wu_database_id[NSTRIPS]; +extern int gregorian; +extern char * projectdir; +extern char trigger_file_name[1024]; + + +/* Buffer that holds tape data */ +extern unsigned char *tapebuffer; + +/* Number of records remaining in the buffer after WU creations is complete */ +extern int records_in_buffer; + +extern const char *wu_template; +extern const char *result_template; +// jeffc +//extern const char *result_template_filename; +extern char result_template_filename[]; +extern char result_template_filepath[]; +extern char wu_template_filename[]; + +/* Persistant sequence number of wu file */ +extern int seqno; + +#endif + +/* + * $Log: splitter.h,v $ + * Revision 1.6.2.1 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.6 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.5 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.4 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.2.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/10/20 19:20:26 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * Added nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:10:32 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/splittypes.h b/gbt_splitter/splittypes.h new file mode 100644 index 0000000..46e4b37 --- /dev/null +++ b/gbt_splitter/splittypes.h @@ -0,0 +1,111 @@ +/* splittypes.h + * + * Type definitions specific to the splitter. + * + * + * $Id: splittypes.h,v 1.4 2003/08/05 17:23:43 korpela Exp $ + * + */ +#ifndef SPLITTYPES_H +#define SPLITTYPES_H + +#include + +#include "splitparms.h" +#include "s_util.h" +#include "seti_header.h" + +//typedef struct wuheader { + //WU_INFO wuhead; + //SETI_WU_INFO wuinfo; +//} wuheader_t; + +typedef struct tapeheader { + char name[36]; + int rcdtype; + int numringbufs; + int numdiskbufs; + unsigned long frameseq; + unsigned long dataseq; + int missed; + TIME st; + SCOPE_STRING telstr; + int source; + double centerfreq,samplerate; + char version[16]; +} tapeheader_t; + +typedef struct buffer_pos { + int frame; + long byte; +} buffer_pos_t; + +#endif +/* + * $Log: splittypes.h,v $ + * Revision 1.4 2003/08/05 17:23:43 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.3 2003/07/29 20:35:51 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:41 korpela + * + * Again + * + * Revision 3.1 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.4 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.3 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * Moved tape_version and encoding_type into SETI_WU_INFO. + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.7 1998/10/30 21:01:13 davea + * *** empty log message *** + * + * Revision 1.6 1998/10/27 01:10:58 korpela + * Modified tapeheader_t to match new tape header fields. + * + * Revision 1.5 1998/10/19 23:04:32 korpela + * Moved times in telstr_t into an st_t. + * Changed name of ast_t to st_t. + * Added time zone (tz) field to ast_t. + * + * Revision 1.4 1998/10/15 19:13:30 korpela + * Renamed "unix" fields to "unix_time" because of GCC #define. + * Added position_history field to wuheader_t. + * + * Revision 1.3 1998/10/15 18:58:50 korpela + * Added time_t unix to ast_t and telstr_t types. + * Changed times in wuheader_t to time_t types. + * + * Revision 1.2 1998/10/15 18:01:19 korpela + * Removed month field from ast_t and telstr_t. + * + * Revision 1.1 1998/10/15 16:20:24 korpela + * Initial revision + * + */ diff --git a/gbt_splitter/squarewave.cpp b/gbt_splitter/squarewave.cpp new file mode 100644 index 0000000..7ac379d --- /dev/null +++ b/gbt_splitter/squarewave.cpp @@ -0,0 +1,75 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include + +#define NUM_FRAMES 200L +#define FRAME_DATA_SIZE (1024L*1024) +#define HEADER_SIZE 1024 +#define FILESIZE (NUM_FRAMES*(FRAME_DATA_SIZE+HEADER_SIZE)) + +char header[HEADER_SIZE]; + +int main(void) { + int i; + int datapos=0; + int frameseq=0; + long written=0; + int on=0; + struct tm *tm; + char data; + + char tmpstr[256]; + char telstr[256]; + double time0=(double)time(0); + time_t clock; + + for (written=0;writtentm_year,tm->tm_yday,tm->tm_hour,tm->tm_min,tm->tm_sec,(int)((time0-floor(time0))*100)); + strcpy(header+headerpos,tmpstr); + headerpos+=strlen(tmpstr)+1; + if (!((frameseq-1)%5)) { + sprintf(telstr,"TELSTR=%.2d%.3d%.2d%.2d%.2d 0.0 0.0 15.0",tm->tm_year,tm->tm_yday,tm->tm_hour,tm->tm_min+(tm->tm_sec>57),(tm->tm_sec+2)%60); + } + strcpy(header+headerpos,telstr); + headerpos+=strlen(telstr)+1; + strcpy(header+headerpos,"RECEIVER=ao1420"); + headerpos+=strlen("RECEIVER=ao1420")+1; + strcpy(header+headerpos,"SAMPLERATE=2.5000"); + headerpos+=strlen("SAMPLERATE=2.5000")+1; + strcpy(header+headerpos,"VER=1.00"); + headerpos+=strlen("VER=1.00")+1; + strcpy(header+headerpos,"CENTERFREQ=1420.0"); + headerpos+=strlen("CENTERFREQ=1420.0")+1; + strcpy(header+headerpos,"NUMRINGBUFS=4"); + headerpos+=strlen("NUMRINGBUFS=4")+1; + strcpy(header+headerpos,"NUMDISKBUFS=2"); + headerpos+=strlen("NUMDISKBUFS=2")+1; + strcpy(header+headerpos,"EOH="); + write(stdout->_file, header, HEADER_SIZE); + for(i=0;i_file, &data, 1); + } + time0+=(1024.0*1024.0*4.0/2.5e6); + } +} + diff --git a/gbt_splitter/tags b/gbt_splitter/tags new file mode 100644 index 0000000..36fa81d --- /dev/null +++ b/gbt_splitter/tags @@ -0,0 +1,463 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ +!_TAG_PROGRAM_NAME Exuberant Ctags // +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ +!_TAG_PROGRAM_VERSION 5.8 // +ARECIBO_LAT splitparms.h 53;" d +ARECIBO_LON splitparms.h 54;" d +AST splitparms.h 50;" d +AltAzCorrection coordcvt.cpp /^void AltAzCorrection(double *alt, double *az) {$/;" f namespace:SPLITTER +COMPLEX fftw.h 74;" d +COORDCVT_H coordcvt.h 11;" d +D2R coordcvt.cpp 109;" d file: +DB_FNS_H db_fns.h 8;" d +DL_IMPORT fftw.h 141;" d +DL_IMPORT fftw.h 143;" d +DL_IMPORT fftw.h 145;" d +DL_IMPORT fftw.h 148;" d +DTOR angdist.cpp 16;" d file: +DTOR mb_angdist.cpp 24;" d file: +EXIT_NORMAL_EOF mb_splitter.h /^const int EXIT_NORMAL_EOF = 0;$/;" v +EXIT_NORMAL_NOT_EOF mb_splitter.h /^const int EXIT_NORMAL_NOT_EOF = 2;$/;" v +FFTWND_FORCE_BUFFERED fftw.h 289;" d +FFTWND_HAS_PRINT_PLAN fftw.h 401;" d +FFTW_1_0_COMPATIBILITY fftw.h 68;" d +FFTW_BACKWARD fftw.h /^ FFTW_FORWARD = -1, FFTW_BACKWARD = 1$/;" e enum:__anon2 +FFTW_COMPLEX fftw.h /^typedef fftw_complex FFTW_COMPLEX;$/;" t +FFTW_ENABLE_FLOAT fftw.h 40;" d +FFTW_ESTIMATE fftw.h 278;" d +FFTW_FAILURE fftw.h /^ FFTW_SUCCESS = 0, FFTW_FAILURE = -1$/;" e enum:__anon3 +FFTW_FORWARD fftw.h /^ FFTW_FORWARD = -1, FFTW_BACKWARD = 1$/;" e enum:__anon2 +FFTW_GENERIC fftw.h /^ FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER,$/;" e enum:fftw_node_type +FFTW_H fftw.h 26;" d +FFTW_HAS_FPRINT_PLAN fftw.h 335;" d +FFTW_HAS_PLAN_SPECIFIC fftw.h 295;" d +FFTW_HAS_WISDOM fftw.h 322;" d +FFTW_HC2HC fftw.h /^ FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC$/;" e enum:fftw_node_type +FFTW_HC2REAL fftw.h /^ FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC$/;" e enum:fftw_node_type +FFTW_IN_PLACE fftw.h 282;" d +FFTW_MEASURE fftw.h 279;" d +FFTW_NOTW fftw.h /^ FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER,$/;" e enum:fftw_node_type +FFTW_OUT_OF_PLACE fftw.h 281;" d +FFTW_RADER fftw.h /^ FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER,$/;" e enum:fftw_node_type +FFTW_REAL fftw.h /^typedef fftw_real FFTW_REAL;$/;" t +FFTW_REAL2HC fftw.h /^ FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC$/;" e enum:fftw_node_type +FFTW_RGENERIC fftw.h /^ FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC$/;" e enum:fftw_node_type +FFTW_SUCCESS fftw.h /^ FFTW_SUCCESS = 0, FFTW_FAILURE = -1$/;" e enum:__anon3 +FFTW_THREADSAFE fftw.h 285;" d +FFTW_TWIDDLE fftw.h /^ FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER,$/;" e enum:fftw_node_type +FFTW_USE_WISDOM fftw.h 283;" d +FFT_LEN splitparms.h 27;" d +FILESIZE randomdata.cpp 12;" d file: +FILESIZE squarewave.cpp 12;" d file: +FRAME_DATA_SIZE randomdata.cpp 10;" d file: +FRAME_DATA_SIZE squarewave.cpp 10;" d file: +HANNING polyphase.h 3;" d +HEADER_SIZE randomdata.cpp 11;" d file: +HEADER_SIZE squarewave.cpp 11;" d file: +IFFT_LEN splitparms.h 28;" d +MAKEBUFS_H makebufs.h 11;" d +MAX mb_splitter.h 16;" d +MAX splitter.h 16;" d +MAX_POSITION_HISTORY splitparms.h 23;" d +MAX_WUS_ONDISK splitparms.h 17;" d +MIN mb_splitter.h 17;" d +MIN splitter.h 17;" d +NBYTES splitparms.h 21;" d +NONE polyphase.h 1;" d +NSAMPLES splitparms.h 22;" d +NSTRIPS splitparms.h 29;" d +NUM_FRAMES randomdata.cpp 9;" d file: +NUM_FRAMES squarewave.cpp 9;" d file: +N_SIMULT_SPLITTERS splitparms.h 18;" d +N_WINDOWS polyphase.h 5;" d +P_FFT_LEN polyphase.h 6;" d +READTAPE_H readtape.h 10;" d +REAL fftw.h 73;" d +RECORDER_BUFFER_BYTES splitparms.h 44;" d +RECORDER_BUFFER_SAMPLES splitparms.h 45;" d +SAMPLES_PER_OBUF dotransform.cpp 32;" d file: +SAMPLES_PER_OBUF dotransform.h 17;" d +SAMPLES_PER_OBUF mb_dotransform.cpp 30;" d file: +SAMPLES_PER_OBUF mb_dotransform.h 15;" d +SAMPLES_PER_OBUF mb_polyphase.cpp 26;" d file: +SAMPLES_PER_OBUF polyphase.cpp 25;" d file: +SAMPLES_PER_OBUF polyphase.h 14;" d +SPLITPARMS_H splitparms.h 10;" d +SPLITTER coordcvt.cpp /^namespace SPLITTER {$/;" n file: +SPLITTER_H mb_splitter.h 11;" d +SPLITTER_H splitter.h 11;" d +SPLITTER_VERSION splitparms.h 16;" d +SPLITTYPES_H mb_splittypes.h 10;" d +SPLITTYPES_H splittypes.h 10;" d +SWAP four1.cpp 11;" d file: +SWAP four1.cpp 57;" d file: +TAPE_BUFFER_SIZE splitparms.h 37;" d +TAPE_DATA_SIZE splitparms.h 33;" d +TAPE_FRAMES_IN_BUFFER splitparms.h 39;" d +TAPE_FRAMES_PER_RECORD splitparms.h 34;" d +TAPE_FRAMES_PER_WU splitparms.h 40;" d +TAPE_FRAME_SIZE splitparms.h 35;" d +TAPE_HEADER_SIZE splitparms.h 32;" d +TAPE_RECORDS_IN_BUFFER splitparms.h 38;" d +TAPE_RECORD_SIZE splitparms.h 36;" d +TBUF_OFFSET dotransform.cpp 108;" d file: +TBUF_OFFSET dotransform.h 18;" d +TBUF_OFFSET mb_dotransform.h 16;" d +TBUF_OFFSET mb_polyphase.cpp 97;" d file: +TBUF_OFFSET polyphase.cpp 96;" d file: +TBUF_OFFSET polyphase.h 15;" d +USE_MYSQL mb_splitter.cpp 10;" d file: +USE_MYSQL mb_wufiles.cpp 10;" d file: +USE_MYSQL readtape.cpp 10;" d file: +USE_MYSQL splitter.cpp 10;" d file: +USE_MYSQL wufiles.cpp 10;" d file: +UTC splitparms.h 49;" d +WELCH polyphase.h 2;" d +WU_FILESIZE splitparms.h 24;" d +WU_OVERLAP_BYTES splitparms.h 43;" d +WU_OVERLAP_FRAMES splitparms.h 42;" d +WU_OVERLAP_RECORDS splitparms.h 41;" d +WU_SUBDIR splitparms.h 14;" d +alfa mb_splitter.cpp /^int alfa;$/;" v +angdist angdist.cpp /^double angdist(const SCOPE_STRING &a, const SCOPE_STRING &b) {$/;" f +angdist angdist.cpp /^double angdist(double r1, double d1, double r2, double d2) {$/;" f +angdist mb_angdist.cpp /^double angdist(const coordinate_t &a, const coordinate_t &b) {$/;" f +angdist mb_angdist.cpp /^double angdist(double r1, double d1, double r2, double d2) {$/;" f +app mb_splitter.cpp /^DB_APP app;$/;" v +app splitter.cpp /^DB_APP app;$/;" v +atnight mb_splitter.cpp /^int atnight;$/;" v +atnight splitter.cpp /^int atnight;$/;" v +beam mb_splitter.cpp /^int beam;$/;" v +bin_data mb_wufiles.cpp /^std::vector > bin_data;$/;" v +bin_data wufiles.cpp /^static std::vector bin_data[NSTRIPS];$/;" v file: +boinc_config mb_splitter.cpp /^SCHED_CONFIG boinc_config;$/;" v +boinc_config splitter.cpp /^SCHED_CONFIG boinc_config;$/;" v +buffer_pos mb_splittypes.h /^typedef struct buffer_pos {$/;" s +buffer_pos splittypes.h /^typedef struct buffer_pos {$/;" s +buffer_pos_t mb_splittypes.h /^} buffer_pos_t;$/;" t typeref:struct:buffer_pos +buffer_pos_t splittypes.h /^} buffer_pos_t;$/;" t typeref:struct:buffer_pos +byte splittypes.h /^ long byte;$/;" m struct:buffer_pos +c_im fftw.h 57;" d +c_re fftw.h 56;" d +cdesc fftw.h /^ const fftw_codelet_desc *cdesc;$/;" m struct:fftw_twiddle_struct +cdesc fftw.h /^ fftw_codelet_desc *cdesc;$/;" m struct:fftw_rader_data_struct +centerfreq mb_splittypes.h /^ double centerfreq,samplerate;$/;" m struct:tapeheader +centerfreq splittypes.h /^ double centerfreq,samplerate;$/;" m struct:tapeheader +check_for_halt mb_splitter.cpp /^int check_for_halt() {$/;" f +check_for_halt splitter.cpp /^int check_for_halt() {$/;" f +check_free_disk_space mb_splitter.cpp /^int check_free_disk_space() {$/;" f +check_free_disk_space splitter.cpp /^int check_free_disk_space() {$/;" f +cleanup mb_splitter.cpp /^void cleanup(void) {$/;" f +cleanup splitter.cpp /^void cleanup(void) {$/;" f +cmap_interp cmap_interp.cpp /^coordinate_t cmap_interp(std::map &map, seti_time &t) {$/;" f +codelet fftw.h /^ fftw_generic_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon8 +codelet fftw.h /^ fftw_hc2hc_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +codelet fftw.h /^ fftw_hc2real_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon11 +codelet fftw.h /^ fftw_notw_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon6 +codelet fftw.h /^ fftw_rader_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 +codelet fftw.h /^ fftw_real2hc_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon10 +codelet fftw.h /^ fftw_rgeneric_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 +codelet fftw.h /^ fftw_twiddle_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 +codelet fftw.h /^ void (*codelet) (); \/* pointer to the codelet itself *\/$/;" m struct:__anon4 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon10 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon11 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon6 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 +coord_history mb_splitter.cpp /^std::map coord_history;$/;" v +cost fftw.h /^ double cost;$/;" m struct:fftw_plan_struct +cprint mb_splitter.cpp /^void cprint(char *p) {$/;" f +cprint splitter.cpp /^void cprint(char *p) {$/;" f +current_record readtape.cpp /^int current_record;$/;" v +databuf dotransform.cpp /^float databuf[FFT_LEN*2];$/;" v +dataclass mb_splitter.cpp /^int dataclass;$/;" v +dataclass splitter.cpp /^int dataclass;$/;" v +dataseq mb_splittypes.h /^ unsigned long dataseq;$/;" m struct:tapeheader +dataseq splittypes.h /^ unsigned long dataseq;$/;" m struct:tapeheader +daynames writeheader.cpp /^char *daynames[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};$/;" v +delbuffer makebufs.cpp /^void delbuffer(void) {$/;" f +delbuffer_sig makebufs.cpp /^void delbuffer_sig(int i) {$/;" f +dir fftw.h /^ fftw_direction dir;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +dir fftw.h /^ fftw_direction dir;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 +dir fftw.h /^ fftw_direction dir; \/* direction *\/$/;" m struct:__anon4 +dir fftw.h /^ fftw_direction dir;$/;" m struct:__anon14 +dir fftw.h /^ fftw_direction dir;$/;" m struct:fftw_plan_struct +do_polyphase mb_polyphase.cpp /^void do_polyphase(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu) {$/;" f +do_polyphase polyphase.cpp /^void do_polyphase(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu) {$/;" f +do_transform dotransform.cpp /^void do_transform(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu) {$/;" f +do_transform mb_dotransform.cpp /^void do_transform(std::vector &tapebuffer) {$/;" f +end_of_wu mb_splitter.cpp /^buffer_pos_t start_of_wu,end_of_wu; \/* position of start and end of wu in$/;" v +end_of_wu splitter.cpp /^buffer_pos_t start_of_wu,end_of_wu; \/* position of start and end of wu in$/;" v +errorlog mb_splitter.cpp /^FILE *wulog,*errorlog;$/;" v +errorlog splitter.cpp /^FILE *wulog,*errorlog;$/;" v +f_data mb_polyphase.cpp /^float *f_data;$/;" v +f_data polyphase.cpp /^float *f_data;$/;" v +fftw_codelet_desc fftw.h /^} fftw_codelet_desc;$/;" t typeref:struct:__anon4 +fftw_complex fftw.h /^} fftw_complex;$/;" t typeref:struct:__anon1 +fftw_die_type_function fftw.h /^typedef void (*fftw_die_type_function) (const char *errString);$/;" t +fftw_direction fftw.h /^} fftw_direction;$/;" t typeref:enum:__anon2 +fftw_free_type_function fftw.h /^typedef void (*fftw_free_type_function) (void *p);$/;" t +fftw_generic_codelet fftw.h /^typedef void (fftw_generic_codelet) $/;" t +fftw_hc2hc_codelet fftw.h /^typedef void (fftw_hc2hc_codelet)$/;" t +fftw_hc2real_codelet fftw.h /^typedef void (fftw_hc2real_codelet)$/;" t +fftw_malloc_type_function fftw.h /^typedef void *(*fftw_malloc_type_function) (size_t n);$/;" t +fftw_node_type fftw.h /^enum fftw_node_type {$/;" g +fftw_notw_codelet fftw.h /^typedef void (fftw_notw_codelet) $/;" t +fftw_plan fftw.h /^typedef struct fftw_plan_struct *fftw_plan;$/;" t typeref:struct:fftw_plan_struct +fftw_plan_node fftw.h /^} fftw_plan_node;$/;" t typeref:struct:fftw_plan_node_struct +fftw_plan_node_struct fftw.h /^typedef struct fftw_plan_node_struct {$/;" s +fftw_plan_struct fftw.h /^struct fftw_plan_struct {$/;" s +fftw_rader_codelet fftw.h /^typedef void (fftw_rader_codelet) $/;" t +fftw_rader_data fftw.h /^} fftw_rader_data;$/;" t typeref:struct:fftw_rader_data_struct +fftw_rader_data_struct fftw.h /^typedef struct fftw_rader_data_struct {$/;" s +fftw_real fftw.h /^typedef double fftw_real;$/;" t +fftw_real fftw.h /^typedef float fftw_real;$/;" t +fftw_real2hc_codelet fftw.h /^typedef void (fftw_real2hc_codelet)$/;" t +fftw_rgeneric_codelet fftw.h /^typedef void (fftw_rgeneric_codelet)$/;" t +fftw_status fftw.h /^} fftw_status;$/;" t typeref:enum:__anon3 +fftw_twiddle fftw.h /^} fftw_twiddle;$/;" t typeref:struct:fftw_twiddle_struct +fftw_twiddle_codelet fftw.h /^typedef void (fftw_twiddle_codelet)$/;" t +fftw_twiddle_struct fftw.h /^typedef struct fftw_twiddle_struct {$/;" s +fftwnd_data fftw.h /^} fftwnd_data;$/;" t typeref:struct:__anon14 +fftwnd_plan fftw.h /^typedef fftwnd_data *fftwnd_plan;$/;" t +filecopy mb_wufiles.cpp /^int filecopy(char *oldname,char *newname) {$/;" f +filecopy wufiles.cpp /^int filecopy(char *oldname,char *newname) {$/;" f +fill_tape_buffer readtape.cpp /^int fill_tape_buffer(unsigned char *buffer, int n_records) {$/;" f +filter_i mb_polyphase.cpp /^double *filter_r, *filter_i;$/;" v +filter_i polyphase.cpp /^double *filter_r, *filter_i;$/;" v +filter_r mb_polyphase.cpp /^double *filter_r, *filter_i;$/;" v +filter_r polyphase.cpp /^double *filter_r, *filter_i;$/;" v +filter_window mb_splitter.cpp /^int filter_window = 0;$/;" v +filter_window splitter.cpp /^int filter_window = 0;$/;" v +flags fftw.h /^ int flags;$/;" m struct:fftw_plan_struct +flags fftw.h /^ int p, flags, refcount;$/;" m struct:fftw_rader_data_struct +four1 four1.cpp /^void four1(float data[], unsigned long nn, int isign) {$/;" f +frame mb_splittypes.h /^ int frame;$/;" m struct:buffer_pos +frame splittypes.h /^ int frame;$/;" m struct:buffer_pos +frameseq mb_splittypes.h /^ unsigned long frameseq;$/;" m struct:tapeheader +frameseq splittypes.h /^ unsigned long frameseq;$/;" m struct:tapeheader +g fftw.h /^ int g, ginv;$/;" m struct:fftw_rader_data_struct +generic fftw.h /^ } generic;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon8 +get_last_block db_fns.cpp /^int get_last_block(tapeheader_t *tapeheader) {$/;" f +ginv fftw.h /^ int g, ginv;$/;" m struct:fftw_rader_data_struct +gregorian mb_splitter.cpp /^int gregorian;$/;" v +gregorian splitter.cpp /^int gregorian;$/;" v +hc2hc fftw.h /^ } hc2hc;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon12 +hc2real fftw.h /^ } hc2real;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon11 +header randomdata.cpp /^char header[HEADER_SIZE];$/;" v +header squarewave.cpp /^char header[HEADER_SIZE];$/;" v +horz_to_equatorial coordcvt.cpp /^void horz_to_equatorial(double alt, double azimuth, double lsthour,$/;" f namespace:SPLITTER +hr_min_sec hr_min_sec.cpp /^char* hr_min_sec (double x) {$/;" f +im fftw.h /^ fftw_real re, im;$/;" m struct:__anon1 +is_in_place fftw.h /^ int is_in_place; \/* 1 if for in-place FFTs, 0 otherwise *\/$/;" m struct:__anon14 +is_tape readtape.cpp /^int is_tape;$/;" v +iters mb_splitter.cpp /^int iters=-1;$/;" v +iters splitter.cpp /^int iters=-1;$/;" v +jd_to_lmst coordcvt.cpp /^double jd_to_lmst(double jd, double longitude) {$/;" f namespace:SPLITTER +key mb_splitter.cpp /^R_RSA_PRIVATE_KEY key;$/;" v +key splitter.cpp /^R_RSA_PRIVATE_KEY key;$/;" v +main mb_splitter.cpp /^int main(int argc, char *argv[]) {$/;" f +main randomdata.cpp /^int main(void) {$/;" f +main splitter.cpp /^int main(int argc, char *argv[]) {$/;" f +main squarewave.cpp /^int main(void) {$/;" f +make_FIR mb_polyphase.cpp /^void make_FIR (int n_points, int M, int window, double *output) {$/;" f +make_FIR polyphase.cpp /^void make_FIR (int n_points, int M, int window, double *output) {$/;" f +make_wu_headers mb_wufiles.cpp /^int make_wu_headers(std::vector &tapebuffer, telescope_id$/;" f +make_wu_headers wufiles.cpp /^int make_wu_headers(tapeheader_t tapeheader[],workunit wuheader[],$/;" f +makebuffers makebufs.cpp /^void makebuffers(unsigned char **tapebuffer) {$/;" f +max_wus_ondisk mb_splitter.cpp /^int max_wus_ondisk=MAX_WUS_ONDISK;$/;" v +max_wus_ondisk splitter.cpp /^int max_wus_ondisk=MAX_WUS_ONDISK;$/;" v +message mb_message.cpp /^void message(char *msg) {$/;" f +message message.cpp /^void message(char *msg) {$/;" f +minvfsbuf mb_splitter.cpp /^unsigned long minvfsbuf=-1;$/;" v +minvfsbuf splitter.cpp /^unsigned long minvfsbuf=-1;$/;" v +missed mb_splittypes.h /^ int missed;$/;" m struct:tapeheader +missed splittypes.h /^ int missed;$/;" m struct:tapeheader +monthnames writeheader.cpp /^char *monthnames[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"$/;" v +n fftw.h /^ int *n; \/*$/;" m struct:__anon14 +n fftw.h /^ int n;$/;" m struct:fftw_plan_struct +n fftw.h /^ int n;$/;" m struct:fftw_twiddle_struct +n_after fftw.h /^ int *n_after; \/* n_after[i] = product of n[j] for j > i *\/$/;" m struct:__anon14 +n_before fftw.h /^ int *n_before; \/*$/;" m struct:__anon14 +name fftw.h /^ const char *name; \/* name of the codelet *\/$/;" m struct:__anon4 +name mb_splittypes.h /^ char name[36];$/;" m struct:tapeheader +name splittypes.h /^ char name[36];$/;" m struct:tapeheader +nbuffers fftw.h /^ int nbuffers, nwork;$/;" m struct:__anon14 +next fftw.h /^ struct fftw_plan_struct *next;$/;" m struct:fftw_plan_struct typeref:struct:fftw_plan_struct::fftw_plan_struct +next fftw.h /^ struct fftw_rader_data_struct *next;$/;" m struct:fftw_rader_data_struct typeref:struct:fftw_rader_data_struct::fftw_rader_data_struct +next fftw.h /^ struct fftw_twiddle_struct *next;$/;" m struct:fftw_twiddle_struct typeref:struct:fftw_twiddle_struct::fftw_twiddle_struct +nodb mb_splitter.cpp /^int nodb;$/;" v +nodb splitter.cpp /^int nodb;$/;" v +nodeu fftw.h /^ } nodeu;$/;" m struct:fftw_plan_node_struct typeref:union:fftw_plan_node_struct::__anon5 +noencode mb_splitter.cpp /^int noencode;$/;" v +noencode splitter.cpp /^int noencode;$/;" v +norewind mb_splitter.cpp /^int norewind;$/;" v +norewind splitter.cpp /^int norewind;$/;" v +notw fftw.h /^ } notw;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon6 +ntwiddle fftw.h /^ int ntwiddle; \/* number of twiddle factors *\/$/;" m struct:__anon4 +numdiskbufs mb_splittypes.h /^ int numdiskbufs;$/;" m struct:tapeheader +numdiskbufs splittypes.h /^ int numdiskbufs;$/;" m struct:tapeheader +numringbufs mb_splittypes.h /^ int numringbufs;$/;" m struct:tapeheader +numringbufs splittypes.h /^ int numringbufs;$/;" m struct:tapeheader +nwork fftw.h /^ int nbuffers, nwork;$/;" m struct:__anon14 +obuf_pos dotransform.cpp /^int obuf_pos; \/* Tracks current postition in the output buffers *\/$/;" v +obuf_pos mb_dotransform.cpp /^int obuf_pos; \/* Tracks current postition in the output buffers *\/$/;" v +offset mb_splittypes.h /^ long offset;$/;" m struct:buffer_pos +omega fftw.h /^ fftw_complex *omega;$/;" m struct:fftw_rader_data_struct +open_tape_device readtape.cpp /^int open_tape_device(char *device) {$/;" f +output_buf dotransform.cpp /^unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; $/;" v +output_samples dotransform.cpp /^void output_samples(float *data, int i, int buf_pos) {$/;" f +output_samples mb_dotransform.cpp /^void output_samples(float *data, int i, int buf_pos) {$/;" f +output_xml mb_splitter.cpp /^int output_xml;$/;" v +output_xml splitter.cpp /^int output_xml;$/;" v +p fftw.h /^ int p, flags, refcount;$/;" m struct:fftw_rader_data_struct +parse_tape_headers readheader.cpp /^int parse_tape_headers(unsigned char *tapebuffer, tapeheader_t *tapeheaders) {$/;" f +plan fftw.h /^ struct fftw_plan_struct *plan;$/;" m struct:fftw_rader_data_struct typeref:struct:fftw_rader_data_struct::fftw_plan_struct +plans fftw.h /^ fftw_plan *plans; \/* 1d fftw plans for each dimension *\/$/;" m struct:__anon14 +pol mb_splitter.cpp /^int pol;$/;" v +polyphase mb_splitter.cpp /^int polyphase;$/;" v +polyphase splitter.cpp /^int polyphase;$/;" v +polyphase_seg mb_polyphase.cpp /^void polyphase_seg(float* data) {$/;" f +polyphase_seg polyphase.cpp /^void polyphase_seg(float* data) {$/;" f +process_command_line mb_splitter.cpp /^int process_command_line(int argc, char *argv[],char **tape_device,$/;" f +process_command_line splitter.cpp /^int process_command_line(int argc, char *argv[],char **tape_device,$/;" f +process_seg dotransform.cpp /^void process_seg(float* data) {$/;" f +process_seg mb_dotransform.cpp /^void process_seg(std::vector > &data,int offset) {$/;" f +projectdir mb_splitter.cpp /^char * projectdir = NULL;$/;" v +projectdir splitter.cpp /^char * projectdir = NULL;$/;" v +rader fftw.h /^ } rader;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon9 +rader_data fftw.h /^ fftw_rader_data *rader_data;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 +randn mb_dotransform.cpp /^float randn() {$/;" f +randu mb_dotransform.cpp /^float randu() {$/;" f +rank fftw.h /^ int rank; \/* $/;" m struct:__anon14 +rcdtype mb_splittypes.h /^ int rcdtype;$/;" m struct:tapeheader +rcdtype splittypes.h /^ int rcdtype;$/;" m struct:tapeheader +rcvr mb_splitter.cpp /^receiver_config rcvr;$/;" v +re fftw.h /^ fftw_real re, im;$/;" m struct:__anon1 +read_checkpoint readtape.cpp /^int read_checkpoint() {$/;" f +read_tape_header readheader.cpp /^int read_tape_header(char *buffer, tapeheader_t *header)$/;" f +real2hc fftw.h /^ } real2hc;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon10 +records_in_buffer splitter.cpp /^int records_in_buffer;$/;" v +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 typeref:struct:fftw_plan_node_struct::__anon5::__anon12::fftw_plan_node_struct +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 typeref:struct:fftw_plan_node_struct::__anon5::__anon13::fftw_plan_node_struct +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 typeref:struct:fftw_plan_node_struct::__anon5::__anon7::fftw_plan_node_struct +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon8 typeref:struct:fftw_plan_node_struct::__anon5::__anon8::fftw_plan_node_struct +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 typeref:struct:fftw_plan_node_struct::__anon5::__anon9::fftw_plan_node_struct +refcnt fftw.h /^ int refcnt;$/;" m struct:fftw_plan_node_struct +refcnt fftw.h /^ int refcnt;$/;" m struct:fftw_plan_struct +refcnt fftw.h /^ int refcnt;$/;" m struct:fftw_twiddle_struct +refcount fftw.h /^ int p, flags, refcount;$/;" m struct:fftw_rader_data_struct +rename_wu_files mb_wufiles.cpp /^void rename_wu_files() {$/;" f +rename_wu_files wufiles.cpp /^void rename_wu_files() {$/;" f +result_template mb_splitter.cpp /^const char *result_template=$/;" v +result_template splitter.cpp /^const char *result_template=$/;" v +result_template_filename mb_splitter.cpp /^char result_template_filename[1024];$/;" v +result_template_filename splitter.cpp /^char result_template_filename[1024];$/;" v +result_template_filename_id mb_splitter.cpp /^const char *result_template_filename_id = "result_0.xml";$/;" v +result_template_filename_id splitter.cpp /^const char *result_template_filename_id = "result_0.xml";$/;" v +result_template_filepath mb_splitter.cpp /^char result_template_filepath[1024];$/;" v +result_template_filepath splitter.cpp /^char result_template_filepath[1024];$/;" v +resumetape mb_splitter.cpp /^int resumetape;$/;" v +resumetape splitter.cpp /^int resumetape;$/;" v +rgeneric fftw.h /^ } rgeneric;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon13 +root fftw.h /^ fftw_plan_node *root;$/;" m struct:fftw_plan_struct +sah_config mb_splitter.cpp /^APP_CONFIG sah_config;$/;" v +sah_config splitter.cpp /^APP_CONFIG sah_config;$/;" v +samplerate mb_splittypes.h /^ double centerfreq,samplerate;$/;" m struct:tapeheader +samplerate splittypes.h /^ double centerfreq,samplerate;$/;" m struct:tapeheader +select_record readtape.cpp /^int select_record(int record_number) {$/;" f +seqno mb_splitter.cpp /^int seqno;$/;" v +seqno splitter.cpp /^int seqno;$/;" v +signature fftw.h /^ int signature; \/* unique id *\/$/;" m struct:__anon4 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon10 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon11 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon6 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon8 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 +size fftw.h /^ int size; \/* size of the codelet *\/$/;" m struct:__anon4 +source mb_splittypes.h /^ int source;$/;" m struct:tapeheader +source splittypes.h /^ int source;$/;" m struct:tapeheader +splitter_bits_to_float dotransform.cpp /^void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) {$/;" f +splitter_bits_to_float mb_dotransform.cpp /^void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) {$/;" f +splitter_encode encode.cpp /^void splitter_encode(unsigned char *bin, int nbytes, FILE *f) {$/;" f +splitter_settings mb_splitter.cpp /^settings splitter_settings;$/;" v +st mb_splittypes.h /^ TIME st;$/;" m struct:tapeheader +st splittypes.h /^ TIME st;$/;" m struct:tapeheader +start_of_wu mb_splitter.cpp /^buffer_pos_t start_of_wu,end_of_wu; \/* position of start and end of wu in$/;" v +start_of_wu splitter.cpp /^buffer_pos_t start_of_wu,end_of_wu; \/* position of start and end of wu in$/;" v +start_time mb_splitter.cpp /^double start_time;$/;" v +start_time splitter.cpp /^double start_time;$/;" v +startblock mb_splitter.cpp /^int startblock;$/;" v +startblock splitter.cpp /^int startblock;$/;" v +stop_time mb_splitter.cpp /^double stop_time;$/;" v +stop_time splitter.cpp /^double stop_time;$/;" v +tape_busy readtape.cpp /^int tape_busy() {$/;" f +tape_eject readtape.cpp /^int tape_eject() {$/;" f +tape_fd readtape.cpp /^static int tape_fd;$/;" v file: +tape_info readtape.cpp /^static tape tape_info;$/;" v file: +tape_read_record readtape.cpp /^int tape_read_record(char *buffer) {$/;" f +tape_rewind readtape.cpp /^int tape_rewind() {$/;" f +tape_status readtape.cpp /^struct mtget tape_status;$/;" v typeref:struct:mtget +tape_struct db_fns.cpp /^static tape tape_struct;$/;" v file: +tapebuffd makebufs.cpp /^int tapebuffd;$/;" v +tapebuffer mb_splitter.cpp /^std::vector tapebuffer;$/;" v +tapebuffer splitter.cpp /^unsigned char *tapebuffer; \/* A buffer for a tape section *\/$/;" v +tapebufname makebufs.cpp /^char tapebufname[30];$/;" v +tapeheader mb_splittypes.h /^typedef struct tapeheader {$/;" s +tapeheader splittypes.h /^typedef struct tapeheader {$/;" s +tapeheader_t mb_splittypes.h /^} tapeheader_t;$/;" t typeref:struct:tapeheader +tapeheader_t splittypes.h /^} tapeheader_t;$/;" t typeref:struct:tapeheader +tapeheaders splitter.cpp /^tapeheader_t tapeheaders[TAPE_FRAMES_IN_BUFFER];$/;" v +telstr mb_splittypes.h /^ SCOPE_STRING telstr;$/;" m struct:tapeheader +telstr splittypes.h /^ SCOPE_STRING telstr;$/;" m struct:tapeheader +telstr_coord_convert coordcvt.cpp /^void telstr_coord_convert(SCOPE_STRING *telstr, double lat, double lon) {$/;" f +trigger_file_path mb_splitter.cpp /^char trigger_file_path[1024]="\/disks\/setifiler1\/wutape\/tapedir\/splitter_stop";$/;" v +trigger_file_path splitter.cpp /^char trigger_file_path[1024]="\/disks\/setifiler1\/wutape\/tapedir\/splitter_stop";$/;" v +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon8 +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 +twarray fftw.h /^ fftw_complex *twarray;$/;" m struct:fftw_twiddle_struct +twiddle fftw.h /^ } twiddle;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon7 +twiddle_order fftw.h /^ const int *twiddle_order; \/* $/;" m struct:__anon4 +type fftw.h /^ enum fftw_node_type type; \/* TWIDDLE or NO_TWIDDLE *\/$/;" m struct:__anon4 typeref:enum:__anon4::fftw_node_type +type fftw.h /^ enum fftw_node_type type;$/;" m struct:fftw_plan_node_struct typeref:enum:fftw_plan_node_struct::fftw_node_type +update_checkpoint readtape.cpp /^static void update_checkpoint() {$/;" f file: +useanalysiscfgid mb_splitter.cpp /^int useanalysiscfgid = 0;$/;" v +usereceivercfgid mb_splitter.cpp /^int usereceivercfgid = 0;$/;" v +userecordercfgid mb_splitter.cpp /^int userecordercfgid = 0;$/;" v +usesplittercfgid mb_splitter.cpp /^int usesplittercfgid = 0;$/;" v +valid_run mb_validrun.cpp /^bool valid_run(std::vector &tapebuffer) {$/;" f +valid_run validrun.cpp /^int valid_run(tapeheader_t tapeheader[],buffer_pos_t *start_of_wu, $/;" f +version mb_splittypes.h /^ char version[16];$/;" m struct:tapeheader +version splittypes.h /^ char version[16];$/;" m struct:tapeheader +wait_for_db_wus_ondisk mb_splitter.cpp /^int wait_for_db_wus_ondisk() {$/;" f +wait_for_db_wus_ondisk splitter.cpp /^int wait_for_db_wus_ondisk() {$/;" f +wait_until_night mb_splitter.cpp /^int wait_until_night() {$/;" f +wait_until_night splitter.cpp /^int wait_until_night() {$/;" f +wd mb_splitter.cpp /^char wd[1024];$/;" v +wd splitter.cpp /^char wd[1024];$/;" v +wisdom_signature fftw.h /^ int wisdom_signature;$/;" m struct:fftw_plan_struct +wisdom_type fftw.h /^ enum fftw_node_type wisdom_type;$/;" m struct:fftw_plan_struct typeref:enum:fftw_plan_struct::fftw_node_type +work fftw.h /^ fftw_complex *work; \/* $/;" m struct:__anon14 +write_tape_header writeheader.cpp /^int write_tape_header(char *buffer, tapeheader_t *header) {$/;" f +write_wufile_blocks mb_wufiles.cpp /^void write_wufile_blocks(int nbytes) {$/;" f +write_wufile_blocks wufiles.cpp /^void write_wufile_blocks(int nbytes) {$/;" f +wu_database_id mb_wufiles.cpp /^std::vector wu_database_id;$/;" v +wu_database_id wufiles.cpp /^int wu_database_id[NSTRIPS];$/;" v +wu_template mb_splitter.cpp /^const char *wu_template=$/;" v +wu_template splitter.cpp /^const char *wu_template=$/;" v +wu_template_filename mb_splitter.cpp /^char wu_template_filename[1024];$/;" v +wu_template_filename splitter.cpp /^char wu_template_filename[1024];$/;" v +wu_template_filename_id mb_splitter.cpp /^const char *wu_template_filename_id = "wu_0.xml";$/;" v +wu_template_filename_id splitter.cpp /^const char *wu_template_filename_id = "wu_0.xml";$/;" v +wuheaders mb_splitter.cpp /^std::vector wuheaders;$/;" v +wuheaders splitter.cpp /^workunit wuheaders[NSTRIPS];$/;" v +wulog mb_splitter.cpp /^FILE *wulog,*errorlog;$/;" v +wulog splitter.cpp /^FILE *wulog,*errorlog;$/;" v diff --git a/gbt_splitter/tools/disksplitter b/gbt_splitter/tools/disksplitter new file mode 100755 index 0000000..a4bc323 --- /dev/null +++ b/gbt_splitter/tools/disksplitter @@ -0,0 +1,121 @@ +#! /bin/tcsh -x + +set PATH=/opt/misc:/opt/misc/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/openwin/bin/xview:/usr/lang:/usr/ucb:/bin:/usr/bin:/usr/local/bin:/usr/hosts:/usr/bin/X11:/usr/casual/sparc:/usr/etc:/usr/local/lib/tex/bin:/usr/local/lib/frame/bin:/disks/asimov/a/apps/informix/bin:.:/disks/albert/d/office/bin:/usr/ucb:/disks/albert/e/users/eurd/data_analysis/bin:/usr/local/lib/g++-include.bak:/disks/siren/a/users/seti/s4/siren/bin:/disks/albert/d/orfeus:/disks/albert/d/chips:/disks/asimov/a/apps/informix/bin:/usr/local/tex +# export PATH +set LD_LIBRARY_PATH=/usr/lib/X11:/usr/openwin/lib:/usr/lib:/lib:/disks/islay/a/users/korpela/bin/lib:/disks/asimov/a/apps/informix/lib:/disks/asimov/a/apps/informix/lib/esql +# export LD_LIBRARY_PATH +set INFORMIXDIR=/disks/asimov/a/apps/informix +# export INFORMIXDIR +set INFORMIXSERVER=ejk_tcp +# export INFORMIXSERVER + +set SPLIT_PROG_LOC=/disks/milkyway/a/users/anderson/seti/splitter/bin/ +set SPLIT_PROG_NAME=splitter +set SPLIT_LOG_LOC=/disks/milkyway/a/users/anderson/seti/sethi/hi_tape_logs/ +# set HI_TAPE_DIR=/disks/philmor/a/users/eheien/hitest/ +set SPLIT_TAPE_DIR=/disks/setifiler1/wutape/tapedir/ +set SPLIT_SUFFIX=.split +set HIDONE_SUFFIX=.hidone +set SPLITDONE_SUFFIX=.splitdone +set EMAIL_LIST="jeffc@ssl.berkeley.edu mattl@ssl.berkeley.edu" +set FOUND_FILE=0 +set HOST=`hostname` +set SPLIT_HALT_MSG=splitter_stop + +# Check to see if this machine is already running the splitter program +set PROG_RUNNING=`/usr/ucb/ps -auxww | grep "$SPLIT_PROG_NAME" | grep -v "disksplitter" | wc | awk '{print $1}'` +echo "$PROG_RUNNING" +if( $PROG_RUNNING > 1 ) then + echo "Splitter is already running on this machine. Quitting." + exit +endif + +# Get rid of all .split files here with HOSTNAME in them(?) + +while ( ! -f $SPLIT_TAPE_DIR$SPLIT_HALT_MSG ) + +set FOUND_FILE=0 +cd $SPLIT_TAPE_DIR + +set FILE_LIST=`ls . | grep ".tape" | grep -v "done" | grep -v "reading" | grep -v "hi" | grep -v "msg" | grep -v "split"` + +if( -z "$FILE_LIST" ) then + exit +endif + +foreach file ($FILE_LIST) + if ( $FOUND_FILE == 0 && ! -f $file$SPLITDONE_SUFFIX ) then + if( -f $file$SPLIT_SUFFIX ) then + set FOUND_FILE=0 + else + echo $HOST > $file$SPLIT_SUFFIX + set TAPE_FILE=$file + set SPLIT_FILE=$SPLIT_TAPE_DIR$file + set SPLIT_MARK_FILE=$SPLIT_TAPE_DIR$file$SPLIT_SUFFIX + set HI_DONE_FILE=$SPLIT_TAPE_DIR$file$HIDONE_SUFFIX + set SPLIT_DONE_FILE=$SPLIT_TAPE_DIR$file$SPLITDONE_SUFFIX + set FOUND_FILE=1 + endif + endif +end + +cd /mydisks/a/servers/splitter/ +/bin/rm -f error.log rcd.chk +touch error.log +touch rcd.chk + +if ( $FOUND_FILE == 0 ) then +# echo "" | /usr/ucb/mail -s"no more splitter tape files" $EMAIL_LIST + exit +else + if( -f /disks/milkyway/a/users/anderson/seti/watchdogs/go_spliiter ) then + /bin/rm -f wu_inbox/.* +#set START_MSG=`echo "Splitter is starting on tape" $SPLIT_FILE "on" $HOST` + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" splitter starting" $EMAIL_LIST + /bin/nice $SPLIT_PROG_LOC$SPLIT_PROG_NAME $SPLIT_FILE $1 -resume >>& splitterlog + set TEMP=`grep -i "end" error.log` + if( "$TEMP" != "" ) then + sleep 60 # wait for it to finish moving the files from wu_inbox + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" splitter finished" $EMAIL_LIST + /bin/rm -f error.log rcd.chk + /bin/rm -f wu_inbox/.* + /bin/rm -f $SPLIT_MARK_FILE + if( -f $HI_DONE_FILE ) then + /bin/rm -f $HI_DONE_FILE + /bin/rm -f `cd $SPLIT_TAPE_DIR; ls -l | grep $TAPE_FILE | awk '{print $NF}'` + /bin/rm -f $SPLIT_FILE + else + touch -f $SPLIT_DONE_FILE + endif + endif + /bin/rm -f $SPLIT_MARK_FILE + exit + else + /bin/rm -f $SPLIT_MARK_FILE + exit + endif +endif + +#if ( 0 == 1 ) then +# if ( grep -i done hi_log ) then +# cat error.log rcd.chk | /usr/ucb/mail -s"end of tape on $HOST" $EMAIL_LIST +# touch $HI_FILE$HIDONE_SUFFIX +# if ( -f $HI_FILE$HIDONE_SUFFIX ) then +# unlink $SPLITFILE +# fi +# unlink .$SPLITFILE +# /bin/rm error.log rcd.chk +# /bin/rm wu_inbox/.* +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +#else +# if [ -f $MARKER$HOST ] +# then +# /bin/rm wu_inbox/.* +# cat error.log rcd.chk | /usr/ucb/mail -s"restarting HI analysis on $HOST" $EMAIL_LIST +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +# else +# cat error.log rcd.chk | /usr/ucb/mail -s"hi analysis disabled on $HOST" $EMAIL_LIST +# fi +#endif +end + diff --git a/gbt_splitter/tools/sah_splitter.sh b/gbt_splitter/tools/sah_splitter.sh new file mode 100755 index 0000000..2ff1d34 --- /dev/null +++ b/gbt_splitter/tools/sah_splitter.sh @@ -0,0 +1,150 @@ +#! /bin/sh +PATH=/opt/misc:/opt/misc/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/openwin/bin/xview:/usr/lang:/usr/ucb:/bin:/usr/bin:/usr/local/bin:/usr/hosts:/usr/bin/X11:/usr/casual/sparc:/usr/etc:/usr/local/lib/tex/bin:/usr/local/lib/frame/bin:/disks/asimov/a/apps/informix/bin:.:/disks/albert/d/office/bin:/usr/ucb:/disks/albert/e/users/eurd/data_analysis/bin:/usr/local/lib/g++-include.bak:/disks/siren/a/users/seti/s4/siren/bin:/disks/albert/d/orfeus:/disks/albert/d/chips:/disks/asimov/a/apps/informix/bin:/usr/local/tex +export PATH +LD_LIBRARY_PATH=/lib:/disks/asimov/a/apps/informix/lib:/disks/asimov/a/apps/informix/lib/esql::/usr/ucblib:/lib:/usr/lib:/usr/openwin/lib:/usr/ccs/lib:/usr/local/gcc/lib:/disks/asimov/a/lang/gnu/H-sparc-sun-solaris2/lib:/opt/misc/lib:/usr/local/lib:/disks/ellie/a/users/korpela/lib:/usr/dt/lib +export LD_LIBRARY_PATH +INFORMIXDIR=/disks/asimov/a/apps/informix/ +export INFORMIXDIR +INFORMIXSERVER=ejk_tcp +export INFORMIXSERVER +S4_RECEIVER_CONFIG=/usr/local/warez/projects/s4/siren/db/ReceiverConfig.tab +export S4_RECEIVER_CONFIG + +PROJECTDIR=/disks/koloth/a/inet_services/boinc_www/share/projects/sah +SPLIT_PROG_LOC=${PROJECTDIR}/bin/ +SPLIT_PROG_NAME=sah_splitter +SPLIT_TAPE_DIR=/disks/setifiler1/wutape/tapedir/seti_boinc_public/ +SPLIT_SUFFIX=.split +#HIDONE_SUFFIX=.hidone +SPLITDONE_SUFFIX=.splitdone +EMAIL_LIST="korpela@ssl.berkeley.edu jeffc@ssl.berkeley.edu mattl@ssl.berkeley.edu davea@ssl.berkeley.edu" +FOUND_FILE=0 +HOST=`hostname` +SPLIT_HALT_MSG=splitter_stop + +# Check to see if this machine is already running the splitter program +PROG_RUNNING=`/usr/ucb/ps -auxww | grep "$SPLIT_PROG_NAME " | grep -v grep` +if [ ! -z "$PROG_RUNNING" ] +then + echo "Splitter is already running on this machine. Quitting." + exit 1 +fi + +# Get rid of all .split files here with HOSTNAME in them(?) + +TAPE_FILE= + +# get list of all tapes in the sah classic tape directory +cd $SPLIT_TAPE_DIR/.. +FILE_LIST=`ls *.tape` + +cd $SPLIT_TAPE_DIR + +# if no sah classic tapes then bail +if [ -z "$FILE_LIST" ] +then + exit 2 +fi + +# for each sah classic tape... +for file in $FILE_LIST +do + # if we have already split it... + if [ -f $file$SPLITDONE_SUFFIX ] + then + # ... then remove it ("it" being a hard link upward into the sah classic dir) + if [ -f $file ] + then + /bin/rm $file + fi + else + # if we are in the process of splitting it... + if [ -f $file$SPLIT_SUFFIX ] + then + # and are splitting it from this host... (this logic prevents one host from repeating another host's tape) + if grep $HOST $file$SPLIT_SUFFIX + then + # trigger to restart the split + /bin/rm $file$SPLIT_SUFFIX + fi + fi + # if a restart or a brand new tape... + if [ ! -f $file$SPLIT_SUFFIX ] + then + # claim it for this host (there is certainly a race condition here) + echo $HOST > $file$SPLIT_SUFFIX + ln ../$file + TAPE_FILE=$file + SPLIT_FILE=$SPLIT_TAPE_DIR$file + SPLIT_MARK_FILE=$SPLIT_TAPE_DIR$file$SPLIT_SUFFIX +# HI_DONE_FILE=$SPLIT_TAPE_DIR$file$HIDONE_SUFFIX + SPLIT_DONE_FILE=$SPLIT_TAPE_DIR$file$SPLITDONE_SUFFIX + break + fi + fi +done + +cd /tmp/splitter/sah +if [ ! -d splitter ] +then + mkdir splitter +fi +cd splitter +if [ ! -d wu_inbox ] +then + mkdir wu_inbox +fi +/bin/rm -f error.log rcd.chk +touch error.log +touch rcd.chk + +if [ -z "$TAPE_FILE" ] +then + exit 3 +else + /bin/rm -f wu_inbox/.* + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" boinc_splitter starting" $EMAIL_LIST + /bin/nice $SPLIT_PROG_LOC$SPLIT_PROG_NAME $SPLIT_FILE $* -resume -projectdir=$PROJECTDIR + if grep -i "end" error.log >/dev/null 2>&1 + then + /bin/nice $SPLIT_PROG_LOC$SPLIT_PROG_NAME $SPLIT_FILE $* -resume -projectdir=$PROJECTDIR + fi + if grep -i "end" error.log >/dev/null 2>&1 + then + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" boinc_splitter finished" $EMAIL_LIST + /bin/rm -f error.log rcd.chk + /bin/rm -f wu_inbox/.* + /bin/rm -f $SPLIT_MARK_FILE + /bin/rm -f `cd $SPLIT_TAPE_DIR; ls -l | grep $TAPE_FILE | awk '{print $NF}'` + /bin/rm -f $SPLIT_FILE + touch -f $SPLIT_DONE_FILE + exit + else + /bin/rm -f $SPLIT_MARK_FILE + exit 4 + fi +fi + +#if ( 0 == 1 ) then +# if ( grep -i done hi_log ) then +# cat error.log rcd.chk | /usr/ucb/mail -s"end of tape on $HOST" $EMAIL_LIST +# touch $HI_FILE$HIDONE_SUFFIX +# if ( -f $HI_FILE$HIDONE_SUFFIX ) then +# unlink $SPLITFILE +# fi +# unlink .$SPLITFILE +# /bin/rm error.log rcd.chk +# /bin/rm wu_inbox/.* +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +#else +# if [ -f $MARKER$HOST ] +# then +# /bin/rm wu_inbox/.* +# cat error.log rcd.chk | /usr/ucb/mail -s"restarting HI analysis on $HOST" $EMAIL_LIST +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +# else +# cat error.log rcd.chk | /usr/ucb/mail -s"hi analysis disabled on $HOST" $EMAIL_LIST +# fi +#endif +end + diff --git a/gbt_splitter/uttolst.h b/gbt_splitter/uttolst.h new file mode 100644 index 0000000..8f29efb --- /dev/null +++ b/gbt_splitter/uttolst.h @@ -0,0 +1,2 @@ +double tm_UtToLst(double ddtime, double longitude, + long mon, long day, long year); diff --git a/gbt_splitter/validrun.cpp b/gbt_splitter/validrun.cpp new file mode 100644 index 0000000..45d3854 --- /dev/null +++ b/gbt_splitter/validrun.cpp @@ -0,0 +1,181 @@ +/* + * validrun.c + * + * Functions for determining if a section of the tape buffer can be + * turned into a valid work unit + * + * $Id: validrun.cpp,v 1.2.4.2 2006/12/14 22:24:48 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "message.h" + + +int valid_run(tapeheader_t tapeheader[],buffer_pos_t *start_of_wu, + buffer_pos_t *end_of_wu) { + + int i=0,valid=1; + SCOPE_STRING *first_telstr; + double first_telstr_time=0; + double first_jd=tapeheader[0].st.jd; + char tmpstr[256]; + + /* find the first telstr that refers to valid data */ + + do { + first_telstr=&(tapeheader[++i].telstr); + first_telstr_time=first_telstr->st.jd; + } while ((first_telstr_time<=first_jd) && (iframe=1+WU_OVERLAP_FRAMES; + end_of_wu->byte=0; + return(0); + } + + /* find the correct byte offset for the start of the work unit */ + + start_of_wu->frame=i; + start_of_wu->byte=(long)((tapeheader[i].telstr.st.jd-tapeheader[i].st.jd)*86400.0*tapeheader[i].samplerate*2/CHAR_BIT); + start_of_wu->byte &= 0xfffffffe; + + + while (start_of_wu->byte<0) { + start_of_wu->frame--; + start_of_wu->byte+=TAPE_DATA_SIZE; + } + + while (start_of_wu->byte>TAPE_DATA_SIZE) { + start_of_wu->frame++; + start_of_wu->byte-=TAPE_DATA_SIZE; + } + + if (start_of_wu->frame<0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Missing telescope strings near %lu\n", + tapeheader[0].frameseq); + end_of_wu->frame=0; + end_of_wu->byte=0; + records_in_buffer=0; + return(0); + } + + if ((start_of_wu->frame+TAPE_FRAMES_PER_WU)>TAPE_FRAMES_IN_BUFFER) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Missing telescope strings near %lu\n", + tapeheader[0].frameseq); + end_of_wu->frame=0; + end_of_wu->byte=0; + records_in_buffer=0; + return(0); + } + + /* check for frames in error */ + for (i=0; iframe+i; + // missed frames + if (tapeheader[j].missed) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Missing frames between %lu and %lu\n", + tapeheader[j-1].frameseq,tapeheader[j].frameseq); + valid=0; + } + // failed blanking signal acquisition + if (tapeheader[j].blanking_failed) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Failed blanking between frames %lu and %lu\n", + tapeheader[j-1].frameseq,tapeheader[j].frameseq); + valid=0; + } + if(!valid) { + end_of_wu->frame=j+WU_OVERLAP_FRAMES+1; + end_of_wu->byte=0; + assert((j+WU_OVERLAP_FRAMES)<=TAPE_FRAMES_IN_BUFFER); + } + } + + if (!valid) { + end_of_wu->frame=0; + records_in_buffer=0; + return(valid); + } + + end_of_wu->frame=start_of_wu->frame+TAPE_FRAMES_PER_WU; + end_of_wu->byte=start_of_wu->byte; + + return(valid); +} + + +/* + * $Log: validrun.cpp,v $ + * Revision 1.2.4.2 2006/12/14 22:24:48 korpela + * *** empty log message *** + * + * Revision 1.2.4.1 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:57 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:23:43 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.6 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.4 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.3 1999/02/11 16:46:28 korpela + * Added checkpointing. + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.3 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.2 1998/10/27 00:59:22 korpela + * Bug fixes. + * + * Revision 1.1 1998/10/22 17:48:20 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/validrun.h b/gbt_splitter/validrun.h new file mode 100644 index 0000000..89f7c6d --- /dev/null +++ b/gbt_splitter/validrun.h @@ -0,0 +1,33 @@ +/* + * validrun.h + * + * Functions for determining if a section of the tape buffer can be + * turned into a valid work unit + * + * $Id: validrun.h,v 1.1 2003/06/03 00:23:43 korpela Exp $ + * + */ + +int valid_run(tapeheader_t tapeheader[],buffer_pos_t *start_of_wu, + buffer_pos_t *end_of_wu); + +/* + * $Log: validrun.h,v $ + * Revision 1.1 2003/06/03 00:23:43 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/22 17:49:15 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/writeheader.cpp b/gbt_splitter/writeheader.cpp new file mode 100644 index 0000000..89296c3 --- /dev/null +++ b/gbt_splitter/writeheader.cpp @@ -0,0 +1,105 @@ +/* + * Functions for writing tape and work unit headers + * + * $Id: writeheader.cpp,v 1.3.4.1 2006/12/14 22:24:49 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "timecvt.h" +#include "seti_header.h" + +extern int output_xml; + +/* Write a tape header into a buffer */ +int write_tape_header(char *buffer, tapeheader_t *header) { +/* Unimplemented as yet */ +return(0); +} + +char *monthnames[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep" + "Oct","Nov","Dec"}; +char *daynames[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; + +/* Write a work unit header into a FILE */ +/*int splitter_write_wu_header(FILE *file, wuheader_t *header) { + if (!output_xml) + write_wu_header(file, header->wuhead); + return (seti_write_wu_header(file,header->wuinfo,output_xml)); + +} +*/ + +/* + * $Log: writeheader.cpp,v $ + * Revision 1.3.4.1 2006/12/14 22:24:49 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:44 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:59 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:18 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:43 korpela + * + * Again + * + * Revision 3.1 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.6 1999/01/04 22:27:55 korpela + * Updated return codes. + * + * Revision 2.5 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.4 1998/11/09 23:26:27 korpela + * Added generic version= to default header. + * + * Revision 2.3 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.2 1998/11/02 18:42:03 korpela + * Changed write_wu_header to call seti_write_wu_header + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Will be transfered to client. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.4 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.3 1998/10/27 00:59:43 korpela + * Bug fixes. + * / + * + * Revision 1.2 1998/10/20 16:32:03 korpela + * Fixed syntax error. + * + * Revision 1.1 1998/10/20 16:27:41 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/writeheader.h b/gbt_splitter/writeheader.h new file mode 100644 index 0000000..c3d6d4a --- /dev/null +++ b/gbt_splitter/writeheader.h @@ -0,0 +1,39 @@ +/* + * Functions for writing tape and work unit headers + * + * $Id: writeheader.h,v 1.2 2003/08/05 17:23:44 korpela Exp $ + * + */ + +/* Write a tape header into a buffer */ +int write_tape_header(char *buffer, tapeheader_t *header); + +/* Write a work unit header into a FILE */ +// int splitter_write_wu_header(FILE *file, wuheader_t *header); + +/* + * $Log: writeheader.h,v $ + * Revision 1.2 2003/08/05 17:23:44 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 1999/01/04 22:27:55 korpela + * Updated return codes. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/15 17:20:01 korpela + * Initial revision + * + */ diff --git a/gbt_splitter/wufiles.cpp b/gbt_splitter/wufiles.cpp new file mode 100644 index 0000000..d8663ce --- /dev/null +++ b/gbt_splitter/wufiles.cpp @@ -0,0 +1,679 @@ +/* + * + * Functions for managing wufiles and their data + * + * $Id: wufiles.cpp,v 1.29.2.18 2007/08/10 18:21:13 korpela Exp $ + * + */ + +#include "sah_config.h" +#undef USE_MYSQL +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_ERRNO_H +#include +#endif + +#include "boinc_db.h" +#include "sched_util.h" +#include "splitparms.h" +#include "splittypes.h" +#include "timecvt.h" +#include "s_util.h" +#include "util.h" +#include "str_util.h" +#include "str_replace.h" +#include "splitter.h" +#include "writeheader.h" +#include "message.h" +#include "encode.h" +#include "dotransform.h" +#include "angdist.h" +#include "lcgamm.h" +#include "readtape.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "seti_tel.h" +#include "seti_cfg.h" +#include "xml_util.h" +#include "db/app_config.h" +#include "str_util.h" +#include + +int wu_database_id[NSTRIPS]; +static std::vector bin_data[NSTRIPS]; + +extern APP_CONFIG sah_config; + +int make_wu_headers(tapeheader_t tapeheader[],workunit wuheader[], + buffer_pos_t *start_of_wu) { + int procid=getpid(); + int i,j,startframe=start_of_wu->frame; + double receiver_freq; + int bandno; + SCOPE_STRING *lastpos; + FILE *tmpfile; + char tmpstr[256]; + char buf[64]; + static int HaveConfigTable=0; + static ReceiverConfig_t ReceiverConfig; + static receiver_config r; + static settings s; + + if(!HaveConfigTable) { + sprintf(buf,"where s4_id=%d",gregorian?AOGREG_1420:AO_1420); + r.fetch(std::string(buf)); + ReceiverConfig.ReceiverID=r.s4_id; + strlcpy(ReceiverConfig.ReceiverName,r.name, + sizeof(ReceiverConfig.ReceiverName)); + ReceiverConfig.Latitude=r.latitude; + ReceiverConfig.Longitude=r.longitude; + ReceiverConfig.WLongitude=-r.longitude; + ReceiverConfig.Elevation=r.elevation; + ReceiverConfig.Diameter=r.diameter; + ReceiverConfig.BeamWidth=r.beam_width; + ReceiverConfig.CenterFreq=r.center_freq; + ReceiverConfig.AzOrientation=r.az_orientation; + for (i=0;i<(sizeof(ReceiverConfig.ZenCorrCoeff)/sizeof(ReceiverConfig.ZenCorrCoeff[0]));i++) { + ReceiverConfig.ZenCorrCoeff[i]=r.zen_corr_coeff[i]; + ReceiverConfig.AzCorrCoeff[i]=r.az_corr_coeff[i]; + } + HaveConfigTable=1; + } + sprintf(buf,"where active=%d",app.id); + if (!s.fetch(std::string(buf))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to find active settings for app.id=%d\n",app.id); + exit(1); + } + if (s.receiver_cfg->id != r.id) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Receiver config does not match settings (%d != %d)\n",s.receiver_cfg->id, r.id); + exit(1); + } + s.recorder_cfg->fetch(); + s.splitter_cfg->fetch(); + s.analysis_cfg->fetch(); + if (!strncmp(s.splitter_cfg->data_type,"encoded", + std::min(static_cast(7),sizeof(s.splitter_cfg->data_type)))) { + noencode=0; + } else { + noencode=1; + } + + workunit_grp wugrp; + sprintf(wugrp.name,"%s.%ld.%d.%ld.%d",tapeheader[startframe].name, + procid, + (current_record-TAPE_RECORDS_IN_BUFFER)*8+startframe, + start_of_wu->byte,s.id); + wugrp.receiver_cfg=r; + wugrp.recorder_cfg=s.recorder_cfg; + wugrp.splitter_cfg=s.splitter_cfg; + wugrp.analysis_cfg=s.analysis_cfg; + + wugrp.data_desc.start_ra=tapeheader[startframe+1].telstr.ra; + wugrp.data_desc.start_dec=tapeheader[startframe+1].telstr.dec; + wugrp.data_desc.end_ra=tapeheader[startframe+TAPE_FRAMES_PER_WU].telstr.ra; + wugrp.data_desc.end_dec=tapeheader[startframe+TAPE_FRAMES_PER_WU].telstr.dec; + wugrp.data_desc.nsamples=NSAMPLES; + wugrp.data_desc.true_angle_range=0; + { + double sample_rate=tapeheader[startframe].samplerate/NSTRIPS; + /* startframe+1 contains the first valid RA and Dec */ + TIME st=tapeheader[startframe+1].telstr.st; + TIME et=tapeheader[startframe+TAPE_FRAMES_PER_WU].telstr.st; + double diff=(et-st).jd*86400.0; + for (j=2;j(13*1024)) ||(keyuniq<12*1024)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Invalid keyuniq value!\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%d %d %f\n",keyuniq,s.analysis_cfg.id,wugrp.data_desc.true_angle_range); + exit(1); + } + + keyuniq*=-1; + long save_keyuniq=keyuniq; + s.analysis_cfg=wugrp.analysis_cfg; + sprintf(tmpstr,"where keyuniq=%d",keyuniq); + // Check if we've already done this analysis_config... + s.analysis_cfg.id=0; + s.analysis_cfg->fetch(tmpstr); + + if (s.analysis_cfg->id==0) { + if (keyuniq != save_keyuniq) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"keyuniq value changed!\n"); + exit(1); + } + + // If not calculate the thresholds based upon the input analysis_config + // Triplets are distributed exponentially... + wugrp.analysis_cfg->triplet_thresh+=(log(numtrip)-29.0652); + + // Gaussians are based upon chisqr... + double p_gauss=lcgf(32.0,wugrp.analysis_cfg->gauss_null_chi_sq_thresh*32.0); + p_gauss-=(log(numgauss)-19.5358); + wugrp.analysis_cfg->gauss_null_chi_sq_thresh=invert_lcgf(p_gauss,32,1e-4)*0.03125; + + // Pulses thresholds are log of the probability + wugrp.analysis_cfg->pulse_thresh+=(log(numpulse)-24.7894); + + wugrp.analysis_cfg->keyuniq=keyuniq; + wugrp.analysis_cfg->insert(); + } else { + wugrp.analysis_cfg=s.analysis_cfg; + } + + strlcpy(wugrp.data_desc.time_recorded, + short_jd_string(tapeheader[startframe+1].telstr.st.jd), + sizeof(wugrp.data_desc.time_recorded)); + wugrp.data_desc.time_recorded_jd=tapeheader[startframe+1].telstr.st.jd; + + lastpos=&(tapeheader[startframe].telstr); + coordinate_t tmpcoord; + tmpcoord.time=tapeheader[startframe].telstr.st.jd; + tmpcoord.ra=tapeheader[startframe].telstr.ra; + tmpcoord.dec=tapeheader[startframe].telstr.dec; + wugrp.data_desc.coords.push_back(tmpcoord); + + for (j=1;jst.jd) > (1.0/86400.0)) + { + lastpos=&(tapeheader[startframe+j].telstr); + tmpcoord.time=tapeheader[startframe+j].telstr.st.jd; + tmpcoord.ra=tapeheader[startframe+j].telstr.ra; + tmpcoord.dec=tapeheader[startframe+j].telstr.dec; + wugrp.data_desc.coords.push_back(tmpcoord); + } + } + + wugrp.tape_info->id=0; + wugrp.tape_info->fetch(std::string("where name=\'")+tapeheader[startframe].name+"\'"); + wugrp.tape_info->start_time=tapeheader[startframe].st.jd; + wugrp.tape_info->last_block_time=tapeheader[startframe].st.jd; + wugrp.tape_info->last_block_done=tapeheader[startframe].frameseq; + + if (!nodb) { + if (wugrp.tape_info.id) { + if (!(wugrp.tape_info->update())) { + char buf[1024]; + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s",sql_error_message()); + exit(1); + } + } else { + strlcpy(wugrp.tape_info->name,tapeheader[startframe].name,sizeof(wugrp.tape_info->name)); + wugrp.tape_info->insert(); + } + } + + if (!nodb) wugrp.insert(); + + for (i=0;ibyte,s.id,i); + wuheader[i].subband_desc.sample_rate=tapeheader[startframe].samplerate/NSTRIPS; + + receiver_freq=tapeheader[startframe].centerfreq; + + bandno=((i+NSTRIPS/2)%NSTRIPS)-NSTRIPS/2; + + wuheader[i].subband_desc.base=receiver_freq+ + (double)(bandno)*wuheader[i].subband_desc.sample_rate; + wuheader[i].subband_desc.center=receiver_freq+wuheader[i].subband_desc.sample_rate*NSTRIPS*((double)IFFT_LEN*bandno/FFT_LEN+(double)IFFT_LEN/(2*FFT_LEN)-1.0/(2*FFT_LEN)); + wuheader[i].subband_desc.number=i; + + if (!nodb ) { + if (!(wu_database_id[i]=wuheader[i].insert())) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Database error in make_wu_headers()\n"); + exit(EXIT_FAILURE); + } + } + + sprintf(tmpstr,"./wu_inbox/%s",wuheader[i].name); + if ((tmpfile=fopen(tmpstr,"w"))) { + fprintf(tmpfile,"\n"); + fprintf(tmpfile,wuheader[i].print_xml().c_str()); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to open file ./wu_inbox/%s, errno=%d\n",wuheader[i].name,errno); + exit(1); + } + bin_data[i].reserve(wuheaders[i].group_info->recorder_cfg->bits_per_sample* + wuheaders[i].group_info->data_desc.nsamples/8); + } + return(1); +} + + +void write_wufile_blocks(int nbytes) { + static bool first_call=true; + int i,j; + + + for (i=0;i0); + fclose(oldfile); + fclose(newfile); + return 0; + } else { + return 1; + } +} + + + +void rename_wu_files() { + int i, retval; + char oldname[256],newname[1024]; + unsigned long sz; + DB_WORKUNIT db_wu; + const char *name[1]; + char *wudir="./wu_inbox"; + xml_encoding encoding=(noencode?_binary:_x_setiathome); + FILE *tmpfile; + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Fatal error in boinc_db.open\n"); + exit(1); + } + + for (i=0;i",tmpstr.size(), + xml_encoding_names[encoding]); + fwrite(tmpstr.c_str(),tmpstr.size(),1,tmpfile); + fprintf(tmpfile,"\n"); + fprintf(tmpfile,"\n"); + sz=bin_data[i].size(); + + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Header file no longer exists! splitter start script may be failing\n "); + exit(1); + } + if (!nodb) { + if (!filecopy(oldname,newname)) { + db_wu.clear(); + db_wu.opaque=wuheaders[i].id; + strncpy(db_wu.name,name[0],sizeof(db_wu.name)-2); + db_wu.appid=app.id; + //db_wu.rsc_fpops_est=2.79248e+13*6; + //db_wu.rsc_fpops_bound=4.46797e+14*6; + double ar=wuheaders[i].group_info->data_desc.true_angle_range; + double dur=(double)(wuheaders[i].group_info->data_desc.nsamples)/wuheaders[i].subband_desc.sample_rate; + double min_slew=wuheaders[i].group_info->analysis_cfg->pot_min_slew; + double max_slew=wuheaders[i].group_info->analysis_cfg->pot_max_slew; + if ( ar < ( dur*min_slew )/2 ) { + db_wu.rsc_fpops_est=4.95e+13; + } else { + if ( ar < ( dur*min_slew ) ) { + db_wu.rsc_fpops_est=(2.85e+13+2.0e+14*ar); + } else { + if ( ar <= (dur*max_slew) ) { + db_wu.rsc_fpops_est=(2.22e+13/pow(ar,1.25)); + } else { + db_wu.rsc_fpops_est=1.125e+13; + } + } + } + db_wu.rsc_fpops_bound=db_wu.rsc_fpops_est*10; + db_wu.rsc_memory_bound=32505856; + db_wu.rsc_disk_bound=500000; + // Our minimum is 10% of a 100 MFLOP machine + db_wu.delay_bound=db_wu.rsc_fpops_est/3e+7; + db_wu.min_quorum=sah_config.min_quorum; + db_wu.target_nresults=sah_config.target_nresults; + db_wu.max_error_results=sah_config.max_error_results; + db_wu.max_total_results=sah_config.max_total_results; + db_wu.max_success_results=sah_config.max_success_results; + strncpy(db_wu.app_name,SAH_APP_NAME,sizeof(db_wu.app_name)-2); + if (create_work(db_wu, + wu_template, + result_template_filename, + result_template_filepath, + name, + 1, + boinc_config, + NULL + ) + ) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"create work failed\n"); + exit(1); + } + //unlink(oldname); // we now *always* unlink + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"file copy failed\n"); + exit(1); + } + unlink(oldname); + } + } + boinc_db.close(); +} + +/* + * $Log: wufiles.cpp,v $ + * Revision 1.29.2.18 2007/08/10 18:21:13 korpela + * *** empty log message *** + * + * Revision 1.29.2.17 2007/06/07 20:01:52 mattl + * *** empty log message *** + * + * Revision 1.29.2.16 2007/06/06 15:58:30 korpela + * *** empty log message *** + * + * Revision 1.29.2.15 2006/12/14 22:24:49 korpela + * *** empty log message *** + * + * Revision 1.29.2.14 2006/05/03 19:14:31 korpela + * Updated work estimates. + * + * Revision 1.29.2.13 2006/04/24 18:41:02 korpela + * *** empty log message *** + * + * Revision 1.29.2.12 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.29.2.11 2006/01/10 00:39:04 jeffc + * *** empty log message *** + * + * Revision 1.29.2.10 2006/01/05 23:55:22 korpela + * *** empty log message *** + * + * Revision 1.29.2.9 2005/12/05 22:11:40 korpela + * Fixed bug in flops estimate. + * + * Revision 1.29.2.8 2005/10/05 16:22:17 jeffc + * removed reference to old/new boolean for directory hash. + * + * Revision 1.29.2.7 2005/09/22 23:05:22 korpela + * Fixed threshold calculation. Was using chisqr rather than reduced chisqr. + * + * Revision 1.29.2.6 2005/09/21 22:11:23 korpela + * Updated Makefile.in for OpenSSL. + * Added dynamic threshold generation to wufiles.cpp. + * + * Revision 1.29.2.5 2005/08/01 17:47:38 korpela + * Type fixed. + * + * Revision 1.29.2.4 2005/08/01 17:43:20 korpela + * Refinement of FLOPS estimate for workunits. + * + * Revision 1.29.2.3 2005/07/26 17:17:01 korpela + * Typo fix + * + * Revision 1.29.2.2 2005/07/19 00:15:19 korpela + * Revised delay bound and FLOP estimate for setiathome_enhanced. + * + * Revision 1.29.2.1 2005/07/06 01:30:17 korpela + * Updated estimates of FPOPS per workunit for setiathome enhanced. + * + * Revision 1.29 2005/03/08 22:36:15 jeffc + * jeffc - fixed call to create_work() + * + * Revision 1.28 2005/02/15 23:06:47 korpela + * Fixed missing dir_hier symbol. + * + * Revision 1.27 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.26 2004/11/18 22:24:48 korpela + * *** empty log message *** + * + * Revision 1.25 2004/08/25 22:42:11 jeffc + * *** empty log message *** + * + * Revision 1.24 2004/08/14 04:44:26 jeffc + * *** empty log message *** + * + * Revision 1.23 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.22 2004/07/15 17:54:20 jeffc + * *** empty log message *** + * + * Revision 1.21 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/07/01 17:56:51 korpela + * *** empty log message *** + * + * Revision 1.19 2004/06/25 13:49:33 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/02 20:51:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/01/22 00:57:54 korpela + * *** empty log message *** + * + * Revision 1.14 2004/01/20 22:33:44 korpela + * *** empty log message *** + * + * Revision 1.13 2004/01/06 22:44:05 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/12 01:51:39 korpela + * Now using the opaque field in workunit to store SAH wuid. + * + * Revision 1.10 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.9 2003/11/25 21:59:53 korpela + * *** empty log message *** + * + * Revision 1.8 2003/11/11 06:20:30 korpela + * Increased max fpops_max to prevent timeout on windows clients + * + * Revision 1.7 2003/10/25 18:19:44 korpela + * *** empty log message *** + * + * Revision 1.6 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.3.2.2 2003/09/22 19:00:31 korpela + * *** empty log message *** + * + * Revision 1.3.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.4 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:44 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:36:00 korpela + * + * renames .C files to .cpp + * + * Revision 1.3 2003/06/05 15:52:47 korpela + * + * Fixed coordinate bug that was using the wrong zenith angle from the telescope + * strings when handling units from the gregorian. + * + * Revision 1.2 2003/06/03 01:01:18 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.8 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.7 2003/04/10 17:32:25 korpela + * *** empty log message *** + * + * Revision 3.6 2002/06/21 01:42:15 eheien + * *** empty log message *** + * + * Revision 3.5 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.4 2001/08/17 22:20:54 korpela + * *** empty log message *** + * + * Revision 3.3 2001/08/17 01:22:31 korpela + * *** empty log message *** + * + * Revision 3.2 2001/08/17 01:16:53 korpela + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.18 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.17 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.16 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.15 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.14 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.13 1999/02/11 16:46:28 korpela + * Added db access functions. + * + * Revision 2.12 1999/01/04 22:27:55 korpela + * Updated return codes. + * + * Revision 2.11 1998/12/14 23:41:44 korpela + * Added subband_base to work unit header. + * Changed frequency calculation. + * + * Revision 2.10 1998/12/14 21:55:07 korpela + * Added fft_len and ifft_len to work unit header. + * + * Revision 2.9 1998/11/13 23:58:52 korpela + * Modified for move of name field between structures. + * + * Revision 2.8 1998/11/13 22:18:12 davea + * *** empty log message *** + * + * Revision 2.7 1998/11/10 01:55:26 korpela + * Server requires a CR at the end of a WU file + * ??? + * + * Revision 2.6 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.5 1998/11/05 21:33:02 korpela + * Fixed angle_range bug. + * + * Revision 2.4 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.3 1998/11/02 21:20:58 korpela + * Modified for (internal) integer receiver ID. + * + * Revision 2.2 1998/11/02 18:45:39 korpela + * Changed location of timecvt.h + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 01:01:16 korpela + * Initial revision + * + * + */ diff --git a/gbt_splitter/wufiles.h b/gbt_splitter/wufiles.h new file mode 100644 index 0000000..046c378 --- /dev/null +++ b/gbt_splitter/wufiles.h @@ -0,0 +1,39 @@ +/* + * + * Functions for managing wufiles and their data + * + * $Id: wufiles.h,v 1.2 2003/08/05 17:23:45 korpela Exp $ + * + */ + + + +int make_wu_headers(tapeheader_t tapeheader[],workunit wuheaders[], + buffer_pos_t *start_of_wu) ; +void write_wufile_blocks(int nbytes) ; +void rename_wu_files(); + +/* + * $Log: wufiles.h,v $ + * Revision 1.2 2003/08/05 17:23:45 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:13:16 korpela + * Initial revision + * + * + */ diff --git a/hosts.make b/hosts.make new file mode 100644 index 0000000..fac8adc --- /dev/null +++ b/hosts.make @@ -0,0 +1,2 @@ +BOINCDIR = /disks/ellie/a/users/korpela/boinc + diff --git a/image_libs/Makefile b/image_libs/Makefile new file mode 100644 index 0000000..a09375e --- /dev/null +++ b/image_libs/Makefile @@ -0,0 +1,13 @@ + +subdir = image_libs + +SUFFIXES = .cpp .h + +all: Makefile + +clean: + rm -f *.o + +distclean: clean + -rm -f Makefile + diff --git a/image_libs/Makefile.in b/image_libs/Makefile.in new file mode 100644 index 0000000..a09375e --- /dev/null +++ b/image_libs/Makefile.in @@ -0,0 +1,13 @@ + +subdir = image_libs + +SUFFIXES = .cpp .h + +all: Makefile + +clean: + rm -f *.o + +distclean: clean + -rm -f Makefile + diff --git a/image_libs/bmplib.cpp b/image_libs/bmplib.cpp new file mode 100644 index 0000000..cf41d76 --- /dev/null +++ b/image_libs/bmplib.cpp @@ -0,0 +1,188 @@ +#include + +#ifdef _WIN32 +#include "windows.h" +#endif + +#include "bmplib.h" + +// Returns true for success -- false otherwise +bool DIB_BITMAP::set_size(int width, int height, int channels) +{ + + // If DIB_BITMAP has already been set -- clear it out first + FreeDIB_BMP(); + + // Create a temporary compatible device context + HDC temp_hdc = CreateCompatibleDC(NULL); + + // Error Check + if(!temp_hdc) + return false; + + bmp_width = width; // Set the width + bmp_height = height; // Set the height + bmp_channels = channels; // Set the channels (3 == 24-bit, 4 == 32-bit) + + // Set stride -- The stride is the TRUE number of bytes in a line of pixels + // Windows makes all the .bmps DWORD aligned (divisible evenly by 4) + // So if you bitmap say was 103x103 pixels, Windows would add 1 "padding byte" to it + // so in memory it would be 104x103 pixels. The "padding bytes" do not get blit (drawn) + // to the screen, they're just there so again everything is DWORD aligned which makes + // blitting (drawing to the screen) easier for the OS + bmp_stride = bmp_width * bmp_channels; + + while((bmp_stride % 4) != 0) // Ensure bmp_stride is DWORD aligned + bmp_stride++; + + BITMAPINFO bmp_info = {0}; + + // Initialize the parameters that we care about + bmp_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmp_info.bmiHeader.biWidth = width; + bmp_info.bmiHeader.biHeight = height; + bmp_info.bmiHeader.biPlanes = 1; // Always equal 1 + bmp_info.bmiHeader.biBitCount = channels * 8; + bmp_info.bmiHeader.biCompression = BI_RGB; // No compression + bmp_info.bmiHeader.biClrUsed = 0; // Always equals 0 with a 24 or 32-bit .bmp + + // Create a DIBSection -- This returns us two things, an HBITMAP handle and + // a memory pointer (pointer to the pixels) in surface_bits + hbitmap = CreateDIBSection(temp_hdc, &bmp_info, DIB_RGB_COLORS, + (void**)&surface_bits, 0, 0); + + // Release our temporary HDC + DeleteDC(temp_hdc); + + // Error Check -- Make sure the call to CreateDIBSection() DID NOT fail + if(!hbitmap) + return false; + + return true; // We're sized :) + +} // end of set_size(int width, int height, int channels) + +bool DIB_BITMAP::loadBMP(const char *file_name) +{ + // If DIB_BITMAP has already been set -- clear it out first + FreeDIB_BMP(); + + // Error Check -- Make sure they passed in a valid file name + if(!file_name) + return false; + + FILE *bmp_file = fopen(file_name, "rb"); + + // Error Check -- Make sure the file could be opened + if(!bmp_file) + return false; + + BITMAPFILEHEADER bmp_fileheader; + + // Read the BITMAPFILEHEADER + if(!fread(&bmp_fileheader, sizeof(BITMAPFILEHEADER), 1, bmp_file)) + { + fclose(bmp_file); + return false; + } + + // Check the type field to make sure we have a .bmp file + if(memcmp(&bmp_fileheader.bfType, "BM", 2)) + { + fclose(bmp_file); + return false; + } + + BITMAPINFOHEADER bmp_infoheader; + + // Read the BITMAPINFOHEADER. + if(!fread(&bmp_infoheader, sizeof(BITMAPINFOHEADER), 1, bmp_file)) + { + fclose(bmp_file); + return false; + } + + // We only support 24-bit and 32-bit .bmps so make sure that's what we have + if((bmp_infoheader.biBitCount != 24) && (bmp_infoheader.biBitCount != 32)) + { + fclose(bmp_file); + return false; + } + + // Set the size of our DIB_BITMAP, once we do this we're ready to store the pixel + // data in it + if(set_size(bmp_infoheader.biWidth,bmp_infoheader.biHeight,bmp_infoheader.biBitCount / 8) == false) + { + fclose(bmp_file); + return false; + } + + // Jump to the location where the pixel data is stored + if(fseek(bmp_file, bmp_fileheader.bfOffBits, SEEK_SET)) + { + fclose(bmp_file); + return false; + } + + unsigned int bytesPerLine = bmp_width * bmp_channels; // Bytes per line (number of bytes + // in a scan line) + + // Calculate how many "padding" bytes there are -- WE DO NOT want to read in the + // padding bytes (we will just skip over those) + // **Remember** Windows adds padding bytes to ensure ALL .bmps are DWORD aligned + // (divisible evenly by 4) + unsigned int padding = bmp_stride - bytesPerLine; + + // Loop over all the scan lines (all the rows of pixels in the image) + for(int y = bmp_height-1; y >= 0; y--) + { + // Get the "current" line pointer + uchar *LinePtr = getLinePtr(y); + + // Read the precise number of bytes that the scan line requires into the bitmap + if(!fread(LinePtr, bytesPerLine, 1, bmp_file)) + { + fclose(bmp_file); + return false; + } + + // Skip over any padding bytes. + if(fseek(bmp_file, padding, SEEK_CUR)) + { + fclose(bmp_file); + return false; + } + + } // end of for (int y = 0; y < bmp_infoheader.biHeight; y++) + + + fclose(bmp_file); + return true; // If we get here .bmp was read in successfully + +} // end of loadBMP(char *file_name, HDC hdc) + +// Returns the address in memory of the specified line. This gives you a pointer to at least +// width * channels bytes. Lines are numbered such that when the bitmap +// is displayed line zero is at the top. +uchar* DIB_BITMAP::getLinePtr(int which_line) +{ + return (surface_bits + bmp_stride * which_line); +} + +// Release the memory +void DIB_BITMAP::FreeDIB_BMP() +{ + // If we created an HBITMAP, delete it + if(hbitmap) + DeleteObject(hbitmap); + + // Zero out all data associated with DIB_BITMAP + hbitmap = NULL; + surface_bits = NULL; + bmp_width = bmp_height = bmp_channels = bmp_stride = 0; + return; +} + +// Deconstructor +DIB_BITMAP::~DIB_BITMAP() { FreeDIB_BMP(); } + diff --git a/image_libs/bmplib.h b/image_libs/bmplib.h new file mode 100644 index 0000000..02385dd --- /dev/null +++ b/image_libs/bmplib.h @@ -0,0 +1,57 @@ +#ifndef BITMAP_CLASS_H +#define BITMAP_CLASS_H + +typedef unsigned char uchar; // We're lazy so typedef "unsigned char" as "uchar" + +// We will use this class to load 24 and 32-bit .bmp for us +class DIB_BITMAP +{ + public: + + // Constructor() -- Zero's out DIB_BITMAP + DIB_BITMAP():hbitmap(NULL),surface_bits(NULL),bmp_width(0),bmp_height(0), + bmp_channels(0),bmp_stride(0) { GdiFlush(); /* Guarantee that writing to + DIB_BITMAP is okay */ } + + // Data Access Functions ************ + + inline int get_width() const { return bmp_width; } + inline int get_height() const { return bmp_height; } + inline int get_channels() const { return bmp_channels; } + inline int get_stride() const { return bmp_stride; } + + // ****** End of Data Access Functions + + // Creates a "empty" DIB_BITMAP with the "traits" of the parameters passed in + // Returns true for success -- false otherwise + // If set_size is called on a DIB_BITMAP that already has memory associated with it + // that memory is freed and the new size is implemented + bool set_size(int width, int height, int channels); + + // Loads a bmp with specified file_name -- Returns true on success, false otherwise + // If loadBMP() is called on a DIB_BITMAP that already has memory associated with + // it, that memory is freed and the .bmp is loaded + bool loadBMP(const char *file_name); + + uchar* getLinePtr(int which_line); // returns a pointer to the line passed in + + // Deconstructor(); + ~DIB_BITMAP(); + + + private: + + int bmp_width; // The width of the bitmap + int bmp_height; // The height of the bitmap + int bmp_channels; // How many channels is the bitmap (3 == 24-bit, 4 == 32-bit) + int bmp_stride; // The TRUE number of bytes in a scan line (in a line of pixels + // in memory) + + HBITMAP hbitmap; // This will be the handle to our bitmap + + uchar *surface_bits; // This is a pointer to the actual pixels of the bitmap + + void FreeDIB_BMP(); // Frees all memory associated with DIB_BITMAP +}; + +#endif diff --git a/image_libs/tgalib.cpp b/image_libs/tgalib.cpp new file mode 100644 index 0000000..8f1f81d --- /dev/null +++ b/image_libs/tgalib.cpp @@ -0,0 +1,239 @@ + + +#include "tgalib.h" + +tImageTGA *LoadTGA(const char *filename) +{ + tImageTGA *pImageData = NULL; // This stores our important image data + WORD width = 0, height = 0; // The dimensions of the image + byte length = 0; // The length in bytes to the pixels + byte imageType = 0; // The image type (RLE, RGB, Alpha...) + byte bits = 0; // The bits per pixel for the image (16, 24, 32) + FILE *pFile = NULL; // The file pointer + int channels = 0; // The channels of the image (3 = RGA : 4 = RGBA) + int stride = 0; // The stride (channels * width) + int i = 0; // A counter + + // This function loads in a TARGA (.TGA) file and returns its data to be + // used as a texture or what have you. This currently loads in a 16, 24 + // and 32-bit targa file, along with RLE compressed files. Eventually you + // will want to do more error checking to make it more robust. This is + // also a perfect start to go into a modular class for an engine. + // Basically, how it works is, you read in the header information, then + // move your file pointer to the pixel data. Before reading in the pixel + // data, we check to see the if it's an RLE compressed image. This is because + // we will handle it different. If it isn't compressed, then we need another + // check to see if we need to convert it from 16-bit to 24 bit. 24-bit and + // 32-bit textures are very similar, so there's no need to do anything special. + // We do, however, read in an extra bit for each color. + + // Open a file pointer to the targa file and check if it was found and opened + if((pFile = fopen(filename, "rb")) == NULL) + { + return NULL; + } + + // Allocate the structure that will hold our eventual image data (must free it!) + pImageData = (tImageTGA*)malloc(sizeof(tImageTGA)); + + // Read in the length in bytes from the header to the pixel data + fread(&length, sizeof(byte), 1, pFile); + + // Jump over one byte + fseek(pFile,1,SEEK_CUR); + + // Read in the imageType (RLE, RGB, etc...) + fread(&imageType, sizeof(byte), 1, pFile); + + // Skip past general information we don't care about + fseek(pFile, 9, SEEK_CUR); + + // Read the width, height and bits per pixel (16, 24 or 32) + fread(&width, sizeof(WORD), 1, pFile); + fread(&height, sizeof(WORD), 1, pFile); + fread(&bits, sizeof(byte), 1, pFile); + + // Now we move the file pointer to the pixel data + fseek(pFile, length + 1, SEEK_CUR); + + // Check if the image is RLE compressed or not + if(imageType != TGA_RLE) + { + // Check if the image is a 24 or 32-bit image + if(bits == 24 || bits == 32) + { + // Calculate the channels (3 or 4) - (use bits >> 3 for more speed). + // Next, we calculate the stride and allocate enough memory for the pixels. + channels = bits / 8; + stride = channels * width; + pImageData->data = new unsigned char[stride * height]; + + // Load in all the pixel data line by line + for(int y = 0; y < height; y++) + { + // Store a pointer to the current line of pixels + unsigned char *pLine = &(pImageData->data[stride * y]); + + // Read in the current line of pixels + fread(pLine, stride, 1, pFile); + + // Go through all of the pixels and swap the B and R values since TGA + // files are stored as BGR instead of RGB (or use GL_BGR_EXT verses GL_RGB) + for(i = 0; i < stride; i += channels) + { + int temp = pLine[i]; + pLine[i] = pLine[i + 2]; + pLine[i + 2] = temp; + } + } + } + // Check if the image is a 16 bit image (RGB stored in 1 unsigned short) + else if(bits == 16) + { + unsigned short pixels = 0; + int r=0, g=0, b=0; + + // Since we convert 16-bit images to 24 bit, we hardcode the channels to 3. + // We then calculate the stride and allocate memory for the pixels. + channels = 3; + stride = channels * width; + pImageData->data = new unsigned char[stride * height]; + + // Load in all the pixel data pixel by pixel + for(int i = 0; i < width*height; i++) + { + // Read in the current pixel + fread(&pixels, sizeof(unsigned short), 1, pFile); + + // To convert a 16-bit pixel into an R, G, B, we need to + // do some masking and such to isolate each color value. + // 0x1f = 11111 in binary, so since 5 bits are reserved in + // each unsigned short for the R, G and B, we bit shift and mask + // to find each value. We then bit shift up by 3 to get the full color. + b = (pixels & 0x1f) << 3; + g = ((pixels >> 5) & 0x1f) << 3; + r = ((pixels >> 10) & 0x1f) << 3; + + // This essentially assigns the color to our array and swaps the + // B and R values at the same time. + pImageData->data[i * 3 + 0] = r; + pImageData->data[i * 3 + 1] = g; + pImageData->data[i * 3 + 2] = b; + } + } + // Else return a NULL for a bad or unsupported pixel format + else + return NULL; + } + // Else, it must be Run-Length Encoded (RLE) + else + { + // First, let me explain real quickly what RLE is. + // For further information, check out Paul Bourke's intro article at: + // http://astronomy.swin.edu.au/~pbourke/dataformats/rle/ + // + // Anyway, we know that RLE is a basic type compression. It takes + // colors that are next to each other and then shrinks that info down + // into the color and a integer that tells how much of that color is used. + // For instance: + // aaaaabbcccccccc would turn into a5b2c8 + // Well, that's fine and dandy and all, but how is it down with RGB colors? + // Simple, you read in an color count (rleID), and if that number is less than 128, + // it does NOT have any optimization for those colors, so we just read the next + // pixels normally. Say, the color count was 28, we read in 28 colors like normal. + // If the color count is over 128, that means that the next color is optimized and + // we want to read in the same pixel color for a count of (colorCount - 127). + // It's 127 because we add 1 to the color count, as you'll notice in the code. + + // Create some variables to hold the rleID, current colors read, channels, & stride. + byte rleID = 0; + int colorsRead = 0; + channels = bits / 8; + stride = channels * width; + + // Next we want to allocate the memory for the pixels and create an array, + // depending on the channel count, to read in for each pixel. + pImageData->data = new unsigned char[stride * height]; + byte *pColors = new byte [channels]; + + // Load in all the pixel data + while(i < width*height) + { + // Read in the current color count + 1 + fread(&rleID, sizeof(byte), 1, pFile); + + // Check if we don't have an encoded string of colors + if(rleID < 128) + { + // Increase the count by 1 + rleID++; + + // Go through and read all the unique colors found + while(rleID) + { + // Read in the current color + fread(pColors, sizeof(byte) * channels, 1, pFile); + + // Store the current pixel in our image array + pImageData->data[colorsRead + 0] = pColors[2]; + pImageData->data[colorsRead + 1] = pColors[1]; + pImageData->data[colorsRead + 2] = pColors[0]; + + // If we have a 4 channel 32-bit image, assign one more for the alpha + if(bits == 32) + pImageData->data[colorsRead + 3] = pColors[3]; + + // Increase the current pixels read, decrease the amount + // of pixels left, and increase the starting index for the next pixel. + i++; + rleID--; + colorsRead += channels; + } + } + // Else, let's read in a string of the same character + else + { + // Minus the 128 ID + 1 (127) to get the color count that needs to be read + rleID -= 127; + + // Read in the current color, which is the same for a while + fread(pColors, sizeof(byte) * channels, 1, pFile); + + // Go and read as many pixels as are the same + while(rleID) + { + // Assign the current pixel to the current index in our pixel array + pImageData->data[colorsRead + 0] = pColors[2]; + pImageData->data[colorsRead + 1] = pColors[1]; + pImageData->data[colorsRead + 2] = pColors[0]; + + // If we have a 4 channel 32-bit image, assign one more for the alpha + if(bits == 32) + pImageData->data[colorsRead + 3] = pColors[3]; + + // Increase the current pixels read, decrease the amount + // of pixels left, and increase the starting index for the next pixel. + i++; + rleID--; + colorsRead += channels; + } + + } + + } + + // Free up pColors + delete[] pColors; + } + + // Close the file pointer that opened the file + fclose(pFile); + + // Fill in our tImageTGA structure to pass back + pImageData->channels = channels; + pImageData->sizeX = width; + pImageData->sizeY = height; + + // Return the TGA data (remember, you must free this data after you are done) + return pImageData; +} diff --git a/image_libs/tgalib.h b/image_libs/tgalib.h new file mode 100644 index 0000000..eeba871 --- /dev/null +++ b/image_libs/tgalib.h @@ -0,0 +1,22 @@ +#ifndef TGALIB_H +#define TGALIB_H + + +#include +#include + +#define TGA_RGB 2 // This tells us it's a normal RGB (really BGR) file +#define TGA_A 3 // This tells us it's a ALPHA file +#define TGA_RLE 10 // This tells us that the targa is Run-Length Encoded (RLE) + +struct tImageTGA +{ + int channels; // The channels in the image (3 = RGB : 4 = RGBA) + int sizeX; // The width of the image in pixels + int sizeY; // The height of the image in pixels + unsigned char *data; // The image pixel data +}; + +tImageTGA *LoadTGA(const char *filename); + +#endif diff --git a/m4/ax_c_float_words_bigendian.m4 b/m4/ax_c_float_words_bigendian.m4 new file mode 100644 index 0000000..68ae950 --- /dev/null +++ b/m4/ax_c_float_words_bigendian.m4 @@ -0,0 +1,56 @@ +AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN], +[ +AC_CACHE_CHECK(whether float word ordering is bigendian, + ax_cv_c_float_words_bigendian, [ + +ax_cv_c_float_words_bigendian=unknown + +STRINGS="strings -a -" + + +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include +void foo(double *d);],[ + +static double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0; + +foo(&d); +printf("%f",d); + +])], [ + +$STRINGS conftest.$ac_objext > conftest.str +if grep noonsees conftest.str >/dev/null ; then + ax_cv_c_float_words_bigendian=yes +fi +if grep seesnoon conftest.str >/dev/null ; then + if test "$ax_cv_c_float_words_bigendian" = unknown; then + ax_cv_c_float_words_bigendian=no + else + ax_cv_c_float_words_bigendian=unknown + fi +fi +cp conftest.o /tmp/conftest.osav +cp conftest.str /tmp/conftest.sav +/bin/rm -f conftest.str + +])]) + +case $ax_cv_c_float_words_bigendian in + yes) + m4_default([$1], + [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1, + [Define to 1 if your system stores words within floats + with the most significant word first])]) ;; + no) + $2 ;; + *) + m4_default([$3], + [AC_MSG_ERROR([ + +Unknown float word ordering. You need to manually preset +ax_cv_c_float_words_bigendian=no (or yes) according to your system. + + ])]) ;; +esac + +])# AX_C_FLOAT_WORDS_BIGENDIAN diff --git a/m4/ax_check_gl.m4 b/m4/ax_check_gl.m4 new file mode 100644 index 0000000..47ea4e0 --- /dev/null +++ b/m4/ax_check_gl.m4 @@ -0,0 +1,82 @@ +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/ax_check_gl.html +dnl +AC_DEFUN([AX_CHECK_GL], +[AC_REQUIRE([AC_PATH_X])dnl +AC_REQUIRE([ACX_PTHREAD])dnl + +# +# There isn't a reliable way to know we should use the Apple OpenGL framework +# without a configure option. A Mac OS X user may have installed an +# alternative GL implementation (e.g., Mesa), which may or may not depend on X. +# +AC_ARG_WITH([apple-opengl-framework], + [AC_HELP_STRING([--with-apple-opengl-framework], + [use Apple OpenGL framework (Mac OS X only)])]) +if test "X$with_apple_opengl_framework" = "Xyes"; then + AC_DEFINE([HAVE_APPLE_OPENGL_FRAMEWORK], [1], + [Use the Apple OpenGL framework.]) + GL_LIBS="-framework OpenGL" +else + AC_LANG_PUSH(C) + + AX_LANG_COMPILER_MS + if test X$ax_compiler_ms = Xno; then + GL_CFLAGS="${PTHREAD_CFLAGS}" + GL_LIBS="${PTHREAD_LIBS} -lm" + fi + + # + # Use x_includes and x_libraries if they have been set (presumably by + # AC_PATH_X). + # + if test "X$no_x" != "Xyes"; then + if test -n "$x_includes"; then + GL_CFLAGS="-I${x_includes} ${GL_CFLAGS}" + fi + if test -n "$x_libraries"; then + GL_LIBS="-L${x_libraries} -lX11 ${GL_LIBS}" + fi + fi + + AC_CHECK_HEADERS([windows.h]) + + AC_CACHE_CHECK([for OpenGL library], [ax_cv_check_gl_libgl], + [ax_cv_check_gl_libgl="no" + ax_save_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}" + ax_save_LIBS="${LIBS}" + LIBS="" + ax_check_libs="-lopengl32 -lGL" + for ax_lib in ${ax_check_libs}; do + if test X$ax_compiler_ms = Xyes; then + ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` + else + ax_try_lib="${ax_lib}" + fi + LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +# if HAVE_WINDOWS_H && defined(_WIN32) +# include +# endif +# include ]], + [[glBegin(0)]])], + [ax_cv_check_gl_libgl="${ax_try_lib}"; break]) + done + LIBS=${ax_save_LIBS} + CPPFLAGS=${ax_save_CPPFLAGS}]) + + if test "X${ax_cv_check_gl_libgl}" = "Xno"; then + no_gl="yes" + GL_CFLAGS="" + GL_LIBS="" + else + GL_LIBS="${ax_cv_check_gl_libgl} ${GL_LIBS}" + fi + AC_LANG_POP(C) +fi + +AC_SUBST([GL_CFLAGS]) +AC_SUBST([GL_LIBS]) +])dnl diff --git a/m4/ax_check_glu.m4 b/m4/ax_check_glu.m4 new file mode 100644 index 0000000..d1c22fa --- /dev/null +++ b/m4/ax_check_glu.m4 @@ -0,0 +1,58 @@ +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/ax_check_glu.html +dnl +AC_DEFUN([AX_CHECK_GLU], +[AC_REQUIRE([AX_CHECK_GL])dnl +AC_REQUIRE([AC_PROG_CXX])dnl +GLU_CFLAGS="${GL_CFLAGS}" +if test "X${with_apple_opengl_framework}" != "Xyes"; then + AC_CACHE_CHECK([for OpenGL Utility library], [ax_cv_check_glu_libglu], + [ax_cv_check_glu_libglu="no" + ax_save_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${GL_CFLAGS} ${CPPFLAGS}" + ax_save_LIBS="${LIBS}" + LIBS="" + ax_check_libs="-lglu32 -lGLU" + for ax_lib in ${ax_check_libs}; do + if test X$ax_compiler_ms = Xyes; then + ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` + else + ax_try_lib="${ax_lib}" + fi + LIBS="${ax_try_lib} ${GL_LIBS} ${ax_save_LIBS}" + # + # libGLU typically links with libstdc++ on POSIX platforms. However, + # setting the language to C++ means that test program source is named + # "conftest.cc"; and Microsoft cl doesn't know what to do with such a + # file. + # + AC_LANG_PUSH([C++]) + if test X$ax_compiler_ms = Xyes; then + AC_LANG_PUSH([C]) + fi + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +# if HAVE_WINDOWS_H && defined(_WIN32) +# include +# endif +# include ]], + [[gluBeginCurve(0)]])], + [ax_cv_check_glu_libglu="${ax_try_lib}"; break]) + if test X$ax_compiler_ms = Xyes; then + AC_LANG_POP([C]) + fi + AC_LANG_POP([C++]) + done + LIBS=${ax_save_LIBS} + CPPFLAGS=${ax_save_CPPFLAGS}]) + if test "X${ax_cv_check_glu_libglu}" = "Xno"; then + no_glu="yes" + GLU_CFLAGS="" + GLU_LIBS="" + else + GLU_LIBS="${ax_cv_check_glu_libglu} ${GL_LIBS}" + fi +fi +AC_SUBST([GLU_CFLAGS]) +AC_SUBST([GLU_LIBS]) +]) diff --git a/m4/ax_check_glut.m4 b/m4/ax_check_glut.m4 new file mode 100644 index 0000000..7c5280c --- /dev/null +++ b/m4/ax_check_glut.m4 @@ -0,0 +1,72 @@ +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/ax_check_glut.html +dnl +AC_DEFUN([AX_CHECK_GLUT], +[AC_REQUIRE([AX_CHECK_GLU])dnl +AC_REQUIRE([AC_PATH_XTRA])dnl + +if test "X$with_apple_opengl_framework" = "Xyes"; then + GLUT_CFLAGS="${GLU_CFLAGS}" + GLUT_LIBS="-framework GLUT -lobjc ${GL_LIBS}" +else + GLUT_CFLAGS=${GLU_CFLAGS} + GLUT_LIBS=${GLU_LIBS} + + # + # If X is present, assume GLUT depends on it. + # + if test "X${no_x}" != "Xyes"; then + GLUT_LIBS="${X_PRE_LIBS} -lXmu -lXi ${X_EXTRA_LIBS} ${GLUT_LIBS}" + fi + # + # If were running under windows assume we need GDI32 and WinMM + # + if echo $host_os | egrep '^mingw|^winnt' > /dev/null ; then + GLUT_LIBS="${GLUT_LIBS} -lgdi32 -lwinmm" + fi + + AC_LANG_PUSH(C) + + ax_save_CPPFLAGS="${CPPFLAGS}" + CPPFLAGS="${GLUT_CFLAGS} ${CPPFLAGS}" + + AC_CACHE_CHECK([for GLUT library], [ax_cv_check_glut_libglut], + [ax_cv_check_glut_libglut="no" + ax_save_LIBS="${LIBS}" + LIBS="" + ax_check_libs="-lglut32 -lglut -lfreeglut_static -lfreeglut" + for ax_lib in ${ax_check_libs}; do + if test X$ax_compiler_ms = Xyes; then + ax_try_lib=`echo $ax_lib | sed -e 's/^-l//' -e 's/$/.lib/'` + else + ax_try_lib="${ax_lib}" + fi + LIBS="-L${prefix}/lib ${ax_try_lib} ${GLUT_LIBS} ${ax_save_LIBS}" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#define FREEGLUT_STATIC 1 +# if HAVE_WINDOWS_H && (defined(_WIN32) || defined(CYGWIN_USE_WIN32)) +# include +# endif +# include ]], + [[glutMainLoop()]])], + [ax_cv_check_glut_libglut="-L${prefix}/lib ${ax_try_lib}"; break]) + + done + LIBS=${ax_save_LIBS} + ]) + CPPFLAGS="${ax_save_CPPFLAGS}" + AC_LANG_POP(C) + + if test "X${ax_cv_check_glut_libglut}" = "Xno"; then + no_glut="yes" + GLUT_CFLAGS="" + GLUT_LIBS="" + else + GLUT_LIBS="${ax_cv_check_glut_libglut} ${GLUT_LIBS}" + fi +fi + +AC_SUBST([GLUT_CFLAGS]) +AC_SUBST([GLUT_LIBS]) +])dnl diff --git a/m4/ax_lang_compiler_ms.m4 b/m4/ax_lang_compiler_ms.m4 new file mode 100644 index 0000000..d0c73dc --- /dev/null +++ b/m4/ax_lang_compiler_ms.m4 @@ -0,0 +1,14 @@ +dnl Available from the GNU Autoconf Macro Archive at: +dnl http://www.gnu.org/software/ac-archive/htmldoc/ax_lang_compiler_ms.html +dnl +AC_DEFUN([AX_LANG_COMPILER_MS], +[AC_CACHE_CHECK([whether we are using the Microsoft _AC_LANG compiler], + [ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms], +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef _MSC_VER + choke me +#endif +]])], + [ax_compiler_ms=yes], + [ax_compiler_ms=no]) +ax_cv_[]_AC_LANG_ABBREV[]_compiler_ms=$ax_compiler_ms +])]) diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 new file mode 100644 index 0000000..6d400ed --- /dev/null +++ b/m4/ax_pthread.m4 @@ -0,0 +1,317 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. e.g. you should link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threads programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 20 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) + AC_MSG_RESULT($ax_pthread_ok) + if test x"$ax_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case ${host_os} in + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" + ;; + + darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; +esac + +if test x"$ax_pthread_ok" = xno; then +for flag in $ax_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($ax_pthread_ok) + if test "x$ax_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $attr; return attr /* ; */])], + [attr_name=$attr; break], + []) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case ${host_os} in + aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; + osf* | hpux*) flag="-D_REENTRANT";; + solaris*) + if test "$GCC" = "yes"; then + flag="-D_REENTRANT" + else + flag="-mt -D_REENTRANT" + fi + ;; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + ax_cv_PTHREAD_PRIO_INHERIT, [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include ]], [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], + AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != xyes; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/m4/boinc_platform.m4 b/m4/boinc_platform.m4 new file mode 100644 index 0000000..da85d8f --- /dev/null +++ b/m4/boinc_platform.m4 @@ -0,0 +1,69 @@ +AC_DEFUN([BOINC_PLATFORM],[ + AC_ARG_WITH([boinc-platform], + AC_HELP_STRING([--with-boinc-platform], + [override the default boinc platform]), + [boinc_platform="$withval"], + [boinc_platform=]) + AC_ARG_WITH([boinc-alt-platform], + AC_HELP_STRING([--with-boinc-alt-platform], + [override the boinc alternate platform]), + [boinc_alt_platform="$withval"], + [boinc_alt_platform=]) + AC_MSG_CHECKING([boinc platform]) + if test -z "${boinc_platform}" ; then + boinc_platform=`echo $target | $SED -e 's/amd64/x86_64/' -e 's/portbld/pc/' -e 's/redhat/pc/' -e 's/x86_64-unknown/x86_64-pc/' -e 's/[[0-9]]$//' -e 's/[[0-9]]$//' -e 's/\.$//' -e 's/[[0-9]]$//' -e 's/\.$//' -e 's/[[0-9]]$//'` + case "${boinc_platform}" in + sparc-sun-solaris) + if test "$COMPILER_MODEL_BITS" = "64" ; then + boinc_platform=`echo $boinc_platform | $SED 's/sparc/sparc64/'` + if test -z "$boinc_alt_platform" ; then + boinc_alt_platform=sparc-sun-solaris + fi + elif test -z "$boinc_alt_platform" ; then + boinc_alt_platform=sparc-sun-solaris2.7 + fi + ;; + x86_64*linux-gnu) + if test "$COMPILER_MODEL_BITS" = "32" ; then + boinc_platform="i686-pc-linux-gnu" + elif test -z "$boinc_alt_platform" ; then + boinc_alt_platform="i686-pc-linux-gnu" + fi + ;; + powerpc-apple-darwin) + if test "$COMPILER_MODEL_BITS" = "64" ; then + boinc_platform="powerpc64-apple-darwin" + if test -z "$boinc_alt_platform" ; then + boinc_alt_platform="powerpc-apple-darwin" + fi + fi + ;; + hppa*-hp-hpux*) + if test "$COMPILER_MODEL_BITS" = "64" ; then + boinc_platform="hppa64-hp-hpux" + if test -z "${boinc_alt_platform}" ; then + boinc_alt_platform="hppa-hp-hpux" + fi + else + boinc_platform="hppa-hp-hpux" + fi + ;; + ia64-hp-hpux*) + boinc_platform="ia64-hp-hpux" + ;; + + esac + fi + AC_DEFINE_UNQUOTED([HOSTTYPE],"$boinc_platform",[Platform identification used to identify applications for this BOINC core client]) + AC_SUBST([boinc_platform],$boinc_platform) + AC_MSG_RESULT([$boinc_platform]) + AC_MSG_CHECKING([alternate boinc platform]) + if test -n "$boinc_alt_platform" ; then + AC_DEFINE_UNQUOTED([HOSTTYPEALT],"$boinc_alt_platform",[Alternate identification used to identify applications for this BOINC core client]) + AC_SUBST([boinc_alt_platform],$boinc_alt_platform) + AC_MSG_RESULT($boinc_alt_platform) + else + AC_MSG_RESULT(none) + fi +]) + diff --git a/m4/check_ssl.m4 b/m4/check_ssl.m4 new file mode 100644 index 0000000..d0da9f5 --- /dev/null +++ b/m4/check_ssl.m4 @@ -0,0 +1,46 @@ +AC_DEFUN([CHECK_SSL], +[AC_MSG_CHECKING(for openssl) +SSLDIR= +found_ssl="no" +AC_ARG_WITH(ssl, + AC_HELP_STRING([--with-ssl], + [Use openssl (in specified installation directory)]), + [check_ssl_dir="$withval"], + [check_ssl_dir=]) +for dir in $check_ssl_dir /usr/local/ssl /usr/lib64/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do + ssldir="$dir" + if test -f "$dir/include/openssl/ssl.h"; then + found_ssl="yes"; + SSLDIR="${ssldir}" + CFLAGS="$CFLAGS -I$ssldir/include -I$ssldir/include/openssl"; + CXXFLAGS="$CXXFLAGS -I$ssldir/include -I$ssldir/include/openssl"; + break; + fi + if test -f "$dir/include/ssl.h"; then + found_ssl="yes"; + SSLDIR="${ssldir}" + CFLAGS="$CFLAGS -I$ssldir/include/"; + CXXFLAGS="$CXXFLAGS -I$ssldir/include/"; + break + fi +done +AC_MSG_RESULT($found_ssl) +if test x_$found_ssl != x_yes; then + AC_MSG_ERROR([ +---------------------------------------------------------------------- + Cannot find openssl libraries. + + Please install openssl or specify installation directory with + --with-ssl=(dir). +---------------------------------------------------------------------- +]) +else + printf "OpenSSL found in $ssldir\n"; + SSLLIBS="-lssl -lcrypto"; + LDFLAGS="$LDFLAGS -L$ssldir/lib"; + AC_DEFINE_UNQUOTED([USE_OPENSSL],[1], + ["Define to 1 if you want to use the openssl crypto library"]) + AC_SUBST(SSLLIBS) + AC_SUBST(SSLDIR) +fi +])dnl diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 new file mode 100644 index 0000000..c72167d --- /dev/null +++ b/m4/libcurl.m4 @@ -0,0 +1,230 @@ +# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], +# [ACTION-IF-YES], [ACTION-IF-NO]) +# ---------------------------------------------------------- +# David Shaw Jun-21-2005 +# +# Checks for libcurl. DEFAULT-ACTION is the string yes or no to +# specify whether to default to --with-libcurl or --without-libcurl. +# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the +# minimum version of libcurl to accept. Pass the version as a regular +# version number like 7.10.1. If not supplied, any version is +# accepted. ACTION-IF-YES is a list of shell commands to run if +# libcurl was successfully found and passed the various tests. +# ACTION-IF-NO is a list of shell commands that are run otherwise. +# Note that using --without-libcurl does run ACTION-IF-NO. +# +# This macro defines HAVE_LIBCURL if a working libcurl setup is found, +# and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary values. +# Other useful defines are LIBCURL_FEATURE_xxx where xxx are the +# various features supported by libcurl, and LIBCURL_PROTOCOL_yyy +# where yyy are the various protocols supported by libcurl. Both xxx +# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of +# the macro for the complete list of possible defines. Shell +# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also +# defined to 'yes' for those features and protocols that were found. +# Note that xxx and yyy keep the same capitalization as in the +# curl-config list (e.g. it's "HTTP" and not "http"). +# +# Users may override the detected values by doing something like: +# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure +# +# For the sake of sanity, this macro assumes that any libcurl that is +# found is after version 7.7.2, the first version that included the +# curl-config script. Note that it is very important for people +# packaging binary versions of libcurl to include this script! +# Without curl-config, we can only guess what protocols are available. + +AC_DEFUN([LIBCURL_CHECK_CONFIG], +[ + AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL]) + AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4]) + AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6]) + AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz]) + AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS]) + + AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP]) + AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS]) + AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP]) + AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS]) + AH_TEMPLATE([LIBCURL_PROTOCOL_GOPHER],[Defined if libcurl supports GOPHER]) + AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE]) + AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET]) + AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) + AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) + + AC_ARG_WITH(libcurl, + AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]), + [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) + + if test "$_libcurl_with" != "no" ; then + + AC_PROG_AWK + + _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'" + + _libcurl_try_link=yes + + if test -d "$_libcurl_with" ; then + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + fi + + AC_PATH_PROG([_libcurl_config],[curl-config]) + + if test x$_libcurl_config != "x" ; then + AC_CACHE_CHECK([for the version of libcurl], + [libcurl_cv_lib_curl_version], + [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`]) + + _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` + _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse` + + if test $_libcurl_wanted -gt 0 ; then + AC_CACHE_CHECK([for libcurl >= version $2], + [libcurl_cv_lib_version_ok], + [ + if test $_libcurl_version -ge $_libcurl_wanted ; then + libcurl_cv_lib_version_ok=yes + else + libcurl_cv_lib_version_ok=no + fi + ]) + fi + + if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then + if test x"$LIBCURL_CPPFLAGS" = "x" ; then + LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` + fi + if test x"$LIBCURL" = "x" ; then + LIBCURL=`$_libcurl_config --libs` + + # This is so silly, but Apple actually has a bug in their + # curl-config script. Fixed in Tiger, but there are still + # lots of Panther installs around. + case "${host}" in + powerpc-apple-darwin7*) + LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` + ;; + esac + fi + + # All curl-config scripts support --feature + _libcurl_features=`$_libcurl_config --feature` + + # Is it modern enough to have --protocols? (7.12.4) + if test $_libcurl_version -ge 461828 ; then + _libcurl_protocols=`$_libcurl_config --protocols` + fi + else + _libcurl_try_link=no + fi + + unset _libcurl_wanted + fi + + if test $_libcurl_try_link = yes ; then + + # we didn't find curl-config, so let's see if the user-supplied + # link line (or failing that, "-lcurl") is enough. + LIBCURL=${LIBCURL-"-lcurl"} + + AC_CACHE_CHECK([whether libcurl is usable], + [libcurl_cv_lib_curl_usable], + [ + _libcurl_save_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" + _libcurl_save_libs=$LIBS + LIBS="$LIBS $LIBCURL" + + AC_LINK_IFELSE(AC_LANG_PROGRAM([#include ],[ +/* Try and use a few common options to force a failure if we are + missing symbols or can't link. */ +int x; +curl_easy_setopt(NULL,CURLOPT_URL,NULL); +x=CURL_ERROR_SIZE; +x=CURLOPT_WRITEFUNCTION; +x=CURLOPT_FILE; +x=CURLOPT_ERRORBUFFER; +x=CURLOPT_STDERR; +x=CURLOPT_VERBOSE; +]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) + + CPPFLAGS=$_libcurl_save_cppflags + LIBS=$_libcurl_save_libs + unset _libcurl_save_cppflags + unset _libcurl_save_libs + ]) + + if test $libcurl_cv_lib_curl_usable = yes ; then + + # Does curl_free() exist in this version of libcurl? + # If not, fake it with free() + + _libcurl_save_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" + _libcurl_save_libs=$LIBS + LIBS="$LIBS $LIBCURL" + + AC_CHECK_FUNC(curl_free,, + AC_DEFINE(curl_free,free, + [Define curl_free() as free() if our version of curl lacks curl_free.])) + + CPPFLAGS=$_libcurl_save_cppflags + LIBS=$_libcurl_save_libs + unset _libcurl_save_cppflags + unset _libcurl_save_libs + + AC_DEFINE(HAVE_LIBCURL,1, + [Define to 1 if you have a functional curl library.]) + AC_SUBST(LIBCURL_CPPFLAGS) + AC_SUBST(LIBCURL) + + for _libcurl_feature in $_libcurl_features ; do + AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1]) + eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes + done + + if test "x$_libcurl_protocols" = "x" ; then + + # We don't have --protocols, so just assume that all + # protocols are available + _libcurl_protocols="HTTP FTP GOPHER FILE TELNET LDAP DICT" + + if test x$libcurl_feature_SSL = xyes ; then + _libcurl_protocols="$_libcurl_protocols HTTPS" + + # FTPS wasn't standards-compliant until version + # 7.11.0 + if test $_libcurl_version -ge 461568; then + _libcurl_protocols="$_libcurl_protocols FTPS" + fi + fi + fi + + for _libcurl_protocol in $_libcurl_protocols ; do + AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) + eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes + done + fi + fi + + unset _libcurl_try_link + unset _libcurl_version_parse + unset _libcurl_config + unset _libcurl_feature + unset _libcurl_features + unset _libcurl_protocol + unset _libcurl_protocols + unset _libcurl_version + fi + + if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then + # This is the IF-NO path + ifelse([$4],,:,[$4]) + else + # This is the IF-YES path + ifelse([$3],,:,[$3]) + fi + + unset _libcurl_with +])dnl diff --git a/m4/optimizations.m4 b/m4/optimizations.m4 new file mode 100644 index 0000000..46fba0b --- /dev/null +++ b/m4/optimizations.m4 @@ -0,0 +1,113 @@ +AC_DEFUN([SAH_OPTIMIZATIONS],[ +if test x_$sah_opt_only_once = x_ ; then + +sah_opt_only_once=all_done + +AC_ARG_ENABLE([sse3], + AC_HELP_STRING([--enable-sse3], + [Use SSE3 optimizations]) +) + +if test x_$enable_sse3 = x_yes ; then + AC_DEFINE_UNQUOTED([USE_SSE3],[1], + [Define to 1 if you want to use SSE3 optimizations]) +# put compiler specific flags here + if test x_$ac_cv_c_compiler_gnu = x_yes ; then + CFLAGS="-msse3 ${CFLAGS}" + fi +fi + +AC_ARG_ENABLE([sse2], + AC_HELP_STRING([--enable-sse2], + [Use SSE2 optimizations]) +) + +if test x_$enable_sse2 = x_yes ; then + AC_DEFINE_UNQUOTED([USE_SSE2],[1], + [Define to 1 if you want to use SSE2 optimizations]) +# put compiler specific flags here + if test x_$ac_cv_c_compiler_gnu = x_yes ; then + CFLAGS="-msse2 ${CFLAGS}" + if test -z "echo $CFLAGS | grep march=" ; then + CFLAGS="-march=pentium4 ${CFLAGS}" + fi + fi +fi + +AC_ARG_ENABLE([sse], + AC_HELP_STRING([--enable-sse], + [Use SSE optimizations]) +) + +if test x_$enable_sse = x_yes ; then + AC_DEFINE_UNQUOTED([USE_SSE],[1], + [Define to 1 if you want to use SSE optimizations]) +# put compiler specific flags here + if test x_$ac_cv_c_compiler_gnu = x_yes ; then + CFLAGS="-march=pentium3 -msse -mfpmath=sse ${CFLAGS}" + fi +fi + +AC_ARG_ENABLE([mmx], + AC_HELP_STRING([--enable-mmx], + [Use MMX optimizations]) +) + +if test x_$enable_mmx = x_yes ; then + AC_DEFINE_UNQUOTED([USE_MMX],[1], + [Define to 1 if you want to use MMX optimizations]) +# put compiler specific flags here + if test x_$ac_cv_c_compiler_gnu = x_yes ; then + CFLAGS="-march=pentium2 -mmmx -mfpmath=387 ${CFLAGS}" + fi +fi + +AC_ARG_ENABLE([3dnow], + AC_HELP_STRING([--enable-3dnow], + [Use 3dnow optimizations]) +) + + +if test x_$enable_3dnow = x_yes ; then + AC_DEFINE_UNQUOTED([USE_3DNOW],[1], + [Define to 1 if you want to use 3D-Now optimizations]) +# put compiler specific flags here + if test x_$ac_cv_c_compiler_gnu = x_yes ; then + CFLAGS="-march=pentium2 -m3dnow -mfpmath=387 ${CFLAGS}" + fi +fi + +AC_ARG_ENABLE([fast-math], + AC_HELP_STRING([--enable-fast-math], + [Use gcc -ffast-math optimization]) + ) + +if test x_$enable_fast_math = x_yes ; then + AC_DEFINE_UNQUOTED([USE_FAST_MATH],[1], + [Define to 1 if you want to use the gcc -ffast-math optimization]) +# put compiler specific flags here + if test x_$ac_cv_c_compiler_gnu = x_yes ; then + CFLAGS="${CFLAGS} -ffast-math" + fi +fi + +AC_ARG_ENABLE([altivec], + AC_HELP_STRING([--enable-altivec], + [Use altivec optimizations]) + ) + +if test x_$enable_altivec = x_yes ; then + AC_DEFINE_UNQUOTED([USE_ALTIVEC],[1], + [Define to 1 if you want to use ALTIVEC optimizations]) +# put compiler specific flags here + if test x_$ac_cv_c_compiler_gnu = x_yes ; then + SAH_CHECK_CFLAG([-faltivec],[CFLAGS="-faltivec ${CFLAGS}"]) + SAH_CHECK_CFLAG([-maltivec],[CFLAGS="-maltivec ${CFLAGS}"]) + SAH_CHECK_CFLAG([-mtune=G5],[CFLAGS="-mtune=G5 ${CFLAGS}"]) + SAH_CHECK_CFLAG([-mcpu=powerpc],[CFLAGS="-mcpu=powerpc ${CFLAGS}"]) + SAH_CHECK_LDFLAG([-framework Accelerate],[LDFLAGS="${LDFLAGS} -framework Accelerate"]) + fi +fi + +fi +]) diff --git a/m4/sah_asmlib.m4 b/m4/sah_asmlib.m4 new file mode 100644 index 0000000..6cd4358 --- /dev/null +++ b/m4/sah_asmlib.m4 @@ -0,0 +1,62 @@ +AC_DEFUN([SAH_CHECK_ASMLIB],[ + AC_LANG_PUSH([C++]) + AC_MSG_CHECKING([asmlib]) + AC_ARG_ENABLE(asmlib, + AC_HELP_STRING([--disable-asmlib], + [disable use of asmlib for CPU identification (iX86 only)]), + [ + disable_asmlib=yes + enable_asmlib=no + ], + [ + disable_asmlib=no + enable_asmlib=yes + ] + ) + if test -z "`echo $target | grep '[3456]86'`" ; then + disable_asmlib=yes + enable_asmlib=no + fi + ASMLIB_CFLAGS= + ASMLIB_LDFLAGS= + ASMLIB_LIBS= + asmlib_save_CFLAGS="${CFLAGS}" + asmlib_save_CXXFLAGS="${CXXFLAGS}" + asmlib_save_LDFLAGS="${LDFLAGS}" + asmlib_save_LIBS="${LIBS}" + asmlib_dir="${SAH_TOP_DIR}/client/vector/" + asmlib_works=no + if test "${disable_asmlib}" != "yes" ; then + CFLAGS="${CFLAGS} -I${asmlib_dir}" + CXXFLAGS="${CXXFLAGS} -I${asmlib_dir}" + for ASMLIB_LIBS in ${asmlib_dir}/asmlibe.a ${asmlib_dir}/asmlibm.a ${asmlib_dir}/asmlibo.lib + do + LIBS="${ASMLIB_LIBS} ${asmlib_save_LIBS}" + AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM( + [[#include "asmlib.h"]], + [[InstructionSet()]] + ) + ], + [asmlib_works=yes; break] + ) + done + fi + if test "${asmlib_works}" = "yes" ; then + AC_DEFINE_UNQUOTED([USE_ASMLIB],[1], + [Define to 1 to use ASMLIB to determine processor capabilities]) + AC_MSG_RESULT([$ASMLIB_LIBS]) + else + ASMLIB_LIBS= + AC_MSG_RESULT([no]) + fi + CFLAGS="${asmlib_save_CFLAGS}" + CXXFLAGS="${asmlib_save_CXXFLAGS}" + LDFLAGS="${asmlib_save_LDFLAGS}" + LIBS="${asmlib_save_LIBS}" + AC_SUBST([ASMLIB_LDFLAGS]) + AC_SUBST([ASMLIB_CFLAGS]) + AC_SUBST([ASMLIB_LIBS]) + AC_LANG_POP([C++]) +]) diff --git a/m4/sah_avx.m4 b/m4/sah_avx.m4 new file mode 100644 index 0000000..10f8515 --- /dev/null +++ b/m4/sah_avx.m4 @@ -0,0 +1,55 @@ +AC_DEFUN([SAH_AVX],[ + AC_LANG_PUSH(C) + AC_MSG_CHECKING([if compiler supports -mavx]) + save_cflags="${CFLAGS}" + CFLAGS="-mavx" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])],[ + have_avx=yes + ],[ + have_avx=no + ] + ) + AC_MSG_RESULT($have_avx) + if test "$have_avx" = "yes" ; then + AC_MSG_CHECKING([type of arg 2 of _mm256_maskstore_ps()]) + for type in __m256d __m256i __m256 _m256d _m256i _m256 ; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#define __AVX__ 1 +#if defined(HAVE_IMMINTRIN_H) +#include +#elif defined(HAVE_AVXINTRIN_H) +#include +#elif defined(HAVE_X86INTRIN_H) +#include +#elif defined(HAVE_INTRIN_H) +#include +#endif +#if !defined(HAVE___M256) +#define __m256 _m256 +#endif + +float *a1; +$type a2; +__m256 a3; +int foo(void) { + _mm256_maskstore_ps(a1,a2,a3); + return 0; +} +]],[return foo();])], +[ type_found=yes ], +[ type_found=no ]) + if test "${type_found}" = "yes" ; then + break; + fi + done + fi + if test "${type_found}" = "yes" ; then + AC_MSG_RESULT($type) + avx_type=${type} + else + AC_MSG_RESULT(none) + avx_type= + fi + CFLAGS="${save_cflags}" + AC_LANG_POP(C) +]) diff --git a/m4/sah_check_boinc.m4 b/m4/sah_check_boinc.m4 new file mode 100644 index 0000000..1b3026d --- /dev/null +++ b/m4/sah_check_boinc.m4 @@ -0,0 +1,65 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_PREREQ([2.54]) + +AC_DEFUN([SAH_CHECK_BOINC],[ + AC_ARG_VAR([BOINCDIR],[boinc directory]) + AC_ARG_VAR([PROJECTDIR],[project config.xml directory]) + set -x + if test -z "$HEAD" + then + AC_PATH_PROG(HEAD,head) + fi + if test -z "$FIND" + then + AC_PATH_PROG(FIND,find) + fi + thisdir=`pwd` + AC_MSG_CHECKING([for BOINC]) + boinc_search_path="$BOINCDIR /usr/local boinc ../boinc ../../boinc /usr /usr/local /usr/local/include ${top_srcdir}../boinc $HOME/boinc /usr/local/boinc /usr/local/lib/boinc /opt/misc/boinc /opt/misc/lib/boinc $2" + for boinc_dir in $boinc_search_path + do + if test -d $boinc_dir + then + if test -f $boinc_dir/include/std_fixes.h -o -f $boinc_dir/lib/std_fixes.h + then + cd $boinc_dir + BOINCDIR=`pwd` + cd $thisdir + break + else + if test -n "`$FIND $boinc_dir -name 'std_fixes.h'`" + then + BOINCDIR=`$FIND $boinc_dir -name "std_fixes.h" -print | $HEAD -1 | sed 's/\/std_fixes.h//'` + cd $BOINCDIR/.. + BOINCDIR=`pwd` + cd $thisdir + break + fi + fi + fi + done + if test -n "$BOINCDIR" + then + AC_MSG_RESULT($BOINCDIR) + else + no_boinc=yes + AC_MSG_RESULT(not found) + fi + if test -z "$PROJECTDIR" + then + PROJECTDIR=~boincadm/projects/ap + fi + AC_DEFINE_UNQUOTED([PROJECTDIR],["$PROJECTDIR"],[Define as directory containing the project config.xml]) + AC_SUBST([PROJECTDIR]) + AC_SUBST([BOINCDIR]) + BOINCCFG=`find $BOINCDIR -name config.h | head -1` + + BOINC_CFLAGS="-I$BOINCDIR -I$BOINCDIR/api -I$BOINCDIR/lib -I$BOINCDIR/sched -I$BOINCDIR/db -I`dirname $BOINCCFG`" + AC_SUBST([BOINC_CFLAGS]) + set +x +]) + diff --git a/m4/sah_check_cfitsio.m4 b/m4/sah_check_cfitsio.m4 new file mode 100644 index 0000000..c2468b6 --- /dev/null +++ b/m4/sah_check_cfitsio.m4 @@ -0,0 +1,52 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_PREREQ([2.54]) + +AC_DEFUN([SAH_CHECK_CFITSIO],[ + AC_ARG_VAR([CFITSIO],[CFITSIO directory]) + if test -z "$HEAD" + then + AC_PATH_PROG(HEAD,head) + fi + if test -z "$FIND" + then + AC_PATH_PROG(FIND,find) + fi + thisdir=`pwd` + AC_MSG_CHECKING([for CFITSIO]) + cfitsio_search_path=[`echo $CFITSIO cfitsio* ../cfitsio* ../lib/cfitsio* $HOME/lib/cfitsio* /usr/local/cfitsio* /usr/local`] + for cfitsio_dir in $cfitsio_search_path + do + if test -d $cfitsio_dir + then + if test -f $cfitsio_dir/libcfitsio.a + then + cd $cfitsio_dir + CFITSIO=`pwd` + cd $thisdir + break + else + if $FIND $cfitsio_dir -name "lib/libcfitsio.a" 2>/dev/null >/dev/null + then + CFITSIO=`$FIND $cfitsio_dir -name "lib/libcfitsio.a" -print | $HEAD -1 | sed 's/\/lib\/libcfitsio.a//'` + cd $CFITSIO + CFITSIO=`pwd` + cd $thisdir + break + fi + fi + fi + done + if test -n "$CFITSIO" + then + AC_MSG_RESULT($CFITSIO) + else + AC_MSG_RESULT(not found) + no_cfitsio=yes + fi +]) + + diff --git a/m4/sah_check_healpix.m4 b/m4/sah_check_healpix.m4 new file mode 100644 index 0000000..621432c --- /dev/null +++ b/m4/sah_check_healpix.m4 @@ -0,0 +1,52 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_PREREQ([2.54]) + +AC_DEFUN([SAH_CHECK_HEALPIX],[ + AC_ARG_VAR([HEALPIX],[HEALPIX directory]) + if test -z "$HEAD" + then + AC_PATH_PROG(HEAD,head) + fi + if test -z "$FIND" + then + AC_PATH_PROG(FIND,find) + fi + thisdir=`pwd` + AC_MSG_CHECKING([for HEALPIX]) + healpix_search_path=[`echo $HEALPIX [Hh]ealpix* ../[Hh]ealpix* ../lib/[Hh]ealpix* $HOME/lib/[Hh]ealpix* /usr/local/[Hh]ealpix* /usr/local`] + for healpix_dir in $healpix_search_path + do + if test -d $healpix_dir/lib + then + if test -f $healpix_dir/lib/libchealpix.a + then + cd $healpix_dir + HEALPIX=`pwd` + cd $thisdir + break + else + if $FIND $healpix_dir -name "lib/libchealpix.a" 2>/dev/null >/dev/null + then + HEALPIX=`$FIND $healpix_dir -name "lib/libchealpix.a" -print | $HEAD -1 | sed 's/\/lib\/libchealpix.a//'` + cd $HEALPIX + HEALPIX=`pwd` + cd $thisdir + break + fi + fi + fi + done + if test -n "$HEALPIX" + then + AC_MSG_RESULT($HEALPIX) + else + AC_MSG_RESULT(not found) + no_healpix=yes + fi +]) + + diff --git a/m4/sah_check_ipp.m4 b/m4/sah_check_ipp.m4 new file mode 100644 index 0000000..4339487 --- /dev/null +++ b/m4/sah_check_ipp.m4 @@ -0,0 +1,39 @@ +AC_DEFUN([SAH_CHECK_IPP], +[AC_MSG_CHECKING([for Intel Performance Primitives]) +IPP= +found_ipp="no" +AC_ARG_WITH(ipp, + AC_HELP_STRING([--with-ipp@<:@=DIR@:>@], + [Use Intel Performance Primitives (in specified installation directory)]), + [check_ipp_dir="$withval"], + [check_ipp_dir=]) + +SAH_OPTIMIZATIONS + +for dir in $check_ipp_dir $check_ipp_dir/ia32* $check_ipp_dir/ipp*/ia32* /opt/intel/ipp*/ia32* /usr/local/ipp*/ia32* /usr/lib/ipp*/ia32* /usr/ipp*/ia32* /usr/pkg/ipp*/ia32* /usr/local /usr; do + ippdir="$dir" + if test -f "$dir/include/ipp.h"; then + found_ipp="yes"; + IPPDIR="${ippdir}" + CFLAGS="$CFLAGS -I$ippdir/include -I$ippdir/tools/staticlib"; + CXXFLAGS="$CXXFLAGS -I$ippdir/include -I$ippdir/tools/staticlib"; + break; + fi + if test -f "$dir/include/ipp.h"; then + found_ipp="yes"; + IPPDIR="${ippdir}" + CFLAGS="$CFLAGS -I$ippdir/include/"; + CXXFLAGS="$CXXFLAGS -I$ippdir/include/"; + break + fi +done +AC_MSG_RESULT($found_ipp) +if test x_$found_ipp = x_yes ; then + printf "IPP found in $ippdir\n"; + LIBS="$LIBS -lippcore -lippsmerged"; + LDFLAGS="$LDFLAGS -L$ippdir/lib"; + AC_DEFINE_UNQUOTED([USE_IPP],[1], + ["Define to 1 if you want to use the Intel Performance Primitives"]) + AC_SUBST(IPPDIR) +fi +]) diff --git a/m4/sah_check_jpeglib.m4 b/m4/sah_check_jpeglib.m4 new file mode 100644 index 0000000..4e84c4a --- /dev/null +++ b/m4/sah_check_jpeglib.m4 @@ -0,0 +1,24 @@ +AC_DEFUN([SAH_CHECK_JPEGLIB],[ +AC_ARG_WITH([my-libjpeg], + AC_HELP_STRING([--with-my-libjpeg],[use the jpeglib that is distributed with setiatthome]), + [use_my_libjpeg="$withval"]) +if test "x${use_my_libjpeg}" = "xyes" ; then + LIBS="-L`pwd`/jpeglib ${LIBS}" + CFLAGS="${CFLAGS} -I`pwd`/jpeglib" + sah_cv_lib_jpeg_jpeg_start_decompress="`pwd`/jpeglib/libjpeg.a" + sah_cv_lib_jpeg_fopen="`pwd`/jpeglib/libjpeg.a" + sah_cv_static_lib_jpeg_jpeg_start_decompress="$sah_cv_lib_jpeg_jpeg_start_decompress" + sah_cv_static_lib_jpeg_fopen="$sah_cv_lib_jpeg_fopen" + if test -f "${sah_cv_lib_jpeg_fopen}" ; then + /bin/rm -f "${sah_cv_lib_jpeg_fopen}" + fi + echo "int foo() { return 0; }" >foo.c + $CC -c foo.c + $AR cr "${sah_cv_lib_jpeg_fopen}" foo.$OBJEXT + /bin/rm foo.$OBJEXT foo.c + $RANLIB "${sah_cv_lib_jpeg_fopen}" +fi +SAH_CHECK_LIB([jpeg], [jpeg_start_decompress], + AC_DEFINE([HAVE_LIBJPEG],[1],[Define to 1 if you have the jpeg library])) +AM_CONDITIONAL(USE_MY_LIBJPEG, [test "x${use_my_libjpeg}" = "xyes" -o "${sah_cv_lib_jpeg_jpeg_start_decompress}" = "no"]) +]) diff --git a/m4/sah_check_lib.m4 b/m4/sah_check_lib.m4 new file mode 100644 index 0000000..72684da --- /dev/null +++ b/m4/sah_check_lib.m4 @@ -0,0 +1,503 @@ + +AC_DEFUN([SAH_CHECK_LIB],[ + alib="$1" + # check to see if it is in our static list + for slib in ${STATIC_LIB_LIST}; do + lib_is_static="no" + tmp_pattern=`echo s/x${slib}// | sed 's/\*/.*/'` + if test -z "`echo x${alib} | sed ${tmp_pattern}`" + then + SAH_STATIC_LIB_REQUIRED(${alib},[$2],[ + lib_is_static="yes" + sah_lib_last="${sah_static_lib_last}" + $3 + ],[$4],[$5],[$6]) + break; + fi + done + if test "${lib_is_static}" = "no" ; then + SAH_DYNAMIC_LIB_REQUIRED(${alib},[$2],[ + sah_lib_last="${sah_dynamic_lib_last}" + $3 + ],[$4],[$5],[$6]) + fi +]) + + + + +AC_DEFUN([SAH_CHECK_LDFLAG],[ + sv_ldflags="${LDFLAGS}" + AC_MSG_CHECKING(if linker works with $1 flag) + LDFLAGS="${LDFLAGS} $1" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #define CONFIG_TEST + int foo() {return 1;} + ]], + [ return foo(); ])], + [ + AC_MSG_RESULT(yes) + $2 + ], + [ + AC_MSG_RESULT(no) + LDFLAGS="${sv_ldflags}" + $3 + ] + ) +]) + +AC_DEFUN([SAH_CHECK_CFLAG],[ + AC_LANG_PUSH(C) + sv_cflags="${CFLAGS}" + AC_MSG_CHECKING(if compiler works with $1 flag) + CFLAGS="${CFLAGS} $1" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + #define CONFIG_TEST + int foo() {return 1;} + ]], + [ return foo(); ])], + [ + AC_MSG_RESULT(yes) + $2 + ], + [ + AC_MSG_RESULT(no) + CFLAGS="${sv_ldflags}" + $3 + ] + ) + AC_LANG_POP +]) + +AC_DEFUN([SAH_LINKAGE_FLAGS],[ + AC_ARG_ENABLE(static_client, + AC_HELP_STRING([--disable-static-linkage], + [disable static linking of certain libraries]), + [ + disable_static_linkage=yes + enable_client_release=no + ], + [ + disable_static_linkage=no + enable_client_release=yes + ]) + if test "${disable_static_linkage}" = "yes" + then + ld_static_option="" + ld_dynamic_option="" + LD_EXPORT_DYNAMIC="" + else + if test -z "${ld_static_option}" + then + case $target in + *linux* | *solaris* | *cygwin* ) + AC_MSG_CHECKING([${CC} flags for static linkage ...]) + ld_static_option="-Wl,-Bstatic" + AC_MSG_RESULT($ld_static_option) + AC_MSG_CHECKING([${CC} flags for dynamic linkage ...]) + ld_dynamic_option="-Wl,-Bdynamic" + AC_MSG_RESULT($ld_dynamic_option) + ;; + *darwin* ) + AC_MSG_CHECKING([${CC} flags for static linkage ...]) + ld_static_option="-static" + AC_MSG_RESULT($ld_static_option) + AC_MSG_CHECKING([${CC} flags for dynamic linkage ...]) + ld_dynamic_option="-dynamic" + AC_MSG_RESULT($ld_dynamic_option) + ;; + *) + if test -z "${dummy_ld_variable_gfdsahjf}" + then + dummy_ld_variable_gfdsahjf="been there done that" + AC_MSG_CHECKING([${CC} flags for static linkage ...]) + AC_MSG_RESULT(unknown) + AC_MSG_CHECKING([${CC} flags for dynamic linkage ...]) + AC_MSG_RESULT(unknown) + fi + ;; + esac + AC_MSG_CHECKING([${CC} flags for exporting dynamic symbols from an executable ...]) + LD_EXPORT_DYNAMIC="${export_dynamic_flag_spec}" + if test -z "${LD_EXPORT_DYNAMIC}" ; then + case $target in + *cygwin*) + LD_EXPORT_DYNAMIC="-Wl,--export-all-symbols" + AC_MSG_RESULT(${LD_EXPORT_DYNAMIC}) + ;; + *linux*) + AC_MSG_RESULT(-rdynamic) + LD_EXPORT_DYNAMIC="-rdynamic" + ;; + *) + AC_MSG_RESULT(none required) + LD_EXPORT_DYNAMIC= + ;; + esac + fi + fi + fi + if test -z "${LIBEXT}"; + then + SAH_LIBEXT + fi + if test -z "${DLLEXT}"; + then + SAH_DLLEXT + fi + AC_SUBST(LD_EXPORT_DYNAMIC) +]) + + +# use this function in order to find a library that we require to be static. +# we will check in the following order.... +# 1) files named lib{name}.a +# 2) files named {name}.a +# 3) linking with the static flags "$STATIC_FLAGS -l{name}" +AC_DEFUN([SAH_STATIC_LIB_REQUIRED],[ +SAH_LINKAGE_FLAGS +# upercase the library name for our definition +ac_uc_defn=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` +# Build our cache variable names +STATIC_LIB_LIST="${STATIC_LIB_LIST} $1" +varname=`echo sah_cv_static_lib_$1_$2 | $as_tr_sh` +var2=`echo sah_cv_static_lib_$1_fopen | $as_tr_sh` +if test "$2" != "fopen" ; then + tmp_msg="for $2 in static library $1" +else + tmp_msg="for static library $1" +fi +AC_CACHE_CHECK([$tmp_msg], + [$varname], +[ + tmp_res="no" +# +# check if we want to actually do all this. + if test "${disable_static_linkage}" = "yes" + then + sah_static_checklibs="-l$1" + else + sah_static_checklibs="lib$1.${LIBEXT} $1.${LIBEXT} -l$1" + fi + sah_save_libs="${LIBS}" + for libname in ${sah_static_checklibs} + do + SAH_FIND_STATIC_LIB(${libname}) + if test -n "${tmp_lib_name}" + then + LIBS="${tmp_lib_name} ${sah_save_libs} $5 $6" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #define CONFIG_TEST 1 + #ifdef __cplusplus + extern "C" { + #endif + char $2 (); + #ifdef __cplusplus + } + #endif + ]], + [ $2 (); ])], + [ + tmp_res="${tmp_lib_name}" + ] + ) + fi + if test "${tmp_res}" != "no" + then + break + fi + done + LIBS="${sah_save_libs}" + eval ${varname}='"'${tmp_res}'"' + eval ${var2}='"'${tmp_res}'"' + ]) +# +# save the result for use by the caller +sah_static_lib_last="`eval echo '${'$varname'}'`" +# +if test "${sah_static_lib_last}" != "no" +then + tmp_pattern=`echo "${sah_static_lib_last}" | sed 's/-/./'` + if echo ${LIBS} | grep "${tmp_pattern}" > /dev/null + then + echo Already in LIBS, not adding... >&5 + else + LIBS="${sah_static_lib_last} ${LIBS}" + fi + AC_DEFINE_UNQUOTED([$ac_uc_defn], [1], + [Define to 1 if the $1 library has the function $2] + ) + $3 +else + $4 + echo > /dev/null +fi +]) + +# use this function in order to find a library that we require to be dynamic. +# we will check in the following order.... +# 1) linking with the dynamic flags "$DYNAMIC_FLAGS -l{name}" +# 2) linking with no flags "-l{name}" +AC_DEFUN([SAH_DYNAMIC_LIB_REQUIRED],[ +SAH_LINKAGE_FLAGS +# upercase the library name for our definition +ac_uc_defn=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` +# Build our cache variable names +DYNAMIC_LIB_LIST="${DYNAMIC_LIB_LIST} $1" +varname=`echo sah_cv_dynamic_lib_$1_$2 | $as_tr_sh` +var2=`echo sah_cv_dynamic_lib_$1_fopen | $as_tr_sh` +if test "$2" != "fopen" ; then + tmp_msg="for $2 in dynamic library $1" +else + tmp_msg="for dynamic library $1" +fi +AC_CACHE_CHECK([$tmp_msg], + [$varname], +[ + tmp_res="no" +# +# check if we want to actually do all this. + if test "${disable_static_linkage}" = "yes" + then + sah_dynamic_checklibs="-l$1 -l$1.${DLLEXT}" + else + sah_dynamic_checklibs="-l$1" + fi + sah_save_libs="${LIBS}" + for libname in ${sah_dynamic_checklibs} + do + tmp_lib_name="${libname}" + LIBS="${ld_dynamic_option} ${tmp_lib_name} ${sah_save_libs} $5 $6" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #define CONFIG_TEST 1 + #ifdef __cplusplus + extern "C" { + #endif + char $2 (); + #ifdef __cplusplus + } + #endif + ]], + [ $2 (); ]) + ], + [ + tmp_res="${ld_dynamic_option} ${tmp_lib_name}" + ]) + if test "${tmp_res}" = "no" + then + tmp_lib_name="${libname}" + LIBS="${tmp_lib_name} ${sah_save_libs}" + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ + #define CONFIG_TEST 1 + #ifdef __cplusplus + extern "C" { + #endif + char $2 (); + #ifdef __cplusplus + } + #endif + ]], + [ $2 (); ]) + ], + [ + tmp_res="${tmp_lib_name}" + ]) + fi + done + LIBS="${sah_save_libs}" + eval ${varname}='"'${tmp_res}'"' + eval ${var2}='"'${tmp_res}'"' +]) +# +# save the result for use by the caller +sah_dynamic_lib_last="`eval echo '${'$varname'}'`" +# +if test "${sah_dynamic_lib_last}" != "no" +then + tmp_pattern=`echo "${sah_dynamic_lib_last}" | sed 's/-/./'` + if echo ${LIBS} | grep "${tmp_pattern}" > /dev/null + then + echo Already in LIBS, not adding... >&5 + else + LIBS="${sah_dynamic_lib_last} ${LIBS}" + fi + AC_DEFINE_UNQUOTED([$ac_uc_defn], [1], + [Define to 1 if the $1 library has the function $2] + ) + $3 +else + $4 + echo > /dev/null +fi +]) + +AC_DEFUN([SAH_STATIC_LIB],[ + SAH_STATIC_LIB_REQUIRED([$1],[$2]) + sah_lib_last="${sah_static_lib_last}" + if test "${sah_lib_last}" = "no" ; then + SAH_DYNAMIC_LIB_REQUIRED([$1],[$2]) + sah_lib_last=${sah_dynamic_lib_last} + fi + if test "${sah_lib_last}" != "no" ; then + $3 + echo > /dev/null + else + $4 + echo > /dev/null + fi +]) + +AC_DEFUN([SAH_DYNAMIC_LIB],[ + SAH_DYNAMIC_LIB_REQUIRED([$1],[$2]) + sah_lib_last="${sah_dynamic_lib_last}" + if test "${sah_lib_last}" = "no" ; then + SAH_STATIC_LIB_REQUIRED([$1],[$2]) + sah_lib_last=${sah_static_lib_last} + fi + if test "${sah_lib_last}" != "no" ; then + $3 + echo > /dev/null + else + $4 + echo > /dev/null + fi +]) + +#The SAH_FIND_STATIC_LIB macro searches the LD_LIBRARY_PATH or equivalent +#in order to find a static version of the library being loaded. +AC_DEFUN([SAH_FIND_STATIC_LIB],[ +# libtool sets up the variable shlibpath_var which holds the name of the +# LIB_PATH variable. We also want to strip the sparcv9 and 64s from the +# path, because we'll add them again later +strip_pattern="s/sparcv9//g; s/lib64/lib/g; s/lib\/64/lib/g" +tmp_libpath=`eval echo '${'$shlibpath_var'}' | sed "${strip_pattern}"` + +# in cygwin, the DLLs are in the path, but the static libraries are elsewhere. +# Here's an educated guess. +if test "${shlibpath_var}" = "PATH" +then + tmp_libpath=`echo ${PATH} | sed 's/\/bin/\/lib/g'` + tmp_libpath="${tmp_libpath}:${PATH}" +fi + +gcc_version=`${CC} -v 2>&1 | grep "gcc version" | $AWK '{print $[]3}'` + +for gcc_host in `${CC} -v 2>&1 | grep host` --host=${ac_cv_target} +do + if test -n "`echo x$gcc_host | grep x--host=`" + then + gcc_host="`echo $gcc_host | sed 's/--host=//'`" + break + fi +done + +gcc_specs=`${CC} -v 2>&1 | grep specs | $AWK '{print $[]4}' | sed 's/\/specs//'` + +for dirs in `${CC} -v 2>&1 | grep prefix` --prefix=${gcc_specs} +do + if test -n "`echo x$dirs | grep x--prefix=`" + then + gcc_prefix="`echo $dirs | sed 's/--prefix=//'`" + tmp_libpath="${gcc_specs}:${gcc_prefix}/lib:${gcc_prefix}/lib/gcc-lib/${gcc_host}/${gcc_version}:${tmp_libpath}" + break + fi +done + +gcc_lib_dirs=`${CC} -print-search-dirs 2>&1 | grep libraries: | sed 's/^libraries: =//'` +tmp_libpath="${gcc_lib_dirs}:${tmp_libpath}" + +# Put machine/arch specific tweaks to the libpath here. +if test -z "${COMPILER_MODEL_BITS}" +then + SAH_DEFAULT_BITNESS +fi +case $target in + x86_64-*-linux*) + if test -n "${COMPILER_MODEL_BITS}" + then + tmp_pattern="s/\/lib/\/lib${COMPILER_MODEL_BITS}/g" + tmp_pattern_b="s/${COMPILER_MODEL_BITS}${COMPILER_MODEL_BITS}/${COMPILER_MODEL_BITS}/g" + abcd_q=`echo ${tmp_libpath} | sed ${tmp_pattern} | sed ${tmp_pattern_b} ` + case ${COMPILER_MODEL_BITS} in + 32) + gcc_host_dirs=`echo ${gcc_prefix}/lib/gcc*/i[3456]86*linux*/${gcc_version}` + ;; + 64) + gcc_host_dirs=`echo ${gcc_prefix}/lib/gcc-lib/x86_64*linux*/${gcc_version}` + ;; + esac + tmp_libpath="${abcd_q}:${tmp_libpath}" + for tmp_dir in ${gcc_host_dirs} + do + tmp_libpath="${tmp_dir}:${tmp_libpath}" + done + fi + ;; + sparc*-sun-solaris*) + if test -n "${COMPILER_MODEL_BITS}" + then + tmp_pattern="s/\/lib/\/lib\/${COMPILER_MODEL_BITS}/g" + tmp_pattern_b="s/${COMPILER_MODEL_BITS}\/${COMPILER_MODEL_BITS}/${COMPILER_MODEL_BITS}/g" + abcd_q=`echo ${tmp_libpath} | sed ${tmp_pattern} | sed ${tmp_pattern_b}` + case ${COMPILER_MODEL_BITS} in + 64) + tmp_arch="sparcv9" + ;; + 32) + tmp_arch= + ;; + esac + abcd_r="/notadir/" + for tmp_dir in `echo ${tmp_libpath} | sed 's/\:/ /g'` + do + abcd_r="${abcd_r}:${tmp_dir}/${tmp_arch}" + done + tmp_libpath="${abcd_r}:${abcd_q}:${tmp_libpath}" + fi + ;; + *) + echo > /dev/null + ;; +esac + + +if test -n "`echo x$1 | grep x-l`" +then + # in the -l case, don't search, just use the ld_static_option (usually + # -Wl,-B static + tmp_lib_name="${ld_static_option} $1" +else + # we also want to check the system config files for library dirs. + tmp_dir_list= + if test -e /etc/ld.so.conf + then + tmp_dir_list=`cat /etc/ld.so.conf` + else + if test -e /var/ld/ld.config + then + tmp_dir_list=`cat /var/ld/ld.config` + fi + fi + + tmp_dir_list=`echo ${tmp_libpath}:/lib:/usr/lib:/usr/ucb/lib:/usr/local/lib:/opt/misc/lib:${tmp_dir_list} | $AWK -F: '{for (i=1;i<(NF+1);i++) { print $[]i; }}'` + + tmp_lib_name= + # now that we know where we are looking, find our library + for tmp_dir in $tmp_dir_list + do + if test -e $tmp_dir/$1 + then + tmp_lib_name=${tmp_dir}/$1 + break + fi + done +fi +]) diff --git a/m4/sah_check_math_functions.m4 b/m4/sah_check_math_functions.m4 new file mode 100644 index 0000000..21777e9 --- /dev/null +++ b/m4/sah_check_math_functions.m4 @@ -0,0 +1,10 @@ +AC_DEFUN([SAH_CHECK_MATH_FUNCS],[ + for func in $1 ; do + AH_TEMPLATE(AS_TR_CPP(have_${func}),[Define to 1 if you have the function ${func}()]) + AC_CHECK_LIB([m],$func,[ + eval "ac_cv_func_${func}=yes" + AC_DEFINE_UNQUOTED(AS_TR_CPP(have_${func}),1,[Define to 1 if you have the function ${func()}]) + ]) + AC_CHECK_FUNC($func) + done +]) diff --git a/m4/sah_check_seti_gbt.m4 b/m4/sah_check_seti_gbt.m4 new file mode 100644 index 0000000..a293ef6 --- /dev/null +++ b/m4/sah_check_seti_gbt.m4 @@ -0,0 +1,50 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_PREREQ([2.54]) + +AC_DEFUN([SAH_CHECK_SETI_GBT],[ + AC_ARG_VAR([SETI_GBT],[SETI_GBT directory]) + if test -z "$HEAD" + then + AC_PATH_PROG(HEAD,head) + fi + if test -z "$FIND" + then + AC_PATH_PROG(FIND,find) + fi + thisdir=`pwd` + AC_MSG_CHECKING([for SETI_GBT]) + seti_gbt_search_path=[`echo $SETI_GBT seti_gbt* ../seti_gbt* ../lib/seti_gbt* $HOME/lib/seti_gbt* /usr/local/seti_gbt* /usr/local`] + for seti_gbt_dir in $seti_gbt_search_path + do + if test -d $seti_gbt_dir/lib + then + if test -f $seti_gbt_dir/lib/libsetigbt.so + then + cd $seti_gbt_dir + SETI_GBT=`pwd` + cd $thisdir + break + else + if $FIND $seti_gbt_dir -name "lib/libsetigbt.so" 2>/dev/null >/dev/null + then + SETI_GBT=`$FIND $seti_gbt_dir -name "lib/libsetigbt.so" -print | $HEAD -1 | sed 's/\/lib\/libsetigbt.so//'` + cd $SETI_GBT + SETI_GBT=`pwd` + cd $thisdir + break + fi + fi + fi + done + if test -n "$SETI_GBT" + then + AC_MSG_RESULT($SETI_GBT) + else + AC_MSG_RESULT(not found) + no_seti_gbt=yes + fi +]) diff --git a/m4/sah_find_s4path.m4 b/m4/sah_find_s4path.m4 new file mode 100644 index 0000000..4c51d1a --- /dev/null +++ b/m4/sah_find_s4path.m4 @@ -0,0 +1,32 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_DEFUN([SAH_FIND_S4PATH],[ +AC_MSG_CHECKING([path to S4 library]) +s4_search_path="$S4PATH /usr/local/warez/projects/s4/siren /disks/cyclops/c/users/seti/s4/siren" +for tmp_dir in $s4_search_path +do + if test -f $tmp_dir/lib/libs4.a + then + S4PATH=$tmp_dir + S4LIBS="-L$S4PATH/lib -ls4" + S4CFLAGS="-I$S4PATH/include" + S4_RECEIVER_CONFIG="$S4PATH/db/ReceiverConfig.tab" + break + fi +done +if test -n "$S4PATH" +then + AC_MSG_RESULT([$S4PATH]) +else + no_s4=yes + AC_MSG_RESULT([not found]) +fi +AC_SUBST([S4PATH]) +AC_SUBST([S4LIBS]) +AC_SUBST([S4CFLAGS]) +AC_DEFINE_UNQUOTED([S4_RECEIVER_CONFIG_FILE],["$S4_RECEIVER_CONFIG"],[Path to the S4 receiver config file]) +]) + diff --git a/m4/sah_find_setilib.m4 b/m4/sah_find_setilib.m4 new file mode 100644 index 0000000..5cd132f --- /dev/null +++ b/m4/sah_find_setilib.m4 @@ -0,0 +1,33 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_DEFUN([SAH_FIND_SETILIB],[ +AC_MSG_CHECKING([path to setilib library]) +setilib_search_path="$SETILIBDIR setilib ../setilib $HOME/setilib /usr/local /usr/local/setilib /usr/local/lib/setilib /opt/misc/setilib /opt/misc/lib/setilib" +for tmp_dir in $setilib_search_path +do + if test -f $tmp_dir/lib/libseti.a + then + mydir=`pwd` + cd $tmp_dir + SETILIB_PATH=`pwd` + SETILIB_LIBS="-L$SETILIB_PATH/lib -lseti" + SETILIB_CFLAGS="-I$SETILIB_PATH/include -I$SETILIB_PATH" + cd $mydir + break + fi +done +if test -n "$SETILIB_PATH" +then + AC_MSG_RESULT([$SETILIB_PATH]) +else + no_setilib=yes + AC_MSG_RESULT([not found]) +fi +AC_SUBST([SETILIB_PATH]) +AC_SUBST([SETILIB_LIBS]) +AC_SUBST([SETILIB_CFLAGS]) +]) + diff --git a/m4/sah_grx.m4 b/m4/sah_grx.m4 new file mode 100644 index 0000000..47a96a6 --- /dev/null +++ b/m4/sah_grx.m4 @@ -0,0 +1,27 @@ + + +AC_DEFUN([SAH_GRX_LIBS],[ + AC_LANG_PUSH(C) + sah_save_libs="$LIBS" + AC_PATH_PROG(XLSFONTS,[xlsfonts],[/usr/X11/bin:/usr/X11R6/bin:/usr/X11R5/bin:/usr/X11R4/bin:/usr/openwin/bin:$PATH]) + sah_xpath=`echo $XLSFONTS | sed 's/bin\/xlsfonts//' ` + LIBS=`echo $LIBS "-L$sah_xpath"` + GRXLIBS="-L${sah_xpath} -ljpeg -lX11 -lXext -lXt -lICE -lSM -lGL -lGLU -lm" + LIBS="$sah_save_libs" + AC_SUBST(GRXLIBS) + AC_LANG_POP +]) + +AC_DEFUN([SAH_GRX_INCLUDES],[ + AC_LANG_PUSH(C++) + AC_PATH_PROG(XLSFONTS,[xlsfonts],[/usr/X11/bin:/usr/X11R6/bin:/usr/X11R5/bin:/usr/X11R4/bin:/usr/openwin/bin:$PATH]) + sah_xpath=`echo $XLSFONTS | sed 's/bin\/xlsfonts//' ` + save_cflags="$CFLAGS" + CFLAGS=`echo $CFLAGS "-I$sah_xpath/include"` + GRX_CFLAGS="-I$sah_xpath" + AC_SUBST(GRX_CFLAGS) + AC_CHECK_HEADERS([gl.h glu.h glut.h freeglut.h glaux.h GL/gl.h GL/glu.h GL/glut.h GL/freeglut.h GL/glaux.h OpenGL/gl.h OpenGL/glu.h OpenGL/glut.h OpenGL/freeglut.h OpenGL/glaux.h glut/glut.h glut/freeglut.h freeglut/freeglut.h MesaGL/gl.h MesaGL/glu.h MesaGL/glut.h MesaGL/freeglut.h MesaGL/glaux.h ]) + CFLAGS="$save_cflags" + AC_LANG_POP +]) + diff --git a/m4/sah_header_stdcxx.m4 b/m4/sah_header_stdcxx.m4 new file mode 100644 index 0000000..7c6ee99 --- /dev/null +++ b/m4/sah_header_stdcxx.m4 @@ -0,0 +1,71 @@ +# The contents of this file are subject to the BOINC Public License +# Version 1.0 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://boinc.berkeley.edu/license_1.0.txt + +AC_PREREQ([2.54]) + +AC_DEFUN([SAH_HEADER_STDCXX],[ + save_inc="$ac_includes_default" + ac_includes_default=" +#define CONFIG_TEST +#include \"$BOINCDIR/lib/std_fixes.h\" +$ac_includes_default + +" + + sah_stdcxx_headers="algorithm bitset cassert cctype cerrno cfloat climits clocale cmath complex csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime deque fstream functional iomanip ios iosfwd iostream istream iterator limits list locale map memory numeric ostream queue set sstream stack stdexcept streambuf string utility valarray vector" + AC_LANG_PUSH(C++) + dnl First we'll check to see if they are all here in order to save time. + AC_MSG_CHECKING([standard C++ headers]) + tmp_includes= + for header in $sah_stdcxx_headers + do + tmp_includes="$tmp_includes +#include <$header> +" + done + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +$ac_includes_default +$tmp_includes + ]], + [] + )], + [ + ac_includes_default="${ac_includes_default} +${tmp_includes} +" + sah_cxx_includes=${tmp_includes} + AC_MSG_RESULT(yes) + for header in $sah_stdcxx_headers + do + eval ac_cv_header_${header}=yes + ac_uc_defn=HAVE_`echo ${header} | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + AC_DEFINE_UNQUOTED([${ac_uc_defn}],1,[Define to 1 if you have the ${header} header]) + AC_CACHE_CHECK([for C++ header <${header}>],[ac_cv_header_${header}]) + done + ], + [ + ac_includes_default="$save_inc" + AC_MSG_RESULT(no) + AC_CHECK_HEADERS([$sah_stdcxx_headers]) + for header in $sah_stdcxx_headers + do + eval tmp_var=\$ac_cv_header_${header} + if test "$tmp_var" = "yes" + then + sah_cxx_includes="$sah_cxx_includes +#include <$header> +" + fi + done + ] + ) + ac_includes_default="$save_inc" + AC_CACHE_SAVE + AC_LANG_POP(C++) + CONFIG_TEST= +]) + diff --git a/m4/sah_informix.m4 b/m4/sah_informix.m4 new file mode 100644 index 0000000..4a82bc8 --- /dev/null +++ b/m4/sah_informix.m4 @@ -0,0 +1,47 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_DEFUN([SAH_CHECK_INFORMIX],[ + AC_ARG_VAR([INFORMIXDIR],[informix directory]) + AC_LANG_PUSH(C) + AC_MSG_CHECKING(for Informix) + if test -z "$INFORMIXDIR" + then + AC_PATH_PROG([INFORMIXDIR],[dbaccess],[],[/disks/galileo/a/apps/informix/bin:$PATH:/usr/local/informix/bin:/opt/misc/informix:~informix/bin]) + INFORMIXDIR=`echo $INFORMIXDIR | $SED 's/bin\/dbaccess//'` + fi + if test -n "$INFORMIXDIR" + then + AC_MSG_RESULT(yes) + INFORMIX_CFLAGS="-I$INFORMIXDIR/incl -I$INFORMIXDIR/incl/esql " + INFORMIX_LIBS=" -L$INFORMIXDIR/lib -L$INFORMIXDIR/lib/esql $INFORMIXDIR/lib/esql/checkapi.o -lifasf -lifgen -lifgls -lifos -lifsql" + AC_CHECK_LIB([socket], [bind], INFORMIX_LIBS="${INFORMIX_LIBS} -lsocket") + AC_CHECK_LIB([nsl], [gethostbyname], INFORMIX_LIBS="${INFORMIX_LIBS} -lnsl") + AC_CHECK_LIB([crypt], [crypt], INFORMIX_LIBS="${INFORMIX_LIBS} -lcrypt") + AC_CHECK_LIB([dl], [dlopen], INFORMIX_LIBS="${INFORMIX_LIBS} -ldl") + AC_CHECK_LIB([m], [ceil], INFORMIX_LIBS="${INFORMIX_LIBS} -lm") + + tmpvar=$LIBS + LIBS=`echo $LIBS $INFORMIX_LIBS` + AC_MSG_CHECKING(informix library flags) + AC_TRY_LINK_FUNC(main,AC_DEFINE([USE_INFORMIX],[1],[Define to 1 if informix is installed]) sah_cv_use_informix="yes", sah_cv_use_informix="no") + AC_MSG_RESULT($sah_cv_use_informix) + LIBS=$tmpvar + SAH_FORCE_LIBSEARCH_PATH(tmpvar,[$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql]) + INFORMIX_LIBS=`echo $tmpval $INFORMIX_LIBS` + else + INFORMIXDIR= + INFORMIX_CFLAGS= + INFORMIX_LIBS= + AC_MSG_RESULT(no) + no_informix=yes + fi + AC_SUBST(INFORMIXDIR) + AC_SUBST(INFORMIX_CFLAGS) + AC_SUBST(INFORMIX_LIBS) + AC_LANG_POP +]) + + diff --git a/m4/sah_largefile_breaks_cxx.m4 b/m4/sah_largefile_breaks_cxx.m4 new file mode 100644 index 0000000..c1af234 --- /dev/null +++ b/m4/sah_largefile_breaks_cxx.m4 @@ -0,0 +1,27 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_DEFUN([SAH_LARGEFILE_BREAKS_CXX],[ + AC_MSG_CHECKING([whether largefile support breaks C++]) + AC_LANG_PUSH(C++) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ + #define CONFIG_TEST + #include + ]], + [[ + std::cout << 1.0 << std::endl; + ]])], + [tmp_res="no"], + [AC_DEFINE([LARGEFILE_BREAKS_CXX],[1], + ["Define to 1 if largefile support causes missing symbols in C++"] ) + tmp_res="yes" + sah_cxx_includes=`echo "#include \"$BOINCDIR/lib/std_fixes.h\"" ; echo $sah_cxx_includes` + ] + ) + AC_MSG_RESULT($tmp_res) + AC_LANG_POP +]) + diff --git a/m4/sah_libext.m4 b/m4/sah_libext.m4 new file mode 100644 index 0000000..4f569e7 --- /dev/null +++ b/m4/sah_libext.m4 @@ -0,0 +1,33 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_DEFUN([SAH_LIBEXT],[ + AC_MSG_CHECKING(library extension) + if test -n `echo $AR | grep ar` + then + LIBEXT=a + else + LIBEXT=lib + fi + AC_MSG_RESULT($LIBEXT) + AC_SUBST(LIBEXT) +]) + +AC_DEFUN([SAH_DLLEXT],[ + AC_MSG_CHECKING(shared object extension) + case "${host}" in + *-*-emx* | *-*-mingw* | *-*-cygwin* | *-*-rmx*) + DLLEXT="dll" + ;; + *-*-darwin*) + DLLEXT="dylib" + ;; + *) + DLLEXT="so" + ;; + esac + AC_MSG_RESULT($DLLEXT) + AC_SUBST(DLLEXT) +]) diff --git a/m4/sah_libsearch.m4 b/m4/sah_libsearch.m4 new file mode 100644 index 0000000..f7023a0 --- /dev/null +++ b/m4/sah_libsearch.m4 @@ -0,0 +1,34 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_DEFUN([SAH_FORCE_LIBSEARCH_PATH],[ + if test -z "$LD" + then + AC_PATH_PROGS([LD],[ld link]) + fi + if test "$GCC" = "yes" + then + link_pass_flag="-Xlinker " + else + if test "$CC" = "lcc" + then + link_pass_flag="-Wl" + fi + fi + if test -n "$link_pass_flag" + then + if test -n "$LD" + then + if $LD -V 2>&1 | grep GNU + then + $1="$link_pass_flag -rpath $link_pass_flag $2 " + else + $1="$link_pass_flag -R $link_pass_flag $2 " + fi + fi + fi +]) + + diff --git a/m4/sah_links.m4 b/m4/sah_links.m4 new file mode 100644 index 0000000..492282d --- /dev/null +++ b/m4/sah_links.m4 @@ -0,0 +1,36 @@ +AC_DEFUN([SAH_LINKS],[ + AC_PATH_PROGS(LN,[ln cp copy]) + if test -n "$LN" ; then + AC_MSG_CHECKING(whether '$LN' works) + if $LN config.sub erase.me$$ && \ + test -e erase.me$$ && \ + diff config.sub erase.me$$ >/dev/null 2>&5 + then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + LN=cp + fi + /bin/rm erase.me$$ + else + LN=cp + fi + AC_PROG_LN_S + if test -n "$LN_S" ; then + AC_MSG_CHECKING(whether '$LN_S' really works or whether I'm deluding myself) + if $LN_S config.sub erase.me$$ && \ + test -e erase.me$$ && \ + diff config.sub erase.me$$ >/dev/null 2>&5 + then + AC_MSG_RESULT(it works) + else + AC_MSG_RESULT(I'm deluding myself) + LN_S=cp + fi + /bin/rm erase.me$$ + else + LN_S=cp + fi +]) + + diff --git a/m4/sah_make_dll.m4 b/m4/sah_make_dll.m4 new file mode 100644 index 0000000..7ed00f4 --- /dev/null +++ b/m4/sah_make_dll.m4 @@ -0,0 +1,14 @@ +AC_DEFUN([SAH_LINK_DLL],[ + case ${host} in + *darwin*) + LINK_DLL="${CC} -fPIC -bundle -flat_namespace -undefined suppress" + ;; + *solaris*) + LINK_DLL="/usr/ccs/bin/ld -G " + ;; + *) + LINK_DLL="${CC} -fPIC -shared" + ;; + esac + AC_SUBST(LINK_DLL) +]) diff --git a/m4/sah_mysql.m4 b/m4/sah_mysql.m4 new file mode 100644 index 0000000..7dff3de --- /dev/null +++ b/m4/sah_mysql.m4 @@ -0,0 +1,30 @@ +# SETI_BOINC is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. + +AC_DEFUN([SAH_CHECK_MYSQL],[ +AC_LANG_PUSH(C) +AC_ARG_VAR([MYSQL_CONFIG], [mysql_config program]) +if test -z "$MYSQL_CONFIG"; then + AC_PATH_PROG(MYSQL_CONFIG,mysql_config,,[$PATH:/usr/local/mysql/bin:/opt/misc/mysql/bin:~mysql/bin]) +fi +if test -z "$MYSQL_CONFIG" +then + echo MYSQL not found + no_mysql=yes +else + AC_MSG_RESULT(yes) + AC_MSG_CHECKING(mysql libraries) + MYSQL_LIBS=`${MYSQL_CONFIG} --libs` + AC_MSG_RESULT($MYSQL_LIBS) + AC_MSG_CHECKING(mysql includes) + MYSQL_CFLAGS=`${MYSQL_CONFIG} --cflags` + AC_DEFINE(USE_MYSQL,1,[Define if MYSQL is installed]) + AC_MSG_RESULT($MYSQL_CFLAGS) +fi +AC_SUBST(MYSQL_LIBS) +AC_SUBST(MYSQL_CFLAGS) +AC_LANG_POP +]) + diff --git a/m4/sah_namespace.m4 b/m4/sah_namespace.m4 new file mode 100644 index 0000000..5ac7b73 --- /dev/null +++ b/m4/sah_namespace.m4 @@ -0,0 +1,98 @@ +# The contents of this file are subject to the BOINC Public License +# Version 1.0 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://boinc.berkeley.edu/license_1.0.txt +# +# Revision Log: +# $Log: sah_namespace.m4,v $ +# Revision 1.5.2.1 2005/05/19 01:07:10 korpela +# *** empty log message *** +# +# Revision 1.3 2005/05/10 15:43:56 korpela +# Fixed bug in caching of SAH_FUNCS_IN_NAMESPACE results. +# +# Revision 1.2 2005/05/06 00:31:05 korpela +# Added caching of results to SAH_CHECK_NAMESPACES and SAH_FUNCS_IN_NAMESPACE +# +# Revision 1.1 2003/12/11 18:38:24 korpela +# Added checked macro files into boinc +# +# Revision 1.5 2003/12/03 23:46:11 korpela +# Fixed "sah_namespaces.m4" not to rely on "tr". +# +# + +AC_PREREQ([2.54]) + + +AC_DEFUN([SAH_LC_TO_DEFN],[ + $1=`echo $2 | $AWK '{split($[]1,a,"(");print a[[ 1 ]]}' | $as_tr_cpp` +]) + +AC_DEFUN([SAH_NS_TO_DEFN],[ + $1=`echo $2 | $as_tr_cpp` +]) + +AC_DEFUN([SAH_CHECK_NAMESPACES],[ + AC_LANG_PUSH(C++) + sv_libs="${LIBS}" + LIBS= + AC_CACHE_CHECK([for C++ namespaces], + [sah_cv_have_namespaces],[ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([ + #define CONFIG_TEST + namespace foo { + int foo(void) { return(0); } + } + ],[ + return foo::foo(); + ]) + ], [sah_cv_have_namespaces="yes"], [sah_cv_have_namespaces="no"]) + ]) + if test "${sah_cv_have_namespaces}" = "yes" ; then + AC_DEFINE(HAVE_NAMESPACES,[1],[Define if your C++ compiler supports namespaces]) + fi + LIBS="${sv_libs}" + AC_LANG_POP(C++) +]) + +AC_DEFUN([SAH_FUNCS_IN_NAMESPACE],[ + AC_LANG_PUSH(C++) + sv_libs="${LIBS}" + LIBS= + for func_name in $1 + do + func_name=m4_quote($func_name) + t_ns=m4_quote($2) + SAH_LC_TO_DEFN(ac_func_upper,[$func_name]) + SAH_LC_TO_DEFN(ac_namespace_upper,[$t_ns]) + ac_uc_defn=`echo HAVE_"$ac_namespace_upper"_$ac_func_upper` + AC_CACHE_CHECK([for $func_name in namespace $t_ns], + [sah_cv_func_$2_$ac_func_upper],[ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #define CONFIG_TEST + $sah_cxx_includes + ]], + [[ + $2::$func_name ; + ]])], + [ + eval sah_cv_func_$2_$ac_func_upper="yes" + ], + [ + eval sah_cv_func_$2_$ac_func_upper="no" + ] + ) + ]) + if test "`eval echo '${'sah_cv_func_$2_$ac_func_upper'}'`" = "yes" ; then + AC_DEFINE_UNQUOTED([$ac_uc_defn], [1], + ["Define to 1 if $func_name is in namespace $t_ns::" ]) + fi + done + LIBS="${sv_libs}" + AC_LANG_POP(C++) +]) + + diff --git a/m4/sah_raw_ldflags.m4 b/m4/sah_raw_ldflags.m4 new file mode 100644 index 0000000..84d50a5 --- /dev/null +++ b/m4/sah_raw_ldflags.m4 @@ -0,0 +1,5 @@ +AC_DEFUN([SAH_RAW_LDFLAGS],[ + $2=`echo $1 | $SED 's/-Wl,//g'` + echo RAW_LDFLAGS:$2=`echo $1 | $SED 's/-Wl,//g'` >&5 + AC_SUBST([$2]) +]) diff --git a/m4/sah_requires.m4 b/m4/sah_requires.m4 new file mode 100644 index 0000000..eda657f --- /dev/null +++ b/m4/sah_requires.m4 @@ -0,0 +1,38 @@ + +AC_DEFUN([SAH_REQUIRES],[ + $2 + if test $3; then + AC_MSG_WARN([ $1 not found. +============================================================================ +$4 +============================================================================ +]) +$5 + fi +]) + + +AC_DEFUN([SAH_SERVER_REQUIRES],[ +if test "${enable_server}" = yes; then + SAH_REQUIRES([$1],[$2],[$3], +[ +WARNING: trying to build the seti_boinc server but $1 was not found. +If you don't want to build the server you should use --disable-server. + +I am continuing now as if --disable-server had been specified. +],[enable_server=no]) +fi +]) + +AC_DEFUN([SAH_CLIENT_REQUIRES],[ +if test "${enable_client}" = yes; then + SAH_REQUIRES([$1],[$2],[$3], +[ +WARNING: trying to build the seti_boinc client but $1 was not found. +If you don't want to build the client you should use --disable-client. + +I am continuing now as if --disable-client had been specified. +],[enable_client=no]) +fi +]) + diff --git a/m4/sah_select_bitness.m4 b/m4/sah_select_bitness.m4 new file mode 100644 index 0000000..f96a6bb --- /dev/null +++ b/m4/sah_select_bitness.m4 @@ -0,0 +1,56 @@ +AC_DEFUN([SAH_DEFAULT_BITNESS],[ + if test -z "${COMPILER_MODEL_BITS}" + then + AC_MSG_CHECKING(default bitness of compiler) + echo "int main() { return 0; }" >conftest.c + ${CC} ${CFLAGS} -c conftest.c >&5 + COMPILER_MODEL_BITS=32 + if test -f conftest.${OBJEXT} ; then + if test -n "`file conftest.${OBJEXT} | grep -i 64-bit`" + then + COMPILER_MODEL_BITS=64 + else + if test -n "`file conftest.${OBJEXT} | grep -i 16-bit`" + then + COMPILER_MODEL_BITS=16 + fi + fi + fi + /bin/rm conftest.c + AC_MSG_RESULT($COMPILER_MODEL_BITS) + fi +]) + + +AC_DEFUN([SAH_SELECT_BITNESS],[ + AC_LANG_PUSH(C) + SAH_DEFAULT_BITNESS + AC_MSG_CHECKING(Selecting $1 bit model) + echo "int main() { return 0; }" >conftest.$ac_ext + if test "$1" != "${COMPILER_MODEL_BITS}" + then + ${CC} ${CFLAGS} ${CPPFLAGS} -m$1 -c conftest.$ac_ext >&5 + if test -f conftest.${OBJEXT} ; then + if test -n "`file conftest.${OBJEXT} | grep -i $1-bit`" + then + CFLAGS="${CFLAGS} -m$1" + AC_MSG_RESULT(-m$1) + COMPILER_MODEL_BITS=$1 + fi + AC_MSG_RESULT(failed) + fi + else + AC_MSG_RESULT(ok) + fi + AC_LANG_POP(C) +]) + +AC_DEFUN([SAH_OPTION_BITNESS],[ + AC_ARG_ENABLE(bitness, + AC_HELP_STRING([--enable-bitness=(32,64)], + [enable 32 or 64 bit object/executable files] + ), + [SAH_SELECT_BITNESS(${enableval})], + [SAH_DEFAULT_BITNESS] + ) +]) diff --git a/m4/sah_staticize_ldflags.m4 b/m4/sah_staticize_ldflags.m4 new file mode 100644 index 0000000..93ddcd7 --- /dev/null +++ b/m4/sah_staticize_ldflags.m4 @@ -0,0 +1,41 @@ +AC_DEFUN([SAH_STATICIZE_LDFLAGS],[ + STATIC_LIB_LIST="${STATIC_LIB_LIST} $3" + liblist=`echo $1 | $AWK '{for (i=1;i<(NF+1);i++) {print $[]i;}}' | grep -v "Wl,[sd]" ` + ssl_sah_save_libs="${LIBS}" + echo "DEBUG: before mangling $2:$1" >&5 + sah_outputlibs= + for somelib in ${liblist}; do + # look for the -l to find the libraries + alib=`echo x${somelib} | grep x-l | sed 's/x-l//'` + if test -n "${alib}" + then + # check to see if it is in our static list + for slib in ${STATIC_LIB_LIST}; do + lib_is_static="no" + tmp_pattern=`echo s/x${slib}// | sed 's/\*/.*/'` + if test -z "`echo x${alib} | sed ${tmp_pattern}`" + then + SAH_STATIC_LIB(${alib},[fopen],[sah_outputlibs="${sah_outputlibs} ${sah_lib_last}"]) + lib_is_static="yes" + break; + fi + done + if test "${lib_is_static}" = "no" ; then + SAH_DYNAMIC_LIB(${alib},[fopen],[sah_outputlibs="${sah_outputlibs} ${sah_lib_last}"]) + fi + else + tmp_pattern_a="s/x${ld_dynamic_option}//" + tmp_pattern_b="s/x${ld_static_option}//" + if test -n "`echo x${somelib} | sed ${tmp_pattern_a}`" -a \ + -n "`echo x${somelib} | sed ${tmp_pattern_b}`" + then + sah_outputlibs="${sah_outputlibs} ${somelib}" + LIBS="${LIBS} ${somelib}" + fi + fi + done + echo "DEBUG: final link-line for $2:${sah_outputlibs}" >&5 + $2=${sah_outputlibs} + LIBS="${ssl_sah_save_libs}" +]) + diff --git a/nightly-tarball b/nightly-tarball new file mode 100755 index 0000000..85ad46c --- /dev/null +++ b/nightly-tarball @@ -0,0 +1,37 @@ +#!/bin/sh + +## $Id: nightly-tarball,v 1.6.2.6 2007/06/01 20:46:03 korpela Exp $ + +# Create a nightly tarball from CVS export + +# need to set PATH because we might be running from a cron job. +# on our Solaris servers, cvs is in /opt/misc/bin + +cd `dirname $0` + +#CVSROOT=/usr/local/warez/cvsroot \ +# CHECKOUT='cvs checkout -r HEAD lib/fftw-3.1.1 && mv lib/fftw-3.1.1 .' \ +# DIR=fftw-3.1.1 \ +# FILENAME_TGZ="fftw-3.1.1_seti.tar.gz" \ +# FILENAME_ZIP="fftw-3.1.1_seti.zip" \ +# DESTINATION="/home/boincadm/projects/sah/html/user/seti_source/nightly/" \ +# ./export-tarball + +# CVSROOT=/usr/local/warez/cvsroot \ +# CHECKOUT='cvs checkout -r HEAD seti_boinc && (cd seti_boinc && ./trim_sources DOIT)' \ +# DIR=seti_boinc \ +# FILENAME_TGZ="seti_boinc-client-cvs-TODAY.tar.gz" \ +# FILENAME_ZIP="seti_boinc-client-cvs-TODAY.zip" \ +# DESTINATION="/home/boincadm/projects/sah/html/user/seti_source/nightly/" \ +# ./export-tarball + + CHECKOUT='svn export file:///home/svn/seti_boinc' \ + DIR=seti_boinc \ + FILENAME_TGZ="setiathome_enhanced-client-cvs-TODAY.tar.gz" \ + FILENAME_ZIP="setiathome_enhanced-client-cvs-TODAY.zip" \ + DESTINATION="/home/boincadm/projects/sah/html/user/seti_source/nightly/" \ + ./export-tarball + +cd /home/boincadm/projects/sah/html/user/seti_source/nightly/ +find . -mtime +30 -exec mv {} old \; +/bin/rm -rf /tmp/export-tarball-* diff --git a/ops/bin/README b/ops/bin/README new file mode 100644 index 0000000..0dff97a --- /dev/null +++ b/ops/bin/README @@ -0,0 +1,22 @@ +This is the seti_boinc ops/bin directory. Here you will find all kinds +of script/binary tools for day-to-day operations of seti (and other +affiliated projects). If you add anything, please note here where you +expect the actually script to live and run in normal life. + +### The following are in ~seti/dr2_data/productions/scripts and are +### used for data_pipeline management. Note that data_flow.cfg is a +### perl "include file" that many of the other scripts read in before +### executing. Maybe that should go elsewhere at some point. + +avg_file_create_dir +count_hard_links.csh +count_wugs_wus_by_tape.csh +data_flow.cfg +erase_data_drive +file_to_thumper +fill_xfer_to_hpss +make_hpss_script +make_xfer_script +run_jan.csh +seti_hsi.csh +xfer_to_hpss diff --git a/ops/bin/avg_file_create_dir b/ops/bin/avg_file_create_dir new file mode 100755 index 0000000..8ba036f --- /dev/null +++ b/ops/bin/avg_file_create_dir @@ -0,0 +1,21 @@ +#! /usr/bin/env perl + +$now = time(); +@files = `/bin/ls -1`; +$alltime = 0; +$count = 0; +foreach $file (@files) { + chomp $file; + if (($now - (stat($file))[9]) > 5184000) { + print "$file too old - skipping\n"; + } + else { + $count++; + $alltime += (stat($file))[9]; + print "$file\n"; + } + } +$avg = $alltime / $count; +print "average mtime: $avg (" . localtime($avg) . ")\n"; +exit (0); + diff --git a/ops/bin/count_hard_links.csh b/ops/bin/count_hard_links.csh new file mode 100755 index 0000000..34d6c2f --- /dev/null +++ b/ops/bin/count_hard_links.csh @@ -0,0 +1,3 @@ +#! /bin/csh + +echo $1" "`stat -c%h $1` diff --git a/ops/bin/count_wugs_wus_by_tape.csh b/ops/bin/count_wugs_wus_by_tape.csh new file mode 100755 index 0000000..06a385f --- /dev/null +++ b/ops/bin/count_wugs_wus_by_tape.csh @@ -0,0 +1,39 @@ +#! /bin/csh + + +if(${#argv} == 0 || $1 == "-h") then + echo " " + echo spikesbytape db tape_name + echo " " + exit +endif + +set DB = $1 +set TAPE = $2 + +source ~davea/seti/db/$DB + +dbaccess -e - << HERE + +database sah2; + +select tape.id, tape.name, tape.beam, tape.last_block_done, + count(workunit_grp.id) from tape, workunit_grp + where + tape.name = "$TAPE" and + workunit_grp.tape_info = tape.id + group by + tape.id, tape.name, tape.beam, tape.last_block_done + order by + tape.name, tape.beam; + +select count(workunit.id)/3584 from workunit, workunit_grp, tape where + workunit.group_info = workunit_grp.id and + workunit_grp.tape_info = tape.id and + tape.name = "$TAPE"; + + +HERE + +echo "checking down at HPSS:" +/disks/thumper/raid5_d/users/seti/dr2_data/production/scripts/seti_hsi.csh --list $TAPE diff --git a/ops/bin/data_flow.cfg b/ops/bin/data_flow.cfg new file mode 100755 index 0000000..e1bf8ab --- /dev/null +++ b/ops/bin/data_flow.cfg @@ -0,0 +1,98 @@ +#! /usr/bin/env perl + +# data_flow.cfg - edit all data_flow config stuff here for scripts in: +$scriptdir = "/disks/thumper/raid5_d/users/seti/dr2_data/production/scripts"; + +# list of possible data drives and where they should be mounted +@drive_array=("/dev/sda1","/dev/sdb1","/dev/sdc1","/dev/sdd1"); +@drive_mount_points=("/mnt/seti_data_1","/mnt/seti_data_2","/mnt/seti_data_3","/mnt/seti_data_4"); +$num_drives = scalar(@drive_array); + +# a list of possible block sizes for data drives (to check for proper disk in fdisk) +@partition_block_sizes=(488384001,732572001); + +# where to write data to (via scp) +$scpdatato = 'seti@thumper:/mydisks/raid5_d/users/seti/dr2_data/production/processing'; + +# NFS directory where files are going to AS WELL AS +# where to check for full disk (via nfs/df) and where files will end up: +$nfsdatato = "/disks/thumper/raid5_d/users/seti/dr2_data/production/processing"; +$fullcheck = $nfsdatato; + +# NFS directory where processing is +$processing_dir = $fullcheck; # same as nfsdatati/fullcheck usually + +# NFS directory where xfer_to_hpss is +$xfer_to_hpss_dir = "/disks/thumper/raid5_d/users/seti/dr2_data/production/xfer_to_hpss"; + +# NFS directory where trigger files are +$triggers_dir = "/disks/thumper/raid5_d/users/seti/dr2_data/production/trigger_files"; + +# trigger files: +$xferring_to_hpss = "$triggers_dir/xferring_to_hpss"; + +# buffer space (in bytes) for full disk (i.e. how much under 100% full before we just call it full) +$buffer = 60000000000; # ~60GB + +# md5sum size (bytes) +$md5size = 1073741824; + +# where to write md5s to (via scp) +$scpmd5to = 'seti@thumper:/mydisks/raid5_d/users/seti/dr2_data/production/md5'; + +# email recipients +$mailto = 'mattl@ssl.berkeley.edu jeffc@ssl.berkeley.edu'; + +# lock file to avoid restart: +$lockfile = "/root/lock.data_flow_lando"; + +$awk = "/bin/awk"; +$cat = "/bin/cat"; +$df = "/bin/df"; +$fdisk = "/sbin/fdisk"; +$grep = "/bin/grep"; +$head = "/usr/bin/head"; +$hsi = "$scriptdir/seti_hsi.csh"; +$ln = "/bin/ln"; +$ls = "/bin/ls"; +$mail = "/bin/mail"; +$md5sum = "/usr/bin/md5sum"; +$mke2fs = "/sbin/mke2fs"; +$mount = "/bin/mount"; +$mv = "/bin/mv"; +$ps = "/bin/ps"; +$rm = "/bin/rm"; +$scp = "/usr/bin/scp"; +$su = "/bin/su"; +$tail = "/usr/bin/tail"; +$touch = "/bin/touch"; +$umount = "/bin/umount"; +$wc = "/usr/bin/wc"; +$whoami = "/usr/bin/whoami"; + +# MODULES TO INCLUDE: + +use File::Basename; + +# FUNCTIONS: + +sub send_mail { + my $subject = $_[0]; + my $message = $_[1]; + open (SENDMAIL,"|$mail -s \"$subject\" $mailto"); + print SENDMAIL "$message\n"; + close (SENDMAIL); + return 0; + } + +# PRELIMINARY CHECKS: + +$hostname = `/usr/ucb/hostname`; chomp $hostname; +$whoami = `/usr/bin/whoami`; chomp $whoami; + +if ($whoami ne "root") { + print "sorry - all data flow scripts must be run as root\n"; + print "(don't worry - we'll su to seti as needed)\n"; + exit(0); + } + diff --git a/ops/bin/erase_data_drive b/ops/bin/erase_data_drive new file mode 100755 index 0000000..7cd755f --- /dev/null +++ b/ops/bin/erase_data_drive @@ -0,0 +1,101 @@ +#! /usr/bin/env perl + +# where is the configuration file? +$cfgfile = "/disks/thumper/raid5_d/users/seti/dr2_data/production/scripts/data_flow.cfg"; + +# read it in and continue... +$cfg = ""; +open (CNFFILE,$cfgfile) or die "cannot open configuration file: $cfgfile\nmake sure this variable is set properly"; +while () { $cfg .= $_ } +close (CNFFILE); +eval $cfg; + +$drivedev = $ARGV[0]; +if ($drivedev eq "" || $drivedev eq "-h" || $drivedev eq "--help") { + print "usage: erase_data_drive device_name (i.e. /dev/sdx2)\n"; + print " note: will only work on unmounted drives\n\n"; + exit (1); + } + +if (! -b $drivedev) { + print "no such device: $drivedev - exiting...\n"; + exit (1); + } + +$ismounted = `$mount | $awk '\$1 == "$drivedev"'`; +if ($ismounted ne "") { + print "drive $drivedev currently mounted! exiting...\n"; + exit (1); + } + +$tmpmount = "/mnt/temp_data_$$"; +print "making temporary mount point: $tmpmount...\n"; +mkdir $tmpmount || die "cannot make mount point: $tmpmount"; + +print "mounting $drivedev on $tmpmount...\n"; +system ("$mount $drivedev $tmpmount"); + +print ".AO_DATA number on the data drive is: "; +$aonumber = ""; +if (-f "$tmpmount/.AO_DATA") { + $aonumber = `$cat $tmpmount/.AO_DATA`; + chomp $aonumber; + } +if ($aonumber eq "") { + print "there is no number! exiting...\n"; + chdir ("/root"); + system ("$umount $drivedev"); + rmdir $tmpmount || die "cannot remove mount point: $tmpmount"; + exit (1); + } +print "$aonumber\n"; + +print "double checking data files are elsewhere...\n"; +chdir ($tmpmount); # go to mounted drive +@datafiles = `$ls -1 [0-9][0-9][a-z][a-z][0-9][0-9][a-z][a-z]`; +foreach $datafile (@datafiles) { + chomp $datafile; + print " datafile: $datafile "; + if (-f "$xfer_to_hpss_dir/$datafile") { print "in xfer_to_hpss"; } + elsif (-f "$processing_dir/$datafile") { print "in processing"; } + else { + print "- checking at hpss... "; + $hsicommand = "$su seti -c \"$hsi --list $datafile\""; + $retval = system ($hsicommand . "> /dev/null"); + $retval = $retval >> 8; + if ($retval == 0) { print "yes"; } + else { + # file not at hpss, or anywhere obvious + print "no! can't find anywhere obvious - exiting...\n"; + chdir ("/root"); + system ("$umount $drivedev"); + rmdir $tmpmount || die "cannot remove mount point: $tmpmount"; + exit (1); + } + } + print "\n"; + } +chdir ("/root"); + +print "all files are somewhere else! moving on...\n"; +print "umounting $drivedev...\n"; +system ("$umount $drivedev"); + +print "okay here we go: WIPING DRIVE with mke2fs...\n"; +system ("$mke2fs -m 1 -T largefile4 -j $drivedev"); + +print "mounting empty $drivedev on $tmpmount...\n"; +system ("$mount $drivedev $tmpmount"); + +print "creating .AO_DATA file with number $aonumber...\n"; +open (AODATA,">$tmpmount/.AO_DATA"); +print AODATA $aonumber; +close (AODATA); +chmod 0000, "$tmpmount/.AO_DATA"; +chdir ("/root"); # just to be sure we can unmount + +print "umounting $drivedev one last time...\n"; +system ("$umount $drivedev"); + +print "removing temporary mount point: $tmpmount...\n"; +rmdir $tmpmount || die "cannot remove mount point: $tmpmount"; diff --git a/ops/bin/file_to_thumper b/ops/bin/file_to_thumper new file mode 100755 index 0000000..2bb586d --- /dev/null +++ b/ops/bin/file_to_thumper @@ -0,0 +1,79 @@ +#! /usr/bin/env perl + +# where is the configuration file? +$cfgfile = "/disks/thumper/raid5_d/users/seti/dr2_data/production/scripts/data_flow.cfg"; + +# read it in and continue... +$cfg = ""; +open (CNFFILE,$cfgfile) or die "cannot open configuration file: $cfgfile\nmake sure this variable is set properly"; +while () { $cfg .= $_ } +close (CNFFILE); +eval $cfg; + +$file = $ARGV[0]; +if ($file eq "" || $file eq "-h" || $file eq "--help") { + print "file_to_thumper full_path_to_file :\n copy data file to $nfsdatato (and do md5 checks)\n"; + exit (1); + } + +if (ord($file) ne ord("/")) { + print "$file doesn't big with a \"/\" - make sure you enter a full path!\n"; + exit (1); + } + +if (! -f $file) { + print "cannot find file: $file\n"; + exit (1); + } + +$basefile = basename($file); + +# will file fit on remote partition? + +$filesize = `$ls -l $file | $awk '{print \$5}'`; +chomp $filesize; +$spaceleft = `$df -P $fullcheck | $tail -1 | $awk '{print \$4}'`; +chomp $spaceleft; +$spaceleft *= 1024; +if (($filesize + $buffer) > $spaceleft) { + print "file: $file is too big to currently fit on $nfsdatato!\n"; + exit (1); + } + +# move the file, etc. + +print "file: $file (get md5s... "; +# get initial md5s +$headmd5 = `$head -c $md5size $file | $md5sum | awk '{print \$1}'`; +chomp $headmd5; +$tailmd5 = `$tail -c $md5size $file | $md5sum | awk '{print \$1}'`; +chomp $tailmd5; +open (OUTFILE,">${file}.md5_head_${md5size}"); +print OUTFILE $headmd5 . "\n"; +close (OUTFILE); +open (OUTFILE,">${file}.md5_tail_${md5size}"); +print OUTFILE $tailmd5 . "\n"; +close (OUTFILE); +# copy everything over +print "scp files... "; +system ("$su - seti -c \"$scp $file ${scpdatato}/${basefile}.copying\" > /dev/null 2>&1"); +system ("$su - seti -c \"$scp ${file}.md5_head_${md5size} $scpmd5to\" > /dev/null 2>&1"); +system ("$su - seti -c \"$scp ${file}.md5_tail_${md5size} $scpmd5to\" > /dev/null 2>&1"); +# check remote md5s +print "checking md5s... "; +$rheadmd5 = `$head -c $md5size $nfsdatato/${basefile}.copying | $md5sum | awk '{print \$1}'`; +chomp $rheadmd5; +$rtailmd5 = `$tail -c $md5size $nfsdatato/${basefile}.copying | $md5sum | awk '{print \$1}'`; +chomp $rtailmd5; +if ($rheadmd5 ne $headmd5 || $rtailmd5 ne $tailmd5) { + print "failure!)\n"; + send_mail("ALERT: file_to_thumper md5 mismatch","The file: $file failed to copy from $hostname to thumper due to md5 mismatch."); + system ("$touch $lockfile"); + exit(1); +} +system ("$su - seti -c \"$mv $nfsdatato/${basefile}.copying $nfsdatato/${basefile}\" > /dev/null 2>&1"); +print "unlinking... "; +#unlink "$file"; +unlink "${file}.md5_head_${md5size}"; +unlink "${file}.md5_tail_${md5size}"; +print "done!)\n"; diff --git a/ops/bin/fill_xfer_to_hpss b/ops/bin/fill_xfer_to_hpss new file mode 100755 index 0000000..0bbd6a3 --- /dev/null +++ b/ops/bin/fill_xfer_to_hpss @@ -0,0 +1,54 @@ +#! /usr/bin/env perl + +# where is the configuration file? +$cfgfile = "/disks/thumper/raid5_d/users/seti/dr2_data/production/scripts/data_flow.cfg"; + +# read it in and continue... +$cfg = ""; +open (CNFFILE,$cfgfile) or die "cannot open configuration file: $cfgfile\nmake sure this variable is set properly"; +while () { $cfg .= $_ } +close (CNFFILE); +eval $cfg; + +print "checking xfer_to_hpss directory for excess files..."; +chdir ($xfer_to_hpss_dir); +@datafiles = `$ls -1 [0-9][0-9][a-z][a-z][0-9][0-9][a-z][a-z]`; +foreach $datafile (@datafiles) { + chomp $datafile; + print "datafile: $datafile "; + $hsicommand = "$su seti -c \"$hsi --list $datafile\""; + $retval = system ($hsicommand . "> /dev/null"); + $retval = $retval >> 8; + if ($retval == 0) { + print "already at hpss - removing hard link"; + system ("$su seti -c \"$rm $xfer_to_hpss_dir/$datafile\""); + } + else { print " - not transferred yet"; } + print "\n"; + } + +chdir ($processing_dir); +@datafiles = `$ls -1 [0-9][0-9][a-z][a-z][0-9][0-9][a-z][a-z]`; +foreach $datafile (@datafiles) { + chomp $datafile; + print "datafile: $datafile "; + if (-f "${datafile}.at_hpss") { print "- .at_hpss exists - skipping"; } + else { + if (-f "$xfer_to_hpss_dir/$datafile") { print "- already hard linked in xfer_to_hpss - skipping"; } + else { + print "- checking at hpss... "; + $hsicommand = "$su seti -c \"$hsi --list $datafile\""; + $retval = system ($hsicommand . "> /dev/null"); + $retval = $retval >> 8; + if ($retval == 0) { print "already at hpss - skipping"; } + else { + # file here and not at hpss, so make hard link in xfer to hpss dir: + system ("$su seti -c \"$ln $datafile $xfer_to_hpss_dir/$datafile\""); + print " - made hard link in xfer_to_hpss"; + } + } + } + print "\n"; + } +exit (0); + diff --git a/ops/bin/make_hpss_script b/ops/bin/make_hpss_script new file mode 100755 index 0000000..8d4b836 --- /dev/null +++ b/ops/bin/make_hpss_script @@ -0,0 +1,12 @@ +#! /bin/csh + +# make_hpss_script - makes xfer_to_hpss script for all ??????? files in current directory + +set CURDIR = `/bin/pwd` + +echo '#! /bin/csh' +echo " " + +foreach i (`/bin/ls -1 [0-9][0-9][a-z][a-z][0-9][0-9][a-z][a-z]`) + echo /disks/thumper/raid5_d/users/seti/dr2_data/production/scripts/seti_hsi.csh --put $i +end diff --git a/ops/bin/make_xfer_script b/ops/bin/make_xfer_script new file mode 100755 index 0000000..92d5108 --- /dev/null +++ b/ops/bin/make_xfer_script @@ -0,0 +1,12 @@ +#! /bin/csh + +# make_xfer_script - makes file_to_thumper script for all ??????? files in current directory + +set CURDIR = `/bin/pwd` + +echo '#! /bin/csh' +echo " " + +foreach i (`/bin/ls -1 [0-9][0-9][a-z][a-z][0-9][0-9][a-z][a-z]`) + echo /disks/thumper/raid5_d/users/seti/dr2_data/production/scripts/file_to_thumper $CURDIR/$i +end diff --git a/ops/bin/run_gbt_splitter b/ops/bin/run_gbt_splitter new file mode 100755 index 0000000..3640fb6 --- /dev/null +++ b/ops/bin/run_gbt_splitter @@ -0,0 +1,264 @@ +#! /usr/bin/perl -w + +use locale; +use sigtrap qw(HUP TERM INT); +use Cwd; +use Fcntl; + +$ENV{'INFORMIXDIR'} = '/usr/local/informix'; +$ENV{'INFORMIXSQLHOSTS'} = '/usr/local/informix/etc/sqlhosts'; +$ENV{'INFORMIXSERVER'} = 'sah_master_tcp'; +# $ENV{'LD_LIBRARY_PATH'} = '/usr/local/informix/lib:/usr/local/informix/lib/esql:/usr/local/lib:/usr/X11R6/lib:/usr/lib:/lib:/usr/ccs/lib:/usr/local/lib:/usr/local/ssl/lib:/usr/local/informix/lib:/usr/local/informix/lib/esql:/usr/local/generic/lib:/usr/lib64:/usr/lib64/mysql'; +$ENV{'LD_LIBRARY_PATH'} = '/usr/local/informix/lib:/usr/local/informix/lib/esql:/usr/local/lib:/usr/X11R6/lib:/usr/lib:/lib:/usr/ccs/lib:/usr/local/lib:/usr/local/ssl/lib:/usr/local/informix/lib:/usr/local/informix/lib/esql:/usr/local/generic/lib:/usr/lib64:/usr/lib64/mysql:/disks/carolyn/b/home/jeffc/build/sah_development/seti_gbt/lib'; + +# GBT receivers must be specified with channel (0-31) and polarization (0-1), i.e. -gbt=14,0 + +# signal handler sub + +sub touch_and_die { + print STDERR time . " run_gbt_splitter caught signal and is touching ${split_halt_msg}..\n"; + system ("/bin/touch $split_halt_msg"); + exit(99) + } + +sub is_completely_done { + my $chkfile = $_[0]; + my $completely_done = 1; + my $errors = 0; + for (my $chkchan = 0; $chkchan < 32; $chkchan++) { + for (my $chkpolarization = 0; $chkpolarization < 2; $chkpolarization++) { + if (! -f "${chkfile}.done.${chkchan},${chkpolarization}" && + ! -f "${chkfile}.ERROR.${chkchan},${chkpolarization}") { $completely_done = 0; } + if ( -f "${chkfile}.ERROR.${chkchan},${chkpolarization}") { $errors = 1; } + } + } + if ($completely_done == 1 && $errors == 1) { return -1; } # completely done, but with errors + return $completely_done; + } + +# project/splitter vars +# +# sleep(rand()*30); + +$betaorsah = "beta"; # set to beta or sah to set proper dirs below + +$mb_prog_loc = "/home/boincadm/projects/$betaorsah/bin"; +# $mb_prog_name = "mb_splitter_swb.x86_64"; +$mb_prog_name = "mb_splitter.x86_64"; +$app_name = "setiathome_v8"; + +$project_dir = "/home/boincadm/projects/$betaorsah/"; + +$rawbitdepth = 8; +$file_dir = "/home/boincadm/projects/$betaorsah/processing"; +$split_halt_msg = "$project_dir/stop_splitters"; +$email_list = 'jeffc@ssl.berkeley.edu korpela@ssl.berkeley.edu mattl@ssl.berkeley.edu'; +$found_file = "0"; +$host = `/bin/uname -n | /bin/sed s/.ssl.berkeley.edu//`; +$dovertical = 0; +chomp $host; +$usage = "usage: run_gbt_splitter [-vertical] [-exe executable_name] [-filedir filedir] [-app app_name]\n(assuming all executables are in: $mb_prog_loc)\n"; + +# before anything, stagger processes by sleeping a bit + +@numprocs = `pgrep -f run_gbt_splitter`; +$sleepsecs = $#numprocs * 2; +sleep $sleepsecs; + +# check args + +$checkhelp = $ARGV[0] || ""; +if ($checkhelp eq "-h" || $checkhelp eq "-help" || $checkhelp eq "--help") { print $usage; exit(2); } + +while ($ARGV[0] ne "") { + $tempvar = $ARGV[0]; + if ($tempvar eq '-filedir') { + shift @ARGV; + $file_dir = $ARGV[0] + } + elsif ($tempvar eq '-exe') { + shift @ARGV; + $mb_prog_name = $ARGV[0] + } + elsif ($tempvar eq '-app') { + shift @ARGV; + $app_name = $ARGV[0] + } + elsif ($tempvar eq '-vertical') { + $dovertical = 1; + } + else { print $usage; exit(2); } + shift @ARGV; + } + +$SIG{HUP} = $SIG{TERM} = $SIG{INT} = \&touch_and_die; + +# main loop (run as long as halt trigger file doesn't exist) + +while (! -f "$split_halt_msg") { + + chdir $file_dir; + $found_file = 0; + + # get working state of directory and determine what work is available to do + undef @file_list; + open (LS,"/bin/ls -tr . |"); + while () { + $thisfile = $_; chomp $thisfile; + if (/.0000.raw$/) { push @file_list, $_ } + } + close (LS); + chomp @file_list; + $dothisfile = ""; $dochan = -1; $dopolarization = -1; + foreach $file (@file_list) { + # is it a broken sym link? + if (! -e $file) { + print "${file} doesn't actually exist! (broken sym link?) skipping...\n"; + next; + } + # are we working on this file already? + $isworking = 0; + for ($chan = 0; $chan < 32; $chan++) { + for ($polarization = 0; $polarization < 2; $polarization++) { + if (-f "${file}.working.${chan},${polarization}") { $isworking = 1; } + } + } + # if we're working on this file already and -vertical is set, skip it: + if ($isworking == 1 && $dovertical == 1) { + print "${file} is being worked on and -vertical is set - moving on...\n"; + next; + } + # check if completely done and clean up in case this hasn't happened yet + if (is_completely_done($file) == 1 && ! -f "${file}.completely_done") { + `/bin/touch ${file}.completely_done`; + `/bin/rm -f ${file}.done.*`; + } + if (is_completely_done($file) == -1 && ! -f "${file}.completely_done_with_errors") { + `/bin/touch ${file}.completely_done_with_errors`; + } + if (-f "${file}.completely_done") { + print "${file} is completely_done - moving on...\n"; + next; + } + if (-f "${file}.copying_in_lando") { + print "${file} is currently being read in from lando - moving on...\n"; + next; + } + if (-f "${file}.copying_in_hpss") { + print "${file} is currently being read in from hpss - moving on...\n"; + next; + } + for ($chan = 0; $chan < 32; $chan++) { + for ($polarization = 0; $polarization < 2; $polarization++) { + if ($dothisfile eq "") { + print "trying file $file chan $chan polarization $polarization\n"; + } + if (! -f "${file}.working.${chan},${polarization}" && + ! -f "${file}.done.${chan},${polarization}" && + ! -f "${file}.ERROR.${chan},${polarization}" && + $dothisfile eq "") { + $dothisfile = $file; + $dochan = $chan; + $dopolarization = $polarization; + } # end if + } # end for polarization + } # end for chan + } # end foreach file + if ($dothisfile eq "") { + print "nothing to do - exiting...\n"; + exit(6); + } + + print "starting splitting on file: $dothisfile chan: $dochan polarization: $dopolarization...\n"; + + sysopen (WORKING,"${dothisfile}.working.${dochan},${dopolarization}",O_WRONLY|O_EXCL|O_CREAT) or die "wait a minute - race condition opening .working file - bailing!!!\n"; + $now = `/bin/date`; chomp $now; + print WORKING "$host : ". time() . " ($now)\n"; + close (WORKING); + + open(MAIL, "|/usr/sbin/sendmail -t"); + print MAIL "To: ${email_list}\n"; + print MAIL 'From: splitters@ssl.berkeley.edu' . "\n"; + print MAIL "Subject: splitter_gbt starting on host: ${host}\n\n"; + print MAIL "starting file: ${dothisfile} chan: ${dochan} polarization: ${dopolarization}\n"; + close(MAIL); + + $now = `/bin/date`; chomp $now; + print "$now : starting file: ${dothisfile} chan: ${dochan} polarization: ${dopolarization}\n"; + + $filefullpath = "${file_dir}/${dothisfile}"; + + mkdir "/tmp/splitter_${dothisfile}_${dochan}_${dopolarization}"; + mkdir "/tmp/splitter_${dothisfile}_${dochan}_${dopolarization}/wu_inbox"; + chdir "/tmp/splitter_${dothisfile}_${dochan}_${dopolarization}"; + `/bin/rm -f wu_inbox/*`; + + print "LD_LIBRARY_PATH: "; + print $ENV{'LD_LIBRARY_PATH'}; + print "\n"; + + $splitcommand = "/bin/nice -19 /usr/bin/ionice -c2 -n7 ${mb_prog_loc}/${mb_prog_name} $filefullpath -resume -gbt=${dochan},${dopolarization} -projectdir=${project_dir} -trigger_file_path=/${split_halt_msg} -appname=${app_name} -rawbitdepth=${rawbitdepth}"; + + print "(running command: ${splitcommand})\n"; + + $retval = system ($splitcommand); + $retval = $retval >> 8; + + print "(command exited with retval: $retval)\n"; + + if ( $retval == 0 ) { # splitter_gbt ended gracefully at end of file + sleep 60; # wait for child process to finish moving the files from wu_inbox + open(MAIL, "|/usr/sbin/sendmail -t"); + print MAIL "To: ${email_list}\n"; + print MAIL 'From: splitters@ssl.berkeley.edu' . "\n"; + print MAIL "Subject: splitter_gbt finishing on host: ${host}\n\n"; + print MAIL "finished file: ${dothisfile} chan: ${dochan} polarization: ${dopolarization}\n"; + #open (MAIL, "|/usr/ucb/mail -s \"$host splitter_gbt finished\" $email_list"); + open (MAIL, "|/bin/mail -s \"$host splitter_gbt finished\" $email_list"); + print MAIL "$host splitter_gbt finished on file: ${dothisfile}\n\n"; + open (RCDCHK,"splitterlog"); + while () { print MAIL $_ } + close (RCDCHK); + close(MAIL); + if (-f "${filefullpath}.firsttry.${dochan},${dopolarization}") { + `/bin/touch ${filefullpath}.done.${dochan},${dopolarization}`; + `/bin/rm -f ${filefullpath}.firsttry.${dochan},${dopolarization}`; + if (is_completely_done($filefullpath) == 1 && ! -f "${filefullpath}.completely_done") { + `/bin/touch ${filefullpath}.completely_done`; + `/bin/rm -f ${filefullpath}.done.*`; + } + if (is_completely_done($filefullpath) == -1 && ! -f "${filefullpath}.completely_done_with_errors") { + `/bin/touch ${filefullpath}.completely_done_with_errors`; + } + } + else { + `/bin/touch ${filefullpath}.firsttry.${dochan},${dopolarization}`; + } + `/bin/rm -f ${filefullpath}.working.${dochan},${dopolarization}`; + chdir $file_dir; + `/bin/rm -rf /tmp/splitter_${dothisfile}_${dochan}_${dopolarization}`; + } + elsif ( $retval == 2 ) { # splitter_gbt ended gracefully but before finishing file + # remove working suffix - allows it to be resumed later + `/bin/rm -f ${filefullpath}.working.${dochan},${dopolarization}`; + chdir $file_dir; + `/bin/rm -rf /tmp/splitter_${dothisfile}_${dochan}_${dopolarization}`; + print "WARNING : splitter_gbt running on file: ${dothisfile} chan: ${dochan} polarization: ${dopolarization} ended before EOF\n"; + } + else { # spitter ended in error! + open(ERRFILE,">${filefullpath}.ERROR.${dochan},${dopolarization}"); + print ERRFILE "$host\n"; + close(ERRFILE); + `/bin/rm -f ${filefullpath}.working.${dochan},${dopolarization}`; + print "CRITICAL : splitter_gbt running on file: ${dothisfile} chan: ${dochan} polarization: ${dopolarization} ended in error!\n"; + print "exiting run_gbt_splitter (and keeping working dir in /tmp)..\n"; + exit(1); + } + + $now = `/bin/date`; chomp $now; + print "$now : finished running on file: ${dothisfile} chan: ${dochan} polarization: ${dopolarization}\n"; + + } # while halt trigger file doesn't exist + +print "$split_halt_msg exists - exiting..\n"; +exit (0); diff --git a/ops/bin/run_jan.csh b/ops/bin/run_jan.csh new file mode 100755 index 0000000..1f864c2 --- /dev/null +++ b/ops/bin/run_jan.csh @@ -0,0 +1,6 @@ +#! /bin/csh + +source ~davea/seti/db/master +# ~boincadm/projects/sah/bin/splitter_janitor --dir . +~boincadm/projects/sah/bin/splitter_janitor +echo exit status was $status diff --git a/ops/bin/run_mb_splitter b/ops/bin/run_mb_splitter new file mode 100755 index 0000000..2721e86 --- /dev/null +++ b/ops/bin/run_mb_splitter @@ -0,0 +1,276 @@ +#! /usr/bin/perl -w + +# usage: run_mb_splitter [-filedir filedir] + +use locale; +use sigtrap qw(HUP TERM INT); +use Cwd; +use Fcntl; + +$ENV{'INFORMIXDIR'} = '/usr/local/informix'; +$ENV{'INFORMIXSQLHOSTS'} = '/usr/local/informix/etc/sqlhosts'; +$ENV{'INFORMIXSERVER'} = 'sah_master_tcp'; +$ENV{'LD_LIBRARY_PATH'} = '/usr/local/informix/lib:/usr/local/informix/lib/esql:/usr/local/lib:/usr/X11R6/lib:/usr/lib:/lib:/usr/ccs/lib:/usr/local/lib:/usr/local/ssl/lib:/usr/local/informix/lib:/usr/local/informix/lib/esql:/usr/local/generic/lib:/usr/lib64:/usr/lib64/mysql'; + +# ALFA receivers must be specified with beam (0-6) and polarization (0-1), i.e. -alfa=4,0 + +# signal handler sub + +sub touch_and_die { + print STDERR time . " run_mb_splitter caught signal and is touching ${split_halt_msg}..\n"; + system ("/bin/touch $split_halt_msg"); + exit(99) + } + +sub is_completely_done { + my $chkfile = $_[0]; + my $completely_done = 1; + my $errors = 0; + for (my $chkbeam = 0; $chkbeam < 7; $chkbeam++) { + for (my $chkpolarization = 0; $chkpolarization < 2; $chkpolarization++) { + if (! -f "${chkfile}.done.${chkbeam},${chkpolarization}" && + ! -f "${chkfile}.ERROR.${chkbeam},${chkpolarization}") { $completely_done = 0; } + if ( -f "${chkfile}.ERROR.${chkbeam},${chkpolarization}") { $errors = 1; } + } + } + if ($completely_done == 1 && $errors == 1) { return -1; } # completely done, but with errors + return $completely_done; + } + +# project/splitter vars +# +sleep(rand()*30); + +$mb_prog_loc = "/home/boincadm/projects/sah/bin"; +$mb_prog_name = "mb_splitter_swb.x86_64"; +$app_name = "setiathome_enhanced"; + +$project_dir = "/home/boincadm/projects/sah/"; + +# $file_dir = "/disks/thumper/raid5_d/users/seti/dr2_data/production/processing"; +$file_dir = "/home/boincadm/projects/sah/processing"; +$split_halt_msg = "$project_dir/stop_splitters"; +$email_list = 'jeffc@ssl.berkeley.edu korpela@ssl.berkeley.edu mattl@ssl.berkeley.edu'; +$found_file = "0"; +$host = `/bin/uname -n | /bin/sed s/.ssl.berkeley.edu//`; +$dovertical = 0; +chomp $host; +$usage = "usage: run_mb_splitter [-vertical] [-exe executable_name] [-filedir filedir] [-app app_name]\n(assuming all executables are in: $mb_prog_loc)\n"; + + +# before anything, stagger processes by sleeping a bit + +@numprocs = `pgrep -f run_mb_splitter`; +$sleepsecs = $#numprocs * 2; +sleep $sleepsecs; + +# check args + +$checkhelp = $ARGV[0] || ""; +if ($checkhelp eq "-h" || $checkhelp eq "-help" || $checkhelp eq "--help") { print $usage; exit(2); } + +while ($ARGV[0] ne "") { + $tempvar = $ARGV[0]; + if ($tempvar eq '-filedir') { + shift @ARGV; + $file_dir = $ARGV[0] + } + elsif ($tempvar eq '-exe') { + shift @ARGV; + $mb_prog_name = $ARGV[0] + } + elsif ($tempvar eq '-app') { + shift @ARGV; + $app_name = $ARGV[0] + } + elsif ($tempvar eq '-vertical') { + $dovertical = 1; + } + else { print $usage; exit(2); } + shift @ARGV; + } + +$SIG{HUP} = $SIG{TERM} = $SIG{INT} = \&touch_and_die; + +# main loop (run as long as halt trigger file doesn't exist) + +while (! -f "$split_halt_msg") { + + chdir $file_dir; + $found_file = 0; + + # get working state of directory and determine what work is available to do + undef @file_list; + # NOTE: slurp in 2000-2007 files first, then 2008-2009 files, then anything after 2010 + open (LS,"/bin/ls -tr . |"); + while () { + $thisfile = $_; chomp $thisfile; + if (/^[0-9][0-9][a-z][a-z]0[0-7][a-z][a-z]$/) { push @file_list, $_ } + } + close (LS); + open (LS,"/bin/ls -tr . |"); + while () { + $thisfile = $_; chomp $thisfile; + if (/^[0-9][0-9][a-z][a-z]0[8-9][a-z][a-z]$/) { push @file_list, $_ } + } + close (LS); + open (LS,"/bin/ls -tr . |"); + while () { + $thisfile = $_; chomp $thisfile; + if (/^[0-9][0-9][a-z][a-z][1-9][0-9][a-z][a-z]$/) { push @file_list, $_ } + } + close (LS); + chomp @file_list; + $dothisfile = ""; $dobeam = -1; $dopolarization = -1; + foreach $file (@file_list) { + # is it a broken sym link? + if (! -e $file) { + print "${file} doesn't actually exist! (broken sym link?) skipping...\n"; + next; + } + # are we working on this file already? + $isworking = 0; + for ($beam = 0; $beam < 7; $beam++) { + for ($polarization = 0; $polarization < 2; $polarization++) { + if (-f "${file}.working.${beam},${polarization}") { $isworking = 1; } + } + } + # if we're working on this file already and -vertical is set, skip it: + if ($isworking == 1 && $dovertical == 1) { + print "${file} is being worked on and -vertical is set - moving on...\n"; + next; + } + # check if completely done and clean up in case this hasn't happened yet + if (is_completely_done($file) == 1 && ! -f "${file}.completely_done") { + `/bin/touch ${file}.completely_done`; + `/bin/rm -f ${file}.done.*`; + } + if (is_completely_done($file) == -1 && ! -f "${file}.completely_done_with_errors") { + `/bin/touch ${file}.completely_done_with_errors`; + } + if (-f "${file}.completely_done") { + print "${file} is completely_done - moving on...\n"; + next; + } + if (-f "${file}.copying_in_lando") { + print "${file} is currently being read in from lando - moving on...\n"; + next; + } + if (-f "${file}.copying_in_hpss") { + print "${file} is currently being read in from hpss - moving on...\n"; + next; + } + for ($beam = 0; $beam < 7; $beam++) { + for ($polarization = 0; $polarization < 2; $polarization++) { + if ($dothisfile eq "") { + print "trying file $file beam $beam polarization $polarization\n"; + } + if (! -f "${file}.working.${beam},${polarization}" && + ! -f "${file}.done.${beam},${polarization}" && + ! -f "${file}.ERROR.${beam},${polarization}" && + $dothisfile eq "") { + $dothisfile = $file; + $dobeam = $beam; + $dopolarization = $polarization; + } # end if + } # end for polarization + } # end for beam + } # end foreach file + if ($dothisfile eq "") { + print "nothing to do - exiting...\n"; + exit(6); + } + + print "starting splitting on file: $dothisfile beam: $dobeam polarization: $dopolarization...\n"; + + sysopen (WORKING,"${dothisfile}.working.${dobeam},${dopolarization}",O_WRONLY|O_EXCL|O_CREAT) or die "wait a minute - race condition opening .working file - bailing!!!\n"; + $now = `/bin/date`; chomp $now; + print WORKING "$host : ". time() . " ($now)\n"; + close (WORKING); + + open(MAIL, "|/usr/sbin/sendmail -t"); + print MAIL "To: ${email_list}\n"; + print MAIL 'From: splitters@ssl.berkeley.edu' . "\n"; + print MAIL "Subject: splitter starting on host: ${host}\n\n"; + print MAIL "starting file: ${dothisfile} beam: ${dobeam} polarization: ${dopolarization}\n"; + close(MAIL); + + $now = `/bin/date`; chomp $now; + print "$now : starting file: ${dothisfile} beam: ${dobeam} polarization: ${dopolarization}\n"; + + $filefullpath = "${file_dir}/${dothisfile}"; + + mkdir "/tmp/splitter_${dothisfile}_${dobeam}_${dopolarization}"; + mkdir "/tmp/splitter_${dothisfile}_${dobeam}_${dopolarization}/wu_inbox"; + chdir "/tmp/splitter_${dothisfile}_${dobeam}_${dopolarization}"; + `/bin/rm -f wu_inbox/*`; + + print "LD_LIBRARY_PATH: "; + print $ENV{'LD_LIBRARY_PATH'}; + print "\n"; + + $splitcommand = "/bin/nice -19 /usr/bin/ionice -c2 -n7 ${mb_prog_loc}/${mb_prog_name} $filefullpath -resume -alfa=${dobeam},${dopolarization} -projectdir=${project_dir} -trigger_file_path=/${split_halt_msg} -appname=${app_name}"; + + print "(running command: ${splitcommand})\n"; + + $retval = system ($splitcommand); + $retval = $retval >> 8; + + print "(command exited with retval: $retval)\n"; + + if ( $retval == 0 ) { # splitter ended gracefully at end of file + sleep 60; # wait for child process to finish moving the files from wu_inbox + open(MAIL, "|/usr/sbin/sendmail -t"); + print MAIL "To: ${email_list}\n"; + print MAIL 'From: splitters@ssl.berkeley.edu' . "\n"; + print MAIL "Subject: splitter finishing on host: ${host}\n\n"; + print MAIL "finished file: ${dothisfile} beam: ${dobeam} polarization: ${dopolarization}\n"; + #open (MAIL, "|/usr/ucb/mail -s \"$host splitter finished\" $email_list"); + open (MAIL, "|/bin/mail -s \"$host splitter finished\" $email_list"); + print MAIL "$host splitter finished on file: ${dothisfile}\n\n"; + open (RCDCHK,"splitterlog"); + while () { print MAIL $_ } + close (RCDCHK); + close(MAIL); + if (-f "${filefullpath}.firsttry.${dobeam},${dopolarization}") { + `/bin/touch ${filefullpath}.done.${dobeam},${dopolarization}`; + `/bin/rm -f ${filefullpath}.firsttry.${dobeam},${dopolarization}`; + if (is_completely_done($filefullpath) == 1 && ! -f "${filefullpath}.completely_done") { + `/bin/touch ${filefullpath}.completely_done`; + `/bin/rm -f ${filefullpath}.done.*`; + } + if (is_completely_done($filefullpath) == -1 && ! -f "${filefullpath}.completely_done_with_errors") { + `/bin/touch ${filefullpath}.completely_done_with_errors`; + } + } + else { + `/bin/touch ${filefullpath}.firsttry.${dobeam},${dopolarization}`; + } + `/bin/rm -f ${filefullpath}.working.${dobeam},${dopolarization}`; + chdir $file_dir; + `/bin/rm -rf /tmp/splitter_${dothisfile}_${dobeam}_${dopolarization}`; + } + elsif ( $retval == 2 ) { # splitter ended gracefully but before finishing file + # remove working suffix - allows it to be resumed later + `/bin/rm -f ${filefullpath}.working.${dobeam},${dopolarization}`; + chdir $file_dir; + `/bin/rm -rf /tmp/splitter_${dothisfile}_${dobeam}_${dopolarization}`; + print "WARNING : splitter running on file: ${dothisfile} beam: ${dobeam} polarization: ${dopolarization} ended before EOF\n"; + } + else { # spitter ended in error! + open(ERRFILE,">${filefullpath}.ERROR.${dobeam},${dopolarization}"); + print ERRFILE "$host\n"; + close(ERRFILE); + `/bin/rm -f ${filefullpath}.working.${dobeam},${dopolarization}`; + print "CRITICAL : splitter running on file: ${dothisfile} beam: ${dobeam} polarization: ${dopolarization} ended in error!\n"; + print "exiting run_mb_splitter (and keeping working dir in /tmp)..\n"; + exit(1); + } + + $now = `/bin/date`; chomp $now; + print "$now : finished running on file: ${dothisfile} beam: ${dobeam} polarization: ${dopolarization}\n"; + + } # while halt trigger file doesn't exist + +print "$split_halt_msg exists - exiting..\n"; +exit (0); diff --git a/ops/bin/seti_hsi.csh b/ops/bin/seti_hsi.csh new file mode 100755 index 0000000..82ff368 --- /dev/null +++ b/ops/bin/seti_hsi.csh @@ -0,0 +1,99 @@ +#! /bin/csh + +# This script gets from and puts to HPSS. It does checks on a put. +# It can also list files and directories. + +set action = $1 +set filename = $2 +set target_dir = seti/dr2_data/production +set throttle_speed = "32M" # 32Mbps +set md5_check_length = 1048576 +set retval = 0 +if (`hostname` == "ewen") then + alias hsi hsi.hpss +endif + +hsi touch hpss_ping >& /dev/null +if($status == 1) then + echo hpss is down + exit 1 +endif + +if($action == "--list") then + hsi "ls -l $target_dir/${filename}" |& tail -1 > /tmp/$filename.ls + if ($status) then + echo "$filename not found" + set retval = 1 + else + cat /tmp/$filename.ls + endif + \rm /tmp/$filename.ls + +else if($action == "--dir") then + hsi "ls -l $target_dir" |& tail --lines=+31 + +else if ($action == "--get") then + touch $filename.at_hpss + hsi "firewall -on ; get $target_dir/$filename" | throttle $throttle_speed > $filename + +else if ($action == "--put") then + set retry = 1 + while ($retry == 1) + echo starting the put of $filename + throttle $throttle_speed < $filename | hsi "firewall -on ; put - : $target_dir/$filename" + # start transfer check + set local_length = `ls -l $filename | awk '{print $5}'` + set hpss_length = `hsi list -l $target_dir/$filename | & tail -1 | awk '{print $5}'` + if ($local_length != $hpss_length) then + echo "$filename transfer was bad (file length mismatch)" + set retval = 1 + exit 1 + else + hsi "firewall -on ; get -O ::$md5_check_length /tmp/$filename.start.hpss : $target_dir/$filename" + head -c $md5_check_length $filename > /tmp/$filename.start.local + set hpss_md5 = `md5sum /tmp/$filename.start.hpss | awk '{print $1}'` + set local_md5 = `md5sum /tmp/$filename.start.local | awk '{print $1}'` + if ($hpss_md5 != $local_md5) then + echo "$filename transfer was bad (md5 mismatch at start of file)" + set retval = 1 + else + set end_offset = `python -c "print $hpss_length - $md5_check_length"` + hsi "firewall -on ; get -O ${end_offset}::$md5_check_length /tmp/$filename.end.hpss : $target_dir/$filename" + tail --bytes=$md5_check_length $filename > /tmp/$filename.end.local + set hpss_md5 = `md5sum /tmp/$filename.end.hpss | awk '{print $1}'` + set local_md5 = `md5sum /tmp/$filename.end.local | awk '{print $1}'` + if ($hpss_md5 != $local_md5) then + echo "$filename transfer was bad (md5 mismatch at end of file)" + set retval = 1 + endif + \rm /tmp/$filename.end.hpss + \rm /tmp/$filename.end.local + endif + \rm /tmp/$filename.start.hpss + \rm /tmp/$filename.start.local + endif + if ($retval == 0) then + echo "$filename transfer was good" + set retry = 0 + else + set retry = 1 + echo retrying in 60 seconds + sleep 60 + endif + # end transfer check + end +else if ($action == "--check") then + # if the test ping failed above, we already exited, otherwise print success + echo "hpss is up" + set retval = 0 + +else + echo "usage $0:t --list | --dir | --get | --put | --check" + set retval = 1 + +endif + +echo " " +echo " " + +exit $retval diff --git a/ops/bin/splitter_janitor b/ops/bin/splitter_janitor new file mode 100755 index 0000000..0085c34 --- /dev/null +++ b/ops/bin/splitter_janitor @@ -0,0 +1,276 @@ +#! /usr/bin/perl -w + +# where is the data? +# $file_dir = "/disks/thumper/raid5_d/users/seti/dr2_data/production/processing"; +$file_dir = "/home/seti/dr2_data/production/processing"; + +# $email_list = 'jeffc@ssl.berkeley.edu mattl@ssl.berkeley.edu korpela@ssl.berkeley.edu'; +# $email_list = 'jeffc@ssl.berkeley.edu'; +$email_list = 'mattl@ssl.berkeley.edu jeffc@ssl.berkeley.edu'; + +# num of seconds to keep files in _TO_BE_DELETED before actually deleting them +$keep_for = 7*86400; # one week +#$keep_for = 86400; # one day + +# what if we are missing beam/pol pairs out of the standard 14? should we move date to be deleted anyway? +# 0 - no, 1 - yes; +$delete_even_if_missing_beampols = 1; + +# where is seti_hsi.csh? +$seti_hsi = "/home/boincadm/projects/sah/bin/seti_hsi.csh"; + +# set informix env + +$informixdir = "/usr/local/informix"; +$currentpath = $ENV{"PATH"}; +$currentldlp = $ENV{"LD_LIBRARY_PATH"}; +$ENV{"INFORMIXDIR"}="${informixdir}"; +$ENV{"INFORMIXSERVER"}="sah_master_tcp"; +$ENV{"ONCONFIG"}="onconfig.sah_master"; +$ENV{"PATH"}="${informixdir}/bin:${currentpath}"; +$ENV{"LD_LIBRARY_PATH"}="${informixdir}/lib:${informixdir}/lib/esql:${currentldlp}"; + +# if --check_only flag is specified, do "check only" for current directory, ignoring dot files, etc. +# basically just check for existence at HPSS, and if all 14 tapes are in science db and +# mail us the results without moving/deleting anything. + +# if --not_at_hpss flag is specified, this supercedes --check_only - and only outputs what files +# are here at the lab and fully split/processed, but not yet copied to HPSS + +# if --ignore_matching_sizes is specified, ignore if files don't match in size - delete anyway if +# otherwise deleteable + +# if --dir flag is specified, go into that file_dir instead of default file_dir + +sub is_ap_doing_anything { + my $chkfile = $_[0]; + if (-f "${chkfile}.completely_done_ap") { return 0; } # it's done - so better not be doing anything + if (-f "${chkfile}.completely_done_with_errors_ap") { return 0; } # it's done - so better not be doing anything + @aplist = `/bin/ls *${chkfile}*_ap.* 2>&1 | /bin/grep -v "No such"`; + if (scalar(@aplist) > 0) { return 1; } + return 0; +} + +$check_only = 0; +$not_at_hpss = 0; +$ignore_matching_sizes = 0; +while ($arg = shift) { + if ($arg eq "--check_only") { + $file_dir = `pwd`; + chomp $file_dir; + $check_only = 1; + } + elsif ($arg eq "--not_at_hpss") { + $not_at_hpss = 1; + } + elsif ($arg eq "--ignore_matching_sizes") { + $ignore_matching_sizes = 1; + } + elsif ($arg eq "--dir") { + $file_dir = shift; + } + else { + print "splitter_janitor [--dir file_dir] [--check_only|--not_at_hpss]\n"; + exit(1); + } + } + +# get data file list + +if (! -d $file_dir) { + print "no such directory: $file_dir\n"; + exit(1); + } +chdir $file_dir; +undef @file_list; +open (LS,"/bin/ls . |"); +while () { + $thisfile = $_; chomp $thisfile; + if (/^[0-9][0-9][a-z][a-z][0-9][0-9][a-z][a-z]$/) { push @file_list, $_ } + } +close (LS); +chomp @file_list; + +$message = "Splitter Janitor Results:\n"; +if ($check_only == 1) { + $message .= "(doing check on data files in: $file_dir)\n"; + } + +# is HPSS unavailable? if so, set warning, and undefine file_list and set check_only == 1 +# in order to go right to mail at end (don't care if we're doing not_at_hpss check) + +if ($not_at_hpss == 0) { + $check_hpss = `$seti_hsi --check`; + chomp $check_hpss; + if ($check_hpss eq "hpss is down") { + undef @file_list; + $check_only = 1; + $message .= "\nHPSS is currently unavailable - bailing...\n"; + } + } + +# moving on - main part: + +foreach $file (@file_list) { + $message .= "\n"; + if ($not_at_hpss == 1 && + ( -f "${file}.completely_done" || -f "${file}.completely_done_with_errors") && + ( -f "${file}.completely_done_ap" || -f "${file}.completely_done_with_errors_ap") && + ! -f "${file}.at_hpss") { + print "${file}\n"; + } + elsif ($not_at_hpss == 0) { + if (! -f "${file}.at_hpss") { + $hsicommand = "$seti_hsi --list $file"; + $retval = system ($hsicommand . "> /dev/null"); + $retval = $retval >> 8; + if ($retval == 0) { + $message .= "${file}: had no .at_hpss suffix but actually IS at HPSS - touching ${file}.at_hpss\n"; + system ("/bin/touch ${file}.at_hpss"); + } + } + if (( (-f "${file}.completely_done" || -f "${file}.completely_done_with_errors") && + (-f "${file}.completely_done_ap" || -f "${file}.completely_done_with_errors_ap") && + -f "${file}.at_hpss") || $check_only == 1) { + $message .= "${file}: finished processing and xfering to hpss - checking...\n"; + $domove = 1; + # double check that it is at HPSS + $hsicommand = "$seti_hsi --list $file"; + $retval = system ($hsicommand . "> /dev/null"); + $retval = $retval >> 8; + if ($retval == 1) { + $message .= "WARNING: ${file}: has .at_hpss suffix but IS NOT AT HPSS!\n"; + # $domove = 0; # just a warning... still move if need be + } + else { + $message .= "${file}: is at HPSS\n"; + # now check that local/remote file sizes match + $fsize = (stat($file))[7]; + print "DEBUG: file size: - $fsize - \n"; + $hsifsize = `$hsicommand | awk '{print \$5}'`; + chomp $hsifsize; + if ($fsize != $hsifsize && !$ignore_matching_sizes) { + $message .= "${file}: local size: $fsize HPSS size: $hsifsize -- DO NOT MATCH\n"; + $domove = 0; + if (($hsifsize - $fsize) <= (134742016 * 5)) { # due to ragged files/software blanking - off by less then five buffers + $message .= "${file}: ... but the HSI size is <= 134742016 x 5 bytes (five buffers) different\n"; + $message .= "${file}: ... we will assume due to ragged files/etc. and flag it as okay\n"; + $domove = 1; + } + } + else { $message .= "${file}: local size: $fsize and HPSS size: $hsifsize match\n"; } + } + # final check - scan science database to make sure + $dbcount = `echo "database sah2; select count(name) from tape where name = '${file}';" | dbaccess -e - 2>&1 | tail --l=+8 | head -1 | awk '{print \$1}'`; + chomp $dbcount; + if ($dbcount != 14) { + $message .= "${file}: multibeam does not have 14 entries in the tape table!\n"; + if ($delete_even_if_missing_beampols == 0) { # i.e. if we want to keep tapes around with missing beam/pol entries, then... + $domove = 0; + } + } + else { $message .= "${file}: has all 14 entries in the tape table\n"; } + if ($domove == 1) { + if ($check_only == 1) { + $message .= "${file}: completely processed by multibeam and at HPSS\n"; + } + else { + $moveto = "./_TO_BE_DELETED"; + if (! (-f "${file}.completely_done_ap" || + -f "${file}.completely_done_with_errors_ap") ) { + $message .= "${file}: astropulse not yet finished processing\n"; + $domove = 0; + } + else { + # if (-f "${file}.completely_done_with_errors_ap") { $moveto = "./_COMPLETELY_DONE_WITH_ERRORS"; } + if (-f "${file}.completely_done_with_errors_ap") { $moveto = "./_TO_BE_DELETED"; } + } + if (! (-f "${file}.completely_done" || + -f "${file}.completely_done_with_errors") ) { + $message .= "${file}: multibeam not yet finished processing\n"; + $domove = 0; + } + else { + # if (-f "${file}.completely_done_with_errors") { $moveto = "./_COMPLETELY_DONE_WITH_ERRORS"; } + if (-f "${file}.completely_done_with_errors") { $moveto = "./_TO_BE_DELETED"; } + } + if ($domove == 1) { + $thisdate = `/bin/date "+%F-%T"`; + chomp $thisdate; + if (-f "${file}.completely_done") { system ("/bin/mv ${file}.completely_done ./_COMPLETELY_DONE_HISTORY/${file}.completely_done.${thisdate}"); } + if (-f "${file}.completely_done_ap") { system ("/bin/mv ${file}.completely_done_ap ./_COMPLETELY_DONE_HISTORY/${file}.completely_done_ap.${thisdate}"); } + if (-f "${file}.completely_done_with_errors") { system ("/bin/mv ${file}.completely_done_with_errors ./_COMPLETELY_DONE_HISTORY/${file}.completely_done_with_errors.${thisdate}"); } + if (-f "${file}.completely_done_with_errors_ap") { system ("/bin/mv ${file}.completely_done_with_errors_ap ./_COMPLETELY_DONE_HISTORY/${file}.completely_done_with_errors_ap.${thisdate}"); } + system ("/bin/mv ${file} $moveto"); + system ("/bin/mv ${file}.* $moveto"); + $message .= "${file}: astropulse/multibeam completely done and at HPSS - moved into $moveto\n"; + } # end if $domove == 1 + } # end if $check_only == 1 + } # end if $domove = 1 + } # end if file completely done + else { + $message .= "${file}: not finished processing/xfering to hpss yet\n"; + if (! (-f "${file}.completely_done" || -f "${file}.completely_done_with_errors") ) { + $message .= " ${file}: multibeam not yet finished processing\n"; + } + if (! (-f "${file}.completely_done_ap" || -f "${file}.completely_done_with_errors_ap") ) { + $message .= " ${file}: astropulse not yet finished processing\n"; + } + if (! (-f "${file}.at_hpss")) { + $message .= " ${file}: no .at_hpss file - not finished xfering?\n"; + } + } + } + } + + +# only bother with the actual file deleting if check_only == 0 && not_at_hpss == 0 + +if ($not_at_hpss == 1) { exit (0); } + +if ($check_only == 0) { + + if ($message ne "") { $message .= "\n"; } # if needed skip a line in case there's more + + chdir "./_TO_BE_DELETED"; + undef @del_file_list; + open (LS,"/bin/ls . |"); + while () { + $thisfile = $_; chomp $thisfile; + if (/^[0-9][0-9][a-z][a-z][0-9][0-9][a-z][a-z]$/) { push @del_file_list, $_ } + } + close (LS); + chomp @del_file_list; + + foreach $del_file (@del_file_list) { + if (-l $del_file) { + $message .= "${del_file}: is a symbolic link.. skipping..\n"; + } + else { + $cdmtime = (stat("${del_file}.completely_done"))[9]; + $ahmtime = (stat("${del_file}.at_hpss"))[9]; + # print "${del_file} $cdmtime $ahmtime\n"; + $now = time(); + if (($now - $cdmtime) > $keep_for && ($now - $ahmtime) > $keep_for) { + system ("/bin/rm -f ${del_file}*"); + $cdmdelta = ($now - $cdmtime); + $ahmdelta = ($now - $ahmtime); + $message .= "${del_file}: finished splitting $cdmdelta seconds ago, copied to HPSS $ahmdelta seconds ago - deleting!\n"; + } + } + } + + } + +# send mail! + +if ($message ne "") { + open(MAIL, "|/usr/sbin/sendmail -tv"); + print MAIL "To: ${email_list}\n"; + print MAIL 'From: seti@ssl.berkeley.edu' . "\n"; + print MAIL "Subject: splitter_janitor report\n\n"; + print MAIL "$message"; + close(MAIL); + } + +exit (0); diff --git a/ops/bin/splitter_janitor_gbt b/ops/bin/splitter_janitor_gbt new file mode 100755 index 0000000..e0557e4 --- /dev/null +++ b/ops/bin/splitter_janitor_gbt @@ -0,0 +1,272 @@ +#! /usr/bin/perl -w + +# where is the data? +# $file_dir = "/disks/thumper/raid5_d/users/seti/dr2_data/production/processing"; +#$file_dir = "/home/seti/dr2_data/production/processing"; +$file_dir = "/mydisks/b/users/btldata"; + +# $email_list = 'jeffc@ssl.berkeley.edu mattl@ssl.berkeley.edu korpela@ssl.berkeley.edu'; +# $email_list = 'jeffc@ssl.berkeley.edu'; +#$email_list = 'mattl@ssl.berkeley.edu jeffc@ssl.berkeley.edu'; +$email_list = 'jeffc@ssl.berkeley.edu'; + +# num of seconds to keep files in _TO_BE_DELETED before actually deleting them +$keep_for = 7*86400; # one week +#$keep_for = 86400; # one day + +# what if we are missing beam/pol pairs out of the standard 14? should we move date to be deleted anyway? +# 0 - no, 1 - yes; +$delete_even_if_missing_beampols = 1; + +# where is seti_hsi.csh? +$seti_hsi = "/home/boincadm/projects/sah/bin/seti_hsi.csh"; + +# set informix env + +$informixdir = "/usr/local/informix"; +$currentpath = $ENV{"PATH"}; +$currentldlp = $ENV{"LD_LIBRARY_PATH"}; +$ENV{"INFORMIXDIR"}="${informixdir}"; +$ENV{"INFORMIXSERVER"}="sah_master_tcp"; +$ENV{"ONCONFIG"}="onconfig.sah_master"; +$ENV{"PATH"}="${informixdir}/bin:${currentpath}"; +$ENV{"LD_LIBRARY_PATH"}="${informixdir}/lib:${informixdir}/lib/esql:${currentldlp}"; + +# if --check_only flag is specified, do "check only" for current directory, ignoring dot files, etc. +# basically just check for existence at HPSS, and if all 14 tapes are in science db and +# mail us the results without moving/deleting anything. + +# if --not_at_hpss flag is specified, this supercedes --check_only - and only outputs what files +# are here at the lab and fully split/processed, but not yet copied to HPSS + +# if --ignore_matching_sizes is specified, ignore if files don't match in size - delete anyway if +# otherwise deleteable + +# if --dir flag is specified, go into that file_dir instead of default file_dir + +# if --beams is specified, use that # of beams (default 64) +# if --pols is specific, use that # of pols (default 2) + +$check_only = 0; +$not_at_hpss = 0; +$ignore_matching_sizes = 0; +$totalbeams = 64; +$totalpols = 2; +$totalbeampols = $totalbeams * $totalpols; + +while ($arg = shift) { + if ($arg eq "--check_only") { + $file_dir = `pwd`; + chomp $file_dir; + $check_only = 1; + } + elsif ($arg eq "--not_at_hpss") { + $not_at_hpss = 1; + } + elsif ($arg eq "--ignore_matching_sizes") { + $ignore_matching_sizes = 1; + } + elsif ($arg eq "--dir") { + $file_dir = shift; + } + elsif ($arg eq "--beams") { + $totalbeams = shift; + } + elsif ($arg eq "--pols") { + $totalpols = shift; + } + else { + print "splitter_janitor [--dir file_dir] [--check_only|--not_at_hpss]\n"; + exit(1); + } + } + + +# get data file list + +if (! -d $file_dir) { + print "no such directory: $file_dir\n"; + exit(1); + } +chdir $file_dir; +undef @file_list; +@uniqobs = `/bin/ls *.[0-9][0-9][0-9][0-9].raw | sed 's/.[0-9][0-9][0-9][0-9].raw\$//' | sort | uniq`; +foreach $obs (@uniqobs) { + chomp $obs; + $headobs = `/bin/ls $obs* | sort -n | head -1`; + chomp $headobs; + push @file_list, $headobs; + } +chomp @file_list; + +$message = "Splitter Janitor Results:\n"; +if ($check_only == 1) { + $message .= "(doing check on data files in: $file_dir)\n"; + } + +# is HPSS unavailable? if so, set warning, and undefine file_list and set check_only == 1 +# in order to go right to mail at end (don't care if we're doing not_at_hpss check) + +if ($not_at_hpss == 0) { + $check_hpss = `$seti_hsi --check`; + chomp $check_hpss; + if ($check_hpss eq "hpss is down") { + undef @file_list; + $check_only = 1; + $message .= "\nHPSS is currently unavailable - bailing...\n"; + } + } + +# moving on - main part: + +foreach $file (@file_list) { + + $message .= "\n"; + if ($not_at_hpss == 1 && + ( -f "${file}.completely_done" || -f "${file}.completely_done_with_errors") && + ! -f "${file}.at_hpss") { + print "${file}\n"; + } + elsif ($not_at_hpss == 0) { + if (! -f "${file}.at_hpss") { + $hsicommand = "$seti_hsi --list $file"; + $retval = system ($hsicommand . "> /dev/null"); + $retval = $retval >> 8; + if ($retval == 0) { + $message .= "${file}: had no .at_hpss suffix but actually IS at HPSS - touching ${file}.at_hpss\n"; + system ("/bin/touch ${file}.at_hpss"); + } + } + if (( (-f "${file}.completely_done" || -f "${file}.completely_done_with_errors") && + -f "${file}.at_hpss") || $check_only == 1) { + $message .= "${file}: finished processing and xfering to hpss - checking...\n"; + $domove = 1; + # double check that it is at HPSS + $hsicommand = "$seti_hsi --list $file"; + $retval = system ($hsicommand . "> /dev/null"); + $retval = $retval >> 8; + if ($retval == 1) { + $message .= "WARNING: ${file}: has .at_hpss suffix but IS NOT AT HPSS!\n"; + # $domove = 0; # just a warning... still move if need be + } + else { + $message .= "${file}: is at HPSS\n"; + # now check that local/remote file sizes match + $fsize = (stat($file))[7]; + print "DEBUG: file size: - $fsize - \n"; + $hsifsize = `$hsicommand | awk '{print \$5}'`; + chomp $hsifsize; + if ($fsize != $hsifsize && !$ignore_matching_sizes) { + $message .= "${file}: local size: $fsize HPSS size: $hsifsize -- DO NOT MATCH\n"; + $domove = 0; + if (($hsifsize - $fsize) <= (134742016 * 5)) { # due to ragged files/software blanking - off by less then five buffers + $message .= "${file}: ... but the HSI size is <= 134742016 x 5 bytes (five buffers) different\n"; + $message .= "${file}: ... we will assume due to ragged files/etc. and flag it as okay\n"; + $domove = 1; + } + } + else { $message .= "${file}: local size: $fsize and HPSS size: $hsifsize match\n"; } + } + # final check - scan science database to make sure + $dbcount = `echo "database sah2; select count(name) from tape where name = '${file}';" | dbaccess -e - 2>&1 | tail --l=+8 | head -1 | awk '{print \$1}'`; + chomp $dbcount; + #if ($dbcount != 14) { + if ($dbcount != $totalbeampols) { + #$message .= "${file}: tape does not have 14 entries in the tape table!\n"; + $message .= "${file}: tape does not have ${totalbeampols} entries in the tape table!\n"; + if ($delete_even_if_missing_beampols == 0) { # i.e. if we want to keep tapes around with missing beam/pol entries, then... + $domove = 0; + } + } + #else { $message .= "${file}: has all 14 entries in the tape table\n"; } + else { $message .= "${file}: has ${dbcount} entries in the tape table\n"; } + if ($domove == 1) { + if ($check_only == 1) { + $message .= "${file}: completely processed and at HPSS\n"; + } + else { + $moveto = "./_TO_BE_DELETED"; + if (! (-f "${file}.completely_done" || + -f "${file}.completely_done_with_errors") ) { + $message .= "${file}: tape not yet finished processing\n"; + $domove = 0; + } + else { + if (-f "${file}.completely_done_with_errors") { $moveto = "./_TO_BE_DELETED"; } + } + if ($domove == 1) { + $thisdate = `/bin/date "+%F-%T"`; + chomp $thisdate; + if (-f "${file}.completely_done") { system ("/bin/mv ${file}.completely_done ./_COMPLETELY_DONE_HISTORY/${file}.completely_done.${thisdate}"); } + if (-f "${file}.completely_done_with_errors") { system ("/bin/mv ${file}.completely_done_with_errors ./_COMPLETELY_DONE_HISTORY/${file}.completely_done_with_errors.${thisdate}"); } + ($root, $seq, $ext) = split('\.', ${file}); + system ("/bin/mv ${root}* $moveto"); + #system ("/bin/mv ${file} $moveto"); + #system ("/bin/mv ${file}.* $moveto"); + $message .= "${file}: tape completely done and at HPSS - moved into $moveto\n"; + } # end if $domove == 1 + } # end if $check_only == 1 + } # end if $domove = 1 + } # end if file completely done + else { + $message .= "${file}: not finished processing/xfering to hpss yet\n"; + if (! (-f "${file}.completely_done" || -f "${file}.completely_done_with_errors") ) { + $message .= " ${file}: tape not yet finished processing\n"; + } + if (! (-f "${file}.at_hpss")) { + $message .= " ${file}: no .at_hpss file - not finished xfering?\n"; + } + } + } + } + +# only bother with the actual file deleting if check_only == 0 && not_at_hpss == 0 + +if ($not_at_hpss == 1) { exit (0); } + +if ($check_only == 0) { + + if ($message ne "") { $message .= "\n"; } # if needed skip a line in case there's more + + chdir "./_TO_BE_DELETED"; + undef @del_file_list; + open (LS,"/bin/ls . |"); + while () { + $thisfile = $_; chomp $thisfile; + if (/.[0-9][0-9][0-9][0-9].raw$/) { push @del_file_list, $_ } + } + close (LS); + chomp @del_file_list; + + foreach $del_file (@del_file_list) { + if (-l $del_file) { + $message .= "${del_file}: is a symbolic link.. skipping..\n"; + } + else { + $cdmtime = (stat("${del_file}.completely_done"))[9]; + $ahmtime = (stat("${del_file}.at_hpss"))[9]; + # print "${del_file} $cdmtime $ahmtime\n"; + $now = time(); + if (($now - $cdmtime) > $keep_for && ($now - $ahmtime) > $keep_for) { + # Do not delete for real until we shake this out. This is where the real delete would happen via : system ("/bin/rm -f ${del_file}*"); + $cdmdelta = ($now - $cdmtime); + $ahmdelta = ($now - $ahmtime); + $message .= "${del_file}: finished splitting $cdmdelta seconds ago, copied to HPSS $ahmdelta seconds ago - deleting!\n"; + } + } + } + + } + +# send mail! + +if ($message ne "") { + open(MAIL, "|/usr/sbin/sendmail -tv"); + print MAIL "To: ${email_list}\n"; + print MAIL 'From: seti@ssl.berkeley.edu' . "\n"; + print MAIL "Subject: splitter_janitor report\n\n"; + print MAIL "$message"; + close(MAIL); + } + +exit (0); diff --git a/ops/bin/xfer_to_hpss b/ops/bin/xfer_to_hpss new file mode 100755 index 0000000..e212da0 --- /dev/null +++ b/ops/bin/xfer_to_hpss @@ -0,0 +1,29 @@ +#! /usr/bin/env perl + +# where is the configuration file? +$cfgfile = "/disks/thumper/raid5_d/users/seti/dr2_data/production/scripts/data_flow.cfg"; + +# read it in and continue... +$cfg = ""; +open (CNFFILE,$cfgfile) or die "cannot open configuration file: $cfgfile\nmake sure this variable is set properly"; +while () { $cfg .= $_ } +close (CNFFILE); +eval $cfg; + +$file = $ARGV[0]; +if ($file eq "" || $file eq "-h" || $file eq "--help") { + print "xfer_to_hpss full_path_to_file :\n copy data file to hpss\n"; + exit (1); + } + +if (ord($file) ne ord("/")) { + print "$file doesn't big with a \"/\" - make sure you enter a full path!\n"; + exit (1); + } + +if (! -f $file) { + print "cannot find file: $file\n"; + exit (1); + } + + diff --git a/setiathome.pbproj/project.pbxproj b/setiathome.pbproj/project.pbxproj new file mode 100644 index 0000000..1627a16 --- /dev/null +++ b/setiathome.pbproj/project.pbxproj @@ -0,0 +1,2497 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 38; + objects = { + 0249A665FF388DC511CA2CEA = { + isa = PBXApplicationReference; + path = setiathome.app; + refType = 3; + }; + 0249A669FF388E3911CA2CEA = { + isa = PBXFileReference; + name = "libstdc++.a"; + path = "/usr/lib/libstdc++.a"; + refType = 0; + }; +//020 +//021 +//022 +//023 +//024 +//040 +//041 +//042 +//043 +//044 + 04313892FE3035C9C02AAC07 = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXRezBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; +//040 +//041 +//042 +//043 +//044 +//050 +//051 +//052 +//053 +//054 + 05952DFCFFF02D1B11CA0E50 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = NO; + OPTIMIZATION_CFLAGS = "-O0"; + }; + isa = PBXBuildStyle; + name = Development; + }; + 05952DFDFFF02D1B11CA0E50 = { + buildRules = ( + ); + buildSettings = { + COPY_PHASE_STRIP = YES; + }; + isa = PBXBuildStyle; + name = Deployment; + }; +//050 +//051 +//052 +//053 +//054 +//060 +//061 +//062 +//063 +//064 + 0640BAA4FFF0323A11CA0E50 = { + isa = PBXFrameworkReference; + name = ApplicationServices.framework; + path = /System/Library/Frameworks/ApplicationServices.framework; + refType = 0; + }; + 0640BAA5FFF0323A11CA0E50 = { + isa = PBXFrameworkReference; + name = CoreServices.framework; + path = /System/Library/Frameworks/CoreServices.framework; + refType = 0; + }; +//060 +//061 +//062 +//063 +//064 +//190 +//191 +//192 +//193 +//194 + 195DF8C9FE9D4F0611CA2CBB = { + children = ( + 0249A665FF388DC511CA2CEA, + ); + isa = PBXGroup; + name = Products; + refType = 4; + }; +//190 +//191 +//192 +//193 +//194 +//200 +//201 +//202 +//203 +//204 + 20286C28FDCF999611CA2CEA = { + buildStyles = ( + 05952DFCFFF02D1B11CA0E50, + 05952DFDFFF02D1B11CA0E50, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 20286C29FDCF999611CA2CEA; + projectDirPath = ""; + targets = ( + 20286C34FDCF999611CA2CEA, + ); + }; + 20286C29FDCF999611CA2CEA = { + children = ( + AA3FFC8F053BDEC000164350, + AA3FFC00053BCCC700164350, + AA6AA8C804113B7B00A80164, + 20286C2AFDCF999611CA2CEA, + 20286C2CFDCF999611CA2CEA, + 20286C32FDCF999611CA2CEA, + 195DF8C9FE9D4F0611CA2CBB, + ); + isa = PBXGroup; + name = "«PROJECTNAME»"; + path = ""; + refType = 4; + }; + 20286C2AFDCF999611CA2CEA = { + children = ( + AA763A9B0400775C00A80164, + AA3FFB63053BC42600164350, + AA763A910400775C00A80164, + AA3FFB0B053BC3AA00164350, + AA763A930400775C00A80164, + AA763A940400775C00A80164, + AA763A950400775C00A80164, + AA3FFB0C053BC3AA00164350, + AA763A970400775C00A80164, + AA3FFB64053BC42600164350, + AABC80520410BC6E00A80164, + AA763A9C0400775C00A80164, + AA763A9E0400775C00A80164, + AA763A9D0400775C00A80164, + AA763A9F0400775C00A80164, + AA763AB00400777000A80164, + AA763AB20400777000A80164, + AABC80550410BCCF00A80164, + AABC80540410BCCF00A80164, + AADBC6EE04226C0F00A80164, + AADBC6EF04226C0F00A80164, + AA763AB30400777000A80164, + AA763AB10400777000A80164, + AA3FFB69053BC4DA00164350, + AA3FFBF2053BC99600164350, + AA3FFBF3053BC99600164350, + AA3FFBF8053BCAAD00164350, + AA3FFBF9053BCAAD00164350, + ); + isa = PBXGroup; + name = "BOINC Sources"; + path = ""; + refType = 4; + }; + 20286C2CFDCF999611CA2CEA = { + children = ( + ); + isa = PBXGroup; + name = Resources; + path = ""; + refType = 4; + }; + 20286C32FDCF999611CA2CEA = { + children = ( + 20286C33FDCF999611CA2CEA, + 0249A669FF388E3911CA2CEA, + 0640BAA4FFF0323A11CA0E50, + 0640BAA5FFF0323A11CA0E50, + AA763B590400789200A80164, + AA763B5B040078AC00A80164, + AA763B5C040078AC00A80164, + AA763B6104007BB800A80164, + AA6AA8C60410C8B300A80164, + ); + isa = PBXGroup; + name = "External Frameworks and Libraries"; + path = ""; + refType = 4; + }; + 20286C33FDCF999611CA2CEA = { + isa = PBXFrameworkReference; + name = Carbon.framework; + path = /System/Library/Frameworks/Carbon.framework; + refType = 0; + }; + 20286C34FDCF999611CA2CEA = { + buildPhases = ( + 20286C35FDCF999611CA2CEA, + 20286C36FDCF999611CA2CEA, + 20286C38FDCF999611CA2CEA, + 20286C3BFDCF999611CA2CEA, + 04313892FE3035C9C02AAC07, + ); + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ""; + HEADER_SEARCH_PATHS = ""; + INSTALL_PATH = "$(HOME)/Applications"; + LIBRARY_SEARCH_PATHS = /usr/lib/gcc/darwin/3.1; + OTHER_CFLAGS = "-DHAVE_DIRENT_H -DHAVE_SYS_RESOURCE_H -DHAVE_INTTYPES_H -DHAVE_UNISTD_H -DHAVE_SIGNAL_H -DHAVE_SYS_TIME_H -DFFTW_ENABLE_FLOAT -DBOINC_APP_GRAPHICS -DHAVE_SYS_SHM_H -DHAVE_SYS_IPC_H -DHAVE_SYS_MOUNT_H -DCLIENT -DVERSION_MINOR=00 -DVERSION_MAJOR=4 -DHAVE_ATOLL -DFAR="; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = setiathome; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + WRAPPER_EXTENSION = app; + }; + dependencies = ( + ); + isa = PBXApplicationTarget; + name = setiathome; + productInstallPath = "$(HOME)/Applications"; + productName = "«PROJECTNAME»"; + productReference = 0249A665FF388DC511CA2CEA; + productSettingsXML = " + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + setiathome + CFBundleIconFile + + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 0.1 + CSResourcesFileMapped + + + +"; + }; + 20286C35FDCF999611CA2CEA = { + buildActionMask = 2147483647; + files = ( + AA763AAC0400775C00A80164, + AA763AAD0400775C00A80164, + AA763AB40400777000A80164, + AA763AB50400777000A80164, + AABC80570410BCCF00A80164, + AABC806A0410BD2600A80164, + AABC806E0410BD2800A80164, + AABC80730410BEEE00A80164, + AABC80790410C06700A80164, + AA6AA8B10410C34000A80164, + AADBC6F104226C0F00A80164, + AA3FFB39053BC3EB00164350, + AA3FFB3B053BC3EB00164350, + AA3FFB3D053BC3EB00164350, + AA3FFB3F053BC3EB00164350, + AA3FFB41053BC3EB00164350, + AA3FFB43053BC3EB00164350, + AA3FFB46053BC3EB00164350, + AA3FFB48053BC3EB00164350, + AA3FFB4B053BC3EB00164350, + AA3FFB4E053BC3EB00164350, + AA3FFB4F053BC3EB00164350, + AA3FFB51053BC3EB00164350, + AA3FFB54053BC3EB00164350, + AA3FFB56053BC3EB00164350, + AA3FFB58053BC3EB00164350, + AA3FFB5A053BC3EB00164350, + AA3FFB5C053BC3EB00164350, + AA3FFB5E053BC3EB00164350, + AA3FFB60053BC3EB00164350, + AA3FFB62053BC3EB00164350, + AA3FFB6A053BC4DA00164350, + AA3FFBF5053BC99600164350, + AA3FFBFB053BCAAD00164350, + AA3FFBFF053BCAF200164350, + AA3FFC43053BCCE200164350, + AA3FFC44053BCCE200164350, + AA3FFC4B053BCCE200164350, + AA3FFC51053BCCE200164350, + AA3FFC5D053BCCE200164350, + AA3FFC60053BCCE200164350, + AA3FFC6B053BCCE200164350, + AA3FFC73053BCCE200164350, + AA3FFC76053BCCE200164350, + AA3FFC77053BCCE200164350, + AA3FFC78053BCCE200164350, + AA3FFC79053BCCE200164350, + AA3FFC7D053BCCE200164350, + AA3FFC86053BCDAD00164350, + AA3FFC8A053BD34A00164350, + AA3FFC8E053BDE9100164350, + ); + isa = PBXHeadersBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 20286C36FDCF999611CA2CEA = { + buildActionMask = 2147483647; + files = ( + ); + isa = PBXResourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 20286C38FDCF999611CA2CEA = { + buildActionMask = 2147483647; + files = ( + AA763AAE0400775C00A80164, + AA763AAF0400775C00A80164, + AA763AB60400777000A80164, + AA763AB70400777000A80164, + AABC80530410BC6E00A80164, + AABC80560410BCCF00A80164, + AABC80720410BEED00A80164, + AADBC6F004226C0F00A80164, + AA3FFB0D053BC3AA00164350, + AA3FFB0E053BC3AA00164350, + AA3FFB3A053BC3EB00164350, + AA3FFB3C053BC3EB00164350, + AA3FFB3E053BC3EB00164350, + AA3FFB40053BC3EB00164350, + AA3FFB42053BC3EB00164350, + AA3FFB44053BC3EB00164350, + AA3FFB45053BC3EB00164350, + AA3FFB47053BC3EB00164350, + AA3FFB4A053BC3EB00164350, + AA3FFB4C053BC3EB00164350, + AA3FFB4D053BC3EB00164350, + AA3FFB50053BC3EB00164350, + AA3FFB52053BC3EB00164350, + AA3FFB53053BC3EB00164350, + AA3FFB55053BC3EB00164350, + AA3FFB57053BC3EB00164350, + AA3FFB59053BC3EB00164350, + AA3FFB5B053BC3EB00164350, + AA3FFB5D053BC3EB00164350, + AA3FFB5F053BC3EB00164350, + AA3FFB61053BC3EB00164350, + AA3FFB65053BC42600164350, + AA3FFB66053BC42600164350, + AA3FFBF4053BC99600164350, + AA3FFBFA053BCAAD00164350, + AA3FFBFE053BCAF200164350, + AA3FFC45053BCCE200164350, + AA3FFC46053BCCE200164350, + AA3FFC47053BCCE200164350, + AA3FFC48053BCCE200164350, + AA3FFC49053BCCE200164350, + AA3FFC4A053BCCE200164350, + AA3FFC4C053BCCE200164350, + AA3FFC4D053BCCE200164350, + AA3FFC4E053BCCE200164350, + AA3FFC4F053BCCE200164350, + AA3FFC50053BCCE200164350, + AA3FFC52053BCCE200164350, + AA3FFC53053BCCE200164350, + AA3FFC54053BCCE200164350, + AA3FFC55053BCCE200164350, + AA3FFC56053BCCE200164350, + AA3FFC57053BCCE200164350, + AA3FFC58053BCCE200164350, + AA3FFC59053BCCE200164350, + AA3FFC5A053BCCE200164350, + AA3FFC5B053BCCE200164350, + AA3FFC5C053BCCE200164350, + AA3FFC5E053BCCE200164350, + AA3FFC5F053BCCE200164350, + AA3FFC61053BCCE200164350, + AA3FFC62053BCCE200164350, + AA3FFC63053BCCE200164350, + AA3FFC64053BCCE200164350, + AA3FFC65053BCCE200164350, + AA3FFC66053BCCE200164350, + AA3FFC67053BCCE200164350, + AA3FFC68053BCCE200164350, + AA3FFC69053BCCE200164350, + AA3FFC6A053BCCE200164350, + AA3FFC6C053BCCE200164350, + AA3FFC6D053BCCE200164350, + AA3FFC6E053BCCE200164350, + AA3FFC6F053BCCE200164350, + AA3FFC70053BCCE200164350, + AA3FFC71053BCCE200164350, + AA3FFC72053BCCE200164350, + AA3FFC74053BCCE200164350, + AA3FFC75053BCCE200164350, + AA3FFC7A053BCCE200164350, + AA3FFC7B053BCCE200164350, + AA3FFC7C053BCCE200164350, + AA3FFC7E053BCCE200164350, + AA3FFC7F053BCCE200164350, + AA3FFC80053BCCE200164350, + AA3FFC81053BCCE200164350, + AA3FFC82053BCCE200164350, + AA3FFC83053BCCE200164350, + AA3FFC84053BCCE200164350, + AA3FFC89053BD34A00164350, + AA3FFC8D053BDE9100164350, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 20286C3BFDCF999611CA2CEA = { + buildActionMask = 2147483647; + files = ( + AA763B5A0400789200A80164, + AA763B5E040078AC00A80164, + AA763B6304007BD100A80164, + AA763B8904007C2F00A80164, + AA763B8A04007C8A00A80164, + AA6AA8C70410C8B300A80164, + ); + isa = PBXFrameworksBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; +//200 +//201 +//202 +//203 +//204 +//AA0 +//AA1 +//AA2 +//AA3 +//AA4 + AA3FFB0B053BC3AA00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = gutil.C; + path = ../boinc/api/gutil.C; + refType = 4; + }; + AA3FFB0C053BC3AA00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = reduce.C; + path = ../boinc/api/reduce.C; + refType = 4; + }; + AA3FFB0D053BC3AA00164350 = { + fileRef = AA3FFB0B053BC3AA00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB0E053BC3AA00164350 = { + fileRef = AA3FFB0C053BC3AA00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB0F053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = analyze.h; + path = client/analyze.h; + refType = 4; + }; + AA3FFB10053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = analyzeFuncs.cpp; + path = client/analyzeFuncs.cpp; + refType = 4; + }; + AA3FFB11053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = analyzeFuncs.h; + path = client/analyzeFuncs.h; + refType = 4; + }; + AA3FFB12053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = analyzePoT.cpp; + path = client/analyzePoT.cpp; + refType = 4; + }; + AA3FFB13053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = analyzePoT.h; + path = client/analyzePoT.h; + refType = 4; + }; + AA3FFB14053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = analyzeReport.cpp; + path = client/analyzeReport.cpp; + refType = 4; + }; + AA3FFB15053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = analyzeReport.h; + path = client/analyzeReport.h; + refType = 4; + }; + AA3FFB16053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = chirpfft.cpp; + path = client/chirpfft.cpp; + refType = 4; + }; + AA3FFB17053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = chirpfft.h; + path = client/chirpfft.h; + refType = 4; + }; + AA3FFB18053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = fft8g.cpp; + path = client/fft8g.cpp; + refType = 4; + }; + AA3FFB19053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = fft8g.h; + path = client/fft8g.h; + refType = 4; + }; + AA3FFB1A053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = gasdev.cpp; + path = client/gasdev.cpp; + refType = 4; + }; + AA3FFB1B053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = gaussfit.cpp; + path = client/gaussfit.cpp; + refType = 4; + }; + AA3FFB1C053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = gaussfit.h; + path = client/gaussfit.h; + refType = 4; + }; + AA3FFB1D053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = gdata.cpp; + path = client/gdata.cpp; + refType = 4; + }; + AA3FFB1E053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = gdata.h; + path = client/gdata.h; + refType = 4; + }; + AA3FFB20053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = lcgamm.cpp; + path = client/lcgamm.cpp; + refType = 4; + }; + AA3FFB21053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = lcgamm.h; + path = client/lcgamm.h; + refType = 4; + }; + AA3FFB22053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = main.cpp; + path = client/main.cpp; + refType = 4; + }; + AA3FFB23053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = malloc_a.cpp; + path = client/malloc_a.cpp; + refType = 4; + }; + AA3FFB24053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = malloc_a.h; + path = client/malloc_a.h; + refType = 4; + }; + AA3FFB25053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = nr.h; + path = client/nr.h; + refType = 4; + }; + AA3FFB26053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = pulsefind.cpp; + path = client/pulsefind.cpp; + refType = 4; + }; + AA3FFB27053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = pulsefind.h; + path = client/pulsefind.h; + refType = 4; + }; + AA3FFB28053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = ran1.cpp; + path = client/ran1.cpp; + refType = 4; + }; + AA3FFB29053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = s_util.cpp; + path = client/s_util.cpp; + refType = 4; + }; + AA3FFB2A053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = s_util.h; + path = client/s_util.h; + refType = 4; + }; + AA3FFB2B053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sah_gfx.cpp; + path = client/sah_gfx.cpp; + refType = 4; + }; + AA3FFB2C053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sah_gfx.h; + path = client/sah_gfx.h; + refType = 4; + }; + AA3FFB2D053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = seti_header.cpp; + path = client/seti_header.cpp; + refType = 4; + }; + AA3FFB2E053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = seti_header.h; + path = client/seti_header.h; + refType = 4; + }; + AA3FFB2F053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = seti.cpp; + path = client/seti.cpp; + refType = 4; + }; + AA3FFB30053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = seti.h; + path = client/seti.h; + refType = 4; + }; + AA3FFB31053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = spike.cpp; + path = client/spike.cpp; + refType = 4; + }; + AA3FFB32053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = spike.h; + path = client/spike.h; + refType = 4; + }; + AA3FFB33053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = timecvt.cpp; + path = client/timecvt.cpp; + refType = 4; + }; + AA3FFB34053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = timecvt.h; + path = client/timecvt.h; + refType = 4; + }; + AA3FFB35053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = version.cpp; + path = client/version.cpp; + refType = 4; + }; + AA3FFB36053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = version.h; + path = client/version.h; + refType = 4; + }; + AA3FFB37053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = worker.cpp; + path = client/worker.cpp; + refType = 4; + }; + AA3FFB38053BC3EB00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = worker.h; + path = client/worker.h; + refType = 4; + }; + AA3FFB39053BC3EB00164350 = { + fileRef = AA3FFB0F053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB3A053BC3EB00164350 = { + fileRef = AA3FFB10053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB3B053BC3EB00164350 = { + fileRef = AA3FFB11053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB3C053BC3EB00164350 = { + fileRef = AA3FFB12053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB3D053BC3EB00164350 = { + fileRef = AA3FFB13053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB3E053BC3EB00164350 = { + fileRef = AA3FFB14053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB3F053BC3EB00164350 = { + fileRef = AA3FFB15053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB40053BC3EB00164350 = { + fileRef = AA3FFB16053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB41053BC3EB00164350 = { + fileRef = AA3FFB17053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB42053BC3EB00164350 = { + fileRef = AA3FFB18053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB43053BC3EB00164350 = { + fileRef = AA3FFB19053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB44053BC3EB00164350 = { + fileRef = AA3FFB1A053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB45053BC3EB00164350 = { + fileRef = AA3FFB1B053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB46053BC3EB00164350 = { + fileRef = AA3FFB1C053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB47053BC3EB00164350 = { + fileRef = AA3FFB1D053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB48053BC3EB00164350 = { + fileRef = AA3FFB1E053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB4A053BC3EB00164350 = { + fileRef = AA3FFB20053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB4B053BC3EB00164350 = { + fileRef = AA3FFB21053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB4C053BC3EB00164350 = { + fileRef = AA3FFB22053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB4D053BC3EB00164350 = { + fileRef = AA3FFB23053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB4E053BC3EB00164350 = { + fileRef = AA3FFB24053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB4F053BC3EB00164350 = { + fileRef = AA3FFB25053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB50053BC3EB00164350 = { + fileRef = AA3FFB26053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB51053BC3EB00164350 = { + fileRef = AA3FFB27053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB52053BC3EB00164350 = { + fileRef = AA3FFB28053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB53053BC3EB00164350 = { + fileRef = AA3FFB29053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB54053BC3EB00164350 = { + fileRef = AA3FFB2A053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB55053BC3EB00164350 = { + fileRef = AA3FFB2B053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB56053BC3EB00164350 = { + fileRef = AA3FFB2C053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB57053BC3EB00164350 = { + fileRef = AA3FFB2D053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB58053BC3EB00164350 = { + fileRef = AA3FFB2E053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB59053BC3EB00164350 = { + fileRef = AA3FFB2F053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB5A053BC3EB00164350 = { + fileRef = AA3FFB30053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB5B053BC3EB00164350 = { + fileRef = AA3FFB31053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB5C053BC3EB00164350 = { + fileRef = AA3FFB32053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB5D053BC3EB00164350 = { + fileRef = AA3FFB33053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB5E053BC3EB00164350 = { + fileRef = AA3FFB34053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB5F053BC3EB00164350 = { + fileRef = AA3FFB35053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB60053BC3EB00164350 = { + fileRef = AA3FFB36053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB61053BC3EB00164350 = { + fileRef = AA3FFB37053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB62053BC3EB00164350 = { + fileRef = AA3FFB38053BC3EB00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB63053BC42600164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = mac_app_opengl.C; + path = ../boinc/api/mac_app_opengl.C; + refType = 4; + }; + AA3FFB64053BC42600164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = mac_carbon_gl.C; + path = ../boinc/api/mac_carbon_gl.C; + refType = 4; + }; + AA3FFB65053BC42600164350 = { + fileRef = AA3FFB63053BC42600164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB66053BC42600164350 = { + fileRef = AA3FFB64053BC42600164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFB69053BC4DA00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = config.h; + path = ../boinc/config.h; + refType = 4; + }; + AA3FFB6A053BC4DA00164350 = { + fileRef = AA3FFB69053BC4DA00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFBF2053BC99600164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = app_ipc.C; + path = ../boinc/lib/app_ipc.C; + refType = 4; + }; + AA3FFBF3053BC99600164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = app_ipc.h; + path = ../boinc/lib/app_ipc.h; + refType = 4; + }; + AA3FFBF4053BC99600164350 = { + fileRef = AA3FFBF2053BC99600164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFBF5053BC99600164350 = { + fileRef = AA3FFBF3053BC99600164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFBF8053BCAAD00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = xml_util.C; + path = ../boinc/lib/xml_util.C; + refType = 4; + }; + AA3FFBF9053BCAAD00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = xml_util.h; + path = ../boinc/lib/xml_util.h; + refType = 4; + }; + AA3FFBFA053BCAAD00164350 = { + fileRef = AA3FFBF8053BCAAD00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFBFB053BCAAD00164350 = { + fileRef = AA3FFBF9053BCAAD00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFBFC053BCAF200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = schema_master.cpp; + path = db/schema_master.cpp; + refType = 4; + }; + AA3FFBFD053BCAF200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = schema_master.h; + path = db/schema_master.h; + refType = 4; + }; + AA3FFBFE053BCAF200164350 = { + fileRef = AA3FFBFC053BCAF200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFBFF053BCAF200164350 = { + fileRef = AA3FFBFD053BCAF200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC00053BCCC700164350 = { + children = ( + AA3FFC01053BCCE100164350, + AA3FFC02053BCCE100164350, + AA3FFC03053BCCE100164350, + AA3FFC04053BCCE100164350, + AA3FFC05053BCCE100164350, + AA3FFC06053BCCE100164350, + AA3FFC07053BCCE100164350, + AA3FFC08053BCCE100164350, + AA3FFC09053BCCE100164350, + AA3FFC0A053BCCE100164350, + AA3FFC0B053BCCE100164350, + AA3FFC0C053BCCE100164350, + AA3FFC0D053BCCE100164350, + AA3FFC0E053BCCE100164350, + AA3FFC0F053BCCE100164350, + AA3FFC10053BCCE100164350, + AA3FFC11053BCCE100164350, + AA3FFC12053BCCE100164350, + AA3FFC13053BCCE100164350, + AA3FFC14053BCCE100164350, + AA3FFC15053BCCE100164350, + AA3FFC16053BCCE100164350, + AA3FFC17053BCCE100164350, + AA3FFC18053BCCE100164350, + AA3FFC19053BCCE100164350, + AA3FFC1A053BCCE100164350, + AA3FFC1B053BCCE100164350, + AA3FFC1C053BCCE100164350, + AA3FFC1D053BCCE100164350, + AA3FFC1E053BCCE100164350, + AA3FFC1F053BCCE100164350, + AA3FFC20053BCCE100164350, + AA3FFC21053BCCE100164350, + AA3FFC22053BCCE100164350, + AA3FFC23053BCCE100164350, + AA3FFC24053BCCE100164350, + AA3FFC25053BCCE100164350, + AA3FFC26053BCCE100164350, + AA3FFC27053BCCE100164350, + AA3FFC28053BCCE100164350, + AA3FFC29053BCCE100164350, + AA3FFC2A053BCCE100164350, + AA3FFC2B053BCCE100164350, + AA3FFC2C053BCCE100164350, + AA3FFC2D053BCCE100164350, + AA3FFC2E053BCCE100164350, + AA3FFC2F053BCCE100164350, + AA3FFC30053BCCE200164350, + AA3FFC31053BCCE200164350, + AA3FFC32053BCCE200164350, + AA3FFC33053BCCE200164350, + AA3FFC34053BCCE200164350, + AA3FFC35053BCCE200164350, + AA3FFC36053BCCE200164350, + AA3FFC37053BCCE200164350, + AA3FFC38053BCCE200164350, + AA3FFC39053BCCE200164350, + AA3FFC3A053BCCE200164350, + AA3FFC3B053BCCE200164350, + AA3FFC3C053BCCE200164350, + AA3FFC3D053BCCE200164350, + AA3FFC3E053BCCE200164350, + AA3FFC3F053BCCE200164350, + AA3FFC40053BCCE200164350, + AA3FFC41053BCCE200164350, + AA3FFC42053BCCE200164350, + ); + isa = PBXGroup; + name = JPEGLib; + refType = 4; + }; + AA3FFC01053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = cderror.h; + path = ../boinc/jpeglib/cderror.h; + refType = 4; + }; + AA3FFC02053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = cdjpeg.h; + path = ../boinc/jpeglib/cdjpeg.h; + refType = 4; + }; + AA3FFC03053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcapimin.c; + path = ../boinc/jpeglib/jcapimin.c; + refType = 4; + }; + AA3FFC04053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcapistd.c; + path = ../boinc/jpeglib/jcapistd.c; + refType = 4; + }; + AA3FFC05053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jccoefct.c; + path = ../boinc/jpeglib/jccoefct.c; + refType = 4; + }; + AA3FFC06053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jccolor.c; + path = ../boinc/jpeglib/jccolor.c; + refType = 4; + }; + AA3FFC07053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcdctmgr.c; + path = ../boinc/jpeglib/jcdctmgr.c; + refType = 4; + }; + AA3FFC08053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jchuff.c; + path = ../boinc/jpeglib/jchuff.c; + refType = 4; + }; + AA3FFC09053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jchuff.h; + path = ../boinc/jpeglib/jchuff.h; + refType = 4; + }; + AA3FFC0A053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcinit.c; + path = ../boinc/jpeglib/jcinit.c; + refType = 4; + }; + AA3FFC0B053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcmainct.c; + path = ../boinc/jpeglib/jcmainct.c; + refType = 4; + }; + AA3FFC0C053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcmarker.c; + path = ../boinc/jpeglib/jcmarker.c; + refType = 4; + }; + AA3FFC0D053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcmaster.c; + path = ../boinc/jpeglib/jcmaster.c; + refType = 4; + }; + AA3FFC0E053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcomapi.c; + path = ../boinc/jpeglib/jcomapi.c; + refType = 4; + }; + AA3FFC0F053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jconfig.h; + path = ../boinc/jpeglib/jconfig.h; + refType = 4; + }; + AA3FFC10053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcparam.c; + path = ../boinc/jpeglib/jcparam.c; + refType = 4; + }; + AA3FFC11053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcphuff.c; + path = ../boinc/jpeglib/jcphuff.c; + refType = 4; + }; + AA3FFC12053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcprepct.c; + path = ../boinc/jpeglib/jcprepct.c; + refType = 4; + }; + AA3FFC13053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jcsample.c; + path = ../boinc/jpeglib/jcsample.c; + refType = 4; + }; + AA3FFC14053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jctrans.c; + path = ../boinc/jpeglib/jctrans.c; + refType = 4; + }; + AA3FFC15053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdapimin.c; + path = ../boinc/jpeglib/jdapimin.c; + refType = 4; + }; + AA3FFC16053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdapistd.c; + path = ../boinc/jpeglib/jdapistd.c; + refType = 4; + }; + AA3FFC17053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdatadst.c; + path = ../boinc/jpeglib/jdatadst.c; + refType = 4; + }; + AA3FFC18053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdatasrc.c; + path = ../boinc/jpeglib/jdatasrc.c; + refType = 4; + }; + AA3FFC19053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdcoefct.c; + path = ../boinc/jpeglib/jdcoefct.c; + refType = 4; + }; + AA3FFC1A053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdcolor.c; + path = ../boinc/jpeglib/jdcolor.c; + refType = 4; + }; + AA3FFC1B053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdct.h; + path = ../boinc/jpeglib/jdct.h; + refType = 4; + }; + AA3FFC1C053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jddctmgr.c; + path = ../boinc/jpeglib/jddctmgr.c; + refType = 4; + }; + AA3FFC1D053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdhuff.c; + path = ../boinc/jpeglib/jdhuff.c; + refType = 4; + }; + AA3FFC1E053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdhuff.h; + path = ../boinc/jpeglib/jdhuff.h; + refType = 4; + }; + AA3FFC1F053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdinput.c; + path = ../boinc/jpeglib/jdinput.c; + refType = 4; + }; + AA3FFC20053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdmainct.c; + path = ../boinc/jpeglib/jdmainct.c; + refType = 4; + }; + AA3FFC21053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdmarker.c; + path = ../boinc/jpeglib/jdmarker.c; + refType = 4; + }; + AA3FFC22053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdmaster.c; + path = ../boinc/jpeglib/jdmaster.c; + refType = 4; + }; + AA3FFC23053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdmerge.c; + path = ../boinc/jpeglib/jdmerge.c; + refType = 4; + }; + AA3FFC24053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdphuff.c; + path = ../boinc/jpeglib/jdphuff.c; + refType = 4; + }; + AA3FFC25053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdpostct.c; + path = ../boinc/jpeglib/jdpostct.c; + refType = 4; + }; + AA3FFC26053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdsample.c; + path = ../boinc/jpeglib/jdsample.c; + refType = 4; + }; + AA3FFC27053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jdtrans.c; + path = ../boinc/jpeglib/jdtrans.c; + refType = 4; + }; + AA3FFC28053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jerror.c; + path = ../boinc/jpeglib/jerror.c; + refType = 4; + }; + AA3FFC29053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jerror.h; + path = ../boinc/jpeglib/jerror.h; + refType = 4; + }; + AA3FFC2A053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jfdctflt.c; + path = ../boinc/jpeglib/jfdctflt.c; + refType = 4; + }; + AA3FFC2B053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jfdctfst.c; + path = ../boinc/jpeglib/jfdctfst.c; + refType = 4; + }; + AA3FFC2C053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jfdctint.c; + path = ../boinc/jpeglib/jfdctint.c; + refType = 4; + }; + AA3FFC2D053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jidctflt.c; + path = ../boinc/jpeglib/jidctflt.c; + refType = 4; + }; + AA3FFC2E053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jidctfst.c; + path = ../boinc/jpeglib/jidctfst.c; + refType = 4; + }; + AA3FFC2F053BCCE100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jidctint.c; + path = ../boinc/jpeglib/jidctint.c; + refType = 4; + }; + AA3FFC30053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jidctred.c; + path = ../boinc/jpeglib/jidctred.c; + refType = 4; + }; + AA3FFC31053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jinclude.h; + path = ../boinc/jpeglib/jinclude.h; + refType = 4; + }; + AA3FFC32053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jmemmgr.c; + path = ../boinc/jpeglib/jmemmgr.c; + refType = 4; + }; + AA3FFC33053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jmemnobs.c; + path = ../boinc/jpeglib/jmemnobs.c; + refType = 4; + }; + AA3FFC34053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jmemsys.h; + path = ../boinc/jpeglib/jmemsys.h; + refType = 4; + }; + AA3FFC35053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jmorecfg.h; + path = ../boinc/jpeglib/jmorecfg.h; + refType = 4; + }; + AA3FFC36053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jpegint.h; + path = ../boinc/jpeglib/jpegint.h; + refType = 4; + }; + AA3FFC37053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jpeglib.h; + path = ../boinc/jpeglib/jpeglib.h; + refType = 4; + }; + AA3FFC38053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jquant1.c; + path = ../boinc/jpeglib/jquant1.c; + refType = 4; + }; + AA3FFC39053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jquant2.c; + path = ../boinc/jpeglib/jquant2.c; + refType = 4; + }; + AA3FFC3A053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jutils.c; + path = ../boinc/jpeglib/jutils.c; + refType = 4; + }; + AA3FFC3B053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = jversion.h; + path = ../boinc/jpeglib/jversion.h; + refType = 4; + }; + AA3FFC3C053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = rdbmp.c; + path = ../boinc/jpeglib/rdbmp.c; + refType = 4; + }; + AA3FFC3D053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = rdcolmap.c; + path = ../boinc/jpeglib/rdcolmap.c; + refType = 4; + }; + AA3FFC3E053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = rdgif.c; + path = ../boinc/jpeglib/rdgif.c; + refType = 4; + }; + AA3FFC3F053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = rdppm.c; + path = ../boinc/jpeglib/rdppm.c; + refType = 4; + }; + AA3FFC40053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = rdrle.c; + path = ../boinc/jpeglib/rdrle.c; + refType = 4; + }; + AA3FFC41053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = rdswitch.c; + path = ../boinc/jpeglib/rdswitch.c; + refType = 4; + }; + AA3FFC42053BCCE200164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = rdtarga.c; + path = ../boinc/jpeglib/rdtarga.c; + refType = 4; + }; + AA3FFC43053BCCE200164350 = { + fileRef = AA3FFC01053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC44053BCCE200164350 = { + fileRef = AA3FFC02053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC45053BCCE200164350 = { + fileRef = AA3FFC03053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC46053BCCE200164350 = { + fileRef = AA3FFC04053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC47053BCCE200164350 = { + fileRef = AA3FFC05053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC48053BCCE200164350 = { + fileRef = AA3FFC06053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC49053BCCE200164350 = { + fileRef = AA3FFC07053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC4A053BCCE200164350 = { + fileRef = AA3FFC08053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC4B053BCCE200164350 = { + fileRef = AA3FFC09053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC4C053BCCE200164350 = { + fileRef = AA3FFC0A053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC4D053BCCE200164350 = { + fileRef = AA3FFC0B053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC4E053BCCE200164350 = { + fileRef = AA3FFC0C053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC4F053BCCE200164350 = { + fileRef = AA3FFC0D053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC50053BCCE200164350 = { + fileRef = AA3FFC0E053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC51053BCCE200164350 = { + fileRef = AA3FFC0F053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC52053BCCE200164350 = { + fileRef = AA3FFC10053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC53053BCCE200164350 = { + fileRef = AA3FFC11053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC54053BCCE200164350 = { + fileRef = AA3FFC12053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC55053BCCE200164350 = { + fileRef = AA3FFC13053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC56053BCCE200164350 = { + fileRef = AA3FFC14053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC57053BCCE200164350 = { + fileRef = AA3FFC15053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC58053BCCE200164350 = { + fileRef = AA3FFC16053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC59053BCCE200164350 = { + fileRef = AA3FFC17053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC5A053BCCE200164350 = { + fileRef = AA3FFC18053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC5B053BCCE200164350 = { + fileRef = AA3FFC19053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC5C053BCCE200164350 = { + fileRef = AA3FFC1A053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC5D053BCCE200164350 = { + fileRef = AA3FFC1B053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC5E053BCCE200164350 = { + fileRef = AA3FFC1C053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC5F053BCCE200164350 = { + fileRef = AA3FFC1D053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC60053BCCE200164350 = { + fileRef = AA3FFC1E053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC61053BCCE200164350 = { + fileRef = AA3FFC1F053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC62053BCCE200164350 = { + fileRef = AA3FFC20053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC63053BCCE200164350 = { + fileRef = AA3FFC21053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC64053BCCE200164350 = { + fileRef = AA3FFC22053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC65053BCCE200164350 = { + fileRef = AA3FFC23053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC66053BCCE200164350 = { + fileRef = AA3FFC24053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC67053BCCE200164350 = { + fileRef = AA3FFC25053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC68053BCCE200164350 = { + fileRef = AA3FFC26053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC69053BCCE200164350 = { + fileRef = AA3FFC27053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC6A053BCCE200164350 = { + fileRef = AA3FFC28053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC6B053BCCE200164350 = { + fileRef = AA3FFC29053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC6C053BCCE200164350 = { + fileRef = AA3FFC2A053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC6D053BCCE200164350 = { + fileRef = AA3FFC2B053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC6E053BCCE200164350 = { + fileRef = AA3FFC2C053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC6F053BCCE200164350 = { + fileRef = AA3FFC2D053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC70053BCCE200164350 = { + fileRef = AA3FFC2E053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC71053BCCE200164350 = { + fileRef = AA3FFC2F053BCCE100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC72053BCCE200164350 = { + fileRef = AA3FFC30053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC73053BCCE200164350 = { + fileRef = AA3FFC31053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC74053BCCE200164350 = { + fileRef = AA3FFC32053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC75053BCCE200164350 = { + fileRef = AA3FFC33053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC76053BCCE200164350 = { + fileRef = AA3FFC34053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC77053BCCE200164350 = { + fileRef = AA3FFC35053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC78053BCCE200164350 = { + fileRef = AA3FFC36053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC79053BCCE200164350 = { + fileRef = AA3FFC37053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC7A053BCCE200164350 = { + fileRef = AA3FFC38053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC7B053BCCE200164350 = { + fileRef = AA3FFC39053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC7C053BCCE200164350 = { + fileRef = AA3FFC3A053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC7D053BCCE200164350 = { + fileRef = AA3FFC3B053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC7E053BCCE200164350 = { + fileRef = AA3FFC3C053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC7F053BCCE200164350 = { + fileRef = AA3FFC3D053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC80053BCCE200164350 = { + fileRef = AA3FFC3E053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC81053BCCE200164350 = { + fileRef = AA3FFC3F053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC82053BCCE200164350 = { + fileRef = AA3FFC40053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC83053BCCE200164350 = { + fileRef = AA3FFC41053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC84053BCCE200164350 = { + fileRef = AA3FFC42053BCCE200164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC85053BCDAD00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sqlint8.h; + path = db/sqlint8.h; + refType = 4; + }; + AA3FFC86053BCDAD00164350 = { + fileRef = AA3FFC85053BCDAD00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC87053BD34A00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sqlblob.cpp; + path = db/sqlblob.cpp; + refType = 4; + }; + AA3FFC88053BD34A00164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sqlblob.h; + path = db/sqlblob.h; + refType = 4; + }; + AA3FFC89053BD34A00164350 = { + fileRef = AA3FFC87053BD34A00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC8A053BD34A00164350 = { + fileRef = AA3FFC88053BD34A00164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC8B053BDE9100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sqlrow.cpp; + path = db/sqlrow.cpp; + refType = 4; + }; + AA3FFC8C053BDE9100164350 = { + fileEncoding = 30; + isa = PBXFileReference; + name = sqlrow.h; + path = db/sqlrow.h; + refType = 4; + }; + AA3FFC8D053BDE9100164350 = { + fileRef = AA3FFC8B053BDE9100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC8E053BDE9100164350 = { + fileRef = AA3FFC8C053BDE9100164350; + isa = PBXBuildFile; + settings = { + }; + }; + AA3FFC8F053BDEC000164350 = { + children = ( + AA3FFBFC053BCAF200164350, + AA3FFBFD053BCAF200164350, + AA3FFC85053BCDAD00164350, + AA3FFC87053BD34A00164350, + AA3FFC88053BD34A00164350, + AA3FFC8B053BDE9100164350, + AA3FFC8C053BDE9100164350, + ); + isa = PBXGroup; + name = DB; + refType = 4; + }; + AA6AA8B10410C34000A80164 = { + fileRef = AA763A950400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA6AA8C60410C8B300A80164 = { + isa = PBXFrameworkReference; + name = Cocoa.framework; + path = /System/Library/Frameworks/Cocoa.framework; + refType = 0; + }; + AA6AA8C70410C8B300A80164 = { + fileRef = AA6AA8C60410C8B300A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA6AA8C804113B7B00A80164 = { + children = ( + AA3FFB0F053BC3EB00164350, + AA3FFB10053BC3EB00164350, + AA3FFB11053BC3EB00164350, + AA3FFB12053BC3EB00164350, + AA3FFB13053BC3EB00164350, + AA3FFB14053BC3EB00164350, + AA3FFB15053BC3EB00164350, + AA3FFB16053BC3EB00164350, + AA3FFB17053BC3EB00164350, + AA3FFB18053BC3EB00164350, + AA3FFB19053BC3EB00164350, + AA3FFB1A053BC3EB00164350, + AA3FFB1B053BC3EB00164350, + AA3FFB1C053BC3EB00164350, + AA3FFB1D053BC3EB00164350, + AA3FFB1E053BC3EB00164350, + AA3FFB20053BC3EB00164350, + AA3FFB21053BC3EB00164350, + AA3FFB22053BC3EB00164350, + AA3FFB23053BC3EB00164350, + AA3FFB24053BC3EB00164350, + AA3FFB25053BC3EB00164350, + AA3FFB26053BC3EB00164350, + AA3FFB27053BC3EB00164350, + AA3FFB28053BC3EB00164350, + AA3FFB29053BC3EB00164350, + AA3FFB2A053BC3EB00164350, + AA3FFB2B053BC3EB00164350, + AA3FFB2C053BC3EB00164350, + AA3FFB2D053BC3EB00164350, + AA3FFB2E053BC3EB00164350, + AA3FFB2F053BC3EB00164350, + AA3FFB30053BC3EB00164350, + AA3FFB31053BC3EB00164350, + AA3FFB32053BC3EB00164350, + AA3FFB33053BC3EB00164350, + AA3FFB34053BC3EB00164350, + AA3FFB35053BC3EB00164350, + AA3FFB36053BC3EB00164350, + AA3FFB37053BC3EB00164350, + AA3FFB38053BC3EB00164350, + ); + isa = PBXGroup; + name = "SETI@home"; + refType = 4; + }; + AA763A910400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = gutil.h; + path = ../boinc/api/gutil.h; + refType = 2; + }; + AA763A930400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = graphics_data.h; + path = ../boinc/api/graphics_data.h; + refType = 2; + }; + AA763A940400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = graphics_data.C; + path = ../boinc/api/graphics_data.C; + refType = 2; + }; + AA763A950400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = reduce.h; + path = ../boinc/api/reduce.h; + refType = 2; + }; + AA763A970400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = mac_carbon_gl.h; + path = ../boinc/api/mac_carbon_gl.h; + refType = 2; + }; + AA763A9B0400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = mac_app_opengl.h; + path = ../boinc/api/mac_app_opengl.h; + refType = 2; + }; + AA763A9C0400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = graphics_api.h; + path = ../boinc/api/graphics_api.h; + refType = 2; + }; + AA763A9D0400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = boinc_api.h; + path = ../boinc/api/boinc_api.h; + refType = 2; + }; + AA763A9E0400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = graphics_api.C; + path = ../boinc/api/graphics_api.C; + refType = 2; + }; + AA763A9F0400775C00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = boinc_api.C; + path = ../boinc/api/boinc_api.C; + refType = 2; + }; + AA763AAC0400775C00A80164 = { + fileRef = AA763A9C0400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763AAD0400775C00A80164 = { + fileRef = AA763A9D0400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763AAE0400775C00A80164 = { + fileRef = AA763A9E0400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763AAF0400775C00A80164 = { + fileRef = AA763A9F0400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763AB00400777000A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = filesys.h; + path = ../boinc/lib/filesys.h; + refType = 2; + }; + AA763AB10400777000A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = util.h; + path = ../boinc/lib/util.h; + refType = 2; + }; + AA763AB20400777000A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = filesys.C; + path = ../boinc/lib/filesys.C; + refType = 2; + }; + AA763AB30400777000A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = util.C; + path = ../boinc/lib/util.C; + refType = 2; + }; + AA763AB40400777000A80164 = { + fileRef = AA763AB00400777000A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763AB50400777000A80164 = { + fileRef = AA763AB10400777000A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763AB60400777000A80164 = { + fileRef = AA763AB20400777000A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763AB70400777000A80164 = { + fileRef = AA763AB30400777000A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763B590400789200A80164 = { + isa = PBXFrameworkReference; + name = AGL.framework; + path = /System/Library/Frameworks/AGL.framework; + refType = 0; + }; + AA763B5A0400789200A80164 = { + fileRef = AA763B590400789200A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763B5B040078AC00A80164 = { + isa = PBXFrameworkReference; + name = DrawSprocket.framework; + path = /System/Library/Frameworks/DrawSprocket.framework; + refType = 0; + }; + AA763B5C040078AC00A80164 = { + isa = PBXFrameworkReference; + name = OpenGL.framework; + path = /System/Library/Frameworks/OpenGL.framework; + refType = 0; + }; + AA763B5E040078AC00A80164 = { + fileRef = AA763B5C040078AC00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763B6104007BB800A80164 = { + isa = PBXFrameworkReference; + name = GLUT.framework; + path = /System/Library/Frameworks/GLUT.framework; + refType = 0; + }; + AA763B6304007BD100A80164 = { + fileRef = AA763B6104007BB800A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AA763B8904007C2F00A80164 = { + fileRef = 20286C33FDCF999611CA2CEA; + isa = PBXBuildFile; + settings = { + }; + }; + AA763B8A04007C8A00A80164 = { + fileRef = AA763B5B040078AC00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AABC80520410BC6E00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = mfile.C; + path = ../boinc/api/mfile.C; + refType = 2; + }; + AABC80530410BC6E00A80164 = { + fileRef = AABC80520410BC6E00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AABC80540410BCCF00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = parse.C; + path = ../boinc/lib/parse.C; + refType = 2; + }; + AABC80550410BCCF00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = parse.h; + path = ../boinc/lib/parse.h; + refType = 2; + }; + AABC80560410BCCF00A80164 = { + fileRef = AABC80540410BCCF00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AABC80570410BCCF00A80164 = { + fileRef = AABC80550410BCCF00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AABC806A0410BD2600A80164 = { + fileRef = AA763A970400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AABC806E0410BD2800A80164 = { + fileRef = AA763A9B0400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AABC80720410BEED00A80164 = { + fileRef = AA763A940400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AABC80730410BEEE00A80164 = { + fileRef = AA763A930400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AABC80790410C06700A80164 = { + fileRef = AA763A910400775C00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AADBC6EE04226C0F00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = shmem.C; + path = ../boinc/lib/shmem.C; + refType = 4; + }; + AADBC6EF04226C0F00A80164 = { + fileEncoding = 30; + isa = PBXFileReference; + name = shmem.h; + path = ../boinc/lib/shmem.h; + refType = 4; + }; + AADBC6F004226C0F00A80164 = { + fileRef = AADBC6EE04226C0F00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + AADBC6F104226C0F00A80164 = { + fileRef = AADBC6EF04226C0F00A80164; + isa = PBXBuildFile; + settings = { + }; + }; + }; + rootObject = 20286C28FDCF999611CA2CEA; +} diff --git a/splitter_fft/Makefile.am b/splitter_fft/Makefile.am new file mode 100644 index 0000000..6ff1078 --- /dev/null +++ b/splitter_fft/Makefile.am @@ -0,0 +1,65 @@ +CC=gcc +BOINCDIR=@BOINCDIR@ +INFORMIXDIR=@INFORMIXDIR@ +SETILIB_PATH=@SETILIB_PATH@ +SETILIB_LIBS=@SETILIB_LIBS@ +SETIHOME=.. + +LINKOPTIONS= + + + +DBLIBS=@INFORMIX_LIBS@ -lm -lstdc++ + + +LINKOPTIONS=-Xlinker -R -Xlinker $(INFORMIXDIR)/lib:$(INFORMIXDIR)/lib/esql:$(LD_LIBRARY_PATH) + + +AM_CFLAGS= -g -Wall $(INCLUDE_DIRS) -DUSE_INFORMIX @PTHREAD_CFLAGS@ -ISETILIB_PATH/include + + +SYSLIBS = -lcrypto -ldl + +BOINCLIBS= -L$(BOINCDIR)/sched -lsched @MYSQL_LIBS@ @PTHREAD_LIBS@ -L$(BOINCDIR)/lib -lboinc_crypt -lboinc -L$(SSLDIR) -lcrypto -lssl + +SPLITLIBS= $(SETILIB_LIBS) \ + $(DBLIBS) \ + $(BOINCLIBS) \ + $(SYSLIBS) \ + -lchealpix \ + -lfftw3f + +noinst_PROGRAMS = mb_splitter + + +mb_splitter_SOURCES=mb_angdist.cpp \ + mb_message.cpp \ + mb_splitter.cpp \ + mb_wufiles.cpp \ + mb_dotransform.cpp \ + mb_validrun.cpp \ + cmap_interp.cpp \ + ../db/schema_master.cpp \ + ../db/sqlifx.cpp \ + ../db/sqlrow.cpp \ + ../db/sqlblob.cpp ../db/sqlint8.cpp \ + ../db/xml_util.cpp \ + ../db/app_config.cpp \ + ../client/seti_header.cpp \ + ../client/timecvt.cpp \ + ../client/lcgamm.cpp \ + ../client/hr_min_sec.o + +mb_splitter_CXXFLAGS= \ + -I$(SETIHOME) -I$(SETIHOME)/client -I$(SETIHOME)/db \ + @MYSQL_CFLAGS@ -I$(HEALPIX)/include \ + @INFORMIX_CFLAGS@ @SETILIB_CFLAGS@ \ + @BOINC_CFLAGS@ -I$(BOINCDIR)/tools -I$(BOINCDIR)/sched -I$(BOINCDIR)/db +mb_splitter_CFLAGS=$(mb_splitter_CXXFLAGS) +mb_splitter_LDFLAGS=-static $(AM_LDFLAGS) -L$(HEALPIX)/lib $(LINKOPTIONS) +mb_splitter_LDADD=$(SPLITLIBS) + +../db/sqlifx.cpp: ../db/sqlifx.ec + $(INFORMIXDIR)/bin/esql -e $< + mv sqlifx.c $*.cpp + diff --git a/splitter_fft/angdist.cpp b/splitter_fft/angdist.cpp new file mode 100644 index 0000000..a4d9cf2 --- /dev/null +++ b/splitter_fft/angdist.cpp @@ -0,0 +1,79 @@ +/* + * angdist.c + * + * Computes angular distance between two lat/lon points + * + * $Id: angdist.cpp,v 1.3.4.1 2006/12/14 22:24:37 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include "seti_header.h" + +#define DTOR (M_PI/180) + +double angdist(double r1, double d1, double r2, double d2) { + double alpha,dist,d; + + r1*=DTOR; + r2*=DTOR; + d1*=DTOR; + d2*=DTOR; + alpha=r1-r2; + dist=sin(d2)*sin(d1)+cos(d1)*cos(d2)*cos(alpha); + if ((dist*dist)<1) { + d=sqrt(1.0-dist*dist); + } else { + dist=1.0; + d=0.0; + } + dist=atan2(d,dist); + dist=dist/DTOR; + return (dist); +} + +double angdist(const SCOPE_STRING &a, const SCOPE_STRING &b) { + return angdist(a.ra*15,a.dec,b.ra*15,b.dec); +} + +/* + * $Log: angdist.cpp,v $ + * Revision 1.3.4.1 2006/12/14 22:24:37 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:39 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:31 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:15 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:16:08 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:47:33 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/angdist.h b/splitter_fft/angdist.h new file mode 100644 index 0000000..c3fc069 --- /dev/null +++ b/splitter_fft/angdist.h @@ -0,0 +1,33 @@ +/* + * angdist.h + * + * Computes angular distance between two lat/lon points + * + * $Id: angdist.h,v 1.1 2003/06/03 00:16:09 korpela Exp $ + * + */ + +double angdist(double r1, double d1, double r2, double d2) ; +double angdist(const SCOPE_STRING &a,const SCOPE_STRING &b); + +/* + * $Log: angdist.h,v $ + * Revision 1.1 2003/06/03 00:16:09 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:03:21 korpela + * Initial revision + * + * + */ + diff --git a/splitter_fft/cmap_interp.cpp b/splitter_fft/cmap_interp.cpp new file mode 100644 index 0000000..d431f92 --- /dev/null +++ b/splitter_fft/cmap_interp.cpp @@ -0,0 +1,40 @@ +#include +#include +#include "setilib.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +coordinate_t cmap_interp(std::map &map, seti_time &t) { + std::map::iterator above(map.upper_bound(t)); + std::map::iterator below; + below=above; + if (above==map.begin()) { + above++; + } else { + below--; + } + if (above==map.end()) { + above--; + below--; + } + coordinate_t upper(above->second); + coordinate_t lower(below->second); + coordinate_t rv; + + if ((upper.ra-lower.ra)>23) lower.ra+=24; + if ((lower.ra-upper.ra)>23) upper.ra+=24; + rv.time=t.jd().uval(); + double f=(seti_time(t.jd()-JD1970,JD1970)-seti_time(days(lower.time)))/ + days(upper.time-lower.time); + rv.ra=(upper.ra-lower.ra)*f+lower.ra; + rv.ra=fmod(rv.ra,24.0); + rv.dec=(upper.dec-lower.dec)*f+lower.dec; + return rv; +} + + + + diff --git a/splitter_fft/cmap_interp.h b/splitter_fft/cmap_interp.h new file mode 100644 index 0000000..37ee520 --- /dev/null +++ b/splitter_fft/cmap_interp.h @@ -0,0 +1,6 @@ + +extern coordinate_t cmap_interp(std::map &map, seti_time &t); + + + + diff --git a/splitter_fft/coordcvt.cpp b/splitter_fft/coordcvt.cpp new file mode 100644 index 0000000..959f231 --- /dev/null +++ b/splitter_fft/coordcvt.cpp @@ -0,0 +1,179 @@ +/* + * coordcvt.c + * + * Celestial coordinate conversion routines. + * + * $Id: coordcvt.cpp,v 1.2.4.1 2006/12/14 22:24:37 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include + +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "coordcvt.h" + +extern int gregorian; + +namespace SPLITTER { + +double jd_to_lmst(double jd, double longitude) { +/* + * converts from julian date/time to local mean siderial time + * + */ + + double tu; /* time, in centuries from Jan 0, 2000 */ + double tusqr; + double tucb; + double g; /* derrived from tu, used to calculate gmst */ + double gmst; /* Greenwich Mean Sidereal Time */ + double lmst; /* Local Mean Sidereal Time */ + double jd0=floor(jd+0.5)-0.5; /* jd at noon GMT */ + double ddtime=fmod((jd-jd0)*24,24); /* GMT hours */ + + tu = (jd0 - 2451545.0)/36525; + tusqr = tu * tu; + tucb = tusqr * tu; + +/* computation of the gmst at ddtime UT */ + + g = 24110.54841 + 8640184.812866 * tu + 0.093104 * tusqr - 6.62E-6 * tucb; + + for (gmst = g; gmst < 0; gmst += 86400) ; + + gmst /= 3600; /* GMST at 0h UT */ + gmst += (1.0027379093 * ddtime); /* GMST at utime UT */ + + gmst=fmod(gmst,24); + +/* computation of lmst given gmst and longitude */ + + lmst = gmst + ((longitude/360) * 24); + + if (lmst < 0) + lmst += 24; + lmst = fmod(lmst,24); + return(lmst); +} + + +void horz_to_equatorial(double alt, double azimuth, double lsthour, + double lat, double *ra, double *dec) { + double dec_rad, hour_ang_rad, zenith_ang=90.0-alt; + double temp; + + zenith_ang*=(M_PI/180.0); + azimuth*=(M_PI/180.0); + + dec_rad = asin ((cos(zenith_ang) * sin(lat*M_PI/180)) + + (sin(zenith_ang) * cos(lat*M_PI/180) * cos(azimuth))); + + *dec = dec_rad * 180.0/M_PI; /* radians to decimal degrees */ + + temp = (cos(zenith_ang) - sin(lat*M_PI/180) * sin(dec_rad)) / + (cos(lat*M_PI/180) * cos(dec_rad)); + if (temp > 1) + temp = 1; + else if (temp < -1) + temp = -1; + hour_ang_rad = acos (temp); + + if (sin(azimuth) > 0.0) /* insure correct quadrant */ + hour_ang_rad = (2 * M_PI) - hour_ang_rad; + + + /* to get ra, we convert hour angle to decimal degrees, */ + /* convert degrees to decimal hours, and subtract the */ + /* result from local sidereal decimal hours. */ + *ra = lsthour - ((hour_ang_rad * 180.0/M_PI) / 15.0); + + // Take care of wrap situations in RA + if (*ra < 0.0) + *ra += 24.0; + *ra=fmod(*ra,24); +} +#define D2R 0.017453292 + +void AltAzCorrection(double *alt, double *az) { + double zen=90-*alt; + co_ZenAzCorrection((telescope_id)(gregorian?AOGREG_1420:AO_1420),&zen,az); + *alt=90-zen; +} + +} + +void telstr_coord_convert(SCOPE_STRING *telstr, double lat, double lon) { + + double lmst=SPLITTER::jd_to_lmst(telstr->st.jd,lon); + + SPLITTER::AltAzCorrection(&(telstr->alt),&(telstr->az)); + SPLITTER::horz_to_equatorial(telstr->alt, telstr->az, lmst, lat, &(telstr->ra), + &(telstr->dec)); +} + +/* + * $Log: coordcvt.cpp,v $ + * Revision 1.2.4.1 2006/12/14 22:24:37 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:33 korpela + * + * renames .C files to .cpp + * + * Revision 1.3 2003/06/05 19:01:45 korpela + * + * Fixed coordiate bug that allowed RA>24 hours. + * + * Revision 1.2 2003/06/05 15:52:46 korpela + * + * Fixed coordinate bug that was using the wrong zenith angle from the telescope + * strings when handling units from the gregorian. + * + * Revision 1.1 2003/06/03 00:16:09 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.1 2003/05/20 16:01:54 eheien + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1999/03/05 01:47:18 korpela + * New zenith angle correction. + * + * Revision 2.2 1999/02/22 22:21:09 korpela + * Fixed half-day error. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/27 00:48:48 korpela + * Bug fixes. + * + * Revision 1.1 1998/10/19 23:02:43 korpela + * Initial revision + * + * + */ + diff --git a/splitter_fft/coordcvt.h b/splitter_fft/coordcvt.h new file mode 100644 index 0000000..5595f06 --- /dev/null +++ b/splitter_fft/coordcvt.h @@ -0,0 +1,40 @@ +/* + * coordcvt.h + * + * Celestial coordinate conversion routines. + * + * $Id: coordcvt.h,v 1.1 2003/06/03 00:16:09 korpela Exp $ + * + */ + +#ifndef COORDCVT_H +#define COORDCVT_H + +double jd_to_lmst(double jd, double longitude); + +void horz_to_equatorial(double alt, double azimuth, double lsthour, + double lat, double *ra, double *dec); + +void telstr_coord_convert(SCOPE_STRING *telstr, double lat, double lon); + +#endif + +/* + * $Log: coordcvt.h,v $ + * Revision 1.1 2003/06/03 00:16:09 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/19 23:03:18 korpela + * Initial revision + * + */ diff --git a/splitter_fft/db_fns.cpp b/splitter_fft/db_fns.cpp new file mode 100644 index 0000000..9234ed3 --- /dev/null +++ b/splitter_fft/db_fns.cpp @@ -0,0 +1,199 @@ +/* + * $Id: db_fns.cpp,v 1.3.4.2 2006/12/14 22:24:37 korpela Exp $ + * + */ + + +#include "sah_config.h" +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "message.h" +#include "readtape.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "db_table.h" +#include "schema_master.h" + + +static tape tape_struct; + +int update_tape_entry( tapeheader_t *tapeheader) ; + +int get_last_block(tapeheader_t *tapeheader) { + int err; + strncat(tape_struct.tapename,tapeheader->name,20); + if (!db_tape_lookup_name(&tape_struct)) { + return(tape_struct.last_block_done/TAPE_FRAMES_PER_RECORD); + } else { + if ((err=db_tape_new(&tape_struct))) { + log_messages.printf( SCHED_MSG_LOG::MSG_CRITICAL,"Unable to create db entry for tape %s error %d.\n",tapeheader->name,err); + exit(1); + } + return 0; + } +} + + +/* returns id number of tape db entry or zero if failure */ +/*int update_tape_entry( tapeheader_t *tapeheader) { + if (strncmp(tapeheader->name,tape_struct.tapename,20)) { + strncat(tape_struct.tapename,tapeheader->name,20); + if (db_tape_lookup_name(&tape_struct)) { + tape_struct.id=0; + strncpy(tape_struct.tapename,tapeheader->name,20); + tape_struct.start_time=tapeheader->st.jd; + tape_struct.last_block_time=tapeheader->st.jd; + tape_struct.last_block_done=tapeheader->frameseq; + if (db_tape_new(&tape_struct)) { + char tmpstr[256]; + fprintf( stderr, "Point 2\n" ); + sprintf(tmpstr,"Unable to create db entry for tape %s.",tapeheader->name); + message(tmpstr); + return(0); + } + } + } + tape_struct.last_block_time=tapeheader->st.jd; + tape_struct.last_block_done=tapeheader->frameseq; + if (db_tape_update(&tape_struct)) { + char tmpstr[256]; + sprintf(tmpstr,"Unable to update db entry for tape %s.",tapeheader->name); + message(tmpstr); + return(0); + } + return(tape_struct.id); +} +*/ + +/* returns workunit group id number on success, 0 on failure */ +/* +int create_wugrp_entry(workunit_grp &wugrp, int tapenum, tapeheader_t *tapeheader) { + int i,n; + + wugrp.tapenum=tapenum; + strncpy(wugrp.wugrpname,wugrpname,64); + wugrp.splitter_version=wuheader->wuinfo.splitter_version; + wugrp.start_ra=wuheader->wuinfo.start_ra; + wugrp.start_dec=wuheader->wuinfo.start_dec; + wugrp.end_ra=wuheader->wuinfo.end_ra; + wugrp.end_dec=wuheader->wuinfo.end_dec; + wugrp.angle_range=wuheader->wuinfo.angle_range; + wugrp.true_angle_range=wuheader->wuinfo.true_angle_range; + wugrp.beam_width=wuheader->wuinfo.beam_width; + wugrp.time_recorded=wuheader->wuinfo.time_recorded; + wugrp.fft_len=wuheader->wuinfo.fft_len; + wugrp.ifft_len=wuheader->wuinfo.ifft_len; + wugrp.receiver=wuheader->wuinfo.source; + wugrp.nsamples=wuheader->wuinfo.nsamples; + wugrp.sample_rate=tapeheader->samplerate; + wugrp.data_class=wuheader->wuinfo.data_class; + strncpy(wugrp.tape_version,wuheader->wuinfo.tape_version,13); + wugrp.num_positions=wuheader->wuinfo.num_positions; + if (db_workunit_grp_new(&wugrp)) { + char tmpstr[256]; + sprintf(tmpstr,"Unable to create db entry for workunit_grp %s\n",wugrpname); + message(tmpstr); + return(0); + } + for (i=0;iwuinfo.position_history[i].st.jd, + wuheader->wuinfo.position_history[i].ra, + wuheader->wuinfo.position_history[i].dec + ); + if (n=db_workunit_grp_update_position(wugrp.id,i,tmpstr)) { + fprintf( stderr, "%d\n", n ); + sprintf(tmpstr,"Unable to add position %d to workunit_grp %s\n",i,wugrpname); + message(tmpstr); + } + } + return (wugrp.id); +} + +int create_workunit_entry(wuheader_t *wuheader, int wugrpid, int subband_number) { + WORKUNIT wu; + + memset(&wu,0,sizeof(wu)); + strncpy(wu.name,wuheader->wuhead.name,63); + wu.grpnum=wugrpid; + wu.subb_center=wuheader->wuinfo.subband_center; + wu.subb_base=wuheader->wuinfo.subband_base; + wu.subb_sample_rate=wuheader->wuinfo.subband_sample_rate; + wu.subband_number=subband_number; + wu.data_class=wuheader->wuinfo.data_class; + if (db_workunit_new(&wu)) { + char tmpstr[256]; + sprintf(tmpstr,"Unable to create workunit entry %s\n",wu.name); + message(tmpstr); + return(0); + } + return(wu.id); +} +*/ + +/* + * $Log: db_fns.cpp,v $ + * Revision 1.3.4.2 2006/12/14 22:24:37 korpela + * *** empty log message *** + * + * Revision 1.3.4.1 2006/01/13 00:37:56 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.3 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:40 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:35 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:16 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:16:10 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 1.4 2000/12/01 01:13:29 korpela + * *** empty log message *** + * +// Revision 1.3 1999/03/05 01:47:18 korpela +// Added data_class field. +// +// Revision 1.2 1999/02/22 22:21:09 korpela +// Fixed half-day error. +// +// Revision 1.1 1999/02/11 16:46:28 korpela +// Initial revision +// + * + */ diff --git a/splitter_fft/db_fns.h b/splitter_fft/db_fns.h new file mode 100644 index 0000000..3ccf871 --- /dev/null +++ b/splitter_fft/db_fns.h @@ -0,0 +1,48 @@ +/* + * $Id: db_fns.h,v 1.3 2003/08/05 17:23:40 korpela Exp $ + * + */ + + +#ifndef DB_FNS_H +#define DB_FNS_H + +#include "schema_master.h" + +int get_last_block(tapeheader_t *tapeheader) ; + +//int update_tape_entry( tapeheader_t *tapeheader) ; + +/* returns workunit group id number on success, 0 on failure */ +//int create_wugrp_entry(char *wugrpname,wuheader_t *wuheader, int tapenum, tapeheader_t *tapeheader) ; + +//int create_workunit_entry(wuheader_t *wuheader, int wugrpid, int subband_number) ; + +#endif + +/* + * + * $Log: db_fns.h,v $ + * Revision 1.3 2003/08/05 17:23:40 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.2 2003/06/03 01:01:16 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:16:10 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 1.2 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 1.1 1999/02/11 16:46:28 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/dotransform.cpp b/splitter_fft/dotransform.cpp new file mode 100644 index 0000000..1663a50 --- /dev/null +++ b/splitter_fft/dotransform.cpp @@ -0,0 +1,218 @@ +/* + * + * dotransform.c + * + * Functions for division by frequency into work units. + * + * $Id: dotransform.cpp,v 1.2.4.1 2006/12/14 22:24:38 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "fftw.h" +#include "wufiles.h" + +/* buffer for fft input/output */ +float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) +unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + + +int obuf_pos; /* Tracks current postition in the output buffers */ + + +void output_samples(float *data, int i, int buf_pos) { + int j,k; + unsigned short s; + float *p=data; + + for (j=0;j<2;j++) { + s=0; + for (k=0; k<8; k++) { + s >>= 2; + if (*p>0) s |= 0x8000; + if (*(p+1)>0) s |= 0x4000; + p+=2; + } + output_buf[i][buf_pos++]=*(char *)(&s); + output_buf[i][buf_pos++]=*(((char *)(&s))+1); + } +} + +void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) { + unsigned int i, j; + unsigned short s; + static int first_time=1; + static float lut[65536][16]; + + assert(!(nsamples % 8)); + + if (first_time) { + for (i=0;i<65536;i++) { + s=(unsigned short)i; + for (j=0;j<8;j++) { + lut[i][j*2]=(float)2*(s & 1)-1; + s >>= 1; + lut[i][j*2+1]=(float)2*(s & 1)-1; + s >>= 1; + } + } + first_time--; + } + + for (i=0;i<(nsamples/8);i++) { + memcpy(data+16*i,lut[raw[i]],16*sizeof(float)); + } +} + +void process_seg(float* data) { + int i; + float* p = data; + static float dbuff[FFT_LEN*2]; + static fftw_plan planfwd,planinverse; + + if (!planfwd) { + planfwd=fftw_create_plan(FFT_LEN, FFTW_BACKWARD, + FFTW_MEASURE | FFTW_IN_PLACE | FFTW_USE_WISDOM ); + planinverse=fftw_create_plan(IFFT_LEN, FFTW_FORWARD, + FFTW_MEASURE | FFTW_IN_PLACE | FFTW_USE_WISDOM ); + } + + fftw_one(planfwd, (fftw_complex *)data, (fftw_complex *)NULL); + data[0]=0; + data[1]=0; + fftw(planinverse, NSTRIPS, (fftw_complex *)data, 1, IFFT_LEN, + (fftw_complex *)NULL, 1, IFFT_LEN); + for (i=0; i TAPE_DATA_SIZE) { + /* End of frame crossed need to trasfer correctly */ + end_trans.frame++; + end_trans.byte-=TAPE_DATA_SIZE; + nsamp=(TAPE_DATA_SIZE-start_trans.byte)*(CHAR_BIT/2); + assert((nsamp+end_trans.byte*(CHAR_BIT/2)) == FFT_LEN); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf, nsamp); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(end_trans.frame,0),databuf+nsamp*2, + end_trans.byte*(CHAR_BIT/2)); + } else { + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf,FFT_LEN); + } + process_seg(databuf); + /* Go on to next transform */ + start_trans=end_trans; + } + /* Check if we're at the end of the wu file. If so we print less bytes */ + if ((end_trans.frame>=end_of_wu->frame) && + (end_trans.byte>=end_of_wu->byte)) { + write_wufile_blocks(NBYTES % SAMPLES_PER_OBUF); + } else { + write_wufile_blocks(SAMPLES_PER_OBUF); + } + } while (!((end_trans.frame>=end_of_wu->frame) && (end_trans.byte>=end_of_wu->byte))); + + /* Move the data in the buffer so we don't have to reread portions of the + * tape. + */ + { + unsigned char *record_offset; + int copysize; + end_of_wu->frame-=WU_OVERLAP_FRAMES; + records_in_buffer=TAPE_RECORDS_IN_BUFFER- + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD); + record_offset=tapebuffer+ + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD)*TAPE_RECORD_SIZE; + copysize=records_in_buffer*TAPE_RECORD_SIZE; + bcopy(record_offset,tapebuffer,copysize); + } +} + +/* + * + * $Log: dotransform.cpp,v $ + * Revision 1.2.4.1 2006/12/14 22:24:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:36 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:10 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2003/04/10 22:09:00 korpela + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.6 1999/02/22 19:02:50 korpela + * Revered input real & imaginary. + * + * Revision 2.5 1999/02/10 21:49:44 korpela + * Zeroed DC component of forward transform. + * + * Revision 2.4 1999/02/01 22:28:52 korpela + * FFTW version. + * + * Revision 2.3 1998/12/14 23:41:44 korpela + * *** empty log message *** + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:51:08 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/dotransform.h b/splitter_fft/dotransform.h new file mode 100644 index 0000000..5b3136d --- /dev/null +++ b/splitter_fft/dotransform.h @@ -0,0 +1,56 @@ +/* + * + * dotransform.h + * + * Functions for division by frequency into work units. + * + * $Id: dotransform.h,v 1.1 2003/06/03 00:16:11 korpela Exp $ + * + */ + +/* buffer for fft input/output */ +extern float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) +#define TBUF_OFFSET(frame,byte) (tapebuffer+(frame)*TAPE_FRAME_SIZE+(byte)) +extern unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + + +extern int obuf_pos; /* Tracks current postition in the output buffers */ + + +void output_samples(float *data, int i, int buf_pos); +void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) ; +void process_seg(float* data) ; +void do_transform(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu) ; + +/* + * + * $Log: dotransform.h,v $ + * Revision 1.1 2003/06/03 00:16:11 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1999/02/01 22:28:52 korpela + * FFTW version. + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:05:22 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/encode.cpp b/splitter_fft/encode.cpp new file mode 100644 index 0000000..579697b --- /dev/null +++ b/splitter_fft/encode.cpp @@ -0,0 +1,93 @@ +/* + * + * binary to ascii encoding for work unit files + * + * $Id: encode.cpp,v 1.2.4.2 2007/06/01 03:29:25 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include + +/* Write a range of bytes encoded into printable chars. + * Encodes 3 bytes into 4 chars. + * May read up to two bytes past end + */ + +void splitter_encode(unsigned char *bin, int nbytes, FILE *f) { + int count=0, offset=0, nleft, count1=0; + unsigned char c[4*1024+64]; + unsigned char nl=10; + assert(nbytes<=(3*1024)); + for (nleft = nbytes; nleft > 0; nleft -= 3) { + c[0+count1] = bin[offset]&0x3f; // 6 + c[1+count1] = (bin[offset]>>6) | (bin[offset+1]<<2)&0x3f; // 2+4 + c[2+count1] = ((bin[offset+1]>>4)&0xf) | (bin[offset+2]<<4)&0x3f;// 4+2 + c[3+count1] = bin[offset+2]>>2; // 6 + c[0+count1] += 0x20; + c[1+count1] += 0x20; + c[2+count1] += 0x20; + c[3+count1] += 0x20; + offset += 3; + count += 4; + count1 +=4; + if (count == 64) { + count = 0; + c[count1++]=nl; + } + } + write(fileno(f),c,count1); +} + +/* + * + * $Log: encode.cpp,v $ + * Revision 1.2.4.2 2007/06/01 03:29:25 korpela + * Fixes for linux build of Joe's updated code. + * + * Probably not working yet. + * + * Revision 1.2.4.1 2006/12/14 22:24:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:37 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:11 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * changed function name from encode() to splitter_encode() to avoid + * conflict with encode routine in ../client/util.C. Will investigate + * if merging of two functions is possible. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:52:56 korpela + * Initial revision + * + * + */ + + diff --git a/splitter_fft/encode.h b/splitter_fft/encode.h new file mode 100644 index 0000000..d17775f --- /dev/null +++ b/splitter_fft/encode.h @@ -0,0 +1,39 @@ +/* + * + * binary to ascii encoding for work unit files + * + * $Id: encode.h,v 1.1 2003/06/03 00:16:11 korpela Exp $ + * + */ + +/* Write a range of bytes encoded into printable chars. + * Encodes 3 bytes into 4 chars. + * May read up to two bytes past end + */ + +void splitter_encode(unsigned char *bin, int nbytes, FILE *f); + +/* + * $Log: encode.h,v $ + * Revision 1.1 2003/06/03 00:16:11 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * Changed routine name from encode() to splitter_encode(). See encode.C + * for details. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:06:46 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/fftw.h b/splitter_fft/fftw.h new file mode 100644 index 0000000..41698f7 --- /dev/null +++ b/splitter_fft/fftw.h @@ -0,0 +1,413 @@ +/* fftw/fftw.h. Generated automatically by configure. */ +/* -*- C -*- */ +/* + * Copyright (c) 1997,1998 Massachusetts Institute of Technology + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/* fftw.h -- system-wide definitions */ +/* $Id: fftw.h,v 1.1 2003/06/03 00:16:12 korpela Exp $ */ + +#ifndef FFTW_H +#define FFTW_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Define for using single precision */ +/* + * If you can, use configure --enable-float instead of changing this + * flag directly + */ +#define FFTW_ENABLE_FLOAT 1 + +/* our real numbers */ +#ifdef FFTW_ENABLE_FLOAT +typedef float fftw_real; +#else +typedef double fftw_real; +#endif + +/********************************************* + * Complex numbers and operations + *********************************************/ +typedef struct { + fftw_real re, im; +} fftw_complex; + +#define c_re(c) ((c).re) +#define c_im(c) ((c).im) + +typedef enum { + FFTW_FORWARD = -1, FFTW_BACKWARD = 1 +} fftw_direction; + +/* backward compatibility with FFTW-1.3 */ +typedef fftw_complex FFTW_COMPLEX; +typedef fftw_real FFTW_REAL; + +#ifndef FFTW_1_0_COMPATIBILITY +#define FFTW_1_0_COMPATIBILITY 0 +#endif + +#if FFTW_1_0_COMPATIBILITY +/* backward compatibility with FFTW-1.0 */ +#define REAL fftw_real +#define COMPLEX fftw_complex +#endif + +/********************************************* + * Success or failure status + *********************************************/ + +typedef enum { + FFTW_SUCCESS = 0, FFTW_FAILURE = -1 +} fftw_status; + +/********************************************* + * Codelets + *********************************************/ +typedef void (fftw_notw_codelet) + (const fftw_complex *, fftw_complex *, int, int); +typedef void (fftw_twiddle_codelet) + (fftw_complex *, const fftw_complex *, int, + int, int); +typedef void (fftw_generic_codelet) + (fftw_complex *, const fftw_complex *, int, + int, int, int); +typedef void (fftw_real2hc_codelet) + (const fftw_real *, fftw_real *, fftw_real *, + int, int, int); +typedef void (fftw_hc2real_codelet) + (const fftw_real *, const fftw_real *, + fftw_real *, int, int, int); +typedef void (fftw_hc2hc_codelet) + (fftw_real *, const fftw_complex *, + int, int, int); +typedef void (fftw_rgeneric_codelet) + (fftw_real *, const fftw_complex *, int, + int, int, int); + +/********************************************* + * Configurations + *********************************************/ +/* + * A configuration is a database of all known codelets + */ + +enum fftw_node_type { + FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER, + FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC +}; + +/* description of a codelet */ +typedef struct { + const char *name; /* name of the codelet */ + void (*codelet) (); /* pointer to the codelet itself */ + int size; /* size of the codelet */ + fftw_direction dir; /* direction */ + enum fftw_node_type type; /* TWIDDLE or NO_TWIDDLE */ + int signature; /* unique id */ + int ntwiddle; /* number of twiddle factors */ + const int *twiddle_order; /* + * array that determines the order + * in which the codelet expects + * the twiddle factors + */ +} fftw_codelet_desc; + +/* On Win32, you need to do funny things to access global variables + in shared libraries. Thanks to Andrew Sterian for this hack. */ +#if defined(__WIN32__) || defined(WIN32) || defined(_WINDOWS) +# if defined(BUILD_FFTW_DLL) +# define DL_IMPORT(type) __declspec(dllexport) type +# elif defined(USE_FFTW_DLL) +# define DL_IMPORT(type) __declspec(dllimport) type +# else +# define DL_IMPORT(type) type +# endif +#else +# define DL_IMPORT(type) type +#endif + +extern DL_IMPORT(const char *) fftw_version; + +/***************************** + * Plans + *****************************/ +/* + * A plan is a sequence of reductions to compute a FFT of + * a given size. At each step, the FFT algorithm can: + * + * 1) apply a notw codelet, or + * 2) recurse and apply a twiddle codelet, or + * 3) apply the generic codelet. + */ + +/* structure that contains twiddle factors */ +typedef struct fftw_twiddle_struct { + int n; + const fftw_codelet_desc *cdesc; + fftw_complex *twarray; + struct fftw_twiddle_struct *next; + int refcnt; +} fftw_twiddle; + +typedef struct fftw_rader_data_struct { + struct fftw_plan_struct *plan; + fftw_complex *omega; + int g, ginv; + int p, flags, refcount; + struct fftw_rader_data_struct *next; + fftw_codelet_desc *cdesc; +} fftw_rader_data; + +typedef void (fftw_rader_codelet) + (fftw_complex *, const fftw_complex *, int, + int, int, fftw_rader_data *); + +/* structure that holds all the data needed for a given step */ +typedef struct fftw_plan_node_struct { + enum fftw_node_type type; + + union { + /* nodes of type FFTW_NOTW */ + struct { + int size; + fftw_notw_codelet *codelet; + const fftw_codelet_desc *codelet_desc; + } notw; + + /* nodes of type FFTW_TWIDDLE */ + struct { + int size; + fftw_twiddle_codelet *codelet; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + const fftw_codelet_desc *codelet_desc; + } twiddle; + + /* nodes of type FFTW_GENERIC */ + struct { + int size; + fftw_generic_codelet *codelet; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + } generic; + + /* nodes of type FFTW_RADER */ + struct { + int size; + fftw_rader_codelet *codelet; + fftw_rader_data *rader_data; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + } rader; + + /* nodes of type FFTW_REAL2HC */ + struct { + int size; + fftw_real2hc_codelet *codelet; + const fftw_codelet_desc *codelet_desc; + } real2hc; + + /* nodes of type FFTW_HC2REAL */ + struct { + int size; + fftw_hc2real_codelet *codelet; + const fftw_codelet_desc *codelet_desc; + } hc2real; + + /* nodes of type FFTW_HC2HC */ + struct { + int size; + fftw_direction dir; + fftw_hc2hc_codelet *codelet; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + const fftw_codelet_desc *codelet_desc; + } hc2hc; + + /* nodes of type FFTW_RGENERIC */ + struct { + int size; + fftw_direction dir; + fftw_rgeneric_codelet *codelet; + fftw_twiddle *tw; + struct fftw_plan_node_struct *recurse; + } rgeneric; + } nodeu; + + int refcnt; +} fftw_plan_node; + +struct fftw_plan_struct { + int n; + int refcnt; + fftw_direction dir; + int flags; + int wisdom_signature; + enum fftw_node_type wisdom_type; + struct fftw_plan_struct *next; + fftw_plan_node *root; + double cost; +}; + +/* a plan is just an array of instructions */ +typedef struct fftw_plan_struct *fftw_plan; + +/* flags for the planner */ +#define FFTW_ESTIMATE (0) +#define FFTW_MEASURE (1) + +#define FFTW_OUT_OF_PLACE (0) +#define FFTW_IN_PLACE (8) +#define FFTW_USE_WISDOM (16) + +#define FFTW_THREADSAFE (128) /* guarantee plan is read-only so that the + same plan can be used in parallel by + multiple threads */ + +#define FFTWND_FORCE_BUFFERED (256) /* internal, undocumented flag */ + +extern fftw_plan fftw_create_plan_specific(int n, fftw_direction dir, + int flags, + fftw_complex *in, int istride, + fftw_complex *out, int ostride); +#define FFTW_HAS_PLAN_SPECIFIC +extern fftw_plan fftw_create_plan(int n, fftw_direction dir, int flags); +extern void fftw_print_plan(fftw_plan plan); +extern void fftw_destroy_plan(fftw_plan plan); +extern void fftw(fftw_plan plan, int howmany, fftw_complex *in, int istride, + int idist, fftw_complex *out, int ostride, int odist); +extern void fftw_one(fftw_plan plan, fftw_complex *in, fftw_complex *out); +extern void fftw_die(const char *s); +extern void *fftw_malloc(size_t n); +extern void fftw_free(void *p); +extern void fftw_check_memory_leaks(void); +extern void fftw_print_max_memory_usage(void); + +typedef void *(*fftw_malloc_type_function) (size_t n); +typedef void (*fftw_free_type_function) (void *p); +typedef void (*fftw_die_type_function) (const char *errString); +extern DL_IMPORT(fftw_malloc_type_function) fftw_malloc_hook; +extern DL_IMPORT(fftw_free_type_function) fftw_free_hook; +extern DL_IMPORT(fftw_die_type_function) fftw_die_hook; + +extern size_t fftw_sizeof_fftw_real(void); + +/* Wisdom: */ +/* + * define this symbol so that users know we are using a version of FFTW + * with wisdom + */ +#define FFTW_HAS_WISDOM +extern void fftw_forget_wisdom(void); +extern void fftw_export_wisdom(void (*emitter) (char c, void *), void *data); +extern fftw_status fftw_import_wisdom(int (*g) (void *), void *data); +extern void fftw_export_wisdom_to_file(FILE *output_file); +extern fftw_status fftw_import_wisdom_from_file(FILE *input_file); +extern char *fftw_export_wisdom_to_string(void); +extern fftw_status fftw_import_wisdom_from_string(const char *input_string); + +/* + * define symbol so we know this function is available (it is not in + * older FFTWs) + */ +#define FFTW_HAS_FPRINT_PLAN +extern void fftw_fprint_plan(FILE *f, fftw_plan plan); + +/***************************** + * N-dimensional code + *****************************/ +typedef struct { + int is_in_place; /* 1 if for in-place FFTs, 0 otherwise */ + + int rank; /* + * the rank (number of dimensions) of the + * array to be FFTed + */ + int *n; /* + * the dimensions of the array to the + * FFTed + */ + fftw_direction dir; + + int *n_before; /* + * n_before[i] = product of n[j] for j < i + */ + int *n_after; /* n_after[i] = product of n[j] for j > i */ + + fftw_plan *plans; /* 1d fftw plans for each dimension */ + + int nbuffers, nwork; + fftw_complex *work; /* + * work array big enough to hold + * nbuffers+1 of the largest dimension + * (has nwork elements) + */ +} fftwnd_data; + +typedef fftwnd_data *fftwnd_plan; + +/* Initializing the FFTWND plan: */ +extern fftwnd_plan fftw2d_create_plan(int nx, int ny, fftw_direction dir, + int flags); +extern fftwnd_plan fftw3d_create_plan(int nx, int ny, int nz, + fftw_direction dir, int flags); +extern fftwnd_plan fftwnd_create_plan(int rank, const int *n, + fftw_direction dir, + int flags); + +extern fftwnd_plan fftw2d_create_plan_specific(int nx, int ny, + fftw_direction dir, + int flags, + fftw_complex *in, int istride, + fftw_complex *out, int ostride); +extern fftwnd_plan fftw3d_create_plan_specific(int nx, int ny, int nz, + fftw_direction dir, int flags, + fftw_complex *in, int istride, + fftw_complex *out, int ostride); +extern fftwnd_plan fftwnd_create_plan_specific(int rank, const int *n, + fftw_direction dir, + int flags, + fftw_complex *in, int istride, + fftw_complex *out, int ostride); + +/* Freeing the FFTWND plan: */ +extern void fftwnd_destroy_plan(fftwnd_plan plan); + +/* Printing the plan: */ +extern void fftwnd_fprint_plan(FILE *f, fftwnd_plan p); +extern void fftwnd_print_plan(fftwnd_plan p); +#define FFTWND_HAS_PRINT_PLAN + +/* Computing the N-Dimensional FFT */ +extern void fftwnd(fftwnd_plan plan, int howmany, + fftw_complex *in, int istride, int idist, + fftw_complex *out, int ostride, int odist); +extern void fftwnd_one(fftwnd_plan p, fftw_complex *in, fftw_complex *out); + +#ifdef __cplusplus +} /* extern "C" */ + +#endif /* __cplusplus */ +#endif /* FFTW_H */ diff --git a/splitter_fft/four1.cpp b/splitter_fft/four1.cpp new file mode 100644 index 0000000..f775a98 --- /dev/null +++ b/splitter_fft/four1.cpp @@ -0,0 +1,88 @@ +/* + * + * Fourier transform routine from numerical recipes. + * + * $Id: four1.cpp,v 1.2.4.1 2006/12/14 22:24:38 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr + +void four1(float data[], unsigned long nn, int isign) { + unsigned long n,mmax,m,j,istep,i; + double wtemp,wr,wpr,wpi,wi,theta; + float tempr,tempi; + + n=nn << 1; + j=1; + for (i=1;i i) { + SWAP(data[j],data[i]); + SWAP(data[j+1],data[i+1]); + } + m=n >> 1; + while (m >= 2 && j > m) { + j -= m; + m >>= 1; + } + j += m; + } + mmax=2; + while (n > mmax) { + istep=mmax << 1; + theta=isign*(6.28318530717959/mmax); + wtemp=sin(0.5*theta); + wpr = -2.0*wtemp*wtemp; + wpi=sin(theta); + wr=1.0; + wi=0.0; + for (m=1;m +#include + +char* hr_min_sec (double x) { + static char buf[256]; + int hr = (int)(x / 3600); + int min = (int)((x/3600-(double)hr)*60); + float s = (float)(x - ((double)hr)*3600 - ((double)min)*60); + + // the "-.05" below is to prevent it from printing 60.0 sec + // when the real value is e.g. 59.91 + // + sprintf(buf, "%d hr %02d min %04.1f sec", hr, min, s-.05); + return buf; +} + + +/* + * $Log: hr_min_sec.cpp,v $ + * Revision 1.2.4.1 2006/12/14 22:24:39 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:40 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 01:01:16 korpela + * + * First working splitter under CVS. + * + * Revision 4.4 2003/03/10 02:50:03 jeffc + * jeffc - t_strncpy() + * + * Revision 4.3 2003/01/22 20:51:58 korpela + * Changed all strcpy to strncpy. + * Changed all gets to fgets. + * + * Revision 4.2 2001/12/27 21:35:57 davea + * *** empty log message *** + * + * Revision 4.1 2001/09/10 00:25:17 davea + * *** empty log message *** + * + * Revision 4.0 2000/10/05 18:12:12 korpela + * Synchronized versions to 4.0 following release of 3.0 client + * + * Revision 3.8 2000/09/14 01:01:31 korpela + * *** empty log message *** + * + * Revision 3.7 2000/04/24 08:39:06 charlief + * eliminate compiler warning in hr_min_sec() function. + * + * Revision 3.6 2000/01/19 08:32:32 davea + * *** empty log message *** + * + * Revision 3.5 1999/10/19 08:07:24 davea + * *** empty log message *** + * + * Revision 3.4 1999/06/26 06:56:44 hiramc + * Hiram 99/06/25 23:59 moved the include out of the + * ifdef _WIN32 to define strcpy() for all compiles + * + * Revision 3.3 1999/06/22 09:40:36 charlief + * Reverse last change:restore jd_string() as it was before. + * Add new function short_jd_string(), which does not print + * Julian Date as a floating point value. + * + * Revision 3.1 1999/06/10 00:44:11 korpela + * *** empty log message *** + * + * Revision 3.0 1999/05/14 19:17:35 korpela + * 1.0(Win/Mac) 1.1(Unix) Release Version + * + * Revision 2.11 1999/03/14 00:23:02 davea + * *** empty log message *** + * + * Revision 2.10 1999/03/11 21:46:58 korpela + * Fixed rounding error in st_to_ut(). + * + * Revision 2.9 1999/03/05 09:15:07 kyleg + * *** empty log message *** + * + * Revision 2.8 1999/02/18 19:36:49 korpela + * *** empty log message *** + * + * Revision 2.7 1999/02/13 23:54:44 kyleg + * *** empty log message *** + * + * Revision 2.6 1999/02/11 08:36:54 davea + * *** empty log message *** + * + * Revision 2.5 1998/11/17 21:47:02 korpela + * *** empty log message *** + * + * Revision 2.4 1998/11/05 21:25:21 davea + * replace floor() with (int) + * + * Revision 2.3 1998/11/05 02:00:06 kyleg + * *** empty log message *** + * + * Revision 2.2 1998/11/02 17:59:06 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 17:23:29 korpela + * .` + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/27 00:58:56 korpela + * Bug fixes. + * + * Revision 1.1 1998/10/19 18:57:56 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/hr_min_sec.h b/splitter_fft/hr_min_sec.h new file mode 100644 index 0000000..062a2c3 --- /dev/null +++ b/splitter_fft/hr_min_sec.h @@ -0,0 +1,106 @@ +/* + * + * timecvt.c + * + * Time conversion routines. + * + * $Id: hr_min_sec.h,v 1.1 2003/06/03 01:01:16 korpela Exp $ + * + */ + +char* hr_min_sec (double x) ; + + +/* + * $Log: hr_min_sec.h,v $ + * Revision 1.1 2003/06/03 01:01:16 korpela + * + * First working splitter under CVS. + * + * Revision 4.4 2003/03/10 02:50:03 jeffc + * jeffc - t_strncpy() + * + * Revision 4.3 2003/01/22 20:51:58 korpela + * Changed all strcpy to strncpy. + * Changed all gets to fgets. + * + * Revision 4.2 2001/12/27 21:35:57 davea + * *** empty log message *** + * + * Revision 4.1 2001/09/10 00:25:17 davea + * *** empty log message *** + * + * Revision 4.0 2000/10/05 18:12:12 korpela + * Synchronized versions to 4.0 following release of 3.0 client + * + * Revision 3.8 2000/09/14 01:01:31 korpela + * *** empty log message *** + * + * Revision 3.7 2000/04/24 08:39:06 charlief + * eliminate compiler warning in hr_min_sec() function. + * + * Revision 3.6 2000/01/19 08:32:32 davea + * *** empty log message *** + * + * Revision 3.5 1999/10/19 08:07:24 davea + * *** empty log message *** + * + * Revision 3.4 1999/06/26 06:56:44 hiramc + * Hiram 99/06/25 23:59 moved the include out of the + * ifdef _WIN32 to define strcpy() for all compiles + * + * Revision 3.3 1999/06/22 09:40:36 charlief + * Reverse last change:restore jd_string() as it was before. + * Add new function short_jd_string(), which does not print + * Julian Date as a floating point value. + * + * Revision 3.1 1999/06/10 00:44:11 korpela + * *** empty log message *** + * + * Revision 3.0 1999/05/14 19:17:35 korpela + * 1.0(Win/Mac) 1.1(Unix) Release Version + * + * Revision 2.11 1999/03/14 00:23:02 davea + * *** empty log message *** + * + * Revision 2.10 1999/03/11 21:46:58 korpela + * Fixed rounding error in st_to_ut(). + * + * Revision 2.9 1999/03/05 09:15:07 kyleg + * *** empty log message *** + * + * Revision 2.8 1999/02/18 19:36:49 korpela + * *** empty log message *** + * + * Revision 2.7 1999/02/13 23:54:44 kyleg + * *** empty log message *** + * + * Revision 2.6 1999/02/11 08:36:54 davea + * *** empty log message *** + * + * Revision 2.5 1998/11/17 21:47:02 korpela + * *** empty log message *** + * + * Revision 2.4 1998/11/05 21:25:21 davea + * replace floor() with (int) + * + * Revision 2.3 1998/11/05 02:00:06 kyleg + * *** empty log message *** + * + * Revision 2.2 1998/11/02 17:59:06 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 17:23:29 korpela + * .` + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/27 00:58:56 korpela + * Bug fixes. + * + * Revision 1.1 1998/10/19 18:57:56 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/libfftw.a b/splitter_fft/libfftw.a new file mode 100644 index 0000000..3a34c2f Binary files /dev/null and b/splitter_fft/libfftw.a differ diff --git a/splitter_fft/makebufs.cpp b/splitter_fft/makebufs.cpp new file mode 100644 index 0000000..c7b5140 --- /dev/null +++ b/splitter_fft/makebufs.cpp @@ -0,0 +1,139 @@ +/* + * makebuf.c + * + * Creates temporary files and buffers for use in processing.... + * + * $Id: makebufs.cpp,v 1.3.2.2 2006/12/14 22:24:39 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "message.h" + +int tapebuffd; +char tapebufname[30]; + +void delbuffer(void) { + munmap((char *)tapebuffer,TAPE_BUFFER_SIZE); + close(tapebuffd); + unlink(tapebufname); +} + +void delbuffer_sig(int i) { + munmap((char *)tapebuffer,TAPE_BUFFER_SIZE); + close(tapebuffd); + unlink(tapebufname); + exit(1); +} + + + +void makebuffers(unsigned char **tapebuffer) { + char buf[1024]; +/* + * Allocate temp files for tape and wu buffers. Memory mapping these + * files will prevent us from running out of virtual memory + */ +/* sprintf(tapebufname,"tape%d",getpid()); + + if ((tapebuffd=open(tapebufname,O_RDWR|O_CREAT,0777))==-1) { + fprintf(stderr,"Unable to open temp file!\n"); + fprintf(errorlog,"Unable to open temp file!\n"); + exit(EXIT_FAILURE); + } + + if (ftruncate(tapebuffd,TAPE_BUFFER_SIZE) == -1) { + fprintf(stderr,"ftruncate failure\n"); + fprintf(stderr," errno=%d\n",errno); + fprintf(errorlog,"ftruncate failure\n"); + fprintf(errorlog," errno=%d\n",errno); + exit(EXIT_FAILURE); + } + + if (((*tapebuffer= + mmap(0,TAPE_BUFFER_SIZE,PROT_READ|PROT_WRITE,MAP_SHARED,tapebuffd,0))==(char *)-1)) + { + fprintf(stderr,"mmap failure\n"); + fprintf(errorlog,"mmap failure\n"); + exit(EXIT_FAILURE); + } + + atexit(delbuffer); + signal(SIGINT,delbuffer_sig); +*/ + if (!(*tapebuffer=(unsigned char *)malloc(TAPE_BUFFER_SIZE))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"unable to allocate memory for tape buffer\n"); + exit(0); + } +} + +/* + * $Log: makebufs.cpp,v $ + * Revision 1.3.2.2 2006/12/14 22:24:39 korpela + * *** empty log message *** + * + * Revision 1.3.2.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.3 2004/06/16 20:57:18 jeffc + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:42 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:13 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1998/12/14 23:41:44 korpela + * *** empty log message *** + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * Added signal handler for removal of temporary files on SIGINT. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.4 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.3 1998/10/27 00:55:43 korpela + * Bug Fixes + * + * Revision 1.2 1998/10/20 20:40:54 korpela + * Removed wu buffer. + * + * Revision 1.1 1998/10/19 19:01:56 korpela + * Initial revision + * + */ diff --git a/splitter_fft/makebufs.h b/splitter_fft/makebufs.h new file mode 100644 index 0000000..3e1aa59 --- /dev/null +++ b/splitter_fft/makebufs.h @@ -0,0 +1,38 @@ +/* + * makebufs.h + * + * Creates temporary files and buffers for use in processing.... + * + * $Id: makebufs.h,v 1.1 2003/06/03 00:16:14 korpela Exp $ + * + */ + +#ifndef MAKEBUFS_H +#define MAKEBUFS_H + +void makebuffers(unsigned char **tapebuffer); + +#endif + +/* + * $Log: makebufs.h,v $ + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/20 20:41:45 korpela + * Remove wu buffer. + * + * Revision 1.1 1998/10/19 19:02:36 korpela + * Initial revision + * + */ diff --git a/splitter_fft/mb_angdist.cpp b/splitter_fft/mb_angdist.cpp new file mode 100644 index 0000000..02f5bd9 --- /dev/null +++ b/splitter_fft/mb_angdist.cpp @@ -0,0 +1,88 @@ +/* + * angdist.c + * + * Computes angular distance between two lat/lon points + * + * $Id: mb_angdist.cpp,v 1.1.2.1 2006/12/14 22:24:39 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include "seti_header.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "xml_util.h" +#include "db/app_config.h" + + +#define DTOR (M_PI/180) + +double angdist(double r1, double d1, double r2, double d2) { + double alpha,dist,d; + + r1*=DTOR; + r2*=DTOR; + d1*=DTOR; + d2*=DTOR; + alpha=r1-r2; + dist=sin(d2)*sin(d1)+cos(d1)*cos(d2)*cos(alpha); + if ((dist*dist)<1) { + d=sqrt(1.0-dist*dist); + } else { + dist=1.0; + d=0.0; + } + dist=atan2(d,dist); + dist=dist/DTOR; + return (dist); +} + +double angdist(const coordinate_t &a, const coordinate_t &b) { + return angdist(a.ra*15,a.dec,b.ra*15,b.dec); +} + + +/* + * $Log: mb_angdist.cpp,v $ + * Revision 1.1.2.1 2006/12/14 22:24:39 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:39 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:31 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:15 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:16:08 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:47:33 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/mb_angdist.h b/splitter_fft/mb_angdist.h new file mode 100644 index 0000000..c96b664 --- /dev/null +++ b/splitter_fft/mb_angdist.h @@ -0,0 +1,36 @@ +/* + * angdist.h + * + * Computes angular distance between two lat/lon points + * + * $Id: mb_angdist.h,v 1.1.2.1 2006/12/14 22:24:40 korpela Exp $ + * + */ + +double angdist(double r1, double d1, double r2, double d2) ; +double angdist(const coordinate_t &a,const coordinate_t &b); + +/* + * $Log: mb_angdist.h,v $ + * Revision 1.1.2.1 2006/12/14 22:24:40 korpela + * *** empty log message *** + * + * Revision 1.1 2003/06/03 00:16:09 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:03:21 korpela + * Initial revision + * + * + */ + diff --git a/splitter_fft/mb_dotransform.cpp b/splitter_fft/mb_dotransform.cpp new file mode 100644 index 0000000..79d6bc7 --- /dev/null +++ b/splitter_fft/mb_dotransform.cpp @@ -0,0 +1,260 @@ +/* + * + * dotransform.c + * + * Functions for division by frequency into work units. + * + * $Id: mb_dotransform.cpp,v 1.1.2.3 2007/06/06 15:58:29 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include + +#include "setilib.h" +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "fftw3.h" +#include "mb_wufiles.h" + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) + + +int obuf_pos; /* Tracks current postition in the output buffers */ + + +void output_samples(float *data, int i, int buf_pos) { + int j,k; + unsigned short s=0; + float *p=data; + + for (k=0; k<8; k++) { + s >>= 2; + if (*p>0) s |= 0x8000; + if (*(p+1)>0) s |= 0x4000; + p+=2; + } + bin_data[i].push_back((s>>8) & 0xff); + bin_data[i].push_back(s & 0xff); +} + +void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) { + unsigned int i, j; + unsigned short s; + static int first_time=1; + static float lut[65536][16]; + + assert(!(nsamples % 8)); + + if (first_time) { + for (i=0;i<65536;i++) { + s=(unsigned short)i; + for (j=0;j<8;j++) { + lut[i][j*2]=(float)2*(s & 1)-1; + s >>= 1; + lut[i][j*2+1]=(float)2*(s & 1)-1; + s >>= 1; + } + } + first_time--; + } + + for (i=0;i<(nsamples/8);i++) { + memcpy(data+16*i,lut[raw[i]],16*sizeof(float)); + } +} + + +float randu() { +// Uniform random numbers between 0 and 1 + static bool first=true; + if (first) { + srand(time(0)); + first=false; + } + return static_cast(rand())/RAND_MAX; +} + +float randn() { +// normally distributed random numbers + static float last=0; + float a,b,h=0; + if (last==0) { + while (h==0 || h>=1) { + a=2*randu()-1; + b=2*randu()-1; + h=a*a+b*b; + } + h=sqrt(-2*log(h)/h); + last=a*h; + return b*h; + } else { + a=last; + last=0; + return a; + } +} + +void process_seg(std::vector > &data,int offset) { + int i; + static complex *dbuff=(complex *)fftwf_malloc(FFT_LEN*sizeof(complex)); + memset(dbuff,0,FFT_LEN*sizeof(complex)); + float* fbuff = (float *)dbuff; + fftwf_complex *fcbuff=(fftwf_complex *)dbuff; + static fftwf_plan planfwd,planinverse; + + + if (!planfwd) { + planfwd=fftwf_plan_dft_1d(FFT_LEN, fcbuff, fcbuff, FFTW_BACKWARD, + FFTW_MEASURE ); + int n=IFFT_LEN; + planinverse=fftwf_plan_many_dft(1, &n, FFT_LEN/IFFT_LEN, + fcbuff, &n, 1, n, + fcbuff, &n, 1, n, + FFTW_FORWARD, FFTW_MEASURE ); + } + + for (i=0;i( + static_cast(data[i+offset].real()), + static_cast(data[i+offset].imag()) + ); + } + + fftwf_execute(planfwd); + dbuff[0]=complex(0.0f,0.0f); // null the DC bin + + + // highpass filter the rest + if (splitter_settings.splitter_cfg->highpass != 0) { + fprintf(stderr,"Doing highpass filter\n"); + float filter_bins=FFT_LEN*splitter_settings.splitter_cfg->highpass/splitter_settings.recorder_cfg->sample_rate; + complex stddev=0,avg=0; + for (i=0;i temp(dbuff[i]); + avg+=temp; + stddev+=complex(temp.real()*temp.real(),temp.imag()*temp.imag()); + } + avg/=(float)FFT_LEN; + stddev-=(float)FFT_LEN*complex(avg.real()*avg.real(),avg.imag()*avg.imag()); + stddev=complex(sqrt(stddev.real()),sqrt(stddev.imag()))/(float)FFT_LEN; + for (i=0;i(randn()*stddev.real(),randn()*stddev.imag())*(n+0.25f); + dbuff[FFT_LEN-(i+1)]+=complex(randn()*stddev.real(),randn()*stddev.imag())*(n+0.25f); + } + } + + dbuff[0]=complex(0.0f,0.0f); // null the DC bin + + fftwf_execute(planinverse); + for (i=0; i &tapebuffer) { + int i,j; + // long sum=0,sum0; + for (i=0;i &data,int offset) ; +void do_transform(std::vector &tapebuffer) ; + +/* + * + * $Log: mb_dotransform.h,v $ + * Revision 1.1.2.2 2007/04/25 17:20:28 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:41 korpela + * *** empty log message *** + * + * Revision 1.1 2003/06/03 00:16:11 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1999/02/01 22:28:52 korpela + * FFTW version. + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:05:22 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/mb_message.cpp b/splitter_fft/mb_message.cpp new file mode 100644 index 0000000..022fbf7 --- /dev/null +++ b/splitter_fft/mb_message.cpp @@ -0,0 +1,73 @@ +/* + * Functions for sending messages to stderr and log files. + * + * $Id: mb_message.cpp,v 1.1.2.1 2006/12/14 22:24:42 korpela Exp $ + */ + +#include "sah_config.h" +#include +#include +#include +#include "setilib.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "xml_util.h" + + +#include "boinc_db.h" +#include "sched_config.h" +#include "sched_msgs.h" +#include "mb_splitter.h" + +void message(char *msg) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s %s",tapebuffer[0].header.name,msg); +} + + + +/* + * $Log: mb_message.cpp,v $ + * Revision 1.1.2.1 2006/12/14 22:24:42 korpela + * *** empty log message *** + * + * Revision 1.2.4.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:43 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:56:16 korpela + * Initial revision + * + */ diff --git a/splitter_fft/mb_polyphase.cpp b/splitter_fft/mb_polyphase.cpp new file mode 100644 index 0000000..6df3548 --- /dev/null +++ b/splitter_fft/mb_polyphase.cpp @@ -0,0 +1,150 @@ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include +#include "setilib.h" + +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "mb_fftw.h" +#include "mb_wufiles.h" +#include "mb_polyphase.h" +#include "mb_dotransform.h" + +/* buffer for fft input/output */ +//float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) + +extern unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + +double *filter_r, *filter_i; +float *f_data; + +extern int obuf_pos; /* Tracks current postition in the output buffers */ + +void make_FIR (int n_points, int M, int window, double *output) { + /* Create Mth band lowpass FIR filter, n_points long. */ + + /* Modify this to give 8-bit quantized filter. */ + /* Also generate Hilbert transformed filter */ + + int n; + double q, p; + + for (n=0; n TAPE_DATA_SIZE) { + // End of frame crossed need to trasfer correctly + end_trans.frame++; + end_trans.byte-=TAPE_DATA_SIZE; + nsamp=(TAPE_DATA_SIZE-start_trans.byte)*(CHAR_BIT/2); + assert((nsamp+end_trans.byte*(CHAR_BIT/2)) == FFT_LEN); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf, nsamp); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(end_trans.frame,0),databuf+nsamp*2, + end_trans.byte*(CHAR_BIT/2)); + } else { + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf,FFT_LEN); + } + polyphase_seg(databuf); + // Go on to next transform + start_trans=end_trans; + } + // Check if we're at the end of the wu file. If so we print less bytes + if ((end_trans.frame>=end_of_wu->frame) && + (end_trans.byte>=end_of_wu->byte)) { + write_wufile_blocks(NBYTES % SAMPLES_PER_OBUF); + } else { + write_wufile_blocks(SAMPLES_PER_OBUF); + } + } while (!((end_trans.frame>=end_of_wu->frame) && (end_trans.byte>=end_of_wu->byte))); + + // Move the data in the buffer so we don't have to reread portions of the + // tape. + // + { + unsigned char *record_offset; + int copysize; + end_of_wu->frame-=WU_OVERLAP_FRAMES; + records_in_buffer=TAPE_RECORDS_IN_BUFFER- + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD); + record_offset=tapebuffer+ + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD)*TAPE_RECORD_SIZE; + copysize=records_in_buffer*TAPE_RECORD_SIZE; + bcopy(record_offset,tapebuffer,copysize); + } +} + + diff --git a/splitter_fft/mb_splitter.cpp b/splitter_fft/mb_splitter.cpp new file mode 100644 index 0000000..ffb8d06 --- /dev/null +++ b/splitter_fft/mb_splitter.cpp @@ -0,0 +1,965 @@ +/* + * + * The splitter main program. + * + * $Id: mb_splitter.cpp,v 1.1.2.6 2007/08/16 23:03:19 jeffc Exp $ + * + */ + +#include "sah_config.h" +#undef USE_MYSQL +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "boinc_db.h" +#include "backend_lib.h" +#include "sched_config.h" +#include "setilib.h" +#include "str_util.h" +#include "str_replace.h" +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "mb_validrun.h" +#include "mb_wufiles.h" +#include "mb_dotransform.h" +#include "message.h" +#include "sqlrow.h" +#include "sqlapi.h" +#include "db/db_table.h" +#include "db/schema_master.h" +#include "db/app_config.h" + +extern "C" { + int sqldetach(); +} + +char trigger_file_path[1024]="/disks/setifiler1/wutape/tapedir/splitter_stop"; + +SCHED_CONFIG boinc_config; +DB_APP app; +R_RSA_PRIVATE_KEY key; + +// configuration tables +receiver_config rcvr; +settings splitter_settings; + +// TEMPLATE DEFS ------------------------------------------------------ +// IMPORTANT: a change to a template should *always* include a change +// to the template filename. Only the result template is used now. +const char *wu_template_filename_id = "wu_0.xml"; +const char *wu_template= + "\n" + " 0\n" + "\n" + "\n" + " \n" + " 0\n" + " work_unit.sah\n" + " \n" + "\n"; + +const char *result_template_filename_id = "result_0.xml"; +const char *result_template= + "\n" + " \n" + " \n" + " \n" + " 65536\n" + " http://setiboincdata.ssl.berkeley.edu/sah_cgi/file_upload_handler\n" + "\n" + "\n" + " \n" + " \n" + " result.sah\n" + " \n" + "\n"; +// END TEMPLATE DEFS -------------------------------------------------- + +std::vector tapebuffer; +std::map coord_history; +std::vector wuheaders; +char appname[256]; +int max_wus_ondisk=MAX_WUS_ONDISK; +int nodb; +int noencode; +int resumetape; +int norewind; +int startblock; +int dataclass; +int atnight; +int gregorian; +int output_xml; +int polyphase; +int iters=-1; +int beam; +int pol; +int alfa; +int useanalysiscfgid = 0; +int usereceivercfgid = 0; +int userecordercfgid = 0; +int usesplittercfgid = 0; +int filter_window = 0; +double start_time; +double stop_time; +unsigned long minvfsbuf=-1; +char wd[1024]; +//char * scidb = NULL; +char * projectdir = NULL; + +APP_CONFIG sah_config; + +//const char *result_template_filename="projectdir"/"SAH_APP_NAME"_result.tpl"; +char result_template_filename[1024]; +char result_template_filepath[1024]; +char wu_template_filename[1024]; + +int check_for_halt(); +int wait_until_night(); +int check_free_disk_space(); +int wait_for_db_wus_ondisk(); + +void cprint(char *p) { + printf("%s\n",p); +} + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ + +FILE *wulog,*errorlog; +buffer_pos_t start_of_wu,end_of_wu; /* position of start and end of wu in + tape buffer */ +int seqno; + +void cleanup(void) { + FILE *tmpfile; + if ((tmpfile=fopen("seqno.dat","w"))) { + fprintf(tmpfile,"%d\n",seqno); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Unable to open seqno.dat for write\n"); + } +} + + +int process_command_line(int argc, char *argv[],char **tape_device, + int *norewind, int *startblock, int *resumetape, + int *nodb, int *dataclass, int *atnight, + int *max_wus_ondisk, char **projectdir, + int *iters, int *beam, int *pol, int *alfa, + int *useanalysiscfgid, int *usereceivercfgid, + int *userecordercfgid, int *usesplittercfgid) { + int nargs=0,i; + char *ep; + strcpy(appname,SAH_APP_NAME); + for (i=1;i6)) || + ((*pol<0) || (*pol>1))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"ALFA receivers must be specified with beam (0-6) and polarization (0-1), i.e. -alfa=4,0\n"); + exit(EXIT_FAILURE); + } + + *alfa=1; + } else if (!strncmp(argv[i],"-iterations",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",iters); + } else if (!strncmp(argv[i],"-startblock",MAX(ep-argv[i],2))) { + if (*norewind || *resumetape) { + return(1); + } + sscanf(ep+1,"%d",startblock); + } else if (!strncmp(argv[i],"-max_wus_ondisk",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",max_wus_ondisk); + } else if (!strncmp(argv[i],"-dataclass",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",dataclass); + } else if (!strncmp(argv[i],"-projectdir",MAX(ep-argv[i],2))) { + *projectdir=(char *)calloc(strlen(ep+1)+5,1); + strlcpy(*projectdir,ep+1,strlen(ep+1)+5); + strlcat(*projectdir,"/",strlen(ep+1)+5); + } else if (!strncmp(argv[i],"-analysis_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",useanalysiscfgid); + } else if (!strncmp(argv[i],"-recorder_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",userecordercfgid); + } else if (!strncmp(argv[i],"-receiver_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",usereceivercfgid); + } else if (!strncmp(argv[i],"-splitter_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",usesplittercfgid); + } else { + return(1); + } + } else { + return(1); + } + } else { + *tape_device=argv[i]; + nargs++; + } + } + //return(nargs!=1); + + // check for required cmd line + //if (! *scidb) return (1); + if (! *projectdir) return (1); + if (! *tape_device) return (1); + + return 0; +} + +int main(int argc, char *argv[]) { + int tape_fd; + char *tape_device; + FILE *tmpfile; + int retval; + char keyfile[1024]; + char tmpstr[1024]; + char buf[1024]; + + + /* Process command line arguments */ + if (process_command_line(argc,argv,&tape_device,&norewind,&startblock,&resumetape, + &nodb,&dataclass,&atnight,&max_wus_ondisk,&projectdir,&iters, + &beam,&pol,&alfa,&useanalysiscfgid,&usereceivercfgid, + &userecordercfgid,&usesplittercfgid)) { + fprintf(stderr,"Usage: splitter tape_device -projectdir=s [-atnight] [-nodb]\n" + "[-xml] [-gregorian] [-resumetape | -norewind | -startblock=n] [-dataclass=n]\n" + "[-max_wus_on_disk=n] [-iterations=n] [-trigger_file_path=filename]\n" + "[-alfa=beam,pol] [-analysis_config=id] [-receiver_config=id]\n" + "[-recorder_config=id] [-splitter_config=id]\n"); + exit(EXIT_FAILURE); + } + + // MATTL + if (blanking_bit == SOFTWARE_BLANKING_BIT) log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"blanking bit: %d (SOFTWARE)\n",blanking_bit); + else log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"blanking bit: %d (HARDWARE)\n",blanking_bit); + + /* Open log files */ + log_messages.set_debug_level(3); + + retval = sah_config.parse_file(projectdir); + if (retval) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Can't parse config file\n"); + exit(EXIT_FAILURE); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using configuration:\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"scidb_name = %s\n", sah_config.scidb_name); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_wus_ondisk = %d\n", sah_config.max_wus_ondisk); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"min_quorum = %d\n", sah_config.min_quorum); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"target_nresults = %d\n", sah_config.target_nresults); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_error_results = %d\n", sah_config.max_error_results); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_success_results = %d\n", sah_config.max_success_results); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_total_results = %d\n", sah_config.max_total_results); + } + + // Will initially open + if (!db_change(sah_config.scidb_name)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Could not open science database %s\n", sah_config.scidb_name); + if (!nodb) exit(EXIT_FAILURE); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using science database %s\n", sah_config.scidb_name); + } + + + boinc_config.parse_file(projectdir); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using boinc config dir %s\n", projectdir); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using boinc database %s\n", boinc_config.db_name); + + // check / commit result template + strcpy(result_template_filename, "templates/"); + strcat(result_template_filename, appname); + strcat(result_template_filename, "_"); + strcat(result_template_filename, result_template_filename_id); + strcpy(result_template_filepath, projectdir); + strcat(result_template_filepath, result_template_filename); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%s %s\n", result_template_filename, result_template_filepath); + if (!(tmpfile=fopen(result_template_filepath,"r"))) { + if (!(tmpfile=fopen(result_template_filepath,"w"))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Cannot open result file template : %s\n", result_template_filepath); + exit(1); + } + fprintf(tmpfile,result_template); + } + fclose(tmpfile); + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"boinc_db.open\n"); + exit(1); + } + + char tmpquery[128]; + sprintf(tmpquery,"where name ='%s'",appname); + if (app.lookup(tmpquery)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Error looking up appname\n"); + boinc_db.print_error("boinc_app lookup"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"boinc_app lookup\n"); + exit(1); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Splitting for application %s (ID = %d)\n", appname, app.id); + } + + boinc_db.close(); + + telescope_id tel= + channel_to_receiverid[beam_pol_to_channel[bmpol_t(beam,pol)]]; + + sprintf(buf,"where active=%d and receiver_cfg=(select id from receiver_config where s4_id=%d)",app.id,AO_ALFA_0_0); + if (usereceivercfgid > 0) { + sprintf(buf,"where active=%d and receiver_cfg=%d",app.id,usereceivercfgid); + } + if (!splitter_settings.fetch(std::string(buf))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to find active settings for app.id=%d\n",app.id); + exit(1); + } + + sprintf(buf,"where s4_id=%d and id>=%d",tel,splitter_settings.receiver_cfg.id); + if (usereceivercfgid > 0) { sprintf(buf,"where id=%d",usereceivercfgid); } + rcvr.fetch(buf); + if (usereceivercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using receiver cfg id: %d (set by user)\n",usereceivercfgid); + splitter_settings.receiver_cfg = usereceivercfgid; + splitter_settings.receiver_cfg->fetch(); + } else { + splitter_settings.receiver_cfg->fetch(buf); + } + if (userecordercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using recorder cfg id: %d (set by user)\n",userecordercfgid); + splitter_settings.recorder_cfg = userecordercfgid; + } + splitter_settings.recorder_cfg->fetch(); + if (usesplittercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using splitter cfg id: %d (set by user)\n",usesplittercfgid); + splitter_settings.splitter_cfg = usesplittercfgid; + } + splitter_settings.splitter_cfg->fetch(); + if (useanalysiscfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using analysis cfg id: %d (set by user)\n",useanalysiscfgid); + splitter_settings.analysis_cfg = useanalysiscfgid; + } + splitter_settings.analysis_cfg->fetch(); + + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, "settings: \n\n%s\n", splitter_settings.print_xml(1,1,0).c_str()); + + strcpy(keyfile, projectdir); + strcat(keyfile, "/keys/upload_private"); + if (read_key_file(keyfile,key)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Error reading keyfile.\n"); + exit(1); + } + + check_for_halt(); + + if ((tape_fd=open(tape_device,O_RDONLY|0x2000, 0777))<0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to open tape device\n"); + exit(EXIT_FAILURE); + } + + // In early tapes there was a bug where the first N blocks would be duplicates + // of data from previous files. So we need to fast forward until we see a + // frame sequence number of 1. + int i,readbytes=HeaderSize; + dataheader_t header; + header.frameseq=100000; + + while ((readbytes==HeaderSize) && (header.frameseq>10)) { + char buffer[HeaderSize]; + int nread; + readbytes=0; + while ((readbytes!=HeaderSize) && (nread = read(tape_fd,buffer,HeaderSize-readbytes))) { + readbytes+=nread; + } + if (nread < 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"File error %d.\n", errno); + exit(1); + } + if (readbytes == HeaderSize) { + header.populate_from_data(buffer); + if (header.frameseq>10) { + lseek64(tape_fd,DataSize,SEEK_CUR); + } else { + lseek64(tape_fd,-1*(off64_t)HeaderSize,SEEK_CUR); + } + } + } + + if (readbytes != HeaderSize) { + // we fast forwarded through the entire tape without finding the first frame + // maybe this is one of the really early tapes that was split into chunks. + lseek64(tape_fd,0,SEEK_SET); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Warning: First block not found\n"); + } + + if (resumetape) { + tape thistape; + thistape.id=0; + readbytes=HeaderSize; + sprintf(buf,"%d",rcvr.s4_id-AO_ALFA_0_0); + if (thistape.fetch(std::string("where name=\'")+header.name+"\' and beam="+buf)) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Resuming tape %s beam %d pol %d\n",thistape.name,beam,pol ); + while ((readbytes==HeaderSize) && (header.dataseq!=thistape.last_block_done)) { + int nread=0; + char buffer[HeaderSize]; + readbytes=0; + while ((readbytes!=HeaderSize) && + ((nread = read(tape_fd,buffer,HeaderSize-readbytes)) > 0 )) { + readbytes+=nread; + } + if (readbytes == HeaderSize) { + header.populate_from_data(buffer); + if (header.dataseq!=thistape.last_block_done) { + lseek64(tape_fd,(off64_t)(DataSize+HeaderSize)*(thistape.last_block_done-header.dataseq)-HeaderSize,SEEK_CUR); + } else { + lseek64(tape_fd,-1*(off_t)HeaderSize,SEEK_CUR); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Found starting point"); + } + } + if (nread == 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"End of file.\n"); + exit(0); + } + if (nread < 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"File error %d.\n",errno); + exit(1); + } + } + } + } + + /* Start of main loop */ + + + atexit(cleanup); + + getcwd(wd,1024); + + if (polyphase) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Polyphase not implemented\n" ); + exit(1); +#if 0 + int filter_len; + + filter_len = P_FFT_LEN*N_WINDOWS; + + filter_r = (double *)malloc(sizeof(double)*filter_len); + filter_i = (double *)malloc(sizeof(double)*filter_len); + + f_data = (float *)malloc(sizeof(float)*P_FFT_LEN*2); + + make_FIR(filter_len, N_WINDOWS, filter_window, filter_r); + make_FIR(filter_len, N_WINDOWS, filter_window, filter_i); + + /* + int i; + float *data; + data = (float*)malloc(sizeof(float)*2*2048); + for (double n=-20;n<20;n+=.05) { + for (i=0;i<2*2048;i+=2) { + data[i] = cos(2*(24+n)*3.1415926535*i/(2*2048)); + data[i+1] = sin(2*(24+n)*3.1415926535*i/(2*2048)); + } + polyphase_seg(data); + //fprintf( stderr, "%f\n", 3+n/8); + } + exit(0); + for(i=0;i > blanker_filter; + if (strcmp(splitter_settings.splitter_cfg->blanker_filter, "randomize") == 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Setting blanker filter to randomize\n" ); + blanker_filter = randomize; + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Setting blanker filter to null\n" ); + blanker_filter = NULLC; // no blanking + } + while (iters-- && + ((512-tapebuffer.size())==seti_StructureDr2Data(tape_fd, beam, pol, + 512-tapebuffer.size(), tapebuffer, blanker_filter))) { + /* check if we should be running now */ + fflush(stderr); + if (atnight) wait_until_night(); + + sprintf(buf,"where active=%d and receiver_cfg=(select id from receiver_config where s4_id=%d)",app.id,AO_ALFA_0_0); + if (usereceivercfgid > 0) { + sprintf(buf,"where active=%d and receiver_cfg=%d",app.id,usereceivercfgid); + } + if (!splitter_settings.fetch(std::string(buf))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to find active settings for app.id=%d\n",app.id); + exit(1); + } + + sprintf(buf,"where s4_id=%d and id>=%d",tel,splitter_settings.receiver_cfg.id); + if (usereceivercfgid > 0) { sprintf(buf,"where id=%d",usereceivercfgid); } + rcvr.fetch(buf); + if (usereceivercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using receiver cfg id: %d (set by user)\n",usereceivercfgid); + splitter_settings.receiver_cfg = usereceivercfgid; + splitter_settings.receiver_cfg->fetch(); + } else { + splitter_settings.receiver_cfg->fetch(buf); + } + if (userecordercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using recorder cfg id: %d (set by user)\n",userecordercfgid); + splitter_settings.recorder_cfg = userecordercfgid; + } + splitter_settings.recorder_cfg->fetch(); + if (usesplittercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using splitter cfg id: %d (set by user)\n",usesplittercfgid); + splitter_settings.splitter_cfg = usesplittercfgid; + } + splitter_settings.splitter_cfg->fetch(); + if (useanalysiscfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using analysis cfg id: %d (set by user)\n",useanalysiscfgid); + splitter_settings.analysis_cfg = useanalysiscfgid; + } + splitter_settings.analysis_cfg->fetch(); + + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, "settings: \n\n%s\n", splitter_settings.print_xml(1,1,0).c_str()); + + check_for_halt(); + + // Make sure we have enough free disk space + check_free_disk_space(); + + // Wait for ondisk wus in the database to drop below the threshold + if (!nodb) wait_for_db_wus_ondisk(); + //fprintf( stderr, "Read data\n" ); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"less than max wus on disk, continuing\n" ); + fflush(stderr); + + //printf( "Read tape data, analyzing\n" ); + check_for_halt(); + + //check for an uninterrupted run + if (valid_run(tapebuffer,splitter_settings.receiver_cfg->min_vgc)) { + std::vector::iterator i=tapebuffer.begin(); + // insert telescope coordinates into the coordinate history. + // this should be converted to a more accurate routine. + for (;i!=tapebuffer.end();i++) { + coord_history[i->header.coord_time].ra = i->header.ra; + coord_history[i->header.coord_time].dec = i->header.dec; + coord_history[i->header.coord_time].time = i->header.coord_time.jd().uval(); + } + if (make_wu_headers(tapebuffer,tel,wuheaders)) { + int child_pid=-1; + switch (polyphase) { + case 1: + #if 0 + do_polyphase(&start_of_wu,&end_of_wu); + #endif + break; + default: + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"doing transform..." ); + do_transform(tapebuffer); + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG," done\n" ); + } + wait(0); + if (!nodb) sql_finish(); + + do { + sleep(1); + child_pid=fork(); + if (child_pid<0) log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"splitter cannot fork"); + //fprintf( stderr, "child pid: %d\n", child_pid); + } while (child_pid<0); + + if (!child_pid) { + if (!nodb) { + sqldetach(); + while (!sql_database(sah_config.scidb_name)) { + //fprintf(stderr,"child sleeping\n"); + sleep(10); + } + } + rename_wu_files(); + if (!nodb) sql_finish(); + _exit(0); + } + + if (!nodb) { + while (!sql_database(sah_config.scidb_name)) { + //fprintf(stderr,"parent sleeping\n"); + sleep(10); + } + } + } + } + } + + // iters is initalized to -1. If the -iters flag is specified on the command + // line, iters is re-initialized to the user desired number of interations. + // Each time a WUG is proccessed iters is decremineted. If the user specifies + // iters and we do that number of iterations without reaching EOF then iters + // here will be zero. !Zero means we have reached EOF prior to performing the user + // desired number of iterations. + // + // On the other hand, if iters is not specified by the user, iters is decrmented + // downward from -1. It will never be zero in this case. But since we are not + // limiting the number of iterations, the only way will get here is if we reach EOF. + // + // Thus in both cases, a non-zero iters means we have reached EOF. + if (iters != 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"End of file.\n"); + // clean stop at EOF + return (EXIT_NORMAL_EOF); + } else { + // clean stop, but not EOF (iters satisfied or triggered stop) + // (A return of 1 is an error exit somewhere else in the code.) + return(EXIT_NORMAL_NOT_EOF); + } +} + +int check_for_halt() { + FILE *tf; + + tf = fopen(trigger_file_path, "r"); + // tf=0; + if (tf != NULL) { // Stop program + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Found splitter_stop, exiting.\n" ); + exit(EXIT_NORMAL_NOT_EOF); + } + return(0); // Keep going +} + +int wait_until_night() { + time_t t; + struct tm *lt; + do { + t=time(0); + lt=localtime(&t); + // Don't run M-F 8AM-6PM + if ((lt->tm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)) { + sleep(100); + } + } while ((lt->tm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)); + return 0; +} + +int check_free_disk_space() { + struct statvfs vfsbuf; + + /* check disk free space in working directory */ + statvfs("wu_inbox/.",&vfsbuf); + if (vfsbuf.f_frsize==0) vfsbuf.f_frsize=512; + if (vfsbuf.f_bavail < (100000*1024/vfsbuf.f_frsize)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Not enough free disk space in working directory to continue\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Not enough free disk space in working directory to continue\n"); + exit(EXIT_FAILURE); + } + + /* check free disk space in download directory tree */ + std::string download_dir(boinc_config.download_dir); + int waited=0; + download_dir+="/."; + /* wait here if the disk is more than N% full */ + statvfs(download_dir.c_str(),&vfsbuf); + if (vfsbuf.f_blocks > vfsbuf.f_bfree*100/sah_config.min_disk_free_pct) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Waiting for free space in download directory\n"); + while (vfsbuf.f_blocks > vfsbuf.f_bfree*100/sah_config.min_disk_free_pct) { + waited+=10; + sleep(10); + statvfs(download_dir.c_str(),&vfsbuf); + } + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Waited %d seconds\n", waited); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Continuing...\n"); + } + return 0; +} + +int wait_for_db_wus_ondisk() { + //int wus_ondisk,rv; + DB_STATE_COUNTS state_counts; + int retval; + + // No need to check the DB for every single WUG iteration. + static int check_count = 100; + if (check_count < 100) { + check_count++; + return 0; + } else { + check_count = 0; + } + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"boinc_db.open\n"); + exit(1); + } +#if 0 + retval = boinc_db.set_isolation_level(READ_UNCOMMITTED); + if (retval) { + log_messages.printf(MSG_CRITICAL, "boinc_db.set_isolation_level: %d; %s\n", rv, boinc_db.error_string()); + exit(EXIT_FAILURE); + } + else { + log_messages.printf(MSG_NORMAL, "setting read uncommitted isolation level\n"); + } +#endif + do { + char query[1024]; + sprintf(query,"where appid=%d",app.id); + retval=state_counts.lookup(query); + if (retval) { + boinc_db.print_error("state_counts.lookup"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"DB Error, unable to count workunits on disk\n"); + exit(EXIT_FAILURE); + } + check_for_halt(); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%d WUs ondisk\n", state_counts.result_server_state_2); + if (state_counts.result_server_state_2>sah_config.max_wus_ondisk) sleep(600); + +#if 0 + sprintf(query,"where appid=%d and server_state=2",app.id); + rv=boinc_result.count(wus_ondisk,query); + if (rv) { + boinc_db.print_error("boinc_result.count"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"DB Error, unable to count workunits on disk\n"); + exit(EXIT_FAILURE); + } + check_for_halt(); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%d WUs ondisk\n", wus_ondisk); + if (wus_ondisk>sah_config.max_wus_ondisk) sleep(600); + } while (wus_ondisk>sah_config.max_wus_ondisk); +#endif + + } while (state_counts.result_server_state_2>sah_config.max_wus_ondisk); + + boinc_db.close(); + return 0; +} + +/* + * $Log: mb_splitter.cpp,v $ + * Revision 1.1.2.6 2007/08/16 23:03:19 jeffc + * *** empty log message *** + * + * Revision 1.1.2.5 2007/08/10 19:29:40 jeffc + * *** empty log message *** + * + * Revision 1.1.2.4 2007/06/07 20:01:52 mattl + * *** empty log message *** + * + * Revision 1.1.2.3 2007/06/06 15:58:29 korpela + * *** empty log message *** + * + * Revision 1.1.2.2 2007/04/25 17:27:30 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:43 korpela + * *** empty log message *** + * + * Revision 1.22.2.4 2006/11/08 20:16:26 vonkorff + * Fixes an error message. + * + * Revision 1.22.2.3 2006/11/07 19:26:37 vonkorff + * Fixed lcgf + * + * Revision 1.22.2.2 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.22.2.1 2005/08/01 21:16:25 jeffc + * *** empty log message *** + * + * Revision 1.22 2005/01/27 23:03:27 mattl + * + * commented out tf=0 in check_for_halt + * + * Revision 1.21 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.19 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/27 21:07:04 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/20 18:56:48 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.14 2004/04/08 22:25:47 jeffc + * *** empty log message *** + * + * Revision 1.13 2004/01/22 00:57:53 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.10 2003/11/25 21:59:52 korpela + * *** empty log message *** + * + * Revision 1.9 2003/11/01 20:54:02 korpela + * *** empty log message *** + * + * Revision 1.8 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.7 2003/09/26 20:48:51 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.5.2.2 2003/09/23 00:49:12 korpela + * *** empty log message *** + * + * Revision 1.5.2.1 2003/09/22 17:39:34 korpela + * *** empty log message *** + * + * Revision 1.6 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/13 20:48:38 korpela + * directory reorg. Moved client files to ./client + * + * Revision 1.4 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/08/13 23:18:47 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:50 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.6 2003/05/21 00:41:42 korpela + * *** empty log message *** + * + * Revision 3.5 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.4 2003/04/09 17:46:54 korpela + * *** empty log message *** + * + * Revision 3.3 2002/06/20 22:09:17 eheien + * *** empty log message *** + * + * Revision 3.2 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.6 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added dataclass paramter. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added some db access functions. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:58:16 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/mb_splitter.h b/splitter_fft/mb_splitter.h new file mode 100644 index 0000000..6b52bc3 --- /dev/null +++ b/splitter_fft/mb_splitter.h @@ -0,0 +1,145 @@ +/* + * splitter.h + * + * Global definitions from the splitter main program. + * + * $Id: mb_splitter.h,v 1.1.2.2 2007/04/25 17:20:28 korpela Exp $ + * + */ + +#ifndef SPLITTER_H +#define SPLITTER_H + +#include "splitparms.h" +#include "splittypes.h" + +#define MAX(x,y) ( ((x)<(y)) ? (y) : (x) ) +#define MIN(x,y) ( ((y)<(x)) ? (y) : (x) ) + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ +#include "boinc_db.h" +#include "crypt.h" +#include "backend_lib.h" +#include "sched_config.h" + +extern SCHED_CONFIG boinc_config; +extern DB_APP app; +extern R_RSA_PRIVATE_KEY key; +extern FILE *wulog,*errorlog; +extern std::vector wuheaders; +extern int noencode; +extern int dataclass; +extern char appname[256]; +extern int nodb; +extern int resumetape; +extern int startblock; +extern int norewind; +extern int output_xml; +extern int polyphase; +extern std::vector wu_database_id; +extern int gregorian; +extern char * projectdir; +extern char trigger_file_name[1024]; +extern receiver_config rcvr; +extern settings splitter_settings; + + +/* Buffer that holds tape data */ +extern std::vector tapebuffer; +extern std::map coord_history; + +/* Number of records remaining in the buffer after WU creations is complete */ +extern int records_in_buffer; + +extern const char *wu_template; +extern const char *result_template; +// jeffc +//extern const char *result_template_filename; +extern char result_template_filename[]; +extern char result_template_filepath[]; +extern char wu_template_filename[]; + +// exit values not defined elsewhere +const int EXIT_NORMAL_EOF = 0; +const int EXIT_NORMAL_NOT_EOF = 2; + +/* Persistant sequence number of wu file */ +extern int seqno; + +#endif + +/* + * $Log: mb_splitter.h,v $ + * Revision 1.1.2.2 2007/04/25 17:20:28 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:43 korpela + * *** empty log message *** + * + * Revision 1.6.2.1 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.6 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.5 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.4 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.2.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/10/20 19:20:26 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * Added nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:10:32 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/mb_splittypes.h b/splitter_fft/mb_splittypes.h new file mode 100644 index 0000000..540fd74 --- /dev/null +++ b/splitter_fft/mb_splittypes.h @@ -0,0 +1,114 @@ +/* splittypes.h + * + * Type definitions specific to the splitter. + * + * + * $Id: mb_splittypes.h,v 1.1.2.1 2006/12/14 22:24:44 korpela Exp $ + * + */ +#ifndef SPLITTYPES_H +#define SPLITTYPES_H + +#include + +#include "splitparms.h" +#include "s_util.h" +#include "seti_header.h" + +//typedef struct wuheader { + //WU_INFO wuhead; + //SETI_WU_INFO wuinfo; +//} wuheader_t; + +typedef struct tapeheader { + char name[36]; + int rcdtype; + int numringbufs; + int numdiskbufs; + unsigned long frameseq; + unsigned long dataseq; + int missed; + TIME st; + SCOPE_STRING telstr; + int source; + double centerfreq,samplerate; + char version[16]; +} tapeheader_t; + +typedef struct buffer_pos { + int frame; + long offset; +} buffer_pos_t; + +#endif +/* + * $Log: mb_splittypes.h,v $ + * Revision 1.1.2.1 2006/12/14 22:24:44 korpela + * *** empty log message *** + * + * Revision 1.4 2003/08/05 17:23:43 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.3 2003/07/29 20:35:51 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:41 korpela + * + * Again + * + * Revision 3.1 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.4 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.3 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * Moved tape_version and encoding_type into SETI_WU_INFO. + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.7 1998/10/30 21:01:13 davea + * *** empty log message *** + * + * Revision 1.6 1998/10/27 01:10:58 korpela + * Modified tapeheader_t to match new tape header fields. + * + * Revision 1.5 1998/10/19 23:04:32 korpela + * Moved times in telstr_t into an st_t. + * Changed name of ast_t to st_t. + * Added time zone (tz) field to ast_t. + * + * Revision 1.4 1998/10/15 19:13:30 korpela + * Renamed "unix" fields to "unix_time" because of GCC #define. + * Added position_history field to wuheader_t. + * + * Revision 1.3 1998/10/15 18:58:50 korpela + * Added time_t unix to ast_t and telstr_t types. + * Changed times in wuheader_t to time_t types. + * + * Revision 1.2 1998/10/15 18:01:19 korpela + * Removed month field from ast_t and telstr_t. + * + * Revision 1.1 1998/10/15 16:20:24 korpela + * Initial revision + * + */ diff --git a/splitter_fft/mb_validrun.cpp b/splitter_fft/mb_validrun.cpp new file mode 100644 index 0000000..9bf7230 --- /dev/null +++ b/splitter_fft/mb_validrun.cpp @@ -0,0 +1,147 @@ +/* + * validrun.c + * + * Functions for determining if a section of the tape buffer can be + * turned into a valid work unit + * + * $Id: mb_validrun.cpp,v 1.1.2.1 2006/12/14 22:24:45 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include "setilib.h" +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "message.h" + + +bool valid_run(std::vector &tapebuffer, int min_vgc) { + unsigned long start_dataseq=tapebuffer[0].header.dataseq; + unsigned long end_dataseq=tapebuffer[tapebuffer.size()-1].header.dataseq; + bool valid=true; + int i; + + // check for missing frames + if(!(end_dataseq-start_dataseq)==(tapebuffer.size()-1)) { + valid = false; + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Missing frames between %lu and %lu\n", + tapebuffer[0].header.dataseq,tapebuffer[tapebuffer.size()-1].header.dataseq); + for (i=tapebuffer.size()-1;i>0;i--) { // find the last "in sequence" frame + if (tapebuffer[i-1].header.dataseq != (tapebuffer[i].header.dataseq-1)) { + tapebuffer.erase(tapebuffer.begin(),tapebuffer.begin()+i); // delete all frames prior to the miss + } + } + } + + // if still valid, check for failed blanking signal acquisition + if (valid) { + for (i=0;valid && (i 0) { + for (i=0;valid && (i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_ERRNO_H +#include +#endif + +#include "boinc_db.h" +#include "sched_util.h" +#include "setilib.h" +#include "splitparms.h" +#include "splittypes.h" +#include "s_util.h" +#include "util.h" +#include "str_util.h" +#include "str_replace.h" +#include "mb_splitter.h" +#include "message.h" +#include "mb_angdist.h" +#include "cmap_interp.h" +#include "lcgamm.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "xml_util.h" +#include "db/app_config.h" +#include "str_util.h" + +std::vector wu_database_id; +std::vector > bin_data; + +extern APP_CONFIG sah_config; + +int make_wu_headers(std::vector &tapebuffer, telescope_id +tel, std::vector &wuheader) { + int procid=getpid(); + double receiver_freq; + int bandno; + FILE *tmpfile; + char tmpstr[256]; + char buf[64]; + static const receiver_config &r(rcvr); + static const settings &s(splitter_settings); + bool group_is_vlar; + + if (!strncmp(s.splitter_cfg->data_type,"encoded", + std::min(static_cast(7),sizeof(s.splitter_cfg->data_type)))) { + noencode=0; + } else { + noencode=1; + } + + tapebuffer[0].header.samplerate*=1e+6; + seconds sample_time(1.0/tapebuffer[0].header.samplerate); + seti_time start_time(tapebuffer[0].header.data_time + -tapebuffer[0].data.size()*0.5*sample_time); + seti_time end_time(tapebuffer[tapebuffer.size()-1].header.data_time); + + + workunit_grp wugrp; + sprintf(wugrp.name,"%s.%ld.%d.%d.%d", + tapebuffer[0].header.name, + procid, + tapebuffer[0].header.dataseq, + tel-AO_430, + s.id); + wugrp.receiver_cfg=r; + wugrp.recorder_cfg=s.recorder_cfg; + wugrp.splitter_cfg=s.splitter_cfg; + wugrp.analysis_cfg=s.analysis_cfg; + + wugrp.data_desc.nsamples=NSAMPLES; + wugrp.data_desc.true_angle_range=0; + coordinate_t start_coord(cmap_interp(coord_history,start_time)); + coordinate_t end_coord(cmap_interp(coord_history,end_time)); + wugrp.data_desc.start_ra=start_coord.ra; + wugrp.data_desc.end_ra=end_coord.ra; + wugrp.data_desc.start_dec=start_coord.dec; + wugrp.data_desc.end_dec=end_coord.dec; + coordinate_t last_coord=start_coord; + double sample_rate=tapebuffer[0].header.samplerate/NSTRIPS; + + // find the bracketing entries in the coordinate history + std::map::iterator above(coord_history.upper_bound(end_time)); + std::map::iterator below(coord_history.lower_bound(start_time)); + std::map::iterator p; + if (above==coord_history.begin()) { + above++; + } + if (below==coord_history.end()) { + below=above; + below--; + } + if (above==below) { + below--; + } + // Calculate the angular distance the beam has traveled + for (p=below;p!=above;p++) + { + wugrp.data_desc.true_angle_range+=angdist(last_coord,p->second); + last_coord=p->second; + } + wugrp.data_desc.true_angle_range+=angdist(last_coord,end_coord); + if (wugrp.data_desc.true_angle_range==0) wugrp.data_desc.true_angle_range=1e-10; + // Calculate the number of unique signals that could be found in a workunit. + // We will use these numbers to calculate thresholds. + double numgauss=2.36368e+08/std::min(wugrp.data_desc.true_angle_range,10.0); + double numpulse=std::min(4.52067e+10/std::min(wugrp.data_desc.true_angle_range,10.0),2.00382e+11); + double numtrip=std::min(3.25215e+12/std::min(wugrp.data_desc.true_angle_range,10.0),1.44774e+13); + + // check for VLAR workunits + if (wugrp.data_desc.true_angle_range < 0.12) { + group_is_vlar=true; + } else { + group_is_vlar=false; + } + + + // if (useanalysiscfgid > 0) { + // log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Re-reading analysis cfg id: %d (set by user):\n",useanalysiscfgid); + // s.analysis_cfg = useanalysiscfgid; + // } + + // Calculate a unique key to describe this analysis config. + long keyuniq=floor(std::min(wugrp.data_desc.true_angle_range*100,1000.0)+0.5)+ + s.analysis_cfg.id*1024; + if ((keyuniq>((s.analysis_cfg.id+1)*1024)) ||(keyuniq<(s.analysis_cfg.id)*1024)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Invalid keyuniq value!\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%d %d %f\n",keyuniq,s.analysis_cfg.id,wugrp.data_desc.true_angle_range); + exit(1); + } + + keyuniq*=-1; + long save_keyuniq=keyuniq; + splitter_settings.analysis_cfg=wugrp.analysis_cfg; + sprintf(tmpstr,"where keyuniq=%d",keyuniq); + // Check if we've already done this analysis_config... + // Fetch through splitter_settings, since it's alias (s) is const. + splitter_settings.analysis_cfg.id=0; + splitter_settings.analysis_cfg->fetch(tmpstr); + + if (s.analysis_cfg->id==0) { + if (keyuniq != save_keyuniq) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"keyuniq value changed!\n"); + exit(1); + } + + // If not calculate the thresholds based upon the input analysis_config + // Triplets are distributed exponentially... + wugrp.analysis_cfg->triplet_thresh+=(log(numtrip)-29.0652); + + // Gaussians are based upon chisqr... + double p_gauss=lcgf(32.0,wugrp.analysis_cfg->gauss_null_chi_sq_thresh*32.0); + p_gauss-=(log(numgauss)-19.5358); + wugrp.analysis_cfg->gauss_null_chi_sq_thresh=invert_lcgf(p_gauss,32,1e-4)*0.03125; + + // Pulses thresholds are log of the probability + wugrp.analysis_cfg->pulse_thresh+=(log(numpulse)-24.7894); + + wugrp.analysis_cfg->keyuniq=keyuniq; + wugrp.analysis_cfg->insert(); + } else { + wugrp.analysis_cfg=s.analysis_cfg; + } + + strlcpy(wugrp.data_desc.time_recorded, + short_jd_string(start_time.jd().uval()), + sizeof(wugrp.data_desc.time_recorded)); + wugrp.data_desc.time_recorded_jd=start_time.jd().uval(); + wugrp.data_desc.coords.clear(); + + wugrp.data_desc.coords.push_back(start_coord); + for (p=below;p!=above;p++) + { + wugrp.data_desc.coords.push_back(p->second); + } + wugrp.data_desc.coords.push_back(end_coord); + + wugrp.tape_info->id=0; + sprintf(buf,"%d",tel-AO_ALFA_0_0); + wugrp.tape_info->fetch(std::string("where name=\'")+tapebuffer[0].header.name+"\' and beam="+buf); + wugrp.tape_info->start_time=tapebuffer[0].header.data_time.jd().uval(); + wugrp.tape_info->last_block_time=wugrp.tape_info->start_time; + wugrp.tape_info->last_block_done=tapebuffer[0].header.dataseq; + wugrp.tape_info->beam=tel-AO_ALFA_0_0; + + if (!nodb) { + if (wugrp.tape_info.id) { + if (!(wugrp.tape_info->update())) { + char buf[1024]; + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s",sql_error_message()); + exit(1); + } + } else { + strlcpy(wugrp.tape_info->name,tapebuffer[0].header.name,sizeof(wugrp.tape_info->name)); + wugrp.tape_info->insert(); + } + } + + if (!nodb) { + sqlint8_t wgid; + if ((wgid=wugrp.insert())<=0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Workunit_grp insert failed\nwgid=%d\nSQLCODE=%d\nLAST_NON_ZERO_SQLCODE=%d\n",wgid,sql_error_code(),sql_last_error_code()); + exit( 1 ); + } + wugrp.id=wgid; + } + int i; + wu_database_id.resize(NSTRIPS); + bin_data.resize(NSTRIPS); + wuheader.resize(NSTRIPS); + for (i=0;i\n"); + fprintf(tmpfile,wuheader[i].print_xml().c_str()); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to open file ./wu_inbox/%s, errno=%d\n",wuheader[i].name,errno); + exit(1); + } + bin_data[i].reserve(wuheaders[i].group_info->recorder_cfg->bits_per_sample* + wuheaders[i].group_info->data_desc.nsamples/8); + } + return(1); +} + + +void write_wufile_blocks(int nbytes) { + // doesn't do anything anymore. What was done here is done in output_samples. +} + +int filecopy(char *oldname,char *newname) { + FILE *oldfile,*newfile; + char buffer[16384]; + int nread; + if ((oldfile=fopen(oldname,"rb")) && (newfile=fopen(newname,"wb"))) { + do { + nread=fread(buffer,1,16384,oldfile); + fwrite(buffer,1,nread,newfile); + } while (nread>0); + fclose(oldfile); + fclose(newfile); + return 0; + } else { + return 1; + } +} + + + +void rename_wu_files() { + int i, retval; + char oldname[256],newname[1024]; + unsigned long sz; + DB_WORKUNIT db_wu; + const char *name[1]; + char *wudir="./wu_inbox"; + xml_encoding encoding=(noencode?_binary:_x_setiathome); + FILE *tmpfile; + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Fatal error in boinc_db.open\n"); + exit(1); + } + + for (i=0;i",tmpstr.size(), + xml_encoding_names[encoding]); + fwrite(tmpstr.c_str(),tmpstr.size(),1,tmpfile); + fprintf(tmpfile,"\n"); + fprintf(tmpfile,"\n"); + sz=bin_data[i].size(); + + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Header file no longer exists! splitter start script may be failing\n "); + exit(1); + } + if (!nodb) { + if (!filecopy(oldname,newname)) { + db_wu.clear(); + db_wu.opaque=wuheaders[i].id; + strncpy(db_wu.name,name[0],sizeof(db_wu.name)-2); + db_wu.appid=app.id; + //db_wu.rsc_fpops_est=2.79248e+13*6; + //db_wu.rsc_fpops_bound=4.46797e+14*6; + double beam=wuheaders[i].group_info->receiver_cfg->beam_width; + double ar=wuheaders[i].group_info->data_desc.true_angle_range; + double dur=(double)(wuheaders[i].group_info->data_desc.nsamples)/wuheaders[i].subband_desc.sample_rate; + double min_slew=wuheaders[i].group_info->analysis_cfg->pot_min_slew; + double max_slew=wuheaders[i].group_info->analysis_cfg->pot_max_slew; + if ( ar <= beam ) { + db_wu.rsc_fpops_est=9.193e+13; + } else if ( ar <= ( dur*min_slew ) ) { + db_wu.rsc_fpops_est=5.962e+13+2.296e+12/ar; + } else if ( ar <= ( dur*max_slew ) ) { + db_wu.rsc_fpops_est=5.749e+13+1.476e+13/ar; + } else { + db_wu.rsc_fpops_est=3.535e+13; + } + db_wu.rsc_fpops_est*=(0.333/wuheaders[i].group_info->analysis_cfg->chirp_resolution); + db_wu.rsc_fpops_bound=db_wu.rsc_fpops_est*10; + db_wu.rsc_memory_bound=33554432; + db_wu.rsc_disk_bound=33554432; + // Our minimum is a 40 MFLOP machine + db_wu.delay_bound=std::max(86400.0*7,db_wu.rsc_fpops_est/4e+7); + db_wu.min_quorum=sah_config.min_quorum; + db_wu.target_nresults=sah_config.target_nresults; + db_wu.max_error_results=sah_config.max_error_results; + db_wu.max_total_results=sah_config.max_total_results; + db_wu.max_success_results=sah_config.max_success_results; + strncpy(db_wu.app_name,appname,sizeof(db_wu.app_name)-2); + if (create_work(db_wu, + wu_template, + result_template_filename, + result_template_filepath, + name, + 1, + boinc_config, + NULL + ) + ) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"create work failed\n"); + exit(1); + } + //unlink(oldname); // we now *always* unlink + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"file copy failed\n"); + exit(1); + } + unlink(oldname); + } + } + boinc_db.close(); +} + +/* + * $Log: mb_wufiles.cpp,v $ + * Revision 1.1.2.6 2007/08/10 18:21:13 korpela + * *** empty log message *** + * + * Revision 1.1.2.5 2007/08/09 21:31:08 korpela + * *** empty log message *** + * + * Revision 1.1.2.4 2007/06/07 20:01:52 mattl + * *** empty log message *** + * + * Revision 1.1.2.3 2007/06/06 15:58:30 korpela + * *** empty log message *** + * + * Revision 1.1.2.2 2007/04/25 17:27:31 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:45 korpela + * *** empty log message *** + * + * Revision 1.29.2.14 2006/05/03 19:14:31 korpela + * Updated work estimates. + * + * Revision 1.29.2.13 2006/04/24 18:41:02 korpela + * *** empty log message *** + * + * Revision 1.29.2.12 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.29.2.11 2006/01/10 00:39:04 jeffc + * *** empty log message *** + * + * Revision 1.29.2.10 2006/01/05 23:55:22 korpela + * *** empty log message *** + * + * Revision 1.29.2.9 2005/12/05 22:11:40 korpela + * Fixed bug in flops estimate. + * + * Revision 1.29.2.8 2005/10/05 16:22:17 jeffc + * removed reference to old/new boolean for directory hash. + * + * Revision 1.29.2.7 2005/09/22 23:05:22 korpela + * Fixed threshold calculation. Was using chisqr rather than reduced chisqr. + * + * Revision 1.29.2.6 2005/09/21 22:11:23 korpela + * Updated Makefile.in for OpenSSL. + * Added dynamic threshold generation to wufiles.cpp. + * + * Revision 1.29.2.5 2005/08/01 17:47:38 korpela + * Type fixed. + * + * Revision 1.29.2.4 2005/08/01 17:43:20 korpela + * Refinement of FLOPS estimate for workunits. + * + * Revision 1.29.2.3 2005/07/26 17:17:01 korpela + * Typo fix + * + * Revision 1.29.2.2 2005/07/19 00:15:19 korpela + * Revised delay bound and FLOP estimate for setiathome_enhanced. + * + * Revision 1.29.2.1 2005/07/06 01:30:17 korpela + * Updated estimates of FPOPS per workunit for setiathome enhanced. + * + * Revision 1.29 2005/03/08 22:36:15 jeffc + * jeffc - fixed call to create_work() + * + * Revision 1.28 2005/02/15 23:06:47 korpela + * Fixed missing dir_hier symbol. + * + * Revision 1.27 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.26 2004/11/18 22:24:48 korpela + * *** empty log message *** + * + * Revision 1.25 2004/08/25 22:42:11 jeffc + * *** empty log message *** + * + * Revision 1.24 2004/08/14 04:44:26 jeffc + * *** empty log message *** + * + * Revision 1.23 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.22 2004/07/15 17:54:20 jeffc + * *** empty log message *** + * + * Revision 1.21 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/07/01 17:56:51 korpela + * *** empty log message *** + * + * Revision 1.19 2004/06/25 13:49:33 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/02 20:51:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/01/22 00:57:54 korpela + * *** empty log message *** + * + * Revision 1.14 2004/01/20 22:33:44 korpela + * *** empty log message *** + * + * Revision 1.13 2004/01/06 22:44:05 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/12 01:51:39 korpela + * Now using the opaque field in workunit to store SAH wuid. + * + * Revision 1.10 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.9 2003/11/25 21:59:53 korpela + * *** empty log message *** + * + * Revision 1.8 2003/11/11 06:20:30 korpela + * Increased max fpops_max to prevent timeout on windows clients + * + * Revision 1.7 2003/10/25 18:19:44 korpela + * *** empty log message *** + * + * Revision 1.6 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.3.2.2 2003/09/22 19:00:31 korpela + * *** empty log message *** + * + * Revision 1.3.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.4 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:44 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:36:00 korpela + * + * renames .C files to .cpp + * + * Revision 1.3 2003/06/05 15:52:47 korpela + * + * Fixed coordinate bug that was using the wrong zenith angle from the telescope + * strings when handling units from the gregorian. + * + * Revision 1.2 2003/06/03 01:01:18 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.8 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.7 2003/04/10 17:32:25 korpela + * *** empty log message *** + * + * Revision 3.6 2002/06/21 01:42:15 eheien + * *** empty log message *** + * + * Revision 3.5 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.4 2001/08/17 22:20:54 korpela + * *** empty log message *** + * + * Revision 3.3 2001/08/17 01:22:31 korpela + * *** empty log message *** + * + * Revision 3.2 2001/08/17 01:16:53 korpela + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.18 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.17 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.16 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.15 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.14 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.13 1999/02/11 16:46:28 korpela + * Added db access functions. + * + * Revision 2.12 1999/01/04 22:27:55 korpela + * Updated return codes. + * + * Revision 2.11 1998/12/14 23:41:44 korpela + * Added subband_base to work unit header. + * Changed frequency calculation. + * + * Revision 2.10 1998/12/14 21:55:07 korpela + * Added fft_len and ifft_len to work unit header. + * + * Revision 2.9 1998/11/13 23:58:52 korpela + * Modified for move of name field between structures. + * + * Revision 2.8 1998/11/13 22:18:12 davea + * *** empty log message *** + * + * Revision 2.7 1998/11/10 01:55:26 korpela + * Server requires a CR at the end of a WU file + * ??? + * + * Revision 2.6 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.5 1998/11/05 21:33:02 korpela + * Fixed angle_range bug. + * + * Revision 2.4 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.3 1998/11/02 21:20:58 korpela + * Modified for (internal) integer receiver ID. + * + * Revision 2.2 1998/11/02 18:45:39 korpela + * Changed location of timecvt.h + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 01:01:16 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/mb_wufiles.h b/splitter_fft/mb_wufiles.h new file mode 100644 index 0000000..5fb95e2 --- /dev/null +++ b/splitter_fft/mb_wufiles.h @@ -0,0 +1,46 @@ +/* + * + * Functions for managing wufiles and their data + * + * $Id: mb_wufiles.h,v 1.1.2.2 2007/04/25 17:20:28 korpela Exp $ + * + */ + + +extern std::vector > bin_data; + +int make_wu_headers(std::vector &tapebuffer, telescope_id tel, + std::vector &wuheader) ; +void write_wufile_blocks(int nbytes) ; +void rename_wu_files(); + +/* + * $Log: mb_wufiles.h,v $ + * Revision 1.1.2.2 2007/04/25 17:20:28 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:46 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:45 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:13:16 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/message.cpp b/splitter_fft/message.cpp new file mode 100644 index 0000000..d15181e --- /dev/null +++ b/splitter_fft/message.cpp @@ -0,0 +1,65 @@ +/* + * Functions for sending messages to stderr and log files. + * + * $Id: message.cpp,v 1.2.4.2 2006/12/14 22:24:46 korpela Exp $ + */ + +#include "sah_config.h" +#include +#include +#include + +#include "boinc_db.h" +#include "sched_config.h" +#include "sched_msgs.h" +#include "splitter.h" + +void message(char *msg) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s %s",tapeheaders[0].name,msg); +} + + + +/* + * $Log: message.cpp,v $ + * Revision 1.2.4.2 2006/12/14 22:24:46 korpela + * *** empty log message *** + * + * Revision 1.2.4.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:43 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:56:16 korpela + * Initial revision + * + */ diff --git a/splitter_fft/message.h b/splitter_fft/message.h new file mode 100644 index 0000000..6c51713 --- /dev/null +++ b/splitter_fft/message.h @@ -0,0 +1,40 @@ +/* + * Functions for sending messages to stderr and log files. + * + * $Id: message.h,v 1.1.4.1 2006/01/13 00:37:57 korpela Exp $ + */ + +#include "sched_msgs.h" + +void message(char *msg); + +/* + * $Log: message.h,v $ + * Revision 1.1.4.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:09:00 korpela + * Initial revision + * + */ diff --git a/splitter_fft/polyphase.cpp b/splitter_fft/polyphase.cpp new file mode 100644 index 0000000..57cbdd8 --- /dev/null +++ b/splitter_fft/polyphase.cpp @@ -0,0 +1,149 @@ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "fftw.h" +#include "wufiles.h" +#include "polyphase.h" +#include "dotransform.h" + +/* buffer for fft input/output */ +//float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) + +extern unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + +double *filter_r, *filter_i; +float *f_data; + +extern int obuf_pos; /* Tracks current postition in the output buffers */ + +void make_FIR (int n_points, int M, int window, double *output) { + /* Create Mth band lowpass FIR filter, n_points long. */ + + /* Modify this to give 8-bit quantized filter. */ + /* Also generate Hilbert transformed filter */ + + int n; + double q, p; + + for (n=0; n TAPE_DATA_SIZE) { + // End of frame crossed need to trasfer correctly + end_trans.frame++; + end_trans.byte-=TAPE_DATA_SIZE; + nsamp=(TAPE_DATA_SIZE-start_trans.byte)*(CHAR_BIT/2); + assert((nsamp+end_trans.byte*(CHAR_BIT/2)) == FFT_LEN); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf, nsamp); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(end_trans.frame,0),databuf+nsamp*2, + end_trans.byte*(CHAR_BIT/2)); + } else { + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf,FFT_LEN); + } + polyphase_seg(databuf); + // Go on to next transform + start_trans=end_trans; + } + // Check if we're at the end of the wu file. If so we print less bytes + if ((end_trans.frame>=end_of_wu->frame) && + (end_trans.byte>=end_of_wu->byte)) { + write_wufile_blocks(NBYTES % SAMPLES_PER_OBUF); + } else { + write_wufile_blocks(SAMPLES_PER_OBUF); + } + } while (!((end_trans.frame>=end_of_wu->frame) && (end_trans.byte>=end_of_wu->byte))); + + // Move the data in the buffer so we don't have to reread portions of the + // tape. + // + { + unsigned char *record_offset; + int copysize; + end_of_wu->frame-=WU_OVERLAP_FRAMES; + records_in_buffer=TAPE_RECORDS_IN_BUFFER- + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD); + record_offset=tapebuffer+ + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD)*TAPE_RECORD_SIZE; + copysize=records_in_buffer*TAPE_RECORD_SIZE; + bcopy(record_offset,tapebuffer,copysize); + } +} + + diff --git a/splitter_fft/polyphase.h b/splitter_fft/polyphase.h new file mode 100644 index 0000000..0393c38 --- /dev/null +++ b/splitter_fft/polyphase.h @@ -0,0 +1,26 @@ +#define NONE 0 +#define WELCH 1 +#define HANNING 2 + +#define N_WINDOWS 8 +#define P_FFT_LEN 256 + +/* buffer for fft input/output */ +extern float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) +#define TBUF_OFFSET(frame,byte) (tapebuffer+(frame)*TAPE_FRAME_SIZE+(byte)) +extern unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + +extern double *filter_r, *filter_i; +extern float *f_data; + +extern int obuf_pos; /* Tracks current postition in the output buffers */ + +void make_FIR (int n_points, int M, int window, double *output); +void polyphase_seg(float *data); +void do_polyphase(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu); + diff --git a/splitter_fft/randomdata.cpp b/splitter_fft/randomdata.cpp new file mode 100644 index 0000000..094315d --- /dev/null +++ b/splitter_fft/randomdata.cpp @@ -0,0 +1,77 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include + +#define NUM_FRAMES 200L +#define FRAME_DATA_SIZE (1024L*1024) +#define HEADER_SIZE 1024 +#define FILESIZE (NUM_FRAMES*(FRAME_DATA_SIZE+HEADER_SIZE)) + +char header[HEADER_SIZE]; + +int main(void) { + int i; + int datapos=0; + int frameseq=0; + long written=0; + int on=0; + struct tm *tm; + unsigned char data; + + char tmpstr[256]; + char telstr[256]; + double time0=(double)time(0); + time_t clock; + + srandom(time(0)); + + for (written=0;writtentm_year,tm->tm_yday,tm->tm_hour,tm->tm_min,tm->tm_sec,(int)((time0-floor(time0))*100)); + strcpy(header+headerpos,tmpstr); + headerpos+=strlen(tmpstr)+1; + if (!((frameseq-1)%5)) { + sprintf(telstr,"TELSTR=%.2d%.3d%.2d%.2d%.2d 0.0 0.0 15.0",tm->tm_year,tm->tm_yday,tm->tm_hour,tm->tm_min,tm->tm_sec); + } + strcpy(header+headerpos,telstr); + headerpos+=strlen(telstr)+1; + strcpy(header+headerpos,"RECEIVER=ao1420"); + headerpos+=strlen("RECEIVER=ao1420")+1; + strcpy(header+headerpos,"SAMPLERATE=2.5000"); + headerpos+=strlen("SAMPLERATE=2.5000")+1; + strcpy(header+headerpos,"CENTERFREQ=1420.0"); + headerpos+=strlen("CENTERFREQ=1420.0")+1; + strcpy(header+headerpos,"VER=1.00"); + headerpos+=strlen("VER=1.00")+1; + strcpy(header+headerpos,"NUMRINGBUFS=4"); + headerpos+=strlen("NUMRINGBUFS=4")+1; + strcpy(header+headerpos,"NUMDISKBUFS=2"); + headerpos+=strlen("NUMDISKBUFS=2")+1; + strcpy(header+headerpos,"EOH="); + write(stdout->_file, header, HEADER_SIZE); + for(i=0;i_file, &data, 1); + } + time0+=(1024.0*1024.0*4.0/2.5e6); + } +} + diff --git a/splitter_fft/readheader.cpp b/splitter_fft/readheader.cpp new file mode 100644 index 0000000..6a82fc2 --- /dev/null +++ b/splitter_fft/readheader.cpp @@ -0,0 +1,225 @@ +/* + * Functions for reading tape and work unit headers + * + * This file currently assumes that the reciever is at Arecibo. + * + * $Id: readheader.cpp,v 1.3.4.2 2006/12/14 22:24:47 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include + +#include "splitter.h" +#include "splitparms.h" +#include "splittypes.h" +#include "message.h" +#include "timecvt.h" +#include "coordcvt.h" + +/* Read a tape header at buffer into a tapeheader_t */ +int read_tape_header(char *buffer, tapeheader_t *header) +{ + static char *receivers[]={"","synthetic","ao1420"}; + int done=0,len; + int pos=0,i; + char tmpstr[256]; + double dummy; + unsigned int firstdata; + + do { + len=strlen(buffer+pos)+1; + if (!strncmp(buffer+pos,"EOH=",4)) { + done=1; + } else if (!strncmp(buffer+pos,"NAME=",5)) { + strncpy(tmpstr,buffer+pos+5,36); + i=0; + while(!isalnum(tmpstr[i])) i++; + strncpy(header->name,tmpstr+i,36); + } else if (!strncmp(buffer+pos,"RCDTYPE=",8)) { + sscanf(buffer+pos+8,"%d",&(header->rcdtype)); + } else if (!strncmp(buffer+pos,"FRAMESEQ=",9)) { + sscanf(buffer+pos+9,"%lu",&(header->frameseq)); + } else if (!strncmp(buffer+pos,"DATASEQ=",8)) { + sscanf(buffer+pos+8,"%lu",&(header->dataseq)); + } else if (!strncmp(buffer+pos,"NUMRINGBUFS=",12)) { + sscanf(buffer+pos+12,"%d",&(header->numringbufs)); + } else if (!strncmp(buffer+pos,"NUMDISKBUFS=",12)) { + sscanf(buffer+pos+12,"%d",&(header->numdiskbufs)); + } else if (!strncmp(buffer+pos,"MISSED=",7)) { + sscanf(buffer+pos+7,"%d",&(header->missed)); + } else if (!strncmp(buffer+pos,"AST=",4)) { + sscanf(buffer+pos+4,"%2d%3d%2d%2d%2d%2d", + &(header->st.y), &(header->st.d), &(header->st.h), + &(header->st.m), &(header->st.s), &(header->st.c)); + header->st.tz=AST; + } else if (!strncmp(buffer+pos,"TELSTR=",7)) { + sscanf(buffer+pos+7,"%2d%3d%2d%2d%2d %lf %lf %lf", + &(header->telstr.st.y), &(header->telstr.st.d), + &(header->telstr.st.h), &(header->telstr.st.m), + &(header->telstr.st.s), &(header->telstr.az), + gregorian?&(header->telstr.alt):&dummy, + gregorian?&dummy:&(header->telstr.alt)); + header->telstr.alt=90.0-header->telstr.alt; + header->telstr.st.tz=AST; + header->telstr.st.c=0; + } else if (!strncmp(buffer+pos,"RECEIVER=",9)) { + i=1; + while ((!strstr(buffer+pos+9,receivers[i])) && (++isource=0; + } else { + header->source=i; + } + } else if (!strncmp(buffer+pos,"CENTERFREQ=",11)) { + sscanf(buffer+pos+11,"%lf",&(header->centerfreq)); + header->centerfreq*=1e6; + } else if (!strncmp(buffer+pos,"SAMPLERATE=",11)) { + sscanf(buffer+pos+11,"%lf",&(header->samplerate)); + header->samplerate*=1e6; + } else if (!strncmp(buffer+pos,"VER=",4)) { + strncpy(&(header->version[0]),&(buffer[pos+4]),16); + } else if (len>1) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Unknown header field: %40s\n",buffer+pos); + } + pos+=len; + } while (!done && (posst)); + header->st.jd-=(float)RECORDER_BUFFER_SAMPLES/header->samplerate/86400; + st_time_convert(&(header->telstr.st)); + telstr_coord_convert(&(header->telstr),ARECIBO_LAT,ARECIBO_LON); + +/* + * Fix a bug in recorder versions prior to 1.30 + */ + + if (atof(&(header->version[0]))<1.299) { + header->centerfreq-=2.0; + } + +/* + * Check for blank tape + */ + firstdata=*(unsigned int *)(buffer+TAPE_HEADER_SIZE); + if (!(firstdata & 0x55555555) || !(firstdata & 0xaaaaaaaa) || + ((firstdata & 0x55555555) == 0x55555555) || + ((firstdata & 0xaaaaaaaa) == 0xaaaaaaaa)) { + header->missed++; + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Possible data problem...data[0] = 0x%x\n",firstdata); + } + + return(1); +} + +/* Read a work unit header from a FILE into a wuheader_t */ +//int read_wu_header(FILE *file, wuheader_t *header) { +/* to be implemented. Don't need it yet. */ +// return(0); +//} + +int parse_tape_headers(unsigned char *tapebuffer, tapeheader_t *tapeheaders) { + int i; + + for (i=0;i +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "util.h" +#include "splitparms.h" +#include "splitter.h" +#include "message.h" +#include "readheader.h" +#include "readtape.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "str_util.h" +#include "str_replace.h" + +int is_tape; + +static tape tape_info; + +int current_record; +static int tape_fd; +struct mtget tape_status; + +static void update_checkpoint() { + FILE *file=fopen("rcd.chk","w"); + if (file) { + fprintf(file,"%d\n",current_record); + fclose(file); + } +} + +int read_checkpoint() { + FILE *file=fopen("rcd.chk","r"); + int retval=0; + if (file) { + fscanf(file,"%d",&retval); + fclose(file); + } + return(retval); +} + +int tape_busy() { +/* Check if tape is busy. If so return 1 else return 0 + */ + if (is_tape) { + if (ioctl(tape_fd,MTIOCGET,&tape_status) != -1) { + return (tape_status.mt_dsreg); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to get tape status\n"); + return (1); + } + } else { + return (0); + } +} + +int tape_eject() { +/* Rewind and eject the tape. Return 1 if sucessful else return 0 + */ + struct mtop op={MTOFFL,1}; + + close(tape_fd); + if (is_tape) { + while (tape_busy()) sleep(1); + if (ioctl(tape_fd,MTIOCTOP,&op)==-1) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to eject tape\n"); + return(0); + } else { + return(1); + } + } else { + return(1); + } +} + + +int tape_rewind() { +/* Rewind to beginning of tape. Return 1 if sucessful, 0 if failure + */ + struct mtop op={MTREW, 1}; + if (is_tape) { + while (tape_busy()) sleep(1); + if (ioctl(tape_fd,MTIOCTOP,&op)!=-1) { + current_record=0; + update_checkpoint(); + } else { + current_record=-1; + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Tape rewind failed\n"); + } + } else { + if (lseek(tape_fd, 0, SEEK_SET)!=-1) { + current_record=0; + update_checkpoint(); + } else { + current_record=-1; + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"File rewind failed\n"); + } + } + return (!current_record); +} + + + +int open_tape_device(char *device) { +/* opens a device, checks if it is a tape device. If so, sets is_tape + * flag. If not, it resets the flag. All tape routines check this flag + * so routines will work for both tapes and files + */ + + + int fd, errcnt=0; + struct mtop op={MTNOP,1}; + + if ((fd=open(device, O_RDONLY|0x2000, 0777))!=-1) { + tape_fd=fd; + if (ioctl(tape_fd,MTIOCGET,&tape_status) != -1) { + is_tape = 1; + } else { + is_tape = 0; + } + while (!norewind && !tape_rewind() && errcnt<10 ) errcnt++; + if (!nodb && resumetape) { + tape_rewind(); + fill_tape_buffer(tapebuffer,TAPE_RECORDS_IN_BUFFER); + parse_tape_headers(tapebuffer, &(tapeheaders[0])); + if (!tape_info.id) { + if (!tape_info.fetch(std::string("where name=\'")+tapeheaders->name+"\'")) { + tape_info.start_time=tapeheaders->st.jd; + tape_info.last_block_time=tapeheaders->st.jd; + tape_info.last_block_done=tapeheaders->frameseq; + strlcpy(tape_info.name,tapeheaders->name,sizeof(tape_info.name)); + tape_info.insert(); + } + } + startblock=tape_info.last_block_done/TAPE_FRAMES_PER_RECORD; + } + if (norewind) { + startblock=MAX(read_checkpoint()-TAPE_RECORDS_IN_BUFFER,0); + tape_rewind(); + } + if (startblock) { + return select_record(startblock); + } + return (1); + } else { + perror( NULL ); + return (0); + } +} + +int select_record(int record_number) { +/* seeks to a specific record number returns 1 if successful */ + int diff; + struct mtop op; + char tmpstr[100]; + off64_t off,offset; + + if ((current_record<0) && !tape_rewind()) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Tape error: position lost and unable to rewind!\n"); + return(0); + } + + diff=record_number-current_record; + + if (is_tape) { + if (diff==0) return (1); + if (diff>0) { + op.mt_op=MTFSR; + op.mt_count=diff; + } else { + op.mt_op=MTBSR; + op.mt_count=diff; + } + if (ioctl(tape_fd,MTIOCTOP,&op)==-1) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Tape error: unable to position to record %d errno=%d\n", + record_number,errno); + current_record=-1; + return(0); + } else { + current_record+=diff; + update_checkpoint(); + return(1); + } + } else { + current_record=record_number; + update_checkpoint(); + offset = record_number; + offset *= TAPE_RECORD_SIZE; + //fprintf( stderr, "offset: %lld", offset ); + off=lseek64(tape_fd,offset,SEEK_SET) ; + //fprintf( stderr, "off: %lld", offset ); + return (off != -1); + } +} + +int tape_read_record(char *buffer) { + int bytesread=0; + int i; + + while (tape_busy()) sleep(1); + + do { + i=read(tape_fd,buffer+bytesread,TAPE_RECORD_SIZE); + if (i>0) bytesread+=i; + } while ((bytesread0)); + + if (i==0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"End of tape. Please insert new tape\n"); + current_record=-1; + return(0); + } + + if (i<0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Tape error.\n"); + current_record=-1; + return(0); + } + + current_record++; + update_checkpoint(); + return(1); +} + +int fill_tape_buffer(unsigned char *buffer, int n_records) { + int i; + long record; + char tmpstr[100]; + + for (i=0;i + +#define WU_SUBDIR "/download" + +#define SPLITTER_VERSION 0x0012 +#define MAX_WUS_ONDISK 500000 +#define N_SIMULT_SPLITTERS 6 + +/* Work Unit Parameters */ +#define NBYTES 262144L +#define NSAMPLES (NBYTES*CHAR_BIT/2) +#define MAX_POSITION_HISTORY 40 +#define WU_FILESIZE (360L*1024) + +/* FFT Parameters */ +#define FFT_LEN 2048 +#define IFFT_LEN 8 +#define NSTRIPS (FFT_LEN/IFFT_LEN) + +/* Tape format parameters */ +#define TAPE_HEADER_SIZE 1024L +#define TAPE_DATA_SIZE 1048576L +#define TAPE_FRAMES_PER_RECORD 8L +#define TAPE_FRAME_SIZE (TAPE_HEADER_SIZE+TAPE_DATA_SIZE) +#define TAPE_RECORD_SIZE (TAPE_FRAMES_PER_RECORD*TAPE_FRAME_SIZE) +#define TAPE_BUFFER_SIZE (((NSTRIPS*NBYTES*7/4)/TAPE_RECORD_SIZE+1)*TAPE_RECORD_SIZE) +#define TAPE_RECORDS_IN_BUFFER (TAPE_BUFFER_SIZE/TAPE_RECORD_SIZE) +#define TAPE_FRAMES_IN_BUFFER (TAPE_RECORDS_IN_BUFFER*8) +#define TAPE_FRAMES_PER_WU (NBYTES*NSTRIPS/TAPE_DATA_SIZE) +#define WU_OVERLAP_RECORDS 2 +#define WU_OVERLAP_FRAMES (TAPE_FRAMES_PER_RECORD*WU_OVERLAP_RECORDS) +#define WU_OVERLAP_BYTES (WU_OVERLAP_FRAMES*TAPE_DATA_SIZE) +#define RECORDER_BUFFER_BYTES (1024L*1024L) +#define RECORDER_BUFFER_SAMPLES (RECORDER_BUFFER_BYTES*4) + + +/* Time Zone Parameters */ +#define UTC 0.0 +#define AST (UTC-4.0) + +/* Arecibo Observatory Parameters */ +#define ARECIBO_LAT 18.3538056 +#define ARECIBO_LON (-66.7552222) + +#endif +/* + * $Log: splitparms.h,v $ + * Revision 1.10 2004/11/23 21:26:29 jeffc + * *** empty log message *** + * + * Revision 1.9 2004/08/14 04:44:26 jeffc + * *** empty log message *** + * + * Revision 1.8 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.7 2004/05/22 18:12:18 korpela + * *** empty log message *** + * + * Revision 1.6 2003/10/27 17:53:21 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/26 20:48:51 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.3.2.1 2003/09/22 17:39:34 korpela + * *** empty log message *** + * + * Revision 1.4 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.1 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.9 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.8 1999/10/20 19:20:26 korpela + * *** empty log message *** + * + * Revision 2.7 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.6 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.4 1999/02/23 18:57:09 korpela + * *** empty log message *** + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * Changed version number. + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added WU_FILESIZE, RECORDER_BUFFER_BYTES, RECORDER_BUFFER_SAMPLES.` + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.4 1998/10/27 01:10:04 korpela + * Bug fixes. + * + * Revision 1.3 1998/10/19 23:06:40 korpela + * Added UTC and AST definition. + * Added ARECIBO_LAT and ARECIBO_LON definitions. + * + * Revision 1.2 1998/10/16 19:22:14 korpela + * Reduced WU file size from 512K to 256K. + * + * Revision 1.1 1998/10/15 16:39:51 korpela + * Initial revision + * + */ + diff --git a/splitter_fft/splitter.cpp b/splitter_fft/splitter.cpp new file mode 100644 index 0000000..c4cea44 --- /dev/null +++ b/splitter_fft/splitter.cpp @@ -0,0 +1,717 @@ +/* + * + * The splitter main program. + * + * $Id: splitter.cpp,v 1.22.2.6 2007/06/06 15:58:30 korpela Exp $ + * + */ + +#include "sah_config.h" +#undef USE_MYSQL +#include +#include +#include +#include +#include +#include +#include + +#include "boinc_db.h" +#include "crypt.h" +#include "backend_lib.h" +#include "sched_config.h" +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "validrun.h" +#include "makebufs.h" +#include "readtape.h" +#include "readheader.h" +#include "wufiles.h" +#include "dotransform.h" +#include "polyphase.h" +#include "message.h" +#include "sqlrow.h" +#include "sqlapi.h" +#include "db/db_table.h" +#include "db/schema_master.h" +#include "db/app_config.h" + +extern "C" { + int sqldetach(); +} + +char trigger_file_path[1024]="/disks/setifiler1/wutape/tapedir/splitter_stop"; + +SCHED_CONFIG boinc_config; +DB_APP app; +R_RSA_PRIVATE_KEY key; + + +// TEMPLATE DEFS ------------------------------------------------------ +// IMPORTANT: a change to a template should *always* include a change +// to the template filename. Only the result template is used now. +const char *wu_template_filename_id = "wu_0.xml"; +const char *wu_template= + "\n" + " 0\n" + "\n" + "\n" + " \n" + " 0\n" + " work_unit.sah\n" + " \n" + "\n"; + +const char *result_template_filename_id = "result_0.xml"; +const char *result_template= + "\n" + " \n" + " \n" + " \n" + " 65536\n" + " http://setiboincdata.ssl.berkeley.edu/sah_cgi/file_upload_handler\n" + "\n" + "\n" + " \n" + " \n" + " result.sah\n" + " \n" + "\n"; +// END TEMPLATE DEFS -------------------------------------------------- + +unsigned char *tapebuffer; /* A buffer for a tape section */ +workunit wuheaders[NSTRIPS]; +tapeheader_t tapeheaders[TAPE_FRAMES_IN_BUFFER]; +int max_wus_ondisk=MAX_WUS_ONDISK; +int nodb; +int noencode; +int resumetape; +int norewind; +int startblock; +int dataclass; +int atnight; +int gregorian; +int output_xml; +int polyphase; +int iters=-1; +int filter_window = 0; +double start_time; +double stop_time; +unsigned long minvfsbuf=-1; +char wd[1024]; +//char * scidb = NULL; +char * projectdir = NULL; + +APP_CONFIG sah_config; + +//const char *result_template_filename="projectdir"/"SAH_APP_NAME"_result.tpl"; +char result_template_filename[1024]; +char result_template_filepath[1024]; +char wu_template_filename[1024]; + +int check_for_halt(); +int wait_until_night(); +int check_free_disk_space(); +int wait_for_db_wus_ondisk(); + +void cprint(char *p) { + printf("%s\n",p); +} + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ + +FILE *wulog,*errorlog; +buffer_pos_t start_of_wu,end_of_wu; /* position of start and end of wu in + tape buffer */ +int seqno; +int records_in_buffer; + +void cleanup(void) { + FILE *tmpfile; + if ((tmpfile=fopen("seqno.dat","w"))) { + fprintf(tmpfile,"%d\n",seqno); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Unable to open seqno.dat for write\n"); + } +} + + +int process_command_line(int argc, char *argv[],char **tape_device, + int *norewind, int *startblock, int *resumetape, + int *nodb, int *dataclass, int *atnight, + int *max_wus_ondisk, char **projectdir, + int *iters) { + int nargs=0,i; + char *ep; + for (i=1;itm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)) { + sleep(100); + } + } while ((lt->tm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)); + return 0; +} + +int check_free_disk_space() { + struct statvfs vfsbuf; + + /* check disk free space */ + statvfs("wu_inbox/.",&vfsbuf); + if (vfsbuf.f_bavail < (100000*1024/vfsbuf.f_frsize)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Not enough free disk space in working directory to continue\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Not enough free disk space in working directory to continue\n"); + exit(EXIT_FAILURE); + } + return 0; +} + +int wait_for_db_wus_ondisk() { + int wus_ondisk,rv; + + // The boinc db query below takes a long time. Until we fix this, + // we will do it only every 100 times into this routine. All other + // calls here will assume that we need to add WUs. -- jeffc + static int check_count = 100; + if (check_count < 100) { + check_count++; + return 0; + } else { + check_count = 0; + } + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"boinc_db.open\n"); + exit(1); + } + do { + DB_RESULT boinc_result; + char query[1024]; + sprintf(query,"where appid=%d and server_state=2",app.id); + rv=boinc_result.count(wus_ondisk,query); + if (rv) { + boinc_db.print_error("boinc_result.count"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"DB Error, unable to count workunits on disk\n"); + exit(EXIT_FAILURE); + } + check_for_halt(); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%d WUs ondisk\n", wus_ondisk); + if (wus_ondisk>sah_config.max_wus_ondisk) sleep(600); + } while (wus_ondisk>sah_config.max_wus_ondisk); + + return 0; +} + +/* + * $Log: splitter.cpp,v $ + * Revision 1.22.2.6 2007/06/06 15:58:30 korpela + * *** empty log message *** + * + * Revision 1.22.2.5 2006/12/14 22:24:48 korpela + * *** empty log message *** + * + * Revision 1.22.2.4 2006/11/08 20:16:26 vonkorff + * Fixes an error message. + * + * Revision 1.22.2.3 2006/11/07 19:26:37 vonkorff + * Fixed lcgf + * + * Revision 1.22.2.2 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.22.2.1 2005/08/01 21:16:25 jeffc + * *** empty log message *** + * + * Revision 1.22 2005/01/27 23:03:27 mattl + * + * commented out tf=0 in check_for_halt + * + * Revision 1.21 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.19 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/27 21:07:04 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/20 18:56:48 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.14 2004/04/08 22:25:47 jeffc + * *** empty log message *** + * + * Revision 1.13 2004/01/22 00:57:53 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.10 2003/11/25 21:59:52 korpela + * *** empty log message *** + * + * Revision 1.9 2003/11/01 20:54:02 korpela + * *** empty log message *** + * + * Revision 1.8 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.7 2003/09/26 20:48:51 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.5.2.2 2003/09/23 00:49:12 korpela + * *** empty log message *** + * + * Revision 1.5.2.1 2003/09/22 17:39:34 korpela + * *** empty log message *** + * + * Revision 1.6 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/13 20:48:38 korpela + * directory reorg. Moved client files to ./client + * + * Revision 1.4 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/08/13 23:18:47 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:50 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.6 2003/05/21 00:41:42 korpela + * *** empty log message *** + * + * Revision 3.5 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.4 2003/04/09 17:46:54 korpela + * *** empty log message *** + * + * Revision 3.3 2002/06/20 22:09:17 eheien + * *** empty log message *** + * + * Revision 3.2 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.6 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added dataclass paramter. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added some db access functions. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:58:16 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/splitter.h b/splitter_fft/splitter.h new file mode 100644 index 0000000..46b73b3 --- /dev/null +++ b/splitter_fft/splitter.h @@ -0,0 +1,132 @@ +/* + * splitter.h + * + * Global definitions from the splitter main program. + * + * $Id: splitter.h,v 1.6.2.1 2006/01/13 00:37:58 korpela Exp $ + * + */ + +#ifndef SPLITTER_H +#define SPLITTER_H + +#include "splitparms.h" +#include "splittypes.h" + +#define MAX(x,y) ( ((x)<(y)) ? (y) : (x) ) +#define MIN(x,y) ( ((y)<(x)) ? (y) : (x) ) + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ +#include "boinc_db.h" +#include "crypt.h" +#include "backend_lib.h" +#include "sched_config.h" + +extern SCHED_CONFIG boinc_config; +extern DB_APP app; +extern R_RSA_PRIVATE_KEY key; +extern FILE *wulog,*errorlog; +extern workunit wuheaders[NSTRIPS]; +extern tapeheader_t tapeheaders[TAPE_FRAMES_IN_BUFFER]; +extern int noencode; +extern int dataclass; +extern int nodb; +extern int resumetape; +extern int startblock; +extern int norewind; +extern int output_xml; +extern int polyphase; +extern int wu_database_id[NSTRIPS]; +extern int gregorian; +extern char * projectdir; +extern char trigger_file_name[1024]; + + +/* Buffer that holds tape data */ +extern unsigned char *tapebuffer; + +/* Number of records remaining in the buffer after WU creations is complete */ +extern int records_in_buffer; + +extern const char *wu_template; +extern const char *result_template; +// jeffc +//extern const char *result_template_filename; +extern char result_template_filename[]; +extern char result_template_filepath[]; +extern char wu_template_filename[]; + +/* Persistant sequence number of wu file */ +extern int seqno; + +#endif + +/* + * $Log: splitter.h,v $ + * Revision 1.6.2.1 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.6 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.5 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.4 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.2.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/10/20 19:20:26 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * Added nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:10:32 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/splittypes.h b/splitter_fft/splittypes.h new file mode 100644 index 0000000..46e4b37 --- /dev/null +++ b/splitter_fft/splittypes.h @@ -0,0 +1,111 @@ +/* splittypes.h + * + * Type definitions specific to the splitter. + * + * + * $Id: splittypes.h,v 1.4 2003/08/05 17:23:43 korpela Exp $ + * + */ +#ifndef SPLITTYPES_H +#define SPLITTYPES_H + +#include + +#include "splitparms.h" +#include "s_util.h" +#include "seti_header.h" + +//typedef struct wuheader { + //WU_INFO wuhead; + //SETI_WU_INFO wuinfo; +//} wuheader_t; + +typedef struct tapeheader { + char name[36]; + int rcdtype; + int numringbufs; + int numdiskbufs; + unsigned long frameseq; + unsigned long dataseq; + int missed; + TIME st; + SCOPE_STRING telstr; + int source; + double centerfreq,samplerate; + char version[16]; +} tapeheader_t; + +typedef struct buffer_pos { + int frame; + long byte; +} buffer_pos_t; + +#endif +/* + * $Log: splittypes.h,v $ + * Revision 1.4 2003/08/05 17:23:43 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.3 2003/07/29 20:35:51 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:41 korpela + * + * Again + * + * Revision 3.1 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.4 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.3 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * Moved tape_version and encoding_type into SETI_WU_INFO. + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.7 1998/10/30 21:01:13 davea + * *** empty log message *** + * + * Revision 1.6 1998/10/27 01:10:58 korpela + * Modified tapeheader_t to match new tape header fields. + * + * Revision 1.5 1998/10/19 23:04:32 korpela + * Moved times in telstr_t into an st_t. + * Changed name of ast_t to st_t. + * Added time zone (tz) field to ast_t. + * + * Revision 1.4 1998/10/15 19:13:30 korpela + * Renamed "unix" fields to "unix_time" because of GCC #define. + * Added position_history field to wuheader_t. + * + * Revision 1.3 1998/10/15 18:58:50 korpela + * Added time_t unix to ast_t and telstr_t types. + * Changed times in wuheader_t to time_t types. + * + * Revision 1.2 1998/10/15 18:01:19 korpela + * Removed month field from ast_t and telstr_t. + * + * Revision 1.1 1998/10/15 16:20:24 korpela + * Initial revision + * + */ diff --git a/splitter_fft/squarewave.cpp b/splitter_fft/squarewave.cpp new file mode 100644 index 0000000..7ac379d --- /dev/null +++ b/splitter_fft/squarewave.cpp @@ -0,0 +1,75 @@ +#include "sah_config.h" +#include +#include +#include +#include +#include +#include + +#define NUM_FRAMES 200L +#define FRAME_DATA_SIZE (1024L*1024) +#define HEADER_SIZE 1024 +#define FILESIZE (NUM_FRAMES*(FRAME_DATA_SIZE+HEADER_SIZE)) + +char header[HEADER_SIZE]; + +int main(void) { + int i; + int datapos=0; + int frameseq=0; + long written=0; + int on=0; + struct tm *tm; + char data; + + char tmpstr[256]; + char telstr[256]; + double time0=(double)time(0); + time_t clock; + + for (written=0;writtentm_year,tm->tm_yday,tm->tm_hour,tm->tm_min,tm->tm_sec,(int)((time0-floor(time0))*100)); + strcpy(header+headerpos,tmpstr); + headerpos+=strlen(tmpstr)+1; + if (!((frameseq-1)%5)) { + sprintf(telstr,"TELSTR=%.2d%.3d%.2d%.2d%.2d 0.0 0.0 15.0",tm->tm_year,tm->tm_yday,tm->tm_hour,tm->tm_min+(tm->tm_sec>57),(tm->tm_sec+2)%60); + } + strcpy(header+headerpos,telstr); + headerpos+=strlen(telstr)+1; + strcpy(header+headerpos,"RECEIVER=ao1420"); + headerpos+=strlen("RECEIVER=ao1420")+1; + strcpy(header+headerpos,"SAMPLERATE=2.5000"); + headerpos+=strlen("SAMPLERATE=2.5000")+1; + strcpy(header+headerpos,"VER=1.00"); + headerpos+=strlen("VER=1.00")+1; + strcpy(header+headerpos,"CENTERFREQ=1420.0"); + headerpos+=strlen("CENTERFREQ=1420.0")+1; + strcpy(header+headerpos,"NUMRINGBUFS=4"); + headerpos+=strlen("NUMRINGBUFS=4")+1; + strcpy(header+headerpos,"NUMDISKBUFS=2"); + headerpos+=strlen("NUMDISKBUFS=2")+1; + strcpy(header+headerpos,"EOH="); + write(stdout->_file, header, HEADER_SIZE); + for(i=0;i_file, &data, 1); + } + time0+=(1024.0*1024.0*4.0/2.5e6); + } +} + diff --git a/splitter_fft/tools/disksplitter b/splitter_fft/tools/disksplitter new file mode 100755 index 0000000..a4bc323 --- /dev/null +++ b/splitter_fft/tools/disksplitter @@ -0,0 +1,121 @@ +#! /bin/tcsh -x + +set PATH=/opt/misc:/opt/misc/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/openwin/bin/xview:/usr/lang:/usr/ucb:/bin:/usr/bin:/usr/local/bin:/usr/hosts:/usr/bin/X11:/usr/casual/sparc:/usr/etc:/usr/local/lib/tex/bin:/usr/local/lib/frame/bin:/disks/asimov/a/apps/informix/bin:.:/disks/albert/d/office/bin:/usr/ucb:/disks/albert/e/users/eurd/data_analysis/bin:/usr/local/lib/g++-include.bak:/disks/siren/a/users/seti/s4/siren/bin:/disks/albert/d/orfeus:/disks/albert/d/chips:/disks/asimov/a/apps/informix/bin:/usr/local/tex +# export PATH +set LD_LIBRARY_PATH=/usr/lib/X11:/usr/openwin/lib:/usr/lib:/lib:/disks/islay/a/users/korpela/bin/lib:/disks/asimov/a/apps/informix/lib:/disks/asimov/a/apps/informix/lib/esql +# export LD_LIBRARY_PATH +set INFORMIXDIR=/disks/asimov/a/apps/informix +# export INFORMIXDIR +set INFORMIXSERVER=ejk_tcp +# export INFORMIXSERVER + +set SPLIT_PROG_LOC=/disks/milkyway/a/users/anderson/seti/splitter/bin/ +set SPLIT_PROG_NAME=splitter +set SPLIT_LOG_LOC=/disks/milkyway/a/users/anderson/seti/sethi/hi_tape_logs/ +# set HI_TAPE_DIR=/disks/philmor/a/users/eheien/hitest/ +set SPLIT_TAPE_DIR=/disks/setifiler1/wutape/tapedir/ +set SPLIT_SUFFIX=.split +set HIDONE_SUFFIX=.hidone +set SPLITDONE_SUFFIX=.splitdone +set EMAIL_LIST="jeffc@ssl.berkeley.edu mattl@ssl.berkeley.edu" +set FOUND_FILE=0 +set HOST=`hostname` +set SPLIT_HALT_MSG=splitter_stop + +# Check to see if this machine is already running the splitter program +set PROG_RUNNING=`/usr/ucb/ps -auxww | grep "$SPLIT_PROG_NAME" | grep -v "disksplitter" | wc | awk '{print $1}'` +echo "$PROG_RUNNING" +if( $PROG_RUNNING > 1 ) then + echo "Splitter is already running on this machine. Quitting." + exit +endif + +# Get rid of all .split files here with HOSTNAME in them(?) + +while ( ! -f $SPLIT_TAPE_DIR$SPLIT_HALT_MSG ) + +set FOUND_FILE=0 +cd $SPLIT_TAPE_DIR + +set FILE_LIST=`ls . | grep ".tape" | grep -v "done" | grep -v "reading" | grep -v "hi" | grep -v "msg" | grep -v "split"` + +if( -z "$FILE_LIST" ) then + exit +endif + +foreach file ($FILE_LIST) + if ( $FOUND_FILE == 0 && ! -f $file$SPLITDONE_SUFFIX ) then + if( -f $file$SPLIT_SUFFIX ) then + set FOUND_FILE=0 + else + echo $HOST > $file$SPLIT_SUFFIX + set TAPE_FILE=$file + set SPLIT_FILE=$SPLIT_TAPE_DIR$file + set SPLIT_MARK_FILE=$SPLIT_TAPE_DIR$file$SPLIT_SUFFIX + set HI_DONE_FILE=$SPLIT_TAPE_DIR$file$HIDONE_SUFFIX + set SPLIT_DONE_FILE=$SPLIT_TAPE_DIR$file$SPLITDONE_SUFFIX + set FOUND_FILE=1 + endif + endif +end + +cd /mydisks/a/servers/splitter/ +/bin/rm -f error.log rcd.chk +touch error.log +touch rcd.chk + +if ( $FOUND_FILE == 0 ) then +# echo "" | /usr/ucb/mail -s"no more splitter tape files" $EMAIL_LIST + exit +else + if( -f /disks/milkyway/a/users/anderson/seti/watchdogs/go_spliiter ) then + /bin/rm -f wu_inbox/.* +#set START_MSG=`echo "Splitter is starting on tape" $SPLIT_FILE "on" $HOST` + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" splitter starting" $EMAIL_LIST + /bin/nice $SPLIT_PROG_LOC$SPLIT_PROG_NAME $SPLIT_FILE $1 -resume >>& splitterlog + set TEMP=`grep -i "end" error.log` + if( "$TEMP" != "" ) then + sleep 60 # wait for it to finish moving the files from wu_inbox + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" splitter finished" $EMAIL_LIST + /bin/rm -f error.log rcd.chk + /bin/rm -f wu_inbox/.* + /bin/rm -f $SPLIT_MARK_FILE + if( -f $HI_DONE_FILE ) then + /bin/rm -f $HI_DONE_FILE + /bin/rm -f `cd $SPLIT_TAPE_DIR; ls -l | grep $TAPE_FILE | awk '{print $NF}'` + /bin/rm -f $SPLIT_FILE + else + touch -f $SPLIT_DONE_FILE + endif + endif + /bin/rm -f $SPLIT_MARK_FILE + exit + else + /bin/rm -f $SPLIT_MARK_FILE + exit + endif +endif + +#if ( 0 == 1 ) then +# if ( grep -i done hi_log ) then +# cat error.log rcd.chk | /usr/ucb/mail -s"end of tape on $HOST" $EMAIL_LIST +# touch $HI_FILE$HIDONE_SUFFIX +# if ( -f $HI_FILE$HIDONE_SUFFIX ) then +# unlink $SPLITFILE +# fi +# unlink .$SPLITFILE +# /bin/rm error.log rcd.chk +# /bin/rm wu_inbox/.* +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +#else +# if [ -f $MARKER$HOST ] +# then +# /bin/rm wu_inbox/.* +# cat error.log rcd.chk | /usr/ucb/mail -s"restarting HI analysis on $HOST" $EMAIL_LIST +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +# else +# cat error.log rcd.chk | /usr/ucb/mail -s"hi analysis disabled on $HOST" $EMAIL_LIST +# fi +#endif +end + diff --git a/splitter_fft/tools/sah_splitter.sh b/splitter_fft/tools/sah_splitter.sh new file mode 100755 index 0000000..2ff1d34 --- /dev/null +++ b/splitter_fft/tools/sah_splitter.sh @@ -0,0 +1,150 @@ +#! /bin/sh +PATH=/opt/misc:/opt/misc/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/openwin/bin/xview:/usr/lang:/usr/ucb:/bin:/usr/bin:/usr/local/bin:/usr/hosts:/usr/bin/X11:/usr/casual/sparc:/usr/etc:/usr/local/lib/tex/bin:/usr/local/lib/frame/bin:/disks/asimov/a/apps/informix/bin:.:/disks/albert/d/office/bin:/usr/ucb:/disks/albert/e/users/eurd/data_analysis/bin:/usr/local/lib/g++-include.bak:/disks/siren/a/users/seti/s4/siren/bin:/disks/albert/d/orfeus:/disks/albert/d/chips:/disks/asimov/a/apps/informix/bin:/usr/local/tex +export PATH +LD_LIBRARY_PATH=/lib:/disks/asimov/a/apps/informix/lib:/disks/asimov/a/apps/informix/lib/esql::/usr/ucblib:/lib:/usr/lib:/usr/openwin/lib:/usr/ccs/lib:/usr/local/gcc/lib:/disks/asimov/a/lang/gnu/H-sparc-sun-solaris2/lib:/opt/misc/lib:/usr/local/lib:/disks/ellie/a/users/korpela/lib:/usr/dt/lib +export LD_LIBRARY_PATH +INFORMIXDIR=/disks/asimov/a/apps/informix/ +export INFORMIXDIR +INFORMIXSERVER=ejk_tcp +export INFORMIXSERVER +S4_RECEIVER_CONFIG=/usr/local/warez/projects/s4/siren/db/ReceiverConfig.tab +export S4_RECEIVER_CONFIG + +PROJECTDIR=/disks/koloth/a/inet_services/boinc_www/share/projects/sah +SPLIT_PROG_LOC=${PROJECTDIR}/bin/ +SPLIT_PROG_NAME=sah_splitter +SPLIT_TAPE_DIR=/disks/setifiler1/wutape/tapedir/seti_boinc_public/ +SPLIT_SUFFIX=.split +#HIDONE_SUFFIX=.hidone +SPLITDONE_SUFFIX=.splitdone +EMAIL_LIST="korpela@ssl.berkeley.edu jeffc@ssl.berkeley.edu mattl@ssl.berkeley.edu davea@ssl.berkeley.edu" +FOUND_FILE=0 +HOST=`hostname` +SPLIT_HALT_MSG=splitter_stop + +# Check to see if this machine is already running the splitter program +PROG_RUNNING=`/usr/ucb/ps -auxww | grep "$SPLIT_PROG_NAME " | grep -v grep` +if [ ! -z "$PROG_RUNNING" ] +then + echo "Splitter is already running on this machine. Quitting." + exit 1 +fi + +# Get rid of all .split files here with HOSTNAME in them(?) + +TAPE_FILE= + +# get list of all tapes in the sah classic tape directory +cd $SPLIT_TAPE_DIR/.. +FILE_LIST=`ls *.tape` + +cd $SPLIT_TAPE_DIR + +# if no sah classic tapes then bail +if [ -z "$FILE_LIST" ] +then + exit 2 +fi + +# for each sah classic tape... +for file in $FILE_LIST +do + # if we have already split it... + if [ -f $file$SPLITDONE_SUFFIX ] + then + # ... then remove it ("it" being a hard link upward into the sah classic dir) + if [ -f $file ] + then + /bin/rm $file + fi + else + # if we are in the process of splitting it... + if [ -f $file$SPLIT_SUFFIX ] + then + # and are splitting it from this host... (this logic prevents one host from repeating another host's tape) + if grep $HOST $file$SPLIT_SUFFIX + then + # trigger to restart the split + /bin/rm $file$SPLIT_SUFFIX + fi + fi + # if a restart or a brand new tape... + if [ ! -f $file$SPLIT_SUFFIX ] + then + # claim it for this host (there is certainly a race condition here) + echo $HOST > $file$SPLIT_SUFFIX + ln ../$file + TAPE_FILE=$file + SPLIT_FILE=$SPLIT_TAPE_DIR$file + SPLIT_MARK_FILE=$SPLIT_TAPE_DIR$file$SPLIT_SUFFIX +# HI_DONE_FILE=$SPLIT_TAPE_DIR$file$HIDONE_SUFFIX + SPLIT_DONE_FILE=$SPLIT_TAPE_DIR$file$SPLITDONE_SUFFIX + break + fi + fi +done + +cd /tmp/splitter/sah +if [ ! -d splitter ] +then + mkdir splitter +fi +cd splitter +if [ ! -d wu_inbox ] +then + mkdir wu_inbox +fi +/bin/rm -f error.log rcd.chk +touch error.log +touch rcd.chk + +if [ -z "$TAPE_FILE" ] +then + exit 3 +else + /bin/rm -f wu_inbox/.* + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" boinc_splitter starting" $EMAIL_LIST + /bin/nice $SPLIT_PROG_LOC$SPLIT_PROG_NAME $SPLIT_FILE $* -resume -projectdir=$PROJECTDIR + if grep -i "end" error.log >/dev/null 2>&1 + then + /bin/nice $SPLIT_PROG_LOC$SPLIT_PROG_NAME $SPLIT_FILE $* -resume -projectdir=$PROJECTDIR + fi + if grep -i "end" error.log >/dev/null 2>&1 + then + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" boinc_splitter finished" $EMAIL_LIST + /bin/rm -f error.log rcd.chk + /bin/rm -f wu_inbox/.* + /bin/rm -f $SPLIT_MARK_FILE + /bin/rm -f `cd $SPLIT_TAPE_DIR; ls -l | grep $TAPE_FILE | awk '{print $NF}'` + /bin/rm -f $SPLIT_FILE + touch -f $SPLIT_DONE_FILE + exit + else + /bin/rm -f $SPLIT_MARK_FILE + exit 4 + fi +fi + +#if ( 0 == 1 ) then +# if ( grep -i done hi_log ) then +# cat error.log rcd.chk | /usr/ucb/mail -s"end of tape on $HOST" $EMAIL_LIST +# touch $HI_FILE$HIDONE_SUFFIX +# if ( -f $HI_FILE$HIDONE_SUFFIX ) then +# unlink $SPLITFILE +# fi +# unlink .$SPLITFILE +# /bin/rm error.log rcd.chk +# /bin/rm wu_inbox/.* +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +#else +# if [ -f $MARKER$HOST ] +# then +# /bin/rm wu_inbox/.* +# cat error.log rcd.chk | /usr/ucb/mail -s"restarting HI analysis on $HOST" $EMAIL_LIST +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +# else +# cat error.log rcd.chk | /usr/ucb/mail -s"hi analysis disabled on $HOST" $EMAIL_LIST +# fi +#endif +end + diff --git a/splitter_fft/uttolst.h b/splitter_fft/uttolst.h new file mode 100644 index 0000000..8f29efb --- /dev/null +++ b/splitter_fft/uttolst.h @@ -0,0 +1,2 @@ +double tm_UtToLst(double ddtime, double longitude, + long mon, long day, long year); diff --git a/splitter_fft/validrun.cpp b/splitter_fft/validrun.cpp new file mode 100644 index 0000000..45d3854 --- /dev/null +++ b/splitter_fft/validrun.cpp @@ -0,0 +1,181 @@ +/* + * validrun.c + * + * Functions for determining if a section of the tape buffer can be + * turned into a valid work unit + * + * $Id: validrun.cpp,v 1.2.4.2 2006/12/14 22:24:48 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include "splitparms.h" +#include "splittypes.h" +#include "splitter.h" +#include "message.h" + + +int valid_run(tapeheader_t tapeheader[],buffer_pos_t *start_of_wu, + buffer_pos_t *end_of_wu) { + + int i=0,valid=1; + SCOPE_STRING *first_telstr; + double first_telstr_time=0; + double first_jd=tapeheader[0].st.jd; + char tmpstr[256]; + + /* find the first telstr that refers to valid data */ + + do { + first_telstr=&(tapeheader[++i].telstr); + first_telstr_time=first_telstr->st.jd; + } while ((first_telstr_time<=first_jd) && (iframe=1+WU_OVERLAP_FRAMES; + end_of_wu->byte=0; + return(0); + } + + /* find the correct byte offset for the start of the work unit */ + + start_of_wu->frame=i; + start_of_wu->byte=(long)((tapeheader[i].telstr.st.jd-tapeheader[i].st.jd)*86400.0*tapeheader[i].samplerate*2/CHAR_BIT); + start_of_wu->byte &= 0xfffffffe; + + + while (start_of_wu->byte<0) { + start_of_wu->frame--; + start_of_wu->byte+=TAPE_DATA_SIZE; + } + + while (start_of_wu->byte>TAPE_DATA_SIZE) { + start_of_wu->frame++; + start_of_wu->byte-=TAPE_DATA_SIZE; + } + + if (start_of_wu->frame<0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Missing telescope strings near %lu\n", + tapeheader[0].frameseq); + end_of_wu->frame=0; + end_of_wu->byte=0; + records_in_buffer=0; + return(0); + } + + if ((start_of_wu->frame+TAPE_FRAMES_PER_WU)>TAPE_FRAMES_IN_BUFFER) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Missing telescope strings near %lu\n", + tapeheader[0].frameseq); + end_of_wu->frame=0; + end_of_wu->byte=0; + records_in_buffer=0; + return(0); + } + + /* check for frames in error */ + for (i=0; iframe+i; + // missed frames + if (tapeheader[j].missed) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Missing frames between %lu and %lu\n", + tapeheader[j-1].frameseq,tapeheader[j].frameseq); + valid=0; + } + // failed blanking signal acquisition + if (tapeheader[j].blanking_failed) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Failed blanking between frames %lu and %lu\n", + tapeheader[j-1].frameseq,tapeheader[j].frameseq); + valid=0; + } + if(!valid) { + end_of_wu->frame=j+WU_OVERLAP_FRAMES+1; + end_of_wu->byte=0; + assert((j+WU_OVERLAP_FRAMES)<=TAPE_FRAMES_IN_BUFFER); + } + } + + if (!valid) { + end_of_wu->frame=0; + records_in_buffer=0; + return(valid); + } + + end_of_wu->frame=start_of_wu->frame+TAPE_FRAMES_PER_WU; + end_of_wu->byte=start_of_wu->byte; + + return(valid); +} + + +/* + * $Log: validrun.cpp,v $ + * Revision 1.2.4.2 2006/12/14 22:24:48 korpela + * *** empty log message *** + * + * Revision 1.2.4.1 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:57 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:23:43 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.6 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.4 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.3 1999/02/11 16:46:28 korpela + * Added checkpointing. + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.3 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.2 1998/10/27 00:59:22 korpela + * Bug fixes. + * + * Revision 1.1 1998/10/22 17:48:20 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/validrun.h b/splitter_fft/validrun.h new file mode 100644 index 0000000..89f7c6d --- /dev/null +++ b/splitter_fft/validrun.h @@ -0,0 +1,33 @@ +/* + * validrun.h + * + * Functions for determining if a section of the tape buffer can be + * turned into a valid work unit + * + * $Id: validrun.h,v 1.1 2003/06/03 00:23:43 korpela Exp $ + * + */ + +int valid_run(tapeheader_t tapeheader[],buffer_pos_t *start_of_wu, + buffer_pos_t *end_of_wu); + +/* + * $Log: validrun.h,v $ + * Revision 1.1 2003/06/03 00:23:43 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/22 17:49:15 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/writeheader.cpp b/splitter_fft/writeheader.cpp new file mode 100644 index 0000000..89296c3 --- /dev/null +++ b/splitter_fft/writeheader.cpp @@ -0,0 +1,105 @@ +/* + * Functions for writing tape and work unit headers + * + * $Id: writeheader.cpp,v 1.3.4.1 2006/12/14 22:24:49 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include + +#include "splitparms.h" +#include "splittypes.h" +#include "timecvt.h" +#include "seti_header.h" + +extern int output_xml; + +/* Write a tape header into a buffer */ +int write_tape_header(char *buffer, tapeheader_t *header) { +/* Unimplemented as yet */ +return(0); +} + +char *monthnames[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep" + "Oct","Nov","Dec"}; +char *daynames[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; + +/* Write a work unit header into a FILE */ +/*int splitter_write_wu_header(FILE *file, wuheader_t *header) { + if (!output_xml) + write_wu_header(file, header->wuhead); + return (seti_write_wu_header(file,header->wuinfo,output_xml)); + +} +*/ + +/* + * $Log: writeheader.cpp,v $ + * Revision 1.3.4.1 2006/12/14 22:24:49 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:44 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:59 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:18 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:43 korpela + * + * Again + * + * Revision 3.1 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.6 1999/01/04 22:27:55 korpela + * Updated return codes. + * + * Revision 2.5 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.4 1998/11/09 23:26:27 korpela + * Added generic version= to default header. + * + * Revision 2.3 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.2 1998/11/02 18:42:03 korpela + * Changed write_wu_header to call seti_write_wu_header + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Will be transfered to client. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.4 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.3 1998/10/27 00:59:43 korpela + * Bug fixes. + * / + * + * Revision 1.2 1998/10/20 16:32:03 korpela + * Fixed syntax error. + * + * Revision 1.1 1998/10/20 16:27:41 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/writeheader.h b/splitter_fft/writeheader.h new file mode 100644 index 0000000..c3d6d4a --- /dev/null +++ b/splitter_fft/writeheader.h @@ -0,0 +1,39 @@ +/* + * Functions for writing tape and work unit headers + * + * $Id: writeheader.h,v 1.2 2003/08/05 17:23:44 korpela Exp $ + * + */ + +/* Write a tape header into a buffer */ +int write_tape_header(char *buffer, tapeheader_t *header); + +/* Write a work unit header into a FILE */ +// int splitter_write_wu_header(FILE *file, wuheader_t *header); + +/* + * $Log: writeheader.h,v $ + * Revision 1.2 2003/08/05 17:23:44 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 1999/01/04 22:27:55 korpela + * Updated return codes. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/15 17:20:01 korpela + * Initial revision + * + */ diff --git a/splitter_fft/wufiles.cpp b/splitter_fft/wufiles.cpp new file mode 100644 index 0000000..d8663ce --- /dev/null +++ b/splitter_fft/wufiles.cpp @@ -0,0 +1,679 @@ +/* + * + * Functions for managing wufiles and their data + * + * $Id: wufiles.cpp,v 1.29.2.18 2007/08/10 18:21:13 korpela Exp $ + * + */ + +#include "sah_config.h" +#undef USE_MYSQL +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_ERRNO_H +#include +#endif + +#include "boinc_db.h" +#include "sched_util.h" +#include "splitparms.h" +#include "splittypes.h" +#include "timecvt.h" +#include "s_util.h" +#include "util.h" +#include "str_util.h" +#include "str_replace.h" +#include "splitter.h" +#include "writeheader.h" +#include "message.h" +#include "encode.h" +#include "dotransform.h" +#include "angdist.h" +#include "lcgamm.h" +#include "readtape.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "seti_tel.h" +#include "seti_cfg.h" +#include "xml_util.h" +#include "db/app_config.h" +#include "str_util.h" +#include + +int wu_database_id[NSTRIPS]; +static std::vector bin_data[NSTRIPS]; + +extern APP_CONFIG sah_config; + +int make_wu_headers(tapeheader_t tapeheader[],workunit wuheader[], + buffer_pos_t *start_of_wu) { + int procid=getpid(); + int i,j,startframe=start_of_wu->frame; + double receiver_freq; + int bandno; + SCOPE_STRING *lastpos; + FILE *tmpfile; + char tmpstr[256]; + char buf[64]; + static int HaveConfigTable=0; + static ReceiverConfig_t ReceiverConfig; + static receiver_config r; + static settings s; + + if(!HaveConfigTable) { + sprintf(buf,"where s4_id=%d",gregorian?AOGREG_1420:AO_1420); + r.fetch(std::string(buf)); + ReceiverConfig.ReceiverID=r.s4_id; + strlcpy(ReceiverConfig.ReceiverName,r.name, + sizeof(ReceiverConfig.ReceiverName)); + ReceiverConfig.Latitude=r.latitude; + ReceiverConfig.Longitude=r.longitude; + ReceiverConfig.WLongitude=-r.longitude; + ReceiverConfig.Elevation=r.elevation; + ReceiverConfig.Diameter=r.diameter; + ReceiverConfig.BeamWidth=r.beam_width; + ReceiverConfig.CenterFreq=r.center_freq; + ReceiverConfig.AzOrientation=r.az_orientation; + for (i=0;i<(sizeof(ReceiverConfig.ZenCorrCoeff)/sizeof(ReceiverConfig.ZenCorrCoeff[0]));i++) { + ReceiverConfig.ZenCorrCoeff[i]=r.zen_corr_coeff[i]; + ReceiverConfig.AzCorrCoeff[i]=r.az_corr_coeff[i]; + } + HaveConfigTable=1; + } + sprintf(buf,"where active=%d",app.id); + if (!s.fetch(std::string(buf))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to find active settings for app.id=%d\n",app.id); + exit(1); + } + if (s.receiver_cfg->id != r.id) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Receiver config does not match settings (%d != %d)\n",s.receiver_cfg->id, r.id); + exit(1); + } + s.recorder_cfg->fetch(); + s.splitter_cfg->fetch(); + s.analysis_cfg->fetch(); + if (!strncmp(s.splitter_cfg->data_type,"encoded", + std::min(static_cast(7),sizeof(s.splitter_cfg->data_type)))) { + noencode=0; + } else { + noencode=1; + } + + workunit_grp wugrp; + sprintf(wugrp.name,"%s.%ld.%d.%ld.%d",tapeheader[startframe].name, + procid, + (current_record-TAPE_RECORDS_IN_BUFFER)*8+startframe, + start_of_wu->byte,s.id); + wugrp.receiver_cfg=r; + wugrp.recorder_cfg=s.recorder_cfg; + wugrp.splitter_cfg=s.splitter_cfg; + wugrp.analysis_cfg=s.analysis_cfg; + + wugrp.data_desc.start_ra=tapeheader[startframe+1].telstr.ra; + wugrp.data_desc.start_dec=tapeheader[startframe+1].telstr.dec; + wugrp.data_desc.end_ra=tapeheader[startframe+TAPE_FRAMES_PER_WU].telstr.ra; + wugrp.data_desc.end_dec=tapeheader[startframe+TAPE_FRAMES_PER_WU].telstr.dec; + wugrp.data_desc.nsamples=NSAMPLES; + wugrp.data_desc.true_angle_range=0; + { + double sample_rate=tapeheader[startframe].samplerate/NSTRIPS; + /* startframe+1 contains the first valid RA and Dec */ + TIME st=tapeheader[startframe+1].telstr.st; + TIME et=tapeheader[startframe+TAPE_FRAMES_PER_WU].telstr.st; + double diff=(et-st).jd*86400.0; + for (j=2;j(13*1024)) ||(keyuniq<12*1024)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Invalid keyuniq value!\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%d %d %f\n",keyuniq,s.analysis_cfg.id,wugrp.data_desc.true_angle_range); + exit(1); + } + + keyuniq*=-1; + long save_keyuniq=keyuniq; + s.analysis_cfg=wugrp.analysis_cfg; + sprintf(tmpstr,"where keyuniq=%d",keyuniq); + // Check if we've already done this analysis_config... + s.analysis_cfg.id=0; + s.analysis_cfg->fetch(tmpstr); + + if (s.analysis_cfg->id==0) { + if (keyuniq != save_keyuniq) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"keyuniq value changed!\n"); + exit(1); + } + + // If not calculate the thresholds based upon the input analysis_config + // Triplets are distributed exponentially... + wugrp.analysis_cfg->triplet_thresh+=(log(numtrip)-29.0652); + + // Gaussians are based upon chisqr... + double p_gauss=lcgf(32.0,wugrp.analysis_cfg->gauss_null_chi_sq_thresh*32.0); + p_gauss-=(log(numgauss)-19.5358); + wugrp.analysis_cfg->gauss_null_chi_sq_thresh=invert_lcgf(p_gauss,32,1e-4)*0.03125; + + // Pulses thresholds are log of the probability + wugrp.analysis_cfg->pulse_thresh+=(log(numpulse)-24.7894); + + wugrp.analysis_cfg->keyuniq=keyuniq; + wugrp.analysis_cfg->insert(); + } else { + wugrp.analysis_cfg=s.analysis_cfg; + } + + strlcpy(wugrp.data_desc.time_recorded, + short_jd_string(tapeheader[startframe+1].telstr.st.jd), + sizeof(wugrp.data_desc.time_recorded)); + wugrp.data_desc.time_recorded_jd=tapeheader[startframe+1].telstr.st.jd; + + lastpos=&(tapeheader[startframe].telstr); + coordinate_t tmpcoord; + tmpcoord.time=tapeheader[startframe].telstr.st.jd; + tmpcoord.ra=tapeheader[startframe].telstr.ra; + tmpcoord.dec=tapeheader[startframe].telstr.dec; + wugrp.data_desc.coords.push_back(tmpcoord); + + for (j=1;jst.jd) > (1.0/86400.0)) + { + lastpos=&(tapeheader[startframe+j].telstr); + tmpcoord.time=tapeheader[startframe+j].telstr.st.jd; + tmpcoord.ra=tapeheader[startframe+j].telstr.ra; + tmpcoord.dec=tapeheader[startframe+j].telstr.dec; + wugrp.data_desc.coords.push_back(tmpcoord); + } + } + + wugrp.tape_info->id=0; + wugrp.tape_info->fetch(std::string("where name=\'")+tapeheader[startframe].name+"\'"); + wugrp.tape_info->start_time=tapeheader[startframe].st.jd; + wugrp.tape_info->last_block_time=tapeheader[startframe].st.jd; + wugrp.tape_info->last_block_done=tapeheader[startframe].frameseq; + + if (!nodb) { + if (wugrp.tape_info.id) { + if (!(wugrp.tape_info->update())) { + char buf[1024]; + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s",sql_error_message()); + exit(1); + } + } else { + strlcpy(wugrp.tape_info->name,tapeheader[startframe].name,sizeof(wugrp.tape_info->name)); + wugrp.tape_info->insert(); + } + } + + if (!nodb) wugrp.insert(); + + for (i=0;ibyte,s.id,i); + wuheader[i].subband_desc.sample_rate=tapeheader[startframe].samplerate/NSTRIPS; + + receiver_freq=tapeheader[startframe].centerfreq; + + bandno=((i+NSTRIPS/2)%NSTRIPS)-NSTRIPS/2; + + wuheader[i].subband_desc.base=receiver_freq+ + (double)(bandno)*wuheader[i].subband_desc.sample_rate; + wuheader[i].subband_desc.center=receiver_freq+wuheader[i].subband_desc.sample_rate*NSTRIPS*((double)IFFT_LEN*bandno/FFT_LEN+(double)IFFT_LEN/(2*FFT_LEN)-1.0/(2*FFT_LEN)); + wuheader[i].subband_desc.number=i; + + if (!nodb ) { + if (!(wu_database_id[i]=wuheader[i].insert())) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Database error in make_wu_headers()\n"); + exit(EXIT_FAILURE); + } + } + + sprintf(tmpstr,"./wu_inbox/%s",wuheader[i].name); + if ((tmpfile=fopen(tmpstr,"w"))) { + fprintf(tmpfile,"\n"); + fprintf(tmpfile,wuheader[i].print_xml().c_str()); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to open file ./wu_inbox/%s, errno=%d\n",wuheader[i].name,errno); + exit(1); + } + bin_data[i].reserve(wuheaders[i].group_info->recorder_cfg->bits_per_sample* + wuheaders[i].group_info->data_desc.nsamples/8); + } + return(1); +} + + +void write_wufile_blocks(int nbytes) { + static bool first_call=true; + int i,j; + + + for (i=0;i0); + fclose(oldfile); + fclose(newfile); + return 0; + } else { + return 1; + } +} + + + +void rename_wu_files() { + int i, retval; + char oldname[256],newname[1024]; + unsigned long sz; + DB_WORKUNIT db_wu; + const char *name[1]; + char *wudir="./wu_inbox"; + xml_encoding encoding=(noencode?_binary:_x_setiathome); + FILE *tmpfile; + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Fatal error in boinc_db.open\n"); + exit(1); + } + + for (i=0;i",tmpstr.size(), + xml_encoding_names[encoding]); + fwrite(tmpstr.c_str(),tmpstr.size(),1,tmpfile); + fprintf(tmpfile,"\n"); + fprintf(tmpfile,"\n"); + sz=bin_data[i].size(); + + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Header file no longer exists! splitter start script may be failing\n "); + exit(1); + } + if (!nodb) { + if (!filecopy(oldname,newname)) { + db_wu.clear(); + db_wu.opaque=wuheaders[i].id; + strncpy(db_wu.name,name[0],sizeof(db_wu.name)-2); + db_wu.appid=app.id; + //db_wu.rsc_fpops_est=2.79248e+13*6; + //db_wu.rsc_fpops_bound=4.46797e+14*6; + double ar=wuheaders[i].group_info->data_desc.true_angle_range; + double dur=(double)(wuheaders[i].group_info->data_desc.nsamples)/wuheaders[i].subband_desc.sample_rate; + double min_slew=wuheaders[i].group_info->analysis_cfg->pot_min_slew; + double max_slew=wuheaders[i].group_info->analysis_cfg->pot_max_slew; + if ( ar < ( dur*min_slew )/2 ) { + db_wu.rsc_fpops_est=4.95e+13; + } else { + if ( ar < ( dur*min_slew ) ) { + db_wu.rsc_fpops_est=(2.85e+13+2.0e+14*ar); + } else { + if ( ar <= (dur*max_slew) ) { + db_wu.rsc_fpops_est=(2.22e+13/pow(ar,1.25)); + } else { + db_wu.rsc_fpops_est=1.125e+13; + } + } + } + db_wu.rsc_fpops_bound=db_wu.rsc_fpops_est*10; + db_wu.rsc_memory_bound=32505856; + db_wu.rsc_disk_bound=500000; + // Our minimum is 10% of a 100 MFLOP machine + db_wu.delay_bound=db_wu.rsc_fpops_est/3e+7; + db_wu.min_quorum=sah_config.min_quorum; + db_wu.target_nresults=sah_config.target_nresults; + db_wu.max_error_results=sah_config.max_error_results; + db_wu.max_total_results=sah_config.max_total_results; + db_wu.max_success_results=sah_config.max_success_results; + strncpy(db_wu.app_name,SAH_APP_NAME,sizeof(db_wu.app_name)-2); + if (create_work(db_wu, + wu_template, + result_template_filename, + result_template_filepath, + name, + 1, + boinc_config, + NULL + ) + ) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"create work failed\n"); + exit(1); + } + //unlink(oldname); // we now *always* unlink + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"file copy failed\n"); + exit(1); + } + unlink(oldname); + } + } + boinc_db.close(); +} + +/* + * $Log: wufiles.cpp,v $ + * Revision 1.29.2.18 2007/08/10 18:21:13 korpela + * *** empty log message *** + * + * Revision 1.29.2.17 2007/06/07 20:01:52 mattl + * *** empty log message *** + * + * Revision 1.29.2.16 2007/06/06 15:58:30 korpela + * *** empty log message *** + * + * Revision 1.29.2.15 2006/12/14 22:24:49 korpela + * *** empty log message *** + * + * Revision 1.29.2.14 2006/05/03 19:14:31 korpela + * Updated work estimates. + * + * Revision 1.29.2.13 2006/04/24 18:41:02 korpela + * *** empty log message *** + * + * Revision 1.29.2.12 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.29.2.11 2006/01/10 00:39:04 jeffc + * *** empty log message *** + * + * Revision 1.29.2.10 2006/01/05 23:55:22 korpela + * *** empty log message *** + * + * Revision 1.29.2.9 2005/12/05 22:11:40 korpela + * Fixed bug in flops estimate. + * + * Revision 1.29.2.8 2005/10/05 16:22:17 jeffc + * removed reference to old/new boolean for directory hash. + * + * Revision 1.29.2.7 2005/09/22 23:05:22 korpela + * Fixed threshold calculation. Was using chisqr rather than reduced chisqr. + * + * Revision 1.29.2.6 2005/09/21 22:11:23 korpela + * Updated Makefile.in for OpenSSL. + * Added dynamic threshold generation to wufiles.cpp. + * + * Revision 1.29.2.5 2005/08/01 17:47:38 korpela + * Type fixed. + * + * Revision 1.29.2.4 2005/08/01 17:43:20 korpela + * Refinement of FLOPS estimate for workunits. + * + * Revision 1.29.2.3 2005/07/26 17:17:01 korpela + * Typo fix + * + * Revision 1.29.2.2 2005/07/19 00:15:19 korpela + * Revised delay bound and FLOP estimate for setiathome_enhanced. + * + * Revision 1.29.2.1 2005/07/06 01:30:17 korpela + * Updated estimates of FPOPS per workunit for setiathome enhanced. + * + * Revision 1.29 2005/03/08 22:36:15 jeffc + * jeffc - fixed call to create_work() + * + * Revision 1.28 2005/02/15 23:06:47 korpela + * Fixed missing dir_hier symbol. + * + * Revision 1.27 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.26 2004/11/18 22:24:48 korpela + * *** empty log message *** + * + * Revision 1.25 2004/08/25 22:42:11 jeffc + * *** empty log message *** + * + * Revision 1.24 2004/08/14 04:44:26 jeffc + * *** empty log message *** + * + * Revision 1.23 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.22 2004/07/15 17:54:20 jeffc + * *** empty log message *** + * + * Revision 1.21 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/07/01 17:56:51 korpela + * *** empty log message *** + * + * Revision 1.19 2004/06/25 13:49:33 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/02 20:51:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/01/22 00:57:54 korpela + * *** empty log message *** + * + * Revision 1.14 2004/01/20 22:33:44 korpela + * *** empty log message *** + * + * Revision 1.13 2004/01/06 22:44:05 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/12 01:51:39 korpela + * Now using the opaque field in workunit to store SAH wuid. + * + * Revision 1.10 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.9 2003/11/25 21:59:53 korpela + * *** empty log message *** + * + * Revision 1.8 2003/11/11 06:20:30 korpela + * Increased max fpops_max to prevent timeout on windows clients + * + * Revision 1.7 2003/10/25 18:19:44 korpela + * *** empty log message *** + * + * Revision 1.6 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.3.2.2 2003/09/22 19:00:31 korpela + * *** empty log message *** + * + * Revision 1.3.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.4 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:44 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:36:00 korpela + * + * renames .C files to .cpp + * + * Revision 1.3 2003/06/05 15:52:47 korpela + * + * Fixed coordinate bug that was using the wrong zenith angle from the telescope + * strings when handling units from the gregorian. + * + * Revision 1.2 2003/06/03 01:01:18 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.8 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.7 2003/04/10 17:32:25 korpela + * *** empty log message *** + * + * Revision 3.6 2002/06/21 01:42:15 eheien + * *** empty log message *** + * + * Revision 3.5 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.4 2001/08/17 22:20:54 korpela + * *** empty log message *** + * + * Revision 3.3 2001/08/17 01:22:31 korpela + * *** empty log message *** + * + * Revision 3.2 2001/08/17 01:16:53 korpela + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.18 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.17 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.16 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.15 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.14 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.13 1999/02/11 16:46:28 korpela + * Added db access functions. + * + * Revision 2.12 1999/01/04 22:27:55 korpela + * Updated return codes. + * + * Revision 2.11 1998/12/14 23:41:44 korpela + * Added subband_base to work unit header. + * Changed frequency calculation. + * + * Revision 2.10 1998/12/14 21:55:07 korpela + * Added fft_len and ifft_len to work unit header. + * + * Revision 2.9 1998/11/13 23:58:52 korpela + * Modified for move of name field between structures. + * + * Revision 2.8 1998/11/13 22:18:12 davea + * *** empty log message *** + * + * Revision 2.7 1998/11/10 01:55:26 korpela + * Server requires a CR at the end of a WU file + * ??? + * + * Revision 2.6 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.5 1998/11/05 21:33:02 korpela + * Fixed angle_range bug. + * + * Revision 2.4 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.3 1998/11/02 21:20:58 korpela + * Modified for (internal) integer receiver ID. + * + * Revision 2.2 1998/11/02 18:45:39 korpela + * Changed location of timecvt.h + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 01:01:16 korpela + * Initial revision + * + * + */ diff --git a/splitter_fft/wufiles.h b/splitter_fft/wufiles.h new file mode 100644 index 0000000..046c378 --- /dev/null +++ b/splitter_fft/wufiles.h @@ -0,0 +1,39 @@ +/* + * + * Functions for managing wufiles and their data + * + * $Id: wufiles.h,v 1.2 2003/08/05 17:23:45 korpela Exp $ + * + */ + + + +int make_wu_headers(tapeheader_t tapeheader[],workunit wuheaders[], + buffer_pos_t *start_of_wu) ; +void write_wufile_blocks(int nbytes) ; +void rename_wu_files(); + +/* + * $Log: wufiles.h,v $ + * Revision 1.2 2003/08/05 17:23:45 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:13:16 korpela + * Initial revision + * + * + */ diff --git a/splitter_pfb/Makefile.am b/splitter_pfb/Makefile.am new file mode 100644 index 0000000..60794a8 --- /dev/null +++ b/splitter_pfb/Makefile.am @@ -0,0 +1,72 @@ +CC=gcc +BOINCDIR=@BOINCDIR@ +INFORMIXDIR=@INFORMIXDIR@ +SETILIB_PATH=@SETILIB_PATH@ +SETILIB_LIBS=@SETILIB_LIBS@ +SETIHOME=.. + +LINKOPTIONS= + +GSL_LIBS = -lgsl -lgslcblas -lgsl + +DBLIBS=@INFORMIX_LIBS@ -lm -lstdc++ + + +LINKOPTIONS=-Xlinker -R -Xlinker $(INFORMIXDIR)/lib:$(INFORMIXDIR)/lib/esql:$(LD_LIBRARY_PATH) + + +AM_CFLAGS= -g -O3 -Wall $(INCLUDE_DIRS) -DUSE_INFORMIX @PTHREAD_CFLAGS@ -ISETILIB_PATH/include + + +SYSLIBS = -lcrypto -ldl -larmadillo + +BOINCLIBS= -L$(BOINCDIR)/sched -lsched @MYSQL_LIBS@ @PTHREAD_LIBS@ -L$(BOINCDIR)/lib -lboinc_crypt -lboinc -L$(SSLDIR) -lcrypto -lssl + +SPLITLIBS= $(SETILIB_LIBS) \ + $(DBLIBS) \ + $(BOINCLIBS) \ + $(SYSLIBS) \ + -lchealpix \ + -lfftw3f + +noinst_PROGRAMS = mb_splitter + + +mb_splitter_SOURCES=mb_angdist.cpp \ + mb_message.cpp \ + mb_splitter.cpp \ + mb_read_blocks_dr2.cpp \ + mb_read_blocks_guppi.cpp \ + mb_wufiles.cpp \ + mb_dotransform.cpp \ + mb_validrun.cpp \ + mb_coords.cpp \ + cmap_interp.cpp \ + ../db/schema_master.cpp \ + ../db/sqlifx.cpp \ + ../db/sqlrow.cpp \ + ../db/sqlblob.cpp ../db/sqlint8.cpp \ + ../db/xml_util.cpp \ + ../db/app_config.cpp \ + ../client/seti_header.cpp \ + ../client/timecvt.cpp \ + ../client/lcgamm.cpp \ + ../client/hr_min_sec.o + +mb_splitter_CXXFLAGS= \ + -O3 \ + -I$(SETIHOME) -I$(SETIHOME)/client \ + -I$(SETIHOME)/db @MYSQL_CFLAGS@ \ + -I$(HEALPIX)/include @INFORMIX_CFLAGS@ \ + @SETILIB_CFLAGS@ @BOINC_CFLAGS@ \ + -I$(BOINCDIR)/tools -I$(BOINCDIR)/sched \ + -I$(BOINCDIR)/db -I$(CFITSIO) \ + -I$(SETI_GBT)/src +mb_splitter_CFLAGS=$(mb_splitter_CXXFLAGS) +mb_splitter_LDFLAGS=-static $(AM_LDFLAGS) -L$(HEALPIX)/lib -L$(SETI_GBT)/lib -lsetigbt -lsla -L$(CFITSIO) -lcfitsio $(LINKOPTIONS) +mb_splitter_LDADD=$(SPLITLIBS) $(GSL_LIBS) + +../db/sqlifx.cpp: ../db/sqlifx.ec + $(INFORMIXDIR)/bin/esql -e $< + mv sqlifx.c $*.cpp + diff --git a/splitter_pfb/cmap_interp.cpp b/splitter_pfb/cmap_interp.cpp new file mode 100644 index 0000000..d431f92 --- /dev/null +++ b/splitter_pfb/cmap_interp.cpp @@ -0,0 +1,40 @@ +#include +#include +#include "setilib.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" + +coordinate_t cmap_interp(std::map &map, seti_time &t) { + std::map::iterator above(map.upper_bound(t)); + std::map::iterator below; + below=above; + if (above==map.begin()) { + above++; + } else { + below--; + } + if (above==map.end()) { + above--; + below--; + } + coordinate_t upper(above->second); + coordinate_t lower(below->second); + coordinate_t rv; + + if ((upper.ra-lower.ra)>23) lower.ra+=24; + if ((lower.ra-upper.ra)>23) upper.ra+=24; + rv.time=t.jd().uval(); + double f=(seti_time(t.jd()-JD1970,JD1970)-seti_time(days(lower.time)))/ + days(upper.time-lower.time); + rv.ra=(upper.ra-lower.ra)*f+lower.ra; + rv.ra=fmod(rv.ra,24.0); + rv.dec=(upper.dec-lower.dec)*f+lower.dec; + return rv; +} + + + + diff --git a/splitter_pfb/cmap_interp.h b/splitter_pfb/cmap_interp.h new file mode 100644 index 0000000..37ee520 --- /dev/null +++ b/splitter_pfb/cmap_interp.h @@ -0,0 +1,6 @@ + +extern coordinate_t cmap_interp(std::map &map, seti_time &t); + + + + diff --git a/splitter_pfb/gencoeff.py b/splitter_pfb/gencoeff.py new file mode 100755 index 0000000..3af6e75 --- /dev/null +++ b/splitter_pfb/gencoeff.py @@ -0,0 +1,143 @@ +#!/usr/bin/python2.6 + +# vegas_gencoeff.py +# Generate PFB filter coefficients for VEGAS HPC low-bandwidth modes. The +# filter coefficients array contains duplicates for optimised reading +# from the GPU. +# +# Created by Jayanth Chennamangalam based on code by Sean McHugh, UCSB + +import sys +import getopt +import math +import numpy +import matplotlib.pyplot as plotter + +# function definitions +def PrintUsage(ProgName): + "Prints usage information." + print "Usage: " + ProgName + " [options]" + print " -h --help Display this usage information" + print " -n --nfft Number of points in FFT" + print " -t --taps Number of taps in PFB" + print " -b --sub-bands Number of sub-bands in data" + print " -w --width-factor width factor for sinc(x) call" + print " -d --data-type Data type - \"float\" or " \ + + "\"signedchar\"" + print " -p --no-plot Do not plot coefficients" + return + +# default values +NFFT = 32768 # number of points in FFT +NTaps = 8 # number of taps in PFB +NSubBands = 1 # number of sub-bands in data +WidthFactor = 1.05 # width factor for sinc(x) call +DataType = "signedchar" # data type - "float" or "signedchar" +Plot = True # plot flag + +# get the command line arguments +ProgName = sys.argv[0] +OptsShort = "hn:t:b:w:d:p" +OptsLong = ["help", "nfft=", "taps=", "sub-bands=", "width-factor=", "data-type=", "no-plot"] + +# check if the minimum expected number of arguments has been passed +# to the program +if (1 == len(sys.argv)): + sys.stderr.write("ERROR: No arguments passed to the program!\n") + PrintUsage(ProgName) + sys.exit(1) + +# get the arguments using the getopt module +try: + (Opts, Args) = getopt.getopt(sys.argv[1:], OptsShort, OptsLong) +except getopt.GetoptError, ErrMsg: + # print usage information and exit + sys.stderr.write("ERROR: " + str(ErrMsg) + "!\n") + PrintUsage(ProgName) + sys.exit(1) + +# parse the arguments +for o, a in Opts: + if o in ("-h", "--help"): + PrintUsage(ProgName) + sys.exit() + elif o in ("-n", "--nfft"): + NFFT = int(a) + elif o in ("-t", "--taps"): + NTaps = int(a) + elif o in ("-b", "--sub-bands"): + NSubBands = int(a) + elif o in ("-w", "--width-factor"): + WidthFactor = float(a) + elif o in ("-d", "--data-type"): + DataType = a + elif o in ("-p", "--no-plot"): + Plot = False + else: + PrintUsage(ProgName) + sys.exit(1) + +M = NTaps * NFFT + +# the filter-coefficient-generation section --> +X = numpy.array([(float(i) / NFFT) - (float(NTaps) / 2) for i in range(M)]) +PFBCoeff = numpy.sinc(X * WidthFactor) * numpy.hanning(M) +# <-- the filter-coefficient-generation section + +# create conversion map +if ("signedchar" == DataType): + Map = numpy.zeros(256, numpy.float32) + for i in range(0, 128): + Map[i] = float(i) / 128 + for i in range(128, 256): + Map[i] = - (float(256 -i) / 128) + +# 32-bit (float) coefficients +PFBCoeffFloat32 = numpy.zeros(M * NSubBands, numpy.float32) +# 8-bit (signedchar) coefficients +if ("signedchar" == DataType): + PFBCoeffInt8 = numpy.zeros(M * NSubBands, numpy.int8) +k = 0 +for i in range(len(PFBCoeff)): + Coeff = float(PFBCoeff[i]) + if ("signedchar" == DataType): + for j in range(256): + #if (math.fabs(Coeff - Map[j]) <= (0.0078125 / 2)): + if (math.fabs(Coeff - Map[j]) <= 0.0078125): + for m in range(NSubBands): + PFBCoeffInt8[k+m] = j + break + elif ("float" == DataType): + for m in range(NSubBands): + PFBCoeffFloat32[k+m] = Coeff + else: + # print usage information and exit + sys.stderr.write("ERROR: Invalid data type!\n") + PrintUsage(ProgName) + sys.exit(1) + k = k + NSubBands + +# write the coefficients to disk and also plot it +FileCoeff = open("coeff_" \ + + DataType + "_" \ + + str(NTaps) + "_" \ + + str(NFFT) + "_" \ + + str(NSubBands) + "_" \ + + str(WidthFactor) + ".dat", \ + "wb") +if ("signedchar" == DataType): + FileCoeff.write(PFBCoeffInt8) + # plot the coefficients + if (Plot): + plotter.plot(PFBCoeffInt8) +else: + FileCoeff.write(PFBCoeffFloat32) + # plot the coefficients + if (Plot): + plotter.plot(PFBCoeffFloat32) + +FileCoeff.close() + +if (Plot): + plotter.show() + diff --git a/splitter_pfb/mb_angdist.cpp b/splitter_pfb/mb_angdist.cpp new file mode 100644 index 0000000..02f5bd9 --- /dev/null +++ b/splitter_pfb/mb_angdist.cpp @@ -0,0 +1,88 @@ +/* + * angdist.c + * + * Computes angular distance between two lat/lon points + * + * $Id: mb_angdist.cpp,v 1.1.2.1 2006/12/14 22:24:39 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include "seti_header.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "xml_util.h" +#include "db/app_config.h" + + +#define DTOR (M_PI/180) + +double angdist(double r1, double d1, double r2, double d2) { + double alpha,dist,d; + + r1*=DTOR; + r2*=DTOR; + d1*=DTOR; + d2*=DTOR; + alpha=r1-r2; + dist=sin(d2)*sin(d1)+cos(d1)*cos(d2)*cos(alpha); + if ((dist*dist)<1) { + d=sqrt(1.0-dist*dist); + } else { + dist=1.0; + d=0.0; + } + dist=atan2(d,dist); + dist=dist/DTOR; + return (dist); +} + +double angdist(const coordinate_t &a, const coordinate_t &b) { + return angdist(a.ra*15,a.dec,b.ra*15,b.dec); +} + + +/* + * $Log: mb_angdist.cpp,v $ + * Revision 1.1.2.1 2006/12/14 22:24:39 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:39 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:35:31 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:15 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:16:08 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:47:33 korpela + * Initial revision + * + * + */ diff --git a/splitter_pfb/mb_angdist.h b/splitter_pfb/mb_angdist.h new file mode 100644 index 0000000..c96b664 --- /dev/null +++ b/splitter_pfb/mb_angdist.h @@ -0,0 +1,36 @@ +/* + * angdist.h + * + * Computes angular distance between two lat/lon points + * + * $Id: mb_angdist.h,v 1.1.2.1 2006/12/14 22:24:40 korpela Exp $ + * + */ + +double angdist(double r1, double d1, double r2, double d2) ; +double angdist(const coordinate_t &a,const coordinate_t &b); + +/* + * $Log: mb_angdist.h,v $ + * Revision 1.1.2.1 2006/12/14 22:24:40 korpela + * *** empty log message *** + * + * Revision 1.1 2003/06/03 00:16:09 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:03:21 korpela + * Initial revision + * + * + */ + diff --git a/splitter_pfb/mb_coords.cpp b/splitter_pfb/mb_coords.cpp new file mode 100644 index 0000000..2db10af --- /dev/null +++ b/splitter_pfb/mb_coords.cpp @@ -0,0 +1,15 @@ +#include "setilib.h" +#include "mb_splitter.h" + +void get_coord_history() { +// insert telescope coordinates into the coordinate history. +// this should be converted to a more accurate routine. + + std::vector::iterator i=tapebuffer.begin(); + + for (;i!=tapebuffer.end();i++) { + coord_history[i->header.coord_time].ra = i->header.ra; + coord_history[i->header.coord_time].dec = i->header.dec; + coord_history[i->header.coord_time].time = i->header.coord_time.jd().uval(); + } +} diff --git a/splitter_pfb/mb_coords.h b/splitter_pfb/mb_coords.h new file mode 100644 index 0000000..c983259 --- /dev/null +++ b/splitter_pfb/mb_coords.h @@ -0,0 +1 @@ +void get_coord_history(); diff --git a/splitter_pfb/mb_dotransform.cpp b/splitter_pfb/mb_dotransform.cpp new file mode 100644 index 0000000..8bcfa35 --- /dev/null +++ b/splitter_pfb/mb_dotransform.cpp @@ -0,0 +1,563 @@ +/* + * + * dotransform.c + * + * Functions for division by frequency into work units. + * + * $Id: mb_dotransform.cpp,v 1.1.2.3 2007/06/06 15:58:29 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "setilib.h" +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "fftw3.h" +#include "mb_wufiles.h" + +#include /* for open() */ +#include /* for open() */ +#include /* for open() */ +#include "mb_dotransform.h" /* for new function declarations and macro + definitions */ + +// PFB parameters +int g_iNTaps; +float g_fWidthFactor; + +/* the PFB data structure */ +typedef struct +{ + complex* pcfData; // stores the data for one polyphase filtering; PFB_FFT_LEN complex floats + fftwf_complex* pfcData; // points to the above data +} PFB_DATA; +PFB_DATA* g_astPFBData; // points to g_iNTaps PFB_DATA's + + +fftwf_plan g_stPlan = {0}; // FFT plan +fftwf_complex* g_pfcFFTArray = NULL; // FFT input/output; PFB_FFT_LEN complex floats + +static complex* g_pcfPackedDataOut = NULL; // packed FFT output, for the benefit of output_samples(); + // PFB_OUTPUT_STACK_SIZE * PFB_FFT_LEN * 2 floats + +float* g_pfPFBCoeff = NULL; // filter coefficients; g_iNTaps * PFB_FFT_LEN floats +int g_iIsFirstRun = TRUE; + +void gen_coeff(float * coeff, int num_coeff) { + + int i; + float hanning_window[num_coeff]; + float work_array[num_coeff]; + + seti_hanning_window(hanning_window, num_coeff); + + for(i=0; i0); + case 2: + if (f<-0.98159883*stddev) return 0; + if (f<0) return 1; + if (f<0.98159883*stddev) return 2; + return 3; +#if 0 +// this won't work for encoding into an unsigned short. + case 3: + f*=(sqrt(2)/stddev); + f+=3.5; + if (f>7) return 7; + if (f<0) return 0; + return static_cast(round(f)); +#endif + case 4: + f*=(2.0/stddev); + f+=7.5; + if (f>15) return 15; + if (f<0) return 0; + return static_cast(round(f)); + case 8: + f*=(24.0/stddev); + if (f>127) return 128; + if (f<-127) return -127; + return static_cast(round(f)); + default: + fprintf(stderr,"Unsupported bit depth (%d)\n",num_bits); + abort(); + } +} + +void output_samples(float *data, int i, int bits_per_sample) { +// outputs 8 complex samples per call (8 cplx floats -> 8 cplx chars, or 16 floats -> 16 chars) + int j,k; + unsigned short s; + float *p=data; + static float stddev[2]={1,1}; // use reasonable guesses to prevent really bad early values + static long n=8; + + // this is our gain control. + // maintain a running stddev for the last 256K points from all subbands + n=std::min(n,256L*1024-8); + stddev[0]*=stddev[0]*n; + stddev[1]*=stddev[1]*n; + for (j=0;j<8;j++) { + stddev[0]+=(data[j*2]*data[j*2]); + stddev[1]+=(data[j*2+1]*data[j*2+1]); + } + n+=8; + stddev[0]=sqrt(stddev[0]/n); + stddev[1]=sqrt(stddev[1]/n); + + for (j=0; j<(8*bits_per_sample/(CHAR_BIT*sizeof(unsigned short))); j++) { + s=0; + for (k=0; k>= bits_per_sample; + s |= (quantize(*p,stddev[0],bits_per_sample/2) << (CHAR_BIT*sizeof(unsigned short)-bits_per_sample/2)); + s |= (quantize(*(p+1),stddev[1],bits_per_sample/2) << (CHAR_BIT*sizeof(unsigned short)-bits_per_sample)); + p+=2; + } + bin_data[i].push_back((s>>8) & 0xff); + bin_data[i].push_back(s & 0xff); + } +} + +void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) { + unsigned int i, j; + unsigned short s; + static int first_time=1; + static float lut[65536][16]; + + assert(!(nsamples % 8)); + + if (first_time) { + for (i=0;i<65536;i++) { + s=(unsigned short)i; + for (j=0;j<8;j++) { + lut[i][j*2]=(float)2*(s & 1)-1; + s >>= 1; + lut[i][j*2+1]=(float)2*(s & 1)-1; + s >>= 1; + } + } + first_time--; + } + + for (i=0;i<(nsamples/8);i++) { + memcpy(data+16*i,lut[raw[i]],16*sizeof(float)); + } +} + + +float randu() { +// Uniform random numbers between 0 and 1 + static bool first=true; + if (first) { + srand(time(0)); + first=false; + } + return static_cast(rand())/RAND_MAX; +} + +float randn() { +// normally distributed random numbers + static float last=0; + float a,b,h=0; + if (last==0) { + while (h==0 || h>=1) { + a=2*randu()-1; + b=2*randu()-1; + h=a*a+b*b; + } + h=sqrt(-2*log(h)/h); + last=a*h; + return b*h; + } else { + a=last; + last=0; + return a; + } +} + +int set_iDataIdx(int iDataIdx, int &iTapeBufferIdx, int iPrevTapeBufferIdx) { + /* NOTE: for the last tape buffer, the last polyphase filtering we perform is for the + last consecutive g_iNTaps blocks */ + /* rewind the data index by (g_iNTaps - 1) blocks */ + iDataIdx -= ((g_iNTaps - 1) * PFB_FFT_LEN); + if (iTapeBufferIdx != iPrevTapeBufferIdx) { + if (iDataIdx != 0) { /* data index can only be negative or zero at this point */ + /* if rewinding takes us back to the previous tapebuffer, + change the tapebuffer index and data index accordingly */ + iTapeBufferIdx = iPrevTapeBufferIdx; + /* NOTE: data index is negative, hence the addition */ + iDataIdx = tapebuffer[iTapeBufferIdx].data.size() + iDataIdx; + } + } + + return(iDataIdx); +} + +inline int inc_iDataIdx(int &iTapeBufferIdx, int &iDataIdx) { + + int iFlagBreak = FALSE; + + iDataIdx = (iDataIdx + 1) % tapebuffer[iTapeBufferIdx].data.size(); + if (0 == iDataIdx) { + /* move to the next tapebuffer */ + ++iTapeBufferIdx; + if (tapebuffer.size() == iTapeBufferIdx) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, "End of tape buffer.\n"); + iFlagBreak = TRUE; + /* NOTE: do not return here, as we still need to process the current block */ + } + } + + return(iFlagBreak); +} + +inline int load_pfb_data(int &iTapeBufferIdx, int &iDataIdx, int &i, int &k) { + + g_astPFBData[i].pcfData[k] = complex( + // The PFB has the opposite notion of i and q than that of the data recorder. + // To account for this, we flip real and imag here. + static_cast(tapebuffer[iTapeBufferIdx].data[iDataIdx].imag()), + static_cast(tapebuffer[iTapeBufferIdx].data[iDataIdx].real()) + ); + + return(inc_iDataIdx(iTapeBufferIdx, iDataIdx)); +} + +void reorder_data(fftwf_complex *pfcPackedDataOut, int iPFBTapIdx) { + + int i; + + /* re-order the output data in such a way that at the end of this loop, + output is in the same form as before the PFB implementation, + so output_samples() can be used the same way as before. + (in the above output, frequency is the fastest-changing index, + but output_samples() requires data with time as the fastest-changing + index.) */ + for (i = 0; i < PFB_FFT_LEN; ++i) { + // The PFB has the opposite notion of i and q than that of the workunit. + // To account for this, we flip real and imag here. + /* imaginary part of g_pfcFFTArray[][] */ + pfcPackedDataOut[(i*PFB_OUTPUT_STACK_SIZE)+iPFBTapIdx][0] = g_pfcFFTArray[i][1]; + /* real part of g_pfcFFTArray[][] */ + pfcPackedDataOut[(i*PFB_OUTPUT_STACK_SIZE)+iPFBTapIdx][1] = g_pfcFFTArray[i][0]; + + } +} + + +void process_seg() { + int iTapeBufferIdx = 0; + signed int iDataIdx = 0; + int iFlagBreak = FALSE; + + while (iTapeBufferIdx < tapebuffer.size()) { // walk tape blocks + while (iDataIdx < tapebuffer[iTapeBufferIdx].data.size()) { // walk data within a tape block + int i; + float* fbuff = (float*) g_pcfPackedDataOut; + fftwf_complex *pfcPackedDataOut = (fftwf_complex*) g_pcfPackedDataOut; + float r_total=0, r_mean=0, i_total=0, i_mean=0; // used for nulling the DC bin + int iPrevTapeBufferIdx = 0; /* to keep track of tapebuffer-index-change */ + int iPFBOutputStackIdx; + int iPFBTapIdx; + int iPFBFftIdx; + + // this outer loop just stacks up the amout of data required by output_samples() + for(iPFBOutputStackIdx=0; iPFBOutputStackIdxwu_bits_per_sample); // output_samples() outputs 8 complex samples per call + fbuff += PFB_OUTPUT_STACK_SIZE*2; // ..so, we move fbuff ahead by PFB_OUTPUT_STACK_SIZE (8) complex (via *2) floats + } + + if (iFlagBreak) break; + } // end, walk data within a tape block + + if (iFlagBreak) break; + } // end, walk tape blocks + + return; +} + +void do_transform(std::vector &tapebuffer) { + int iRet = EXIT_SUCCESS; + + /* initialise PFB-related stuff */ + if (g_iIsFirstRun) + { + iRet = InitPFB(); + if (iRet != EXIT_SUCCESS) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB() failed\n"); + PFBCleanUp(); + return; + } + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, "PFB initialised.\n"); + g_iIsFirstRun = FALSE; + } + + process_seg(); + + /* Move the data in the buffer so we don't have to reread portions of the + * tape. Leave a 20% overlap. + */ + tapebuffer.erase(tapebuffer.begin(),tapebuffer.begin()+tapebuffer.size()*8/10); + +} + +/* function that allocates memory, reads filter coefficients, creates FFT plan, + etc. */ +int InitPFB() +{ + int iRet = EXIT_SUCCESS; + int iFileCoeff = 0; + int i = 0; + + g_iNTaps = splitter_settings.splitter_cfg->pfb_ntaps; + g_fWidthFactor = splitter_settings.splitter_cfg->pfb_width_factor; + + + /* allocate memory for the filter coefficients */ + g_pfPFBCoeff = (float *) malloc(g_iNTaps + * PFB_FFT_LEN + * sizeof(float)); + if (NULL == g_pfPFBCoeff) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + + gen_coeff(g_pfPFBCoeff, g_iNTaps * PFB_FFT_LEN); // generate the coefficients + + /* allocate memory for the PFB data arrays */ + g_astPFBData = (PFB_DATA *) malloc(g_iNTaps * sizeof(PFB_DATA)); + if (NULL == g_astPFBData) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + for (i = 0; i < g_iNTaps; ++i) + { + g_astPFBData[i].pcfData + = (complex*) fftwf_malloc(PFB_FFT_LEN * sizeof(complex)); + if (NULL == g_astPFBData[i].pcfData) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + /* pointer of type fftwf_complex */ + g_astPFBData[i].pfcData = (fftwf_complex*) g_astPFBData[i].pcfData; + } + + /* allocate memory for FFT input/output array */ + g_pfcFFTArray = (fftwf_complex *) fftwf_malloc(PFB_FFT_LEN + * sizeof(fftwf_complex)); + if (NULL == g_pfcFFTArray) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + + /* create FFT plan */ + g_stPlan = fftwf_plan_dft_1d(PFB_FFT_LEN, + g_pfcFFTArray, + g_pfcFFTArray, + FFTW_FORWARD, + FFTW_MEASURE); + + /* allocate memory to pack the output of g_iNTaps FFTs in the PFB + loop in the process_seg() function, so that the output data structure + remains same as before PFB implementation */ + g_pcfPackedDataOut = (complex *) fftwf_malloc(PFB_OUTPUT_STACK_SIZE + * PFB_FFT_LEN + * sizeof(complex)); + if (NULL == g_pcfPackedDataOut) + { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, "InitPFB(): Memory allocation failed with %s\n", + strerror(errno)); + return EXIT_FAILURE; + } + + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, "InitPFB(): Configured with NTaps %d WidthFactor %f\n", + g_iNTaps, g_fWidthFactor); + return EXIT_SUCCESS; +} + +/* function that performs the PFB */ +void DoPFB(int iPFBReadIdx) +{ + int i = 0; + int j = 0; + int k = 0; + int iCoeffStartIdx = 0; + + /* reset memory */ + (void) memset(g_pfcFFTArray, '\0', PFB_FFT_LEN * sizeof(fftw_complex)); + + /* perform polyphase filtering, starting from the read index */ + i = iPFBReadIdx; + for (j = 0; j < g_iNTaps; ++j) + { + iCoeffStartIdx = j * PFB_FFT_LEN; + for (k = 0; k < PFB_FFT_LEN; ++k) + { + /* real part */ + g_pfcFFTArray[k][0] += g_astPFBData[i].pfcData[k][0] + * g_pfPFBCoeff[iCoeffStartIdx+k]; + /* imaginary part */ + g_pfcFFTArray[k][1] += g_astPFBData[i].pfcData[k][1] + * g_pfPFBCoeff[iCoeffStartIdx+k]; + } + i = (i + 1) % g_iNTaps; + } + + return; +} + +/* function that frees resources */ +void PFBCleanUp() +{ + int i = 0; + + /* free resources */ + for (i = 0; i < g_iNTaps; ++i) + { + free(g_astPFBData[i].pcfData); + } + + fftwf_free(g_pfcFFTArray); + free(g_pfPFBCoeff); + + /* destroy plans */ + fftwf_destroy_plan(g_stPlan); + + fftwf_cleanup(); + + return; +} + +/* + * + * $Log: mb_dotransform.cpp,v $ + * Revision 1.1.2.3 2007/06/06 15:58:29 korpela + * *** empty log message *** + * + * Revision 1.1.2.2 2007/04/25 17:27:30 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:40 korpela + * *** empty log message *** + * + * Revision 1.2 2003/09/11 18:53:37 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:36 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:10 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2003/04/10 22:09:00 korpela + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.6 1999/02/22 19:02:50 korpela + * Revered input real & imaginary. + * + * Revision 2.5 1999/02/10 21:49:44 korpela + * Zeroed DC component of forward transform. + * + * Revision 2.4 1999/02/01 22:28:52 korpela + * FFTW version. + * + * Revision 2.3 1998/12/14 23:41:44 korpela + * *** empty log message *** + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:51:08 korpela + * Initial revision + * + * + */ + diff --git a/splitter_pfb/mb_dotransform.h b/splitter_pfb/mb_dotransform.h new file mode 100644 index 0000000..ac17ee0 --- /dev/null +++ b/splitter_pfb/mb_dotransform.h @@ -0,0 +1,72 @@ +/* + * + * dotransform.h + * + * Functions for division by frequency into work units. + * + * $Id: mb_dotransform.h,v 1.1.2.2 2007/04/25 17:20:28 korpela Exp $ + * + */ + + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) +#define TBUF_OFFSET(frame,byte) (tapebuffer+(frame)*TAPE_FRAME_SIZE+(byte)) + +#define FALSE 0 +#define TRUE 1 + +#define FILE_COEFF_PREFIX "coeff" +#define FILE_COEFF_DATATYPE "float" +#define FILE_COEFF_SUFFIX ".dat" + +#define PFB_OUTPUT_STACK_SIZE 8 // this has to be 8 for the benefit of output_samples() +#define PFB_FFT_LEN 256 + +//extern int obuf_pos; /* Tracks current postition in the output buffers */ + +void output_samples(float *data, int i, int bits_per_sample=2); +void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) ; +void process_seg(void); +void do_transform(std::vector &tapebuffer) ; + +int InitPFB(void); +void DoPFB(int iReadIdx); +void PFBCleanUp(void); + +/* + * + * $Log: mb_dotransform.h,v $ + * Revision 1.1.2.2 2007/04/25 17:20:28 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:41 korpela + * *** empty log message *** + * + * Revision 1.1 2003/06/03 00:16:11 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.3 1999/02/01 22:28:52 korpela + * FFTW version. + * + * Revision 2.2 1998/11/04 23:08:25 korpela + * Byte and bit order change. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:05:22 korpela + * Initial revision + * + * + */ + diff --git a/splitter_pfb/mb_message.cpp b/splitter_pfb/mb_message.cpp new file mode 100644 index 0000000..022fbf7 --- /dev/null +++ b/splitter_pfb/mb_message.cpp @@ -0,0 +1,73 @@ +/* + * Functions for sending messages to stderr and log files. + * + * $Id: mb_message.cpp,v 1.1.2.1 2006/12/14 22:24:42 korpela Exp $ + */ + +#include "sah_config.h" +#include +#include +#include +#include "setilib.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "xml_util.h" + + +#include "boinc_db.h" +#include "sched_config.h" +#include "sched_msgs.h" +#include "mb_splitter.h" + +void message(char *msg) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s %s",tapebuffer[0].header.name,msg); +} + + + +/* + * $Log: mb_message.cpp,v $ + * Revision 1.1.2.1 2006/12/14 22:24:42 korpela + * *** empty log message *** + * + * Revision 1.2.4.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:43 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:56:16 korpela + * Initial revision + * + */ diff --git a/splitter_pfb/mb_polyphase.cpp b/splitter_pfb/mb_polyphase.cpp new file mode 100644 index 0000000..6df3548 --- /dev/null +++ b/splitter_pfb/mb_polyphase.cpp @@ -0,0 +1,150 @@ + +#include "sah_config.h" +#include +#include +#include +#include +#include +#include +#include +#include "setilib.h" + +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "mb_fftw.h" +#include "mb_wufiles.h" +#include "mb_polyphase.h" +#include "mb_dotransform.h" + +/* buffer for fft input/output */ +//float databuf[FFT_LEN*2]; + +/* buffer for ftt output before data writes, needs to be multiple + * of three bytes long for encode to work. + */ +#define SAMPLES_PER_OBUF (FFT_LEN*2*3/CHAR_BIT) + +extern unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; + +double *filter_r, *filter_i; +float *f_data; + +extern int obuf_pos; /* Tracks current postition in the output buffers */ + +void make_FIR (int n_points, int M, int window, double *output) { + /* Create Mth band lowpass FIR filter, n_points long. */ + + /* Modify this to give 8-bit quantized filter. */ + /* Also generate Hilbert transformed filter */ + + int n; + double q, p; + + for (n=0; n TAPE_DATA_SIZE) { + // End of frame crossed need to trasfer correctly + end_trans.frame++; + end_trans.byte-=TAPE_DATA_SIZE; + nsamp=(TAPE_DATA_SIZE-start_trans.byte)*(CHAR_BIT/2); + assert((nsamp+end_trans.byte*(CHAR_BIT/2)) == FFT_LEN); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf, nsamp); + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(end_trans.frame,0),databuf+nsamp*2, + end_trans.byte*(CHAR_BIT/2)); + } else { + splitter_bits_to_float((unsigned short *)TBUF_OFFSET(start_trans.frame,start_trans.byte), + databuf,FFT_LEN); + } + polyphase_seg(databuf); + // Go on to next transform + start_trans=end_trans; + } + // Check if we're at the end of the wu file. If so we print less bytes + if ((end_trans.frame>=end_of_wu->frame) && + (end_trans.byte>=end_of_wu->byte)) { + write_wufile_blocks(NBYTES % SAMPLES_PER_OBUF); + } else { + write_wufile_blocks(SAMPLES_PER_OBUF); + } + } while (!((end_trans.frame>=end_of_wu->frame) && (end_trans.byte>=end_of_wu->byte))); + + // Move the data in the buffer so we don't have to reread portions of the + // tape. + // + { + unsigned char *record_offset; + int copysize; + end_of_wu->frame-=WU_OVERLAP_FRAMES; + records_in_buffer=TAPE_RECORDS_IN_BUFFER- + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD); + record_offset=tapebuffer+ + (end_of_wu->frame/TAPE_FRAMES_PER_RECORD)*TAPE_RECORD_SIZE; + copysize=records_in_buffer*TAPE_RECORD_SIZE; + bcopy(record_offset,tapebuffer,copysize); + } +} + + diff --git a/splitter_pfb/mb_read_blocks_dr2.cpp b/splitter_pfb/mb_read_blocks_dr2.cpp new file mode 100644 index 0000000..9c4ab54 --- /dev/null +++ b/splitter_pfb/mb_read_blocks_dr2.cpp @@ -0,0 +1,146 @@ +#include "boinc_db.h" +#include "backend_lib.h" +#include "setilib.h" +#include "mb_splitter.h" +#include "mb_validrun.h" +#include "mb_coords.h" + +//------------------------------------------------------------------------- +int read_blocks_dr2(int tape_fd, + long startblock, + long num_blocks_to_read, + int beam, + int pol, + int vflag) { +//------------------------------------------------------------------------- + + static bool first_time = true; + blanking_filter > blanker_filter; + int num_blocks_read; + int good_read = 0; // assume bad read until proven otherwise + + if(first_time) { + first_time = false; + // set up blanking filter + if (strcmp(splitter_settings.splitter_cfg->blanker_filter, "randomize") == 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Setting blanker filter to randomize\n" ); + blanker_filter = randomize; + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Setting blanker filter to null\n" ); + blanker_filter = NULLC; // no blanking + } + } + +//fprintf(stderr, "in read_blocks_dr2 : tapebuffer size is %ld num_blocks_to_read %d\n", (long)tapebuffer.size(), num_blocks_to_read); + num_blocks_read = seti_StructureDr2Data(tape_fd, beam, pol, + num_blocks_to_read, + tapebuffer, blanker_filter); +//fprintf(stderr, "in read_blocks_dr2 : tapebuffer size is %ld data is %ld\n", (long)tapebuffer.size(), tapebuffer[0].data.size()); + while (num_blocks_read == num_blocks_to_read) { + //check for an uninterrupted run + if (valid_run(tapebuffer,splitter_settings.receiver_cfg->min_vgc)) { + get_coord_history(); +#if 0 + std::vector::iterator i=tapebuffer.begin(); + // insert telescope coordinates into the coordinate history. + // this should be converted to a more accurate routine. + for (;i!=tapebuffer.end();i++) { + coord_history[i->header.coord_time].ra = i->header.ra; + coord_history[i->header.coord_time].dec = i->header.dec; + coord_history[i->header.coord_time].time = i->header.coord_time.jd().uval(); + } +#endif + good_read = 1; + break; + } else { + num_blocks_to_read = 512-tapebuffer.size(); + num_blocks_read = seti_StructureDr2Data(tape_fd, beam, pol, + num_blocks_to_read, + tapebuffer, blanker_filter); + } + } + return(good_read); +} + +//------------------------------------------------------------------------- +int find_start_point_dr2(int tape_fd, int beam, int pol, int beamchan) { +//------------------------------------------------------------------------- + char buf[1024]; + + // In early tapes there was a bug where the first N blocks would be duplicates + // of data from previous files. So we do a preemptive fast forward until we see a + // frame sequence number of 1. + int i,readbytes=HeaderSize; + dataheader_t header; + header.frameseq=100000; + + while ((readbytes==HeaderSize) && (header.frameseq>10)) { + char buffer[HeaderSize]; + int nread; + readbytes=0; + while ((readbytes!=HeaderSize) && (nread = read(tape_fd,buffer,HeaderSize-readbytes))) { + readbytes+=nread; + } + if (nread < 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"File error %d.\n", errno); + exit(1); + } + if (readbytes == HeaderSize) { + header.populate_from_data(buffer); + if (header.frameseq>10) { + lseek64(tape_fd,DataSize,SEEK_CUR); + } else { + lseek64(tape_fd,-1*(off64_t)HeaderSize,SEEK_CUR); + } + } + } + + if (readbytes != HeaderSize) { + // we fast forwarded through the entire tape without finding the first frame + // maybe this is one of the really early tapes that was split into chunks. + lseek64(tape_fd,0,SEEK_SET); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Warning: First block not found\n"); + } + // End preemptive fast forward + + // Optionally fast forward to the point of resumption + if (resumetape) { + tape thistape; + thistape.id=0; + readbytes=HeaderSize; + //sprintf(buf,"%d",rcvr.s4_id-AO_ALFA_0_0); + sprintf(buf,"%d",beamchan); + if (thistape.fetch(std::string("where name=\'")+header.name+"\' and beam="+buf)) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Resuming tape %s beam %d pol %d\n",thistape.name,beam,pol ); + while ((readbytes==HeaderSize) && (header.dataseq!=thistape.last_block_done)) { + int nread=0; + char buffer[HeaderSize]; + readbytes=0; + while ((readbytes!=HeaderSize) && + ((nread = read(tape_fd,buffer,HeaderSize-readbytes)) > 0 )) { + readbytes+=nread; + } + if (readbytes == HeaderSize) { + header.populate_from_data(buffer); + if (header.dataseq!=thistape.last_block_done) { + lseek64(tape_fd,(off64_t)(DataSize+HeaderSize)*(thistape.last_block_done-header.dataseq)-HeaderSize,SEEK_CUR); + } else { + lseek64(tape_fd,-1*(off_t)HeaderSize,SEEK_CUR); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Found starting point"); + } + } + if (nread == 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"End of file.\n"); + exit(0); + } + if (nread < 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"File error %d.\n",errno); + exit(1); + } + } + } + } + // End fast forward to the point of resumption + + return 0; +} diff --git a/splitter_pfb/mb_read_blocks_dr2.h b/splitter_pfb/mb_read_blocks_dr2.h new file mode 100644 index 0000000..696e2de --- /dev/null +++ b/splitter_pfb/mb_read_blocks_dr2.h @@ -0,0 +1,7 @@ +int read_blocks_dr2(int tape_fd, + long startblock, + long num_blocks_to_read, + int beam, + int pol, + int vflag); +int find_start_point_dr2(int tape_fd, int beam, int pol, int beamchan); diff --git a/splitter_pfb/mb_read_blocks_guppi.cpp b/splitter_pfb/mb_read_blocks_guppi.cpp new file mode 100644 index 0000000..700b0b2 --- /dev/null +++ b/splitter_pfb/mb_read_blocks_guppi.cpp @@ -0,0 +1,935 @@ +#include +#include +#include +#include +#include +#include +#include +#include "fitsio.h" +#include "psrfits.h" +#include "guppi_params.h" +#include "fitshead.h" +#include "median.h" +#include "setimysql.h" +#include +#include +#include "barycenter.h" +#include "rawdopplersearch.h" +#include "setilib.h" +#include "mb_read_blocks_guppi.h" +#include "mb_splitter.h" +#include "mb_coords.h" + +//#include "seti_dr2utils.h" + +/* Guppi channel-frequency mapping */ +/* sample at 1600 MSamp for an 800 MHz BW */ +/* N = 256 channels with frequency centers at m * fs/N */ +/* m = 0,1,2,3,... 255 */ + +// guppi raw data layout (data portion of a ~psrfits HDU (subintegration)): +// +// First of 32 frequency channels / subintegration: +// Pol0Samp0 Pol0Samp0 Pol1Samp0 Pol1Samp0 ... Pol1Samp255 Pol1Samp255 +// real imag real imag real imag +// |--------------------------------------------| ----------------------| +// byte 0 (2 bit data, quantized from 8 bit) ... byte 255 +// time 0 ... time 255 +// +// The next subintegration will be the same 32 channels, starting with time 256. +// Thus, each subintegration is 32*256 = 8192 bytes of data. +// +#if 0 + +We read the actual data samples ass pointed to by rawinput.pf.sub.data + +struct gpu_input { // this is instantiated as rawdata + char *file_prefix; + struct guppi_params gf; + struct psrfits pf; // path to data : rawdata.pf + unsigned int filecnt; + FILE *fil; + int invalid; + int curfile; + int overlap; /* add this keyword here since it doesn't seem to appear in guppi_params.c */ + long int first_file_skip; /* in case there's 8bit data in the header of file 0 */ +}; + +struct guppi_params { + /* Packet information for the current block */ + long long packetindex; // Index of first packet in raw data block + int packetsize; // Size in bytes of data portion of each packet + int n_packets; // Total number of packets in current block + int n_dropped; // Number of packets dropped in current block +}; + +struct psrfits { + char mode; // Read (r) or write (w). + struct hdrinfo hdr; + struct subint sub; // path to data : rawdata.pf.sub +}; + +struct hdrinfo { + char source[24]; // Source name + char frontend[24]; // Frontend used + long double MJD_epoch; // Starting epoch in MJD + double fctr; // Center frequency of the observing band (MHz) + double df; // Frequency spacing between the channels (MHz) // in BL data, this is header item CHAN_BW + double BW; // Bandwidth of the observing band (MHz) // in BL data, this is header item OBSBW + int nbits; // Number of bits per data sample + int nchan; // Number of channels + int rcvr_polns; // Number of polns provided by the receiver +}; + +struct subint { + double tsubint; // Length of subintegration (sec) + double offs; // Offset from Start of subint centre (sec) + double ra; // RA (J2000) at subint centre (deg) + double dec; // Dec (J2000) at subint centre (deg) + int bytes_per_subint; // Number of bytes for one row of raw data + unsigned char *data; // Ptr to the raw data itself // path to data : rawdata.pf.sub.data +}; + +#endif + +unsigned long total_samples = 0; +unsigned long limit_samples; +unsigned long last_num_sample_bytes_read; + +#define RAW_DATA_HEADER_BUF_SIZE 32768 +//#define RAW_DATA_HEADER_BUF_SIZE 8192 // TODO would it help to do less reading/rewinding for each header? + +typedef struct { + // file control... + long long int startindx; + long long int curindx; + long long int chanbytes; // = control_block.indxstep * rawinput.gf.packetsize / (8/raw_bit_depth * rawinput.pf.hdr.nchan); + long long int subint_offset; + long int currentblock; + int indxstep; // = (int) ((rawinput.pf.sub.bytes_per_subint * samples_per_byte) / rawinput.gf.packetsize) - + // (int) (rawinput.overlap * rawinput.pf.hdr.nchan * rawinput.pf.hdr.rcvr_polns * + // 2 / rawinput.gf.packetsize); + int last_block_done; + // user prefs... + int channel; + int polarization; + long int startblock; + long int numblocks; + int vflag; +} control_block_t; + +/* Parse info from buffer into param struct */ +extern void guppi_read_obs_params(char *buf, + struct guppi_params *g, + struct psrfits *p); + +/* prototypes */ + +int exists(const char *fname); + +unsigned long unpack_samples(unsigned char * raw, long int count, int pol, dr2_compact_block_t &this_tapebuffer); + +//------------------------------------------------------- +void print_header(dr2_compact_block_t &this_tapebuffer) { +//------------------------------------------------------- + + fprintf(stderr, "setiheader : Name: %s Frontend: %s Header Size: %d Data Size: %d Channel: %d Polarization: N samplerate %lf sky_freq %ld Data Time: %lf Coordinate Time: %lf RA: %f Dec: %f\n", + this_tapebuffer.header.name, + this_tapebuffer.header.frontend, + this_tapebuffer.header.header_size, + this_tapebuffer.header.data_size, + this_tapebuffer.header.channel, + this_tapebuffer.header.samplerate, + this_tapebuffer.header.sky_freq, + this_tapebuffer.header.data_time.mjd().uval(), + this_tapebuffer.header.coord_time.mjd().uval(), + this_tapebuffer.header.ra, + this_tapebuffer.header.dec); +} + +//------------------------------------------------------- +void populate_header( + char *file_prefix, + control_block_t &control_block, + struct gpu_input &rawinput, + dr2_compact_block_t &this_tapebuffer +) { +//------------------------------------------------------- + + +#if 0 + // orig frequency code: + // this assumes that channels are ordered with *descending* frequency + // (the higher the channel, the lower the frequency) and that BW + // and df are always positive. + // TODO - channel ordering should come from a recorder_config field + this_tapebuffer.header.sky_freq = (long int) ( + (double) 1e6 * + ( + (rawinput.pf.hdr.fctr + + (rawinput.pf.hdr.BW/2)) - + ((control_block.channel+0.5) * rawinput.pf.hdr.df) + ) + ); +#endif +//#if 0 + // new frequency code: + // this assumes in the case of *descending* frequency, both BW and df will + // be negative, otherwise positive. Ie, this should work in all cases where + // the -BW and -df protocol is followed. + this_tapebuffer.header.sky_freq = (long int) ( + (double) 1e6 * + ( + (rawinput.pf.hdr.fctr - + (rawinput.pf.hdr.BW/2)) + + ((control_block.channel+0.5) * rawinput.pf.hdr.df) + ) + ); +//#endif + +fprintf(stderr, "rawinput.pf.hdr.BW is %f\n", rawinput.pf.hdr.BW); +fprintf(stderr, "rawinput.pf.hdr.df is %f\n", rawinput.pf.hdr.df); + if(rawinput.pf.hdr.BW < 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Adjusting for negative BW : rawinput.pf.hdr.BW was %f ... ", rawinput.pf.hdr.BW); + rawinput.pf.hdr.BW = fabs(rawinput.pf.hdr.BW); + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"is %f ", rawinput.pf.hdr.BW); + } + if(rawinput.pf.hdr.df < 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, "Adjusting for negative BW : rawinput.pf.hdr.df was %f ... ", rawinput.pf.hdr.df); + rawinput.pf.hdr.df = fabs(rawinput.pf.hdr.df); + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"is %f ... ", rawinput.pf.hdr.df); + } +fprintf(stderr, "rawinput.pf.hdr.BW is %f\n", rawinput.pf.hdr.BW); +fprintf(stderr, "rawinput.pf.hdr.df is %f\n", rawinput.pf.hdr.df); + + /* size of this header */ + this_tapebuffer.header.header_size = sizeof(this_tapebuffer.header); + + /* populate with source name from psrfits header */ + strncpy(this_tapebuffer.header.name, basename(file_prefix), sizeof(this_tapebuffer.header.name)); + + /* populate with frontend name from psrfits header */ + strncpy(this_tapebuffer.header.frontend, rawinput.pf.hdr.frontend, sizeof(this_tapebuffer.header.frontend)); + + /* populate channel and polarization */ + this_tapebuffer.header.channel = control_block.channel; + // this_tapebuffer.header.polarization = control_block.polarization; // TODO add polarization + + /* (complex) sample rate in MHz */ + this_tapebuffer.header.samplerate = rawinput.pf.hdr.df; + + /* there is no "dataseq in guppi data. TODO - right? */ + //this_tapebuffer.header.dataseq = 0; + print_header(this_tapebuffer); +} + + +//------------------------------------------------------- +int get_params( + control_block_t &control_block, + struct gpu_input &rawinput, + char header_buf[], + char filname[] +) { +//------------------------------------------------------- + long long int chanbytes_overlap = 0; + // Read first raw data header + if(fread(header_buf, sizeof(char), RAW_DATA_HEADER_BUF_SIZE, rawinput.fil) == RAW_DATA_HEADER_BUF_SIZE){ + + guppi_read_obs_params(header_buf, &rawinput.gf, &rawinput.pf); + + // Get to first N bit data header where N != 8... + // At regular intervals, as a sanity check, the N bit + // data are preceeded by the full 8 bit version of + // the same data. We ignore the 8 bit data here. + // We ignore this whole check if we have 8 bit data. + if(raw_bit_depth != 8 && rawinput.pf.hdr.nbits == 8) { + fprintf(stderr, "caught an 8 bit header... moving on to first/next 2 bit header\n"); + /* figure out the size of the first subint + header */ + rawinput.first_file_skip = rawinput.pf.sub.bytes_per_subint + gethlength(header_buf); + /* rewind to the beginning */ + fseek(rawinput.fil, -RAW_DATA_HEADER_BUF_SIZE, SEEK_CUR); + /* seek past the first subint + header */ + fseek(rawinput.fil, rawinput.first_file_skip, SEEK_CUR); + /* read the next header */ + fread(header_buf, sizeof(char), RAW_DATA_HEADER_BUF_SIZE, rawinput.fil); + guppi_read_obs_params(header_buf, &rawinput.gf, &rawinput.pf); + fclose(rawinput.fil); + } else { + // not 8 bit data + fclose(rawinput.fil); + } // end if(rawinput.pf.hdr.nbits == 8) + + /* we'll use this header to set the params for the whole observation */ + + rawinput.fil = NULL; + + hgeti4(header_buf, "OVERLAP", &rawinput.overlap); + + fprintf(stderr, " pktindx : %lld\n", rawinput.gf.packetindex); + fprintf(stderr, " packetsize : %d\n", rawinput.gf.packetsize); + fprintf(stderr, " n_packets : %d\n", rawinput.gf.n_packets); + fprintf(stderr, " n_dropped : %d\n",rawinput.gf.n_dropped); + fprintf(stderr, " bytes_per_subint : %d\n",rawinput.pf.sub.bytes_per_subint); + fprintf(stderr, " overlap : %d\n",rawinput.overlap); + fprintf(stderr, " bit depth : %d\n",raw_bit_depth); + } else { + fprintf(stderr, "couldn't read a header\n"); + return 0; + } // end fread(buf... + + + if(control_block.vflag>=1) fprintf(stderr, "calculating index step\n"); + + /* number of packets that we *should* increment by */ + //control_block.indxstep = (int) ((rawinput.pf.sub.bytes_per_subint * 4) / rawinput.gf.packetsize) - + control_block.indxstep = (int) ((rawinput.pf.sub.bytes_per_subint * samples_per_byte) / rawinput.gf.packetsize) - + (int) (rawinput.overlap * rawinput.pf.hdr.nchan * rawinput.pf.hdr.rcvr_polns * + 2 / rawinput.gf.packetsize); + + if(control_block.vflag>=1) { + fprintf(stderr, "index step %d bytes_per_subint %d packetsize %d overlap %d nchan %d rcr_polns %d\n", + control_block.indxstep, rawinput.pf.sub.bytes_per_subint, rawinput.gf.packetsize, + rawinput.overlap, rawinput.pf.hdr.nchan, rawinput.pf.hdr.rcvr_polns); + } + + if (control_block.channel >= rawinput.pf.hdr.nchan) { + fprintf(stderr, "control_block.channel %d more than channels in data %d\n", control_block.channel, rawinput.pf.hdr.nchan); + return 0; + } else { + fprintf(stderr, "Numer of channels in file %d\n", rawinput.pf.hdr.nchan); + } + + /* number of non-overlapping bytes in each channel */ + /* control_block.indxstep increments by the number of unique packets in each sub-integration */ + /* packetsize is computed based on the original 8 bit resolution */ + /* divide by 8/raw_bit_depth to get to 2 or 8 bits, nchan to get to number of channels */ + // TODO - this needs to change for 8 bit data!! + //control_block.chanbytes = control_block.indxstep * rawinput.gf.packetsize / (4 * rawinput.pf.hdr.nchan); + control_block.chanbytes = control_block.indxstep * rawinput.gf.packetsize / (8/raw_bit_depth * rawinput.pf.hdr.nchan); + fprintf(stderr, "chan bytes %lld\n", control_block.chanbytes); + + /* total number of bytes per channel, including overlap */ + chanbytes_overlap = rawinput.pf.sub.bytes_per_subint / rawinput.pf.hdr.nchan; + + /* memory offset for our chosen channel within a subint */ + control_block.subint_offset = control_block.channel * chanbytes_overlap; + + if(control_block.vflag>=1) fprintf(stderr, "Index step: %d\n", control_block.indxstep); + if(control_block.vflag>=1) fprintf(stderr, "bytes per subint %d\n",rawinput.pf.sub.bytes_per_subint ); +} + + +//------------------------------------------------------- +int read_block( + control_block_t &control_block, + struct gpu_input &rawinput, + char header_buf[], + char filname[], + double &start_data_time, + double &end_data_time, + long int filecnt, + dr2_compact_block_t &this_tapebuffer +) { +//------------------------------------------------------- + + size_t rv=0; + int retval=0; + //long int j=0; + + if(!rawinput.invalid){ + if(rawinput.fil == NULL) { + /* no file is open for this band, try to open one */ + sprintf(filname, "%s.%04d.raw",rawinput.file_prefix,rawinput.curfile); + if(exists(filname)){ + fprintf(stderr, "Opening %s\n", filname); + rawinput.fil = fopen(filname, "rb"); + if(rawinput.curfile == 0 && rawinput.first_file_skip != 0) fseek(rawinput.fil, rawinput.first_file_skip, SEEK_CUR); + } else { + rawinput.invalid = 1; + fprintf(stderr, "couldn't open any more files!\n"); + } + } // end if(rawinput.fil == NULL) + + if(rawinput.fil){ + fprintf(stderr, "Reading %ld bytes - more than enough to obtain first/next header (we'll rewind)\n", RAW_DATA_HEADER_BUF_SIZE); + if(fread(header_buf, sizeof(char), RAW_DATA_HEADER_BUF_SIZE, rawinput.fil) == RAW_DATA_HEADER_BUF_SIZE) { + //fprintf(stderr, "...success!\n"); + fseek(rawinput.fil, -RAW_DATA_HEADER_BUF_SIZE, SEEK_CUR); // rewind for (header plus) data read + + if(control_block.vflag>=1) fprintf(stderr, "header length: %d\n", gethlength(header_buf)); + + // parse the header we just read + guppi_read_obs_params(header_buf, &rawinput.gf, &rawinput.pf); + + // get our current block number + control_block.currentblock = (long int) ((double) rawinput.gf.packetindex/ (double) control_block.indxstep); + + if(control_block.vflag>=1) { + fprintf(stderr, "pktindx %Ld packetsize: %d n_packets %d n_dropped: %d blocks: %ld RA: %f DEC: %f subintoffset %f tsubint %f MJD %Lf\n", + rawinput.gf.packetindex, + rawinput.gf.packetsize, + rawinput.gf.n_packets, + rawinput.gf.n_dropped, + control_block.currentblock, + rawinput.pf.sub.ra, + rawinput.pf.sub.dec, + rawinput.pf.sub.offs, + rawinput.pf.sub.tsubint, + rawinput.pf.hdr.MJD_epoch); + } + + + /* populate the variables that change with each block */ + /* RA (J2000) at subint centre (deg), Dec (J2000) at subint centre (deg), time in MJD */ + this_tapebuffer.header.dataseq = control_block.currentblock; + this_tapebuffer.header.ra = rawinput.pf.sub.ra/15.0; // splitter expects RA in decimal hours + this_tapebuffer.header.dec = rawinput.pf.sub.dec; + /* increment time for data by 0.5 x length of block to push quoted time to the _last_ sample in the block */ + double data_mjd = rawinput.pf.hdr.MJD_epoch + ((rawinput.pf.sub.offs + rawinput.pf.sub.tsubint/2)/86400.0); + double coord_mjd = rawinput.pf.hdr.MJD_epoch + (rawinput.pf.sub.offs/86400.0); + this_tapebuffer.header.data_time = seti_time(days(data_mjd),MJD0); + this_tapebuffer.header.coord_time = seti_time(days(coord_mjd),MJD0); + + if(control_block.currentblock == 1) { + start_data_time = this_tapebuffer.header.data_time.mjd().uval(); + } else { + end_data_time = this_tapebuffer.header.data_time.mjd().uval(); // assigned many times, will end up with the final block's time + } + + if(rawinput.gf.packetindex == control_block.curindx) { // file integrity check - are we at the correct index? Yes... + + long seek_len; + long hlength = (long)gethlength(header_buf); + if(rawinput.pf.hdr.directio) { + seek_len = hlength + (512 - (hlength%512))%512; // directio aligns on 512 byte boundaries + fprintf(stderr, "adjusting for directio (%d) : %ld becomes %ld\n", rawinput.pf.hdr.directio, hlength, seek_len); + } else { + seek_len = hlength; // not directio so no forced alignment + fprintf(stderr, "NOT adjusting for directio (%d) : %ld becomes %ld\n", rawinput.pf.hdr.directio, hlength, seek_len); + } + fseek(rawinput.fil, seek_len, SEEK_CUR); // skip past header + rv=0; + + if (control_block.currentblock > (control_block.startblock-1)){ // if we have reached user requested startblock (default 0) + + // read raw data. bytes_per_subint should == BLOCSIZE value from header + rv=fread(rawinput.pf.sub.data, sizeof(char), rawinput.pf.sub.bytes_per_subint, rawinput.fil); + + if( ((long int)rv == rawinput.pf.sub.bytes_per_subint) ){ // if we got the expected amount of raw data + long filepos = ftell(rawinput.fil); + if(control_block.vflag>=1) { + fprintf(stderr,"read %d bytes starting at filepos %ld in file %ld of %d ... chanbytes is %d\n", + rawinput.pf.sub.bytes_per_subint, filepos, rawinput.curfile, filecnt, control_block.chanbytes); + } + // wrap unpacking samples in restart logic. We skip the unpack (but do everything else) if we are not + // to the point of resumption. + if(control_block.currentblock >= control_block.last_block_done) { + //if(control_block.vflag>=1) fprintf(stderr, "prior to unpack_samples : last : %ld total : %ld\n", + // last_num_sample_bytes_read, total_samples); + last_num_sample_bytes_read = unpack_samples(rawinput.pf.sub.data + // start of raw data, ie channel 0 + control_block.subint_offset, // this gets us to the requested channel + control_block.chanbytes, // chanbytes does not include overlap + control_block.polarization, + this_tapebuffer); // unpack samples to the return vector + if(control_block.vflag>=1) fprintf(stderr, "Just unpacked %ld sample bytes from %ld chanbytes. Total samples : %ld\n", + last_num_sample_bytes_read, control_block.chanbytes, total_samples); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Not to point of resumption (%ld < %ld), skipping...\n", + control_block.currentblock, control_block.last_block_done); + } // end of unpack with restart logic + + } else { + rawinput.fil = NULL; + rawinput.invalid = 1; + fprintf(stderr,"ERR: couldn't read as much as the header said we could... assuming corruption and exiting...\n"); + exit(1); + } // end if we got the expected amount of raw data + + } else { // we have not reached the requested startblock + (rv = fseek(rawinput.fil, rawinput.pf.sub.bytes_per_subint, SEEK_CUR)); // ... so seek to the next block + } // end if we have reached user requested startblock + + } else if( (rawinput.gf.packetindex > control_block.curindx) && (control_block.currentblock > (control_block.startblock-1)) ) { + // are we at the correct index? No, we apparently dropped a subintegration. This is correctable... + + fprintf(stderr,"ERR: control_block.curindx: %Ld, pktindx: %Ld Did we drop a whole subintegration? Reusing last subint...\n", + control_block.curindx, rawinput.gf.packetindex ); + /* read a subint with too high an indx, must have dropped a whole subintegration*/ + + /* pf.sub.data *should* still contain the last valid subint */ + /* grab a copy of the last subint - probably should add gaussian noise here, but this is better than nothing! */ + + /* we'll keep the ra/dec values from this subint, but push back the time to keep everything sensible */ + data_mjd = rawinput.pf.hdr.MJD_epoch + ((rawinput.pf.sub.offs - rawinput.pf.sub.tsubint/2)/86400.0) ; + this_tapebuffer.header.data_time = seti_time(days(data_mjd),MJD0); + + // TODO keep the following demo buffer code to remind me what to do here + // header to return buffer + //memcpy((*setibuffer) + control_block.setibuffer_pos, + // &setiheader, + // sizeof(setiheader)); + //control_block.setibuffer_pos += sizeof(setiheader); + + // data to return buffer + //memmove((*setibuffer) + control_block.setibuffer_pos, + // (*setibuffer) + control_block.setibuffer_pos - sizeof(setiheader) - control_block.chanbytes, + // (control_block.chanbytes * 2 * sizeof(unsigned char))); + //control_block.setibuffer_pos += (control_block.chanbytes * 2 * sizeof(unsigned char)); + + /* We'll get the current valid subintegration again on the next time through this loop */ + + } else if(rawinput.gf.packetindex < control_block.curindx) { + // are we at the correct index? No, nor have we dropped a subintegration. This is a file integrity fatal error... + fprintf(stderr,"Error expecting a higher packet index than we got control_block.curindx: %Ld, pktindx: %Ld\n", + control_block.curindx, rawinput.gf.packetindex ); + /* somehow we were expecting a higher packet index than we got !?!? */ + fprintf(stderr, "assuming corruption and exiting...\n"); + exit(1); + } // end are we at the correct index + + if(control_block.vflag>=1) fprintf(stderr, "Read block %ld\n", control_block.currentblock); + + //if(control_block.vflag>=1) print_header(this_tapebuffer); + retval = true; + } else { + fprintf(stderr, "Could not read first/next 32KB\n"); + fclose(rawinput.fil); + rawinput.fil = NULL; + rawinput.curfile++; + retval = false; + } // end if((fread(buf...) + } // end if(rawinput.fil) + } // end if(!rawinput.invalid) + + if(rawinput.fil != NULL) { + //fprintf(stderr, "index step : %d\n", control_block.indxstep); + control_block.curindx = control_block.curindx + control_block.indxstep; + retval = 1; // we have a new block, which may be empty if we are fast forwarding to the point of resumption + } else { + retval = 0; // we do not have a new block. Perhaps we just need to open the next file in the series. + } + + //if(control_block.vflag>=1) fprintf(stderr, "last_num_sample_bytes_read %ld chanbytes %ld\n", last_num_sample_bytes_read, control_block.chanbytes); + return(retval); +} + +//------------------------------------------------------- +int init( + char * file_prefix, + long int startblock, + int channel, + int polarization, + int vflag, + control_block_t &control_block, + struct gpu_input &rawinput, + char header_buf[], + char filname[], + double &start_data_time, + double &end_data_time, + int &filecnt, + dr2_compact_block_t &this_tapebuffer +) { +//------------------------------------------------------- + + rawinput.file_prefix =file_prefix; + rawinput.fil = NULL; + rawinput.invalid = 0; + rawinput.first_file_skip = 0; + //control_block.check_last = 1; + control_block.chanbytes = 0; + control_block.subint_offset = 0; + control_block.currentblock = 0; + control_block.indxstep = 0; + control_block.channel = channel; + control_block.polarization = polarization; + //control_block.numblocks = numblocks; + control_block.startblock = startblock; + control_block.vflag = vflag; + + if(rawinput.file_prefix == NULL) { + printf("ERR no input stem specified, exiting...\n"); + exit(1); + } + + if(strstr(rawinput.file_prefix, ".0000.raw") != NULL) memset(rawinput.file_prefix + strlen(rawinput.file_prefix) - 9, 0x0, 9); + + // get size of data set, in terms of file count and byte count + fprintf(stderr, "Finding size of data set...\n"); + //j = 0; + struct stat st; + long int size=0; + long int i=0; + do { + sprintf(filname, "%s.%04ld.raw",rawinput.file_prefix,i); + fprintf(stderr, " trying %s ...",filname); + i++; + if(exists(filname)) { + fprintf(stderr, " found\n"); + stat(filname, &st); + size = size + st.st_size; + } else { + fprintf(stderr, " not found\n"); + } + } while (exists(filname)); + rawinput.filecnt = i-1; + fprintf(stderr, " File count is %i Total data set size is %ld bytes\n",rawinput.filecnt, size); + + /* didn't find any files */ + if(rawinput.filecnt < 1) { + fprintf(stderr, "no files for stem %s found, exiting...\n",rawinput.file_prefix); + exit(1); + } + + /* open the first file for input */ + sprintf(filname, "%s.0000.raw", rawinput.file_prefix); + fprintf(stderr, "Opening %s\n", filname); + rawinput.fil = fopen(filname, "rb"); + if(!rawinput.fil){ + fprintf(stderr, "couldn't open first file\n"); + return 0; + } + + get_params( + control_block, + rawinput, + header_buf, + filname + ); + + // Now that we know our sizing requirements, allocate the buffers... + // TODO - we should explicitly free this memory even though we allocate + // once and need it until program exit. + rawinput.pf.sub.data = (unsigned char *) malloc(rawinput.pf.sub.bytes_per_subint); + if(!rawinput.pf.sub.data) { + fprintf(stderr, "error: couldn't allocate memory for the raw data read buffer\n"); + return 0; + } else { + fprintf(stderr, "malloc'ed %ld bytes at %p for the raw data read buffer!\n", rawinput.pf.sub.bytes_per_subint, rawinput.pf.sub.data); + } + + // populate the header with static items + populate_header( + rawinput.file_prefix, + control_block, + rawinput, + this_tapebuffer + ); + + control_block.startindx = rawinput.gf.packetindex; + control_block.curindx = control_block.startindx; + filecnt = rawinput.filecnt; + rawinput.curfile = 0; + + return 1; // success +} + +//------------------------------------------------------- +void dump_tapebuffer(char * file_prefix, int channel) { +//------------------------------------------------------- + + FILE * dump_fp; + char dump_fn[256]; + sprintf(dump_fn, "%s%s%d", basename(file_prefix), ".tapebuffer_dump.channel_", channel); + dump_fp = fopen(dump_fn, "w"); + if(dump_fp == NULL) { + fprintf(stderr, "could not open dump file %s, exiting...", dump_fn); + exit(1); + } + for(int buffer_i=0; buffer_i < tapebuffer.size(); buffer_i++) { +fprintf(stderr, "buffer_i %d\n", buffer_i); + for(int buffer_j=0; buffer_j < tapebuffer[buffer_i].data.size(); buffer_j++) { +//fprintf(stderr, "buffer_i %d buffer_j %ld\n", buffer_i, buffer_j); + fwrite((const void *)&tapebuffer[buffer_i].data[buffer_j].real(), 1, 1, dump_fp); + fwrite((const void *)&tapebuffer[buffer_i].data[buffer_j].imag(), 1, 1, dump_fp); + } + } + fclose(dump_fp); +} + + + +//------------------------------------------------------- +long int read_blocks_guppi(char * file_prefix, + long int startblock, + long int numsamples, + int channel, + int polarization, + int vflag +) { +//------------------------------------------------------- +// Note : a buffer is push_back()'ed to tapebuffer under two conditions: +// 1) at the end of processing a guppi block. This is by far the most +// common push_back() and will result in a tapebuffer of a standard +// length for a given file format until we reach the desired number +// of samples per call. The final buffer will likely be a partial +// buffer. +// 2) Upon re-entry into read_blocks_guppi() for consecutive WUGs, we +// push_back() a buffer with the left-over samples in the prior guppi +// block. This will be a partial buffer. The number of samples in +// this buffer plus the number of samples in the final (partial) buffer +// of the prior call should be the standard length. + + int retval = 0; + static bool first_time = true; + + char header_buf[RAW_DATA_HEADER_BUF_SIZE]; // we read the raw data headers into this buffer + + long reent_total_samples = 0; + + static unsigned long sample_bytes_left; + static double start_data_time; + static double end_data_time; + static int filecnt; + static char filname[250]; + static dr2_compact_block_t this_tapebuffer; + static struct gpu_input rawinput; + static control_block_t control_block; + + limit_samples = numsamples; // TODO - this should go into the control block + total_samples = 0; + + if(first_time) { + first_time = false; + retval = init( + file_prefix, + startblock, + channel, + polarization, + vflag, + control_block, + rawinput, + header_buf, + filname, + start_data_time, + end_data_time, + filecnt, + this_tapebuffer + ); + if(retval == 0) return(0); + if (resumetape) { + char * filename = basename(rawinput.file_prefix); + tape thistape; + thistape.id=0; + char beambuf[16]; + sprintf(beambuf,"%d", 2*channel+polarization); + if (thistape.fetch(std::string("where name=\'")+filename+"\' and beam="+beambuf)) { + control_block.last_block_done = thistape.last_block_done; + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "Resuming tape %s channel %d pol %d at block %d\n", + thistape.name,channel,polarization,control_block.last_block_done); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, + "Cannot resume : tape %s channel %d pol %d beam %s not found. Starting at the beginning.\n", + filename,channel,polarization, beambuf); + //return(0); + } + } // end if(resumetape) + } else { // not first time - on subsequent calls we need to account for splitter (not guppi) overlap + reent_total_samples = 0; + for(int buffer_i=0; buffer_i < tapebuffer.size(); buffer_i++) { + reent_total_samples += tapebuffer[buffer_i].data.size(); + if(control_block.vflag>=2) { + fprintf(stderr, "re-entry (start) - tapebuffer %d has %ld samples\n", buffer_i, tapebuffer[buffer_i].data.size()); + } + } + total_samples = reent_total_samples; // starting this call with thais many samples : + if(control_block.vflag>=2) { + fprintf(stderr, "re-entry (start) - total_samples = %ld (%ld) in %ld tapebuffers\n", reent_total_samples, total_samples, tapebuffer.size()); + } + } // end first/subsequent time logic + + + // take care of any samples left over in the guppi buffer + if(sample_bytes_left) { + if(control_block.vflag>=1) fprintf(stderr, "first getting the %ld sample_bytes_left starting at location %p\n", + sample_bytes_left, rawinput.pf.sub.data + control_block.subint_offset + control_block.chanbytes - sample_bytes_left); + last_num_sample_bytes_read = unpack_samples(rawinput.pf.sub.data + control_block.subint_offset + control_block.chanbytes - sample_bytes_left, + sample_bytes_left, // samples left does not include overlap + control_block.polarization, + this_tapebuffer); // unpack samples to the return vector + tapebuffer.push_back(this_tapebuffer); // this will be a partially full buffer + this_tapebuffer.data.clear(); + sample_bytes_left = 0; + if(control_block.vflag>=2) { + long reent_total_samples = 0; + for(int buffer_i=0; buffer_i < tapebuffer.size(); buffer_i++) { + reent_total_samples += tapebuffer[buffer_i].data.size(); + fprintf(stderr, "re-entry (after adding leftover) tapebuffer %d has %ld samples\n", buffer_i, tapebuffer[buffer_i].data.size()); + } + fprintf(stderr, "re-entry (after adding leftover) - total_samples = %ld (%ld) in %ld tapebuffers\n", reent_total_samples, total_samples, tapebuffer.size()); + } + } + // end take care of any samples left over in the guppi buffer + + // read blocks until we run out of data or the numblocks request is met + int round = 0; + do{ + //if(control_block.vflag>=1) fprintf(stderr, "ROUND %d ========================================================\n", round); + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"ROUND %d ========================================================\n", round); + // retval = 1 : we have a new block, which may be empty if we are fast forwarding to the point of resumption + // retval = 0 : we do not have a new block. + // rawinput.invalid = 1 : we are out of raw data or have detected corruption + // rawinput.invalid = 0 : good to continue with current file or open the next file in the series. + retval = read_block( + control_block, + rawinput, + header_buf, + filname, + start_data_time, + end_data_time, + filecnt, + this_tapebuffer + ); + if(retval && this_tapebuffer.data.size() > 0) { // if retval (OK) and no data, assume fast forward resumption + this_tapebuffer.header.data_size = last_num_sample_bytes_read; + tapebuffer.push_back(this_tapebuffer); + if(control_block.vflag>=1) print_header(this_tapebuffer); + round++; + this_tapebuffer.data.clear(); + } + if(control_block.vflag>=2) { + reent_total_samples = 0; + } + } while((!(rawinput.invalid)) && + total_samples < limit_samples); + fprintf(stderr, "========================================================\n"); + // end read blocks until we run out of data or the numblocks request is met + + sample_bytes_left = control_block.chanbytes - last_num_sample_bytes_read; // set up for next call + + // optionally dump a full tapebuffer + if(dumpraw) dump_tapebuffer(file_prefix, channel); + + if(control_block.vflag>=1) { + fprintf(stderr, "NUM SAMPLES total %ld final buffer contains %ld of a possible %d leaving %ld for the next time through\n", + total_samples, last_num_sample_bytes_read, control_block.chanbytes, control_block.chanbytes-last_num_sample_bytes_read); + } + + if(control_block.vflag>=2) { + reent_total_samples = 0; + for(int buffer_i=0; buffer_i < tapebuffer.size(); buffer_i++) { + reent_total_samples += tapebuffer[buffer_i].data.size(); + fprintf(stderr, "finish tapebuffer %d has %ld samples\n", buffer_i, tapebuffer[buffer_i].data.size()); + } + fprintf(stderr, "finish - total_samples = %ld (%ld) in %ld tapebuffers\n", reent_total_samples, total_samples, tapebuffer.size()); + } + + fprintf(stderr, "getting coordinate history...\n"); + get_coord_history(); + + fprintf(stderr, "finishing up...\n"); + + int blocks_read = tapebuffer.size(); + if(control_block.vflag>=1) fprintf(stderr, "grabbed %ld samples from %Ld blocks covering %lf seconds of time. Current block is %ld = %d\n", + total_samples, blocks_read, (end_data_time-start_data_time)*86400, + control_block.currentblock, tapebuffer[tapebuffer.size()-1].header.dataseq); + start_data_time = end_data_time; // set up for next call + + this_tapebuffer.data.clear(); + if(total_samples != limit_samples) { + return 0; // error or EOF TODO should differentiate + } else { + return total_samples; + } + +} // end read_blocks_guppi() + +//------------------------------------------------------- +unsigned long unpack_samples_2bit(unsigned char * raw, long int count, int pol, dr2_compact_block_t &this_tapebuffer) { +//------------------------------------------------------- +// unpack guppi 2 bit complex samples into a vector of complex signed chars. Here we have 1 byte per sample. +// pol is polarization (0 for X, 1 for Y) + + long i; + int pol_shift = pol * 2; // pol_shift will be 0 or 2 + float quantlookup[4]; + const int stride = 1; // number of bytes in each time (real,imag,2pols) + std::complex sample; + + // the * 10 is to keep some of the precision intact as we + // go to signed char + quantlookup[0] = 3.3358750 * 10; + quantlookup[1] = 1.0 * 10; + quantlookup[2] = -1.0 * 10; + quantlookup[3] = -3.3358750 * 10; + + // short circuit in the case of getting the total number of samples that we want. + // The raw pointer will left where it is for the next time through. + for(i=0; i < count && total_samples < limit_samples; i+=stride) { + // TODO - for some data sets we may need to flip i and q. Whether or not to do this + // should come from a boolean in the recorder_config table. + // real (2 bits of raw data) + sample.real( (signed char)quantlookup[( raw[i] >> (pol_shift * 2) & 1) + // bit 0 or 4 + ((raw[i] >> (pol_shift * 2 + 1) & 1) * 2)] // bit 1 or 5 + ); + // imag (2 bits of raw data) + sample.imag( (signed char)quantlookup[( raw[i] >> ((pol_shift+1) * 2) & 1) + // bit 2 or 6 + ((raw[i] >> ((pol_shift+1) * 2 + 1) & 1) * 2)] // bit 3 or 7 + ); + // add this sample to our vector + this_tapebuffer.data.push_back(sample); + total_samples++; + } + +//fprintf(stderr, "old count : %ld new count : %ld\n", count, this_tapebuffer.data.size()); +//fprintf(stderr, "old data : %d %d new data : %d %d\n", samples[0], samples[1], this_tapebuffer.data[0].real(), this_tapebuffer.data[0].imag()); +//fprintf(stderr, "old data : %d %d new data : %d %d\n", samples[2], samples[3], this_tapebuffer.data[1].real(), this_tapebuffer.data[1].imag()); +//fprintf(stderr, "old data : %d %d new data : %d %d\n", samples[count*2-2], samples[count*2-1], this_tapebuffer.data[count-1].real(), this_tapebuffer.data[count-1].imag()); + + //return i/stride; // == i in this case + return i; // return the number of bytes (not samples) read +} + + +//------------------------------------------------------- +unsigned long unpack_samples_8bit(unsigned char * raw, long int count, int pol, dr2_compact_block_t &this_tapebuffer) { +//------------------------------------------------------- +// unpack 8 bit data. Here we have 4 bytes per sample +// pol is polarization (0 for X, 1 for Y) + + long i; + int pol_shift = pol * 2; // pol_shift will be 0 or 2 + const int stride = 4; // number of bytes in each time (real,imag,2pols) + std::complex sample; + + for(i=0; i < count && total_samples < limit_samples; i+=stride) { + // TODO - for some data sets we may need to flip i and q. Whether or not to do this + // should come from a boolean in the recorder_config table. + sample.real(raw[i+pol_shift]); + sample.imag(raw[i+1+pol_shift]); + // add this sample to our vector + this_tapebuffer.data.push_back(sample); + total_samples++; + } + + //return i/stride; + return i; // return the number of bytes (not samples) read +} + + +//------------------------------------------------------- +unsigned long unpack_samples(unsigned char * raw, long int count, int pol, dr2_compact_block_t &this_tapebuffer) { +//------------------------------------------------------- + + if(raw_bit_depth == 2) { + return(unpack_samples_2bit(raw, count, pol, this_tapebuffer)); + } else if(raw_bit_depth == 8) { + return(unpack_samples_8bit(raw, count, pol, this_tapebuffer)); + } else { + fprintf(stderr,"ERR: unsupported bit depth, exiting...\n"); + exit(1); + } +} + + +//------------------------------------------------------- +int exists(const char *fname) { +//------------------------------------------------------- + FILE *file; + if ((file = fopen(fname, "r"))) { + fclose(file); + return 1; + } + return 0; +} diff --git a/splitter_pfb/mb_read_blocks_guppi.h b/splitter_pfb/mb_read_blocks_guppi.h new file mode 100644 index 0000000..a70f08c --- /dev/null +++ b/splitter_pfb/mb_read_blocks_guppi.h @@ -0,0 +1,7 @@ +long int read_blocks_guppi(char * file_prefix, + long int startblock, + long int numblocks, + int channel, + int polarization, + int vflag +); diff --git a/splitter_pfb/mb_splitter.cpp b/splitter_pfb/mb_splitter.cpp new file mode 100644 index 0000000..b63177b --- /dev/null +++ b/splitter_pfb/mb_splitter.cpp @@ -0,0 +1,947 @@ +/* + * + * The splitter main program. + * + * $Id: mb_splitter.cpp,v 1.1.2.6 2007/08/16 23:03:19 jeffc Exp $ + * + */ + +#include "sah_config.h" +#undef USE_MYSQL +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "boinc_db.h" +#include "backend_lib.h" +#include "sched_config.h" +#include "setilib.h" +#include "str_util.h" +#include "str_replace.h" +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "mb_read_blocks_dr2.h" +#include "mb_read_blocks_guppi.h" +#include "mb_validrun.h" +#include "mb_wufiles.h" +#include "mb_dotransform.h" +#include "message.h" +#include "sqlrow.h" +#include "sqlapi.h" +#include "db/db_table.h" +#include "db/schema_master.h" +#include "db/app_config.h" + +extern "C" { + int sqldetach(); +} + +// Global Variables --------------------------------------------------- +char trigger_file_path[1024]="/disks/setifiler1/wutape/tapedir/splitter_stop"; + +APP_CONFIG sah_config; +SCHED_CONFIG boinc_config; +DB_APP app; +R_RSA_PRIVATE_KEY key; + +// configuration tables +receiver_config rcvr; +settings splitter_settings; +int root_analysis_cfg_id; + +// TEMPLATE DEFS ------------------------------------------------------ +// IMPORTANT: a change to a template should *always* include a change +// to the template filename. Only the result template is used now. +const char *wu_template_filename_id = "wu_0.xml"; +const char *wu_template= + "\n" + " 0\n" + "\n" + "\n" + " \n" + " 0\n" + " work_unit.sah\n" + " \n" + "\n"; + +const char *result_template_filename_id = "result_0.xml"; +const char *result_template= + "\n" + " \n" + " \n" + " \n" + " 65536\n" + " http://setiboincdata.ssl.berkeley.edu/sah_cgi/file_upload_handler\n" + "\n" + "\n" + " \n" + " \n" + " result.sah\n" + " \n" + "\n"; +// END TEMPLATE DEFS -------------------------------------------------- + +std::vector tapebuffer; +std::map coord_history; +std::vector wuheaders; +char appname[256]; +int max_wus_ondisk=MAX_WUS_ONDISK; +int nodb; +int noencode; +int resumetape; +int norewind; +int startblock; +int dataclass; +int atnight; +int gregorian; +int output_xml; +int polyphase; +int iters=-1; +int beam; +int pol; +int alfa = 0; +int gbt = 0; +int parkes = 0; +int channel; +int raw_bit_depth = 0; // bit depth of raw data (required for guppi data). A depth of N means N real, N imag +int samples_per_byte; // real samples/byte +int dumpsubband = -1; // default to not dumping +int dumpraw = 0; // default to not dumping +enum file_types {dr2, guppi}; +enum guppi_types {guppi_gbt, guppi_parkes}; +int useanalysiscfgid = 0; +int usereceivercfgid = 0; +int userecordercfgid = 0; +int usesplittercfgid = 0; +int filter_window = 0; +double start_time; +double stop_time; +unsigned long minvfsbuf=-1; +char wd[1024]; +//char * scidb = NULL; +char * projectdir = NULL; +//const char *result_template_filename="projectdir"/"SAH_APP_NAME"_result.tpl"; +char result_template_filename[1024]; +char result_template_filepath[1024]; +char wu_template_filename[1024]; +// End Global Variables --------------------------------------------------- + +void cprint(char *p) { + printf("%s\n",p); +} + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ + +FILE *wulog,*errorlog; +buffer_pos_t start_of_wu,end_of_wu; /* position of start and end of wu in + tape buffer */ +int seqno; + + + +//------------------------------------------------------------------------- +void cleanup(void) { +//------------------------------------------------------------------------- + FILE *tmpfile; + if ((tmpfile=fopen("seqno.dat","w"))) { + fprintf(tmpfile,"%d\n",seqno); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Unable to open seqno.dat for write\n"); + } +} + + +//------------------------------------------------------------------------- +int process_command_line(int argc, char *argv[],char **tape_device, + int *norewind, int *startblock, int *resumetape, + int *nodb, int *dataclass, int *atnight, + int *max_wus_ondisk, char **projectdir, int *iters, + int *beam, int *pol, int *alfa, int *gbt, int *parkes, + int *channel, int *raw_bit_depth, int *dumpsubband, + int *dumpraw, int *useanalysiscfgid, int *usereceivercfgid, + int *userecordercfgid, int *usesplittercfgid) { +//------------------------------------------------------------------------- + int nargs=0,i; + char *ep; + strcpy(appname,SAH_APP_NAME); + for (i=1;i6)) || + ((*pol<0) || (*pol>1))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"ALFA receivers must be specified with beam (0-6) and polarization (0-1), i.e. -alfa=4,0\n"); + exit(EXIT_FAILURE); + } + *alfa=1; + } else if (!strncmp(argv[i],"-gbt",MAX(ep-argv[i],3))) { + sscanf(ep+1,"%d,%d",channel,pol); + if (*pol<0 || *pol>1) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"GBT receivers must be specified with a channel and polarization (0-1), i.e. -gbt=0,1\n"); + exit(EXIT_FAILURE); + } + *gbt=1; + } else if (!strncmp(argv[i],"-parkes",MAX(ep-argv[i],6))) { + sscanf(ep+1,"%d,%d",channel,pol); + if (*pol<0 || *pol>1) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Parkes receivers must be specified with a channel and polarization (0-1), i.e. -parkes=0,1\n"); + exit(EXIT_FAILURE); + } + *parkes=1; + } else if (!strncmp(argv[i],"-iterations",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",iters); + } else if (!strncmp(argv[i],"-startblock",MAX(ep-argv[i],2))) { + if (*norewind || *resumetape) { + return(1); + } + sscanf(ep+1,"%d",startblock); + } else if (!strncmp(argv[i],"-dumpsubband",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",dumpsubband); + } else if (!strncmp(argv[i],"-rawbitdepth",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",raw_bit_depth); + samples_per_byte = 8/(*raw_bit_depth); + } else if (!strncmp(argv[i],"-max_wus_ondisk",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",max_wus_ondisk); + } else if (!strncmp(argv[i],"-dataclass",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",dataclass); + } else if (!strncmp(argv[i],"-projectdir",MAX(ep-argv[i],2))) { + *projectdir=(char *)calloc(strlen(ep+1)+5,1); + strlcpy(*projectdir,ep+1,strlen(ep+1)+5); + strlcat(*projectdir,"/",strlen(ep+1)+5); + } else if (!strncmp(argv[i],"-analysis_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",useanalysiscfgid); + } else if (!strncmp(argv[i],"-recorder_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",userecordercfgid); + } else if (!strncmp(argv[i],"-receiver_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",usereceivercfgid); + } else if (!strncmp(argv[i],"-splitter_config",MAX(ep-argv[i],2))) { + sscanf(ep+1,"%d",usesplittercfgid); + } else { + return(1); + } + } else { + return(1); + } + } else { + *tape_device=argv[i]; + nargs++; + } + } + //return(nargs!=1); + + // check for required cmd line + //if (! *scidb) return (1); + if (! *projectdir) return (1); + if (! *tape_device) return (1); + if (*gbt && !*raw_bit_depth) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"GBT data requires a bit depth : -rawbitdepth=n\n"); + exit(EXIT_FAILURE); + } + if (*parkes && !*raw_bit_depth) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Parkes data requires a bit depth : -rawbitdepth=n\n"); + exit(EXIT_FAILURE); + } + + + return 0; +} + +//------------------------------------------------------------------------- +int open_dbs() { +//------------------------------------------------------------------------- + + FILE *tmpfile; + + // Will initially open the science DB + if (!db_change(sah_config.scidb_name)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Could not open science database %s\n", sah_config.scidb_name); + if (!nodb) exit(EXIT_FAILURE); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using science database %s\n", sah_config.scidb_name); + } + + boinc_config.parse_file(projectdir); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using boinc config dir %s\n", projectdir); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using boinc database %s\n", boinc_config.db_name); + + // check / commit result template + strcpy(result_template_filename, "templates/"); + strcat(result_template_filename, appname); + strcat(result_template_filename, "_"); + strcat(result_template_filename, result_template_filename_id); + strcpy(result_template_filepath, projectdir); + strcat(result_template_filepath, result_template_filename); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%s %s\n", result_template_filename, result_template_filepath); + if (!(tmpfile=fopen(result_template_filepath,"r"))) { + if (!(tmpfile=fopen(result_template_filepath,"w"))) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Cannot open result file template : %s\n", result_template_filepath); + exit(1); + } + fprintf(tmpfile,result_template); + } + fclose(tmpfile); + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"boinc_db.open\n"); + exit(1); + } + + char tmpquery[128]; + sprintf(tmpquery,"where name ='%s'",appname); + if (app.lookup(tmpquery)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Error looking up appname\n"); + boinc_db.print_error("boinc_app lookup"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"boinc_app lookup\n"); + exit(1); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Splitting for application %s (ID = %d)\n", appname, app.id); + } + + boinc_db.close(); + +} + +//------------------------------------------------------------------------- +int get_config(telescope_id &tel, int file_type, dataheader_t dataheader, int pol) { +//------------------------------------------------------------------------- + //FILE *tmpfile; + char keyfile[1024]; + char buf[1024]; + float channel_freq = 0; + + // tel equates to s4_id and this is where we resolve it. Also... + // A guppi raw file can be from any one of a number of different receivers. + // A guppi raw file is generally of such wide bandwidth that we need to configure + // with the individual channel frequency. A given invocation of the splitter + // specifies a single channel. + if(file_type == guppi) { // GBT + std::string frontend_s = dataheader.frontend; + tel = frontend_pol_to_receiverid[frontend_pol_t(frontend_s, pol)]; + channel_freq = dataheader.sky_freq; + } else if(file_type == dr2) { // ALFA + tel = channel_to_receiverid[beam_pol_to_channel[bmpol_t(beam,pol)]]; + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Invalid file type %d\n", file_type); + exit(1); + } + + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using receiver config with s4_id = %d\n", tel); + + // obtain the settings row - we query on app.od and receiver_config + // because there are multiple settings per app.id + if (usereceivercfgid > 0) { // user requested a specific receiver_config + sprintf(buf,"where active=%d and receiver_cfg=%d",app.id,usereceivercfgid); + if (!splitter_settings.fetch(std::string(buf))) { // fetch + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to find active settings for app.id = %d\n",app.id); + exit(1); + } + } else { // no user request - use tel to find receiver_config + sprintf(buf,"where active=%d and receiver_cfg=(select id from receiver_config where s4_id=%d)",app.id,tel); + if (!splitter_settings.fetch(std::string(buf))) { // fetch + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to find active settings for app.id = %d s4_id = %d\n",app.id, tel); + exit(1); + } + } + + // obtain the receiver config row + if (usereceivercfgid > 0) { // user requested a specific receiver config + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using receiver cfg id: %d (set by user)\n",usereceivercfgid); + sprintf(buf,"where id=%d",usereceivercfgid); + } else { // no user request - receiver config comes from settings + sprintf(buf,"where s4_id=%d",tel); + } + rcvr.fetch(buf); // fetch + if(channel_freq) { + // scale FWHM beamwidth by channel_freq (which is in Hz) + // then replace receiver center (which is in MHz) with channel freq + rcvr.beam_width = rcvr.beam_width * rcvr.center_freq*1e6/channel_freq; + rcvr.center_freq = channel_freq/1e6; + } + splitter_settings.receiver_cfg = rcvr; // copy for WU header inclusion + + // obtain the recorder config row + if (userecordercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using recorder cfg id: %d (set by user)\n",userecordercfgid); + splitter_settings.recorder_cfg = userecordercfgid; + } + splitter_settings.recorder_cfg->fetch(); // fetch + + // obtain the splitter config row + if (usesplittercfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using splitter cfg id: %d (set by user)\n",usesplittercfgid); + splitter_settings.splitter_cfg = usesplittercfgid; + } + splitter_settings.splitter_cfg->fetch(); // fetch + + // obtain the root analysis config row + if (useanalysiscfgid > 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using analysis cfg id: %d (set by user)\n",useanalysiscfgid); + splitter_settings.analysis_cfg = useanalysiscfgid; + } + splitter_settings.analysis_cfg->fetch(); // fetch + root_analysis_cfg_id=splitter_settings.analysis_cfg.id; + + // finally, print all settings + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, "settings: \n\n%s\n", splitter_settings.print_xml(1,1,0).c_str()); + + strcpy(keyfile, projectdir); + strcat(keyfile, "/keys/upload_private"); + if (read_key_file(keyfile,key)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Error reading keyfile.\n"); + exit(1); + } + + return 0; +} + +//------------------------------------------------------------------------- +int check_for_halt() { +//------------------------------------------------------------------------- + FILE *tf; + + tf = fopen(trigger_file_path, "r"); + // tf=0; + if (tf != NULL) { // Stop program + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Found splitter_stop, exiting.\n" ); + exit(EXIT_NORMAL_NOT_EOF); + } + return(0); // Keep going +} + +//------------------------------------------------------------------------- +int wait_until_night() { +//------------------------------------------------------------------------- + time_t t; + struct tm *lt; + do { + t=time(0); + lt=localtime(&t); + // Don't run M-F 8AM-6PM + if ((lt->tm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)) { + sleep(100); + } + } while ((lt->tm_wday>0) && (lt->tm_wday<6) && (lt->tm_hour>8) && (lt->tm_hour<18)); + return 0; +} + +//------------------------------------------------------------------------- +int check_free_disk_space() { +//------------------------------------------------------------------------- + struct statvfs vfsbuf; + + /* check disk free space in working directory */ + statvfs("wu_inbox/.",&vfsbuf); + if (vfsbuf.f_frsize==0) vfsbuf.f_frsize=512; + if (vfsbuf.f_bavail < (100000*1024/vfsbuf.f_frsize)) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Not enough free disk space in working directory to continue\n"); + exit(EXIT_FAILURE); + } + + /* check free disk space in download directory tree */ + std::string download_dir(boinc_config.download_dir); + int waited=0; + download_dir+="/."; + /* wait here if the disk is more than N% full */ + statvfs(download_dir.c_str(),&vfsbuf); + if (vfsbuf.f_blocks > vfsbuf.f_bfree*100/sah_config.min_disk_free_pct) { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Waiting for free space in download directory\n"); + while (vfsbuf.f_blocks > vfsbuf.f_bfree*100/sah_config.min_disk_free_pct) { + waited+=10; + sleep(10); + statvfs(download_dir.c_str(),&vfsbuf); + } + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Waited %d seconds\n", waited); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Continuing...\n"); + } + return 0; +} + +//------------------------------------------------------------------------- +int wait_for_db_wus_ondisk() { +//------------------------------------------------------------------------- + //int wus_ondisk,rv; + DB_STATE_COUNTS state_counts; + int retval; + + // No need to check the DB for every single WUG iteration. + static int check_count = 100; + if (check_count < 100) { + check_count++; + return 0; + } else { + check_count = 0; + } + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"boinc_db.open\n"); + exit(1); + } +#if 0 + retval = boinc_db.set_isolation_level(READ_UNCOMMITTED); + if (retval) { + log_messages.printf(MSG_CRITICAL, "boinc_db.set_isolation_level: %d; %s\n", rv, boinc_db.error_string()); + exit(EXIT_FAILURE); + } + else { + log_messages.printf(MSG_NORMAL, "setting read uncommitted isolation level\n"); + } +#endif + do { + char query[1024]; + sprintf(query,"where appid=%d",app.id); + retval=state_counts.lookup(query); + if (retval) { + boinc_db.print_error("state_counts.lookup"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"DB Error, unable to count workunits on disk\n"); + exit(EXIT_FAILURE); + } + check_for_halt(); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%d WUs ondisk which is greater than the max of %d\n", + state_counts.result_server_state_2, sah_config.max_wus_ondisk); + if (state_counts.result_server_state_2>sah_config.max_wus_ondisk) sleep(600); +#if 0 + sprintf(query,"where appid=%d and server_state=2",app.id); + rv=boinc_result.count(wus_ondisk,query); + if (rv) { + boinc_db.print_error("boinc_result.count"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"DB Error, unable to count workunits on disk\n"); + exit(EXIT_FAILURE); + } + check_for_halt(); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"%d WUs ondisk\n", wus_ondisk); + if (wus_ondisk>sah_config.max_wus_ondisk) sleep(600); + } while (wus_ondisk>sah_config.max_wus_ondisk); +#endif + + } while (state_counts.result_server_state_2>sah_config.max_wus_ondisk); + + boinc_db.close(); + return 0; +} + +//------------------------------------------------------------------------- +int main(int argc, char *argv[]) { +//------------------------------------------------------------------------- + int tape_fd; + char *tape_device; + FILE *tmpfile; + int retval; + char keyfile[1024]; + char tmpstr[1024]; + char buf[1024]; + telescope_id tel = (telescope_id)-1; // -1 = no telescope ID (aka s4_id) yet + + int good_read; + long num_blocks_read; + int vflag; + int file_type = dr2; // default to dr2 for now + int guppi_type = guppi_gbt; // default to guppi_gbt for now + int beamchan; + + /* Process command line arguments */ + if (process_command_line(argc,argv,&tape_device,&norewind,&startblock,&resumetape, + &nodb,&dataclass,&atnight,&max_wus_ondisk,&projectdir,&iters, + &beam,&pol,&alfa,&gbt,&parkes,&channel,&raw_bit_depth,&dumpsubband, + &dumpraw, &useanalysiscfgid, &usereceivercfgid, &userecordercfgid, + &usesplittercfgid)) { + fprintf(stderr,"Usage: splitter tape_device -projectdir=s [-atnight] [-nodb]\n" + "[-xml] [-gregorian] [-resumetape | -norewind | -startblock=n] [-dataclass=n]\n" + "[-max_wus_on_disk=n] [-iterations=n] [-trigger_file_path=filename]\n" + "[-alfa=beam,pol | -gbt=beam,pol -rawbitdepth=n | -parkes=beam,pol -rawbitdepth=n]\n" + "[-analysis_config=id] [-receiver_config=id] [-recorder_config=id] [-splitter_config=id]\n" + "[-dumpsubband=subband] [-dumpraw]\n"); + exit(EXIT_FAILURE); + } + + if(alfa) file_type = dr2; + if(gbt) { + file_type = guppi; + guppi_type = guppi_gbt; + } + if(parkes) { + file_type = guppi; + guppi_type = guppi_parkes; + } + + // MATTL + if (blanking_bit == SOFTWARE_BLANKING_BIT) log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"blanking bit: %d (SOFTWARE)\n",blanking_bit); + else log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"blanking bit: %d (HARDWARE)\n",blanking_bit); + + /* Open log files */ + log_messages.set_debug_level(3); + + retval = sah_config.parse_file(projectdir); + if (retval) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Can't parse config file\n"); + exit(EXIT_FAILURE); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Using configuration:\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"scidb_name = %s\n", sah_config.scidb_name); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_wus_ondisk = %d\n", sah_config.max_wus_ondisk); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"min_quorum = %d\n", sah_config.min_quorum); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"target_nresults = %d\n", sah_config.target_nresults); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_error_results = %d\n", sah_config.max_error_results); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_success_results = %d\n", sah_config.max_success_results); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"max_total_results = %d\n", sah_config.max_total_results); + } + + //get_config(tel, file_type); + open_dbs(); + + check_for_halt(); + + if(file_type == dr2) { + if ((tape_fd=open(tape_device,O_RDONLY|0x2000, 0777))<0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to open tape device\n"); + exit(EXIT_FAILURE); + } + beamchan = 2*beam+pol; + find_start_point_dr2(tape_fd, beam, pol, beamchan); + } else if(file_type == guppi) { + beamchan = 2*channel+pol; + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"invalid file type"); + exit(1); + } + + atexit(cleanup); + getcwd(wd,1024); + + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"Entering main loop\n" ); + // Here is where we read the data that will be processed into WUGs and WUs. + // seti_StructureDr2Data() handles both the reading of header and data. + // iters will be a positve number if the command line specified a certain + // number of iterations. Otherwise, it is initialized to -1 and will thus + // always be true. + // We always want tapebuffer to be 512 blocks in size upon return from + // seti_StructureDr2Data(). If this is not the case then we have hit + // EOF or a read error and it time to exit. Otherwise, tapebuffer.size() + // will change during the body of this loop in one of two ways: + // - valid_run() will erase invalid elements of tapebuffer. + // - do_transform() will erase from the start of tapebuffer up to + // what is needed for WU overlap. + while (iters--) { + + // check, and maybe wait on, various run conditions + fflush(stderr); // TODO why are we fflushing stderr? + if (atnight) wait_until_night(); + check_for_halt(); + check_free_disk_space(); // Make sure we have enough free disk space + if (!nodb) wait_for_db_wus_ondisk(); // Wait for ondisk wus in the database to drop below the threshold + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"less than max wus on disk, continuing\n" ); + check_for_halt(); + fflush(stderr); + // End check, and maybe wait on, various run conditions + + if(file_type == dr2) { + good_read = read_blocks_dr2(tape_fd, // raw dr2 input + startblock, // long int + 512-tapebuffer.size(), // the 512 allows for WU time overlap + beam, // data selection for dr2 is beam wise + pol, + vflag); + } else if(file_type == guppi) { + // guppi data for a WUG may be spread out over more than one file. File naming + // determines the order of files. Thus, we pass a partial file name instead of + // an open descriptor. + const long int numsamples = 256*1048576; // 256*2**20, ie data for 256 WUs, 2**20 samples each + vflag=1; + good_read = read_blocks_guppi(tape_device, // file_prefix, raw guppi input + startblock, + numsamples, + channel, // data selection for guppi is channel wise + pol, + vflag); + fprintf(stderr, "goodread = %ld\n", good_read); +#if 0 + long total_samples; + total_samples = 0; + for(int buffer_i=0; buffer_i < tapebuffer.size(); buffer_i++) { + total_samples += tapebuffer[buffer_i].data.size(); + } + fprintf(stderr, "back in splitter - total_samples = %ld\n", total_samples); +#endif + + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"invalid file type"); + exit(1); + } + + if(!good_read) { + break; // drop out of main loop on first bad read + } else { + if(tel == (telescope_id)-1) { // -1 indicates get_config() not yet called + get_config(tel, file_type, tapebuffer[0].header, pol); // do once, assume constant for this input file + } + if (make_wu_headers(tapebuffer,tel,beamchan,wuheaders)) { + int child_pid=-1; + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG,"doing transform..." ); + do_transform(tapebuffer); + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG," done\n" ); + wait(0); + if (!nodb) sql_finish(); + + do { + sleep(1); + child_pid=fork(); + if (child_pid<0) log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"splitter cannot fork"); + //fprintf( stderr, "child pid: %d\n", child_pid); + } while (child_pid<0); + + if (!child_pid) { + if (!nodb) { + sqldetach(); + while (!sql_database(sah_config.scidb_name)) { + //fprintf(stderr,"child sleeping\n"); + sleep(10); + } + } + rename_wu_files(); + if (!nodb) sql_finish(); + _exit(0); + } + + if (!nodb) { + while (!sql_database(sah_config.scidb_name)) { + //fprintf(stderr,"parent sleeping\n"); + sleep(10); + } + } + } // End if(make_wu_headers()) + } // End if(good_read) + } // End main while() loop + + // A non-zero iters always means we have reached EOF (or had a read error). + if (iters != 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"End of file.\n"); + // clean stop at EOF + return (EXIT_NORMAL_EOF); + } else { + // clean stop, but not EOF (iters satisfied or triggered stop) + // (A return of 1 is an error exit somewhere else in the code.) + return(EXIT_NORMAL_NOT_EOF); + } +} // End main() + +/* + * $Log: mb_splitter.cpp,v $ + * Revision 1.1.2.6 2007/08/16 23:03:19 jeffc + * *** empty log message *** + * + * Revision 1.1.2.5 2007/08/10 19:29:40 jeffc + * *** empty log message *** + * + * Revision 1.1.2.4 2007/06/07 20:01:52 mattl + * *** empty log message *** + * + * Revision 1.1.2.3 2007/06/06 15:58:29 korpela + * *** empty log message *** + * + * Revision 1.1.2.2 2007/04/25 17:27:30 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:43 korpela + * *** empty log message *** + * + * Revision 1.22.2.4 2006/11/08 20:16:26 vonkorff + * Fixes an error message. + * + * Revision 1.22.2.3 2006/11/07 19:26:37 vonkorff + * Fixed lcgf + * + * Revision 1.22.2.2 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.22.2.1 2005/08/01 21:16:25 jeffc + * *** empty log message *** + * + * Revision 1.22 2005/01/27 23:03:27 mattl + * + * commented out tf=0 in check_for_halt + * + * Revision 1.21 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.19 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/27 21:07:04 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/20 18:56:48 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.14 2004/04/08 22:25:47 jeffc + * *** empty log message *** + * + * Revision 1.13 2004/01/22 00:57:53 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.10 2003/11/25 21:59:52 korpela + * *** empty log message *** + * + * Revision 1.9 2003/11/01 20:54:02 korpela + * *** empty log message *** + * + * Revision 1.8 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.7 2003/09/26 20:48:51 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.5.2.2 2003/09/23 00:49:12 korpela + * *** empty log message *** + * + * Revision 1.5.2.1 2003/09/22 17:39:34 korpela + * *** empty log message *** + * + * Revision 1.6 2003/09/22 17:05:38 korpela + * Revision 1.1 2003/07/29 20:35:50 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.6 2003/05/21 00:41:42 korpela + * *** empty log message *** + * + * Revision 3.5 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.4 2003/04/09 17:46:54 korpela + * *** empty log message *** + * + * Revision 3.3 2002/06/20 22:09:17 eheien + * *** empty log message *** + * + * Revision 3.2 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.7 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.6 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added dataclass paramter. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added some db access functions. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 00:58:16 korpela + * Initial revision + * + * + */ diff --git a/splitter_pfb/mb_splitter.h b/splitter_pfb/mb_splitter.h new file mode 100644 index 0000000..3b627f3 --- /dev/null +++ b/splitter_pfb/mb_splitter.h @@ -0,0 +1,149 @@ +/* + * splitter.h + * + * Global definitions from the splitter main program. + * + * $Id: mb_splitter.h,v 1.1.2.2 2007/04/25 17:20:28 korpela Exp $ + * + */ + +#ifndef SPLITTER_H +#define SPLITTER_H + +#include "splitparms.h" +#include "splittypes.h" + +#define MAX(x,y) ( ((x)<(y)) ? (y) : (x) ) +#define MIN(x,y) ( ((y)<(x)) ? (y) : (x) ) + +/* wulog: File for logging names of completed wu files */ +/* errorlog: File for logging errors */ +#include "boinc_db.h" +#include "crypt.h" +#include "backend_lib.h" +#include "sched_config.h" + +extern SCHED_CONFIG boinc_config; +extern DB_APP app; +extern R_RSA_PRIVATE_KEY key; +extern FILE *wulog,*errorlog; +extern std::vector wuheaders; +extern int noencode; +extern int dataclass; +extern char appname[256]; +extern int nodb; +extern int resumetape; +extern int startblock; +extern int raw_bit_depth; +extern int samples_per_byte; +extern int norewind; +extern int output_xml; +extern int polyphase; +extern std::vector wu_database_id; +extern int gregorian; +extern char * projectdir; +extern char trigger_file_name[1024]; +extern receiver_config rcvr; +extern settings splitter_settings; +extern int root_analysis_cfg_id; +extern int dumpsubband; +extern int dumpraw; + +/* Buffer that holds tape data */ +extern std::vector tapebuffer; +extern std::map coord_history; + +/* Number of records remaining in the buffer after WU creations is complete */ +extern int records_in_buffer; + +extern const char *wu_template; +extern const char *result_template; +// jeffc +//extern const char *result_template_filename; +extern char result_template_filename[]; +extern char result_template_filepath[]; +extern char wu_template_filename[]; + +// exit values not defined elsewhere +const int EXIT_NORMAL_EOF = 0; +const int EXIT_NORMAL_NOT_EOF = 2; + +/* Persistant sequence number of wu file */ +extern int seqno; + +#endif + +/* + * $Log: mb_splitter.h,v $ + * Revision 1.1.2.2 2007/04/25 17:20:28 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:43 korpela + * *** empty log message *** + * + * Revision 1.6.2.1 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.6 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.5 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.4 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.2.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.2 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/10/20 19:20:26 korpela + * *** empty log message *** + * + * Revision 2.4 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * Added nodb option + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:10:32 korpela + * Initial revision + * + * + */ diff --git a/splitter_pfb/mb_validrun.cpp b/splitter_pfb/mb_validrun.cpp new file mode 100644 index 0000000..b7d85bb --- /dev/null +++ b/splitter_pfb/mb_validrun.cpp @@ -0,0 +1,147 @@ +/* + * validrun.c + * + * Functions for determining if a section of the tape buffer can be + * turned into a valid work unit + * + * $Id: mb_validrun.cpp,v 1.1.2.1 2006/12/14 22:24:45 korpela Exp $ + * + */ + +#include "sah_config.h" +#include +#include +#include +#include +#include "setilib.h" +#include "splitparms.h" +#include "splittypes.h" +#include "mb_splitter.h" +#include "message.h" + + +bool valid_run(std::vector &tapebuffer, int min_vgc) { + unsigned long start_dataseq=tapebuffer[0].header.dataseq; + unsigned long end_dataseq=tapebuffer[tapebuffer.size()-1].header.dataseq; + bool valid=true; + int i; + + // check for missing frames + if(!(end_dataseq-start_dataseq)==(tapebuffer.size()-1)) { + valid = false; + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Missing frames between %lu and %lu\n", + tapebuffer[0].header.dataseq,tapebuffer[tapebuffer.size()-1].header.dataseq); + for (i=tapebuffer.size()-1;i>0;i--) { // find the last "in sequence" frame + if (tapebuffer[i-1].header.dataseq != (tapebuffer[i].header.dataseq-1)) { + tapebuffer.erase(tapebuffer.begin(),tapebuffer.begin()+i); // delete all frames prior to the miss + } + } + } + + // if still valid, check for failed blanking signal acquisition + if (valid) { + for (i=0;valid && (i 0) { + for (i=0;valid && (i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_ERRNO_H +#include +#endif + +#include "boinc_db.h" +#include "sched_util.h" +#include "setilib.h" +#include "splitparms.h" +#include "splittypes.h" +#include "s_util.h" +#include "util.h" +#include "str_util.h" +#include "str_replace.h" +#include "mb_splitter.h" +#include "message.h" +#include "mb_angdist.h" +#include "cmap_interp.h" +#include "lcgamm.h" +#include "sqlrow.h" +#include "sqlblob.h" +#include "sqlapi.h" +#include "db_table.h" +#include "schema_master.h" +#include "xml_util.h" +#include "db/app_config.h" +#include "str_util.h" + +std::vector wu_database_id; +std::vector > bin_data; + +extern APP_CONFIG sah_config; + +int get_app_id(char * appname) { + DB_APP app; + char clause[256]; + + sprintf(clause, "where name='%s'", appname); + if(app.lookup(clause) == 0) { + return(app.id); + } else { + return -1; + } +} + +int make_wu_headers(std::vector &tapebuffer, + telescope_id tel, + int beamchan, + std::vector &wuheader) { + int procid=getpid(); + double receiver_freq; + int bandno; + FILE *tmpfile; + char tmpstr[256]; + char buf[64]; + static const receiver_config &r(rcvr); + static const settings &s(splitter_settings); + bool group_is_vlar; + + if (!strncmp(s.splitter_cfg->data_type,"encoded", + std::min(static_cast(7),sizeof(s.splitter_cfg->data_type)))) { + noencode=0; + } else { + noencode=1; + } + + tapebuffer[0].header.samplerate*=1e+6; + seconds sample_time(1.0/tapebuffer[0].header.samplerate); + seti_time start_time(tapebuffer[0].header.data_time + -tapebuffer[0].data.size()*0.5*sample_time); + seti_time end_time(tapebuffer[tapebuffer.size()-1].header.data_time); + + + workunit_grp wugrp; + sprintf(wugrp.name,"%s.%ld.%d.%d.%d", + tapebuffer[0].header.name, + procid, + tapebuffer[0].header.dataseq, + (tel-AO_430)&0xff, + s.id); + + // refetch root analysis_config - we need a pristine copy + // because per WUG changes are made below + splitter_settings.analysis_cfg.id=root_analysis_cfg_id; + splitter_settings.analysis_cfg->fetch(); + if(splitter_settings.analysis_cfg.id == 0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"refetch of analysis_config failed\n"); + exit(1); + } + + wugrp.receiver_cfg=r; + wugrp.recorder_cfg=s.recorder_cfg; + wugrp.splitter_cfg=s.splitter_cfg; + wugrp.analysis_cfg=s.analysis_cfg; + + wugrp.data_desc.nsamples=NSAMPLES; + wugrp.data_desc.true_angle_range=0; + coordinate_t start_coord(cmap_interp(coord_history,start_time)); + coordinate_t end_coord(cmap_interp(coord_history,end_time)); + wugrp.data_desc.start_ra=start_coord.ra; + wugrp.data_desc.end_ra=end_coord.ra; + wugrp.data_desc.start_dec=start_coord.dec; + wugrp.data_desc.end_dec=end_coord.dec; + coordinate_t last_coord=start_coord; + double sample_rate=tapebuffer[0].header.samplerate/NSTRIPS; + + // find the bracketing entries in the coordinate history + std::map::iterator above(coord_history.upper_bound(end_time)); + std::map::iterator below(coord_history.lower_bound(start_time)); + std::map::iterator p; + if (above==coord_history.begin()) { + above++; + } + if (below==coord_history.end()) { + below=above; + below--; + } + if (above==below) { + below--; + } + // Calculate the angular distance the beam has traveled + double ncoords=0; + for (p=below;p!=above;p++) + { + wugrp.data_desc.true_angle_range+=angdist(last_coord,p->second); + last_coord=p->second; + ncoords++; + } + wugrp.data_desc.true_angle_range+=angdist(last_coord,end_coord); + if (wugrp.data_desc.true_angle_range==0) wugrp.data_desc.true_angle_range=1e-10; + // Calculate the number of unique signals that could be found in a workunit. + // We will use these numbers to calculate thresholds. + double numgauss=2.36368e+08/std::min(wugrp.data_desc.true_angle_range,10.0); + double numpulse=std::min(4.52067e+10/std::min(wugrp.data_desc.true_angle_range,10.0),2.00382e+11); + double numtrip=std::min(3.25215e+12/std::min(wugrp.data_desc.true_angle_range,10.0),1.44774e+13); + + // check for VLAR workunits + if (wugrp.data_desc.true_angle_range < 2.4*wugrp.receiver_cfg->beam_width) { + group_is_vlar=true; + } else { + group_is_vlar=false; + } + + + // if (useanalysiscfgid > 0) { + // log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL,"Re-reading analysis cfg id: %d (set by user):\n",useanalysiscfgid); + // s.analysis_cfg = useanalysiscfgid; + // } + + // Calculate a unique key to describe this analysis config. + long keyuniq=floor(std::min(wugrp.data_desc.true_angle_range*100,1000.0)+0.5)+ + s.analysis_cfg.id*1024; + if ((keyuniq>((s.analysis_cfg.id+1)*1024)) ||(keyuniq<(s.analysis_cfg.id)*1024)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Invalid keyuniq value!\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%d %d %f\n",keyuniq,s.analysis_cfg.id,wugrp.data_desc.true_angle_range); + exit(1); + } + + keyuniq*=-1; + long save_keyuniq=keyuniq; + splitter_settings.analysis_cfg=wugrp.analysis_cfg; + sprintf(tmpstr,"where keyuniq=%d",keyuniq); + // Check if we've already done this analysis_config... + // Fetch through splitter_settings, since it's alias (s) is const. + splitter_settings.analysis_cfg.id=0; + splitter_settings.analysis_cfg->fetch(tmpstr); + + if (s.analysis_cfg->id==0) { + if (keyuniq != save_keyuniq) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"keyuniq value changed!\n"); + exit(1); + } + + // If not calculate the thresholds based upon the input analysis_config + // Triplets are distributed exponentially... + wugrp.analysis_cfg->triplet_thresh+=(log(numtrip)-29.0652); + + // Gaussians are based upon chisqr... + double p_gauss=lcgf(32.0,wugrp.analysis_cfg->gauss_null_chi_sq_thresh*32.0); + p_gauss-=(log(numgauss)-19.5358); + wugrp.analysis_cfg->gauss_null_chi_sq_thresh=invert_lcgf(p_gauss,32,1e-4)*0.03125; + + // Pulses thresholds are log of the probability + wugrp.analysis_cfg->pulse_thresh+=(log(numpulse)-24.7894); + + wugrp.analysis_cfg->keyuniq=keyuniq; + wugrp.analysis_cfg->insert(); + } else { + wugrp.analysis_cfg=s.analysis_cfg; + } + + strlcpy(wugrp.data_desc.time_recorded, + short_jd_string(start_time.jd().uval()), + sizeof(wugrp.data_desc.time_recorded)); + wugrp.data_desc.time_recorded_jd=start_time.jd().uval(); + wugrp.data_desc.coords.clear(); + + wugrp.data_desc.coords.push_back(start_coord); + // lets have a maximum of 40 coordinate strings + double coord_increment=std::max(ncoords*0.025,1.0); + + double last=0,curr=0; + for (p=below;p!=above;/*nothing*/) + { + wugrp.data_desc.coords.push_back(p->second); + curr+=coord_increment; + for (int z=round(last);zid=0; + sprintf(buf,"%d",beamchan); + wugrp.tape_info->fetch(std::string("where name=\'")+tapebuffer[0].header.name+"\' and beam="+buf); + wugrp.tape_info->start_time=tapebuffer[0].header.data_time.jd().uval(); + wugrp.tape_info->last_block_time=wugrp.tape_info->start_time; + wugrp.tape_info->last_block_done=tapebuffer[0].header.dataseq; +fprintf(stderr, "last_block_done = %d\n", wugrp.tape_info->last_block_done); + wugrp.tape_info->beam=beamchan; + + if (!nodb) { + if (wugrp.tape_info.id) { + if (!(wugrp.tape_info->update())) { + char buf[1024]; + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s",sql_error_message()); + exit(1); + } + } else { + strlcpy(wugrp.tape_info->name,tapebuffer[0].header.name,sizeof(wugrp.tape_info->name)); + wugrp.tape_info->insert(); + } + } else { // nodb + strlcpy(wugrp.tape_info->name,tapebuffer[0].header.name,sizeof(wugrp.tape_info->name)); + } + + if (!nodb) { + sqlint8_t wgid; + if ((wgid=wugrp.insert())<=0) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Workunit_grp insert failed\nwgid=%d\nSQLCODE=%d\nLAST_NON_ZERO_SQLCODE=%d\n",wgid,sql_error_code(),sql_last_error_code()); + exit( 1 ); + } + wugrp.id=wgid; + } + int i; + wu_database_id.resize(NSTRIPS); + bin_data.resize(NSTRIPS); + wuheader.resize(NSTRIPS); + for (i=0;i\n"); + fprintf(tmpfile,"%s\n",appname); + fprintf(tmpfile,wuheader[i].print_xml().c_str()); + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Unable to open file ./wu_inbox/%s, errno=%d\n",wuheader[i].name,errno); + exit(1); + } + bin_data[i].reserve(wuheaders[i].group_info->splitter_cfg->wu_bits_per_sample* + wuheaders[i].group_info->data_desc.nsamples/8); + } + return(1); +} + + +void write_wufile_blocks(int nbytes) { + // doesn't do anything anymore. What was done here is done in output_samples. +} + +int filecopy(char *oldname,char *newname) { + FILE *oldfile,*newfile; + char buffer[16384]; + int nread; + if ((oldfile=fopen(oldname,"rb")) && (newfile=fopen(newname,"wb"))) { + do { + nread=fread(buffer,1,16384,oldfile); + fwrite(buffer,1,nread,newfile); + } while (nread>0); + fclose(oldfile); + fclose(newfile); + return 0; + } else { + return 1; + } +} + + + +void rename_wu_files() { + int i, retval; + char oldname[256],newname[1024]; + unsigned long sz; + DB_WORKUNIT db_wu; + const char *name[1]; + char *wudir="./wu_inbox"; + xml_encoding encoding=(noencode?_binary:_x_setiathome); + FILE *tmpfile; + + if (boinc_db.open(boinc_config.db_name,boinc_config.db_host,boinc_config.db_user,boinc_config.db_passwd)) { + boinc_db.print_error("boinc_db.open"); + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Fatal error in boinc_db.open\n"); + exit(1); + } + + for (i=0;i",tmpstr.size(), + xml_encoding_names[encoding]); + fwrite(tmpstr.c_str(),tmpstr.size(),1,tmpfile); + fprintf(tmpfile,"\n"); + fprintf(tmpfile,"\n"); + sz=bin_data[i].size(); + + fclose(tmpfile); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Header file no longer exists! splitter start script may be failing\n "); + exit(1); + } + if (!nodb) { + if (!filecopy(oldname,newname)) { + db_wu.clear(); + db_wu.opaque=wuheaders[i].id; + strncpy(db_wu.name,name[0],sizeof(db_wu.name)-2); + db_wu.appid=app.id; + //db_wu.rsc_fpops_est=2.79248e+13*6; + //db_wu.rsc_fpops_bound=4.46797e+14*6; + double beam=wuheaders[i].group_info->receiver_cfg->beam_width; + double ar=wuheaders[i].group_info->data_desc.true_angle_range; + double dur=(double)(wuheaders[i].group_info->data_desc.nsamples)/wuheaders[i].subband_desc.sample_rate; + double min_slew=wuheaders[i].group_info->analysis_cfg->pot_min_slew; + double max_slew=wuheaders[i].group_info->analysis_cfg->pot_max_slew; + double autocorr_len=wuheaders[i].group_info->analysis_cfg->autocorr_fftlen; + double autocorr_flops=0; + if (autocorr_len) autocorr_flops=7.5e+06*autocorr_len*log(autocorr_len); + if ( ar <= beam ) { + db_wu.rsc_fpops_est=8.036e+13+autocorr_flops; + } else if ( ar <= ( dur*min_slew ) ) { + db_wu.rsc_fpops_est=4.805e+13+autocorr_flops+2.296e+12/ar; + } else if ( ar <= ( dur*max_slew ) ) { + db_wu.rsc_fpops_est=4.592e+13+autocorr_flops+1.476e+13/ar; + } else { + db_wu.rsc_fpops_est=2.378e+13+autocorr_flops; + } + db_wu.rsc_fpops_est*=(0.333/wuheaders[i].group_info->analysis_cfg->chirp_resolution); + db_wu.rsc_fpops_bound=db_wu.rsc_fpops_est*20; + db_wu.rsc_memory_bound=33554432; + db_wu.rsc_disk_bound=33554432; + // Our minimum is a 40 MFLOP machine + db_wu.delay_bound=std::max(86400.0*7,db_wu.rsc_fpops_est/4e+7); + db_wu.min_quorum=sah_config.min_quorum; + db_wu.target_nresults=sah_config.target_nresults; + db_wu.max_error_results=sah_config.max_error_results; + db_wu.max_total_results=sah_config.max_total_results; + db_wu.max_success_results=sah_config.max_success_results; + //strncpy(db_wu.app_name,appname,sizeof(db_wu.app_name)-2); + if((db_wu.appid = get_app_id(appname)) == -1) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"Could not get appid\n "); + exit(1); + } + if (create_work(db_wu, + wu_template, + result_template_filename, + result_template_filepath, + name, + 1, + boinc_config, + NULL + ) + ) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"create work failed\n"); + exit(1); + } + //unlink(oldname); // we now *always* unlink + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"file copy failed\n"); + exit(1); + } + unlink(oldname); + } + } + boinc_db.close(); +} + +/* + * $Log: mb_wufiles.cpp,v $ + * Revision 1.1.2.6 2007/08/10 18:21:13 korpela + * *** empty log message *** + * + * Revision 1.1.2.5 2007/08/09 21:31:08 korpela + * *** empty log message *** + * + * Revision 1.1.2.4 2007/06/07 20:01:52 mattl + * *** empty log message *** + * + * Revision 1.1.2.3 2007/06/06 15:58:30 korpela + * *** empty log message *** + * + * Revision 1.1.2.2 2007/04/25 17:27:31 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:45 korpela + * *** empty log message *** + * + * Revision 1.29.2.14 2006/05/03 19:14:31 korpela + * Updated work estimates. + * + * Revision 1.29.2.13 2006/04/24 18:41:02 korpela + * *** empty log message *** + * + * Revision 1.29.2.12 2006/01/13 00:37:58 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.29.2.11 2006/01/10 00:39:04 jeffc + * *** empty log message *** + * + * Revision 1.29.2.10 2006/01/05 23:55:22 korpela + * *** empty log message *** + * + * Revision 1.29.2.9 2005/12/05 22:11:40 korpela + * Fixed bug in flops estimate. + * + * Revision 1.29.2.8 2005/10/05 16:22:17 jeffc + * removed reference to old/new boolean for directory hash. + * + * Revision 1.29.2.7 2005/09/22 23:05:22 korpela + * Fixed threshold calculation. Was using chisqr rather than reduced chisqr. + * + * Revision 1.29.2.6 2005/09/21 22:11:23 korpela + * Updated Makefile.in for OpenSSL. + * Added dynamic threshold generation to wufiles.cpp. + * + * Revision 1.29.2.5 2005/08/01 17:47:38 korpela + * Type fixed. + * + * Revision 1.29.2.4 2005/08/01 17:43:20 korpela + * Refinement of FLOPS estimate for workunits. + * + * Revision 1.29.2.3 2005/07/26 17:17:01 korpela + * Typo fix + * + * Revision 1.29.2.2 2005/07/19 00:15:19 korpela + * Revised delay bound and FLOP estimate for setiathome_enhanced. + * + * Revision 1.29.2.1 2005/07/06 01:30:17 korpela + * Updated estimates of FPOPS per workunit for setiathome enhanced. + * + * Revision 1.29 2005/03/08 22:36:15 jeffc + * jeffc - fixed call to create_work() + * + * Revision 1.28 2005/02/15 23:06:47 korpela + * Fixed missing dir_hier symbol. + * + * Revision 1.27 2004/12/27 20:48:54 jeffc + * *** empty log message *** + * + * Revision 1.26 2004/11/18 22:24:48 korpela + * *** empty log message *** + * + * Revision 1.25 2004/08/25 22:42:11 jeffc + * *** empty log message *** + * + * Revision 1.24 2004/08/14 04:44:26 jeffc + * *** empty log message *** + * + * Revision 1.23 2004/08/12 15:45:41 jeffc + * *** empty log message *** + * + * Revision 1.22 2004/07/15 17:54:20 jeffc + * *** empty log message *** + * + * Revision 1.21 2004/07/09 22:35:39 jeffc + * *** empty log message *** + * + * Revision 1.20 2004/07/01 17:56:51 korpela + * *** empty log message *** + * + * Revision 1.19 2004/06/25 13:49:33 jeffc + * *** empty log message *** + * + * Revision 1.18 2004/06/18 23:23:32 jeffc + * *** empty log message *** + * + * Revision 1.17 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.16 2004/06/02 20:51:32 jeffc + * *** empty log message *** + * + * Revision 1.15 2004/01/22 00:57:54 korpela + * *** empty log message *** + * + * Revision 1.14 2004/01/20 22:33:44 korpela + * *** empty log message *** + * + * Revision 1.13 2004/01/06 22:44:05 korpela + * *** empty log message *** + * + * Revision 1.12 2004/01/01 18:42:01 korpela + * *** empty log message *** + * + * Revision 1.11 2003/12/12 01:51:39 korpela + * Now using the opaque field in workunit to store SAH wuid. + * + * Revision 1.10 2003/12/03 23:46:41 korpela + * WU count is now only for SAH workunits. + * + * Revision 1.9 2003/11/25 21:59:53 korpela + * *** empty log message *** + * + * Revision 1.8 2003/11/11 06:20:30 korpela + * Increased max fpops_max to prevent timeout on windows clients + * + * Revision 1.7 2003/10/25 18:19:44 korpela + * *** empty log message *** + * + * Revision 1.6 2003/10/24 16:57:03 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/26 20:48:52 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.3.2.2 2003/09/22 19:00:31 korpela + * *** empty log message *** + * + * Revision 1.3.2.1 2003/09/22 17:39:35 korpela + * *** empty log message *** + * + * Revision 1.4 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:44 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/07/29 20:36:00 korpela + * + * renames .C files to .cpp + * + * Revision 1.3 2003/06/05 15:52:47 korpela + * + * Fixed coordinate bug that was using the wrong zenith angle from the telescope + * strings when handling units from the gregorian. + * + * Revision 1.2 2003/06/03 01:01:18 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.8 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.7 2003/04/10 17:32:25 korpela + * *** empty log message *** + * + * Revision 3.6 2002/06/21 01:42:15 eheien + * *** empty log message *** + * + * Revision 3.5 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.4 2001/08/17 22:20:54 korpela + * *** empty log message *** + * + * Revision 3.3 2001/08/17 01:22:31 korpela + * *** empty log message *** + * + * Revision 3.2 2001/08/17 01:16:53 korpela + * *** empty log message *** + * + * Revision 3.1 2001/08/16 23:42:08 korpela + * Mods for splitter to make binary workunits. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.18 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.17 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.16 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.15 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.14 1999/02/22 22:21:09 korpela + * added -nodb option + * + * Revision 2.13 1999/02/11 16:46:28 korpela + * Added db access functions. + * + * Revision 2.12 1999/01/04 22:27:55 korpela + * Updated return codes. + * + * Revision 2.11 1998/12/14 23:41:44 korpela + * Added subband_base to work unit header. + * Changed frequency calculation. + * + * Revision 2.10 1998/12/14 21:55:07 korpela + * Added fft_len and ifft_len to work unit header. + * + * Revision 2.9 1998/11/13 23:58:52 korpela + * Modified for move of name field between structures. + * + * Revision 2.8 1998/11/13 22:18:12 davea + * *** empty log message *** + * + * Revision 2.7 1998/11/10 01:55:26 korpela + * Server requires a CR at the end of a WU file + * ??? + * + * Revision 2.6 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.5 1998/11/05 21:33:02 korpela + * Fixed angle_range bug. + * + * Revision 2.4 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.3 1998/11/02 21:20:58 korpela + * Modified for (internal) integer receiver ID. + * + * Revision 2.2 1998/11/02 18:45:39 korpela + * Changed location of timecvt.h + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.2 1998/10/30 20:26:03 korpela + * Bug Fixes. Now mostly working. + * + * Revision 1.1 1998/10/27 01:01:16 korpela + * Initial revision + * + * + */ diff --git a/splitter_pfb/mb_wufiles.h b/splitter_pfb/mb_wufiles.h new file mode 100644 index 0000000..fc11001 --- /dev/null +++ b/splitter_pfb/mb_wufiles.h @@ -0,0 +1,48 @@ +/* + * + * Functions for managing wufiles and their data + * + * $Id: mb_wufiles.h,v 1.1.2.2 2007/04/25 17:20:28 korpela Exp $ + * + */ + + +extern std::vector > bin_data; + +int make_wu_headers(std::vector &tapebuffer, + telescope_id tel, + int beamchan, + std::vector &wuheader) ; +void write_wufile_blocks(int nbytes) ; +void rename_wu_files(); + +/* + * $Log: mb_wufiles.h,v $ + * Revision 1.1.2.2 2007/04/25 17:20:28 korpela + * *** empty log message *** + * + * Revision 1.1.2.1 2006/12/14 22:24:46 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:45 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:44 korpela + * + * Again + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:13:16 korpela + * Initial revision + * + * + */ diff --git a/splitter_pfb/message.cpp b/splitter_pfb/message.cpp new file mode 100644 index 0000000..d15181e --- /dev/null +++ b/splitter_pfb/message.cpp @@ -0,0 +1,65 @@ +/* + * Functions for sending messages to stderr and log files. + * + * $Id: message.cpp,v 1.2.4.2 2006/12/14 22:24:46 korpela Exp $ + */ + +#include "sah_config.h" +#include +#include +#include + +#include "boinc_db.h" +#include "sched_config.h" +#include "sched_msgs.h" +#include "splitter.h" + +void message(char *msg) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL,"%s %s",tapeheaders[0].name,msg); +} + + + +/* + * $Log: message.cpp,v $ + * Revision 1.2.4.2 2006/12/14 22:24:46 korpela + * *** empty log message *** + * + * Revision 1.2.4.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.2 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.1 2003/07/29 20:35:43 korpela + * + * renames .C files to .cpp + * + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.2 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 00:56:16 korpela + * Initial revision + * + */ diff --git a/splitter_pfb/message.h b/splitter_pfb/message.h new file mode 100644 index 0000000..6c51713 --- /dev/null +++ b/splitter_pfb/message.h @@ -0,0 +1,40 @@ +/* + * Functions for sending messages to stderr and log files. + * + * $Id: message.h,v 1.1.4.1 2006/01/13 00:37:57 korpela Exp $ + */ + +#include "sched_msgs.h" + +void message(char *msg); + +/* + * $Log: message.h,v $ + * Revision 1.1.4.1 2006/01/13 00:37:57 korpela + * Moved splitter to using standard BOINC logging mechanisms. All stderr now + * goes to "error.log" + * + * Added command line parameters "-iterations=" (number of workunit groups to + * create before exiting), "-trigger_file_path=" (path to the splitter_stop trigger + * file. Default is /disks/setifiler1/wutape/tapedir/splitter_stop). + * + * Reduced deadlines by a factor of three. We now need a 30 MFLOP machine to meet + * the deadline. + * + * Revision 1.1 2003/06/03 00:16:14 korpela + * + * Initial splitter under CVS control. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.1 1998/11/02 16:41:21 korpela + * Minor Change. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.1 1998/10/27 01:09:00 korpela + * Initial revision + * + */ diff --git a/splitter_pfb/splitparms.h b/splitter_pfb/splitparms.h new file mode 100644 index 0000000..bc0c4a5 --- /dev/null +++ b/splitter_pfb/splitparms.h @@ -0,0 +1,128 @@ +/* splitparms.h + * + * Most of the definitions required by the splitter + * + * $Id: splitparms.h,v 1.10 2004/11/23 21:26:29 jeffc Exp $ + * + */ + +#ifndef SPLITPARMS_H +#define SPLITPARMS_H + +#include + +#define WU_SUBDIR "/download" + +#define SPLITTER_VERSION 0x0012 +#define MAX_WUS_ONDISK 500000 +#define N_SIMULT_SPLITTERS 6 + +/* Work Unit Parameters */ +#define NBYTES 262144L +#define NSAMPLES (NBYTES*CHAR_BIT/2) +#define MAX_POSITION_HISTORY 40 +#define WU_FILESIZE (360L*1024) + +/* FFT Parameters */ +#define FFT_LEN 256 +#define IFFT_LEN 1 +#define NSTRIPS (FFT_LEN/IFFT_LEN) + +/* Time Zone Parameters */ +#define UTC 0.0 +#define AST (UTC-4.0) + +/* Arecibo Observatory Parameters */ +#define ARECIBO_LAT 18.3538056 +#define ARECIBO_LON (-66.7552222) + +#endif +/* + * $Log: splitparms.h,v $ + * Revision 1.10 2004/11/23 21:26:29 jeffc + * *** empty log message *** + * + * Revision 1.9 2004/08/14 04:44:26 jeffc + * *** empty log message *** + * + * Revision 1.8 2004/06/16 20:57:19 jeffc + * *** empty log message *** + * + * Revision 1.7 2004/05/22 18:12:18 korpela + * *** empty log message *** + * + * Revision 1.6 2003/10/27 17:53:21 korpela + * *** empty log message *** + * + * Revision 1.5 2003/09/26 20:48:51 jeffc + * jeffc - merge in branch setiathome-4_all_platforms_beta. + * + * Revision 1.3.2.1 2003/09/22 17:39:34 korpela + * *** empty log message *** + * + * Revision 1.4 2003/09/22 17:05:38 korpela + * *** empty log message *** + * + * Revision 1.3 2003/09/11 18:53:38 korpela + * *** empty log message *** + * + * Revision 1.2 2003/08/05 17:23:42 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.1 2003/06/03 00:23:40 korpela + * + * Again + * + * Revision 3.1 2001/11/07 00:51:47 korpela + * Added splitter version to database. + * Added max_wus_ondisk option. + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.9 2000/12/01 01:13:29 korpela + * *** empty log message *** + * + * Revision 2.8 1999/10/20 19:20:26 korpela + * *** empty log message *** + * + * Revision 2.7 1999/06/07 21:00:52 korpela + * *** empty log message *** + * + * Revision 2.6 1999/03/27 16:19:35 korpela + * *** empty log message *** + * + * Revision 2.5 1999/03/05 01:47:18 korpela + * Added data_class field. + * + * Revision 2.4 1999/02/23 18:57:09 korpela + * *** empty log message *** + * + * Revision 2.3 1999/02/22 22:21:09 korpela + * Changed version number. + * + * Revision 2.2 1999/02/11 16:46:28 korpela + * Added WU_FILESIZE, RECORDER_BUFFER_BYTES, RECORDER_BUFFER_SAMPLES.` + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.4 1998/10/27 01:10:04 korpela + * Bug fixes. + * + * Revision 1.3 1998/10/19 23:06:40 korpela + * Added UTC and AST definition. + * Added ARECIBO_LAT and ARECIBO_LON definitions. + * + * Revision 1.2 1998/10/16 19:22:14 korpela + * Reduced WU file size from 512K to 256K. + * + * Revision 1.1 1998/10/15 16:39:51 korpela + * Initial revision + * + */ + diff --git a/splitter_pfb/splittypes.h b/splitter_pfb/splittypes.h new file mode 100644 index 0000000..46e4b37 --- /dev/null +++ b/splitter_pfb/splittypes.h @@ -0,0 +1,111 @@ +/* splittypes.h + * + * Type definitions specific to the splitter. + * + * + * $Id: splittypes.h,v 1.4 2003/08/05 17:23:43 korpela Exp $ + * + */ +#ifndef SPLITTYPES_H +#define SPLITTYPES_H + +#include + +#include "splitparms.h" +#include "s_util.h" +#include "seti_header.h" + +//typedef struct wuheader { + //WU_INFO wuhead; + //SETI_WU_INFO wuinfo; +//} wuheader_t; + +typedef struct tapeheader { + char name[36]; + int rcdtype; + int numringbufs; + int numdiskbufs; + unsigned long frameseq; + unsigned long dataseq; + int missed; + TIME st; + SCOPE_STRING telstr; + int source; + double centerfreq,samplerate; + char version[16]; +} tapeheader_t; + +typedef struct buffer_pos { + int frame; + long byte; +} buffer_pos_t; + +#endif +/* + * $Log: splittypes.h,v $ + * Revision 1.4 2003/08/05 17:23:43 korpela + * More work on database stuff. + * Further tweaks. + * + * Revision 1.3 2003/07/29 20:35:51 korpela + * + * renames .C files to .cpp + * + * Revision 1.2 2003/06/03 01:01:17 korpela + * + * First working splitter under CVS. + * + * Revision 1.1 2003/06/03 00:23:41 korpela + * + * Again + * + * Revision 3.1 2003/05/19 17:40:59 eheien + * *** empty log message *** + * + * Revision 3.0 2001/08/01 19:04:57 korpela + * Check this in before Paul screws it up. + * + * Revision 2.5 1999/02/11 16:46:28 korpela + * Added startblock and norewind support, and wu_database_id. + * + * Revision 2.4 1998/11/10 00:02:44 korpela + * Moved remaining wuheader fields into a WU_INFO structure. + * + * Revision 2.3 1998/11/05 21:18:41 korpela + * Moved name field from header to seti header. + * + * Revision 2.2 1998/11/02 21:20:58 korpela + * Moved tape_version and encoding_type into SETI_WU_INFO. + * + * Revision 2.1 1998/11/02 16:38:29 korpela + * Variable type changes. + * + * Revision 2.0 1998/10/30 22:00:04 korpela + * Conversion to C++ and merger with client source tree. + * + * Revision 1.7 1998/10/30 21:01:13 davea + * *** empty log message *** + * + * Revision 1.6 1998/10/27 01:10:58 korpela + * Modified tapeheader_t to match new tape header fields. + * + * Revision 1.5 1998/10/19 23:04:32 korpela + * Moved times in telstr_t into an st_t. + * Changed name of ast_t to st_t. + * Added time zone (tz) field to ast_t. + * + * Revision 1.4 1998/10/15 19:13:30 korpela + * Renamed "unix" fields to "unix_time" because of GCC #define. + * Added position_history field to wuheader_t. + * + * Revision 1.3 1998/10/15 18:58:50 korpela + * Added time_t unix to ast_t and telstr_t types. + * Changed times in wuheader_t to time_t types. + * + * Revision 1.2 1998/10/15 18:01:19 korpela + * Removed month field from ast_t and telstr_t. + * + * Revision 1.1 1998/10/15 16:20:24 korpela + * Initial revision + * + */ diff --git a/splitter_pfb/tags b/splitter_pfb/tags new file mode 100644 index 0000000..36fa81d --- /dev/null +++ b/splitter_pfb/tags @@ -0,0 +1,463 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ +!_TAG_PROGRAM_NAME Exuberant Ctags // +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ +!_TAG_PROGRAM_VERSION 5.8 // +ARECIBO_LAT splitparms.h 53;" d +ARECIBO_LON splitparms.h 54;" d +AST splitparms.h 50;" d +AltAzCorrection coordcvt.cpp /^void AltAzCorrection(double *alt, double *az) {$/;" f namespace:SPLITTER +COMPLEX fftw.h 74;" d +COORDCVT_H coordcvt.h 11;" d +D2R coordcvt.cpp 109;" d file: +DB_FNS_H db_fns.h 8;" d +DL_IMPORT fftw.h 141;" d +DL_IMPORT fftw.h 143;" d +DL_IMPORT fftw.h 145;" d +DL_IMPORT fftw.h 148;" d +DTOR angdist.cpp 16;" d file: +DTOR mb_angdist.cpp 24;" d file: +EXIT_NORMAL_EOF mb_splitter.h /^const int EXIT_NORMAL_EOF = 0;$/;" v +EXIT_NORMAL_NOT_EOF mb_splitter.h /^const int EXIT_NORMAL_NOT_EOF = 2;$/;" v +FFTWND_FORCE_BUFFERED fftw.h 289;" d +FFTWND_HAS_PRINT_PLAN fftw.h 401;" d +FFTW_1_0_COMPATIBILITY fftw.h 68;" d +FFTW_BACKWARD fftw.h /^ FFTW_FORWARD = -1, FFTW_BACKWARD = 1$/;" e enum:__anon2 +FFTW_COMPLEX fftw.h /^typedef fftw_complex FFTW_COMPLEX;$/;" t +FFTW_ENABLE_FLOAT fftw.h 40;" d +FFTW_ESTIMATE fftw.h 278;" d +FFTW_FAILURE fftw.h /^ FFTW_SUCCESS = 0, FFTW_FAILURE = -1$/;" e enum:__anon3 +FFTW_FORWARD fftw.h /^ FFTW_FORWARD = -1, FFTW_BACKWARD = 1$/;" e enum:__anon2 +FFTW_GENERIC fftw.h /^ FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER,$/;" e enum:fftw_node_type +FFTW_H fftw.h 26;" d +FFTW_HAS_FPRINT_PLAN fftw.h 335;" d +FFTW_HAS_PLAN_SPECIFIC fftw.h 295;" d +FFTW_HAS_WISDOM fftw.h 322;" d +FFTW_HC2HC fftw.h /^ FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC$/;" e enum:fftw_node_type +FFTW_HC2REAL fftw.h /^ FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC$/;" e enum:fftw_node_type +FFTW_IN_PLACE fftw.h 282;" d +FFTW_MEASURE fftw.h 279;" d +FFTW_NOTW fftw.h /^ FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER,$/;" e enum:fftw_node_type +FFTW_OUT_OF_PLACE fftw.h 281;" d +FFTW_RADER fftw.h /^ FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER,$/;" e enum:fftw_node_type +FFTW_REAL fftw.h /^typedef fftw_real FFTW_REAL;$/;" t +FFTW_REAL2HC fftw.h /^ FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC$/;" e enum:fftw_node_type +FFTW_RGENERIC fftw.h /^ FFTW_REAL2HC, FFTW_HC2REAL, FFTW_HC2HC, FFTW_RGENERIC$/;" e enum:fftw_node_type +FFTW_SUCCESS fftw.h /^ FFTW_SUCCESS = 0, FFTW_FAILURE = -1$/;" e enum:__anon3 +FFTW_THREADSAFE fftw.h 285;" d +FFTW_TWIDDLE fftw.h /^ FFTW_NOTW, FFTW_TWIDDLE, FFTW_GENERIC, FFTW_RADER,$/;" e enum:fftw_node_type +FFTW_USE_WISDOM fftw.h 283;" d +FFT_LEN splitparms.h 27;" d +FILESIZE randomdata.cpp 12;" d file: +FILESIZE squarewave.cpp 12;" d file: +FRAME_DATA_SIZE randomdata.cpp 10;" d file: +FRAME_DATA_SIZE squarewave.cpp 10;" d file: +HANNING polyphase.h 3;" d +HEADER_SIZE randomdata.cpp 11;" d file: +HEADER_SIZE squarewave.cpp 11;" d file: +IFFT_LEN splitparms.h 28;" d +MAKEBUFS_H makebufs.h 11;" d +MAX mb_splitter.h 16;" d +MAX splitter.h 16;" d +MAX_POSITION_HISTORY splitparms.h 23;" d +MAX_WUS_ONDISK splitparms.h 17;" d +MIN mb_splitter.h 17;" d +MIN splitter.h 17;" d +NBYTES splitparms.h 21;" d +NONE polyphase.h 1;" d +NSAMPLES splitparms.h 22;" d +NSTRIPS splitparms.h 29;" d +NUM_FRAMES randomdata.cpp 9;" d file: +NUM_FRAMES squarewave.cpp 9;" d file: +N_SIMULT_SPLITTERS splitparms.h 18;" d +N_WINDOWS polyphase.h 5;" d +P_FFT_LEN polyphase.h 6;" d +READTAPE_H readtape.h 10;" d +REAL fftw.h 73;" d +RECORDER_BUFFER_BYTES splitparms.h 44;" d +RECORDER_BUFFER_SAMPLES splitparms.h 45;" d +SAMPLES_PER_OBUF dotransform.cpp 32;" d file: +SAMPLES_PER_OBUF dotransform.h 17;" d +SAMPLES_PER_OBUF mb_dotransform.cpp 30;" d file: +SAMPLES_PER_OBUF mb_dotransform.h 15;" d +SAMPLES_PER_OBUF mb_polyphase.cpp 26;" d file: +SAMPLES_PER_OBUF polyphase.cpp 25;" d file: +SAMPLES_PER_OBUF polyphase.h 14;" d +SPLITPARMS_H splitparms.h 10;" d +SPLITTER coordcvt.cpp /^namespace SPLITTER {$/;" n file: +SPLITTER_H mb_splitter.h 11;" d +SPLITTER_H splitter.h 11;" d +SPLITTER_VERSION splitparms.h 16;" d +SPLITTYPES_H mb_splittypes.h 10;" d +SPLITTYPES_H splittypes.h 10;" d +SWAP four1.cpp 11;" d file: +SWAP four1.cpp 57;" d file: +TAPE_BUFFER_SIZE splitparms.h 37;" d +TAPE_DATA_SIZE splitparms.h 33;" d +TAPE_FRAMES_IN_BUFFER splitparms.h 39;" d +TAPE_FRAMES_PER_RECORD splitparms.h 34;" d +TAPE_FRAMES_PER_WU splitparms.h 40;" d +TAPE_FRAME_SIZE splitparms.h 35;" d +TAPE_HEADER_SIZE splitparms.h 32;" d +TAPE_RECORDS_IN_BUFFER splitparms.h 38;" d +TAPE_RECORD_SIZE splitparms.h 36;" d +TBUF_OFFSET dotransform.cpp 108;" d file: +TBUF_OFFSET dotransform.h 18;" d +TBUF_OFFSET mb_dotransform.h 16;" d +TBUF_OFFSET mb_polyphase.cpp 97;" d file: +TBUF_OFFSET polyphase.cpp 96;" d file: +TBUF_OFFSET polyphase.h 15;" d +USE_MYSQL mb_splitter.cpp 10;" d file: +USE_MYSQL mb_wufiles.cpp 10;" d file: +USE_MYSQL readtape.cpp 10;" d file: +USE_MYSQL splitter.cpp 10;" d file: +USE_MYSQL wufiles.cpp 10;" d file: +UTC splitparms.h 49;" d +WELCH polyphase.h 2;" d +WU_FILESIZE splitparms.h 24;" d +WU_OVERLAP_BYTES splitparms.h 43;" d +WU_OVERLAP_FRAMES splitparms.h 42;" d +WU_OVERLAP_RECORDS splitparms.h 41;" d +WU_SUBDIR splitparms.h 14;" d +alfa mb_splitter.cpp /^int alfa;$/;" v +angdist angdist.cpp /^double angdist(const SCOPE_STRING &a, const SCOPE_STRING &b) {$/;" f +angdist angdist.cpp /^double angdist(double r1, double d1, double r2, double d2) {$/;" f +angdist mb_angdist.cpp /^double angdist(const coordinate_t &a, const coordinate_t &b) {$/;" f +angdist mb_angdist.cpp /^double angdist(double r1, double d1, double r2, double d2) {$/;" f +app mb_splitter.cpp /^DB_APP app;$/;" v +app splitter.cpp /^DB_APP app;$/;" v +atnight mb_splitter.cpp /^int atnight;$/;" v +atnight splitter.cpp /^int atnight;$/;" v +beam mb_splitter.cpp /^int beam;$/;" v +bin_data mb_wufiles.cpp /^std::vector > bin_data;$/;" v +bin_data wufiles.cpp /^static std::vector bin_data[NSTRIPS];$/;" v file: +boinc_config mb_splitter.cpp /^SCHED_CONFIG boinc_config;$/;" v +boinc_config splitter.cpp /^SCHED_CONFIG boinc_config;$/;" v +buffer_pos mb_splittypes.h /^typedef struct buffer_pos {$/;" s +buffer_pos splittypes.h /^typedef struct buffer_pos {$/;" s +buffer_pos_t mb_splittypes.h /^} buffer_pos_t;$/;" t typeref:struct:buffer_pos +buffer_pos_t splittypes.h /^} buffer_pos_t;$/;" t typeref:struct:buffer_pos +byte splittypes.h /^ long byte;$/;" m struct:buffer_pos +c_im fftw.h 57;" d +c_re fftw.h 56;" d +cdesc fftw.h /^ const fftw_codelet_desc *cdesc;$/;" m struct:fftw_twiddle_struct +cdesc fftw.h /^ fftw_codelet_desc *cdesc;$/;" m struct:fftw_rader_data_struct +centerfreq mb_splittypes.h /^ double centerfreq,samplerate;$/;" m struct:tapeheader +centerfreq splittypes.h /^ double centerfreq,samplerate;$/;" m struct:tapeheader +check_for_halt mb_splitter.cpp /^int check_for_halt() {$/;" f +check_for_halt splitter.cpp /^int check_for_halt() {$/;" f +check_free_disk_space mb_splitter.cpp /^int check_free_disk_space() {$/;" f +check_free_disk_space splitter.cpp /^int check_free_disk_space() {$/;" f +cleanup mb_splitter.cpp /^void cleanup(void) {$/;" f +cleanup splitter.cpp /^void cleanup(void) {$/;" f +cmap_interp cmap_interp.cpp /^coordinate_t cmap_interp(std::map &map, seti_time &t) {$/;" f +codelet fftw.h /^ fftw_generic_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon8 +codelet fftw.h /^ fftw_hc2hc_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +codelet fftw.h /^ fftw_hc2real_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon11 +codelet fftw.h /^ fftw_notw_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon6 +codelet fftw.h /^ fftw_rader_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 +codelet fftw.h /^ fftw_real2hc_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon10 +codelet fftw.h /^ fftw_rgeneric_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 +codelet fftw.h /^ fftw_twiddle_codelet *codelet;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 +codelet fftw.h /^ void (*codelet) (); \/* pointer to the codelet itself *\/$/;" m struct:__anon4 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon10 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon11 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon6 +codelet_desc fftw.h /^ const fftw_codelet_desc *codelet_desc;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 +coord_history mb_splitter.cpp /^std::map coord_history;$/;" v +cost fftw.h /^ double cost;$/;" m struct:fftw_plan_struct +cprint mb_splitter.cpp /^void cprint(char *p) {$/;" f +cprint splitter.cpp /^void cprint(char *p) {$/;" f +current_record readtape.cpp /^int current_record;$/;" v +databuf dotransform.cpp /^float databuf[FFT_LEN*2];$/;" v +dataclass mb_splitter.cpp /^int dataclass;$/;" v +dataclass splitter.cpp /^int dataclass;$/;" v +dataseq mb_splittypes.h /^ unsigned long dataseq;$/;" m struct:tapeheader +dataseq splittypes.h /^ unsigned long dataseq;$/;" m struct:tapeheader +daynames writeheader.cpp /^char *daynames[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};$/;" v +delbuffer makebufs.cpp /^void delbuffer(void) {$/;" f +delbuffer_sig makebufs.cpp /^void delbuffer_sig(int i) {$/;" f +dir fftw.h /^ fftw_direction dir;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +dir fftw.h /^ fftw_direction dir;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 +dir fftw.h /^ fftw_direction dir; \/* direction *\/$/;" m struct:__anon4 +dir fftw.h /^ fftw_direction dir;$/;" m struct:__anon14 +dir fftw.h /^ fftw_direction dir;$/;" m struct:fftw_plan_struct +do_polyphase mb_polyphase.cpp /^void do_polyphase(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu) {$/;" f +do_polyphase polyphase.cpp /^void do_polyphase(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu) {$/;" f +do_transform dotransform.cpp /^void do_transform(buffer_pos_t *start_of_wu, buffer_pos_t *end_of_wu) {$/;" f +do_transform mb_dotransform.cpp /^void do_transform(std::vector &tapebuffer) {$/;" f +end_of_wu mb_splitter.cpp /^buffer_pos_t start_of_wu,end_of_wu; \/* position of start and end of wu in$/;" v +end_of_wu splitter.cpp /^buffer_pos_t start_of_wu,end_of_wu; \/* position of start and end of wu in$/;" v +errorlog mb_splitter.cpp /^FILE *wulog,*errorlog;$/;" v +errorlog splitter.cpp /^FILE *wulog,*errorlog;$/;" v +f_data mb_polyphase.cpp /^float *f_data;$/;" v +f_data polyphase.cpp /^float *f_data;$/;" v +fftw_codelet_desc fftw.h /^} fftw_codelet_desc;$/;" t typeref:struct:__anon4 +fftw_complex fftw.h /^} fftw_complex;$/;" t typeref:struct:__anon1 +fftw_die_type_function fftw.h /^typedef void (*fftw_die_type_function) (const char *errString);$/;" t +fftw_direction fftw.h /^} fftw_direction;$/;" t typeref:enum:__anon2 +fftw_free_type_function fftw.h /^typedef void (*fftw_free_type_function) (void *p);$/;" t +fftw_generic_codelet fftw.h /^typedef void (fftw_generic_codelet) $/;" t +fftw_hc2hc_codelet fftw.h /^typedef void (fftw_hc2hc_codelet)$/;" t +fftw_hc2real_codelet fftw.h /^typedef void (fftw_hc2real_codelet)$/;" t +fftw_malloc_type_function fftw.h /^typedef void *(*fftw_malloc_type_function) (size_t n);$/;" t +fftw_node_type fftw.h /^enum fftw_node_type {$/;" g +fftw_notw_codelet fftw.h /^typedef void (fftw_notw_codelet) $/;" t +fftw_plan fftw.h /^typedef struct fftw_plan_struct *fftw_plan;$/;" t typeref:struct:fftw_plan_struct +fftw_plan_node fftw.h /^} fftw_plan_node;$/;" t typeref:struct:fftw_plan_node_struct +fftw_plan_node_struct fftw.h /^typedef struct fftw_plan_node_struct {$/;" s +fftw_plan_struct fftw.h /^struct fftw_plan_struct {$/;" s +fftw_rader_codelet fftw.h /^typedef void (fftw_rader_codelet) $/;" t +fftw_rader_data fftw.h /^} fftw_rader_data;$/;" t typeref:struct:fftw_rader_data_struct +fftw_rader_data_struct fftw.h /^typedef struct fftw_rader_data_struct {$/;" s +fftw_real fftw.h /^typedef double fftw_real;$/;" t +fftw_real fftw.h /^typedef float fftw_real;$/;" t +fftw_real2hc_codelet fftw.h /^typedef void (fftw_real2hc_codelet)$/;" t +fftw_rgeneric_codelet fftw.h /^typedef void (fftw_rgeneric_codelet)$/;" t +fftw_status fftw.h /^} fftw_status;$/;" t typeref:enum:__anon3 +fftw_twiddle fftw.h /^} fftw_twiddle;$/;" t typeref:struct:fftw_twiddle_struct +fftw_twiddle_codelet fftw.h /^typedef void (fftw_twiddle_codelet)$/;" t +fftw_twiddle_struct fftw.h /^typedef struct fftw_twiddle_struct {$/;" s +fftwnd_data fftw.h /^} fftwnd_data;$/;" t typeref:struct:__anon14 +fftwnd_plan fftw.h /^typedef fftwnd_data *fftwnd_plan;$/;" t +filecopy mb_wufiles.cpp /^int filecopy(char *oldname,char *newname) {$/;" f +filecopy wufiles.cpp /^int filecopy(char *oldname,char *newname) {$/;" f +fill_tape_buffer readtape.cpp /^int fill_tape_buffer(unsigned char *buffer, int n_records) {$/;" f +filter_i mb_polyphase.cpp /^double *filter_r, *filter_i;$/;" v +filter_i polyphase.cpp /^double *filter_r, *filter_i;$/;" v +filter_r mb_polyphase.cpp /^double *filter_r, *filter_i;$/;" v +filter_r polyphase.cpp /^double *filter_r, *filter_i;$/;" v +filter_window mb_splitter.cpp /^int filter_window = 0;$/;" v +filter_window splitter.cpp /^int filter_window = 0;$/;" v +flags fftw.h /^ int flags;$/;" m struct:fftw_plan_struct +flags fftw.h /^ int p, flags, refcount;$/;" m struct:fftw_rader_data_struct +four1 four1.cpp /^void four1(float data[], unsigned long nn, int isign) {$/;" f +frame mb_splittypes.h /^ int frame;$/;" m struct:buffer_pos +frame splittypes.h /^ int frame;$/;" m struct:buffer_pos +frameseq mb_splittypes.h /^ unsigned long frameseq;$/;" m struct:tapeheader +frameseq splittypes.h /^ unsigned long frameseq;$/;" m struct:tapeheader +g fftw.h /^ int g, ginv;$/;" m struct:fftw_rader_data_struct +generic fftw.h /^ } generic;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon8 +get_last_block db_fns.cpp /^int get_last_block(tapeheader_t *tapeheader) {$/;" f +ginv fftw.h /^ int g, ginv;$/;" m struct:fftw_rader_data_struct +gregorian mb_splitter.cpp /^int gregorian;$/;" v +gregorian splitter.cpp /^int gregorian;$/;" v +hc2hc fftw.h /^ } hc2hc;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon12 +hc2real fftw.h /^ } hc2real;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon11 +header randomdata.cpp /^char header[HEADER_SIZE];$/;" v +header squarewave.cpp /^char header[HEADER_SIZE];$/;" v +horz_to_equatorial coordcvt.cpp /^void horz_to_equatorial(double alt, double azimuth, double lsthour,$/;" f namespace:SPLITTER +hr_min_sec hr_min_sec.cpp /^char* hr_min_sec (double x) {$/;" f +im fftw.h /^ fftw_real re, im;$/;" m struct:__anon1 +is_in_place fftw.h /^ int is_in_place; \/* 1 if for in-place FFTs, 0 otherwise *\/$/;" m struct:__anon14 +is_tape readtape.cpp /^int is_tape;$/;" v +iters mb_splitter.cpp /^int iters=-1;$/;" v +iters splitter.cpp /^int iters=-1;$/;" v +jd_to_lmst coordcvt.cpp /^double jd_to_lmst(double jd, double longitude) {$/;" f namespace:SPLITTER +key mb_splitter.cpp /^R_RSA_PRIVATE_KEY key;$/;" v +key splitter.cpp /^R_RSA_PRIVATE_KEY key;$/;" v +main mb_splitter.cpp /^int main(int argc, char *argv[]) {$/;" f +main randomdata.cpp /^int main(void) {$/;" f +main splitter.cpp /^int main(int argc, char *argv[]) {$/;" f +main squarewave.cpp /^int main(void) {$/;" f +make_FIR mb_polyphase.cpp /^void make_FIR (int n_points, int M, int window, double *output) {$/;" f +make_FIR polyphase.cpp /^void make_FIR (int n_points, int M, int window, double *output) {$/;" f +make_wu_headers mb_wufiles.cpp /^int make_wu_headers(std::vector &tapebuffer, telescope_id$/;" f +make_wu_headers wufiles.cpp /^int make_wu_headers(tapeheader_t tapeheader[],workunit wuheader[],$/;" f +makebuffers makebufs.cpp /^void makebuffers(unsigned char **tapebuffer) {$/;" f +max_wus_ondisk mb_splitter.cpp /^int max_wus_ondisk=MAX_WUS_ONDISK;$/;" v +max_wus_ondisk splitter.cpp /^int max_wus_ondisk=MAX_WUS_ONDISK;$/;" v +message mb_message.cpp /^void message(char *msg) {$/;" f +message message.cpp /^void message(char *msg) {$/;" f +minvfsbuf mb_splitter.cpp /^unsigned long minvfsbuf=-1;$/;" v +minvfsbuf splitter.cpp /^unsigned long minvfsbuf=-1;$/;" v +missed mb_splittypes.h /^ int missed;$/;" m struct:tapeheader +missed splittypes.h /^ int missed;$/;" m struct:tapeheader +monthnames writeheader.cpp /^char *monthnames[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep"$/;" v +n fftw.h /^ int *n; \/*$/;" m struct:__anon14 +n fftw.h /^ int n;$/;" m struct:fftw_plan_struct +n fftw.h /^ int n;$/;" m struct:fftw_twiddle_struct +n_after fftw.h /^ int *n_after; \/* n_after[i] = product of n[j] for j > i *\/$/;" m struct:__anon14 +n_before fftw.h /^ int *n_before; \/*$/;" m struct:__anon14 +name fftw.h /^ const char *name; \/* name of the codelet *\/$/;" m struct:__anon4 +name mb_splittypes.h /^ char name[36];$/;" m struct:tapeheader +name splittypes.h /^ char name[36];$/;" m struct:tapeheader +nbuffers fftw.h /^ int nbuffers, nwork;$/;" m struct:__anon14 +next fftw.h /^ struct fftw_plan_struct *next;$/;" m struct:fftw_plan_struct typeref:struct:fftw_plan_struct::fftw_plan_struct +next fftw.h /^ struct fftw_rader_data_struct *next;$/;" m struct:fftw_rader_data_struct typeref:struct:fftw_rader_data_struct::fftw_rader_data_struct +next fftw.h /^ struct fftw_twiddle_struct *next;$/;" m struct:fftw_twiddle_struct typeref:struct:fftw_twiddle_struct::fftw_twiddle_struct +nodb mb_splitter.cpp /^int nodb;$/;" v +nodb splitter.cpp /^int nodb;$/;" v +nodeu fftw.h /^ } nodeu;$/;" m struct:fftw_plan_node_struct typeref:union:fftw_plan_node_struct::__anon5 +noencode mb_splitter.cpp /^int noencode;$/;" v +noencode splitter.cpp /^int noencode;$/;" v +norewind mb_splitter.cpp /^int norewind;$/;" v +norewind splitter.cpp /^int norewind;$/;" v +notw fftw.h /^ } notw;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon6 +ntwiddle fftw.h /^ int ntwiddle; \/* number of twiddle factors *\/$/;" m struct:__anon4 +numdiskbufs mb_splittypes.h /^ int numdiskbufs;$/;" m struct:tapeheader +numdiskbufs splittypes.h /^ int numdiskbufs;$/;" m struct:tapeheader +numringbufs mb_splittypes.h /^ int numringbufs;$/;" m struct:tapeheader +numringbufs splittypes.h /^ int numringbufs;$/;" m struct:tapeheader +nwork fftw.h /^ int nbuffers, nwork;$/;" m struct:__anon14 +obuf_pos dotransform.cpp /^int obuf_pos; \/* Tracks current postition in the output buffers *\/$/;" v +obuf_pos mb_dotransform.cpp /^int obuf_pos; \/* Tracks current postition in the output buffers *\/$/;" v +offset mb_splittypes.h /^ long offset;$/;" m struct:buffer_pos +omega fftw.h /^ fftw_complex *omega;$/;" m struct:fftw_rader_data_struct +open_tape_device readtape.cpp /^int open_tape_device(char *device) {$/;" f +output_buf dotransform.cpp /^unsigned char output_buf[NSTRIPS][SAMPLES_PER_OBUF]; $/;" v +output_samples dotransform.cpp /^void output_samples(float *data, int i, int buf_pos) {$/;" f +output_samples mb_dotransform.cpp /^void output_samples(float *data, int i, int buf_pos) {$/;" f +output_xml mb_splitter.cpp /^int output_xml;$/;" v +output_xml splitter.cpp /^int output_xml;$/;" v +p fftw.h /^ int p, flags, refcount;$/;" m struct:fftw_rader_data_struct +parse_tape_headers readheader.cpp /^int parse_tape_headers(unsigned char *tapebuffer, tapeheader_t *tapeheaders) {$/;" f +plan fftw.h /^ struct fftw_plan_struct *plan;$/;" m struct:fftw_rader_data_struct typeref:struct:fftw_rader_data_struct::fftw_plan_struct +plans fftw.h /^ fftw_plan *plans; \/* 1d fftw plans for each dimension *\/$/;" m struct:__anon14 +pol mb_splitter.cpp /^int pol;$/;" v +polyphase mb_splitter.cpp /^int polyphase;$/;" v +polyphase splitter.cpp /^int polyphase;$/;" v +polyphase_seg mb_polyphase.cpp /^void polyphase_seg(float* data) {$/;" f +polyphase_seg polyphase.cpp /^void polyphase_seg(float* data) {$/;" f +process_command_line mb_splitter.cpp /^int process_command_line(int argc, char *argv[],char **tape_device,$/;" f +process_command_line splitter.cpp /^int process_command_line(int argc, char *argv[],char **tape_device,$/;" f +process_seg dotransform.cpp /^void process_seg(float* data) {$/;" f +process_seg mb_dotransform.cpp /^void process_seg(std::vector > &data,int offset) {$/;" f +projectdir mb_splitter.cpp /^char * projectdir = NULL;$/;" v +projectdir splitter.cpp /^char * projectdir = NULL;$/;" v +rader fftw.h /^ } rader;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon9 +rader_data fftw.h /^ fftw_rader_data *rader_data;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 +randn mb_dotransform.cpp /^float randn() {$/;" f +randu mb_dotransform.cpp /^float randu() {$/;" f +rank fftw.h /^ int rank; \/* $/;" m struct:__anon14 +rcdtype mb_splittypes.h /^ int rcdtype;$/;" m struct:tapeheader +rcdtype splittypes.h /^ int rcdtype;$/;" m struct:tapeheader +rcvr mb_splitter.cpp /^receiver_config rcvr;$/;" v +re fftw.h /^ fftw_real re, im;$/;" m struct:__anon1 +read_checkpoint readtape.cpp /^int read_checkpoint() {$/;" f +read_tape_header readheader.cpp /^int read_tape_header(char *buffer, tapeheader_t *header)$/;" f +real2hc fftw.h /^ } real2hc;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon10 +records_in_buffer splitter.cpp /^int records_in_buffer;$/;" v +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 typeref:struct:fftw_plan_node_struct::__anon5::__anon12::fftw_plan_node_struct +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 typeref:struct:fftw_plan_node_struct::__anon5::__anon13::fftw_plan_node_struct +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 typeref:struct:fftw_plan_node_struct::__anon5::__anon7::fftw_plan_node_struct +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon8 typeref:struct:fftw_plan_node_struct::__anon5::__anon8::fftw_plan_node_struct +recurse fftw.h /^ struct fftw_plan_node_struct *recurse;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 typeref:struct:fftw_plan_node_struct::__anon5::__anon9::fftw_plan_node_struct +refcnt fftw.h /^ int refcnt;$/;" m struct:fftw_plan_node_struct +refcnt fftw.h /^ int refcnt;$/;" m struct:fftw_plan_struct +refcnt fftw.h /^ int refcnt;$/;" m struct:fftw_twiddle_struct +refcount fftw.h /^ int p, flags, refcount;$/;" m struct:fftw_rader_data_struct +rename_wu_files mb_wufiles.cpp /^void rename_wu_files() {$/;" f +rename_wu_files wufiles.cpp /^void rename_wu_files() {$/;" f +result_template mb_splitter.cpp /^const char *result_template=$/;" v +result_template splitter.cpp /^const char *result_template=$/;" v +result_template_filename mb_splitter.cpp /^char result_template_filename[1024];$/;" v +result_template_filename splitter.cpp /^char result_template_filename[1024];$/;" v +result_template_filename_id mb_splitter.cpp /^const char *result_template_filename_id = "result_0.xml";$/;" v +result_template_filename_id splitter.cpp /^const char *result_template_filename_id = "result_0.xml";$/;" v +result_template_filepath mb_splitter.cpp /^char result_template_filepath[1024];$/;" v +result_template_filepath splitter.cpp /^char result_template_filepath[1024];$/;" v +resumetape mb_splitter.cpp /^int resumetape;$/;" v +resumetape splitter.cpp /^int resumetape;$/;" v +rgeneric fftw.h /^ } rgeneric;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon13 +root fftw.h /^ fftw_plan_node *root;$/;" m struct:fftw_plan_struct +sah_config mb_splitter.cpp /^APP_CONFIG sah_config;$/;" v +sah_config splitter.cpp /^APP_CONFIG sah_config;$/;" v +samplerate mb_splittypes.h /^ double centerfreq,samplerate;$/;" m struct:tapeheader +samplerate splittypes.h /^ double centerfreq,samplerate;$/;" m struct:tapeheader +select_record readtape.cpp /^int select_record(int record_number) {$/;" f +seqno mb_splitter.cpp /^int seqno;$/;" v +seqno splitter.cpp /^int seqno;$/;" v +signature fftw.h /^ int signature; \/* unique id *\/$/;" m struct:__anon4 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon10 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon11 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon6 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon8 +size fftw.h /^ int size;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 +size fftw.h /^ int size; \/* size of the codelet *\/$/;" m struct:__anon4 +source mb_splittypes.h /^ int source;$/;" m struct:tapeheader +source splittypes.h /^ int source;$/;" m struct:tapeheader +splitter_bits_to_float dotransform.cpp /^void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) {$/;" f +splitter_bits_to_float mb_dotransform.cpp /^void splitter_bits_to_float(unsigned short *raw, float *data, int nsamples) {$/;" f +splitter_encode encode.cpp /^void splitter_encode(unsigned char *bin, int nbytes, FILE *f) {$/;" f +splitter_settings mb_splitter.cpp /^settings splitter_settings;$/;" v +st mb_splittypes.h /^ TIME st;$/;" m struct:tapeheader +st splittypes.h /^ TIME st;$/;" m struct:tapeheader +start_of_wu mb_splitter.cpp /^buffer_pos_t start_of_wu,end_of_wu; \/* position of start and end of wu in$/;" v +start_of_wu splitter.cpp /^buffer_pos_t start_of_wu,end_of_wu; \/* position of start and end of wu in$/;" v +start_time mb_splitter.cpp /^double start_time;$/;" v +start_time splitter.cpp /^double start_time;$/;" v +startblock mb_splitter.cpp /^int startblock;$/;" v +startblock splitter.cpp /^int startblock;$/;" v +stop_time mb_splitter.cpp /^double stop_time;$/;" v +stop_time splitter.cpp /^double stop_time;$/;" v +tape_busy readtape.cpp /^int tape_busy() {$/;" f +tape_eject readtape.cpp /^int tape_eject() {$/;" f +tape_fd readtape.cpp /^static int tape_fd;$/;" v file: +tape_info readtape.cpp /^static tape tape_info;$/;" v file: +tape_read_record readtape.cpp /^int tape_read_record(char *buffer) {$/;" f +tape_rewind readtape.cpp /^int tape_rewind() {$/;" f +tape_status readtape.cpp /^struct mtget tape_status;$/;" v typeref:struct:mtget +tape_struct db_fns.cpp /^static tape tape_struct;$/;" v file: +tapebuffd makebufs.cpp /^int tapebuffd;$/;" v +tapebuffer mb_splitter.cpp /^std::vector tapebuffer;$/;" v +tapebuffer splitter.cpp /^unsigned char *tapebuffer; \/* A buffer for a tape section *\/$/;" v +tapebufname makebufs.cpp /^char tapebufname[30];$/;" v +tapeheader mb_splittypes.h /^typedef struct tapeheader {$/;" s +tapeheader splittypes.h /^typedef struct tapeheader {$/;" s +tapeheader_t mb_splittypes.h /^} tapeheader_t;$/;" t typeref:struct:tapeheader +tapeheader_t splittypes.h /^} tapeheader_t;$/;" t typeref:struct:tapeheader +tapeheaders splitter.cpp /^tapeheader_t tapeheaders[TAPE_FRAMES_IN_BUFFER];$/;" v +telstr mb_splittypes.h /^ SCOPE_STRING telstr;$/;" m struct:tapeheader +telstr splittypes.h /^ SCOPE_STRING telstr;$/;" m struct:tapeheader +telstr_coord_convert coordcvt.cpp /^void telstr_coord_convert(SCOPE_STRING *telstr, double lat, double lon) {$/;" f +trigger_file_path mb_splitter.cpp /^char trigger_file_path[1024]="\/disks\/setifiler1\/wutape\/tapedir\/splitter_stop";$/;" v +trigger_file_path splitter.cpp /^char trigger_file_path[1024]="\/disks\/setifiler1\/wutape\/tapedir\/splitter_stop";$/;" v +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon12 +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon13 +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon7 +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon8 +tw fftw.h /^ fftw_twiddle *tw;$/;" m struct:fftw_plan_node_struct::__anon5::__anon9 +twarray fftw.h /^ fftw_complex *twarray;$/;" m struct:fftw_twiddle_struct +twiddle fftw.h /^ } twiddle;$/;" m union:fftw_plan_node_struct::__anon5 typeref:struct:fftw_plan_node_struct::__anon5::__anon7 +twiddle_order fftw.h /^ const int *twiddle_order; \/* $/;" m struct:__anon4 +type fftw.h /^ enum fftw_node_type type; \/* TWIDDLE or NO_TWIDDLE *\/$/;" m struct:__anon4 typeref:enum:__anon4::fftw_node_type +type fftw.h /^ enum fftw_node_type type;$/;" m struct:fftw_plan_node_struct typeref:enum:fftw_plan_node_struct::fftw_node_type +update_checkpoint readtape.cpp /^static void update_checkpoint() {$/;" f file: +useanalysiscfgid mb_splitter.cpp /^int useanalysiscfgid = 0;$/;" v +usereceivercfgid mb_splitter.cpp /^int usereceivercfgid = 0;$/;" v +userecordercfgid mb_splitter.cpp /^int userecordercfgid = 0;$/;" v +usesplittercfgid mb_splitter.cpp /^int usesplittercfgid = 0;$/;" v +valid_run mb_validrun.cpp /^bool valid_run(std::vector &tapebuffer) {$/;" f +valid_run validrun.cpp /^int valid_run(tapeheader_t tapeheader[],buffer_pos_t *start_of_wu, $/;" f +version mb_splittypes.h /^ char version[16];$/;" m struct:tapeheader +version splittypes.h /^ char version[16];$/;" m struct:tapeheader +wait_for_db_wus_ondisk mb_splitter.cpp /^int wait_for_db_wus_ondisk() {$/;" f +wait_for_db_wus_ondisk splitter.cpp /^int wait_for_db_wus_ondisk() {$/;" f +wait_until_night mb_splitter.cpp /^int wait_until_night() {$/;" f +wait_until_night splitter.cpp /^int wait_until_night() {$/;" f +wd mb_splitter.cpp /^char wd[1024];$/;" v +wd splitter.cpp /^char wd[1024];$/;" v +wisdom_signature fftw.h /^ int wisdom_signature;$/;" m struct:fftw_plan_struct +wisdom_type fftw.h /^ enum fftw_node_type wisdom_type;$/;" m struct:fftw_plan_struct typeref:enum:fftw_plan_struct::fftw_node_type +work fftw.h /^ fftw_complex *work; \/* $/;" m struct:__anon14 +write_tape_header writeheader.cpp /^int write_tape_header(char *buffer, tapeheader_t *header) {$/;" f +write_wufile_blocks mb_wufiles.cpp /^void write_wufile_blocks(int nbytes) {$/;" f +write_wufile_blocks wufiles.cpp /^void write_wufile_blocks(int nbytes) {$/;" f +wu_database_id mb_wufiles.cpp /^std::vector wu_database_id;$/;" v +wu_database_id wufiles.cpp /^int wu_database_id[NSTRIPS];$/;" v +wu_template mb_splitter.cpp /^const char *wu_template=$/;" v +wu_template splitter.cpp /^const char *wu_template=$/;" v +wu_template_filename mb_splitter.cpp /^char wu_template_filename[1024];$/;" v +wu_template_filename splitter.cpp /^char wu_template_filename[1024];$/;" v +wu_template_filename_id mb_splitter.cpp /^const char *wu_template_filename_id = "wu_0.xml";$/;" v +wu_template_filename_id splitter.cpp /^const char *wu_template_filename_id = "wu_0.xml";$/;" v +wuheaders mb_splitter.cpp /^std::vector wuheaders;$/;" v +wuheaders splitter.cpp /^workunit wuheaders[NSTRIPS];$/;" v +wulog mb_splitter.cpp /^FILE *wulog,*errorlog;$/;" v +wulog splitter.cpp /^FILE *wulog,*errorlog;$/;" v diff --git a/splitter_pfb/tools/disksplitter b/splitter_pfb/tools/disksplitter new file mode 100755 index 0000000..a4bc323 --- /dev/null +++ b/splitter_pfb/tools/disksplitter @@ -0,0 +1,121 @@ +#! /bin/tcsh -x + +set PATH=/opt/misc:/opt/misc/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/openwin/bin/xview:/usr/lang:/usr/ucb:/bin:/usr/bin:/usr/local/bin:/usr/hosts:/usr/bin/X11:/usr/casual/sparc:/usr/etc:/usr/local/lib/tex/bin:/usr/local/lib/frame/bin:/disks/asimov/a/apps/informix/bin:.:/disks/albert/d/office/bin:/usr/ucb:/disks/albert/e/users/eurd/data_analysis/bin:/usr/local/lib/g++-include.bak:/disks/siren/a/users/seti/s4/siren/bin:/disks/albert/d/orfeus:/disks/albert/d/chips:/disks/asimov/a/apps/informix/bin:/usr/local/tex +# export PATH +set LD_LIBRARY_PATH=/usr/lib/X11:/usr/openwin/lib:/usr/lib:/lib:/disks/islay/a/users/korpela/bin/lib:/disks/asimov/a/apps/informix/lib:/disks/asimov/a/apps/informix/lib/esql +# export LD_LIBRARY_PATH +set INFORMIXDIR=/disks/asimov/a/apps/informix +# export INFORMIXDIR +set INFORMIXSERVER=ejk_tcp +# export INFORMIXSERVER + +set SPLIT_PROG_LOC=/disks/milkyway/a/users/anderson/seti/splitter/bin/ +set SPLIT_PROG_NAME=splitter +set SPLIT_LOG_LOC=/disks/milkyway/a/users/anderson/seti/sethi/hi_tape_logs/ +# set HI_TAPE_DIR=/disks/philmor/a/users/eheien/hitest/ +set SPLIT_TAPE_DIR=/disks/setifiler1/wutape/tapedir/ +set SPLIT_SUFFIX=.split +set HIDONE_SUFFIX=.hidone +set SPLITDONE_SUFFIX=.splitdone +set EMAIL_LIST="jeffc@ssl.berkeley.edu mattl@ssl.berkeley.edu" +set FOUND_FILE=0 +set HOST=`hostname` +set SPLIT_HALT_MSG=splitter_stop + +# Check to see if this machine is already running the splitter program +set PROG_RUNNING=`/usr/ucb/ps -auxww | grep "$SPLIT_PROG_NAME" | grep -v "disksplitter" | wc | awk '{print $1}'` +echo "$PROG_RUNNING" +if( $PROG_RUNNING > 1 ) then + echo "Splitter is already running on this machine. Quitting." + exit +endif + +# Get rid of all .split files here with HOSTNAME in them(?) + +while ( ! -f $SPLIT_TAPE_DIR$SPLIT_HALT_MSG ) + +set FOUND_FILE=0 +cd $SPLIT_TAPE_DIR + +set FILE_LIST=`ls . | grep ".tape" | grep -v "done" | grep -v "reading" | grep -v "hi" | grep -v "msg" | grep -v "split"` + +if( -z "$FILE_LIST" ) then + exit +endif + +foreach file ($FILE_LIST) + if ( $FOUND_FILE == 0 && ! -f $file$SPLITDONE_SUFFIX ) then + if( -f $file$SPLIT_SUFFIX ) then + set FOUND_FILE=0 + else + echo $HOST > $file$SPLIT_SUFFIX + set TAPE_FILE=$file + set SPLIT_FILE=$SPLIT_TAPE_DIR$file + set SPLIT_MARK_FILE=$SPLIT_TAPE_DIR$file$SPLIT_SUFFIX + set HI_DONE_FILE=$SPLIT_TAPE_DIR$file$HIDONE_SUFFIX + set SPLIT_DONE_FILE=$SPLIT_TAPE_DIR$file$SPLITDONE_SUFFIX + set FOUND_FILE=1 + endif + endif +end + +cd /mydisks/a/servers/splitter/ +/bin/rm -f error.log rcd.chk +touch error.log +touch rcd.chk + +if ( $FOUND_FILE == 0 ) then +# echo "" | /usr/ucb/mail -s"no more splitter tape files" $EMAIL_LIST + exit +else + if( -f /disks/milkyway/a/users/anderson/seti/watchdogs/go_spliiter ) then + /bin/rm -f wu_inbox/.* +#set START_MSG=`echo "Splitter is starting on tape" $SPLIT_FILE "on" $HOST` + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" splitter starting" $EMAIL_LIST + /bin/nice $SPLIT_PROG_LOC$SPLIT_PROG_NAME $SPLIT_FILE $1 -resume >>& splitterlog + set TEMP=`grep -i "end" error.log` + if( "$TEMP" != "" ) then + sleep 60 # wait for it to finish moving the files from wu_inbox + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" splitter finished" $EMAIL_LIST + /bin/rm -f error.log rcd.chk + /bin/rm -f wu_inbox/.* + /bin/rm -f $SPLIT_MARK_FILE + if( -f $HI_DONE_FILE ) then + /bin/rm -f $HI_DONE_FILE + /bin/rm -f `cd $SPLIT_TAPE_DIR; ls -l | grep $TAPE_FILE | awk '{print $NF}'` + /bin/rm -f $SPLIT_FILE + else + touch -f $SPLIT_DONE_FILE + endif + endif + /bin/rm -f $SPLIT_MARK_FILE + exit + else + /bin/rm -f $SPLIT_MARK_FILE + exit + endif +endif + +#if ( 0 == 1 ) then +# if ( grep -i done hi_log ) then +# cat error.log rcd.chk | /usr/ucb/mail -s"end of tape on $HOST" $EMAIL_LIST +# touch $HI_FILE$HIDONE_SUFFIX +# if ( -f $HI_FILE$HIDONE_SUFFIX ) then +# unlink $SPLITFILE +# fi +# unlink .$SPLITFILE +# /bin/rm error.log rcd.chk +# /bin/rm wu_inbox/.* +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +#else +# if [ -f $MARKER$HOST ] +# then +# /bin/rm wu_inbox/.* +# cat error.log rcd.chk | /usr/ucb/mail -s"restarting HI analysis on $HOST" $EMAIL_LIST +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +# else +# cat error.log rcd.chk | /usr/ucb/mail -s"hi analysis disabled on $HOST" $EMAIL_LIST +# fi +#endif +end + diff --git a/splitter_pfb/tools/sah_splitter.sh b/splitter_pfb/tools/sah_splitter.sh new file mode 100755 index 0000000..2ff1d34 --- /dev/null +++ b/splitter_pfb/tools/sah_splitter.sh @@ -0,0 +1,150 @@ +#! /bin/sh +PATH=/opt/misc:/opt/misc/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/openwin/bin/xview:/usr/lang:/usr/ucb:/bin:/usr/bin:/usr/local/bin:/usr/hosts:/usr/bin/X11:/usr/casual/sparc:/usr/etc:/usr/local/lib/tex/bin:/usr/local/lib/frame/bin:/disks/asimov/a/apps/informix/bin:.:/disks/albert/d/office/bin:/usr/ucb:/disks/albert/e/users/eurd/data_analysis/bin:/usr/local/lib/g++-include.bak:/disks/siren/a/users/seti/s4/siren/bin:/disks/albert/d/orfeus:/disks/albert/d/chips:/disks/asimov/a/apps/informix/bin:/usr/local/tex +export PATH +LD_LIBRARY_PATH=/lib:/disks/asimov/a/apps/informix/lib:/disks/asimov/a/apps/informix/lib/esql::/usr/ucblib:/lib:/usr/lib:/usr/openwin/lib:/usr/ccs/lib:/usr/local/gcc/lib:/disks/asimov/a/lang/gnu/H-sparc-sun-solaris2/lib:/opt/misc/lib:/usr/local/lib:/disks/ellie/a/users/korpela/lib:/usr/dt/lib +export LD_LIBRARY_PATH +INFORMIXDIR=/disks/asimov/a/apps/informix/ +export INFORMIXDIR +INFORMIXSERVER=ejk_tcp +export INFORMIXSERVER +S4_RECEIVER_CONFIG=/usr/local/warez/projects/s4/siren/db/ReceiverConfig.tab +export S4_RECEIVER_CONFIG + +PROJECTDIR=/disks/koloth/a/inet_services/boinc_www/share/projects/sah +SPLIT_PROG_LOC=${PROJECTDIR}/bin/ +SPLIT_PROG_NAME=sah_splitter +SPLIT_TAPE_DIR=/disks/setifiler1/wutape/tapedir/seti_boinc_public/ +SPLIT_SUFFIX=.split +#HIDONE_SUFFIX=.hidone +SPLITDONE_SUFFIX=.splitdone +EMAIL_LIST="korpela@ssl.berkeley.edu jeffc@ssl.berkeley.edu mattl@ssl.berkeley.edu davea@ssl.berkeley.edu" +FOUND_FILE=0 +HOST=`hostname` +SPLIT_HALT_MSG=splitter_stop + +# Check to see if this machine is already running the splitter program +PROG_RUNNING=`/usr/ucb/ps -auxww | grep "$SPLIT_PROG_NAME " | grep -v grep` +if [ ! -z "$PROG_RUNNING" ] +then + echo "Splitter is already running on this machine. Quitting." + exit 1 +fi + +# Get rid of all .split files here with HOSTNAME in them(?) + +TAPE_FILE= + +# get list of all tapes in the sah classic tape directory +cd $SPLIT_TAPE_DIR/.. +FILE_LIST=`ls *.tape` + +cd $SPLIT_TAPE_DIR + +# if no sah classic tapes then bail +if [ -z "$FILE_LIST" ] +then + exit 2 +fi + +# for each sah classic tape... +for file in $FILE_LIST +do + # if we have already split it... + if [ -f $file$SPLITDONE_SUFFIX ] + then + # ... then remove it ("it" being a hard link upward into the sah classic dir) + if [ -f $file ] + then + /bin/rm $file + fi + else + # if we are in the process of splitting it... + if [ -f $file$SPLIT_SUFFIX ] + then + # and are splitting it from this host... (this logic prevents one host from repeating another host's tape) + if grep $HOST $file$SPLIT_SUFFIX + then + # trigger to restart the split + /bin/rm $file$SPLIT_SUFFIX + fi + fi + # if a restart or a brand new tape... + if [ ! -f $file$SPLIT_SUFFIX ] + then + # claim it for this host (there is certainly a race condition here) + echo $HOST > $file$SPLIT_SUFFIX + ln ../$file + TAPE_FILE=$file + SPLIT_FILE=$SPLIT_TAPE_DIR$file + SPLIT_MARK_FILE=$SPLIT_TAPE_DIR$file$SPLIT_SUFFIX +# HI_DONE_FILE=$SPLIT_TAPE_DIR$file$HIDONE_SUFFIX + SPLIT_DONE_FILE=$SPLIT_TAPE_DIR$file$SPLITDONE_SUFFIX + break + fi + fi +done + +cd /tmp/splitter/sah +if [ ! -d splitter ] +then + mkdir splitter +fi +cd splitter +if [ ! -d wu_inbox ] +then + mkdir wu_inbox +fi +/bin/rm -f error.log rcd.chk +touch error.log +touch rcd.chk + +if [ -z "$TAPE_FILE" ] +then + exit 3 +else + /bin/rm -f wu_inbox/.* + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" boinc_splitter starting" $EMAIL_LIST + /bin/nice $SPLIT_PROG_LOC$SPLIT_PROG_NAME $SPLIT_FILE $* -resume -projectdir=$PROJECTDIR + if grep -i "end" error.log >/dev/null 2>&1 + then + /bin/nice $SPLIT_PROG_LOC$SPLIT_PROG_NAME $SPLIT_FILE $* -resume -projectdir=$PROJECTDIR + fi + if grep -i "end" error.log >/dev/null 2>&1 + then + cat error.log rcd.chk | /usr/ucb/mail -s""$HOST" boinc_splitter finished" $EMAIL_LIST + /bin/rm -f error.log rcd.chk + /bin/rm -f wu_inbox/.* + /bin/rm -f $SPLIT_MARK_FILE + /bin/rm -f `cd $SPLIT_TAPE_DIR; ls -l | grep $TAPE_FILE | awk '{print $NF}'` + /bin/rm -f $SPLIT_FILE + touch -f $SPLIT_DONE_FILE + exit + else + /bin/rm -f $SPLIT_MARK_FILE + exit 4 + fi +fi + +#if ( 0 == 1 ) then +# if ( grep -i done hi_log ) then +# cat error.log rcd.chk | /usr/ucb/mail -s"end of tape on $HOST" $EMAIL_LIST +# touch $HI_FILE$HIDONE_SUFFIX +# if ( -f $HI_FILE$HIDONE_SUFFIX ) then +# unlink $SPLITFILE +# fi +# unlink .$SPLITFILE +# /bin/rm error.log rcd.chk +# /bin/rm wu_inbox/.* +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +#else +# if [ -f $MARKER$HOST ] +# then +# /bin/rm wu_inbox/.* +# cat error.log rcd.chk | /usr/ucb/mail -s"restarting HI analysis on $HOST" $EMAIL_LIST +# nice -10 $SPLITTER_PROG_LOC $SPLITFILE -resume 2>> splitterlog & +# else +# cat error.log rcd.chk | /usr/ucb/mail -s"hi analysis disabled on $HOST" $EMAIL_LIST +# fi +#endif +end + diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..e4a45ee --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,65 @@ +## $Id: Makefile.am,v 1.1.2.2 2006/01/04 00:47:33 korpela Exp $ + +include $(top_srcdir)/Makefile.incl + +LDFLAGS= +AM_LDFLAGS= + +BOINC_LIBS = -L$(BOINCDIR)/api -lboinc_api -L$(BOINCDIR)/lib -lboinc + +CLIENT_C_FLAGS = $(CFLAGS) \ + $(DEFS) \ + -DTEXT_UI -DNDEBUG -DCLIENT \ + -include $(top_builddir)/config.h \ + -I$(top_srcdir)/db \ + -I$(top_srcdir)/client \ + $(BOINC_CFLAGS) \ + $(PTHREAD_CFLAGS) + +CLIENT_LD_FLAGS = $(PTHREAD_CFLAGS) $(LDFLAGS) $(PTHREAD_LIBS) $(BOINC_LIBS) + +noinst_PROGRAMS = fakedata workunit_resample readwu.so + +fakedata_SOURCES = \ + fakedata.cpp \ + ../client/seti_header.cpp \ + ../client/timecvt.cpp \ + ../db/schema_master.cpp \ + ../db/sqlrow.cpp \ + ../db/sqlblob.cpp \ + ../db/xml_util.cpp + +fakedata_CFLAGS = $(CLIENT_C_FLAGS) +fakedata_CXXFLAGS = $(CLIENT_C_FLAGS) +fakedata_LDFLAGS = $(CLIENT_LD_FLAGS) + +workunit_resample_SOURCES = \ + workunit_resample.cpp \ + ../client/seti_header.cpp \ + ../client/timecvt.cpp \ + ../client/s_util.cpp \ + ../db/schema_master.cpp \ + ../db/sqlrow.cpp \ + ../db/sqlblob.cpp \ + ../db/xml_util.cpp + +workunit_resample_CFLAGS = $(CLIENT_C_FLAGS) +workunit_resample_CXXFLAGS = $(CLIENT_C_FLAGS) +workunit_resample_LDFLAGS = $(CLIENT_LD_FLAGS) +workunit_resample_LDADD = -lfftw3f + +readwu_so_SOURCES = \ + readwu.cpp \ + ../client/seti_header.cpp \ + ../client/timecvt.cpp \ + ../client/s_util.cpp \ + ../db/schema_master.cpp \ + ../db/sqlrow.cpp \ + ../db/sqlblob.cpp \ + ../db/xml_util.cpp + +readwu_so_CFLAGS = $(CLIENT_C_FLAGS) -fPIC -I/usr/local/rsi/idl/external +readwu_so_CXXFLAGS = $(CLIENT_C_FLAGS) -fPIC -I/usr/local/rsi/idl/external +readwu_so_LDFLAGS = $(CLIENT_LD_FLAGS) -shared -fPIC -Bsymbolic --warn-once +readwu_so_LDADD = $(BOINCDIR)/lib/libboinc.a +readwu_so_LINK = $(CXX) $(LDFLAGS) $(readwu_so_LDFLAGS) -o $@ diff --git a/tools/fakedata.cpp b/tools/fakedata.cpp new file mode 100755 index 0000000..06740f1 --- /dev/null +++ b/tools/fakedata.cpp @@ -0,0 +1,431 @@ +// fakedata [ options ] filename +// +// Title : fakedata.c +// Programmer : Jeff Cobb / David Anderson +// History : 12/13/95 - first release +// : 10/25/05 - Modified for setiathome_enhanced Eric Korpela +// Copyright (c) 1998 University of California Regents + +// Credits for seti@home reference package: +// algorithm design: Dan Werthimer (UCB), +// Mike Lampton, (UCB), +// Charles Donnelly (UCB), +// Jeff Cobb (UCB) +// reference code programming: Jeff Cobb +// seti@home network design and programming: David Anderson + +// This program is to be used to generate fake digital data +// for testing seti@home algorithms. It generates random +// noise embedded with any of the following signal types: +// - continuous +// - pulsed +// - chirped +// - showing an gaussian power profile over time +// The randomness of the noise can be colored by: +// - change in noise amplitude over time +// - favoring certain frequencies (changing noise +// amplitude over frequency) + +// The signal to noise ratio you want to use to emulate a setiathome work +// unit depends upon the signal type and the FFT length you want to find it at. +// For example if you want to build a gaussian that is 5 times the noise power +// at an FFT length of 16384 you should specify a noise amplitude of 1 and +// a gaussian amplitude of 5/sqrt(16384) (about 0.04). If you want to specify +// a spike of 30 times the mean noise power at an FFT length of 128k you would +// specify a sine wave of amplitude 30/sqrt(128k) (about 0.083). + +// The output file contains +// the number of data points and an array of floating +// point numbers representing power over time. +// That the array is a series of complex values, +// using 2 array elements for each data point. +// Real parts are held in even elements (starting with [0]) +// and imaginary parts are held in the adjacent odd elements. + +// options: +// +// -sr n +// samples per second +// -dur x +// duration of data (seconds) +// -sine amp freq chirp start end +// inject a sine wave, amplitude amp +// freq: frequency at center of time interval +// (note: freqs must lie in [-sr/2, sr/2] +// chirp rate in Hz/sec +// NOTE: chirp is applied starting from time 0 +// (not necessarily from the start of the sine wave) +// Start and end times; if zero, whole duration +// -noise amp +// inject noise of amplitude amp; +// -gauss amp midpt sig freq chirp +// Inject a Gaussian signal with the given amplitude and midpoint, +// halfpower width (seconds), frequency (Hz), chirp rate (Hz/sec) +// -pulse period duty +// Inject a pulse signal with the given period (seconds) and duty cycle (percent). It +// is "encased" in the Gaussian envelope determined by the -gaussian parameters +// -ascii +// generate ascii data +// default: 1-bit output samples (binary). + +//#define DEBUG + +#include +#include +#include +#include + +#include "analyze.h" +#include "seti_header.h" +#include "xml_util.h" + +#define NEG_LN_ONE_HALF 0.693 +#if 0 +#define EXP(a,b,c) exp(-(NEG_LN_ONE_HALF * pow((double)(a) - (double)(b), 2.0)) / (double)(c)) +#endif + +struct SIGNAL_DESC { + double sample_rate; + double dur; + bool onebit; + double noise_amp; + double sine_amp; + double sine_freq; + double sine_chirp; + double sine_start; + double sine_end; + double gauss_amp; + double gauss_midpt; + double gauss_sigma; + double gauss_freq; + double gauss_chirp; + double pulse_period; + double pulse_duty_cycle; +}; + +void bad_args() { + fprintf(stderr, "bad args\n"); + exit(1); +} + +float randu() { +// Uniform random numbers between 0 and 1 + static bool first=true; + if (first) { + srand(time(0)); + first=false; + } + return static_cast(rand())/RAND_MAX; +} + +float rande() { +// exponentially distributed random numbers + return -log(randu()); +} + +float randn() { +// normally distributed random numbers + static float last=0; + float a,b,h=0; + if (last==0) { + while (h==0 || h>=1) { + a=2*randu()-1; + b=2*randu()-1; + h=a*a+b*b; + } + h=sqrt(-2*log(h)/h); + last=a*h; + return b*h; + } else { + a=last; + last=0; + return a; + } +} + + + +void getopts(int argc, char* argv[], SIGNAL_DESC& sd) { + int i; + sd.onebit = true; + for (i=1; i data; + + time_t st=time(0); + + + if (argc < 2) bad_args(); + + idum = -time(NULL); + + memset(&sd, 0, sizeof(sd)); + getopts(argc, argv, sd); + +// some default values -- added by EK ///////////////////////////// + if (sd.sample_rate == 0) sd.sample_rate=9765.625; + if (sd.noise_amp == 0) sd.noise_amp=1; + if (sd.dur==0) { + npoints=1024*1024; + sd.dur=npoints/sd.sample_rate; + } else { + npoints = (int)(sd.sample_rate * sd.dur); + } + data.reserve(npoints/4); + if (sd.gauss_sigma == 0) sd.gauss_sigma=12.5; +//////////////////////////////////////////////////////////////////// + + if (sd.sine_end == 0) sd.sine_end = sd.dur; + +// Added workunit header - EK /////////////////////////////////// + sprintf(wu.name,"fake.%d.0",st); +///////////////////////// Group Info //////////////////////////// + sprintf(wu.group_info->name,"fake.%d",st); +///////////////////////// Tape Info ///////////////////////////// + sprintf(wu.group_info->tape_info->name,"fake"); + wu.group_info->tape_info->start_time=time_t_to_jd(st); + wu.group_info->tape_info->last_block_time=time_t_to_jd(st); +///////////////////////// Recv Conf ///////////////////////////// + wu.group_info->receiver_cfg->s4_id=1; + sprintf(wu.group_info->receiver_cfg->name,"fake"); + wu.group_info->receiver_cfg->beam_width=5.0/60.0; + wu.group_info->receiver_cfg->center_freq=1420.0; + wu.group_info->receiver_cfg->az_corr_coeff.push_back(0.0); + wu.group_info->receiver_cfg->zen_corr_coeff.push_back(0.0); +///////////////////////// Recorder Cfg ////////////////////////// + sprintf(wu.group_info->recorder_cfg->name,"fake"); + wu.group_info->recorder_cfg->bits_per_sample=2; + wu.group_info->recorder_cfg->beams=1; + wu.group_info->recorder_cfg->sample_rate=sd.sample_rate; +///////////////////////// Splitter Cfg ////////////////////////// + wu.group_info->splitter_cfg->version=0.17; + sprintf(wu.group_info->splitter_cfg->data_type,"encoded"); + sprintf(wu.group_info->splitter_cfg->filter,"fft"); + sprintf(wu.group_info->splitter_cfg->window,"welsh"); + wu.group_info->splitter_cfg->fft_len=1; + wu.group_info->splitter_cfg->ifft_len=1; +///////////////////////// Data Desc ///////////////////////////// + wu.group_info->data_desc.start_ra=0; + wu.group_info->data_desc.start_dec=18.4; + wu.group_info->data_desc.end_dec=18.4; + wu.group_info->data_desc.time_recorded_jd=time_t_to_jd(st); + sprintf(wu.group_info->data_desc.time_recorded,"%s",jd_string(time_t_to_jd(st))); + wu.group_info->data_desc.nsamples=npoints; + wu.group_info->data_desc.true_angle_range=sd.dur/sd.gauss_sigma*wu.group_info->receiver_cfg->beam_width; + { + time_t dt=0; + double dr=wu.group_info->data_desc.true_angle_range/(cos(18.4*M_PI/180)*15*sd.dur); + while (dt<(sd.dur+5)) { + coordinate_t tmp; + tmp.time=time_t_to_jd(st+dt); + tmp.dec=18.4; + tmp.ra=dt*dr; + wu.group_info->data_desc.coords.push_back(tmp); + dt+=5; + } + } +///////////////////////// Subband Desc ///////////////////////////// + wu.subband_desc.number=0; + wu.subband_desc.center=1420000000; + wu.subband_desc.base=1420000000; + wu.subband_desc.sample_rate=sd.sample_rate; + + +///////////////////////// Analysis Cfg ///////////////////////////// + wu.group_info->analysis_cfg->spike_thresh=24.0; + wu.group_info->analysis_cfg->spikes_per_spectrum=1; + wu.group_info->analysis_cfg->gauss_null_chi_sq_thresh=2.2249999; + wu.group_info->analysis_cfg->gauss_chi_sq_thresh=1.41999996; + wu.group_info->analysis_cfg->gauss_power_thresh=3; + wu.group_info->analysis_cfg->gauss_peak_power_thresh=3.2; + wu.group_info->analysis_cfg->gauss_pot_length=64; + wu.group_info->analysis_cfg->pulse_thresh=19.5; + wu.group_info->analysis_cfg->pulse_display_thresh=0.5; + wu.group_info->analysis_cfg->pulse_max=40960; + wu.group_info->analysis_cfg->pulse_min=16; + wu.group_info->analysis_cfg->pulse_fft_max=8192; + wu.group_info->analysis_cfg->pulse_pot_length=256; + wu.group_info->analysis_cfg->triplet_thresh=8.5; + wu.group_info->analysis_cfg->triplet_max=131072; + wu.group_info->analysis_cfg->triplet_min=16; + wu.group_info->analysis_cfg->triplet_pot_length=256; + wu.group_info->analysis_cfg->pot_overlap_factor=0.5; + wu.group_info->analysis_cfg->pot_t_offset=1; + wu.group_info->analysis_cfg->pot_min_slew=0.00209999993; + wu.group_info->analysis_cfg->pot_max_slew=0.0104999999; + wu.group_info->analysis_cfg->chirp_resolution=0.333; + wu.group_info->analysis_cfg->analysis_fft_lengths=262136; + wu.group_info->analysis_cfg->bsmooth_boxcar_length=8192; + wu.group_info->analysis_cfg->bsmooth_chunk_size=32768; + { + chirp_parameter_t tmp; + tmp.chirp_limit=20; + tmp.fft_len_flags=262136; + wu.group_info->analysis_cfg->chirps.push_back(tmp); + tmp.chirp_limit=50; + tmp.fft_len_flags=65528; + wu.group_info->analysis_cfg->chirps.push_back(tmp); + } + wu.group_info->analysis_cfg->pulse_beams=1; + wu.group_info->analysis_cfg->max_signals=3000; + wu.group_info->analysis_cfg->max_spikes=3000; + wu.group_info->analysis_cfg->max_gaussians=3000; + wu.group_info->analysis_cfg->max_pulses=3000; + wu.group_info->analysis_cfg->max_triplets=3000; + + + + + + +///////////////////////////////////////////////////////////////// + + fprintf (stderr, "sample rate: %f\n", sd.sample_rate); + fprintf (stderr, "duration: %f\n", sd.dur); + fprintf (stderr, "number of points: %d\n", npoints); + fprintf (stderr, "noise: %f\n", sd.noise_amp); + fprintf (stderr, "sine_amp: %f\n", sd.sine_amp); + fprintf (stderr, "sine_freq: %f (wu %d)\n", sd.sine_freq, + freq_to_wu(sd, sd.sine_freq) + ); + fprintf (stderr, "sine_chirp: %f\n", sd.sine_chirp); + fprintf (stderr, "sine_start: %f\n", sd.sine_start); + fprintf (stderr, "sine_end: %f\n", sd.sine_end); + fprintf (stderr, "gauss_amp: %f\n", sd.gauss_amp); + fprintf (stderr, "gauss_midpt: %f\n", sd.gauss_midpt); + fprintf (stderr, "gauss_sigma: %f\n", sd.gauss_sigma); + fprintf (stderr, "gauss_freq: %f (wu %d)\n", sd.gauss_freq, + freq_to_wu(sd, sd.gauss_freq) + ); + fprintf (stderr, "gauss_chirp: %f\n", sd.gauss_chirp); + fprintf (stderr, "pulse_period: %f\n", sd.pulse_period); + fprintf (stderr, "pulse_duty_cycle: %f\n", sd.pulse_duty_cycle); + + fprintf (stderr, "data format: %s\n", sd.onebit?"binary":"ascii"); + + cnt = 0; + if(!sd.onebit) { + printf("nsamples=%d\n", npoints); + printf("real imag\n"); + } + double sine_phase = 0, sine_freq; + double sine_midpt = (sd.sine_end - sd.sine_start)/2; + double gauss_phase = 0, gauss_freq; + double dt = sd.dur/npoints; + double sigma_sq = sd.gauss_sigma*sd.gauss_sigma; + double pulseActive = 1.0; + double pulseTime = sd.pulse_period*sd.pulse_duty_cycle/100.0; + + for (i=0; i 0) { + real += randn()*sd.noise_amp; + imag += randn()*sd.noise_amp; + } + if (sd.sine_amp) { + if (mytime >= sd.sine_start && mytime <= sd.sine_end) { + real += sd.sine_amp*cos(sine_phase); + imag -= sd.sine_amp*sin(sine_phase); + } + sine_freq = sd.sine_freq + sd.sine_chirp*mytime; + sine_phase += M_PI*2*dt*sine_freq; + } + if (sd.pulse_period > 0) { + if( (mytime - (floor(mytime/sd.pulse_period))*sd.pulse_period) > pulseTime ) { + pulseActive = 0.0; + } + } + if (sd.gauss_amp > 0) { + double gauss_factor = EXP(mytime, sd.gauss_midpt, sigma_sq); + real += gauss_factor*pulseActive*sd.gauss_amp*cos(gauss_phase); + imag -= gauss_factor*pulseActive*sd.gauss_amp*sin(gauss_phase); + gauss_freq = sd.gauss_freq + sd.gauss_chirp*mytime; + gauss_phase += M_PI*2*dt*gauss_freq; + } + + if (sd.onebit) { + c >>= 2; + if (real >= 0) c |= 0x8000; + if (imag >= 0) c |= 0x4000; + cnt += 2; + if (cnt == 16) { + cnt = 0; + data.push_back(c/256); + data.push_back(c&255); + } + } else { + printf("%e %e\n", real, imag); + } + } + // flush out remaining samples + if (sd.onebit) { + for (i=0; i<7; i++) { + c >>= 2; + cnt += 2; + if (cnt == 16) { + cnt = 0; + data.push_back(c/256); + data.push_back(c&255); + } + } + printf("\n"); + std::cout << wu; + std::string tmpstr=xml_encode_string(data,_x_setiathome); + printf("",tmpstr.size(), + xml_encoding_names[_x_setiathome]); + fwrite(tmpstr.c_str(),tmpstr.size(),1,stdout); + printf("\n\n"); + } +} + +void print_error( int e ) { + printf( "Error %d\n", e ); + exit(1); +} + diff --git a/tools/readwu.cpp b/tools/readwu.cpp new file mode 100644 index 0000000..14d1c71 --- /dev/null +++ b/tools/readwu.cpp @@ -0,0 +1,161 @@ +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// workunit_resample - a program to read in a workunit and convert it to +// real samples at twice the sampling rate with all frequencies shifted to +// be positive. + +#include "sah_config.h" + +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#include +#include +#include "export.h" + + +#ifdef HAVE_IEEEFP_H +#include +#endif + +#include "client/timecvt.h" +#include "client/s_util.h" +#include "db/db_table.h" +#include "db/schema_master.h" +#include "seti.h" + +#define ARRLEN(arr) (sizeof(arr)/sizeof(arr[0])) + +workunit_header header; +extern "C" { +IDL_VPTR readwu(int argc, IDL_VPTR argv[], char *argk); +void readwu_exit_handler(void) { } +int IDL_Load(void); +} + +static IDL_SYSFUN_DEF2 readwu_fns[] = { + {(IDL_VARIABLE *(*)())readwu, "READWU", 1, 1, IDL_SYSFUN_DEF_F_KEYWORDS, 0}, +}; + +static IDL_MSG_DEF msg_arr[] = { + {"READWU_ERROR", "%NError: %s"}, +}; + +static IDL_MSG_BLOCK readwu_msg_block; + +int readwu_startup(void) { + if (!IDL_SysRtnAdd(readwu_fns,TRUE,ARRLEN(readwu_fns))) { + return NULL; + } + IDL_ExitRegister(readwu_exit_handler); + return IDL_TRUE; +} + +int IDL_Load(void) { + if (!(readwu_msg_block=IDL_MessageDefineBlock("readwu", ARRLEN(msg_arr),msg_arr))) { + return NULL; + } + if (!readwu_startup()) { + IDL_MessageFromBlock(readwu_msg_block,0,IDL_MSG_RET,"can't load readwu"); + } + return IDL_TRUE; +} + + + +IDL_VPTR readwu(int argc, IDL_VPTR argv[], char *argk) { + IDL_VPTR filename=NULL; + static IDL_VARIABLE rv; + rv.type=IDL_TYP_INT; + rv.flags=IDL_V_CONST|IDL_V_NULL; + rv.value.i=-1; + + char *outfile=NULL, buf[256]; + struct stat statbuf; + int nbytes,nread,nsamples; + std::string tmpbuf(""); + int i=0,j; + + if (argc != 1) { + fprintf(stderr,"argc=%d\n",argc); + fprintf(stderr,"array=readwu(wufile_name)\n"); + return &rv; + } + IDL_STRING *infile=NULL; + if (argv[0]->type != IDL_TYP_STRING) { + IDL_MessageFromBlock(readwu_msg_block,0,IDL_MSG_RET,"Parameter 1 must be type STRING"); + } else { + infile=(IDL_STRING *)(&argv[0]->value.s); + } + FILE *in=fopen(infile->s,"r"); + if (!in) { + IDL_MessageFromBlock(readwu_msg_block,0,IDL_MSG_RET,"File not found"); + return &rv; + } + stat(infile->s,&statbuf); + nbytes=statbuf.st_size; + fseek(in,0,SEEK_SET); + tmpbuf.reserve(nbytes); + // read entire file into a buffer. + while ((nread=(int)fread(buf,1,sizeof(buf),in))) { + tmpbuf+=std::string(&(buf[0]),nread); + } + // parse the header + header.parse_xml(tmpbuf); + // decode the data + std::vector datav( + xml_decode_field(tmpbuf,"data") + ); + tmpbuf.clear(); + nsamples=header.group_info->data_desc.nsamples; + nbytes=nsamples*header.group_info->recorder_cfg->bits_per_sample/8; + if (datav.size() < nbytes) { + fprintf(stderr,"Data size does not match number of samples\n"); + return &rv; + } + // convert the data to floating point + sah_complex *fpdata=(sah_complex *)IDL_MemAlloc(nsamples*sizeof(sah_complex),0,IDL_MSG_RET); + if (!fpdata) { + fprintf(stderr,"Unable to allocate memory!\r\n"); + return &rv; + } + bits_to_floats(&(datav[0]),fpdata,nsamples); + datav.clear(); + IDL_MEMINT dims[]={nsamples}; + return IDL_ImportArray(1,dims,IDL_TYP_COMPLEX,(UCHAR *)fpdata,NULL,NULL); +} + + diff --git a/tools/readwu.dlm b/tools/readwu.dlm new file mode 100644 index 0000000..86dc205 --- /dev/null +++ b/tools/readwu.dlm @@ -0,0 +1,5 @@ + +MODULE readwu +DESCRIPTION reads data from a SETI@home Work Unit +BUILD_DATE DECEMBER 2014 +FUNCTION READWU 1 1 KEYWORDS diff --git a/tools/workunit_resample.cpp b/tools/workunit_resample.cpp new file mode 100644 index 0000000..051aff8 --- /dev/null +++ b/tools/workunit_resample.cpp @@ -0,0 +1,142 @@ +// SETI_BOINC is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2, or (at your option) any later +// version. + +// SETI_BOINC is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. + +// You should have received a copy of the GNU General Public License along +// with SETI_BOINC; see the file COPYING. If not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +// In addition, as a special exception, the Regents of the University of +// California give permission to link the code of this program with libraries +// that provide specific optimized fast Fourier transform (FFT) functions and +// distribute a linked executable. You must obey the GNU General Public +// License in all respects for all of the code used other than the FFT library +// itself. Any modification required to support these libraries must be +// distributed in source code form. If you modify this file, you may extend +// this exception to your version of the file, but you are not obligated to +// do so. If you do not wish to do so, delete this exception statement from +// your version. + +// workunit_resample - a program to read in a workunit and convert it to +// real samples at twice the sampling rate with all frequencies shifted to +// be positive. + +#include "sah_config.h" + +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#include +#include + + +#ifdef HAVE_IEEEFP_H +#include +#endif + +#include "client/timecvt.h" +#include "client/s_util.h" +#include "db/db_table.h" +#include "db/schema_master.h" +#include "seti.h" + +#include "fftw3.h" + + +workunit_header header; + +int main(int argc, char *argv[]) { + char *outfile=NULL, buf[256]; + struct stat statbuf; + int nbytes,nread,nsamples; + std::string tmpbuf(""); + int i=0,j; + + if ((argc < 2) || (argc > 3)) { + fprintf(stderr,"%s infile [outfile]\n",argv[0]); + exit(1); + } + char *infile=argv[1]; + if (argc==3) { + outfile=argv[2]; + } + FILE *in=fopen(infile,"r"); + FILE *out; + if (outfile) { + out=fopen(outfile,"w"); + } else { + out=stdout; + } + stat(infile,&statbuf); + nbytes=statbuf.st_size; + fseek(in,0,SEEK_SET); + tmpbuf.reserve(nbytes); + // read entire file into a buffer. + while ((nread=(int)fread(buf,1,sizeof(buf),in))) { + tmpbuf+=std::string(&(buf[0]),nread); + } + // parse the header + header.parse_xml(tmpbuf); + // decode the data + std::vector datav( + xml_decode_field(tmpbuf,"data") + ); + tmpbuf.clear(); + nsamples=header.group_info->data_desc.nsamples; + nbytes=nsamples*header.group_info->recorder_cfg->bits_per_sample/8; + if (datav.size() < nbytes) { + fprintf(stderr,"Data size does not match number of samples\n"); + exit(1); + } + // convert the data to floating point + sah_complex *fpdata=(sah_complex *)calloc(nsamples,sizeof(sah_complex)); + sah_complex *fpout=(sah_complex *)calloc(2048,sizeof(sah_complex)); + sah_complex *tmpb=(sah_complex *)calloc(1024,sizeof(sah_complex)); + if (!fpdata || !fpout) { + fprintf(stderr,"Memory allocation failure\n"); + exit(1); + } + bits_to_floats(&(datav[0]),fpdata,nsamples); + datav.clear(); + + sah_complex workbuf[2048]; + fftwf_plan reverse=fftwf_plan_dft_1d(2048,workbuf,fpout,FFTW_BACKWARD,FFTW_MEASURE); + fftwf_plan forward=fftwf_plan_dft_1d(1024,tmpb,workbuf,FFTW_FORWARD,FFTW_MEASURE|FFTW_PRESERVE_INPUT); + + while (i configure.ac.trimmed +mv configure.ac.trimmed configure.ac +./_autosetup diff --git a/validate/Makefile.in b/validate/Makefile.in new file mode 100644 index 0000000..89bda2d --- /dev/null +++ b/validate/Makefile.in @@ -0,0 +1,69 @@ +# under construction - jeffc +@SET_MAKE@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +LIBEXT = @LIBEXT@ +DLLEXT = @DLLEXT@ +DOTEXEEXT = @DOTEXEEXT@ + +SUFFIXES = .cpp .c .@OBJEXT@ .@DLLEXT@ .@LIBEXT@ @DOTEXEEXT@ + +BOINCDIR = @BOINCDIR@ + +CC = @CC@ +CFLAGS = @CFLAGS@ @DEFS@ -DTEXT_UI -DNDEBUG @PTHREAD_CFLAGS@ + +CXX = @CXX@ +CXXFLAGS = $(CFLAGS) + +LDFLAGS = @LDFLAGS@ + +CLIBS = @LIBS@ + +#SUFFIXES = .cpp .@OBJEXT@ + +#BOINC_INC = -I$(BOINCDIR)/api -I$(BOINCDIR)/lib -I$(BOINCDIR)/sched -I$(BOINCDIR)/db +BOINCDIR = @BOINCDIR@ +BOINC_CFLAGS = @BOINC_CFLAGS@ +BOINC_LIBS = -L$(BOINCDIR)/sched -lsched @PTHREAD_LIBS@ -L$(BOINCDIR)/lib -lboinc +MYSQL_CFLAGS = @MYSQL_CFLAGS@ +MYSQL_LIBS = @MYSQL_LIBS@ +INFORMIXDIR = @INFORMIXDIR@ +INFORMIX_CFLAGS = @INFORMIX_CFLAGS@ +INFORMIX_LIBS = @INFORMIX_LIBS@ +SYSLIBS = -larmadillo + +OBJS = \ + sah_validate.$(OBJEXT) \ + sah_result.$(OBJEXT) \ + sah_boinc_db.$(OBJEXT) + +BOINC_OBJS = $(BOINCDIR)/sched/validator.o \ + $(BOINCDIR)/sched/validate_util.o + + +PROG = sah_validate + +.cpp.@OBJEXT@: + $(CXX) $(CXXFLAGS) $(BOINC_CFLAGS) $(MYSQL_CFLAGS) -I.. -I../db -c -o $*.@OBJEXT@ $< + +.c.@OBJEXT@: + $(CC) $(CFLAGS) $(BOINC_CFLAGS) -I.. -I../db -c -o $*.@OBJEXT@ $< + +#all: Makefile dependencies $(PROGS) +all: Makefile $(PROG) + +../aclocal.m4: ../m4/*.m4 + @CAT@ ../m4/*.m4 >../aclocal.m4 + +../configure: ../configure.ac ../aclocal.m4 ../config.h.in + (cd ..; make config.h) + +$(PROG): $(OBJS) $(BOINC_OBJS) + $(CXX) $(OBJS) $(BOINC_OBJS) -I../db $(BOINC_CFLAGS) $(CLIBS) $(BOINC_LIBS) $(MYSQL_LIBS) $(INFORMIX_LIBS) -o $(PROG) $(SYSLIBS) + +clean: + rm -f *.$(OBJEXT) $(PROG) dependencies config.log config.cache + +#include dependencies diff --git a/validate/sah_boinc_db.cpp b/validate/sah_boinc_db.cpp new file mode 100644 index 0000000..fac7cbb --- /dev/null +++ b/validate/sah_boinc_db.cpp @@ -0,0 +1,57 @@ +// stuff that refers to the BOINC DB. +// Separate to avoid name conflicts w/ SETI@home DB + +#include +#include + +#include "parse.h" +#include "error_numbers.h" +#include "sah_boinc_db.h" +#include "sched_config.h" +#include "sched_util.h" +#include "util.h" +#include "validate_util.h" +#include "filesys.h" +#include "sched_msgs.h" + + +extern SCHED_CONFIG config; + +int get_result_file(RESULT& r, SAH_RESULT& s) { + int retval; + FILE * f; + char filename[256]; + char * path; + std::string path_str; + + // Obtain and check the full path to the boinc result file. + retval = get_output_file_path(r, path_str); + if (retval) { + if (retval == ERR_XML_PARSE) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Cannot extract filename from canonical result %ld.\n", + r.name, r.id); + return(retval); + } else { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] unknown error from get_output_file_path() fpr result %ld.\n", + r.name, r.id); + return(retval); + } + } else { + path = (char *)path_str.c_str(); + if (!boinc_file_exists(path)) { + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "[%s] Output file %s does not exist for result %ld\n", + r.name, path, r.id); + return(-1); + } + } + + retval = try_fopen(path, f, "r"); + if (retval) return retval; + s.have_result = true; // we had good read of the result file + s.parse_file(f); + fclose(f); + return 0; +} diff --git a/validate/sah_boinc_db.h b/validate/sah_boinc_db.h new file mode 100644 index 0000000..bf7931c --- /dev/null +++ b/validate/sah_boinc_db.h @@ -0,0 +1,4 @@ +#include "boinc_db.h" +#include "sah_result.h" + +extern int get_result_file(RESULT&, SAH_RESULT&); diff --git a/validate/sah_result.cpp b/validate/sah_result.cpp new file mode 100644 index 0000000..522e56e --- /dev/null +++ b/validate/sah_result.cpp @@ -0,0 +1,304 @@ +#include +#include + +#include "parse.h" +#include "sah_result.h" + +// the difference between two numbers, +// as a fraction of the largest in absolute value +// +double rel_diff(double x1, double x2) { + if (x1 == 0 && x2 == 0) return 0; + if (x1 == 0) return 1; + if (x2 == 0) return 1; + + double d1 = fabs(x1); + double d2 = fabs(x2); + double d = fabs(x1-x2); + if (d1 > d2) return d/d1; + return d/d2; +} + +double abs_diff(double x1, double x2) { + return fabs(x1-x2); +} + + +// return true if the two signals are the same +// within numerical tolerances +// +bool SIGNAL::roughly_equal(SIGNAL& s) { + double second = 1.0/86400.0; // 1 second as a fraction of a day + + if (type != s.type) return false; + + // tolerances common to all signals + if (abs_diff(ra, s.ra) > .00066) return false; // .01 deg + if (abs_diff(decl, s.decl) > .01) return false; // .01 deg + if (abs_diff(time, s.time) > second) return false; // 1 sec + if (abs_diff(freq, s.freq) > .01) return false; // .01 Hz + if (abs_diff(chirp_rate, s.chirp_rate) > .01) return false; // .01 Hz/s + if (fft_len != s.fft_len) return false; // equal + + switch (type) { + case SIGNAL_TYPE_SPIKE: + case SIGNAL_TYPE_BEST_SPIKE: + if (rel_diff(power, s.power) > .01) return false; // 1% + return true; + case SIGNAL_TYPE_GAUSSIAN: + case SIGNAL_TYPE_BEST_GAUSSIAN: + if (rel_diff(peak_power, s.peak_power) > .01) return false; // 1% + if (rel_diff(mean_power, s.mean_power) > .01) return false; // 1% + if (rel_diff(sigma, s.sigma) > .01) return false; // 1% + if (rel_diff(chisqr, s.chisqr) > .01) return false; // 1% + //if (rel_diff(max_power, s.max_power) > .01) return false; // ?? jeffc + return true; + case SIGNAL_TYPE_PULSE: + case SIGNAL_TYPE_BEST_PULSE: + if (rel_diff(power, s.power) > .01) return false; // 1% + if (rel_diff(mean_power, s.mean_power) > .01) return false; // 1% + if (abs_diff(period, s.period) > .01) return false; // .01 sec + if (rel_diff(snr, s.snr) > .01) return false; // 1% + if (rel_diff(thresh, s.thresh) > .01) return false; // 1% + return true; + case SIGNAL_TYPE_TRIPLET: + case SIGNAL_TYPE_BEST_TRIPLET: + if (rel_diff(power, s.power) > .01) return false; // 1% + if (rel_diff(mean_power, s.mean_power) > .01) return false; // 1% + if (rel_diff(period, s.period) > .01) return false; // 1% + return true; + case SIGNAL_TYPE_AUTOCORR: + case SIGNAL_TYPE_BEST_AUTOCORR: + if (rel_diff(power, s.power) > .01) return false; // 1% + if (rel_diff(delay, s.delay) > .01) return false; // 1% + return true; + } + return false; +} + +// parse a SETI@home result file +// +int SAH_RESULT::parse_file(FILE* f) { + char buf[1024]; + SIGNAL s; + double d; + int i; + + num_signals = 0; + found_best_autocorr=false; + is_overflow=false; + int num_spikes=0; + + memset(&s, 0, sizeof(s)); + while (fgets(buf, 256, f)) { + if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_SPIKE; + num_signals++; + num_spikes++; + + } else if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_BEST_SPIKE; + + } else if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_AUTOCORR; + num_signals++; + found_best_autocorr=true; // needed for checking for people trying to run v6 clients. + + } else if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_BEST_AUTOCORR; + found_best_autocorr=true; // needed for checking for people trying to run v6 clients. + + } else if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_GAUSSIAN; + num_signals++; + + } else if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_BEST_GAUSSIAN; + + } else if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_PULSE; + num_signals++; + + } else if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_BEST_PULSE; + + } else if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_TRIPLET; + num_signals++; + + } else if (match_tag(buf, "")) { + memset(&s, 0, sizeof(s)); + s.type = SIGNAL_TYPE_BEST_TRIPLET; + + } else if (parse_double(buf, "",d)) { + setiathome_version = d; + } else if (parse_double(buf, "", d)) { + s.ra = d; + } else if (parse_double(buf, "", d)) { + s.decl = d; + } else if (parse_double(buf, "", d)) { + s.power = d; + } else if (parse_double(buf, "")) { + if (s.type != SIGNAL_TYPE_SPIKE) { + return -1; + } + signals.push_back(s); + + } else if (match_tag(buf, "")) { + if (s.type != SIGNAL_TYPE_BEST_SPIKE) { + return -1; + } + signals.push_back(s); + + } else if (match_tag(buf, "")) { + if (s.type != SIGNAL_TYPE_AUTOCORR) { + return -1; + } + signals.push_back(s); + + } else if (match_tag(buf, "")) { + if (s.type != SIGNAL_TYPE_BEST_AUTOCORR) { + return -1; + } + signals.push_back(s); + + } else if (match_tag(buf, "")) { + if (s.type != SIGNAL_TYPE_GAUSSIAN) { + return -1; + } + signals.push_back(s); + + } else if (match_tag(buf, "")) { + if (s.type != SIGNAL_TYPE_BEST_GAUSSIAN) { + return -1; + } + signals.push_back(s); + + } else if (match_tag(buf, "")) { + if (s.type != SIGNAL_TYPE_PULSE) { + return -1; + } + signals.push_back(s); + + } else if (match_tag(buf, "")) { + if (s.type != SIGNAL_TYPE_BEST_PULSE) { + return -1; + } + signals.push_back(s); + + } else if (match_tag(buf, "")) { + if (s.type != SIGNAL_TYPE_TRIPLET) { + return -1; + } + signals.push_back(s); + + } else if (match_tag(buf, "")) { + if (s.type != SIGNAL_TYPE_BEST_TRIPLET) { + return -1; + } + signals.push_back(s); + + } + } + if (num_spikes>=30) is_overflow=true; + + return 0; +} + +// return true if the given signal is roughly equal to a signal +// from the result +// +bool SAH_RESULT::has_roughly_equal_signal(SIGNAL& s) { + unsigned int i; + for (i=0; i +#include + +using namespace std; + +#define SIGNAL_TYPE_SPIKE 1 +#define SIGNAL_TYPE_GAUSSIAN 2 +#define SIGNAL_TYPE_PULSE 3 +#define SIGNAL_TYPE_TRIPLET 4 +#define SIGNAL_TYPE_BEST_SPIKE 5 +#define SIGNAL_TYPE_BEST_GAUSSIAN 6 +#define SIGNAL_TYPE_BEST_PULSE 7 +#define SIGNAL_TYPE_BEST_TRIPLET 8 +#define SIGNAL_TYPE_AUTOCORR 9 +#define SIGNAL_TYPE_BEST_AUTOCORR 10 + +// Result Flags. Can be passed from validator to assimilator +// via the BOINC result.opaque field. Note that you have +// to cast to float in order to assign a flag to the opaque +// field. OR into a temp int and then assign with a cast. +#define RESULT_FLAG_OVERFLOW 0x00000001 + +struct SIGNAL { + int type; + double power; + double period; + double ra; + double decl; + double time; + double freq; + double delay; + double sigma; + double chisqr; + double max_power; + double peak_power; + double mean_power; + double score; + unsigned char pot[256]; + int len_prof; + double snr; + double thresh; + int fft_len; + double chirp_rate; + + bool checked; // temp + + bool roughly_equal(SIGNAL&); +}; + +struct SAH_RESULT { + bool have_result; + bool overflow; + vector signals; + + bool has_roughly_equal_signal(SIGNAL&); + bool strongly_similar(SAH_RESULT&); + bool weakly_similar(SAH_RESULT&); + bool bad_values(); + int parse_file(FILE*); + int num_signals; + bool found_best_autocorr; + bool is_overflow; + double setiathome_version; +}; + +extern int write_sah_db_entries(SAH_RESULT&); + +#endif diff --git a/validate/sah_validate.cpp b/validate/sah_validate.cpp new file mode 100644 index 0000000..4bd3a29 --- /dev/null +++ b/validate/sah_validate.cpp @@ -0,0 +1,701 @@ +#include "sah_config.h" +#include +#include +#include +#include + +#include "parse.h" +#include "boinc_db.h" +#include "error_numbers.h" + +#include "sah_result.h" +#include "sah_boinc_db.h" + +//#include "boinc_db.h" +#include "util.h" +#include "sched_config.h" +#include "sched_util.h" +#include "sched_msgs.h" + +extern char app_name[256]; + +const int MAX_ALLOWABLE_CREDIT = 225; + +struct VALIDATE_STATS { + int nstrong_compare; + int nstrong; + int nweak_compare; + int nweak; + int bad_results; + + void print(); +}; + +int validate_single(vector& results, long & canonical_id, double& granted_credit); +int validate_plural(vector& results, vector& sah_results, long & canonical_id, double& granted_credit); +void check_overflow_result(RESULT& r); +int log_cuda_result(RESULT& result, double& granted_credit); +bool is_cuda(RESULT result); +int handle_cuda_notvalid(RESULT& result_1, RESULT& result_2); + +void VALIDATE_STATS::print() { + printf("Strongly similar: %d out of %d\n", nstrong, nstrong_compare); + printf("Weakly similar: %d out of %d\n", nweak, nweak_compare); +} + +VALIDATE_STATS validate_stats; + +// the init and usage functions are required by boinc +int validate_handler_init(int, char**) { + return 0; +} +void validate_handler_usage() { +} + +// check_set() is called from BOINC code and is passed a vector of all +// received results for work unit. check_set() determines the canonical +// result and flags each result as to whether it is similar enough to the +// canonical result to be given credit. check_set provides BOINC with both +// the canonical ID and the amount of credit to be granted to each validated +// result. As a matter of policy the validator does not do values checking. +// The canonical result could have bad values. The detection and flagging +// of this situation is a function of the assimilator. +// +//------------------------------------------------------------ +int check_set( + vector& results, WORKUNIT& wu, long & canonicalid, double& granted_credit, bool& retry) { +//------------------------------------------------------------ + + // Note that SAH_RESULT is not the same type as the standard sah + // result as it appears in the app and the science backend. Rather + // it simply contains a vector of all the signals returned in a + // a given result, along with functions used to validate that result + // (ie that set of signals). + // I should rename the type. jeffc + vector sah_results; + //SAH_RESULT s; + RESULT r; + DB_RESULT db_result; + + unsigned int i, j, k, good_result_count=0; + bool found, err_opendir=false; + double max_credit, min_credit, sum; + int max_credit_i=-1, min_credit_i=-1, nvalid, retval; + vector bad_result; + + retry=false; // init + + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "check_set() checking %ld results\n", + results.size() + ); + + // read and parse the result files + // + for (i=0; i& results, long& canonicalid, double& granted_credit) { +// This routine is called for single validation (from a trusted client). +//------------------------------------------------------------ + + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] is trusted nonredundant and therefore canonical\n", + results[0].id + ); + + check_overflow_result(results[0]); + + results[0].validate_state = VALIDATE_STATE_VALID; + canonicalid = results[0].id; + + if (results[0].claimed_credit <= MAX_ALLOWABLE_CREDIT) { + granted_credit = results[0].claimed_credit; + } else { + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] is claiming greater than max allowable credit (%d). Granting max allowable.\n", + results[0].id, MAX_ALLOWABLE_CREDIT + ); + granted_credit = MAX_ALLOWABLE_CREDIT; + } + + return(0); +} + +//------------------------------------------------------------ +int validate_plural(vector& results, vector& sah_results, long& canonicalid, double& granted_credit) { +// This routine is called for redundant validation (from nontrusted or test case clients) . +//------------------------------------------------------------ + + unsigned int i, j, k; + bool found; + double max_credit, min_credit, sum; + int max_credit_i=-1, min_credit_i=-1, nvalid, retval; + + // see if there's a pair of results that are strongly similar + // Not all results are *neccessarily* checked for overflow. Any + // result that may become the canonical reult is checked and thus + // a valid overflow indicator is always paased on to the assimilator. + found = false; + for (i=0; i8.89))&& + !(sah_results[i].is_overflow || results[i].runtime_outlier) && + !strcmp(app_name,"setiathome_v8")) { + results[i].validate_state = VALIDATE_STATE_INVALID; + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] is from an invalid app_version (%f)\n", results[i].id, sah_results[i].setiathome_version + ); + continue; + } + + for (j=i+1; j8.89))&& + !(sah_results[j].is_overflow || results[j].runtime_outlier) && + !strcmp(app_name,"setiathome_v8")) { + results[j].validate_state = VALIDATE_STATE_INVALID; + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] is from an invalid app_version (%f)\n", results[j].id,sah_results[j].setiathome_version + ); + continue; + } + if (sah_results[i].strongly_similar(sah_results[j])) { + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld (%d signals) and RESULT#%ld (%d signals)] ARE strongly similar\n", + results[i].id, sah_results[i].num_signals, results[j].id, + sah_results[j].num_signals + ); + found = true; + validate_stats.nstrong++; + break; + } + handle_cuda_notvalid(results[i], results[j]); // temporary for cuda debugging + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld (%d signals) and RESULT#%ld (%d signals)] are NOT strongly similar\n", + results[i].id, sah_results[i].num_signals, results[j].id, + sah_results[j].num_signals + ); + } // end scan with [j] to match [i] + if (found) break; + } // end scan with [i] to find canonical + + if (found) { + // At this point results[i] is the canonical result and results[j] + // is strongly similar to results[i]. + canonicalid = results[i].id; + max_credit = 0; + min_credit = 0; + nvalid = 0; + for (k=0; k8.89))&& + !(sah_results[k].is_overflow || results[k].runtime_outlier) && + !strcmp(app_name,"setiathome_v8")) { + results[k].validate_state = VALIDATE_STATE_INVALID; + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] is from an invalid app_version (%f)\n", results[k].id,sah_results[k].setiathome_version + ); + continue; + } + if (k == i || k == j) { + results[k].validate_state = VALIDATE_STATE_VALID; + } else { + validate_stats.nweak_compare++; + if (sah_results[k].weakly_similar(sah_results[i])) { + validate_stats.nweak++; + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[CANONICAL RESULT#%ld (%d signals) and RESULT#%ld (%d signals)] ARE weakly similar\n", + results[i].id, sah_results[i].num_signals, results[k].id, + sah_results[k].num_signals + ); + results[k].validate_state = VALIDATE_STATE_VALID; + } else { + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[CANONICAL RESULT#%ld (%d signals) and RESULT#%ld (%d signals)] are NOT weakly similar\n", + results[i].id, sah_results[i].num_signals, results[k].id, + sah_results[k].num_signals + ); + results[k].validate_state = VALIDATE_STATE_INVALID; + handle_cuda_notvalid(results[i], results[k]); // temporary for cuda debugging + } + } + + if (results[k].validate_state == VALIDATE_STATE_VALID) { + if (results[k].claimed_credit < 0) { + results[k].claimed_credit = 0; + } + if (nvalid == 0) { + max_credit = min_credit = results[k].claimed_credit; + max_credit_i = min_credit_i = k; + } else { + if (results[k].claimed_credit >= max_credit) { + max_credit = results[k].claimed_credit; + max_credit_i = k; + } + if (results[k].claimed_credit <= min_credit) { + min_credit = results[k].claimed_credit; + min_credit_i = k; + } + } + nvalid++; + } // end validate_state == VALIDATE_STATE_VALID + } // end scan with [k] to validate rest of set against canonical + + // the granted credit is the average of claimed credits + // of valid results, discarding the largest and smallest + // + if (nvalid == 2) { + granted_credit = min_credit; + } else { + // Take care of case where all claimed credits are equal. + if (max_credit == min_credit) { + granted_credit = min_credit; + } else { + sum = 0; + for (k=0; k8.89))&& + !(sah_new.is_overflow || new_result.runtime_outlier) && + !strcmp(app_name,"setiathome_v8")) { + new_result.validate_state = VALIDATE_STATE_INVALID; + retval = 0; + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] is from an invalid app_version (%f)\n", new_result.id,sah_new.setiathome_version + ); + goto return_retval; + } + + + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] getting canonical result file %s\n", + canonical.id, canonical.name + ); + retval = get_result_file((RESULT &)canonical, sah_canonical); + if (retval) { + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] read/parse of %s FAILED with retval %d\n", + canonical.id, canonical.name, retval + ); + // A directory problem may be transient. + if (retval == ERR_OPENDIR) { + retry = true; + retval = 0; + goto return_retval; + } else { + // a non-transient, non-recoverable error - set new_result to error. + new_result.outcome = RESULT_OUTCOME_VALIDATE_ERROR; + new_result.validate_state = VALIDATE_STATE_INVALID; + retval = 0; + goto return_retval; + } + } + + if (sah_canonical.weakly_similar(sah_new)) { + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[CANONICAL RESULT#%ld (%d signals) and NEW RESULT#%ld (%d signals)] ARE weakly similar\n", + canonical.id, sah_canonical.num_signals, new_result.id, sah_new.num_signals + ); + new_result.validate_state = VALIDATE_STATE_VALID; + } else { + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[CANONICAL RESULT#%ld (%d signals) and NEW RESULT#%ld (%d signals)] are NOT weakly similar\n", + canonical.id, sah_canonical.num_signals, new_result.id, sah_new.num_signals + ); + new_result.validate_state = VALIDATE_STATE_INVALID; + handle_cuda_notvalid(canonical, new_result); // temporary for cuda debugging + } + + if (new_result.validate_state == VALIDATE_STATE_VALID) { + log_cuda_result(new_result, canonical.granted_credit); + } + + retval = 0; +return_retval: + return(retval); +} + +//------------------------------------------------------------ +void check_overflow_result(RESULT& r) { +//------------------------------------------------------------ + int result_flags=0; + + if (strstr(r.stderr_out, "result_overflow")) { + r.runtime_outlier = true; + result_flags = (long)r.opaque; + result_flags |= RESULT_FLAG_OVERFLOW; + r.opaque = (double)result_flags; + log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, "[RESULT#%ld] is an OVERFLOW result\n", r.id); + } +} + +//------------------------------------------------------------ +int log_cuda_result(RESULT& result, double& granted_credit) { +//------------------------------------------------------------ + + const char * cuda_str = "SETI@home using CUDA accelerated device "; + time_t log_time; + int i, retval; + char stderr_txt[1024]; + char log_path[256]; + char device_str[256]; + char * p; + static FILE * log_fp=NULL; + + device_str[0] = '\0'; + + get_log_path(log_path, "cuda_result_log"); + if (!log_fp) { + log_fp = fopen(log_path, "a"); + if (!log_fp) { + log_messages.printf( + SCHED_MSG_LOG::MSG_CRITICAL, + "[RESULT#%ld] cannot open cuda_result_log\n", + result.id + ); + exit(1); + } else { + setbuf(log_fp, NULL); + } + } + + //get stderr_txt and determine cuda status + p = strstr(result.stderr_out, cuda_str); + if (p == NULL) { + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] is not a cuda result\n", + result.id + ); + return(0); // not a cuda result - nothing more to do + } else { + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[RESULT#%ld] is a cuda result\n", + result.id + ); + return(1); // is a cuda result - hack - we will remove this entire routine later + } + // pull out device string and replace spaces with underscores + p += strlen(cuda_str); + for (i=0; p[i] != '\n' && p[i] != '\0'; i++) { + device_str[i] = p[i]; + } + device_str[i] = '\0'; + for (i=0; device_str[i] != '\0'; i++) { + if (device_str[i] == ' ') { + device_str[i] = '_'; + } + } + + log_time = time(NULL); + + retval = fprintf(log_fp, "%ld %ld %ld %ld %ld %ld %lf %lf %s\n", + log_time, (time_t)result.received_time, result.id, + result.hostid, result.userid, + result.teamid, result.claimed_credit, + granted_credit, device_str); + if (retval < 0) { + log_messages.printf( + SCHED_MSG_LOG::MSG_CRITICAL, + "[RESULT#%ld] cannot write to cuda_result_log : %s\n", + result.id,strerror(errno) + ); + } + + return(1); // this was a cuda result +} + +//------------------------------------------------------------ +bool is_cuda(RESULT result) { +//------------------------------------------------------------ + + bool retval=false; + + const char * cuda_str = "SETI@home using CUDA accelerated device "; + + if (strstr(result.stderr_out, cuda_str)) { + return(true); + } else { + return(false); + } + +} + +//------------------------------------------------------------ +int handle_cuda_notvalid(RESULT& result_1, RESULT& result_2) { +//------------------------------------------------------------ + + int retval=0; + bool result_1_is_cuda, result_2_is_cuda; + char result_1_cuda_str[16]; + char result_2_cuda_str[16]; + + result_1_is_cuda = is_cuda(result_1); + result_2_is_cuda = is_cuda(result_2); + + if (result_1_is_cuda ^ result_2_is_cuda) { + if (result_1_is_cuda) { + strcpy(result_1_cuda_str, "cuda"); + } else { + strcpy(result_1_cuda_str, "noncuda"); + } + if (result_2_is_cuda) { + strcpy(result_2_cuda_str, "cuda"); + } else { + strcpy(result_2_cuda_str, "noncuda"); + } + log_messages.printf( + SCHED_MSG_LOG::MSG_DEBUG, + "[%s RESULT#%ld and %s RESULT#%ld] do not covalidate\n", + result_1_cuda_str, result_1.id, result_2_cuda_str, result_2.id + ); + + // insert additonal "cuda vs noncuda not valid" code here + + retval = 1; + } + + return(retval); +} + + +#if 0 +// test program: +// sah_validate file1 ... filen +// +int main(int argc, char** argv) { + vector results; + double credit, test_credit=5.5; + int i, canonical, retval; + RESULT r; + + memset(&validate_stats, 0, sizeof(validate_stats)); + + for (i=1; i\n" + " %s\n" + "\n", + argv[i] + ); + results.push_back(r); + } + + retval = check_set(results, canonical, credit); + if (retval) { + printf("error: %d\n", retval); + } + + for (i=0; i < results.size(); i++) { + printf("validate_state of %s is %d\n", argv[i+1], results[i].validate_state); + } + + if (canonical) { + printf("canonical result is %d; credit is %f\n", canonical, credit); + } else { + printf("no canonical result found\n"); + } + validate_stats.print(); +} +#endif diff --git a/xcompile/xcompile.MinGW32_on_cygwin.sh b/xcompile/xcompile.MinGW32_on_cygwin.sh new file mode 100755 index 0000000..ae12675 --- /dev/null +++ b/xcompile/xcompile.MinGW32_on_cygwin.sh @@ -0,0 +1,162 @@ +#! /bin/sh +case $1 in + --help) echo Usage: + echo "$0 \ (default i686-\*-mingw32)" + echo " Expects to find build root in /usr/\/sys-root/mingw" + ;; + i686*mingw32|x86_64*mingw32) + export TARGET_HOST=$1 + ;; +esac +for target_host in ${TARGET_HOST} i686-w64-mingw32 i686-pc-mingw32 x86_64-w64-mingw32 x86_64-pc-mingw32 none ; do + if test ${target_host} = none ; then + echo Cross compiling environment not found in /usr + exit 1 + fi + echo -n Checking for cross compiling environment in /usr/${target_host} + if test -d /usr/${target_host}; then + export TARGET_HOST=${target_host} + echo ... found + break + fi + echo ... not found +done + +case $TARGET_HOST in + i686*) openssl_cross=mingw + ;; + x86_64*) openssl_cross=mingw64 + ;; +esac + +build_client=yes +build_server=no + +export XCOMPILE_ROOT="/usr/${TARGET_HOST}/sys-root/mingw" +guess=`../config.guess` +export BUILD_HOST=`../config.sub ${guess}` +export PATH="/usr/${TARGET_HOST}/bin:${XCOMPILE_ROOT}/bin:${PATH}" + +export CC=`which ${TARGET_HOST}-gcc` +export CXX=`which ${TARGET_HOST}-g++` +export AR=`which ${TARGET_HOST}-ar` +export LD=`which ${TARGET_HOST}-ld` +export RANLIB=`which ${TARGET_HOST}-ranlib` +export WINDRES=`which ${TARGET_HOST}-windres` +export CPPFLAGS="-D_WIN32_WINDOWS=0x0410 -DMINGW_WIN32 -I${XCOMPILE_ROOT}/include" +export CFLAGS="${CPPFLAGS}" +export CXXFLAGS="-gstabs -g3 -fpermissive" +export LDFLAGS="-L/usr/${TARGET_HOST}/lib -L${XCOMPILE_ROOT}/lib" +export CURL_CONFIG="${XCOMPILE_ROOT}/bin/curl-config" +export WX_CONFIG_PATH="${XCOMPILE_ROOT}/bin/wx-config" +pkgsearchpath="dummy" +for dir in `find /usr/${TARGET_HOST} -name pkgconfig` ; do + pkgsearchpath="${pkgsearchpath}:${dir}" +done +for dir in `find /usr/lib -name pkgconfig` ; do + pkgsearchpath="${pkgsearchpath}:${dir}" +done +for dir in `find /usr/share -name pkgconfig` ; do + pkgsearchpath="${pkgsearchpath}:${dir}" +done +export PKG_CONFIG_PATH=`echo ${pkgsearchpath} | sed 's/dummy://'` + +if ! ( test -e ../configure && find .. -name configure -mtime -1 ) ; then + cd .. + ./_autosetup + cd xcompile +fi + +if test $build_client != no ; then + if ! test -f ${XCOMPILE_ROOT}/lib/libjpeg.a ; then + jpegver=9a + wget http://ijg.org/files/jpegsrc.v${jpegver}.tar.gz + tar zxf jpegsrc.v${jpegver}.tar.gz + /bin/rm jpegsrc.v${jpegver}.tar.gz + cd jpeg-${jpegver} + ./configure --prefix=${XCOMPILE_ROOT}/ --disable-shared --host=$TARGET_HOST --build=$BUILD_HOST + make -j 4 all + make install + cd .. + rm -rf jpeg-${jpegver} + fi + +fi + +if test $build_client != no ; then + if ! test -f ${XCOMPILE_ROOT}/lib/libssl.a ; then + opensslver=1.0.1g + wget http://www.openssl.org/source/openssl-${opensslver}.tar.gz + tar zxf openssl-${opensslver}.tar.gz + /bin/rm openssl-${opensslver}.tar.gz + cd openssl-${opensslver} + ./Configure --prefix=${XCOMPILE_ROOT}/ ${CFLAGS} ${LDFLAGS} no-shared zlib $openssl_cross + make -j 4 all + make install + cd .. + rm -rf openssl-${opensslver} + fi +fi + +if test $build_client != no ; then + if ! test -f ${XCOMPILE_ROOT}/lib/libcurl.a ; then + curlver=7.36.0 + wget http://curl.haxx.se/download/curl-${curlver}.tar.bz2 + tar jxf curl-${curlver}.tar.bz2 + /bin/rm curl-${curlver}.tar.bz2 + cd curl-${curlver} + ./configure --prefix=${XCOMPILE_ROOT} --enable-static --disable-shared --host=$TARGET_HOST --build=$BUILD_HOST --with-zlib=${XCOMPILE_ROOT} + make -j 4 all + make install + cd .. + rm -rf curl-${curlver} + fi +fi + +if test $build_client != no ; then + if ! test -f ${XCOMPILE_ROOT}/include/GL/glut.h ; then + svn co http://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut freeglut + cd freeglut + mkdir build + cd build + /usr/bin/cmake -D GNU_HOST=${TARGET_HOST} \ + -D CMAKE_TOOLCHAIN_FILE=mingw_cross_toolchain.cmake \ + -D CMAKE_INSTALL_PREFIX=${XCOMPILE_ROOT}\ + -D FREEGLUT_BUILD_STATIC_LIBS=ON \ + -D FREEGLUT_BUILD_SHARED_LIBS=OFF \ + -D FREEGLUT_BUILD_DEMOS=OFF \ + .. + make -j 4 all + make install + cd ../.. + /bin/rm -rf freeglut + fi +fi + +if test $build_client != no ; then + if ! test -f ${XCOMPILE_ROOT}/lib/libfftw3f.a ; then + case $target_host in + i[56]86-*) cp ../client/win_build/libfftw3f-3-3-4_x86.lib ${XCOMPILE_ROOT}/lib/libfftw3f.a + cp ../client/win_build/libfftw3f-3-3-4_x86.dll ${XCOMPILE_ROOT}/bin + ;; + x86*|x64*) cp ../client/win_build/libfftw3f-3-3-4_x64.lib ${XCOMPILE_ROOT}/lib/libfftw3f.a + cp ../client/win_build/libfftw3f-3-3-4_x64.dll ${XCOMPILE_ROOT}/bin + ;; + esac + fi +fi + +enables="--enable-static --disable-shared" +if test $build_client != no ; then + enables="${enables} --enable-client" +else + enables="${enables} --disable-client" +fi +if test $build_server != no ; then + enables="${enables} --enable-server" +else + enables="${enables} --disable-server" +fi + +../configure -C --host=$TARGET_HOST --build=$BUILD_HOST ${enables} --with-ssl=${XCOMPILE_ROOT} --prefix=${XCOMPILE_ROOT} +make -j 4 all