CS代写 // *********************************************************************

// *********************************************************************
// [NAME]: [STUDENT ID]:
// [EMAIL]:
// NOTICE: Write your code only in the specified section.

Copyright By PowCoder代写 加微信 powcoder

// *********************************************************************
// 7 MAR (update2.1), 28 FEB (update1): UPDATES IN read2supermers(…)
#define _in_
#define _out_
#define _MPI_TEST_
// #define DEBUG
#include
#include
#include
#include
#include
#include
#include
#include “utilities.hpp”
#ifdef _MPI_TEST_
#include “mpi.h”
using namespace std;

// void read2supermers(const char* _read, int read_len, int k, int p, _out_ char* &supermers, _out_ /**/int* &supermer_offs, int &n_supermers);
void read2supermers(const char* _read, int read_len, int k, int p, _out_ vector &supermers);

const int MAX_PROCESS = 64;

int main(int argc, char **argvs) {
#ifdef _MPI_TEST_
MPI_Init(&argc, &argvs);
MPI_Comm comm;
int num_process; // number of processors
int my_rank; // my global rank
comm = MPI_COMM_WORLD;
MPI_Comm_size(comm, &num_process);
MPI_Comm_rank(comm, &my_rank);

int correctness_checking = 0;
string output_path;
string read_file_path;
ArgParser(argc, argvs, K, P, read_file_path, correctness_checking, output_path);
vector reads;

// Input data (the reads in CSR format)
int num_of_reads = 0;
char* reads_CSR;
/**/int* reads_CSR_offs;

// Output data, each supermers should be a string in the vector
// you need to save all the supermers to the vector below in the root(0) process
vector all_supermers;

#ifdef _MPI_TEST_
if (my_rank == 0) {
cout<<"MPI running with "<(end_time – start_time).count()/1000.0;
cout << "Your algorithm finished in " << duration_sec << " sec." << endl << endl; // output to text file and correctness checking delete reads_CSR; delete reads_CSR_offs; if (correctness_checking) CorrectnessChecking(reads, K, P, all_supermers); if (!output_path.empty()) { if (!correctness_checking) sort(all_supermers.begin(), all_supermers.end()); SaveSupermers(output_path, all_supermers); #ifdef _MPI_TEST_ MPI_Barrier(comm); // cout<<"Thread "<.
void read2supermers(const char* _read, int read_len, int k, int p, _out_ vector &supermers) {
string prev_minimizer, minimizer, new_minimizer;
string read(_read, read_len); // from-buffer init
char base;
int skm_begin_pos, skm_end_pos, mm_begin_pos;

// Generate the first k-mer’s minimizer:
skm_begin_pos = 0;
skm_end_pos = k;
mm_begin_pos = 0;
minimizer = new_minimizer = read.substr(0, p);
for (i=p; i mm_begin_pos) {
// new minimizer required
prev_minimizer = minimizer;
minimizer = new_minimizer = read.substr(i, p);
for (j=i+p; jCS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com