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

Function evalMultiple

src/backend/cuda/Array.cpp:202–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200
201template<typename T>
202void evalMultiple(std::vector<Array<T> *> arrays) {
203 vector<Param<T>> output_params;
204 vector<Array<T> *> output_arrays;
205 vector<Node *> nodes;
206
207 // Check if all the arrays have the same dimension
208 auto it = std::adjacent_find(begin(arrays), end(arrays),
209 [](const Array<T> *l, const Array<T> *r) {
210 return l->dims() != r->dims();
211 });
212
213 // If they are not the same. eval individually
214 if (it != end(arrays)) {
215 for (auto ptr : arrays) { ptr->eval(); }
216 return;
217 }
218
219 for (Array<T> *array : arrays) {
220 if (array->isReady()) { continue; }
221
222 array->setId(getActiveDeviceId());
223 array->data =
224 shared_ptr<T>(memAlloc<T>(array->elements()).release(), memFree);
225
226 output_params.emplace_back(array->getData().get(), array->dims().get(),
227 array->strides().get());
228 output_arrays.push_back(array);
229 nodes.push_back(array->getNode().get());
230 }
231
232 if (output_params.empty()) return;
233
234 evalNodes(output_params, nodes);
235
236 for (Array<T> *array : output_arrays) { array->node.reset(); }
237}
238
239template<typename T>
240Node_ptr Array<T>::getNode() {

Callers

nothing calls this directly

Calls 14

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
getMethod · 0.45
getDataMethod · 0.45

Tested by

no test coverage detected