5 const omp_alloctrait_t traits2
[]
6 = { { omp_atk_alignment
, 16 },
7 { omp_atk_sync_hint
, omp_atv_default
},
8 { omp_atk_access
, omp_atv_default
},
9 { omp_atk_pool_size
, 1024 },
10 { omp_atk_fallback
, omp_atv_default_mem_fb
},
11 { omp_atk_partition
, omp_atv_environment
} };
12 omp_alloctrait_t traits3
[]
13 = { { omp_atk_sync_hint
, omp_atv_uncontended
},
14 { omp_atk_alignment
, 32 },
15 { omp_atk_access
, omp_atv_all
},
16 { omp_atk_pool_size
, 512 },
17 { omp_atk_fallback
, omp_atv_allocator_fb
},
18 { omp_atk_fb_data
, 0 },
19 { omp_atk_partition
, omp_atv_default
} };
20 const omp_alloctrait_t traits4
[]
21 = { { omp_atk_alignment
, 128 },
22 { omp_atk_pool_size
, 1024 },
23 { omp_atk_fallback
, omp_atv_null_fb
} };
28 int *volatile p
= (int *) omp_calloc (3, sizeof (int), omp_default_mem_alloc
);
32 omp_alloctrait_t traits
[3]
33 = { { omp_atk_alignment
, 64 },
34 { omp_atk_fallback
, omp_atv_null_fb
},
35 { omp_atk_pool_size
, 4096 } };
36 omp_allocator_handle_t a
, a2
;
38 if ((((uintptr_t) p
) % __alignof (int)) != 0 || p
[0] || p
[1] || p
[2])
43 omp_free (p
, omp_default_mem_alloc
);
44 p
= (int *) omp_calloc (2, sizeof (int), omp_default_mem_alloc
);
45 if ((((uintptr_t) p
) % __alignof (int)) != 0 || p
[0] || p
[1])
49 omp_free (p
, omp_null_allocator
);
50 omp_set_default_allocator (omp_default_mem_alloc
);
51 p
= (int *) omp_calloc (1, sizeof (int), omp_null_allocator
);
52 if ((((uintptr_t) p
) % __alignof (int)) != 0 || p
[0])
55 omp_free (p
, omp_get_default_allocator ());
57 a
= omp_init_allocator (omp_default_mem_space
, 3, traits
);
58 if (a
== omp_null_allocator
)
60 p
= (int *) omp_calloc (3, 1024, a
);
61 if ((((uintptr_t) p
) % 64) != 0)
63 for (i
= 0; i
< 3072 / sizeof (int); i
++)
67 p
[3071 / sizeof (int)] = 2;
68 if (omp_calloc (1024, 3, a
) != NULL
)
71 p
= (int *) omp_calloc (512, 6, a
);
72 for (i
= 0; i
< 3072 / sizeof (int); i
++)
76 p
[3071 / sizeof (int)] = 4;
77 omp_free (p
, omp_null_allocator
);
78 omp_set_default_allocator (a
);
79 if (omp_get_default_allocator () != a
)
81 p
= (int *) omp_calloc (12, 256, omp_null_allocator
);
82 for (i
= 0; i
< 3072 / sizeof (int); i
++)
85 if (omp_calloc (128, 24, omp_null_allocator
) != NULL
)
88 omp_destroy_allocator (a
);
90 a
= omp_init_allocator (omp_default_mem_space
,
91 sizeof (traits2
) / sizeof (traits2
[0]),
93 if (a
== omp_null_allocator
)
95 if (traits3
[5].key
!= omp_atk_fb_data
)
97 traits3
[5].value
= (uintptr_t) a
;
98 a2
= omp_init_allocator (omp_default_mem_space
,
99 sizeof (traits3
) / sizeof (traits3
[0]),
101 if (a2
== omp_null_allocator
)
103 p
= (int *) omp_calloc (10, 42, a2
);
104 for (i
= 0; i
< 420 / sizeof (int); i
++)
107 if ((((uintptr_t) p
) % 32) != 0)
110 p
[419 / sizeof (int)] = 6;
111 q
= (int *) omp_calloc (24, 32, a2
);
112 if ((((uintptr_t) q
) % 16) != 0)
114 for (i
= 0; i
< 768 / sizeof (int); i
++)
118 q
[767 / sizeof (int)] = 8;
119 r
= (int *) omp_calloc (128, 4, a2
);
120 if ((((uintptr_t) r
) % __alignof (int)) != 0)
122 for (i
= 0; i
< 512 / sizeof (int); i
++)
126 r
[511 / sizeof (int)] = 10;
127 omp_free (p
, omp_null_allocator
);
129 omp_free (r
, omp_null_allocator
);
130 omp_destroy_allocator (a2
);
131 omp_destroy_allocator (a
);
133 a
= omp_init_allocator (omp_default_mem_space
,
134 sizeof (traits4
) / sizeof (traits4
[0]),
136 if (a
== omp_null_allocator
)
138 if (traits3
[5].key
!= omp_atk_fb_data
)
140 traits3
[5].value
= (uintptr_t) a
;
141 a2
= omp_init_allocator (omp_default_mem_space
,
142 sizeof (traits3
) / sizeof (traits3
[0]),
144 if (a2
== omp_null_allocator
)
146 omp_set_default_allocator (a2
);
148 p
= static_cast <int *> (omp_calloc (42, 10));
150 p
= (int *) omp_calloc (42, 10, omp_null_allocator
);
152 if ((((uintptr_t) p
) % 32) != 0)
154 for (i
= 0; i
< 420 / sizeof (int); i
++)
158 p
[419 / sizeof (int)] = 6;
159 q
= (int *) omp_calloc (32, 24, omp_null_allocator
);
160 if ((((uintptr_t) q
) % 128) != 0)
162 for (i
= 0; i
< 768 / sizeof (int); i
++)
166 q
[767 / sizeof (int)] = 8;
167 if (omp_calloc (24, 32, omp_null_allocator
) != NULL
)
174 omp_free (p
, omp_null_allocator
);
175 omp_free (q
, omp_null_allocator
);
176 omp_free (NULL
, omp_null_allocator
);
178 omp_free (NULL
, omp_null_allocator
);
179 omp_destroy_allocator (a2
);
180 omp_destroy_allocator (a
);