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_aligned_calloc (sizeof (int), 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_aligned_calloc (2 * sizeof (int), 1, 2 * sizeof (int), omp_default_mem_alloc
);
45 if ((((uintptr_t) p
) % (2 * sizeof (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_aligned_calloc (1, 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_aligned_calloc (32, 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_aligned_calloc (8, 192, 16, a
) != NULL
)
71 p
= (int *) omp_aligned_calloc (128, 6, 512, a
);
72 if ((((uintptr_t) p
) % 128) != 0)
74 for (i
= 0; i
< 3072 / sizeof (int); i
++)
78 p
[3071 / sizeof (int)] = 4;
79 omp_free (p
, omp_null_allocator
);
80 omp_set_default_allocator (a
);
81 if (omp_get_default_allocator () != a
)
83 p
= (int *) omp_aligned_calloc (64, 12, 256, omp_null_allocator
);
84 for (i
= 0; i
< 3072 / sizeof (int); i
++)
87 if (omp_aligned_calloc (8, 128, 24, omp_null_allocator
) != NULL
)
90 omp_destroy_allocator (a
);
92 a
= omp_init_allocator (omp_default_mem_space
,
93 sizeof (traits2
) / sizeof (traits2
[0]),
95 if (a
== omp_null_allocator
)
97 if (traits3
[5].key
!= omp_atk_fb_data
)
99 traits3
[5].value
= (uintptr_t) a
;
100 a2
= omp_init_allocator (omp_default_mem_space
,
101 sizeof (traits3
) / sizeof (traits3
[0]),
103 if (a2
== omp_null_allocator
)
105 p
= (int *) omp_aligned_calloc (4, 5, 84, a2
);
106 for (i
= 0; i
< 420 / sizeof (int); i
++)
109 if ((((uintptr_t) p
) % 32) != 0)
112 p
[419 / sizeof (int)] = 6;
113 q
= (int *) omp_aligned_calloc (8, 24, 32, a2
);
114 if ((((uintptr_t) q
) % 16) != 0)
116 for (i
= 0; i
< 768 / sizeof (int); i
++)
120 q
[767 / sizeof (int)] = 8;
121 r
= (int *) omp_aligned_calloc (8, 64, 8, a2
);
122 if ((((uintptr_t) r
) % 8) != 0)
124 for (i
= 0; i
< 512 / sizeof (int); i
++)
128 r
[511 / sizeof (int)] = 10;
129 omp_free (p
, omp_null_allocator
);
131 omp_free (r
, omp_null_allocator
);
132 omp_destroy_allocator (a2
);
133 omp_destroy_allocator (a
);
135 a
= omp_init_allocator (omp_default_mem_space
,
136 sizeof (traits4
) / sizeof (traits4
[0]),
138 if (a
== omp_null_allocator
)
140 if (traits3
[5].key
!= omp_atk_fb_data
)
142 traits3
[5].value
= (uintptr_t) a
;
143 a2
= omp_init_allocator (omp_default_mem_space
,
144 sizeof (traits3
) / sizeof (traits3
[0]),
146 if (a2
== omp_null_allocator
)
148 omp_set_default_allocator (a2
);
150 p
= static_cast <int *> (omp_aligned_calloc (4, 21, 20));
152 p
= (int *) omp_aligned_calloc (4, 21, 20, omp_null_allocator
);
154 if ((((uintptr_t) p
) % 32) != 0)
156 for (i
= 0; i
< 420 / sizeof (int); i
++)
160 p
[419 / sizeof (int)] = 6;
161 q
= (int *) omp_aligned_calloc (64, 12, 64, omp_null_allocator
);
162 if ((((uintptr_t) q
) % 128) != 0)
164 for (i
= 0; i
< 768 / sizeof (int); i
++)
168 q
[767 / sizeof (int)] = 8;
169 if (omp_aligned_calloc (8, 24, 32, omp_null_allocator
) != NULL
)
176 omp_free (p
, omp_null_allocator
);
177 omp_free (q
, omp_null_allocator
);
178 omp_free (NULL
, omp_null_allocator
);
180 omp_free (NULL
, omp_null_allocator
);
181 omp_destroy_allocator (a2
);
182 omp_destroy_allocator (a
);