MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / load_schedule

Method load_schedule

Processor/BaseMachine.cpp:126–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126void BaseMachine::load_schedule(const string& progname, bool load_bytecode)
127{
128 this->progname = progname;
129 string fname = "Programs/Schedules/" + progname + ".sch";
130#ifdef DEBUG_FILES
131 cerr << "Opening file " << fname << endl;
132#endif
133 ifstream inpf;
134 inpf.open(fname);
135 if (inpf.fail()) { throw file_error("Missing '" + fname + "'. Did you compile '" + progname + "'?"); }
136
137 int nprogs;
138 inpf >> nthreads;
139 inpf >> nprogs;
140
141 if (inpf.fail())
142 throw file_error("Error reading " + fname);
143
144#ifdef DEBUG_FILES
145 cerr << "Number of threads I will run in parallel = " << nthreads << endl;
146 cerr << "Number of program sequences I need to load = " << nprogs << endl;
147#endif
148
149 bc_filenames.clear();
150
151 // Load in the programs
152 string threadname;
153 for (int i=0; i<nprogs; i++)
154 { inpf >> threadname;
155 size_t split = threadname.find_last_of(":");
156 long expected = -1;
157 if (split != string::npos)
158 {
159 expected = atoi(threadname.substr(split + 1).c_str());
160 threadname = threadname.substr(0, split);
161 }
162
163 string filename = "Programs/Bytecode/" + threadname + ".bc";
164 bc_filenames.push_back(filename);
165 if (load_bytecode)
166 {
167#ifdef DEBUG_FILES
168 cerr << "Loading program " << i << " from " << filename << endl;
169#endif
170 long size = load_program(threadname, filename);
171 if (expected >= 0 and expected != size)
172 {
173 stringstream os;
174 os << "broken bytecode file, found " << size
175 << " instructions, expected " << expected;
176 throw runtime_error(os.str());
177 }
178 }
179
180 }
181
182 for (auto i : {1, 0, 0})
183 {

Callers 1

get_basicsMethod · 0.45

Calls 9

file_errorClass · 0.85
runtime_errorFunction · 0.85
closeMethod · 0.80
openMethod · 0.45
failMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45
strMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected