Update STD C++17 for Issue #80

This commit is contained in:
Tom Deakin 2020-12-07 11:32:22 +00:00
parent 74f705cac9
commit b00120d346
3 changed files with 16 additions and 6 deletions

View File

@ -15,11 +15,19 @@
auto exe_policy = std::execution::par_unseq; auto exe_policy = std::execution::par_unseq;
template <class T> template <class T>
STDStream<T>::STDStream(const unsigned int ARRAY_SIZE, T *a, T *b, T *c, int device) STDStream<T>::STDStream(const unsigned int ARRAY_SIZE, int device)
noexcept : array_size{ARRAY_SIZE}, a{a}, b{b}, c{c} noexcept : array_size{ARRAY_SIZE}, a{new T[array_size]}, b{new T[array_size]}, c{new T[array_size]}
{ {
} }
template <class T>
STDStream<T>::~STDStream()
{
delete[] a;
delete[] b;
delete[] c;
}
template <class T> template <class T>
void STDStream<T>::init_arrays(T initA, T initB, T initC) void STDStream<T>::init_arrays(T initA, T initB, T initC)
{ {
@ -87,3 +95,4 @@ std::string getDeviceDriver(const int)
} }
template class STDStream<float>; template class STDStream<float>;
template class STDStream<double>; template class STDStream<double>;

View File

@ -24,8 +24,8 @@ class STDStream : public Stream<T>
T *c; T *c;
public: public:
STDStream(const unsigned int, T*, T*, T*, int); STDStream(const unsigned int, int);
~STDStream() = default; ~STDStream();
virtual void copy() override; virtual void copy() override;
virtual void add() override; virtual void add() override;
@ -36,3 +36,4 @@ class STDStream : public Stream<T>
virtual void init_arrays(T initA, T initB, T initC) override; virtual void init_arrays(T initA, T initB, T initC) override;
virtual void read_arrays(std::vector<T>& a, std::vector<T>& b, std::vector<T>& c) override; virtual void read_arrays(std::vector<T>& a, std::vector<T>& b, std::vector<T>& c) override;
}; };

View File

@ -158,7 +158,7 @@ void run()
#elif defined(STD) #elif defined(STD)
// Use the STD implementation // Use the STD implementation
stream = new STDStream<T>(ARRAY_SIZE, a.data(), b.data(), c.data(), deviceIndex); stream = new STDStream<T>(ARRAY_SIZE, deviceIndex);
#elif defined(ACC) #elif defined(ACC)
// Use the OpenACC implementation // Use the OpenACC implementation
@ -366,7 +366,7 @@ void run_triad()
#elif defined(STD) #elif defined(STD)
// Use the STD implementation // Use the STD implementation
stream = new STDStream<T>(ARRAY_SIZE, a.data(), b.data(), c.data(), deviceIndex); stream = new STDStream<T>(ARRAY_SIZE, deviceIndex);
#elif defined(SYCL) #elif defined(SYCL)
// Use the SYCL implementation // Use the SYCL implementation