Skip to content

Commit 3549007

Browse files
TheAssembler1github-actions[bot]jeanbez
authored
Use FUNC_ENTER and FUNC_LEAVE (#270)
* use func enter and func leave in all functions * Committing clang-format changes * fix infinite recursion between memory managment, hash table, and per function timing * Committing clang-format changes * add profiling to CI --------- Co-authored-by: github-actions <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jean Luca Bez <[email protected]>
1 parent 1106828 commit 3549007

File tree

83 files changed

+5438
-3314
lines changed

Some content is hidden

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

83 files changed

+5438
-3314
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Ubuntu (profiling)
2+
3+
on:
4+
pull_request:
5+
branches: [ stable, develop ]
6+
7+
push:
8+
branches: [ stable, develop ]
9+
10+
workflow_dispatch:
11+
12+
jobs:
13+
PDC:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 60
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Dependencies
21+
run: .github/workflows/dependencies-linux.sh
22+
23+
- name: Build PDC
24+
run: |
25+
mkdir build && cd build
26+
cmake ../ -DBUILD_MPI_TESTING=ON -DBUILD_SHARED_LIBS=ON -DPDC_SERVER_CACHE=ON -DBUILD_TESTING=ON -DPDC_ENABLE_MPI=ON -DPDC_ENABLE_PROFILING=ON -DCMAKE_C_COMPILER=mpicc -DCMAKE_POLICY_VERSION_MINIMUM=3.5
27+
make -j2
28+
29+
- name: Test PDC
30+
working-directory: build
31+
run: ctest -L serial --output-on-failure

src/api/close_server.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
int
3636
main(int argc, char *argv[])
3737
{
38+
FUNC_ENTER(NULL);
39+
3840
pdcid_t pdc;
3941
#ifdef ENABLE_MPI
4042
int rank;
@@ -57,5 +59,6 @@ main(int argc, char *argv[])
5759
}
5860
MPI_Finalize();
5961
#endif
60-
return 0;
62+
63+
FUNC_LEAVE(0);
6164
}

src/api/pdc.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ perr_t PDC_class__close(struct _pdc_class *p);
4545
static perr_t
4646
PDC_class_init()
4747
{
48-
perr_t ret_value = SUCCEED;
49-
5048
FUNC_ENTER(NULL);
5149

50+
perr_t ret_value = SUCCEED;
51+
5252
/* Initialize the atom group for the container property IDs */
5353
if (PDC_register_type(PDC_CLASS, (PDC_free_t)PDC_class__close) < 0)
5454
PGOTO_ERROR(FAIL, "unable to initialize pdc class interface");
@@ -61,12 +61,12 @@ PDC_class_init()
6161
static pdcid_t
6262
PDC_class_create(const char *pdc_name)
6363
{
64+
FUNC_ENTER(NULL);
65+
6466
pdcid_t ret_value = SUCCEED;
6567
pdcid_t pdcid;
6668
struct _pdc_class *p = NULL;
6769

68-
FUNC_ENTER(NULL);
69-
7070
p = (struct _pdc_class *)PDC_malloc(sizeof(struct _pdc_class));
7171
if (!p)
7272
PGOTO_ERROR(FAIL, "PDC class property memory allocation failed\n");
@@ -84,11 +84,11 @@ PDC_class_create(const char *pdc_name)
8484
pdcid_t
8585
PDCinit(const char *pdc_name)
8686
{
87+
FUNC_ENTER(NULL);
88+
8789
pdcid_t ret_value = SUCCEED;
8890
pdcid_t pdcid;
8991

90-
FUNC_ENTER(NULL);
91-
9292
if (NULL == (pdc_id_list_g = (struct pdc_id_list *)PDC_calloc(1, sizeof(struct pdc_id_list))))
9393
PGOTO_ERROR(0, "PDC global id list: memory allocation failed");
9494

@@ -123,9 +123,10 @@ PDCinit(const char *pdc_name)
123123
perr_t
124124
PDC_class__close(struct _pdc_class *p)
125125
{
126+
FUNC_ENTER(NULL);
127+
126128
perr_t ret_value = SUCCEED;
127129

128-
FUNC_ENTER(NULL);
129130
#ifdef PDC_TIMING
130131
PDC_timing_finalize();
131132
#endif
@@ -139,10 +140,10 @@ PDC_class__close(struct _pdc_class *p)
139140
perr_t
140141
PDC_class_close(pdcid_t pdc)
141142
{
142-
perr_t ret_value = SUCCEED;
143-
144143
FUNC_ENTER(NULL);
145144

145+
perr_t ret_value = SUCCEED;
146+
146147
/* When the reference count reaches zero the resources are freed */
147148
if (PDC_dec_ref(pdc) < 0)
148149
PGOTO_ERROR(FAIL, "PDC: problem of freeing id");
@@ -155,10 +156,10 @@ PDC_class_close(pdcid_t pdc)
155156
perr_t
156157
PDC_class_end()
157158
{
158-
perr_t ret_value = SUCCEED;
159-
160159
FUNC_ENTER(NULL);
161160

161+
perr_t ret_value = SUCCEED;
162+
162163
if (PDC_destroy_type(PDC_CLASS) < 0)
163164
PGOTO_ERROR(FAIL, "unable to destroy pdc class interface");
164165

@@ -170,10 +171,10 @@ PDC_class_end()
170171
perr_t
171172
PDCclose(pdcid_t pdcid)
172173
{
173-
perr_t ret_value = SUCCEED;
174-
175174
FUNC_ENTER(NULL);
176175

176+
perr_t ret_value = SUCCEED;
177+
177178
#ifdef ENABLE_APP_CLOSE_SERVER
178179
PDC_Client_close_all_server();
179180
#endif

src/api/pdc_analysis/include/pdc_analysis_and_transforms_common.h

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "pdc_prop_pkg.h"
2828
#include "pdc_transforms_pkg.h"
29+
#include "pdc_timing.h"
2930
#include "mercury_proc_string.h"
3031
#include "mercury_atomic.h"
3132
#include <dlfcn.h>
@@ -202,195 +203,207 @@ typedef struct obj_data_iterator_out_t {
202203
static HG_INLINE hg_return_t
203204
hg_proc_analysis_ftn_in_t(hg_proc_t proc, void *data)
204205
{
206+
FUNC_ENTER(NULL);
207+
205208
hg_return_t ret;
206209
analysis_ftn_in_t *struct_data = (analysis_ftn_in_t *)data;
207210
ret = hg_proc_hg_const_string_t(proc, &struct_data->ftn_name);
208211
if (ret != HG_SUCCESS) {
209212
// HG_LOG_ERROR("Proc error");
210-
return ret;
213+
FUNC_LEAVE(ret);
211214
}
212215
ret = hg_proc_hg_const_string_t(proc, &struct_data->loadpath);
213216
if (ret != HG_SUCCESS) {
214217
// HG_LOG_ERROR("Proc error");
215-
return ret;
218+
FUNC_LEAVE(ret);
216219
}
217220
ret = hg_proc_uint64_t(proc, &struct_data->local_obj_id);
218221
if (ret != HG_SUCCESS) {
219222
// HG_LOG_ERROR("Proc error");
220-
return ret;
223+
FUNC_LEAVE(ret);
221224
}
222225
ret = hg_proc_uint64_t(proc, &struct_data->iter_in);
223226
if (ret != HG_SUCCESS) {
224227
// HG_LOG_ERROR("Proc error");
225-
return ret;
228+
FUNC_LEAVE(ret);
226229
}
227230
ret = hg_proc_uint64_t(proc, &struct_data->iter_out);
228231
if (ret != HG_SUCCESS) {
229232
// HG_LOG_ERROR("Proc error");
230-
return ret;
233+
FUNC_LEAVE(ret);
231234
}
232-
return ret;
235+
236+
FUNC_LEAVE(ret);
233237
}
234238

235239
static HG_INLINE hg_return_t
236240
hg_proc_obj_data_iterator_in_t(hg_proc_t proc, void *data)
237241
{
242+
FUNC_ENTER(NULL);
243+
238244
hg_return_t ret;
239245
obj_data_iterator_in_t *struct_data = (obj_data_iterator_in_t *)data;
240246
ret = hg_proc_uint64_t(proc, &struct_data->client_iter_id);
241247
if (ret != HG_SUCCESS) {
242248
// HG_LOG_ERROR("Proc error");
243-
return ret;
249+
FUNC_LEAVE(ret);
244250
}
245251
ret = hg_proc_uint64_t(proc, &struct_data->object_id);
246252
if (ret != HG_SUCCESS) {
247253
// HG_LOG_ERROR("Proc error");
248-
return ret;
254+
FUNC_LEAVE(ret);
249255
}
250256
ret = hg_proc_uint64_t(proc, &struct_data->reg_id);
251257
if (ret != HG_SUCCESS) {
252258
// HG_LOG_ERROR("Proc error");
253-
return ret;
259+
FUNC_LEAVE(ret);
254260
}
255261
ret = hg_proc_uint64_t(proc, &struct_data->sliceCount);
256262
if (ret != HG_SUCCESS) {
257263
// HG_LOG_ERROR("Proc error");
258-
return ret;
264+
FUNC_LEAVE(ret);
259265
}
260266
ret = hg_proc_uint64_t(proc, &struct_data->sliceNext);
261267
if (ret != HG_SUCCESS) {
262268
// HG_LOG_ERROR("Proc error");
263-
return ret;
269+
FUNC_LEAVE(ret);
264270
}
265271
ret = hg_proc_uint64_t(proc, &struct_data->sliceResetCount);
266272
if (ret != HG_SUCCESS) {
267273
// HG_LOG_ERROR("Proc error");
268-
return ret;
274+
FUNC_LEAVE(ret);
269275
}
270276
ret = hg_proc_uint64_t(proc, &struct_data->elementsPerSlice);
271277
if (ret != HG_SUCCESS) {
272278
// HG_LOG_ERROR("Proc error");
273-
return ret;
279+
FUNC_LEAVE(ret);
274280
}
275281
ret = hg_proc_uint64_t(proc, &struct_data->slicePerBlock);
276282
if (ret != HG_SUCCESS) {
277283
// HG_LOG_ERROR("Proc error");
278-
return ret;
284+
FUNC_LEAVE(ret);
279285
}
280286
ret = hg_proc_uint64_t(proc, &struct_data->elementsPerPlane);
281287
if (ret != HG_SUCCESS) {
282288
// HG_LOG_ERROR("Proc error");
283-
return ret;
289+
FUNC_LEAVE(ret);
284290
}
285291
ret = hg_proc_uint64_t(proc, &struct_data->elementsPerBlock);
286292
if (ret != HG_SUCCESS) {
287293
// HG_LOG_ERROR("Proc error");
288-
return ret;
294+
FUNC_LEAVE(ret);
289295
}
290296
ret = hg_proc_uint64_t(proc, &struct_data->skipCount);
291297
if (ret != HG_SUCCESS) {
292298
// HG_LOG_ERROR("Proc error");
293-
return ret;
299+
FUNC_LEAVE(ret);
294300
}
295301
ret = hg_proc_uint64_t(proc, &struct_data->element_size);
296302
if (ret != HG_SUCCESS) {
297303
// HG_LOG_ERROR("Proc error");
298-
return ret;
304+
FUNC_LEAVE(ret);
299305
}
300306
ret = hg_proc_uint64_t(proc, &struct_data->srcBlockCount);
301307
if (ret != HG_SUCCESS) {
302308
// HG_LOG_ERROR("Proc error");
303-
return ret;
309+
FUNC_LEAVE(ret);
304310
}
305311
ret = hg_proc_uint64_t(proc, &struct_data->contigBlockSize);
306312
if (ret != HG_SUCCESS) {
307313
// HG_LOG_ERROR("Proc error");
308-
return ret;
314+
FUNC_LEAVE(ret);
309315
}
310316
ret = hg_proc_uint64_t(proc, &struct_data->totalElements);
311317
if (ret != HG_SUCCESS) {
312318
// HG_LOG_ERROR("Proc error");
313-
return ret;
319+
FUNC_LEAVE(ret);
314320
}
315321
ret = hg_proc_uint64_t(proc, &struct_data->ndim);
316322
if (ret != HG_SUCCESS) {
317323
// HG_LOG_ERROR("Proc error");
318-
return ret;
324+
FUNC_LEAVE(ret);
319325
}
320326
ret = hg_proc_uint64_t(proc, &struct_data->dims_0);
321327
if (ret != HG_SUCCESS) {
322328
// HG_LOG_ERROR("Proc error");
323-
return ret;
329+
FUNC_LEAVE(ret);
324330
}
325331
ret = hg_proc_uint64_t(proc, &struct_data->dims_1);
326332
if (ret != HG_SUCCESS) {
327333
// HG_LOG_ERROR("Proc error");
328-
return ret;
334+
FUNC_LEAVE(ret);
329335
}
330336
ret = hg_proc_uint64_t(proc, &struct_data->dims_2);
331337
if (ret != HG_SUCCESS) {
332338
// HG_LOG_ERROR("Proc error");
333-
return ret;
339+
FUNC_LEAVE(ret);
334340
}
335341
ret = hg_proc_uint64_t(proc, &struct_data->dims_3);
336342
if (ret != HG_SUCCESS) {
337343
// HG_LOG_ERROR("Proc error");
338-
return ret;
344+
FUNC_LEAVE(ret);
339345
}
340346
ret = hg_proc_int32_t(proc, &struct_data->storageinfo);
341347
if (ret != HG_SUCCESS) {
342348
// HG_LOG_ERROR("Proc error");
343-
return ret;
349+
FUNC_LEAVE(ret);
344350
}
345351
ret = hg_proc_int32_t(proc, &struct_data->server_id);
346352
if (ret != HG_SUCCESS) {
347353
// HG_LOG_ERROR("Proc error");
348-
return ret;
354+
FUNC_LEAVE(ret);
349355
}
350-
return ret;
356+
357+
FUNC_LEAVE(ret);
351358
}
352359

353360
static HG_INLINE hg_return_t
354361
hg_proc_analysis_ftn_out_t(hg_proc_t proc, void *data)
355362
{
363+
FUNC_ENTER(NULL);
364+
356365
hg_return_t ret;
357366
analysis_ftn_out_t *struct_data = (analysis_ftn_out_t *)data;
358367

359368
ret = hg_proc_uint64_t(proc, &struct_data->remote_ftn_id);
360369
if (ret != HG_SUCCESS) {
361370
// HG_LOG_ERROR("Proc error");
362-
return ret;
371+
FUNC_LEAVE(ret);
363372
}
364-
return ret;
373+
374+
FUNC_LEAVE(ret);
365375
}
366376

367377
static HG_INLINE hg_return_t
368378
hg_proc_obj_data_iterator_out_t(hg_proc_t proc, void *data)
369379
{
380+
FUNC_ENTER(NULL);
381+
370382
hg_return_t ret;
371383
obj_data_iterator_out_t *struct_data = (obj_data_iterator_out_t *)data;
372384

373385
ret = hg_proc_uint64_t(proc, &struct_data->server_iter_id);
374386
if (ret != HG_SUCCESS) {
375387
// HG_LOG_ERROR("Proc error");
376-
return ret;
388+
FUNC_LEAVE(ret);
377389
}
378390
ret = hg_proc_uint64_t(proc, &struct_data->client_iter_id);
379391
if (ret != HG_SUCCESS) {
380392
// HG_LOG_ERROR("Proc error");
381-
return ret;
393+
FUNC_LEAVE(ret);
382394
}
383395
ret = hg_proc_uint64_t(proc, &struct_data->server_region_id);
384396
if (ret != HG_SUCCESS) {
385397
// HG_LOG_ERROR("Proc error");
386-
return ret;
398+
FUNC_LEAVE(ret);
387399
}
388400
ret = hg_proc_int32_t(proc, &struct_data->ret);
389401
if (ret != HG_SUCCESS) {
390402
// HG_LOG_ERROR("Proc error");
391-
return ret;
403+
FUNC_LEAVE(ret);
392404
}
393-
return ret;
405+
406+
FUNC_LEAVE(ret);
394407
}
395408

396409
/***************************************/

0 commit comments

Comments
 (0)