-
Notifications
You must be signed in to change notification settings - Fork 2
/
RNNMaster.h
executable file
·39 lines (31 loc) · 1.01 KB
/
RNNMaster.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
#pragma once
#include "Parameters.h"
#include "RNN.h"
class RNNMaster
{
public:
Parameters *parameters;
//put frequently used variables here
int batchNum;
string rnnModelFile;
string trainFile;
int* wordCounts;
RNNMaster(Parameters ¶meters);
~RNNMaster() {
/*if(parameters != NULL) {
free(parameters);
}*/
if(wordCounts != NULL) {
free(wordCounts);
}
}
void partitionAndDispatch(Vocab *vocab, int iteration, bool use_hpc, FILE *logger);
void saveMasterRNNModel(RNN &model);
void dispatchSlaveTrain(int iteration, int batchId, bool use_hpc, FILE* logger);
bool finisedSlaveRnnsTrain(int iteration);
RNN* averageRnnModels(RNN &preAveModel, FILE* logger, double tolerance, bool master_para_adapt, double learningRate, double beta);
static void master(string paraFile);
static void slave(string rnnFile, string batchTrainFile, int batchWordCount, string batchRnnFile);
static void masterTemp(string paraFile);
static void masterTemp2(string paraFile);
};