#include "LoadTimeInitializer.h" #include "utils.h" using namespace std; char* LoadTimeInitializerStatsNames[] = { "num_regions", "num_reads", "num_haplotypes", "num_testcases", "num_double_invocations", "haplotype_length", "readlength", "product_read_length_haplotype_length", "dummy" }; LoadTimeInitializer g_load_time_initializer; LoadTimeInitializer::LoadTimeInitializer() //will be called when library is loaded { ConvertChar::init(); #ifndef DISABLE_FTZ //Very important to get good performance on Intel processors //Function: enabling FTZ converts denormals to 0 in hardware //Denormals cause microcode to insert uops into the core causing big slowdown _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); cout << "FTZ enabled - may decrease accuracy if denormal numbers encountered\n"; #else cout << "FTZ is not set - may slow down performance if denormal numbers encountered\n"; #endif //Profiling: times for compute and transfer (either bytes copied or pointers copied) m_compute_time = 0; m_data_transfer_time = 0; m_bytes_copied = 0; //Initialize profiling counters for(unsigned i=0;i C++) "<::iterator mI = m_filename_to_fptr.find(filename); ofstream* fptr = 0; if(mI == m_filename_to_fptr.end()) { m_filename_to_fptr[filename] = new ofstream(); fptr = m_filename_to_fptr[filename]; //File never seen before if(m_written_files_set.find(filename) == m_written_files_set.end()) { to_append = false; m_written_files_set.insert(filename); } fptr->open(filename.c_str(), to_append ? ios::app : ios::out); assert(fptr->is_open()); } else fptr = (*mI).second; //ofstream fptr; //fptr.open(filename.c_str(), to_append ? ofstream::app : ofstream::out); (*fptr) << s; if(add_newline) (*fptr) << "\n"; //fptr.close(); } void LoadTimeInitializer::debug_close() { for(map::iterator mB = m_filename_to_fptr.begin(), mE = m_filename_to_fptr.end(); mB != mE;mB++) { (*mB).second->close(); delete (*mB).second; } m_filename_to_fptr.clear(); } void LoadTimeInitializer::dump_sandbox(testcase& tc, unsigned tc_idx, unsigned numReads, unsigned numHaplotypes) { unsigned haplotypeLength = tc.haplen; unsigned readLength = tc.rslen; ofstream& dumpFptr = m_sandbox_fptr; for(unsigned k=0;k