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

Function main

examples/getting_started/convolve.cpp:36–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36int main(int argc, char **argv) {
37 try {
38 int device = argc > 1 ? atoi(argv[1]) : 0;
39 af::setDevice(device);
40 af::info();
41
42 // setup image and device copies of kernels
43 img = randu(640, 480);
44 dx = array(5, 1, h_dx); // 5x1 kernel
45 spread = array(1, 5, h_spread); // 1x5 kernel
46 kernel = matmul(dx, spread); // 5x5 kernel
47
48 printf("full 2D convolution: %.5f seconds\n", timeit(full));
49 printf("separable, device pointers: %.5f seconds\n", timeit(dsep));
50
51 // ensure values are all the same across versions
52 if (fail(full_out, dsep_out)) { throw af::exception("full != dsep"); }
53 } catch (af::exception &e) { fprintf(stderr, "%s\n", e.what()); }
54
55 return 0;
56}

Callers

nothing calls this directly

Calls 7

infoFunction · 0.85
randuFunction · 0.85
timeitFunction · 0.85
failFunction · 0.85
setDeviceFunction · 0.50
arrayClass · 0.50
matmulFunction · 0.50

Tested by

no test coverage detected