Skip to content

Commit b932dfc

Browse files
[OpenMP][Test][NFC] clang-format all ompt and multiplex tests
1 parent 8e50c89 commit b932dfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+837
-968
lines changed

openmp/runtime/test/ompt/callback.h

Lines changed: 424 additions & 478 deletions
Large diffs are not rendered by default.

openmp/runtime/test/ompt/cancel/cancel_parallel.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@
99
#include "omp.h"
1010

1111
int main() {
12-
#pragma omp parallel num_threads(2)
12+
#pragma omp parallel num_threads(2)
1313
{
1414
if (omp_get_thread_num() == 0) {
1515
print_fuzzy_address_blocks(get_ompt_label_address(1));
16-
#pragma omp cancel parallel
16+
#pragma omp cancel parallel
1717
define_ompt_label(1);
18-
// We cannot print at this location because the parallel region is cancelled!
18+
// We cannot print at this location because the parallel region is
19+
// cancelled!
1920
} else {
2021
delay(100);
2122
print_fuzzy_address_blocks(get_ompt_label_address(2));
22-
#pragma omp cancellation point parallel
23+
#pragma omp cancellation point parallel
2324
define_ompt_label(2);
24-
// We cannot print at this location because the parallel region is cancelled!
25+
// We cannot print at this location because the parallel region is
26+
// cancelled!
2527
}
2628
}
2729

openmp/runtime/test/ompt/cancel/cancel_taskgroup.c

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,56 @@
77
// clang-format on
88

99
#include "callback.h"
10-
#include <unistd.h>
10+
#include <unistd.h>
1111
#include <stdio.h>
1212

13-
int main()
14-
{
15-
int condition=0;
16-
#pragma omp parallel num_threads(2)
13+
int main() {
14+
int condition = 0;
15+
#pragma omp parallel num_threads(2)
1716
{}
1817

1918
print_frame(0);
20-
#pragma omp parallel num_threads(2)
19+
#pragma omp parallel num_threads(2)
2120
{
22-
#pragma omp master
21+
#pragma omp master
2322
{
24-
#pragma omp taskgroup
23+
#pragma omp taskgroup
2524
{
26-
#pragma omp task shared(condition)
25+
#pragma omp task shared(condition)
2726
{
2827
printf("start execute task 1\n");
2928
OMPT_SIGNAL(condition);
30-
OMPT_WAIT(condition,2);
31-
#pragma omp cancellation point taskgroup
29+
OMPT_WAIT(condition, 2);
30+
#pragma omp cancellation point taskgroup
3231
printf("end execute task 1\n");
3332
}
34-
#pragma omp task shared(condition)
33+
#pragma omp task shared(condition)
3534
{
3635
printf("start execute task 2\n");
3736
OMPT_SIGNAL(condition);
38-
OMPT_WAIT(condition,2);
39-
#pragma omp cancellation point taskgroup
37+
OMPT_WAIT(condition, 2);
38+
#pragma omp cancellation point taskgroup
4039
printf("end execute task 2\n");
4140
}
42-
#pragma omp task shared(condition)
41+
#pragma omp task shared(condition)
4342
{
4443
printf("start execute task 3\n");
4544
OMPT_SIGNAL(condition);
46-
OMPT_WAIT(condition,2);
47-
#pragma omp cancellation point taskgroup
45+
OMPT_WAIT(condition, 2);
46+
#pragma omp cancellation point taskgroup
4847
printf("end execute task 3\n");
4948
}
50-
#pragma omp task if(0) shared(condition)
49+
#pragma omp task if (0) shared(condition)
5150
{
5251
printf("start execute task 4\n");
53-
OMPT_WAIT(condition,1);
54-
#pragma omp cancel taskgroup
52+
OMPT_WAIT(condition, 1);
53+
#pragma omp cancel taskgroup
5554
printf("end execute task 4\n");
5655
}
5756
OMPT_SIGNAL(condition);
5857
}
5958
}
60-
#pragma omp barrier
59+
#pragma omp barrier
6160
}
6261

6362
// clang-format off

openmp/runtime/test/ompt/cancel/cancel_worksharing.c

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,40 @@
88
#include "callback.h"
99
#include <unistd.h>
1010

11-
int main()
12-
{
13-
int condition=0;
14-
#pragma omp parallel num_threads(2)
11+
int main() {
12+
int condition = 0;
13+
#pragma omp parallel num_threads(2)
1514
{
1615
int x = 0;
1716
int i;
18-
#pragma omp for
19-
for(i = 0; i < 2; i++)
20-
{
21-
if(i == 0)
22-
{
17+
#pragma omp for
18+
for (i = 0; i < 2; i++) {
19+
if (i == 0) {
2320
x++;
2421
OMPT_SIGNAL(condition);
25-
#pragma omp cancel for
26-
}
27-
else
28-
{
22+
#pragma omp cancel for
23+
} else {
2924
x++;
30-
OMPT_WAIT(condition,1);
25+
OMPT_WAIT(condition, 1);
3126
delay(10000);
32-
#pragma omp cancellation point for
27+
#pragma omp cancellation point for
3328
}
3429
}
3530
}
36-
#pragma omp parallel num_threads(2)
31+
#pragma omp parallel num_threads(2)
3732
{
38-
#pragma omp sections
33+
#pragma omp sections
3934
{
40-
#pragma omp section
35+
#pragma omp section
4136
{
4237
OMPT_SIGNAL(condition);
43-
#pragma omp cancel sections
38+
#pragma omp cancel sections
4439
}
45-
#pragma omp section
40+
#pragma omp section
4641
{
47-
OMPT_WAIT(condition,2);
42+
OMPT_WAIT(condition, 2);
4843
delay(10000);
49-
#pragma omp cancellation point sections
44+
#pragma omp cancellation point sections
5045
}
5146
}
5247
}

openmp/runtime/test/ompt/loadtool/tool_available.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@
107107
#ifdef CODE
108108
#include "omp.h"
109109

110-
int main()
111-
{
112-
#pragma omp parallel num_threads(2)
110+
int main() {
111+
#pragma omp parallel num_threads(2)
113112
{
114113
}
115114

@@ -133,20 +132,18 @@ int main()
133132

134133
int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
135134
ompt_data_t *tool_data) {
136-
printf("0: NULL_POINTER=%p\n", (void*)NULL);
137-
return 1; //success
135+
printf("0: NULL_POINTER=%p\n", (void *)NULL);
136+
return 1; // success
138137
}
139138

140-
void ompt_finalize(ompt_data_t* tool_data)
141-
{
139+
void ompt_finalize(ompt_data_t *tool_data) {
142140
printf("0: ompt_event_runtime_shutdown\n");
143141
}
144142

145-
ompt_start_tool_result_t* ompt_start_tool(
146-
unsigned int omp_version,
147-
const char *runtime_version)
148-
{
149-
static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,&ompt_finalize, 0};
143+
ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
144+
const char *runtime_version) {
145+
static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,
146+
&ompt_finalize, 0};
150147
return &ompt_start_tool_result;
151148
}
152149
#endif /* TOOL */

openmp/runtime/test/ompt/loadtool/tool_available_search.c

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,16 @@
6363
#include "omp.h"
6464
#include "omp-tools.h"
6565

66-
int main()
67-
{
68-
#pragma omp parallel num_threads(2)
66+
int main() {
67+
#pragma omp parallel num_threads(2)
6968
{
70-
#pragma omp master
69+
#pragma omp master
7170
{
7271
int result = omp_control_tool(omp_control_tool_start, 0, NULL);
7372
printf("0: control_tool()=%d\n", result);
7473
}
7574
}
7675

77-
7876
return 0;
7977
}
8078

@@ -87,44 +85,37 @@ int main()
8785

8886
#ifdef SECOND_TOOL
8987
// The second tool has an implementation of ompt_start_tool that returns NULL
90-
ompt_start_tool_result_t* ompt_start_tool(
91-
unsigned int omp_version,
92-
const char *runtime_version)
93-
{
88+
ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
89+
const char *runtime_version) {
9490
printf("0: Do not initialize tool\n");
9591
return NULL;
9692
}
9793
#elif defined(THIRD_TOOL)
9894
// The third tool has an implementation of ompt_start_tool that returns a
9995
// pointer to a valid instance of ompt_start_tool_result_t
10096

101-
static void
102-
on_ompt_callback_thread_begin(
103-
ompt_thread_t thread_type,
104-
ompt_data_t *thread_data)
105-
{
97+
static void on_ompt_callback_thread_begin(ompt_thread_t thread_type,
98+
ompt_data_t *thread_data) {
10699
printf("0: ompt_event_thread_begin\n");
107100
}
108101

109102
int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
110103
ompt_data_t *tool_data) {
111-
ompt_set_callback_t ompt_set_callback = (ompt_set_callback_t) lookup("ompt_set_callback");
112-
ompt_set_callback(ompt_callback_thread_begin, (ompt_callback_t)on_ompt_callback_thread_begin);
104+
ompt_set_callback_t ompt_set_callback =
105+
(ompt_set_callback_t)lookup("ompt_set_callback");
106+
ompt_set_callback(ompt_callback_thread_begin,
107+
(ompt_callback_t)on_ompt_callback_thread_begin);
113108
printf("0: Tool initialized\n");
114109
return 1;
115110
}
116111

117-
void ompt_finalize(ompt_data_t *tool_data)
118-
{
119-
printf("0: Tool finalized\n");
120-
}
112+
void ompt_finalize(ompt_data_t *tool_data) { printf("0: Tool finalized\n"); }
121113

122-
ompt_start_tool_result_t* ompt_start_tool(
123-
unsigned int omp_version,
124-
const char *runtime_version)
125-
{
114+
ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
115+
const char *runtime_version) {
126116
printf("0: Do initialize tool\n");
127-
static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,&ompt_finalize, 0};
117+
static ompt_start_tool_result_t ompt_start_tool_result = {&ompt_initialize,
118+
&ompt_finalize, 0};
128119
return &ompt_start_tool_result;
129120
}
130121
#endif

openmp/runtime/test/ompt/loadtool/tool_not_available.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
// clang-format on
4949

5050
/*
51-
* This file contains code for an OMPT shared library tool to be
52-
* loaded and the code for the OpenMP executable.
51+
* This file contains code for an OMPT shared library tool to be
52+
* loaded and the code for the OpenMP executable.
5353
* -DTOOL enables the code for the tool during compilation
5454
* -DCODE enables the code for the executable during compilation
5555
*/
@@ -59,11 +59,10 @@
5959
#include "omp.h"
6060
#include "omp-tools.h"
6161

62-
int main()
63-
{
64-
#pragma omp parallel num_threads(2)
62+
int main() {
63+
#pragma omp parallel num_threads(2)
6564
{
66-
#pragma omp master
65+
#pragma omp master
6766
{
6867
int result = omp_control_tool(omp_control_tool_start, 0, NULL);
6968
printf("0: control_tool()=%d\n", result);
@@ -112,10 +111,8 @@ int main()
112111
#include <omp-tools.h>
113112
#include "stdio.h"
114113

115-
ompt_start_tool_result_t* ompt_start_tool(
116-
unsigned int omp_version,
117-
const char *runtime_version)
118-
{
114+
ompt_start_tool_result_t *ompt_start_tool(unsigned int omp_version,
115+
const char *runtime_version) {
119116
printf("0: Do not initialize tool\n");
120117
return NULL;
121118
}

openmp/runtime/test/ompt/misc/control_tool.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
#include "callback.h"
88
#include <omp.h>
99

10-
int main()
11-
{
12-
#pragma omp parallel num_threads(1)
10+
int main() {
11+
#pragma omp parallel num_threads(1)
1312
{
1413
print_frame_from_outlined_fn(1);
1514
print_frame(0);

openmp/runtime/test/ompt/misc/control_tool_no_ompt_support.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
#include <omp.h>
66

7-
int main()
8-
{
9-
#pragma omp parallel num_threads(1)
7+
int main() {
8+
#pragma omp parallel num_threads(1)
109
{
1110
omp_control_tool(omp_control_tool_flush, 1, NULL);
1211
}

openmp/runtime/test/ompt/misc/unset_callback.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
#include "omp_testsuite.h"
77
#include <omp.h>
88

9-
int main()
10-
{
9+
int main() {
1110
go_parallel_nthreads(1);
1211
ompt_set_callback(ompt_callback_parallel_begin, NULL);
1312
go_parallel_nthreads(1);

0 commit comments

Comments
 (0)