--- /dev/null
+// { dg-additional-options "-std=c++23" }
+
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+#define OMP_USM
+#define MEM_SHARED
+
+#include "target-std__flat_map-concurrent.C"
init (keys, true);
init (data, false);
+#ifndef MEM_SHARED
#pragma omp target enter data map (to: keys[ :N], data[ :N]) map (alloc: _map)
+#endif
#pragma omp target
{
for (int i = 0; i < N; ++i)
sum += (long long) keys[i] * _map[keys[i]];
+#ifdef OMP_USM
+ #pragma omp target
+ /* Restore the object into pristine state. In particular, deallocate
+ any memory allocated during device execution, which otherwise, back
+ on the host, we'd SIGSEGV on, when attempting to deallocate during
+ destruction of the object. */
+ __typeof__ (_map){}.swap (_map);
+#endif
#ifndef MEM_SHARED
#pragma omp target
_map.~flat_map ();
#endif
+#ifndef MEM_SHARED
#pragma omp target exit data map (release: _map)
+#endif
bool ok = validate (sum, keys, data);
return ok ? 0 : 1;
--- /dev/null
+// { dg-additional-options "-std=c++23" }
+
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+#define OMP_USM
+#define MEM_SHARED
+
+#include "target-std__flat_multimap-concurrent.C"
init (keys, KEY_MAX);
init (data, RAND_MAX);
+#ifndef MEM_SHARED
#pragma omp target enter data map (to: keys[ :N], data[ :N]) map (alloc: _map)
+#endif
#pragma omp target
{
}
}
+#ifdef OMP_USM
+ #pragma omp target
+ /* Restore the object into pristine state. In particular, deallocate
+ any memory allocated during device execution, which otherwise, back
+ on the host, we'd SIGSEGV on, when attempting to deallocate during
+ destruction of the object. */
+ __typeof__ (_map){}.swap (_map);
+#endif
#ifndef MEM_SHARED
#pragma omp target
_map.~flat_multimap ();
#endif
+#ifndef MEM_SHARED
#pragma omp target exit data map (release: _map)
+#endif
bool ok = validate (sum, keys, data);
return ok ? 0 : 1;
--- /dev/null
+// { dg-additional-options "-std=c++23" }
+
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+#define OMP_USM
+#define MEM_SHARED
+
+#include "target-std__flat_multiset-concurrent.C"
srand (time (NULL));
init (data);
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[ :N]) map (alloc: set)
+#endif
{
#pragma omp target
{
for (int i = 0; i < MAX; ++i)
sum += i * set.count (i);
+#ifdef OMP_USM
+ #pragma omp target
+ /* Restore the object into pristine state. In particular, deallocate
+ any memory allocated during device execution, which otherwise, back
+ on the host, we'd SIGSEGV on, when attempting to deallocate during
+ destruction of the object. */
+ __typeof__ (set){}.swap (set);
+#endif
#ifndef MEM_SHARED
#pragma omp target
set.~flat_multiset ();
--- /dev/null
+// { dg-additional-options "-std=c++23" }
+
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+#define OMP_USM
+#define MEM_SHARED
+
+#include "target-std__flat_set-concurrent.C"
srand (time (NULL));
init (data);
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[ :N]) map (alloc: _set)
+#endif
{
#pragma omp target
{
if (_set.count (i) > 0)
sum += i;
+#ifdef OMP_USM
+ #pragma omp target
+ /* Restore the object into pristine state. In particular, deallocate
+ any memory allocated during device execution, which otherwise, back
+ on the host, we'd SIGSEGV on, when attempting to deallocate during
+ destruction of the object. */
+ __typeof__ (_set){}.swap (_set);
+#endif
#ifndef MEM_SHARED
#pragma omp target
_set.~flat_set ();