From 2b481093b02b76d49ac567aecc1a5fcc63bb6826 Mon Sep 17 00:00:00 2001 From: Sandipan Mohanty <s.mohanty@fz-juelich.de> Date: Fri, 10 Jun 2022 14:32:30 +0200 Subject: [PATCH] Use thrust counting iterator in mandelbrot1.cc --- day4/examples/mandelbrot1.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/day4/examples/mandelbrot1.cc b/day4/examples/mandelbrot1.cc index 03e5e18..81e9087 100644 --- a/day4/examples/mandelbrot1.cc +++ b/day4/examples/mandelbrot1.cc @@ -1,4 +1,4 @@ -#include "CountingIterator.hh" +#include <thrust/iterator/counting_iterator.h> #include <algorithm> #include <chrono> #include <complex> @@ -8,6 +8,9 @@ #include <string> #include <vector> +template <class T> +using CountingIterator = thrust::counting_iterator<T>; + void save_pgm(std::string filename, size_t width, size_t height, std::vector<unsigned char> data) { @@ -29,7 +32,7 @@ auto mandel(size_t width, size_t height) -> std::vector<unsigned char> double aspect = static_cast<double>(width) / height; std::vector<unsigned char> ans(width * height, 0); CountingIterator<size_t> beg { 0 }, end { width * height }; - std::transform(std::execution::par, beg, end, + std::transform(std::execution::par_unseq, beg, end, ans.begin(), [=](size_t index) { double myrow = index / width; double mycol = index % width; -- GitLab