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

Function mean_first

src/backend/cuda/kernel/mean.hpp:386–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384
385template<typename Ti, typename Tw, typename To>
386void mean_first(Param<To> out, CParam<Ti> in, CParam<Tw> iwt) {
387 uint threads_x = nextpow2(std::max(32u, (uint)in.dims[0]));
388 threads_x = std::min(threads_x, THREADS_PER_BLOCK);
389 uint threads_y = THREADS_PER_BLOCK / threads_x;
390
391 uint blocks_x = divup(in.dims[0], threads_x * REPEAT);
392 uint blocks_y = divup(in.dims[1], threads_y);
393
394 Array<To> tmpOut = createEmptyArray<To>(dim4());
395 Array<Tw> tmpWt = createEmptyArray<Tw>(dim4());
396 if (blocks_x > 1) {
397 tmpOut = createEmptyArray<To>(
398 {blocks_x, in.dims[1], in.dims[2], in.dims[3]});
399 tmpWt = createEmptyArray<Tw>(
400 {blocks_x, in.dims[1], in.dims[2], in.dims[3]});
401 } else {
402 tmpOut = createParamArray(out, false);
403 }
404
405 mean_first_launcher<Ti, Tw, To>(tmpOut, tmpWt, in, iwt, blocks_x, blocks_y,
406 threads_x);
407
408 if (blocks_x > 1) {
409 Param<Tw> owt;
410 owt.ptr = NULL;
411 mean_first_launcher<To, Tw, To>(out, owt, tmpOut, tmpWt, 1, blocks_y,
412 threads_x);
413 }
414}
415
416template<typename Ti, typename Tw, typename To>
417void mean_weighted(Param<To> out, CParam<Ti> in, CParam<Tw> iwt, int dim) {

Callers

nothing calls this directly

Calls 5

nextpow2Function · 0.85
maxFunction · 0.50
minFunction · 0.50
dim4Class · 0.50
createParamArrayFunction · 0.50

Tested by

no test coverage detected