static inline void enqueueStandardSplittingJob(JobQueue& jobQueue, const LcpCacheStringPtr* inputs, unsigned numInputs, string* output, size_t jobLength) { if (numInputs == 1) jobQueue.enqueue(new CopyDataJob(inputs[0], output)); else if (numInputs <= 2) jobQueue.enqueue(new BinaryMergeJob(inputs[0], inputs[1], 0, output)); else if (numInputs <= 4) jobQueue.enqueue(new MergeJobStandardSplitting<4>(inputs, numInputs, output, jobLength)); else if (numInputs <= 8) jobQueue.enqueue(new MergeJobStandardSplitting<8>(inputs, numInputs, output, jobLength)); else if (numInputs <= 16) jobQueue.enqueue(new MergeJobStandardSplitting<16>(inputs, numInputs, output, jobLength)); else if (numInputs <= 32) jobQueue.enqueue(new MergeJobStandardSplitting<32>(inputs, numInputs, output, jobLength)); else if (numInputs <= 64) jobQueue.enqueue(new MergeJobStandardSplitting<64>(inputs, numInputs, output, jobLength)); else { DBG(1, "Can't create job with that many streams. Add more cases."); abort(); } }
static inline void parallelLcpMergeStandardSplitting(const LcpCacheStringPtr* input, unsigned numInputs, string* output, size_t length) { g_outputBase = output; g_splittingsExecuted = 0; g_mergeJobsCreated = 0; g_splittingTime = 0; ClockTimer timer; timer.start(); g_outputBase = output; JobQueue jobQueue; DBG(debug_merge_start_message, "doing parallel lcp merge for " << numInputs << " input streams using " << omp_get_max_threads() << " threads with standard splitting"); jobQueue.enqueue(new InitialJobStandardSplitting(input, numInputs, output, length)); jobQueue.numaLoop(-1, omp_get_max_threads()); g_stats >> "toplevelmerge_time" << timer.elapsed(); g_stats >> "splittings_executed" << g_splittingsExecuted; g_stats >> "mergejobs_created" << g_mergeJobsCreated; g_stats >> "splitting_time" << g_splittingTime; }