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

Function calcPackedSize

src/backend/opencl/fftconvolve.cpp:32–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31template<typename T>
32dim4 calcPackedSize(Array<T> const& i1, Array<T> const& i2, const dim_t rank) {
33 const dim4& i1d = i1.dims();
34 const dim4& i2d = i2.dims();
35
36 dim_t pd[4] = {1, 1, 1, 1};
37
38 // Pack both signal and filter on same memory array, this will ensure
39 // better use of batched cuFFT capabilities
40 pd[0] = nextpow2(static_cast<unsigned>(
41 static_cast<int>(ceil(i1d[0] / 2.f)) + i2d[0] - 1));
42
43 for (dim_t k = 1; k < rank; k++) {
44 pd[k] = nextpow2(static_cast<unsigned>(i1d[k] + i2d[k] - 1));
45 }
46
47 dim_t i1batch = 1;
48 dim_t i2batch = 1;
49 for (int k = rank; k < 4; k++) {
50 i1batch *= i1d[k];
51 i2batch *= i2d[k];
52 }
53 pd[rank] = (i1batch + i2batch);
54
55 return dim4(pd[0], pd[1], pd[2], pd[3]);
56}
57
58template<typename T>
59Array<T> fftconvolve(Array<T> const& signal, Array<T> const& filter,

Callers

nothing calls this directly

Calls 4

nextpow2Function · 0.85
ceilFunction · 0.85
dim4Class · 0.50
dimsMethod · 0.45

Tested by

no test coverage detected