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

Function csrCalcOutNNZ

src/backend/opencl/kernel/sparse_arith.hpp:135–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135static void csrCalcOutNNZ(Param outRowIdx, unsigned &nnzC, const uint M,
136 const uint N, uint nnzA, const Param lrowIdx,
137 const Param lcolIdx, uint nnzB, const Param rrowIdx,
138 const Param rcolIdx) {
139 UNUSED(N);
140 UNUSED(nnzA);
141 UNUSED(nnzB);
142
143 std::vector<TemplateArg> tmpltArgs = {
144 TemplateTypename<uint>(),
145 };
146
147 auto calcNNZ = common::getKernel(
148 "csr_calc_out_nnz", {{ssarith_calc_out_nnz_cl_src}}, tmpltArgs, {});
149
150 cl::NDRange local(256, 1);
151 cl::NDRange global(divup(M, local[0]) * local[0], 1, 1);
152
153 nnzC = 0;
154 auto out = memAlloc<unsigned>(1);
155 getQueue().enqueueFillBuffer(*out, nnzC, 0, sizeof(unsigned));
156
157 calcNNZ(cl::EnqueueArgs(getQueue(), global, local), *out, *outRowIdx.data,
158 M, *lrowIdx.data, *lcolIdx.data, *rrowIdx.data, *rcolIdx.data,
159 cl::Local(local[0] * sizeof(unsigned int)));
160 getQueue().enqueueReadBuffer(*out, CL_TRUE, 0, sizeof(unsigned), &nnzC);
161 CL_DEBUG_FINISH(getQueue());
162}
163
164template<typename T, af_op_t op>
165void ssArithCSR(Param oVals, Param oColIdx, const Param oRowIdx, const uint M,

Callers 1

arithOpFunction · 0.50

Calls 3

EnqueueArgsClass · 0.85
getKernelFunction · 0.50
getQueueFunction · 0.50

Tested by

no test coverage detected