MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / evalMultiple

Function evalMultiple

src/backend/opencl/Array.cpp:252–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250
251template<typename T>
252void evalMultiple(vector<Array<T> *> arrays) {
253 vector<Param> outputs;
254 vector<Array<T> *> output_arrays;
255 vector<Node *> nodes;
256
257 // Check if all the arrays have the same dimension
258 auto it = std::adjacent_find(begin(arrays), end(arrays),
259 [](const Array<T> *l, const Array<T> *r) {
260 return l->dims() != r->dims();
261 });
262
263 // If they are not the same. eval individually
264 if (it != end(arrays)) {
265 for (auto ptr : arrays) { ptr->eval(); }
266 return;
267 }
268
269 for (Array<T> *array : arrays) {
270 if (array->isReady()) { continue; }
271
272 const ArrayInfo info = array->info;
273
274 array->setId(getActiveDeviceId());
275 array->data = std::shared_ptr<cl::Buffer>(
276 memAlloc<T>(info.elements()).release(), bufferFree);
277
278 // Do not replace this with cast operator
279 KParam kInfo = {
280 {info.dims()[0], info.dims()[1], info.dims()[2], info.dims()[3]},
281 {info.strides()[0], info.strides()[1], info.strides()[2],
282 info.strides()[3]},
283 0};
284
285 outputs.emplace_back(array->data.get(), kInfo);
286 output_arrays.push_back(array);
287 nodes.push_back(array->getNode().get());
288 }
289
290 evalNodes(outputs, nodes);
291
292 for (Array<T> *array : output_arrays) { array->node.reset(); }
293}
294
295template<typename T>
296Node_ptr Array<T>::getNode() {

Callers

nothing calls this directly

Calls 13

beginFunction · 0.85
endFunction · 0.85
resetMethod · 0.80
getActiveDeviceIdFunction · 0.70
evalNodesFunction · 0.70
dimsMethod · 0.45
evalMethod · 0.45
isReadyMethod · 0.45
setIdMethod · 0.45
elementsMethod · 0.45
stridesMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected