diff -Nru boinc-app-seti-8.00~svn3363/assimilator/Makefile.am boinc-app-seti-8.00~svn3701/assimilator/Makefile.am --- boinc-app-seti-8.00~svn3363/assimilator/Makefile.am 2009-06-29 22:43:09.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/assimilator/Makefile.am 2017-02-16 20:51:03.000000000 +0000 @@ -12,6 +12,7 @@ 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 @@ -30,5 +31,5 @@ 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) +sah_assimilator_LDADD = $(PTHREAD_CFLAGS) $(BOINC_LIBS) $(SETILIB_LIBS) $(MYSQL_LIBS) $(INFORMIX_LIBS) $(CLIBS) $(HEALPIX_LIBS) $(SYSLIBS) diff -Nru boinc-app-seti-8.00~svn3363/assimilator/sah_assimilate_handler.cpp boinc-app-seti-8.00~svn3701/assimilator/sah_assimilate_handler.cpp --- boinc-app-seti-8.00~svn3363/assimilator/sah_assimilate_handler.cpp 2015-11-09 20:02:21.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/assimilator/sah_assimilate_handler.cpp 2017-02-16 20:51:03.000000000 +0000 @@ -32,7 +32,7 @@ // the boinc assimilator makes these available extern SCHED_CONFIG config; -extern bool noinsert; +//extern bool noinsert; const double D2R = 0.017453292; const int fpix_res = 10; // Hz @@ -43,6 +43,14 @@ //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, @@ -143,12 +151,12 @@ } // 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 - ); - } + //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); @@ -166,7 +174,7 @@ } */ } - if (noinsert) return 0; // Note that this will result in the WU being marked as assimilated - + //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 diff -Nru boinc-app-seti-8.00~svn3363/AUTHORS boinc-app-seti-8.00~svn3701/AUTHORS --- boinc-app-seti-8.00~svn3363/AUTHORS 2015-12-28 17:32:39.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/AUTHORS 2016-03-09 02:47:47.000000000 +0000 @@ -23,6 +23,25 @@ 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 diff -Nru boinc-app-seti-8.00~svn3363/client/analyzeFuncs.cpp boinc-app-seti-8.00~svn3701/client/analyzeFuncs.cpp --- boinc-app-seti-8.00~svn3363/client/analyzeFuncs.cpp 2015-12-25 04:59:23.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/client/analyzeFuncs.cpp 2017-04-11 22:34:06.000000000 +0000 @@ -33,10 +33,10 @@ #if defined(USING_XCODE) || defined(_WIN32) #include "version.h" -const char *BOINC_PACKAGE_STRING="libboinc: "BOINC_VERSION_STRING; +const char *BOINC_PACKAGE_STRING="libboinc: " BOINC_VERSION_STRING; #else #include "config.h" -const char *BOINC_PACKAGE_STRING="libboinc: "PACKAGE_STRING; +const char *BOINC_PACKAGE_STRING="libboinc: " PACKAGE_STRING; #endif #undef PACKAGE_STRING @@ -790,7 +790,7 @@ SETIERROR(WRITE_FAILED,"from outfile.printf (best triplet) in seti_analyze()"); } } - retval=outfile.printf(""PACKAGE_VERSION"\n"); + retval=outfile.printf("" PACKAGE_VERSION "\n"); #ifdef BOINC_APP_GRAPHICS if (sah_graphics) strcpy(sah_graphics->status, "Work unit done"); diff -Nru boinc-app-seti-8.00~svn3363/client/seti.cpp boinc-app-seti-8.00~svn3701/client/seti.cpp --- boinc-app-seti-8.00~svn3363/client/seti.cpp 2016-01-09 10:22:17.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/client/seti.cpp 2017-01-19 21:23:48.000000000 +0000 @@ -1,1122 +1,1122 @@ -// 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 +// 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); @@ -1153,35 +1153,35 @@ 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; -} + + 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 -Nru boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_fpu.cpp boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_fpu.cpp --- boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_fpu.cpp 2014-03-23 20:52:30.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_fpu.cpp 2017-02-23 22:36:56.000000000 +0000 @@ -75,7 +75,7 @@ : "=&t" (val) : "0" (val), "f" (roundVal), "f" (val) ); -#elif defined(_WIN64) || defined (__arm__) +#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); diff -Nru boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_neon.S boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_neon.S --- boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_neon.S 2015-03-01 22:51:46.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_neon.S 2017-02-11 23:39:01.000000000 +0000 @@ -37,23 +37,30 @@ #ifdef __arm__ /* - * vfp_ChirpData.S + * 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 @@ -90,6 +97,7 @@ _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 @@ -98,12 +106,33 @@ * 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 @@ -116,9 +145,12 @@ 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] @@ -131,8 +163,10 @@ 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 @@ -142,8 +176,11 @@ 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} @@ -569,7 +606,11 @@ 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} @@ -590,26 +631,6 @@ * neon_FoldSubs.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 24, 1 - .eabi_attribute 25, 1 - .eabi_attribute 26, 2 - .eabi_attribute 30, 2 - .eabi_attribute 18, 4 - .text .align 2 /***** * fold array by 3 @@ -2498,25 +2519,6 @@ * 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 24, 1 - .eabi_attribute 25, 1 - .eabi_attribute 26, 2 - .eabi_attribute 30, 2 - .eabi_attribute 18, 4 - .text .align 2 .global _Z21neon_GetPowerSpectrumPA2_fPfi .type _Z21neon_GetPowerSpectrumPA2_fPfi, %function diff -Nru boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_vector.cpp boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_vector.cpp --- boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_vector.cpp 2016-01-08 18:28:07.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_vector.cpp 2017-02-14 20:52:52.000000000 +0000 @@ -41,7 +41,6 @@ #ifdef _WIN32 #define uint32_t unsigned long #endif - #include #include #include @@ -264,7 +263,7 @@ if ((dp & 0x00000800) && avxSupported()) CPUCaps |= BA_AVX; #endif -#elif defined(__i386__) || defined (__x86_64__) +#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) @@ -410,7 +409,7 @@ avx_ChirpData_d, BA_AVX, "avx_ChirpData_d", # endif #endif -#if defined(__arm__) && defined(ANDROID) && defined(__VFP_FP__) && !defined(__SOFTFP__) +#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__) vfp_ChirpData, BA_VFP, "vfp_ChirpData", #ifdef USE_NEON neon_ChirpData, BA_NEON, "neon_ChirpData", @@ -912,9 +911,22 @@ 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__) diff -Nru boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_vfp_aux.cpp boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_vfp_aux.cpp --- boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_vfp_aux.cpp 2015-12-31 19:17:39.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_vfp_aux.cpp 2017-02-01 19:46:44.000000000 +0000 @@ -33,7 +33,7 @@ #include #include -#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__) +#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__) || defined(__aarch64__) #define INVALID_CHIRP 2e+20 @@ -47,6 +47,7 @@ #include "diagnostics.h" #include "asmlib.h" #include "pulsefind.h" +#include "fp_arm.h" template @@ -198,6 +199,7 @@ #ifdef USE_MANUAL_CALLSTACK call_stack.enter("vfp_subTranspose2()"); #endif +#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__) __asm__ __volatile__ ( "fldmias %2, {s4, s5}\n" "fldmias %3, {s6, s7}\n" @@ -209,6 +211,19 @@ : : "r" (out), "r" (out+y), "r" (in), "r" (in+x) : "s3", "s4", "s5", "s6", "s7" ); +#elif defined(__aarch64__) + __asm__ __volatile__ ( + "ldp x4, x5, [%2], #16\n" + "ldp x6, x7, [%3], #16\n" + "mov x3,x6\n" + "mov x6,x5\n" + "mov x5,x3\n" + "stp x4, x5, [%0], #16\n" + "stp x6, x7, [%1], #16\n" + : + : "x" (out), "x" (out+y), "x" (in), "x" (in+x) + : "x3", "x4", "x5", "x6", "x7" ); +#endif #ifdef USE_MANUAL_CALLSTACK call_stack.exit(); #endif diff -Nru boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_vfp.S boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_vfp.S --- boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_vfp.S 2015-03-01 22:51:46.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/client/vector/analyzeFuncs_vfp.S 2017-02-14 20:52:52.000000000 +0000 @@ -50,10 +50,13 @@ .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 @@ -75,8 +78,9 @@ .global _Z13vfp_ChirpDataPA2_fS0_idid .type _Z13vfp_ChirpDataPA2_fS0_idid, %function _Z13vfp_ChirpDataPA2_fS0_idid: - push {r4,r5,r6,r7,r8,lr} + 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 @@ -85,12 +89,30 @@ * 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 @@ -103,9 +125,11 @@ 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] @@ -118,8 +142,11 @@ 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 @@ -610,7 +637,7 @@ .Lendoffunc: mov r0,#0 vpop {d8,d9,d10,d11,d12,d13,d14,d15} - pop {r4,r5,r6,r7,r8,lr} + pop {r4,r5,r6,r7,r8,r9,lr} bx lr .align 2 @@ -624,25 +651,6 @@ * 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 24, 1 - .eabi_attribute 25, 1 - .eabi_attribute 26, 2 - .eabi_attribute 30, 2 - .eabi_attribute 18, 4 - .text .align 2 /***** * fold array by 3 @@ -2133,26 +2141,6 @@ * vfp_GetPowerSpectrum.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 24, 1 - .eabi_attribute 25, 1 - .eabi_attribute 26, 2 - .eabi_attribute 30, 2 - .eabi_attribute 18, 4 - .text .align 2 .global _Z20vfp_GetPowerSpectrumPA2_fPfi .type _Z20vfp_GetPowerSpectrumPA2_fPfi, %function diff -Nru boinc-app-seti-8.00~svn3363/client/win-sah_config.h boinc-app-seti-8.00~svn3701/client/win-sah_config.h --- boinc-app-seti-8.00~svn3363/client/win-sah_config.h 2015-12-28 16:43:39.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/client/win-sah_config.h 2017-04-11 22:34:06.000000000 +0000 @@ -30,6 +30,9 @@ #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 @@ -406,7 +409,7 @@ /* Define to the full name and version of this package. */ #undef PACKAGE_STRING -#define PACKAGE_STRING FILE_DESCRIPTION" "FILE_VERSION +#define PACKAGE_STRING FILE_DESCRIPTION" " FILE_VERSION /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME @@ -427,8 +430,12 @@ #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 2010/Microsoft Visual C++ 10" + #define COMPILER_STRING "Visual Studio/Microsoft Visual C++" #endif #else #define COMPILER_STRING "Unknown Compiler" @@ -436,7 +443,7 @@ #endif #ifndef CUSTOM_STRING -#define CUSTOM_STRING "setiathome_v8 "FILE_VERSION" "COMPILER_STRING +#define CUSTOM_STRING "setiathome_v8 " FILE_VERSION " " COMPILER_STRING #endif /* The size of a `long double', as computed by sizeof. */ diff -Nru boinc-app-seti-8.00~svn3363/client/worker.cpp boinc-app-seti-8.00~svn3701/client/worker.cpp --- boinc-app-seti-8.00~svn3363/client/worker.cpp 2016-01-08 18:28:07.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/client/worker.cpp 2017-05-12 06:55:33.000000000 +0000 @@ -182,8 +182,11 @@ 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) { @@ -194,7 +197,9 @@ remaining=0; boinc_fraction_done(progress); checkpoint(true); // force a checkpoint - boinc_finish(0); +#if 1 //R: set 0 for PGO logging test + boinc_finish(0); +#endif #ifdef USE_MANUAL_CALLSTACK call_stack.exit(); #endif diff -Nru boinc-app-seti-8.00~svn3363/COPYRIGHT boinc-app-seti-8.00~svn3701/COPYRIGHT --- boinc-app-seti-8.00~svn3363/COPYRIGHT 2011-02-22 20:36:42.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/COPYRIGHT 2016-03-09 02:47:47.000000000 +0000 @@ -1,11 +1,16 @@ -// Copyright (c) 1999-2011 Regents of the University of California +// Copyright (c) 1999-2016 Regents of the University of California // -// FFTW: Copyright (c) 2003,2006 Matteo Frigo -// Copyright (c) 2003,2006 Massachusets Institute of Technology +// 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 diff -Nru boinc-app-seti-8.00~svn3363/db/db_table.h boinc-app-seti-8.00~svn3701/db/db_table.h --- boinc-app-seti-8.00~svn3363/db/db_table.h 2013-03-06 21:07:31.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/db/db_table.h 2017-04-11 22:34:06.000000000 +0000 @@ -175,6 +175,7 @@ template row_cache db_table::cache; +#ifndef NEBULA template class db_reference { private: @@ -202,6 +203,82 @@ 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) {} @@ -224,21 +301,6 @@ return *me; } -template -db_reference::operator T() const { - return r; -} - -template -T *db_reference::operator ->() { - return &r; -} - -template -const T *db_reference::operator ->() const { - return &r; -} - #ifndef CLIENT template sqlint8_t db_table::insert(sqlint8_t lid) { @@ -488,12 +550,6 @@ #endif -template -std::ostream &operator <<(std::ostream &o, const db_reference &a) { - o << a.print_xml(); - return o; -} - template const char *db_type::search_tag(const char *s) { if (s) { @@ -525,43 +581,6 @@ return me->print_xml(full_subtables,show_ids,no_refs,tag); } -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 db_type &db_type::operator =(const T &t) { if (me != &t) { @@ -595,22 +614,6 @@ } return *this; } - -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; -} #endif diff -Nru boinc-app-seti-8.00~svn3363/db/schema_master.cpp boinc-app-seti-8.00~svn3701/db/schema_master.cpp --- boinc-app-seti-8.00~svn3363/db/schema_master.cpp 2016-01-26 22:30:06.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/db/schema_master.cpp 2017-01-24 19:57:21.000000000 +0000 @@ -788,8 +788,8 @@ template <> const char * const db_table::table_name="receiver_config"; 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","s4_id","name","beam_width","center_freq","latitude","longitude","elevation","diameter","az_orientation","az_corr_coeff","zen_corr_coeff","array_az_ellipse","array_za_ellipse","array_angle","min_vgc""polarization"}; +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), @@ -800,6 +800,9 @@ 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), @@ -824,6 +827,9 @@ 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), @@ -868,6 +874,9 @@ 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; { @@ -898,7 +907,7 @@ std::string receiver_config::update_format() const { std::ostringstream rv(""); - for (int i=2;i<17;i++) rv << "?,"; + for (int i=2;i<20;i++) rv << "?,"; rv << "?"; return rv.str(); } @@ -911,7 +920,7 @@ std::string receiver_config::select_format() const { std::string rv(""); -for (int i=0; i<16;i++) rv+="?,"; +for (int i=0; i<19;i++) rv+="?,"; rv+="?"; return rv; } @@ -936,6 +945,12 @@ rv << ','; rv << elevation; rv << ','; + rv << glat; + rv << ','; + rv << glon; + rv << ','; + rv << galt; + rv << ','; rv << diameter; rv << ','; rv << az_orientation; @@ -998,6 +1013,9 @@ 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()) { @@ -1089,6 +1107,24 @@ 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'); @@ -1199,17 +1235,29 @@ } { std::istringstream row(*(s[8])); - row >> diameter; + 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[10]); + SQL_ROW tmp(s[13]); for (i=0;i> array_az_ellipse; } { - std::istringstream row(*(s[13])); + std::istringstream row(*(s[16])); row >> array_za_ellipse; } { - std::istringstream row(*(s[14])); + std::istringstream row(*(s[17])); row >> array_angle; } { - std::istringstream row(*(s[15])); + std::istringstream row(*(s[18])); row >> min_vgc; } { - strncpy(polarization,s[16]->c_str(),32); + strncpy(polarization,s[19]->c_str(),32); polarization[31]=0; } } void receiver_config::parse(const std::string &s) { - SQL_ROW row(&s,17); + SQL_ROW row(&s,20); parse(row); } diff -Nru boinc-app-seti-8.00~svn3363/db/schema_master.h boinc-app-seti-8.00~svn3701/db/schema_master.h --- boinc-app-seti-8.00~svn3363/db/schema_master.h 2016-01-26 22:30:06.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/db/schema_master.h 2017-01-28 23:58:41.000000000 +0000 @@ -21,7 +21,7 @@ inline int db_close() { return !(db_is_open=0); } inline int db_change() { return (db_is_open=1); } #ifdef NEBULA -typedef sqlint8_t long; +typedef long sqlint8_t; template struct db_reference { ID_TYPE id; @@ -29,6 +29,7 @@ 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 @@ -150,6 +151,9 @@ double latitude; double longitude; double elevation; + double glat; + double glon; + double galt; double diameter; double az_orientation; sqlblob az_corr_coeff ; diff -Nru boinc-app-seti-8.00~svn3363/db/schema_master.sql boinc-app-seti-8.00~svn3701/db/schema_master.sql --- boinc-app-seti-8.00~svn3363/db/schema_master.sql 2016-01-26 22:30:06.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/db/schema_master.sql 2017-01-24 19:57:21.000000000 +0000 @@ -80,6 +80,9 @@ latitude float, longitude float, elevation float, + glat float, + glon float, + galt float, diameter smallfloat, az_orientation float, az_corr_coeff list(float not null), diff -Nru boinc-app-seti-8.00~svn3363/db/xml_util.h boinc-app-seti-8.00~svn3701/db/xml_util.h --- boinc-app-seti-8.00~svn3363/db/xml_util.h 2016-01-28 22:48:08.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/db/xml_util.h 2017-01-19 21:23:48.000000000 +0000 @@ -210,9 +210,7 @@ #endif // 0 #define XML_ENCODING "iso-8859-1" - -static const char * const xml_header= - "\n"; +static const char * const xml_header="\n"; // XML entity for tranlation table (not wchar_t compatible) struct xml_entity { diff -Nru boinc-app-seti-8.00~svn3363/debian/changelog boinc-app-seti-8.00~svn3701/debian/changelog --- boinc-app-seti-8.00~svn3363/debian/changelog 2017-03-15 15:29:49.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/changelog 2017-09-11 17:33:46.000000000 +0000 @@ -1,3 +1,38 @@ +boinc-app-seti (8.00~svn3701-1) unstable; urgency=medium + + * Upload to unstable + + -- Gianfranco Costamagna Mon, 11 Sep 2017 19:33:46 +0200 + +boinc-app-seti (8.00~svn3701-1~exp1) experimental; urgency=medium + + * New upstream release, patch refresh + * Bump compat level to 10. + * Try to fix arm64 build. + * Bump std-version to 4.1.0, no changes required. + + -- Gianfranco Costamagna Tue, 11 Apr 2017 14:24:24 +0200 + +boinc-app-seti (8.00~svn3643-1~exp3) experimental; urgency=medium + + * Introduced LTO (Link Time Optimization). + + -- Steffen Moeller Tue, 11 Apr 2017 00:23:22 +0200 + +boinc-app-seti (8.00~svn3643-1~exp2) experimental; urgency=medium + + * Moved to debhelper 10, eliminating invocation of dh_autoreconf (Gianfranco and Steffen) + * Gave explicit reference to libboinc-app7 (>= 7.6.33) (Closes: #825374). + + -- Steffen Moeller Mon, 10 Apr 2017 18:14:54 +0200 + +boinc-app-seti (8.00~svn3643-1~exp1) experimental; urgency=medium + + * New upstream release, drop upstream fix. + * Patch refresh + + -- Gianfranco Costamagna Tue, 04 Apr 2017 10:14:51 +0200 + boinc-app-seti (8.00~svn3363-4) unstable; urgency=medium * Fix broken symlink (thanks Andreas Beckmann!) diff -Nru boinc-app-seti-8.00~svn3363/debian/compat boinc-app-seti-8.00~svn3701/debian/compat --- boinc-app-seti-8.00~svn3363/debian/compat 2014-08-30 18:15:09.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/compat 2017-09-11 13:25:21.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru boinc-app-seti-8.00~svn3363/debian/control boinc-app-seti-8.00~svn3701/debian/control --- boinc-app-seti-8.00~svn3363/debian/control 2016-05-16 09:36:26.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/control 2017-09-11 13:26:25.000000000 +0000 @@ -5,9 +5,8 @@ Uploaders: Steffen Moeller , Guo Yixuan (郭溢譞) , Gianfranco Costamagna -Standards-Version: 3.9.8 -Build-Depends: debhelper (>= 9), - dh-autoreconf, +Standards-Version: 4.1.0 +Build-Depends: debhelper (>= 10), dpkg-dev (>= 1.16.1.1), freeglut3-dev, libboinc-app-dev, @@ -21,7 +20,7 @@ Package: boinc-app-seti Architecture: any -Depends: boinc-client, ${misc:Depends}, ${shlibs:Depends} +Depends: boinc-client, libboinc-app7 (>= 7.6.33), ${misc:Depends}, ${shlibs:Depends} Suggests: boinc-manager Conflicts: boinc-app-seti-graphics Description: SETI@home application for the BOINC client @@ -50,7 +49,7 @@ Package: boinc-app-seti-graphics Architecture: any -Depends: boinc-client, ${misc:Depends}, ${shlibs:Depends} +Depends: boinc-client, libboinc-app7 (>= 7.6.33), ${misc:Depends}, ${shlibs:Depends} Suggests: boinc-manager Conflicts: boinc-app-seti Description: SETI@home application for the BOINC client (with graphics) diff -Nru boinc-app-seti-8.00~svn3363/debian/patches/007_worker_comments.patch boinc-app-seti-8.00~svn3701/debian/patches/007_worker_comments.patch --- boinc-app-seti-8.00~svn3363/debian/patches/007_worker_comments.patch 2015-02-23 14:18:11.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/patches/007_worker_comments.patch 2017-09-11 13:30:18.000000000 +0000 @@ -1,6 +1,8 @@ Description: add some useful output debug. ---- a/client/worker.cpp -+++ b/client/worker.cpp +Index: boinc-app-seti/client/worker.cpp +=================================================================== +--- boinc-app-seti.orig/client/worker.cpp ++++ boinc-app-seti/client/worker.cpp @@ -130,7 +130,7 @@ fclose(f); if (retval) SETIERROR(retval,"from seti_parse_wu() in read_wu_state()"); @@ -10,7 +12,7 @@ sprintf(msg,"(%s) in read_wu_state() errno=%d\n",path.c_str(),errno); SETIERROR(FOPEN_FAILED,msg); } -@@ -174,15 +174,19 @@ +@@ -174,17 +174,21 @@ #endif try { @@ -25,12 +27,14 @@ + fprintf(stderr,"I: worker() - seti_do_work\n"); retval = seti_do_work(); if (retval) SETIERROR(retval,"from seti_do_work() in worker()"); - + #if 0 //R: Set for PGO + exit(retval); + #else + fprintf(stderr,"I: worker() - boinc_finish\n"); boinc_finish(retval); + #endif } - catch (seti_error e) { -@@ -200,6 +204,7 @@ +@@ -205,6 +209,7 @@ #endif exit(0); // an overflow is not an app error } else { diff -Nru boinc-app-seti-8.00~svn3363/debian/patches/212_increase_buffers.patch boinc-app-seti-8.00~svn3701/debian/patches/212_increase_buffers.patch --- boinc-app-seti-8.00~svn3363/debian/patches/212_increase_buffers.patch 2014-10-18 10:53:21.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/patches/212_increase_buffers.patch 2017-09-11 13:25:21.000000000 +0000 @@ -1,28 +1,28 @@ Description: increase buffer size. --- a/client/seti.cpp +++ b/client/seti.cpp -@@ -1024,10 +1024,11 @@ - unsigned long nbytes, nsamples,samples_per_byte; - sah_complex *data; - unsigned long i; -- char *p, buf[256]; -+ char *p, buf[2560]; - sah_complex *bin_data=0; - int retval=0; - FORCE_FRAME_POINTER; -+ buf[0]=0; - #ifdef USE_MANUAL_CALLSTACK - call_stack.enter("seti_parse_data()"); - #endif -@@ -1042,7 +1043,7 @@ - switch(swi.data_type) { - case DATA_ASCII: - for (i=0; i + +--- boinc-app-seti-8.00~svn3643.orig/client/vector/analyzeFuncs_vfp_aux.cpp ++++ boinc-app-seti-8.00~svn3643/client/vector/analyzeFuncs_vfp_aux.cpp +@@ -33,7 +33,7 @@ + #include + #include + +-#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__) || defined(__aarch64__) ++#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__) + + + #define INVALID_CHIRP 2e+20 diff -Nru boinc-app-seti-8.00~svn3363/debian/patches/fix-arm-build.patch boinc-app-seti-8.00~svn3701/debian/patches/fix-arm-build.patch --- boinc-app-seti-8.00~svn3363/debian/patches/fix-arm-build.patch 2016-02-02 08:15:55.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/patches/fix-arm-build.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -Description: fix an armhf build failure, by reverting the pld function removal. -../../client/vector/analyzeFuncs_vfp_aux.cpp: In function 'void v_pfsubTranspose(float*, float*, int, int)': -../../client/vector/analyzeFuncs_vfp_aux.cpp:68:24: error: there are no arguments to 'pld' that depend on a template parameter, so a declaration of 'pld' must be available [-fpermissive] - ---- boinc-app-seti-8.00~svn3363.orig/client/vector/analyzeFuncs_vfp_aux.cpp -+++ boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_vfp_aux.cpp -@@ -48,6 +48,14 @@ - #include "asmlib.h" - #include "pulsefind.h" - -+inline void pld(void *arg1,const int arg2=0) { -+ __asm__ __volatile__ ( -+ "pld [%0,%1]\n" -+ : -+ : "r" (arg1), "Jr" (arg2) -+ ); -+} -+ - - template - inline void v_pfsubTranspose(float *in, float *out, int xline, int yline) { diff -Nru boinc-app-seti-8.00~svn3363/debian/patches/introduce_lto.patch boinc-app-seti-8.00~svn3701/debian/patches/introduce_lto.patch --- boinc-app-seti-8.00~svn3363/debian/patches/introduce_lto.patch 1970-01-01 00:00:00.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/patches/introduce_lto.patch 2017-09-11 13:25:21.000000000 +0000 @@ -0,0 +1,31 @@ +Description: Introduce --enable-lto option for configure +Author: Steffen Moeller +Index: boinc-app-seti/m4/optimizations.m4 +=================================================================== +--- boinc-app-seti.orig/m4/optimizations.m4 ++++ boinc-app-seti/m4/optimizations.m4 +@@ -45,6 +45,24 @@ if test x_$enable_sse = x_yes ; then + fi + fi + ++AC_ARG_ENABLE([lto], ++ AC_HELP_STRING([--enable-lto], ++ [Use Link Time Optimizations]) ++) ++ ++if test x_$enable_lto = x_yes ; then ++ AC_DEFINE_UNQUOTED([USE_LTO],[1], ++ [Define to 1 to learn that LTO was enabled]) ++# put compiler specific flags here ++ if test x_$ac_cv_c_compiler_gnu = x_yes ; then ++ CFLAGS="-flto ${CFLAGS}" ++ LD=gcc ++ LDFLAGS="-flto ${LDFLAGS}" ++ AR=gcc-ar ++ RANLIB=gcc-ranlib ++ fi ++fi ++ + AC_ARG_ENABLE([mmx], + AC_HELP_STRING([--enable-mmx], + [Use MMX optimizations]) diff -Nru boinc-app-seti-8.00~svn3363/debian/patches/isnan-fix.patch boinc-app-seti-8.00~svn3701/debian/patches/isnan-fix.patch --- boinc-app-seti-8.00~svn3363/debian/patches/isnan-fix.patch 2016-07-14 09:44:37.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/patches/isnan-fix.patch 2017-09-11 13:25:21.000000000 +0000 @@ -4,7 +4,7 @@ --- boinc-app-seti-8.00~svn3363.orig/client/vector/analyzeFuncs_vector.cpp +++ boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_vector.cpp -@@ -45,9 +45,7 @@ +@@ -44,9 +44,7 @@ #include #include #include diff -Nru boinc-app-seti-8.00~svn3363/debian/patches/series boinc-app-seti-8.00~svn3701/debian/patches/series --- boinc-app-seti-8.00~svn3363/debian/patches/series 2016-07-14 09:40:13.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/patches/series 2017-09-11 13:25:21.000000000 +0000 @@ -11,6 +11,6 @@ 006_omitting_archs.patch 007_worker_comments.patch 216-fix-build.patch -#fix-arm-build.patch isnan-fix.patch -upstream-fix.patch +introduce_lto.patch +fix-arm64.patch diff -Nru boinc-app-seti-8.00~svn3363/debian/patches/upstream-fix.patch boinc-app-seti-8.00~svn3701/debian/patches/upstream-fix.patch --- boinc-app-seti-8.00~svn3363/debian/patches/upstream-fix.patch 2016-07-14 09:27:01.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/patches/upstream-fix.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -Description: cherry-pick little upstream fix for arm ---- boinc-app-seti-8.00~svn3363.orig/client/vector/analyzeFuncs_vfp_aux.cpp -+++ boinc-app-seti-8.00~svn3363/client/vector/analyzeFuncs_vfp_aux.cpp -@@ -47,6 +47,7 @@ - #include "diagnostics.h" - #include "asmlib.h" - #include "pulsefind.h" -+#include "fp_arm.h" - - - template diff -Nru boinc-app-seti-8.00~svn3363/debian/README.source boinc-app-seti-8.00~svn3701/debian/README.source --- boinc-app-seti-8.00~svn3363/debian/README.source 2014-08-30 18:15:09.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/README.source 2017-09-11 13:25:21.000000000 +0000 @@ -53,3 +53,8 @@ no-graphics one in boinc-app-seti. 3. Mark boinc-app-seti and boinc-app-seti-graphics as in conflict with each other. + +Patches: + + Please inspect debian/patches/README.patches and the first few descriptive + lines of each patch of interest. diff -Nru boinc-app-seti-8.00~svn3363/debian/rules boinc-app-seti-8.00~svn3701/debian/rules --- boinc-app-seti-8.00~svn3363/debian/rules 2016-05-16 09:54:10.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/debian/rules 2017-09-11 13:25:21.000000000 +0000 @@ -107,15 +107,10 @@ # Link-time optimisation demands knowledge about all CFLAGS both at # compile time (as represented by CFLAGS and CXXFLAGS) but also at # at link time. -#ifeq (,$(findstring nolto,$(DEB_BUILD_OPTIONS))) -# $(info I: Activating LinkTimeOptimisation) -# SETIEXTRAFLAGS += -flto -# LDFLAGS += -flto -# #CXX := $(CXX) $(CXXFLAGS) -# #CC := $(CC) $(CFLAGS) -# AR := gcc-ar -# RANLIB := gcc-ranlib -#endif +ifeq (,$(findstring nolto,$(DEB_BUILD_OPTIONS))) + $(info I: Activating LinkTimeOptimisation) + SETIEXTRAFLAGS += --enable-lto +endif # Although all source file are C++, some handwritten rules in # client/Makefile.am seem to use CFLAGS only. @@ -131,7 +126,7 @@ %: - dh $@ --parallel --with autoreconf + dh $@ CFGFLAGS = \ --disable-static-client \ @@ -197,7 +192,7 @@ cd $(origDir); \ EXP=/tmp/download-seti; \ nice="nice -5"; if [ -x /usr/bin/ionice ]; then nice="$$nice ionice -c 3"; fi ; \ - $$nice wget -O$$EXP "http://git.debian.org/?p=pkg-boinc/scripts.git;a=blob_plain;f=export-seti;hb=HEAD" --quiet && \ + $$nice wget -O$$EXP "https://anonscm.debian.org/cgit/pkg-boinc/scripts.git/plain/export-seti" --quiet && \ chmod +x $$EXP && $$EXP && rm -f $$EXP .PHONY: get-orig-source diff -Nru boinc-app-seti-8.00~svn3363/ops/bin/splitter_janitor_gbt boinc-app-seti-8.00~svn3701/ops/bin/splitter_janitor_gbt --- boinc-app-seti-8.00~svn3363/ops/bin/splitter_janitor_gbt 1970-01-01 00:00:00.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/ops/bin/splitter_janitor_gbt 2016-02-23 22:43:04.000000000 +0000 @@ -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 -Nru boinc-app-seti-8.00~svn3363/splitter_pfb/Makefile.am boinc-app-seti-8.00~svn3701/splitter_pfb/Makefile.am --- boinc-app-seti-8.00~svn3363/splitter_pfb/Makefile.am 2015-10-12 17:07:53.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/splitter_pfb/Makefile.am 2017-02-16 20:44:19.000000000 +0000 @@ -18,7 +18,7 @@ AM_CFLAGS= -g -O3 -Wall $(INCLUDE_DIRS) -DUSE_INFORMIX @PTHREAD_CFLAGS@ -ISETILIB_PATH/include -SYSLIBS = -lcrypto -ldl +SYSLIBS = -lcrypto -ldl -larmadillo BOINCLIBS= -L$(BOINCDIR)/sched -lsched @MYSQL_LIBS@ @PTHREAD_LIBS@ -L$(BOINCDIR)/lib -lboinc_crypt -lboinc -L$(SSLDIR) -lcrypto -lssl diff -Nru boinc-app-seti-8.00~svn3363/splitter_pfb/mb_dotransform.cpp boinc-app-seti-8.00~svn3701/splitter_pfb/mb_dotransform.cpp --- boinc-app-seti-8.00~svn3363/splitter_pfb/mb_dotransform.cpp 2016-01-26 20:44:27.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/splitter_pfb/mb_dotransform.cpp 2016-03-01 21:56:33.000000000 +0000 @@ -95,8 +95,8 @@ if (f<0) return 0; return static_cast(round(f)); case 8: - f*=(64.0/stddev); - if (f>127) return 127; + f*=(24.0/stddev); + if (f>127) return 128; if (f<-127) return -127; return static_cast(round(f)); default: diff -Nru boinc-app-seti-8.00~svn3363/splitter_pfb/mb_read_blocks_guppi.cpp boinc-app-seti-8.00~svn3701/splitter_pfb/mb_read_blocks_guppi.cpp --- boinc-app-seti-8.00~svn3363/splitter_pfb/mb_read_blocks_guppi.cpp 2016-01-15 20:43:33.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/splitter_pfb/mb_read_blocks_guppi.cpp 2017-02-07 23:07:14.000000000 +0000 @@ -74,8 +74,8 @@ 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) - double BW; // Bandwidth 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 @@ -94,7 +94,7 @@ unsigned long total_samples = 0; unsigned long limit_samples; -unsigned long last_num_samples_read; +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? @@ -156,6 +156,52 @@ ) { //------------------------------------------------------- + +#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); @@ -174,16 +220,6 @@ /* there is no "dataseq in guppi data. TODO - right? */ //this_tapebuffer.header.dataseq = 0; - - 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) - ) - ); - print_header(this_tapebuffer); } @@ -363,7 +399,16 @@ if(rawinput.gf.packetindex == control_block.curindx) { // file integrity check - are we at the correct index? Yes... - fseek(rawinput.fil, gethlength(header_buf), SEEK_CUR); // skip past header + 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) @@ -381,14 +426,14 @@ // 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_samples_read, total_samples); - last_num_samples_read = unpack_samples(rawinput.pf.sub.data + // start of raw data, ie channel 0 + // 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 samples from %ld bytes. Total samples : %ld\n", - last_num_samples_read, control_block.chanbytes, total_samples); + 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); @@ -465,7 +510,7 @@ 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_samples_read %ld chanbytes %ld\n", last_num_samples_read, control_block.chanbytes); + //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); } @@ -592,7 +637,9 @@ 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); } @@ -611,6 +658,17 @@ 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; @@ -619,7 +677,7 @@ long reent_total_samples = 0; - static unsigned long samples_left; + static unsigned long sample_bytes_left; static double start_data_time; static double end_data_time; static int filecnt; @@ -672,35 +730,35 @@ 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 - tapebuffer %d has %ld samples\n", buffer_i, tapebuffer[buffer_i].data.size()); + 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 - total_samples = %ld (%ld) in %ld tapebuffers\n", reent_total_samples, total_samples, tapebuffer.size()); + 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(samples_left) { - if(control_block.vflag>=1) fprintf(stderr, "first getting the %ld samples_left starting at location %p\n", - samples_left, rawinput.pf.sub.data + control_block.subint_offset + control_block.chanbytes - samples_left); - last_num_samples_read = unpack_samples(rawinput.pf.sub.data + control_block.subint_offset + control_block.chanbytes - samples_left, - samples_left, // samples left does not include overlap + 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(); - samples_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 2 tapebuffer %d has %ld samples\n", buffer_i, tapebuffer[buffer_i].data.size()); + 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()); } - fprintf(stderr, "re-entry 2 - 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 @@ -724,7 +782,7 @@ 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_samples_read; + 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++; @@ -732,33 +790,29 @@ } 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, "re-entry 3 - total_samples = %ld (%ld) in %ld tapebuffers\n", reent_total_samples, total_samples, tapebuffer.size()); } } 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 - samples_left = control_block.chanbytes - last_num_samples_read; // set up for next call + 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_samples_read, control_block.chanbytes, control_block.chanbytes-last_num_samples_read); + 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, "re-entry 4 tapebuffer %d has %ld samples\n", buffer_i, tapebuffer[buffer_i].data.size()); + fprintf(stderr, "finish tapebuffer %d has %ld samples\n", buffer_i, tapebuffer[buffer_i].data.size()); } - fprintf(stderr, "re-entry 4 - total_samples = %ld (%ld) in %ld tapebuffers\n", reent_total_samples, total_samples, tapebuffer.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"); @@ -803,13 +857,14 @@ // 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) { - // Note that we swap real/imag from the guppi ordering to get the order that the splitter expects. - // imag (2 bits of raw data) - sample.imag( (signed char)quantlookup[( raw[i] >> (pol_shift * 2) & 1) + // bit 0 or 4 + // 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 ); - // real (2 bits of raw data) - sample.real( (signed char)quantlookup[( raw[i] >> ((pol_shift+1) * 2) & 1) + // bit 2 or 6 + // 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 @@ -822,7 +877,8 @@ //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/stride; // == i in this case + return i; // return the number of bytes (not samples) read } @@ -838,15 +894,17 @@ std::complex sample; for(i=0; i < count && total_samples < limit_samples; i+=stride) { - // Note that we swap real/imag from the guppi ordering to get the order that the splitter expects. - sample.imag(raw[i+pol_shift]); - sample.real(raw[i+1+pol_shift]); + // 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/stride; + return i; // return the number of bytes (not samples) read } diff -Nru boinc-app-seti-8.00~svn3363/splitter_pfb/mb_splitter.cpp boinc-app-seti-8.00~svn3701/splitter_pfb/mb_splitter.cpp --- boinc-app-seti-8.00~svn3363/splitter_pfb/mb_splitter.cpp 2016-01-12 23:55:46.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/splitter_pfb/mb_splitter.cpp 2017-09-08 18:59:07.000000000 +0000 @@ -108,12 +108,14 @@ 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; @@ -163,9 +165,9 @@ 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 *channel, - int *raw_bit_depth, int *dumpsubband, int *dumpraw, - int *useanalysiscfgid, int *usereceivercfgid, + 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; @@ -222,7 +224,7 @@ char *fe=ep+1; memset(trigger_file_path,0,sizeof(trigger_file_path)); while (isgraph(*(fe++))) trigger_file_path[fe-ep-2]=*fe ; - } else if (!strncmp(argv[i],"-alfa",MAX(ep-argv[i],3))) { + } else if (!strncmp(argv[i],"-alfa",MAX(ep-argv[i],4))) { sscanf(ep+1,"%d,%d",beam,pol); if (((*beam<0) || (*beam>6)) || ((*pol<0) || (*pol>1))) { @@ -237,6 +239,13 @@ 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))) { @@ -283,7 +292,11 @@ 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", gbt); + 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); } @@ -581,25 +594,34 @@ int good_read; long num_blocks_read; int vflag; - int file_type = 0; // default to dr2 for now + 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,&channel,&raw_bit_depth,&dumpsubband, + &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] [-analysis_config=id] [-receiver_config=id]\n" - "[-recorder_config=id] [-splitter_config=id] [-dumpsubband=subband] [-dumpraw]\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; + 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); diff -Nru boinc-app-seti-8.00~svn3363/splitter_pfb/mb_wufiles.cpp boinc-app-seti-8.00~svn3701/splitter_pfb/mb_wufiles.cpp --- boinc-app-seti-8.00~svn3363/splitter_pfb/mb_wufiles.cpp 2016-01-22 01:29:27.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/splitter_pfb/mb_wufiles.cpp 2016-03-01 21:56:33.000000000 +0000 @@ -143,7 +143,7 @@ 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 < 1.2*wugrp.receiver_cfg->beam_width) { + if (wugrp.data_desc.true_angle_range < 2.4*wugrp.receiver_cfg->beam_width) { group_is_vlar=true; } else { group_is_vlar=false; diff -Nru boinc-app-seti-8.00~svn3363/validate/Makefile.in boinc-app-seti-8.00~svn3701/validate/Makefile.in --- boinc-app-seti-8.00~svn3363/validate/Makefile.in 2008-06-17 22:38:07.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/validate/Makefile.in 2017-02-16 20:53:41.000000000 +0000 @@ -32,6 +32,7 @@ INFORMIXDIR = @INFORMIXDIR@ INFORMIX_CFLAGS = @INFORMIX_CFLAGS@ INFORMIX_LIBS = @INFORMIX_LIBS@ +SYSLIBS = -larmadillo OBJS = \ sah_validate.$(OBJEXT) \ @@ -60,7 +61,7 @@ (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) + $(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 diff -Nru boinc-app-seti-8.00~svn3363/validate/sah_validate.cpp boinc-app-seti-8.00~svn3701/validate/sah_validate.cpp --- boinc-app-seti-8.00~svn3363/validate/sah_validate.cpp 2016-01-19 21:21:59.000000000 +0000 +++ boinc-app-seti-8.00~svn3701/validate/sah_validate.cpp 2017-02-16 20:53:41.000000000 +0000 @@ -45,6 +45,13 @@ 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