Make OpenMP array size signed
This commit is contained in:
parent
4abb080a0e
commit
a9fd663471
@ -12,7 +12,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <class T>
|
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;
|
array_size = ARRAY_SIZE;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ OMPStream<T>::~OMPStream()
|
|||||||
{
|
{
|
||||||
#ifdef OMP_TARGET_GPU
|
#ifdef OMP_TARGET_GPU
|
||||||
// End data region on device
|
// End data region on device
|
||||||
unsigned int array_size = this->array_size;
|
int array_size = this->array_size;
|
||||||
T *a = this->a;
|
T *a = this->a;
|
||||||
T *b = this->b;
|
T *b = this->b;
|
||||||
T *c = this->c;
|
T *c = this->c;
|
||||||
@ -53,7 +53,7 @@ OMPStream<T>::~OMPStream()
|
|||||||
template <class T>
|
template <class T>
|
||||||
void OMPStream<T>::init_arrays(T initA, T initB, T initC)
|
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
|
#ifdef OMP_TARGET_GPU
|
||||||
T *a = this->a;
|
T *a = this->a;
|
||||||
T *b = this->b;
|
T *b = this->b;
|
||||||
@ -101,7 +101,7 @@ template <class T>
|
|||||||
void OMPStream<T>::copy()
|
void OMPStream<T>::copy()
|
||||||
{
|
{
|
||||||
#ifdef OMP_TARGET_GPU
|
#ifdef OMP_TARGET_GPU
|
||||||
unsigned int array_size = this->array_size;
|
int array_size = this->array_size;
|
||||||
T *a = this->a;
|
T *a = this->a;
|
||||||
T *c = this->c;
|
T *c = this->c;
|
||||||
#pragma omp target teams distribute parallel for simd
|
#pragma omp target teams distribute parallel for simd
|
||||||
@ -125,7 +125,7 @@ void OMPStream<T>::mul()
|
|||||||
const T scalar = startScalar;
|
const T scalar = startScalar;
|
||||||
|
|
||||||
#ifdef OMP_TARGET_GPU
|
#ifdef OMP_TARGET_GPU
|
||||||
unsigned int array_size = this->array_size;
|
int array_size = this->array_size;
|
||||||
T *b = this->b;
|
T *b = this->b;
|
||||||
T *c = this->c;
|
T *c = this->c;
|
||||||
#pragma omp target teams distribute parallel for simd
|
#pragma omp target teams distribute parallel for simd
|
||||||
@ -147,7 +147,7 @@ template <class T>
|
|||||||
void OMPStream<T>::add()
|
void OMPStream<T>::add()
|
||||||
{
|
{
|
||||||
#ifdef OMP_TARGET_GPU
|
#ifdef OMP_TARGET_GPU
|
||||||
unsigned int array_size = this->array_size;
|
int array_size = this->array_size;
|
||||||
T *a = this->a;
|
T *a = this->a;
|
||||||
T *b = this->b;
|
T *b = this->b;
|
||||||
T *c = this->c;
|
T *c = this->c;
|
||||||
@ -172,7 +172,7 @@ void OMPStream<T>::triad()
|
|||||||
const T scalar = startScalar;
|
const T scalar = startScalar;
|
||||||
|
|
||||||
#ifdef OMP_TARGET_GPU
|
#ifdef OMP_TARGET_GPU
|
||||||
unsigned int array_size = this->array_size;
|
int array_size = this->array_size;
|
||||||
T *a = this->a;
|
T *a = this->a;
|
||||||
T *b = this->b;
|
T *b = this->b;
|
||||||
T *c = this->c;
|
T *c = this->c;
|
||||||
@ -197,7 +197,7 @@ T OMPStream<T>::dot()
|
|||||||
T sum = 0.0;
|
T sum = 0.0;
|
||||||
|
|
||||||
#ifdef OMP_TARGET_GPU
|
#ifdef OMP_TARGET_GPU
|
||||||
unsigned int array_size = this->array_size;
|
int array_size = this->array_size;
|
||||||
T *a = this->a;
|
T *a = this->a;
|
||||||
T *b = this->b;
|
T *b = this->b;
|
||||||
#pragma omp target teams distribute parallel for simd map(tofrom: sum) reduction(+:sum)
|
#pragma omp target teams distribute parallel for simd map(tofrom: sum) reduction(+:sum)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class OMPStream : public Stream<T>
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
// Size of arrays
|
// Size of arrays
|
||||||
unsigned int array_size;
|
int array_size;
|
||||||
|
|
||||||
// Device side pointers
|
// Device side pointers
|
||||||
T *a;
|
T *a;
|
||||||
@ -29,7 +29,7 @@ class OMPStream : public Stream<T>
|
|||||||
T *c;
|
T *c;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OMPStream(const unsigned int, int);
|
OMPStream(const int, int);
|
||||||
~OMPStream();
|
~OMPStream();
|
||||||
|
|
||||||
virtual void copy() override;
|
virtual void copy() override;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user