File: fs_gpfs_file_set_info.c

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (609 lines) | stat: -rw-r--r-- 26,327 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
/*
 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
 *                         University Research and Technology
 *                         Corporation.  All rights reserved.
 * Copyright (c) 2004-2011 The University of Tennessee and The University
 *                         of Tennessee Research Foundation.  All rights
 *                         reserved.
 * Copyright (c) 2004-2015 High Performance Computing Center Stuttgart,
 *                         University of Stuttgart.  All rights reserved.
 * Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
 * Copyright (c) 2008-2011 University of Houston. All rights reserved.
 * $COPYRIGHT$
 * 
 * Additional copyrights may follow
 * 
 * $HEADER$
 */

#include "ompi_config.h"
#include "fs_gpfs.h"
#include "mpi.h"
#include "ompi/constants.h"
#include "ompi/mca/fs/fs.h"
#include "ompi/mca/fs/base/base.h"

#include <unistd.h>
#include <string.h>

#include <gpfs.h>
#include <fcntl.h>
#include <errno.h>
#include <gpfs_fcntl.h>

/*
 *  file_set_info_gpfs
 *
 *  Function:   - set_info of a file
 *  Accepts:    - same arguments as MPI_File_set_info()
 *  Returns:    - Success if info is set
 */

int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info)
{
    int rc = 0;
    int flag;
    opal_cstring_t *info_str;
    char gpfsHintsKey[50];
    bool info_bool;
    const char* split = ",";
    char* token;
    int ret = OMPI_SUCCESS;
    ompi_info_t *info_selected;
    info_selected = info;
    gpfs_file_t gpfs_file_handle = fh->fd;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsAccessRange_t gpfsAccessRange;
    } gpfs_hint_AccessRange;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsFreeRange_t gpfsFreeRange;
    } gpfs_hint_FreeRange;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsClearFileCache_t gpfsClearFileCache;
    } gpfs_hint_ClearFileCache;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsCancelHints_t gpfsCancelHints;
    } gpfs_hint_CancelHints;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsSetReplication_t gpfsSetReplication;
    } gpfs_hint_SetReplication;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsByteRange_t gpfsByteRange;
    } gpfs_hint_ByteRange;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsRestripeData_t gpfsRestripeData;
    } gpfs_hint_RestripeData;

    //CN: TODO: Implement the following currently unused GPFS hints
    /*
    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsRestripeRange_t gpfsRestripeRange;
    } gpfs_hint_RestripeRange;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsGetReplication_t gpfsGetReplication;
    } gpfs_hint_GetReplication;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsGetStoragePool_t gpfsGetStoragePool;
    } gpfs_hint_GetStoragePool;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsGetFilesetName_t gpfsGetFilesetName;
    } gpfs_hint_GetFilesetName;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsGetSnapshotName_t gpfsGetSnapshotName;
    } gpfs_hint_GetSnapshotName;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsSetImmutable_t gpfsSetImmutable;
    } gpfs_hint_SetImmutable;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsGetImmutable_t gpfsGetImmutable;
    } gpfs_hint_GetImmutable;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsSetExpTime_t gpfsSetExpTime;
    } gpfs_hint_SetExpTime;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsGetExpTime_t gpfsGetExpTime;
    } gpfs_hint_GetExpTime;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsSetAppendOnly_t gpfsSetAppendOnly;
    } gpfs_hint_SetAppendOnly;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsGetAppendOnly_t gpfsGetAppendOnly;
    } gpfs_hint_GetAppendOnly;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsSetStoragePool_t gpfsSetStoragePool;
    } gpfs_hint_SetStoragePool;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsRangeArray_t gpfsRangeArray;
    } gpfs_hint_RangeArray;

    struct {
        gpfsFcntlHeader_t gpfsFcntlHeader;
        gpfsMultipleAccessRange_t gpfsMultipleAccessRange;
    } gpfs_hint_MultipleAccessRange;
    */

    strcpy(gpfsHintsKey, "useSIOXLib");
    ompi_info_get_bool(info_selected, gpfsHintsKey, &info_bool, &flag);
    if (flag) {
        if(info_bool) {
            //using the SIOX lib and the I/O pattern selection
            ret = mca_fs_gpfs_io_selection(fh, info, info_selected);
            if (ret != OMPI_SUCCESS)
                return ret;
        }
        else {
            //CN: Is there something left to do here?
            //TODO Sending the MPI_INFO to SIOX for knowledgebase
        }
    }

    //Setting GPFS Hint - gpfsAccessRange
    strcpy(gpfsHintsKey, "gpfsAccessRange");
    ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
    if (flag) {
        opal_output(ompi_fs_base_framework.framework_output,
                    "GPFS Access Range is set: %s: %s\n", gpfsHintsKey, info_str->string);
        gpfs_hint_AccessRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_AccessRange);
        gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
        gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlReserved = 0;

        gpfs_hint_AccessRange.gpfsAccessRange.structLen =
                sizeof(gpfs_hint_AccessRange.gpfsAccessRange);
        gpfs_hint_AccessRange.gpfsAccessRange.structType = GPFS_ACCESS_RANGE;
        char *info_str_dup = strdup(info_str->string);
        OBJ_RELEASE(info_str);
        token = strtok(info_str_dup, split);
        gpfs_hint_AccessRange.gpfsAccessRange.start = atol(token);
        token = strtok(NULL, split);
        gpfs_hint_AccessRange.gpfsAccessRange.length = atol(token);
        token = strtok(NULL, split);
        gpfs_hint_AccessRange.gpfsAccessRange.isWrite = atoi(token);
        free(info_str_dup);

        rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_AccessRange);
        if (rc != 0) {
            rc = errno;
            opal_output(ompi_fs_base_framework.framework_output,
                    "gpfs_hint_AccessRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n",
                    gpfs_file_handle, rc, strerror(rc));
            ret = OMPI_ERROR;
        }
    }

    //Setting GPFS Hint - gpfsFreeRange
    strcpy(gpfsHintsKey, "gpfsFreeRange");
    ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
    if (flag) {
        opal_output(ompi_fs_base_framework.framework_output,
                    "GPFS Free Range is set: %s: %s\n", gpfsHintsKey, info_str->string);
        gpfs_hint_FreeRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_FreeRange);
        gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
        gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlReserved = 0;

        gpfs_hint_FreeRange.gpfsFreeRange.structLen =
                sizeof(gpfs_hint_FreeRange.gpfsFreeRange);
        gpfs_hint_FreeRange.gpfsFreeRange.structType = GPFS_FREE_RANGE;
        char *info_str_dup = strdup(info_str->string);
        OBJ_RELEASE(info_str);
        token = strtok(info_str_dup, split);
        gpfs_hint_FreeRange.gpfsFreeRange.start = atol(token);
        token = strtok(NULL, split);
        gpfs_hint_FreeRange.gpfsFreeRange.length = atol(token);
        free(info_str_dup);

        rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_FreeRange);
        if (rc != 0) {
            rc = errno;
            opal_output(ompi_fs_base_framework.framework_output,
                    "gpfs_hint_FreeRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n",
                    gpfs_file_handle, rc, strerror(rc));
            ret = OMPI_ERROR;
        }
    }

    //CN: TODO
    //Setting GPFS Hint - gpfsRangeArray
    //Setting GPFS Hint - gpfsMultipleAccessRange

    //Setting GPFS Hint - gpfsClearFileCache
    strcpy(gpfsHintsKey, "gpfsClearFileCache");
    ompi_info_get_bool(info_selected, gpfsHintsKey, &info_bool, &flag);
    if (flag && info_bool) {
        opal_output(ompi_fs_base_framework.framework_output,
                    "GPFS Clear File Cache is set: %s\n", gpfsHintsKey);
        gpfs_hint_ClearFileCache.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ClearFileCache);
        gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
        gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlReserved = 0;

        gpfs_hint_ClearFileCache.gpfsClearFileCache.structLen =
                sizeof(gpfs_hint_ClearFileCache.gpfsClearFileCache);
        gpfs_hint_ClearFileCache.gpfsClearFileCache.structType = GPFS_CLEAR_FILE_CACHE;

        rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ClearFileCache);
        if (rc != 0) {
            rc = errno;
            opal_output(ompi_fs_base_framework.framework_output,
                    "gpfs_hint_ClearFileCache gpfs_fcntl(file handle: %d): Error number is %d, %s\n",
                    gpfs_file_handle, rc, strerror(rc));
            ret = OMPI_ERROR;
        }
    }

    //Setting GPFS Hint - gpfsCancelHints
    strcpy(gpfsHintsKey, "gpfsCancelHints");
    ompi_info_get_bool(info_selected, gpfsHintsKey, &info_bool, &flag);
    if (flag && info_bool) {
        opal_output(ompi_fs_base_framework.framework_output,
                    "GPFS Cancel Hints is set: %s\n", gpfsHintsKey);
        gpfs_hint_CancelHints.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_CancelHints);
        gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
        gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlReserved = 0;

        gpfs_hint_CancelHints.gpfsCancelHints.structLen =
                sizeof(gpfs_hint_CancelHints.gpfsCancelHints);
        gpfs_hint_CancelHints.gpfsCancelHints.structType = GPFS_CANCEL_HINTS;

        rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_CancelHints);
        if (rc != 0) {
            rc = errno;
            opal_output(ompi_fs_base_framework.framework_output,
                    "gpfs_hint_CancelHints gpfs_fcntl(file handle: %d): Error number is %d, %s\n",
                    gpfs_file_handle, rc, strerror(rc));
            ret = OMPI_ERROR;
        }
    }

    //Setting GPFS Hint - gpfsSetReplication
    strcpy(gpfsHintsKey, "gpfsSetReplication");
    ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
    if (flag) {
        opal_output(ompi_fs_base_framework.framework_output,
                    "GPFS Set Replication is set: %s: %s\n", gpfsHintsKey, info_str->string);
        gpfs_hint_SetReplication.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_SetReplication);
        gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
        gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlReserved = 0;

        gpfs_hint_SetReplication.gpfsSetReplication.structLen =
                sizeof(gpfs_hint_SetReplication.gpfsSetReplication);
        gpfs_hint_SetReplication.gpfsSetReplication.structType = GPFS_FCNTL_SET_REPLICATION;
        char *info_str_dup = strdup(info_str->string);
        OBJ_RELEASE(info_str);
        token = strtok(info_str_dup, split);
        gpfs_hint_SetReplication.gpfsSetReplication.metadataReplicas = atoi(token);
        gpfs_hint_SetReplication.gpfsSetReplication.maxMetadataReplicas = atoi(token);
        gpfs_hint_SetReplication.gpfsSetReplication.dataReplicas = atoi(token);
        gpfs_hint_SetReplication.gpfsSetReplication.maxDataReplicas = atoi(token);
        gpfs_hint_SetReplication.gpfsSetReplication.reserved = 0;
        free(info_str_dup);

        rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_SetReplication);
        if (rc != 0) {
            rc = errno;
            opal_output(ompi_fs_base_framework.framework_output,
                    "gpfs_hint_SetReplication gpfs_fcntl(file handle: %d): Error number is %d, %s\n",
                    gpfs_file_handle, rc, strerror(rc));
            ret = OMPI_ERROR;
        }
    }

    //CN: TODO
    //Setting GPFS Hint - gpfsSetStoragePool

    //Setting GPFS Hint - gpfsByteRange
    strcpy(gpfsHintsKey, "gpfsByteRange");
    ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
    if (flag) {
        opal_output(ompi_fs_base_framework.framework_output,
                    "GPFS Byte Range is set: %s: %s\n", gpfsHintsKey, info_str->string);
        gpfs_hint_ByteRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ByteRange);
        gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
        gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlReserved = 0;

        char *info_str_dup = strdup(info_str->string);
        OBJ_RELEASE(info_str);
        token = strtok(info_str_dup, split);
        gpfs_hint_ByteRange.gpfsByteRange.startOffset = atol(token);
        token = strtok(NULL, split);
        gpfs_hint_ByteRange.gpfsByteRange.numOfBlks = atol(token);
        free(info_str_dup);

        rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ByteRange);
        if (rc != 0) {
            rc = errno;
            opal_output(ompi_fs_base_framework.framework_output,
                    "gpfs_hint_ByteRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n",
                    gpfs_file_handle, rc, strerror(rc));
            ret = OMPI_ERROR;
        }
    }

    //Setting GPFS Hint - gpfsRestripeData
    strcpy(gpfsHintsKey, "gpfsRestripeData");
    ompi_info_get(info_selected, gpfsHintsKey, &info_str, &flag);
    if (flag) {
        opal_output(ompi_fs_base_framework.framework_output,
                    "GPFS Restripe Data is set: %s: %s\n", gpfsHintsKey, info_str->string);
        gpfs_hint_RestripeData.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_RestripeData);
        gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION;
        gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlReserved = 0;

        gpfs_hint_RestripeData.gpfsRestripeData.structLen =
                sizeof(gpfs_hint_RestripeData.gpfsRestripeData);
        gpfs_hint_RestripeData.gpfsRestripeData.structType = GPFS_FCNTL_RESTRIPE_DATA;
        char *info_str_dup = strdup(info_str->string);
        OBJ_RELEASE(info_str);
        token = strtok(info_str_dup, split);
        gpfs_hint_RestripeData.gpfsRestripeData.options = atoi(token);
        gpfs_hint_RestripeData.gpfsRestripeData.reserved1 = 0;
        gpfs_hint_RestripeData.gpfsRestripeData.reserved2 = 0;
        free(info_str_dup);

        rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_RestripeData);
        if (rc != 0) {
            rc = errno;
            opal_output(ompi_fs_base_framework.framework_output,
                    "gpfs_hint_RestripeData gpfs_fcntl(file handle: %d): Error number is %d, %s\n",
                    gpfs_file_handle, rc, strerror(rc));
            ret = OMPI_ERROR;
        }
    }

    //CN: TODO
    //Setting GPFS Hint - gpfsRestripeRange
    //Setting GPFS Hint - gpfsGetReplication
    //Setting GPFS Hint - gpfsGetStoragePool
    //Setting GPFS Hint - gpfsGetFilesetName
    //Setting GPFS Hint - gpfsGetSnapshotName
    //Setting GPFS Hint - gpfsSetImmutable
    //Setting GPFS Hint - gpfsGetImmutable
    //Setting GPFS Hint - gpfsSetExpTime
    //Setting GPFS Hint - gpfsGetExpTime
    //Setting GPFS Hint - gpfsSetAppendOnly
    //Setting GPFS Hint - gpfsGetAppendOnly

    return ret;
}

//CN: Will this function set info keys with siox prefix?
//CN: Where shall the knowledge of the optimization of GPFS hints go? Into Open MPI or into SIOX?
//CN: Never ever exit! Open MPI requires error propagation.
int mca_fs_gpfs_io_selection(ompio_file_t *fh,
        struct ompi_info_t *info, struct ompi_info_t *info_selected) {

//CN: configure option to enable/disable SIOX support?
#ifdef HAVE_C_SIOX_H
    char value[MPI_MAX_INFO_VAL + 1], sioxHintsKey[50], optimal_value_str[MPI_MAX_INFO_VAL + 1];
    int rc = 0, valueLen = MPI_MAX_INFO_VAL, flag;
    //START SIOX initialization
    if (siox_gpfs_uiid == SIOX_INVALID_ID){
        siox_gpfs_uiid = siox_system_information_lookup_interface_id("MPI",
            "Generic");
        if (!siox_component_is_registered(siox_gpfs_uiid)){
            fprintf(stderr, "SIOX Component MPI Generic is NOT registered!\n");
            siox_gpfs_component = siox_component_register(siox_gpfs_uiid, "GPFS");
        }
        siox_gpfs_component_activity = siox_component_register_activity(
            siox_gpfs_uiid, "MPI_File_open");
    }
    //DEBUG: fprintf(stderr, "Beginning the SIOX_activity in mca_fs_gpfs_siox_io_selection()\n");

    fh->f_siox_component = siox_gpfs_component;
    fh->f_siox_activity = siox_activity_begin(siox_gpfs_component,
            siox_gpfs_component_activity);
    siox_activity_start(fh->f_siox_activity);
    //END SIOX initialization

    info_selected = info;

    //DEBUG: fprintf(stderr, "Starting setting the SIOX_activity_attribute\n");
//CN: Why we need all attributes as an dynamic array?
//CN: Only one element used at a time to be added to mpi_info object at a time
    siox_attribute **siox_attribute_array;
    //START Registering the SIOX activities' attributes
    //Make sure how many SIOX activities' attributes should be registered
    int i = 0;
    int number_of_info = opal_list_get_size(&(info_selected->super));
    //DEBUG: fprintf(stderr, "The size of number_of_info is: %d\n", number_of_info);

//CN: Why we need all attributes as an dynamic array?
//CN: Where is the corresponding free?
    siox_attribute_array = (siox_attribute **) malloc(
                           sizeof(siox_attribute*) * number_of_info);
    if (siox_attribute_array == 0) {
        //DEBUG: fprintf(stderr, "assign siox_attribute_array fail, out of memory!\n");
        return OMPI_ERROR;
    }
    //END Registering the SIOX activities' attributes
    // Setting the fileNameAttribute
    siox_attribute_array[i] = siox_ontology_register_attribute("MPI",
                "descriptor/filename", SIOX_STORAGE_STRING);
    siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], fh->f_filename);
    i++;

//CN: Code duplication en mass (9 times same code block with changing key!)
//CN: do this with a loop over a list of sioxHintsKeys
    //START setting the siox activity attributes
    strcpy(sioxHintsKey, "sioxAccessRange");
    ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag);
    if (flag) {
        printf("Setting sioxAccessRange hints to SIOX activity attribute.\n");
        siox_attribute_array[i] = siox_ontology_register_attribute("GPFS",
                "sioxAccessRange", SIOX_STORAGE_STRING);
        siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], &value);
        if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) {
            printf("Getting optimal value of sioxAccessRange hints from SIOX: %s \n", optimal_value_str);
            ompi_info_set(info_selected, sioxHintsKey, optimal_value_str);
        }
        i++;
    }

    strcpy(sioxHintsKey, "sioxFreeRange");
    ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag);
    if (flag) {
        //DEBUG: fprintf(stderr, "Setting sioxFreeRange hints to SIOX activity attribute.\n");
        siox_attribute_array[i] = siox_ontology_register_attribute("GPFS",
                "sioxFreeRange", SIOX_STORAGE_STRING);
        siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], &value);
        if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) {
            //DEBUG: fprintf(stderr, "Getting optimal value of sioxFreeRange hints from SIOX: %s \n", optimal_value_str);
            ompi_info_set(info_selected, sioxHintsKey, optimal_value_str);
        }
        i++;
    }

    strcpy(sioxHintsKey, "sioxClearFileCache");
    ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag);
    if (flag) {
        //DEBUG: fprintf(stderr, "Setting sioxClearFileCache hints to SIOX activity attribute.\n");
        siox_attribute_array[i] = siox_ontology_register_attribute("GPFS",
                "sioxClearFileCache", SIOX_STORAGE_STRING);
        siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], &value);
        if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) {
            printf("Getting optimal value of sioxClearFileCache hints from SIOX: %s \n", optimal_value_str);
            ompi_info_set(info_selected, sioxHintsKey, optimal_value_str);
        }
        i++;
    }

    strcpy(sioxHintsKey, "sioxCancelHints");
    ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag);
    if (flag) {
        //DEBUG: fprintf(stderr, "Setting sioxCancelHints hints to SIOX activity attribute.\n");
        siox_attribute_array[i] = siox_ontology_register_attribute("GPFS",
                "sioxCancelHints", SIOX_STORAGE_STRING);
        siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], &value);
        if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) {
            //DEBUG: fprintf(stderr, "Getting optimal value of sioxCancelHints hints from SIOX: %s \n", optimal_value_str);
            ompi_info_set(info_selected, sioxHintsKey, optimal_value_str);
        }
        i++;
    }

    strcpy(sioxHintsKey, "sioxDataShipStart");
    ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag);
    if (flag) {
        //DEBUG: fprintf(stderr, "Setting sioxDataShipStart hints to SIOX activity attribute.\n");
        siox_attribute_array[i] = siox_ontology_register_attribute("GPFS",
                "sioxDataShipStart", SIOX_STORAGE_STRING);
        siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], &value);
        if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) {
            printf("Getting optimal value of sioxDataShipStart hints from SIOX: %s \n", optimal_value_str);
            ompi_info_set(info_selected, sioxHintsKey, optimal_value_str);
        }
        i++;
    }

    strcpy(sioxHintsKey, "sioxDataShipStop");
    ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag);
    if (flag) {
        printf("Setting sioxDataShipStop hints to SIOX activity attribute.\n");
        siox_attribute_array[i] = siox_ontology_register_attribute("GPFS",
                "sioxDataShipStop", SIOX_STORAGE_STRING);
        siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], &value);
        if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) {
            //DEBUG: fprintf(stderr, "Getting optimal value of sioxDataShipStop hints from SIOX: %s \n", optimal_value_str);
            ompi_info_set(info_selected, sioxHintsKey, optimal_value_str);
        }
        i++;
    }

    strcpy(sioxHintsKey, "sioxSetReplication");
    ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag);
    if (flag) {
        //DEBUG: fprintf(stderr, "Setting sioxSetReplication hints to SIOX activity attribute.\n");
        siox_attribute_array[i] = siox_ontology_register_attribute("GPFS",
                "sioxSetReplication", SIOX_STORAGE_STRING);
        siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], &value);
        if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) {
            //DEBUG: fprintf(stderr, "Getting optimal value of sioxSetReplication hints from SIOX: %s \n", optimal_value_str);
            ompi_info_set(info_selected, sioxHintsKey, optimal_value_str);
        }
        i++;
    }

    strcpy(sioxHintsKey, "sioxByteRange");
    ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag);
    if (flag) {
        //DEBUG: fprintf(stderr, "Setting sioxByteRange hints to SIOX activity attribute.\n");
        siox_attribute_array[i] = siox_ontology_register_attribute("GPFS",
                "sioxByteRange", SIOX_STORAGE_STRING);
        siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], &value);
        if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) {
            //DEBUG: fprintf(stderr, "Getting optimal value of sioxByteRange hints from SIOX: %s \n", optimal_value_str);
            ompi_info_set(info_selected, sioxHintsKey, optimal_value_str);
        }
        i++;
    }

    strcpy(sioxHintsKey, "sioxRestripeData");
    ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag);
    if (flag) {
        //DEBUG: fprintf(stderr, "Setting sioxRestripeData hints to SIOX activity attribute.\n");
        siox_attribute_array[i] = siox_ontology_register_attribute("GPFS",
                "sioxRestripeData", SIOX_STORAGE_STRING);
        siox_activity_set_attribute(fh->f_siox_activity,
                siox_attribute_array[i], &value);
        if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) {
            //DEBUG: fprintf(stderr, "Getting optimal value of sioxRestripeData hints from SIOX: %s \n", optimal_value_str);
            ompi_info_set(info_selected, sioxHintsKey, optimal_value_str);
        }
        i++;
    }

    //DEBUG: fprintf(stderr, "Stopping and ending the SIOX activity in mca_fs_gpfs_siox_io_selection()\n");
    siox_activity_stop(fh->f_siox_activity);
    siox_activity_end(fh->f_siox_activity);
#else
    info_selected = info;
#endif /* HAVE_C_SIOX_H */
    return OMPI_SUCCESS;
}