Make OpenMP array size signed

This commit is contained in:
Tom Deakin 2021-01-12 10:04:51 +00:00
parent 4abb080a0e
commit a9fd663471
2 changed files with 10 additions and 10 deletions

View File

@ -12,7 +12,7 @@
#endif
template <class T>
OMPStream<T>::OMPStream(const unsigned int ARRAY_SIZE, int device)
OMPStream<T>::OMPStream(const int ARRAY_SIZE, int device)
{
array_size = ARRAY_SIZE;
@ -38,7 +38,7 @@ OMPStream<T>::~OMPStream()
{
#ifdef OMP_TARGET_GPU
// End data region on device
unsigned int array_size = this->array_size;
int array_size = this->array_size;
T *a = this->a;
T *b = this->b;
T *c = this->c;
@ -53,7 +53,7 @@ OMPStream<T>::~OMPStream()
template <class T>
void OMPStream<T>::init_arrays(T initA, T initB, T initC)
{
unsigned int array_size = this->array_size;
int array_size = this->array_size;
#ifdef OMP_TARGET_GPU
T *a = this->a;
T *b = this->b;
@ -101,7 +101,7 @@ template <class T>
void OMPStream<T>::copy()
{
#ifdef OMP_TARGET_GPU
unsigned int array_size = this->array_size;
int array_size = this->array_size;
T *a = this->a;
T *c = this->c;
#pragma omp target teams distribute parallel for simd
@ -125,7 +125,7 @@ void OMPStream<T>::mul()
const T scalar = startScalar;
#ifdef OMP_TARGET_GPU
unsigned int array_size = this->array_size;
int array_size = this->array_size;
T *b = this->b;
T *c = this->c;
#pragma omp target teams distribute parallel for simd
@ -147,7 +147,7 @@ template <class T>
void OMPStream<T>::add()
{
#ifdef OMP_TARGET_GPU
unsigned int array_size = this->array_size;
int array_size = this->array_size;
T *a = this->a;
T *b = this->b;
T *c = this->c;
@ -172,7 +172,7 @@ void OMPStream<T>::triad()
const T scalar = startScalar;
#ifdef OMP_TARGET_GPU
unsigned int array_size = this->array_size;
int array_size = this->array_size;
T *a = this->a;
T *b = this->b;
T *c = this->c;
@ -197,7 +197,7 @@ T OMPStream<T>::dot()
T sum = 0.0;
#ifdef OMP_TARGET_GPU
unsigned int array_size = this->array_size;
int array_size = this->array_size;
T *a = this->a;
T *b = this->b;
#pragma omp target teams distribute parallel for simd map(tofrom: sum) reduction(+:sum)

View File

@ -21,7 +21,7 @@ class OMPStream : public Stream<T>
{
protected:
// Size of arrays
unsigned int array_size;
int array_size;
// Device side pointers
T *a;
@ -29,7 +29,7 @@ class OMPStream : public Stream<T>
T *c;
public:
OMPStream(const unsigned int, int);
OMPStream(const int, int);
~OMPStream();
virtual void copy() override;