[OMP] Update deconstructor to only call target region if building for GPU

This commit is contained in:
Tom Deakin 2016-12-13 11:45:30 +00:00
parent d0dd48406c
commit d75b0004de

View File

@ -31,6 +31,7 @@ OMPStream<T>::OMPStream(const unsigned int ARRAY_SIZE, T *a, T *b, T *c, int dev
template <class T> template <class T>
OMPStream<T>::~OMPStream() OMPStream<T>::~OMPStream()
{ {
#ifdef OMP_TARGET_GPU
// End data region on device // End data region on device
unsigned int array_size = this->array_size; unsigned int array_size = this->array_size;
T *a = this->a; T *a = this->a;
@ -38,6 +39,11 @@ OMPStream<T>::~OMPStream()
T *c = this->c; T *c = this->c;
#pragma omp target exit data map(release: a[0:array_size], b[0:array_size], c[0:array_size]) #pragma omp target exit data map(release: a[0:array_size], b[0:array_size], c[0:array_size])
{} {}
#else
free(a);
free(b);
free(c);
#endif
} }
template <class T> template <class T>