forked from aquaskyline/MICA-aligner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCPUControllerThread.h
132 lines (110 loc) · 4.25 KB
/
CPUControllerThread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//
// CPUControllerThread.h
//
// mica
//
// Copyright (C) 2013, HKU
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
///////////////////////////////////////////////////////////////////////////////////////////////
#ifndef __CPUCONTROLLERTHREAD_H__
#define __CPUCONTROLLERTHREAD_H__
///////////////////////////////////////
// Including Standard Libraries
///////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <time.h>
#include <omp.h>
///////////////////////////////////////
// Including 2BWT Libraries
///////////////////////////////////////
#include "2bwt-flex/2bwt-lib/iniparser.h"
#include "2bwt-flex/2bwt-lib/2BWT-Interface.h"
#include "2bwt-flex/2bwt-lib/Timing.h"
#include "2bwt-flex/utilities/Logging.h"
///////////////////////////////////////
// Including SOAP2-DP Libraries
///////////////////////////////////////
#include "2bwt-flex/2BWT-PEAlgnmt.h"
#include "2bwt-flex/2BWT-SRAAlgnmt.h"
#include "2bwt-flex/SRAQueryParser.h"
///////////////////////////////////////
// Including MIC Libraries
///////////////////////////////////////
#include "MIC-SRA2BWTMdl.h"
#include "MIC-SRAAlgnmt.h"
#include "MIC-PEAlgnmt.h"
#include "MIC-DPAlgnmt.h"
#include "MICA-PE-ReadThread.h"
#include "MICA-PE-WriteThread.h"
#include "MemMan.h"
#define CPU_CONTROL_WRITE_THREAD_BUFFER_COUNT 1
#define CPU_CONTROL_HEALTH_STRING_MAX_LENGTH 20
// -----------------------------
// Compile-time Configurable #1
// Ticket#70 [MICA] An infrastructure change for the health checking of multi-threading processes
// -----------------------------
// Enable the core health checker to poll
// multiple component and get health status on stdout.
//#define MICA_PE_ENABLE_HEALTH_CHECK
// -----------------------------
// Compile-time Configurable #2
// -----------------------------
// Limit CPU Controller to process only a certain number of batches
#define CPU_CONTROL_MAX_BATCH 1
typedef struct CPUControllerThread {
uint8_t threadId;
char * charMap;
// SRA Settings
int alignmentModel;
SRAArguments * cpuSraArgTemplate;
// PE Settings
PEArguments * cpuPeArgTemplate;
// CPU Thread Settings
unsigned int cpuMaxBatchSize;
int numOfMICThreads;
// Read Thread
PEReadThread * peReadThread;
// Write Thread
PEWriteThread * writeThread;
// Thread
pthread_t * t;
// Health string
char healthString[CPU_CONTROL_HEALTH_STRING_MAX_LENGTH];
char consolidHealth[CPU_CONTROL_HEALTH_STRING_MAX_LENGTH+MICA_PE_WRITE_HEALTH_STRING_MAX_LENGTH];
// Statistics
double statsTotalAlignmentTime;
double statsTotalReadLoadTime;
double statsTotalModelBuildTime;
double statsTotalWaitTime;
unsigned long long statsQueryHandled;
} CPUControllerThread;
CPUControllerThread * CPUCTCreate(uint8_t threadId, char * charMap,
unsigned int batchSize);
void CPUCTSetSRA(CPUControllerThread * thread, int alignmentModel, SRAArguments * cpuSraArgTemplate);
void CPUCTSetPE(CPUControllerThread * thread, PEArguments * cpuPeArgTemplate);
void CPUCTSetReadThread(CPUControllerThread * thread, PEReadThread * peReadThread);
void CPUCTSetWriteThread(CPUControllerThread * thread, PEWriteThread * peWriteThread);
void CPUCTStart(CPUControllerThread * thread);
void CPUCTJoin(CPUControllerThread * thread);
void CPUCTFree(CPUControllerThread * thread);
void CPUCTPollHealthString(CPUControllerThread * thread);
char * CPUCTGetHealthText(CPUControllerThread * thread);
#endif