Skip to content

Commit 7e0eb5f

Browse files
committed
make example run again
1 parent 41c1400 commit 7e0eb5f

File tree

1 file changed

+6
-54
lines changed

1 file changed

+6
-54
lines changed

examples/mandelbrot.cpp

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ namespace scalar {
231231

232232

233233

234+
// run simd version of mandelbrot benchmark for a specific arch
234235
template<class arch, class bencher_t>
235236
void run_arch(
236237
bencher_t & bencher,
@@ -248,7 +249,6 @@ void run_arch(
248249
xsimd::mandelbrot<arch>(x0, y0, x1, y1, width, height, maxIters, buffer.data());
249250
});
250251

251-
252252
const float scalar_min = stats.min().count();
253253

254254
std::cout << '\n' << typeid(arch).name() <<" "<< stats << '\n';
@@ -258,10 +258,12 @@ void run_arch(
258258
}
259259

260260
template<class T>
261-
struct RunMandelbrot;
261+
struct run_archlist;
262262

263+
// run simd version of mandelbrot benchmark for a list
264+
// of archs
263265
template<class ... Arch>
264-
struct RunMandelbrot<xsimd::arch_list<Arch ...>>
266+
struct run_archlist<xsimd::arch_list<Arch ...>>
265267
{
266268
template<class bencher_t>
267269
static void run(
@@ -327,57 +329,7 @@ int main()
327329

328330
writePPM("mandelbrot_omp.ppm", width, height, buf.data());
329331

330-
331-
332-
RunMandelbrot<xsimd::supported_architectures>::run(bencher, x0, y0, x1, y1, width, height, maxIters, buf);
333-
334-
335-
336-
337-
338-
// xsimd_1 run //////////////////////////////////////////////////////////////
339-
340-
std::fill(buf.begin(), buf.end(), 0);
341-
342-
auto stats_1 = bencher([&]() {
343-
xsimd::mandelbrot<xsimd::avx>(x0, y0, x1, y1, width, height, maxIters, buf.data());
344-
});
345-
346-
const float xsimd1_min = stats_1.min().count();
347-
348-
std::cout << '\n' << "xsimd_1 " << stats_1 << '\n';
349-
350-
writePPM("mandelbrot_xsimd1.ppm", width, height, buf.data());
351-
352-
// xsimd_4 run //////////////////////////////////////////////////////////////
353-
354-
std::fill(buf.begin(), buf.end(), 0);
355-
356-
auto stats_4 = bencher([&]() {
357-
xsimd::mandelbrot<xsimd::avx>(x0, y0, x1, y1, width, height, maxIters, buf.data());
358-
});
359-
360-
const float xsimd4_min = stats_4.min().count();
361-
362-
std::cout << '\n' << "xsimd_4 " << stats_4 << '\n';
363-
364-
writePPM("mandelbrot_xsimd4.ppm", width, height, buf.data());
365-
366-
// xsimd_8 run //////////////////////////////////////////////////////////////
367-
368-
std::fill(buf.begin(), buf.end(), 0);
369-
370-
auto stats_8 = bencher([&]() {
371-
xsimd::mandelbrot<xsimd::avx>(x0, y0, x1, y1, width, height, maxIters, buf.data());
372-
});
373-
374-
const float xsimd8_min = stats_8.min().count();
375-
376-
std::cout << '\n' << "xsimd_8 " << stats_8 << '\n';
377-
378-
writePPM("mandelbrot_xsimd8.ppm", width, height, buf.data());
379-
380-
332+
run_archlist<xsimd::supported_architectures>::run(bencher, x0, y0, x1, y1, width, height, maxIters, buf);
381333

382334
return 0;
383335
}

0 commit comments

Comments
 (0)