File: SeedingData.h

package info (click to toggle)
ray 2.3.1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,008 kB
  • sloc: cpp: 49,973; sh: 339; makefile: 281; python: 168
file content (187 lines) | stat: -rw-r--r-- 5,348 bytes parent folder | download | duplicates (5)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
 	Ray
    Copyright (C) 2010, 2011, 2012 Sébastien Boisvert

	http://DeNovoAssembler.SourceForge.Net/

    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, version 3 of the License.

    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 have received a copy of the GNU General Public License
    along with this program (gpl-3.0.txt).  
	see <http://www.gnu.org/licenses/>

*/

#ifndef _SeedingData
#define _SeedingData

class SeedExtender;

#include "SeedWorker.h"

#include <code/KmerAcademyBuilder/Kmer.h>
#include <code/SeedExtender/SeedExtender.h>
#include <code/SeedingData/GraphPath.h>
#include <code/VerticesExtractor/GridTableIterator.h>
#include <code/VerticesExtractor/Vertex.h>
#include <code/Mock/common_functions.h>

#include <RayPlatform/communication/VirtualCommunicator.h>
#include <RayPlatform/structures/SplayTreeIterator.h>
#include <RayPlatform/structures/SplayNode.h>
#include <RayPlatform/core/ComputeCore.h>

#include <set>
using namespace std;

__DeclarePlugin(SeedingData);

__DeclareSlaveModeAdapter(SeedingData,RAY_SLAVE_MODE_START_SEEDING);
__DeclareSlaveModeAdapter(SeedingData,RAY_SLAVE_MODE_SEND_SEED_LENGTHS);

/*
 * Computes seeds in the k-mer graph.
 * The computation is not done actually by
 * this class. It is a pool of workers that does the job.
 * These workers push messages on the virtual
 * communicator and the later groups messages.
 * \author Sébastien Boisvert
 */
class SeedingData : public CorePlugin{

	__AddAdapter(SeedingData,RAY_SLAVE_MODE_START_SEEDING);
	__AddAdapter(SeedingData,RAY_SLAVE_MODE_SEND_SEED_LENGTHS);

/**
 * the minimum seed coverage allowed
 */
	
	CoverageDepth m_minimumSeedCoverageDepth;

	MessageTag RAY_MPI_TAG_IS_DONE_SENDING_SEED_LENGTHS;
	MessageTag RAY_MPI_TAG_SEEDING_IS_OVER;
	MessageTag RAY_MPI_TAG_SEND_SEED_LENGTHS;
	MessageTag RAY_MPI_TAG_SEND_SEED_LENGTHS_REPLY;

	MessageTag RAY_MPI_TAG_GET_VERTEX_EDGES_COMPACT;
	MessageTag RAY_MPI_TAG_REQUEST_VERTEX_COVERAGE;

	SlaveMode RAY_SLAVE_MODE_DO_NOTHING;
	SlaveMode RAY_SLAVE_MODE_START_SEEDING;
	SlaveMode RAY_SLAVE_MODE_SEND_SEED_LENGTHS;

/*
 * Some counters for sorting objects.
 */

	int m_skippedObjectsWithDeadEndForHead;
	int m_skippedObjectsWithDeadEndForTail;
	int m_skippedObjectsWithTwoDeadEnds;
	int m_skippedObjectsWithBubbleWeakComponent;

	int m_skippedNotMine;
	int m_skippedTooShort;
	int m_skippedNotEnoughCoverage;

	int m_eligiblePaths;

	bool m_debugSeeds;

	/** checkpointing */
	bool m_checkedCheckpoint;

	map<int,int>::iterator m_iterator;

	bool m_flushAllMode;
	VirtualCommunicator*m_virtualCommunicator;
	bool m_initiatedIterator;
	Rank m_rank;
	int m_size;
	RingAllocator*m_outboxAllocator;
	StaticVector*m_outbox;
	StaticVector*m_inbox;
	int*m_seedCoverage;
	int*m_mode;
	set<WorkerHandle> m_activeWorkers;
	set<WorkerHandle>::iterator m_activeWorkerIterator;
	map<WorkerHandle,SeedWorker> m_aliveWorkers;
	bool m_communicatorWasTriggered;
	vector<WorkerHandle> m_workersDone;
	vector<WorkerHandle> m_waitingWorkers;
	vector<WorkerHandle> m_activeWorkersToRestore;
	Parameters*m_parameters;
	GridTable*m_subgraph;
	GridTableIterator m_splayTreeIterator;
	int m_wordSize;
	int m_completedJobs;
	int m_maximumAliveWorkers;
	int m_maximumWorkers;
	time_t m_last;

	void loadCheckpoint();

	void writeCheckpoints();
public:

	// TODO: move these attributes in the private zone
	map<int,int> m_masterSeedLengths;
	map<int,int> m_slaveSeedLengths;

	bool m_SEEDING_edgesRequested;
	int m_SEEDING_ingoingEdgeIndex;
	vector<Kmer> m_SEEDING_receivedOutgoingEdges;
	Kmer m_SEEDING_currentVertex;
	int m_SEEDING_receivedVertexCoverage;
	vector<Kmer> m_SEEDING_receivedIngoingEdges;
	bool m_SEEDING_InedgesReceived;
	int m_SEEDING_outgoingEdgeIndex;
	bool m_SEEDING_vertexCoverageRequested;
	bool m_SEEDING_vertexCoverageReceived;
	SplayTreeIterator<uint64_t,Vertex>*m_SEEDING_iterator;
	SplayNode<Kmer,Vertex>*m_SEEDING_node;
	uint64_t m_SEEDING_receivedKey;
	bool m_SEEDING_vertexKeyAndCoverageReceived;
	int m_SEEDING_currentChildRank;
	bool m_SEEDING_edge_initiated;
	bool m_SEEDING_NodeInitiated;
	bool m_SEEDING_passedCoverageTest;
	bool m_SEEDING_passedParentsTest;
	bool m_SEEDING_Extended;
	bool m_SEEDING_edgesReceived;
	LargeIndex m_SEEDING_i;

	int m_SEEDING_outgoing_index;
	bool m_SEEDING_outgoing_choice_done;
	int m_SEEDING_currentRank;
	vector<GraphPath> m_SEEDING_seeds;
	vector<int> m_SEEDING_outgoingCoverages;
	vector<uint64_t> m_SEEDING_outgoingKeys;
	bool m_SEEDING_vertexKeyAndCoverageRequested;
	int m_SEEDING_currentParentRank;
	
	SeedExtender*m_seedExtender;
	int getRank();
	int getSize();
	void call_RAY_SLAVE_MODE_START_SEEDING();

	void constructor(SeedExtender*seedExtender,int rank,int size,StaticVector*outbox,RingAllocator*outboxAllocator,
		int*mode,Parameters*parameters,GridTable*subgraph,
		StaticVector*inbox,VirtualCommunicator*vc);
	void updateStates();

	void call_RAY_SLAVE_MODE_SEND_SEED_LENGTHS();

	bool m_initialized;

	void registerPlugin(ComputeCore*core);
	void resolveSymbols(ComputeCore*core);
};

#endif