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

Function evalMultiple

src/backend/oneapi/Array.cpp:245–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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