aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/alloc-3.c
blob: a30cdc05e6051302253ec6c46dfdef4756826df3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* { dg-set-target-env-var OMP_ALLOCATOR "omp_cgroup_mem_alloc" } */
/* { dg-set-target-env-var OMP_DISPLAY_ENV "true" } */

#include <string.h>
#include <stdlib.h>
#include <omp.h>

int
main ()
{
  const char *p = getenv ("OMP_ALLOCATOR");
  if (p && strcmp (p, "omp_cgroup_mem_alloc") == 0)
    {
      if (omp_get_default_allocator () != omp_cgroup_mem_alloc)
	abort ();
      #pragma omp parallel num_threads (2)
      {
	if (omp_get_default_allocator () != omp_cgroup_mem_alloc)
	  abort ();
	#pragma omp parallel num_threads (2)
	{
	  if (omp_get_default_allocator () != omp_cgroup_mem_alloc)
	    abort ();
	}
      }
    }
  return 0;
}